diff options
Diffstat (limited to 'xc')
927 files changed, 124381 insertions, 31419 deletions
diff --git a/xc/Imakefile b/xc/Imakefile index 1cdcba7ff..d5dd66db9 100644 --- a/xc/Imakefile +++ b/xc/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.5 2000/08/17 19:41:44 cpqbld Exp $ -XCOMM $XFree86: xc/Imakefile,v 3.24 2001/02/07 18:53:11 dawes Exp $ +XCOMM $XFree86: xc/Imakefile,v 3.25 2001/03/21 17:36:43 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" @@ -18,7 +18,9 @@ RELEASE = XOrgReleaseString FONTSDIR = fonts #endif #ifndef Win32Architecture +#if BuildDocs DOCSDIR = doc +#endif NLSSUBDIR = nls #endif #endif diff --git a/xc/Makefile b/xc/Makefile index 371aedf7f..dead6dae2 100644 --- a/xc/Makefile +++ b/xc/Makefile @@ -2,7 +2,7 @@ -# $XFree86: xc/Makefile,v 3.20 2001/01/24 17:28:53 tsi Exp $ +# $XFree86: xc/Makefile,v 3.21 2001/03/03 22:03:43 tsi Exp $ # Luna users will need to either run make as "make MAKE=make" # or add "MAKE = make" to this file. @@ -184,7 +184,7 @@ dangerous_strip_clean: $(MAKE_CMD) $@ distclean: $(MAKE_CMD) $@ - $(RM) xmakefile + $(RM) xmakefile $(IRULESRC)/version.def depend: $(MAKE_CMD) $@ Everything: diff --git a/xc/RELNOTES b/xc/RELNOTES index cc3da8198..cfc789500 100644 --- a/xc/RELNOTES +++ b/xc/RELNOTES @@ -17,7 +17,7 @@ significant redesign of the XFree86 X server. 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. Our Driver Status document summarizes how the hardware driver support compares between 3.3.6 and 4.0.2. Please -check there first before downloading 4.0.2. +check there first before downloading 4.0.2. The 4.0.1 release introduced a new graphical configuration tool, "xf86cfg", and a text mode interface was added to it for the 4.0.2 release. It is work @@ -824,34 +824,35 @@ via DDC, you may want to add that information to XF86Config. To allow a graceful transition for applications moving from core text render- ing to the Render extension, Xft can use either core fonts or FreeType and -the Render extension for text. By default, Xft is configured to support only -core fonts, see the section on building FreeType support for the changes -needed to add FreeType/Render fonts. +the Render extension for text. By default, Xft is configured to support both +core fonts and FreeType fonts using the supplied version of FreeType 2. See +the section on FreeType support in Xft for instructions on configuring +XFree86 to use an existing FreeType installation. The Xft library uses a configuration file, XftConfig, which contains informa- tion about which directories contain font files and also provides a sophisti- cated font aliasing mechanism. Documentation for that file is included in the Xft man page. -4.11.2 Building FreeType support for Xft +4.11.2 FreeType support in Xft -XFree86 4.0.2 includes sources for FreeType version 2.0.1, but they are not -built and installed automatically. As a result, Xft is configured to provide -only core fonts by default. +XFree86 4.0.2 includes sources for FreeType version 2.0.1, and, by default, +they are built and installed automatically. -To build FreeType support for Xft, first FreeType must be built and -installed, either from the sources included in XFree86 in extras/freetype2 or -from another FreeType (version 2.0.1 or later) release. Early FreeType ver- -sion 2 releases used a different header file installation and aren't compati- -ble with XFree86. Instructions for building and installing FreeType can be -found in the INSTALL file included with the FreeType release. +If you prefer, you can configure XFree86 4.0.2 to use an existing Freetype2 +installation by telling XFree86 not to build the internal copy and indicating +where that external version has been installed. Edit (or create) con- +fig/cf/host.def to include: -Second, XFree86 needs to know the installed location for FreeType, usually -/usr/local. Edit (or create) config/cf/host.def to include: + o #define BuildFreetype2Library NO - #define Freetype2Dir /usr/local + o #define Freetype2Dir /usr/local -Finally, build XFree86 with "make World" from the top. +Note that XFree86 assumes you'll be using a release FreeType no older than +version 2.0.1. Early FreeType version 2 releases used a different header +file installation and aren't compatible with XFree86. Instructions for build- +ing and installing FreeType can be found in the INSTALL file included with +the FreeType release. 4.11.3 Application Support For Anti-Aliased Text @@ -871,8 +872,8 @@ instead: Xditview will use Xft instead of the core API by default. X11perf includes tests to measure the performance of text rendered in three ways, anti- aliased, anti-aliased with sub-pixel sampling and regular chunky text, but -through the Render extension, a path which has not been optimized within the -X server yet. +through the Render extension, a path which is currently somewhat slower than +core text. 4.12 Other extensions @@ -1081,7 +1082,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.58 2000/12/17 23:01:10 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.60 2001/03/02 17:40:48 dawes Exp $ -$XFree86: xc/RELNOTES,v 1.1 2000/12/18 02:45:46 dawes Exp $ +$XFree86: xc/RELNOTES,v 1.2 2001/03/02 17:48:40 dawes Exp $ diff --git a/xc/config/cf/FreeBSD.cf b/xc/config/cf/FreeBSD.cf index 33539b1bb..bba0c012f 100644 --- a/xc/config/cf/FreeBSD.cf +++ b/xc/config/cf/FreeBSD.cf @@ -2,7 +2,7 @@ XCOMM platform: $Xorg: FreeBSD.cf,v 1.3 2000/08/17 19:41:45 cpqbld Exp $ XCOMM XCOMM XCOMM -XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.104 2001/01/17 16:22:29 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.106 2001/03/02 23:01:27 dawes Exp $ #ifndef UseElfFormat #define UseElfFormat DefaultToElfFormat @@ -66,6 +66,38 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define InstallXloadSetGID YES #endif +/* + * Multi-thread safe libs + */ +/* 2.2.7 and later has libc_r (POSIX threads) */ +#if OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 7 || \ + OSMajorVersion >= 3 +# ifndef HasLibPthread +# define HasLibPthread NO +# endif +# define HasPosixThreads YES +# define ThreadedX YES +/* + * math.h uses _REENTRANT and stdio.h uses _THREAD_SAFE, so define both. + */ +# define SystemMTDefines -D_REENTRANT -D_THREAD_SAFE +/* + * FreeBSD has tread-safe api but no getpwnam_r yet. + */ +# define HasThreadSafeAPI YES +# define MTSafeAPIDefines -DXUSE_MTSAFE_API -DXNO_MTSAFE_PWDAPI +# if HasLibPthread +# define ThreadsLibraries -lpthread +# else +# define BuildThreadStubLibrary YES +# define NeedUIThrStubs YES +# define ThreadsCompileFlags -pthread +# define ThreadsLibraries -pthread +# define SharedX11Reqs $(LDPRELIB) $(XTHRSTUBLIB) +# define SharedXtReqs $(LDPRELIB) $(XLIBONLY) $(SMLIB) $(ICELIB) $(XTHRSTUBLIB) +# endif +#endif + #define AvoidNullMakeCommand YES #define StripInstalledPrograms YES #define CompressAllFonts YES @@ -88,7 +120,32 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define HasFlex YES #endif -#define CcCmd cc +#ifndef HasMktemp +#if (OSMajorVersion >= 4) || (OSMajorVersion == 3 && OSMinorVersion >= 1) || \ + (OSMajorVersion == 2 && OSMinorVersion == 2 && OSTeenyVersion >= 7) +#define HasMktemp YES +#else +#define HasMktemp NO +#endif +#endif + +/* + * Add an LD_LIBRARY_PATH environment variable, defined by $(CLIENTENVSETUP), + * when building X to avoid that for each client ld give the message + * + * ld: warning: libXThrStub.so.6, needed by libX11.so, not found + */ +#if BuildThreadStubLibrary && !UseInstalled +# define CcCmd $(CLIENTENVSETUP) cc +# define CplusplusCmd $(CLIENTENVSETUP) c++ +#else +# define CcCmd cc +# define CplusplusCmd c++ +#endif + +#define CppCmd /usr/bin/cpp +#define PreProcessCmd CppCmd +#define StandardCppOptions -traditional #define CppCmd /usr/bin/cpp #define PreProcessCmd CppCmd #define StandardCppOptions -traditional @@ -218,8 +275,10 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe /* PAM appeared in FreeBSD 3.1 */ #if (OSMajorVersion > 3) || (OSMajorVersion == 3 && OSMinorVersion >=1 ) +#ifndef HasPam #define HasPam YES #endif +#endif /* * For FreeBSD 2.2.5 and later don't make any assumptions about the version diff --git a/xc/config/cf/Imake.rules b/xc/config/cf/Imake.rules index 7058bf43b..4aeca765f 100644 --- a/xc/config/cf/Imake.rules +++ b/xc/config/cf/Imake.rules @@ -5,7 +5,7 @@ XCOMM XCOMM XCOMM XCOMM -XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.92 2001/02/07 23:28:44 dawes Exp $ +XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.93 2001/03/31 01:57:20 keithp Exp $ /* * MACHINE-INDEPENDENT RULES; DO NOT MODIFY @@ -2273,7 +2273,7 @@ clean:: @@\ #ifndef SwitchYYPrefix #define SwitchYYPrefix(in,out,prefix) \ - sed 's/yy/prefix/g' in > out && RemoveFile(in) + sed 's/yy/prefix/g' in | sed 's/__REALLY_YY__/yy/' > out && RemoveFile(in) #endif #ifndef LexFilePrefix diff --git a/xc/config/cf/Imake.tmpl b/xc/config/cf/Imake.tmpl index 9084eb62d..73f4a7547 100644 --- a/xc/config/cf/Imake.tmpl +++ b/xc/config/cf/Imake.tmpl @@ -5,7 +5,7 @@ XCOMM XCOMM XCOMM XCOMM -XCOMM $XFree86: xc/config/cf/Imake.tmpl,v 3.95 2001/02/13 17:20:09 tsi Exp $ +XCOMM $XFree86: xc/config/cf/Imake.tmpl,v 3.97 2001/03/18 14:50:30 dawes Exp $ XCOMM ---------------------------------------------------------------------- /* @@ -408,6 +408,9 @@ XCOMM the platform-specific parameters - edit site.def to change #define HasCplusplus NO #endif #endif +#ifndef HasMktemp +#define HasMktemp NO /* if you have the mktemp command */ +#endif #ifndef HasNdbm #define HasNdbm NO #endif @@ -445,6 +448,10 @@ XCOMM the platform-specific parameters - edit site.def to change #ifndef GzipLibrary /* if OS config didn't define it, assume it's -lz */ #define GzipLibrary -lz #endif +/* If the system has the Freetype2 library */ +#ifndef HasFreetype2 +#define HasFreetype2 NO +#endif #if HasKrbIV #ifndef KrbIVIncludes #define KrbIVIncludes /**/ diff --git a/xc/config/cf/OpenBSD.cf b/xc/config/cf/OpenBSD.cf index b076d72fb..2433ec460 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.49 2001/02/03 19:33:04 herrb Exp $ +XCOMM platform: $XFree86: xc/config/cf/OpenBSD.cf,v 3.52 2001/03/03 09:52:59 herrb Exp $ XCOMM #ifndef OSName @@ -78,6 +78,14 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define HasLibPthread NO #endif +#ifndef HasMktemp +# if (OSMajorVersion > 2) || (OSMajorVersion == 2 && OSMinorVersion >= 1) +# define HasMktemp YES +# else +# define HasMktemp NO +# endif +#endif + /* * Multi-thread safe libs */ @@ -95,9 +103,8 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe # endif #endif -#if OSMajorVersion == 2 && OSMinorVersion > 6 || OSMajorVersion >= 3 -# define HasThreadSafeAPI YES -#endif +/* Set this to YES when getpwuid_r is added to libc_r */ +# define HasThreadSafeAPI NO /* * Compiler Features @@ -151,7 +158,11 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe # define LdPostLib /**/ # define ServerExtraDefines GccGasOption XFree86ServerDefines # ifndef XFree86ConsoleDefines -# define XFree86ConsoleDefines -DPCCONS_SUPPORT -DWSCONS_SUPPORT -DPCVT_SUPPORT +# if OSMajorVersion == 2 && OSMinorVersion <= 8 +# define XFree86ConsoleDefines -DPCCONS_SUPPORT -DPCVT_SUPPORT +# else +# define XFree86ConsoleDefines -DWSCONS_SUPPORT +# endif # endif #endif diff --git a/xc/config/cf/X11.tmpl b/xc/config/cf/X11.tmpl index d34fcb8aa..8e650f616 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.99 2001/02/09 00:35:02 keithp Exp $ +XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.111 2001/04/05 02:43:33 dawes Exp $ /*************************************************************************** * * @@ -23,10 +23,12 @@ XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.99 2001/02/09 00:35:02 keithp Exp $ * InstallAppDefaults (class) * InstallAppDefaultsLong (file,class) * MakeFontsDir (deplist) + * MakeXftCache (deplist) * MakeFonts () * InstallFontObjs (objs,dest) * InstallFonts (dest) * InstallFontAliases (dest) + * InstallXftCache (dest) * FontSrc (basename) * FontBaseObj (basename) * InstallFontScale (dest) @@ -79,6 +81,15 @@ VENDORMANVERSION = XVendorManVersionString #ifndef BuildServersOnly #define BuildServersOnly NO #endif +#ifndef BuildClients +#define BuildClients !BuildServersOnly +#endif +#ifndef BuildDocs +#define BuildDocs !BuildServersOnly +#endif +#ifndef BuildLibraries +#define BuildLibraries (!BuildServersOnly || BuildClients) +#endif #ifndef BuildFontServer #define BuildFontServer YES #endif @@ -121,14 +132,93 @@ VENDORMANVERSION = XVendorManVersionString #ifndef BuildCIDFonts #define BuildCIDFonts YES #endif +/* Not used now */ #ifndef BuildLatin2Fonts -#define BuildLatin2Fonts NO +#define BuildLatin2Fonts YES #endif #ifndef BuildCyrillicFonts -#define BuildCyrillicFonts NO +#define BuildCyrillicFonts YES #endif #ifndef UseKoi8RForCyrillic -#define UseKoi8RForCyrillic NO +#define UseKoi8RForCyrillic YES +#endif +/* Some bdf font generation details. The scripts for this require perl. */ +#ifndef TruncateUCSFonts +#define TruncateUCSFonts HasPerl +#endif +#ifndef MaxUCSChar +#define MaxUCSChar 0x3200 +#endif +#ifndef DerivedUCSFonts +#define DerivedUCSFonts HasPerl +#endif +/* These primarily control generation of derived 8-bit fonts. */ +#ifndef BuildUCSFonts +#define BuildUCSFonts YES +#endif +/* Setting BuildISO8859_1Fonts to NO may result in problems. */ +#ifndef BuildISO8859_1Fonts +#define BuildISO8859_1Fonts YES +#endif +#ifndef BuildISO8859_2Fonts +#define BuildISO8859_2Fonts YES +#endif +#ifndef BuildISO8859_3Fonts +#define BuildISO8859_3Fonts YES +#endif +#ifndef BuildISO8859_4Fonts +#define BuildISO8859_4Fonts YES +#endif +#ifndef BuildISO8859_5Fonts +#define BuildISO8859_5Fonts BuildCyrillicFonts +#endif +#ifndef BuildArabicFonts +#define BuildArabicFonts YES +#endif +#ifndef BuildISO8859_6Fonts +#define BuildISO8859_6Fonts BuildArabicFonts +#endif +#ifndef BuildGreekFonts +#define BuildGreekFonts YES +#endif +#ifndef BuildISO8859_7Fonts +#define BuildISO8859_7Fonts BuildGreekFonts +#endif +#ifndef BuildHebrewFonts +#define BuildHebrewFonts YES +#endif +#ifndef BuildISO8859_8Fonts +#define BuildISO8859_8Fonts BuildHebrewFonts +#endif +#ifndef BuildISO8859_9Fonts +#define BuildISO8859_9Fonts YES +#endif +#ifndef BuildISO8859_10Fonts +#define BuildISO8859_10Fonts YES +#endif +#ifndef BuildISO8859_13Fonts +#define BuildISO8859_13Fonts YES +#endif +#ifndef BuildISO8859_14Fonts +#define BuildISO8859_14Fonts YES +#endif +#ifndef BuildISO8859_15Fonts +#define BuildISO8859_15Fonts YES +#endif +#ifndef BuildKOI8_RFonts +#define BuildKOI8_RFonts BuildCyrillicFonts +#endif +#ifndef BuildJapaneseFonts +#define BuildJapaneseFonts YES +#endif +#ifndef BuildJISX0201Fonts +#define BuildJISX0201Fonts BuildJapaneseFonts +#endif +#ifndef BuildKoreanFonts +#define BuildKoreanFonts YES +#endif +#ifndef BuildChineseFonts +#define BuildChineseFonts YES #endif #ifndef HasXAudio #define HasXAudio NO @@ -166,9 +256,15 @@ VENDORMANVERSION = XVendorManVersionString #ifndef BuildPexExt #define BuildPexExt NO #endif +#ifndef BuildPexLib +#define BuildPexLib (BuildPex && !BuildServersOnly) +#endif #ifndef BuildXInputExt #define BuildXInputExt NO #endif +#ifndef BuildXInputLib +#define BuildXInputLib (BuildXInputExt && !BuildServersOnly) +#endif #ifndef BuildEVI #define BuildEVI YES #endif @@ -188,7 +284,7 @@ VENDORMANVERSION = XVendorManVersionString #define BuildFontCache YES #endif #ifndef BuildFontCacheLib -#define BuildFontCacheLib BuildFontCache +#define BuildFontCacheLib (BuildFontCache && !BuildServersOnly) #endif #ifndef BuildLowMem #define BuildLowMem NO @@ -208,16 +304,16 @@ VENDORMANVERSION = XVendorManVersionString #endif #endif #ifndef BuildXIElib -#define BuildXIElib BuildXIE +#define BuildXIElib (BuildXIE && !BuildServersOnly) #endif #ifndef BuildXKB #define BuildXKB YES #endif #ifndef BuildXKBlib -#define BuildXKBlib BuildXKB +#define BuildXKBlib (BuildXKB && !BuildServersOnly) #endif #ifndef BuildXKBuilib -#define BuildXKBuilib BuildXKB +#define BuildXKBuilib (BuildXKB && !BuildServersOnly) #endif /* * WARNING: Setting UseXKBInClients to YES cause incompatibilities @@ -240,7 +336,7 @@ VENDORMANVERSION = XVendorManVersionString #define BuildXinerama NO #endif #ifndef BuildXineramaLibrary -#define BuildXineramaLibrary BuildXinerama +#define BuildXineramaLibrary (BuildXinerama && !BuildServersOnly) #endif #ifndef BuildXCSecurity #define BuildXCSecurity YES @@ -274,23 +370,26 @@ VENDORMANVERSION = XVendorManVersionString #define BuildXprint NO #endif #endif +#ifndef BuildXprintLib +#define BuildXprintLib (BuildXprint && !BuildServersOnly) +#endif #ifndef BuildScreenSaverExt #define BuildScreenSaverExt NO #endif #ifndef BuildScreenSaverLibrary -#define BuildScreenSaverLibrary BuildScreenSaverExt +#define BuildScreenSaverLibrary (BuildScreenSaverExt && !BuildServersOnly) #endif #ifndef BuildXF86VidModeExt #define BuildXF86VidModeExt NO #endif #ifndef BuildXF86VidModeLibrary -#define BuildXF86VidModeLibrary BuildXF86VidModeExt +#define BuildXF86VidModeLibrary (BuildXF86VidModeExt && !BuildServersOnly) #endif #ifndef BuildXF86MiscExt #define BuildXF86MiscExt NO #endif #ifndef BuildXF86MiscLibrary -#define BuildXF86MiscLibrary BuildXF86MiscExt +#define BuildXF86MiscLibrary (BuildXF86MiscExt && !BuildServersOnly) #endif #ifndef BuildXF86BigfontExt #define BuildXF86BigfontExt NO @@ -299,31 +398,31 @@ VENDORMANVERSION = XVendorManVersionString #define BuildXF86DGA NO #endif #ifndef BuildXF86DGALibrary -#define BuildXF86DGALibrary BuildXF86DGA +#define BuildXF86DGALibrary (BuildXF86DGA && !BuildServersOnly) #endif #ifndef BuildXvExt #define BuildXvExt NO #endif #ifndef BuildXvLibrary -#define BuildXvLibrary BuildXvExt -#endif -#ifndef BuildGLULibrary -#define BuildGLULibrary NO +#define BuildXvLibrary (BuildXvExt && !BuildServersOnly) #endif #ifndef BuildGlxExt #define BuildGlxExt NO #endif #ifndef BuildGLXLibrary -#define BuildGLXLibrary BuildGlxExt +#define BuildGLXLibrary (BuildGlxExt && !BuildServersOnly) +#endif +#ifndef BuildGLULibrary +#define BuildGLULibrary (BuildGLXLibrary && HasCplusplus) #endif #ifndef BuildXF86RushExt #define BuildXF86RushExt NO #endif #ifndef BuildXF86RushLibrary -#define BuildXF86RushLibrary BuildXF86RushExt +#define BuildXF86RushLibrary (BuildXF86RushExt && !BuildServersOnly) #endif #ifndef BuildDPSLibraries -#define BuildDPSLibraries YES +#define BuildDPSLibraries !BuildServersOnly #endif #ifndef BuildDPSLibrary #define BuildDPSLibrary BuildDPSLibraries @@ -334,17 +433,23 @@ VENDORMANVERSION = XVendorManVersionString #ifndef BuildPSResLibrary #define BuildPSResLibrary BuildDPSLibraries #endif +#ifndef BuildDPSClients +#define BuildDPSClients BuildDPSLibraries +#endif #ifndef BuildRender #define BuildRender NO #endif #ifndef BuildRenderLibrary -#define BuildRenderLibrary YES +#define BuildRenderLibrary !BuildServersOnly #endif #ifndef BuildXftLibrary #define BuildXftLibrary BuildRenderLibrary #endif +#ifndef UseFreetype2 +#define UseFreetype2 BuildXftLibrary +#endif #ifndef BuildFreetype2Library -#define BuildFreetype2Library BuildXftLibrary +#define BuildFreetype2Library (UseFreetype2 && !HasFreetype2) #endif #ifndef BuildMiscDocs @@ -416,6 +521,9 @@ VENDORMANVERSION = XVendorManVersionString #ifndef ThreadedProject #define ThreadedProject ThreadedX #endif +#ifndef BuildThreadStubLibrary +#define BuildThreadStubLibrary NO +#endif #ifndef HasWChar32 #define HasWChar32 SystemV4 #endif @@ -1248,7 +1356,12 @@ XCOMM X Window System make variables; these need to be coordinated with rules RGB = $(CLIENTENVSETUP) $(XBUILDBINDIR)/rgb FONTC = $(CLIENTENVSETUP) $(XBUILDBINDIR)/bdftopcf MKFONTDIR = $(CLIENTENVSETUP) $(XBUILDBINDIR)/mkfontdir + XFTCACHE = $(CLIENTENVSETUP) $(XBUILDBINDIR)/xftcache +#if HasPerl + MKHTMLINDEX = RunPerlScript($(CONFIGSRC)/util/mkhtmlindex.pl,) +#else MKHTMLINDEX = $(SHELL) $(CONFIGSRC)/util/mkhtmlindex.sh +#endif UCS2ANY = $(FONTSRC)/util/ucs2any.pl BDFTRUNCATE = $(FONTSRC)/util/bdftruncate.pl UCSMAPPREFIX = $(FONTSRC)/util/map- @@ -1561,6 +1674,12 @@ ProjectUnsharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBSRC),XBuildLibDir) #ifndef ProfileLibGlx #define ProfileLibGlx NO #endif +#ifndef BuildLibGlxWithoutPIC +#define BuildLibGlxWithoutPIC NO +#endif +#if BuildLibGlxWithoutPIC && SharedLibGlx +#define SharedLibGlxWithoutPIC YES +#endif #ifndef LinkGLToUsrLib #define LinkGLToUsrLib NO #endif @@ -1756,7 +1875,7 @@ ProjectUnsharedLibReferences(PSRES,psres,$(PSRESLIBSRC),XBuildLibDir) #endif #if BuildGLULibrary - GLULIBSRC = $(LIBSRC)/GL/glu + GLULIBSRC = $(LIBSRC)/GLU #if SharedLibGlu #ifndef SharedGluRev #define SharedGluRev 1.3 @@ -1890,6 +2009,28 @@ SharedDSLibReferences(XMU,Xmu,$(XMUSRC),SOXMUREV,SharedXmuRev) ProjectUnsharedLibReferences(XMU,Xmu,$(XMUSRC),XBuildLibDir) #endif +#ifndef SharedLibXmuu +#define SharedLibXmuu HasSharedLibraries +#endif +#ifndef NormalLibXmuu +#define NormalLibXmuu (!SharedLibXmuu | ForceNormalLib) +#endif +#ifndef DebugLibXmuu +#define DebugLibXmuu NO /* debugged Xmuu library */ +#endif +#ifndef ProfileLibXmuu +#define ProfileLibXmuu NO /* profiled Xmuu library */ +#endif + XMUUSRC = $(LIBSRC)/Xmuu +#if SharedLibXmuu +#ifndef SharedXmuuRev +#define SharedXmuuRev 1.0 +#endif +SharedLibReferences(XMUU,Xmuu,$(XMUUSRC),SOXMUUREV,SharedXmuuRev) +#else +ProjectUnsharedLibReferences(XMUU,Xmuu,$(XMUUSRC),XBuildLibDir) +#endif + #ifndef SharedOldX #define SharedOldX HasSharedLibraries #endif @@ -2299,15 +2440,18 @@ SharedLibReferences(FREETYPE2,freetype,$(FREETYPE2LIBSRC),SOFREETYPE2REV,SharedF ProjectUnsharedLibReferences(FREETYPE2,freetype,$(FREETYPE2LIBSRC),XBuildLibDir) #endif +#if UseFreetype2 + #if BuildFreetype2Library FREETYPE2INCLUDES=$(TOP_X_INCLUDES)/freetype2 FREETYPE2DEFINES=-DFREETYPE2 -#define HasFreetype2 YES #else -#ifdef Freetype2Dir +#if HasFreetype2 -#define HasFreetype2 YES +#ifndef Freetype2Dir +#define Freetype2Dir /usr +#endif #ifndef Freetype2LibDir #define Freetype2LibDir Freetype2Dir/lib @@ -2326,9 +2470,6 @@ FREETYPE2DEFINES = -DFREETYPE2 #endif #endif - -#ifndef HasFreetype2 -#define HasFreetype2 NO #endif #ifndef SharedLibXft @@ -2354,10 +2495,25 @@ ProjectUnsharedLibReferences(XFT,Xft,$(XFTLIBSRC),XBuildLibDir) #endif #ifndef XftClientDepLibs +#if UseFreetype2 #define XftClientDepLibs $(DEPXFTLIB) $(DEPFREETYPE2LIB) $(DEPXRENDERLIB) +#else +#define XftClientDepLibs $(DEPXFTLIB) $(DEPXRENDERLIB) +#endif #endif #ifndef XftClientLibs +#if UseFreetype2 #define XftClientLibs $(XFTLIB) $(FREETYPE2LIB) $(XRENDERLIB) +#else +#define XftClientLibs $(XFTLIB) $(XRENDERLIB) +#endif +#endif + +#ifndef XmuuClientDepLibs +#define XmuuClientDepLibs $(DEPXMUULIB) $(DEPXLIB) +#endif +#ifndef XmuuClientLibs +#define XmuuClientLibs $(XMUULIB) $(XLIB) #endif #ifndef LdLibraryPath @@ -2396,7 +2552,7 @@ ProjectUnsharedLibReferences(XKBFILE,xkbfile,$(XKBFILELIBSRC),XBuildLibDir) #endif #endif /* BuildXKBlib */ -#ifdef BuildXKBuilib +#if BuildXKBuilib XKBUILIBSRC = $(LIBSRC)/xkbui ProjectUnsharedLibReferences(XKBUI,xkbui,$(XKBUILIBSRC),XBuildLibDir) #ifndef XkbuiLibs @@ -2481,6 +2637,41 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #endif /* InstallAppDefaultsLong */ /* + * MakeXftCache - generate rules to build XftCache database + */ + +#ifdef UseFreetype2 + +#ifndef MakeXftCache +#define MakeXftCache(deplist) @@\ +all:: XftCache @@\ + @@\ +XftCache: deplist @@\ + RunProgram(XFTCACHE, $(XFTCACHEOPTS) .) @@\ + @@\ +clean:: @@\ + RemoveFile(XftCache) +#endif /* MakeXftCache */ + +#ifndef InstallXftCache +#define InstallXftCache(dest) @@\ +InstallTarget(install,XftCache,$(INSTDATFLAGS),dest) +#endif /* InstallXftCache */ + +#else + +#ifndef MakeXftCache +#define MakeXftCache(deplist) +#endif + +#ifndef InstallXftCache +#define InstallXftCache(dest) +#endif + +#endif + + +/* * MakeFontsDir - generate rules to build fonts.dir database. */ #ifndef MakeFontsDir @@ -2858,3 +3049,33 @@ clean:: @@\ InstallDoc(name,deps) #endif + +/* + * Rule for maintainers to use to updated generated copies of fonts in the + * source tree. Use with care. + */ + +#ifndef UpdateDerivedFont +#define UpdateDerivedFont(src,dst) @@\ +update.fonts:: src @@\ + -@if [ -f dst ]; then \ @@\ + if [ "$(FORCEUPDATE)" = yes ]; then \ @@\ + if [ "$(FOLLOWLINK)" = no ]; then \ @@\ + (set -x; $(RM) dst); \ @@\ + fi; \ @@\ + set -x; cp src dst; \ @@\ + else \ @@\ + grep -v "XFree86:" src > __tmp1__; \ @@\ + grep -v "XFree86:" dst > __tmp2__; \ @@\ + if diff __tmp1__ __tmp2__ > /dev/null 2>&1; then :; \ @@\ + else \ @@\ + if [ "$(FOLLOWLINK)" = no ]; then \ @@\ + (set -x; $(RM) dst); \ @@\ + fi; \ @@\ + set -x; cp src dst; \ @@\ + fi; \ @@\ + fi; \ @@\ + fi @@\ + @$(RM) __tmp1__ __tmp2__ +#endif + diff --git a/xc/config/cf/bsdLib.tmpl b/xc/config/cf/bsdLib.tmpl index 49c616a89..b0c890515 100644 --- a/xc/config/cf/bsdLib.tmpl +++ b/xc/config/cf/bsdLib.tmpl @@ -1,5 +1,5 @@ XCOMM $Xorg: bsdLib.tmpl,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ -XCOMM $XFree86: xc/config/cf/bsdLib.tmpl,v 3.7 2001/01/17 16:22:31 dawes Exp $ +XCOMM $XFree86: xc/config/cf/bsdLib.tmpl,v 3.8 2001/03/02 23:01:27 dawes Exp $ /* * NetBSD/FreeBSD/OpenBSD shared library template @@ -47,7 +47,9 @@ XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) #define SharedX11Reqs #endif #define SharedOldXReqs $(LDPRELIB) $(XLIBONLY) +#ifndef SharedXtReqs #define SharedXtReqs $(LDPRELIB) $(XLIBONLY) $(SMLIB) $(ICELIB) +#endif #define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) #define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) diff --git a/xc/config/cf/cross.def b/xc/config/cf/cross.def index 5a6a407fe..1e24e12cb 100644 --- a/xc/config/cf/cross.def +++ b/xc/config/cf/cross.def @@ -1,4 +1,4 @@ -/* $XFree86: xc/config/cf/cross.def,v 1.1 2000/12/08 22:09:34 keithp Exp $ */ +/* $XFree86: xc/config/cf/cross.def,v 1.2 2001/03/30 02:15:17 keithp Exp $ */ /* * This file contains redefinitions of some symbols to enable * cross compilation: e.g. paths for include files and paths to @@ -20,6 +20,9 @@ #undef PostIncDir #define PostIncDir /skiff/local/lib/gcc-lib/arm-linux/2.95.2/include #define CcCmd /skiff/local/bin/arm-linux-gcc +#undef CplusplusCmd +#define HasCplusplus YES +#define CplusplusCmd /skiff/local/bin/arm-linux-g++ #define DoRanlibCmd YES #define RanlibCmd /skiff/local/bin/arm-linux-ranlib #undef ExtraLoadFlags diff --git a/xc/config/cf/darwin.cf b/xc/config/cf/darwin.cf index 70f3cca2f..e101a3dce 100644 --- a/xc/config/cf/darwin.cf +++ b/xc/config/cf/darwin.cf @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.6 2001/02/02 21:40:40 herrb Exp $ +XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.9 2001/03/26 02:55:59 torrey Exp $ /* Darwin / Mac OS X configuration by John Carmack <johnc@idsoftware.com> */ @@ -62,6 +62,11 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.6 2001/02/02 21:40:40 herrb Exp $ #endif #endif +/* flags to pass to cc when building libraries */ +#ifndef LibraryCCOptions +# define LibraryCCOptions DefaultCCOptions -fno-common +#endif + /* A lot of xfree86 code needs __powerpc__ to avoid doing outport asm. * * __DARWIN__ will be used for platform specific #ifdefs that can't @@ -98,12 +103,8 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.6 2001/02/02 21:40:40 herrb Exp $ /* no Display Power Management extension */ #define BuildDPMSExt NO -/* no Render extension */ -#define BuildRender NO - #define BuildXvExt NO - /* no OpenGL libraries */ #ifndef BuildGLXLibrary # define BuildGLXLibrary NO @@ -112,7 +113,20 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.6 2001/02/02 21:40:40 herrb Exp $ # define BuildGLULibrary NO #endif +#define BuildLibPathVar DYLD_LIBRARY_PATH + +/* include rules to build shared libraries */ +#include <darwinLib.rules> -/* include all the xfree rules */ -/* I haven't tracked down why this is needed, but it is... */ +/* + * Darwin specific Imake Config files + */ +#ifndef LocalConfigFiles +#define LocalConfigFiles \ + darwinLib.rules \ + darwinLib.tmpl +#endif + +/* include all the XFree86 rules */ #include <xfree86.cf> + diff --git a/xc/config/cf/darwinLib.rules b/xc/config/cf/darwinLib.rules new file mode 100644 index 000000000..863daef5a --- /dev/null +++ b/xc/config/cf/darwinLib.rules @@ -0,0 +1,156 @@ +XCOMM $XFree86: xc/config/cf/darwinLib.rules,v 1.1 2001/03/13 02:36:12 torrey Exp $ +/* + * Darwin/Mac OS X shared library rules + */ + +#ifndef UseElfFormat +#define UseElfFormat NO +#endif +#ifndef HasSharedLibraries +#define HasSharedLibraries YES +#endif +#ifndef ForceNormalLib +#define ForceNormalLib YES +#endif + +#ifndef SharedDataSeparation +#define SharedDataSeparation NO +#endif +#ifndef SharedCodeDef +#define SharedCodeDef /**/ +#endif +#ifndef SharedLibraryDef +#define SharedLibraryDef /**/ +#endif +#ifndef ShLibIncludeFile +#define ShLibIncludeFile <darwinLib.tmpl> +#endif +#ifndef SharedLibraryLoadFlags +#define SharedLibraryLoadFlags -dynamiclib -undefined suppress +#endif +#ifndef PositionIndependentCFlags +#define PositionIndependentCFlags -dynamic +#endif +#ifndef ExtraLoadFlags +#define ExtraLoadFlags /**/ +#endif + +/* + * InstallSharedLibrary - generate rules to install the shared library. + */ +#ifndef InstallSharedLibrary +#define InstallSharedLibrary(libname,rev,dest) @@\ +install:: Concat(lib,libname.rev.dylib) @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.rev.dylib) $(DESTDIR)dest @@\ + @MAJREV=`expr rev : '\(.*\)\.'`; \ @@\ + set -x; $(RM) Concat($(DESTDIR)dest/lib,libname.$$MAJREV.dylib) && \ @@\ + $(LN) Concat(lib,libname.rev.dylib) Concat($(DESTDIR)dest/lib,libname.$$MAJREV.dylib) @@\ + @if $(SOSYMLINK); then (set -x; \ @@\ + $(RM) Concat($(DESTDIR)dest/lib,libname.dylib); \ @@\ + $(LN) Concat(lib,libname.rev.dylib) Concat($(DESTDIR)dest/lib,libname.dylib)); fi +#endif /* InstallSharedLibrary */ + +/* + * SharedLibraryTarget - generate rules to create a shared library; + * build it into a different name so that we do not hose people by having + * the library gone for long periods. + */ +#ifndef SharedLibraryTarget +#ifdef UseInstalled +#define LinkBuildSonameLibrary(lib) true +#else +#define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); \ + cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .) +#endif + +#define SharedLibraryTarget(libname,rev,solist,down,up) @@\ +AllTarget(Concat(lib,libname.rev.dylib)) @@\ + @@\ +Concat(lib,libname.rev.dylib): solist $(EXTRALIBRARYDEPS) @@\ + $(RM) $@~ @@\ + @MAJREV=`expr rev : '\(.*\)\.'`; \ @@\ + INSTALLNAME=Concat(lib,libname.$$MAJREV.dylib); \ @@\ + set -x; (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -install_name $(USRLIBDIR)/$$INSTALLNAME -current_version rev -compatibility_version rev solist $(REQUIREDLIBS)); \ @@\ + $(RM) $$INSTALLNAME; $(LN) $@ $$INSTALLNAME; \ @@\ + LinkBuildSonameLibrary($$INSTALLNAME) @@\ + $(RM) $@ @@\ + $(MV) $@~ $@ @@\ + @if $(SOSYMLINK); then (set -x; \ @@\ + $(RM) Concat(lib,libname.dylib); \ @@\ + $(LN) $@ Concat(lib,libname.dylib)); fi @@\ + LinkBuildLibrary($@) @@\ + LinkBuildLibraryMaybe(Concat(lib,libname.dylib),$(SOSYMLINK)) @@\ + @@\ +clean:: @@\ + @MAJREV=`expr rev : '\(.*\)\.'`; \ @@\ + set -x; $(RM) Concat(lib,libname.$$MAJREV.dylib) @@\ + $(RM) Concat(lib,libname.rev.dylib) Concat(lib,libname.dylib) + +#endif /* SharedLibraryTarget */ + +/* + * SharedDepLibraryTarget - generate rules to create a shared library. + */ +#ifndef SharedDepLibraryTarget +#ifdef UseInstalled +#ifndef LinkBuildSonameLibrary +#define LinkBuildSonameLibrary(lib) true +#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) @@\ +AllTarget(Concat(lib,libname.rev.dylib)) @@\ + @@\ +Concat(lib,libname.rev.dylib): deplist $(EXTRALIBRARYDEPS) @@\ + $(RM) $@~ @@\ + @MAJREV=`expr rev : '\(.*\)\.'`; \ @@\ + INSTALLNAME=Concat(lib,libname.$$MAJREV.dylib); \ @@\ + set -x; (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -install_name $(USRLIBDIR)/$$INSTALLNAME -current_version rev -compatibility_version rev solist $(REQUIREDLIBS)); \ @@\ + $(RM) $$INSTALLNAME; $(LN) $@ $$INSTALLNAME; \ @@\ + LinkBuildSonameLibrary($$INSTALLNAME) @@\ + $(RM) $@ @@\ + $(MV) $@~ $@ @@\ + @if $(SOSYMLINK); then (set -x; \ @@\ + $(RM) Concat(lib,libname.dylib); \ @@\ + $(LN) $@ Concat(lib,libname.dylib)); fi @@\ + LinkBuildLibrary($@) @@\ + LinkBuildLibraryMaybe(Concat(lib,libname.dylib),$(SOSYMLINK)) @@\ + @@\ +clean:: @@\ + @MAJREV=`expr rev : '\(.*\)\.'`; \ @@\ + set -x; $(RM) Concat(lib,libname.$$MAJREV.dylib) @@\ + $(RM) Concat(lib,libname.rev.dylib) Concat(lib,libname.dylib) + +#endif /* SharedDepLibraryTarget */ + +#ifndef SharedDepModuleTarget +#define SharedDepModuleTarget(name,deps,solist) @@\ +AllTarget(name) @@\ + @@\ +name: deps @@\ + $(RM) $@~ @@\ + $(CC) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) @@\ + $(RM) $@ @@\ + $(MV) $@~ $@ @@\ + @@\ +clean:: @@\ + $(RM) name + +#endif /* SharedDepModuleTarget */ + +/* + * SharedLibraryDataTarget - generate rules to create shlib data file; + */ +#ifndef SharedLibraryDataTarget +#define SharedLibraryDataTarget(libname,rev,salist) +#endif /* SharedLibraryDataTarget */ + +#ifndef InstallSharedLibraryData +#define InstallSharedLibraryData(libname,rev,dest) +#endif /* InstallSharedLibraryData */ diff --git a/xc/config/cf/darwinLib.tmpl b/xc/config/cf/darwinLib.tmpl new file mode 100644 index 000000000..36ccfcd5b --- /dev/null +++ b/xc/config/cf/darwinLib.tmpl @@ -0,0 +1,35 @@ +XCOMM $XFree86: xc/config/cf/darwinLib.tmpl,v 1.1 2001/03/13 02:36:12 torrey Exp $ +/* + * Darwin/Mac OS X shared library template + */ + +#ifndef FixupLibReferences +#define FixupLibReferences() @@\ +XMULIBONLY = -lXmu @@\ +XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) +#endif + +#ifndef XawClientLibs +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#endif + +#define CplusplusLibC +#define FrescoSysLibs CplusplusLibC MathLibrary + +/* Allow for libpthread, as overridden by OS definitions */ +#if !defined(SharedX11Reqs) +#define SharedX11Reqs +#endif +#define SharedOldXReqs $(LDPRELIB) $(XLIBONLY) +#define SharedXtReqs $(LDPRELIB) $(XLIBONLY) $(SMLIB) $(ICELIB) +#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) MathLibrary +#define SharedXtstReqs $(LDPRELIB) $(XLIB) +#define SharedXieReqs $(LDPRELIB) $(XLIBONLY) +#define SharedSMReqs $(LDPRELIB) $(ICELIB) +#define SharedFrescoReqs $(LDPRELIB) $(XLIBONLY) FrescoSysLibs +#define SharedXtfReqs $(LDPRELIB) $(FRESCOLIB) $(XTOOLLIB) $(XLIB) FrescoSysLibs diff --git a/xc/config/cf/gnu.cf b/xc/config/cf/gnu.cf index 3b5862e84..a9764952d 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.10 2000/11/30 23:29:55 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/gnu.cf,v 1.11 2001/02/28 18:58:49 dawes Exp $ #ifndef OSName #define OSName DefaultOSName @@ -37,12 +37,11 @@ XCOMM #define SystemMTDefines -D_REENTRANT #define HasLibCrypt YES #endif -#define BuildLibPathVar LD_LIBRARY_PATH -#define HasGcc YES -#define HasGcc2 YES -#ifndef HasGcc2ForCplusplus -# define HasGcc2ForCplusplus YES +#ifndef BuildXF86RushExt +# define BuildXF86RushExt YES #endif + +#define BuildLibPathVar LD_LIBRARY_PATH #define GccUsesGas YES #define UseGas YES #define GnuCpp YES @@ -124,7 +123,7 @@ XCOMM Not implemented and will always fail. #define StandardCppDefines StandardDefines #define HasVarRun YES -#define VarDbDirectory $(VARDIR)/state +#define VarDbDirectory $(VARDIR)/lib XCOMM i386Architecture #define OptimizedCDebugFlags DefaultGcc2i386Opt diff --git a/xc/config/cf/linux.cf b/xc/config/cf/linux.cf index 57be0c752..38e1275a1 100644 --- a/xc/config/cf/linux.cf +++ b/xc/config/cf/linux.cf @@ -4,7 +4,7 @@ XCOMM platform: $Xorg: linux.cf,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ -XCOMM platform: $XFree86: xc/config/cf/linux.cf,v 3.160 2001/01/30 22:06:14 tsi Exp $ +XCOMM platform: $XFree86: xc/config/cf/linux.cf,v 3.162 2001/04/03 02:29:30 dawes Exp $ #ifndef LinuxElfDefault # define LinuxElfDefault YES @@ -271,6 +271,14 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # endif #endif +/* + * Build shared libGL and the DRI modules without -fPIC. This improves + * performance. + */ +#if BuildXF86DRI +# define BuildLibGlxWithoutPIC YES +#endif + /* The DRM module requires kernel services that appeared in late 2.1.x kernels and are known to be present in 2.2.x kernels. Unfortunately, the kernel API is a moving target and the module may break with new @@ -588,21 +596,27 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #endif #ifdef i386Architecture -# define OptimizedCDebugFlags DefaultGcc2i386Opt +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags DefaultGcc2i386Opt +# endif # define LinuxMachineDefines -D__i386__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* i386Architecture */ #ifdef s390Architecture -#define OptimizedCDebugFlags -O2 -#define LinuxMachineDefines -D__s390__ -#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET -#define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O2 +# endif +# define LinuxMachineDefines -D__s390__ +# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* s390Architecture */ #ifdef AlphaArchitecture -# define OptimizedCDebugFlags DefaultGcc2AxpOpt +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags DefaultGcc2AxpOpt +# endif # define LinuxMachineDefines -D__alpha__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 @@ -613,21 +627,27 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #ifdef Arm32Architecture # define DefaultCCOptions -fsigned-char -# define OptimizedCDebugFlags -O3 +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O3 +# endif # define LinuxMachineDefines -D__arm__ -U__arm -Uarm # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Arm32Achitecture */ #ifdef ia64Architecture -# define OptimizedCDebugFlags -O2 +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O2 +# endif # define LinuxMachineDefines -D__ia64__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* ia64Architecture */ #ifdef Mc68020Architecture -# define OptimizedCDebugFlags -O2 +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O2 +# endif # define LinuxMachineDefines -D__mc68000__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines @@ -637,14 +657,18 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #ifdef PpcArchitecture # define DefaultCCOptions -fsigned-char -# define OptimizedCDebugFlags -O2 +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O2 +# endif # define LinuxMachineDefines -D__powerpc__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* PpcArchitecture */ #ifdef SparcArchitecture -# define OptimizedCDebugFlags -O2 +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O2 +# endif # define LinuxMachineDefines -D__sparc__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines @@ -657,7 +681,9 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #endif #ifdef MipsArchitecture -# define OptimizedCDebugFlags -O2 +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O2 +# endif # define LinuxMachineDefines -D__mips__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines diff --git a/xc/config/cf/osf1.cf b/xc/config/cf/osf1.cf index b731d9e51..397f94ccc 100644 --- a/xc/config/cf/osf1.cf +++ b/xc/config/cf/osf1.cf @@ -1,6 +1,10 @@ XCOMM platform: $Xorg: osf1.cf,v 1.3 2000/08/17 19:41:48 cpqbld Exp $ /* only tested with Digital OSF/1 */ + + +XCOMM platform: $XFree86: xc/config/cf/osf1.cf,v 3.9 2001/03/02 02:45:33 dawes Exp $ + #ifndef OSName # define OSName DefaultOSName #endif diff --git a/xc/config/cf/xf86site.def b/xc/config/cf/xf86site.def index 114ec3693..9c54ca29c 100644 --- a/xc/config/cf/xf86site.def +++ b/xc/config/cf/xf86site.def @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/config/cf/xf86site.def,v 3.171 2001/02/11 21:39:36 herrb Exp $ +XCOMM $XFree86: xc/config/cf/xf86site.def,v 3.173 2001/04/05 19:29:36 dawes Exp $ /******************************************************************************/ /* * This file is to provide a quick method for most people to change the @@ -253,7 +253,7 @@ XCOMM $XFree86: xc/config/cf/xf86site.def,v 3.171 2001/02/11 21:39:36 herrb Exp * #define XF86CardDrivers mga glint nv tga s3virge sis rendition \ neomagic i740 tdfx savage \ - cirrus tseng trident chips apm \ + cirrus vmware tseng trident chips apm \ GlideDriver fbdev i128 \ ati AgpGartDrivers DevelDrivers ark cyrix \ siliconmotion \ @@ -748,9 +748,4 @@ XCOMM $XFree86: xc/config/cf/xf86site.def,v 3.171 2001/02/11 21:39:36 herrb Exp #define X86EMU_LIBPATH /usr/local/lib */ -/* - * By default, gccmakedep uses mktemp for security reasons. - * Uncomment this, if your system lacks mktemp. - * -#define HasMktemp NO - */ + diff --git a/xc/config/cf/xfree86.cf b/xc/config/cf/xfree86.cf index 8e3e621ac..57ac75dc6 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.346 2001/02/11 21:39:36 herrb Exp $ +XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.354 2001/04/05 21:29:09 dawes Exp $ /* * This configuration file contains all of the configuration * information for the XFree86 based X Servers. @@ -104,6 +104,30 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ #define XLogFile XFree86 #endif + /* + * BuildXFree86ConfigTools: + * + * Turning this on allows the XFree86 config tools to build when + * BuildServersOnly is YES. This requires more than the servonly CVS + * module. This cannot be used to disable building the config tools with + * a full build. + */ +#ifndef BuildXFree86ConfigTools +#ifdef BuildServersOnly +#define BuildXFree86ConfigTools !BuildServersOnly +#else +#define BuildXFree86ConfigTools YES +#endif +#endif + +#if BuildXFree86ConfigTools +#define BuildLibraries YES +#define BuildXF86MiscLibrary YES +#define BuildXF86VidModeLibrary YES +#define BuildXKBlib YES +#define BuildXKBuilib YES +#endif + /* * Default settings for which X Servers to build. */ @@ -280,12 +304,20 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ # ifndef XF86CardDrivers # define XF86CardDrivers mga glint nv tga s3virge sis rendition \ neomagic i740 tdfx savage \ - cirrus tseng trident chips apm \ + cirrus vmware tseng trident chips apm \ GlideDriver fbdev i128 \ ati AgpGartDrivers DevelDrivers ark cyrix \ siliconmotion \ vesa vga XF86OSCardDrivers XF86ExtraCardDrivers # endif +# if HasGlide3 +# define TdfxDriDriver tdfx +# else +# define TdfxDriDriver /**/ +# endif +# ifndef DriDrivers +# define DriDrivers gamma TdfxDriDriver mga i810 r128 radeon sis +# endif #endif /* Sparc drivers */ @@ -357,6 +389,9 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ sunbw2 ati glint fbdev \ XF86OSCardDrivers XF86ExtraCardDrivers # endif +# ifndef DRIDrivers +# define DRIDrivers ffb +# endif #endif @@ -509,6 +544,14 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ savage nv DevelDrivers siliconmotion vga \ XF86OSCardDrivers XF86ExtraCardDrivers # endif +# if HasGlide3 +# define TdfxDriDriver tdfx +# else +# define TdfxDriDriver /**/ +# endif +# ifndef DriDrivers +# define DriDrivers gamma TdfxDriDriver mga r128 radeon +# endif #endif /* @@ -582,7 +625,7 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ # ifndef DevelDrivers # if XFree86Devel -# define DevelDrivers ati +# define DevelDrivers ati imstt # else # define DevelDrivers /* */ # endif @@ -591,7 +634,7 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers # define XF86CardDrivers mga glint s3virge sis savage\ - trident chips fbdev \ + trident chips tdfx fbdev \ DevelDrivers vga \ XF86OSCardDrivers XF86ExtraCardDrivers # endif @@ -689,6 +732,10 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 #if BuildXF86DRI +#ifndef BuildGLXLibrary +#define BuildGLXLibrary YES +#endif + /* * One and ONLY one of the GlxBuiltIn* drivers can be defined to be YES. * If more than one are defined, the compilation will fail with multiply @@ -734,6 +781,34 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 # define DRIDynLoadDefines -DGLX_USE_DLOPEN # endif +# if GlxUseBuiltInDRIDriver +# undef DriDrivers +# if GlxBuiltInGamma +# define DriDrivers gamma +# endif +# if GlxBuiltInTdfx +# define DriDrivers tdfx +# endif +# if GlxBuiltInMga +# define DriDrivers mga +# endif +# if GlxBuiltInI810 +# define DriDrivers i810 +# endif +# if GlxBuiltInR128 +# define DriDrivers r128 +# endif +# if GlxBuiltInRadeon +# define DriDrivers radeon +# endif +# if GlxBuiltInSIS +# define DriDrivers sis +# endif +# if GlxBuiltInFfb +# define DriDrivers ffb +# endif +# endif + #endif /* @@ -869,6 +944,7 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 #endif #endif +#if 0 /* * Build the extra extension libs even when not including the extra extensions * in the servers @@ -888,12 +964,10 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 #ifndef BuildXvLibrary # define BuildXvLibrary YES #endif -#ifndef BuildGLULibrary -# define BuildGLULibrary HasCplusplus -#endif #ifndef BuildGLXLibrary # define BuildGLXLibrary YES #endif +#endif /* * Build the XFree86-VidMode extension @@ -1064,7 +1138,7 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 (defined(LinuxArchitecture) && !defined(Mc68020Architecture) && \ !defined(PpcArchitecture)) || \ defined(i386BsdArchitecture) || defined(LynxOSArchitecture) || \ - defined(OS2Architecture) + defined(OS2Architecture) || defined(GNUMachArchitecture) # define BuildScanpci YES # else # define BuildScanpci NO @@ -1342,9 +1416,5 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese # endif #endif -#ifndef HasMktemp -#define HasMktemp YES -#endif - #include <xf86.rules> diff --git a/xc/config/imake/ccimake.c b/xc/config/imake/ccimake.c index 216b318bb..f8546699f 100644 --- a/xc/config/imake/ccimake.c +++ b/xc/config/imake/ccimake.c @@ -20,6 +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/ccimake.c,v 1.2 2001/04/01 13:59:56 tsi Exp $ */ /* * Warning: This file must be kept as simple as posible so that it can @@ -34,9 +35,10 @@ in this Software without prior written authorization from The Open Group . #define imake_ccflags "-O" #endif +int main() { write(1, imake_ccflags, sizeof(imake_ccflags) - 1); - exit(0); + return 0; } diff --git a/xc/config/imake/imakemdep.h b/xc/config/imake/imakemdep.h index 424e307b9..05c5b89f8 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.47 2001/01/19 08:13:28 dawes Exp $ */ +/* $XFree86: xc/config/imake/imakemdep.h,v 3.48 2001/03/27 00:21:17 torrey Exp $ */ /* @@ -219,11 +219,6 @@ in this Software without prior written authorization from The Open Group. #define FIXUP_CPP_WHITESPACE #endif -#if defined(__APPLE__) -#define DEFAULT_CPP "/usr/bin/cpp" -#endif - - #if defined(Lynx) /* On LynxOS 2.4.0 imake gets built with the old "legacy" * /bin/cc which has a rather pedantic builtin preprocessor. @@ -239,6 +234,9 @@ in this Software without prior written authorization from The Open Group. * If use cc -E but want a different compiler, define DEFAULT_CC. * If the cpp you need is not in /lib/cpp, define DEFAULT_CPP. */ +#if defined(__APPLE__) +#define DEFAULT_CPP "/usr/bin/cpp" +#endif #if defined(Lynx) || defined(__Lynx__) #define DEFAULT_CC "gcc" #define USE_CC_E @@ -650,13 +648,13 @@ char *cpp_argv[ARGUMENTS] = { #if defined(MIPS) "-DMIPS", #endif +#endif #if defined(__APPLE__) + "-D__APPLE__", "-D__DARWIN__", #endif -#endif - }; diff --git a/xc/config/pswrap/Imakefile b/xc/config/pswrap/Imakefile index abbf1d47f..8e997ab16 100644 --- a/xc/config/pswrap/Imakefile +++ b/xc/config/pswrap/Imakefile @@ -1,6 +1,6 @@ -XCOMM $XFree86: xc/config/pswrap/Imakefile,v 1.6 2000/06/07 21:58:25 tsi Exp $ +XCOMM $XFree86: xc/config/pswrap/Imakefile,v 1.7 2001/03/01 01:23:55 dawes Exp $ - FRIENDSDEF = -DFRIENDSFILE='"<DPS/dpsclient.h>"' + FRIENDSDEF = -DFRIENDSFILE='"<DPS/dpsfriends.h>"' DEFINES = -DXENVIRONMENT DEPLIBS = YFLAGS = -d diff --git a/xc/config/pswrap/pswfile.c b/xc/config/pswrap/pswfile.c index 5965e82bc..ff9674e7a 100644 --- a/xc/config/pswrap/pswfile.c +++ b/xc/config/pswrap/pswfile.c @@ -35,7 +35,7 @@ * * Author: Adobe Systems Incorporated */ -/* $XFree86: xc/config/pswrap/pswfile.c,v 1.4 2000/06/07 21:58:25 tsi Exp $ */ +/* $XFree86: xc/config/pswrap/pswfile.c,v 1.5 2001/03/01 01:23:55 dawes Exp $ */ #include <stdio.h> #include "pswversion.h" @@ -81,12 +81,11 @@ void InitOFile(void) #endif /* __MACH__ */ printf("#include %s\n", FRIENDSFILE); printf("#include <string.h>\n"); - if (special_h == 0) { - printf("#include \"%spsops.h\"\n\n", dpsops ? "d" : ""); - } else { + outlineno += 3; /* UPDATE this if you add more prolog */ + if (special_h) { printf("#include \"%s\"\n\n", special_h); + outlineno ++; } - outlineno += 4; /* UPDATE this if you add more prolog */ printf("#line 1 \"%s\"\n",ifile); outlineno++; } diff --git a/xc/config/pswrap/pswversion.h b/xc/config/pswrap/pswversion.h index b15f7bf4e..ab235df8a 100644 --- a/xc/config/pswrap/pswversion.h +++ b/xc/config/pswrap/pswversion.h @@ -35,7 +35,8 @@ * * Author: Adobe Systems Incorporated */ +/* $XFree86: xc/config/pswrap/pswversion.h,v 1.3 2001/03/02 02:45:34 dawes Exp $ */ -#define PSW_VERSION "V1.009 Wed Apr 19 17:50:24 PDT 1989" +#define PSW_VERSION "V1.009 XFree86" #define PSW_OS "unix" diff --git a/xc/config/util/Imakefile b/xc/config/util/Imakefile index 779235a75..880baf9dd 100644 --- a/xc/config/util/Imakefile +++ b/xc/config/util/Imakefile @@ -2,7 +2,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:41:52 cpqbld Exp $ -XCOMM $XFree86: xc/config/util/Imakefile,v 3.31 2001/02/11 21:39:37 herrb Exp $ +XCOMM $XFree86: xc/config/util/Imakefile,v 3.34 2001/03/21 20:25:00 dawes Exp $ #if UseCCMakeDepend MDEP_PROG = makedepend @@ -21,10 +21,6 @@ GCCMDEP_PROG = gccmakedep LNDIR_PROG = ProgramTargetName(lndir) #endif -#if HasMktemp -MKTEMPDEFINE = -DHAS_MKTEMP -#endif - #if BuildRman RMAN_PROG = ProgramTargetName(rman) #endif @@ -71,10 +67,10 @@ InstallNamedProg(exportlistgen,exportlistgen,$(BINDIR)) #endif CppScriptTarget(xmkmf,xmkmf.cpp,-DCONFIGDIRSPEC='"'"-I$(CONFIGDIR)"'"',$(ICONFIGFILES)) -CppScriptTarget(makedepend,mdepend.cpp,$(MKTEMPDEFINE) -DPREPROC='"'"$(PREPROCESSCMD_MKDEPEND)"'"',$(ICONFIGFILES)) +CppScriptTarget(makedepend,mdepend.cpp,-DPREPROC='"'"$(PREPROCESSCMD_MKDEPEND)"'"',$(ICONFIGFILES)) CppScriptTarget(mergelib,mergelib.cpp,"-DARCMD=$(AR)" "-DRANLIB=$(RANLIB)",$(ICONFIGFILES)) #ifndef OS2Architecture -CppScriptTarget(gccmakedep,gccmdep.cpp,$(MKTEMPDEFINE) -DCCCMD='"'"$(GCCCMD)"'"' -DRMCMD='"'"$(RM)"'"' -DLNCMD='"'"$(LN)"'"' -DMVCMD='"'"$(MV)"'"',$(ICONFIGFILES)) +CppScriptTarget(gccmakedep,gccmdep.cpp,-DCCCMD='"'"$(GCCCMD)"'"' -DRMCMD='"'"$(RM)"'"' -DLNCMD='"'"$(LN)"'"' -DMVCMD='"'"$(MV)"'"',$(ICONFIGFILES)) #endif #ifndef OpenBSDArchitecture @@ -134,8 +130,13 @@ InstallDriverSDKNamedProg(gccmakedep,gccmakedep,$(DRIVERSDKDIR)/config/util) InstallNamedProg(mergelib,mergelib,$(BINDIR)) InstallNamedProg(makeg.sh,makeg,$(BINDIR)) InstallManPage(makeg,$(MANDIR)) +InstallNamedProg(cleanlinks.sh,cleanlinks,$(BINDIR)) +#if HasPerl +InstallNamedProg(mkhtmlindex.pl,mkhtmlindex,$(BINDIR)) +#else InstallNamedProg(mkhtmlindex.sh,mkhtmlindex,$(BINDIR)) #endif +#endif InstallManPage(mkdirhier,$(MANDIR)) #if UseCCMakeDepend InstallNamedProg(makedepend,makedepend,$(BINDIR)) diff --git a/xc/config/util/cleanlinks.sh b/xc/config/util/cleanlinks.sh new file mode 100755 index 000000000..51252e28f --- /dev/null +++ b/xc/config/util/cleanlinks.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Copyright © 2000 by The XFree86 Project, Inc +# +# Remove dangling symlinks and empty directories from a shadow link tree +# (created with lndir). +# +# Author: David Dawes <dawes@xfree86.org> +# +# $XFree86: xc/config/util/cleanlinks.sh,v 1.1 2001/03/21 20:25:00 dawes Exp $ + +find . -type l -print | +( + read i + while [ X"$i" != X ]; do + if [ ! -f "$i" ]; then + echo $i is a dangling symlink, removing + rm -f "$i" + fi + read i + done +) + +echo Removing empty directories ... +find . -type d -depth -print | xargs rmdir > /dev/null 2>&1 +exit 0 diff --git a/xc/config/util/gccmdep.cpp b/xc/config/util/gccmdep.cpp index c6eaaa0b3..31c4a414f 100644 --- a/xc/config/util/gccmdep.cpp +++ b/xc/config/util/gccmdep.cpp @@ -3,7 +3,7 @@ XCOMM!/bin/sh XCOMM XCOMM makedepend which uses 'gcc -M' XCOMM -XCOMM $XFree86: xc/config/util/gccmdep.cpp,v 3.6 2001/01/26 23:01:44 herrb Exp $ +XCOMM $XFree86: xc/config/util/gccmdep.cpp,v 3.8 2001/03/15 18:39:00 tsi Exp $ XCOMM XCOMM Based on mdepend.cpp and code supplied by Hongjiu Lu <hjl@nynexst.com> XCOMM @@ -14,18 +14,6 @@ RM=RMCMD LN=LNCMD MV=MVCMD -XCOMM Security: if $tmp exists exit immediately -rm -f ${TMP} -if [ -e ${TMP} ] ; then - echo "$0: ${TMP} exists already, exit." 1>&2 - exit 1; -fi -#if defined(HAS_MKTEMP) -if [ -n "`type -p mktemp`" ] ; then - TMP="`mktemp ${TMP}.XXXXXX`" || exit 1 -fi -#endif - trap "$RM ${TMP}*; exit 1" 1 2 15 trap "$RM ${TMP}*; exit 0" 1 2 13 @@ -42,10 +30,10 @@ while [ $# != 0 ]; do endmarker= else case "$1" in - -D*|-I*) + -D*|-I*|-U*) args="$args '$1'" ;; - -g|-O) + -g*|-O*) ;; *) if [ "$endmarker"x = x ]; then @@ -60,12 +48,17 @@ XCOMM ignore these flags magic_string="$2" shift ;; - -f-) - makefile="-" - ;; - -f) - makefile="$2" - shift + -f*) + if [ "$1" = "-f-" ]; then + makefile="-" + elif [ "$1" = "-f" ]; then + makefile="$2" + shift + else + echo "$1" | sed 's/^\-f//' >${TMP}arg + makefile="`cat ${TMP}arg`" + rm -f ${TMP}arg + fi ;; --*) endmarker=`echo $1 | sed 's/^\-\-//'` diff --git a/xc/config/util/lndir.c b/xc/config/util/lndir.c index 99dbf00f6..72eeae414 100644 --- a/xc/config/util/lndir.c +++ b/xc/config/util/lndir.c @@ -22,7 +22,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/util/lndir.c,v 3.12 2001/02/11 22:04:07 herrb Exp $ */ +/* $XFree86: xc/config/util/lndir.c,v 3.13 2001/04/01 13:59:57 tsi Exp $ */ /* From the original /bin/sh script: @@ -42,6 +42,7 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xos.h> #include <X11/Xfuncproto.h> #include <stdio.h> +#include <stdlib.h> #include <sys/stat.h> #if !defined(MINIX) && !defined(Lynx) #include <sys/param.h> diff --git a/xc/config/util/mdepend.cpp b/xc/config/util/mdepend.cpp index 371e28bfb..364855551 100644 --- a/xc/config/util/mdepend.cpp +++ b/xc/config/util/mdepend.cpp @@ -22,7 +22,7 @@ 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.5 2001/02/11 21:39:37 herrb Exp $ +XCOMM $XFree86: xc/config/util/mdepend.cpp,v 3.7 2001/03/15 18:39:00 tsi Exp $ XCOMM CC=PREPROC @@ -36,18 +36,6 @@ TMPMAKEFILE=${TMP}c MAGICLINE=${TMP}d ARGS=${TMP}e -XCOMM Security: if $tmp exists exit immediately -rm -f ${TMP} -if [ -e ${TMP} ] ; then - echo "$0: ${TMP} exists already, exit." 1>&2 - exit 1; -fi -#if defined(HAS_MKTEMP) -if [ -n "`type -p mktemp`" ] ; then - TMP="`mktemp ${TMP}.XXXXXX`" || exit 1 -fi -#endif - trap "rm -f ${TMP}*; exit 1" 1 2 15 trap "rm -f ${TMP}*; exit 0" 1 2 13 @@ -78,7 +66,7 @@ do endmarker="" else case "$1" in - -D*|-I*) + -D*|-I*|-U*) echo $n " '$1'$c" >> $ARGS ;; @@ -99,9 +87,13 @@ do -f*) if [ "$1" = "-f-" ]; then makefile="-" - else + elif [ "$1" = "-f" ]; then makefile="$2" shift + else + echo "$1" | sed 's/^\-f//' >${TMP}arg + makefile="`cat ${TMP}arg`" + rm -f ${TMP}arg fi ;; -o) diff --git a/xc/config/util/mkhtmlindex.pl b/xc/config/util/mkhtmlindex.pl new file mode 100644 index 000000000..109253464 --- /dev/null +++ b/xc/config/util/mkhtmlindex.pl @@ -0,0 +1,103 @@ +#!/usr/bin/perl +# +# $XFree86: xc/config/util/mkhtmlindex.pl,v 1.3 2001/03/18 14:49:01 dawes Exp $ +# +# Copyright © 2000,2001 by VA Linux Systems, Inc. +# +# Generate index files for HTML man pages. +# +# Author: David Dawes <dawes@xfree86.org> +# + +# +# Best viewed with tabs set to 4 +# + +if ($#ARGV ne 0) { + print STDERR "Usage: mkhtmlindex.pl htmlmandir\n"; + exit 1; +} + +$dir = $ARGV[0]; + +if (! -d $dir) { + print STDERR "$dir is not a directory\n"; + exit 1; +} + +@vollist = ("1", "2", "3", "4", "5", "6", "7", "8", "9", "o", "l", "n", "p"); + +$indexprefix = "manindex"; + +foreach $vol (@vollist) { + $empty = "yes"; + $indexname="$dir/$indexprefix$vol.html"; + + # print "Processing volume $vol\n"; + + open(mindex, ">$indexname") || die "Can't create $indexname"; + opendir(dir, "$dir") || die "Can't open $dir"; + + print mindex <<EOF; +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> +<TITLE>XFree86[tm] Manual pages: Section $vol</TITLE> +</HEAD> +<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red"> + +<H1>XFree86[tm] Manual pages: Section $vol</H1> +<P> +<UL> +EOF + + foreach $file (sort readdir dir) { + if ($file =~ "\.$vol\.html") { + open(file, "<$dir/$file") || die "Can't open $dir/$file"; + while (<file>) { + chop; + if (/^<H2>/) { + if (! /<\/H2>$/) { + while (<file> && ! /<\/H2>$/) { + ; + } + } + $heading = ""; + while (<file>) { + if (/^<H2>/) { + last; + } + $heading = "$heading" . "$_"; + } + if ($heading) { + undef $empty; + $heading =~ s/--/-/; + ($name, $descr) = split(/-/, $heading, 2); + $file =~ /(.*)\.$vol\.html/; + $fname = $1; + $descr =~ s/<[P]>//g; + print mindex + "<LI><A href=\"$file\">$fname</A> - $descr</LI>"; + } + last; + } + } + close file; + } + } + + print mindex <<EOF; +</UL> +<P> +</BODY> +</HTML> +EOF + + close mindex; + closedir dir; + if (defined $empty) { + # print "Removing empty $indexname\n"; + unlink $indexname; + } +} diff --git a/xc/extras/Mesa/README.XF86 b/xc/extras/Mesa/README.XF86 index 06470491d..3ceae5c0f 100644 --- a/xc/extras/Mesa/README.XF86 +++ b/xc/extras/Mesa/README.XF86 @@ -8,7 +8,7 @@ Instructions for importing a tagged Mesa release X.Y. 1. Check out the release version from the Mesa CVS repository: % cvs -d :pserver:anonymous@cvs.mesa3d.sourceforge.net:/cvsroot/mesa3d \ - -r mesa_X_Y Mesa + co -r mesa_X_Y Mesa 2. Remove the CVSROOT directory: @@ -39,9 +39,9 @@ When importing a snapshot of a Mesa (stable) branch, do everything as above, except check out the branch with: % cvs -d :pserver:anonymous@cvs.mesa3d.sourceforge.net:/cvsroot/mesa3d \ - -r mesa_X_Y_branch Mesa + co -r mesa_X_Y_branch Mesa and import with the tag MESA-X_Y-yyyymmdd indicating the date of the snapshot. -$XFree86: xc/extras/Mesa/README.XF86,v 1.1 2000/11/30 15:46:25 dawes Exp $ +$XFree86: xc/extras/Mesa/README.XF86,v 1.2 2001/03/21 17:22:44 dawes Exp $ diff --git a/xc/extras/Mesa/docs/RELNOTES-3.4.1 b/xc/extras/Mesa/docs/RELNOTES-3.4.1 new file mode 100644 index 000000000..a116bac90 --- /dev/null +++ b/xc/extras/Mesa/docs/RELNOTES-3.4.1 @@ -0,0 +1,22 @@ + + Mesa 3.4.1 release notes + + February 9, 2001 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +Mesa 3.4.1 is a maintenance release that simply fixes bugs found since +the Mesa 3.4 release. For details, see the VERSIONS file. + + +---------------------------------------------------------------------- +$Id: RELNOTES-3.4.1,v 1.1.1.1 2001/04/09 16:27:27 dawes Exp $ diff --git a/xc/extras/Mesa/include/GL/glext.h b/xc/extras/Mesa/include/GL/glext.h index 7339398a4..774d57284 100644 --- a/xc/extras/Mesa/include/GL/glext.h +++ b/xc/extras/Mesa/include/GL/glext.h @@ -46,7 +46,7 @@ extern "C" { /*************************************************************/ /* Header file version number, required by OpenGL ABI for Linux */ -#define GL_GLEXT_VERSION 6 +#define GL_GLEXT_VERSION 7 #ifndef GL_VERSION_1_2 #define GL_CONSTANT_COLOR 0x8001 @@ -220,12 +220,57 @@ extern "C" { #define GL_COMPRESSED_RGB_ARB 0x84ED #define GL_COMPRESSED_RGBA_ARB 0x84EE #define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 #define GL_TEXTURE_COMPRESSED_ARB 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 #endif +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif @@ -670,6 +715,18 @@ extern "C" { #ifndef GL_SGIX_tag_sample_buffer #endif +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + #ifndef GL_SGIX_reference_plane #define GL_REFERENCE_PLANE_SGIX 0x817D #define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E @@ -785,6 +842,14 @@ extern "C" { #define GL_COLOR_INDEX8_EXT 0x80E5 #define GL_COLOR_INDEX12_EXT 0x80E6 #define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 +#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF #define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED #endif @@ -926,6 +991,24 @@ extern "C" { #define GL_BGRA_EXT 0x80E1 #endif +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + #ifndef GL_INTEL_texture_scissor #endif @@ -1663,15 +1746,9 @@ typedef void (APIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bia #define GL_EXT_texture3D 1 #ifdef GL_GLEXT_PROTOTYPES extern void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_EXT_subtexture -/*#define GL_EXT_subtexture 1*/ -#ifdef GL_GLEXT_PROTOTYPES extern void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); #endif @@ -2043,6 +2120,20 @@ extern void APIENTRY glTagSampleBufferSGIX (void); typedef void (APIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); #endif +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +extern void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +extern void APIENTRY glDeformSGIX (GLbitfield); +extern void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRY * PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRY * PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRY * PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + #ifndef GL_SGIX_reference_plane #define GL_SGIX_reference_plane 1 #ifdef GL_GLEXT_PROTOTYPES @@ -2311,6 +2402,32 @@ typedef void (APIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode) #define GL_EXT_bgra 1 #endif +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glAsyncMarkerSGIX (GLuint); +extern GLint APIENTRY glFinishAsyncSGIX (GLuint *); +extern GLint APIENTRY glPollAsyncSGIX (GLuint *); +extern GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); +extern void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); +extern GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + #ifndef GL_INTEL_parallel_arrays #define GL_INTEL_parallel_arrays 1 #ifdef GL_GLEXT_PROTOTYPES @@ -2717,12 +2834,6 @@ extern void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, extern void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); extern void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); extern void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); -#ifdef VMS - #define glGetCombinerOutputParameterfvNV glGetCombinerOutputParameterfvN - #define glGetCombinerOutputParameterivNV glGetCombinerOutputParameterivN - #define glGetFinalCombinerInputParameterfvNV glGetFinalCombinerInputParafvNV - #define glGetFinalCombinerInputParameterivNV glGetFinalCombinerInputParaivNV -#endif extern void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); extern void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); extern void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); @@ -2923,6 +3034,14 @@ extern void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GL typedef void (APIENTRY * PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); #endif +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + #ifndef GL_EXT_texture_env_dot3 #define GL_EXT_texture_env_dot3 1 #endif diff --git a/xc/extras/Mesa/include/GL/vms_x_fix.h b/xc/extras/Mesa/include/GL/vms_x_fix.h new file mode 100644 index 000000000..db754f655 --- /dev/null +++ b/xc/extras/Mesa/include/GL/vms_x_fix.h @@ -0,0 +1,880 @@ +/*************************************************************************** + * * + * Repair definitions of Xlib when compileing with /name=(as_is) on VMS * + * * + * Author : Jouk Jansen (joukj@hrem.stm.tudelft.nl) * + * * + * Last revision : 22 August 2000 * + * * + ***************************************************************************/ + +#ifndef VMS_X_FIX +#define VMS_X_FIX + +#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE +#define XAllocClassHint XALLOCCLASSHINT +#define XAllocColor XALLOCCOLOR +#define XAllocColorCells XALLOCCOLORCELLS +#define XAllocSizeHints XALLOCSIZEHINTS +#define XAllocWMHints XALLOCWMHINTS +#define XAutoRepeatOff XAUTOREPEATOFF +#define XAutoRepeatOn XAUTOREPEATON +#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET +#define XBell XBELL +#define XBitmapPad XBITMAPPAD +#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB +#define XChangeGC XCHANGEGC +#define XChangeProperty XCHANGEPROPERTY +#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES +#define XCheckIfEvent XCHECKIFEVENT +#define XCheckMaskEvent XCHECKMASKEVENT +#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT +#define XCheckWindowEvent XCHECKWINDOWEVENT +#define XClearArea XCLEARAREA +#define XClearWindow XCLEARWINDOW +#define XClipBox XCLIPBOX +#define XCloseDisplay XCLOSEDISPLAY +#define XCloseIM XCLOSEIM +#define XConfigureWindow XCONFIGUREWINDOW +#define XConvertSelection XCONVERTSELECTION +#define XCopyArea XCOPYAREA +#define XCopyGC XCOPYGC +#define XCopyPlane XCOPYPLANE +#define XCreateBitmapFromData XCREATEBITMAPFROMDATA +#define XCreateColormap XCREATECOLORMAP +#define XCreateFontCursor XCREATEFONTCURSOR +#define XCreateFontSet XCREATEFONTSET +#define XCreateGC XCREATEGC +#define XCreateIC XCREATEIC +#define XCreateImage XCREATEIMAGE +#define XCreatePixmap XCREATEPIXMAP +#define XCreatePixmapCursor XCREATEPIXMAPCURSOR +#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA +#define XCreateRegion XCREATEREGION +#define XCreateSimpleWindow XCREATESIMPLEWINDOW +#define XCreateWindow XCREATEWINDOW +#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY +#define XDefineCursor XDEFINECURSOR +#define XDeleteProperty XDELETEPROPERTY +#define XDestroyIC XDESTROYIC +#define XDestroyRegion XDESTROYREGION +#define XDestroyWindow XDESTROYWINDOW +#define XDisplayName XDISPLAYNAME +#define XDisplayOfScreen XDISPLAYOFSCREEN +#define XDrawArc XDRAWARC +#define XDrawImageString XDRAWIMAGESTRING +#define XDrawImageString16 XDRAWIMAGESTRING16 +#define XDrawLine XDRAWLINE +#define XDrawLines XDRAWLINES +#define XDrawPoint XDRAWPOINT +#define XDrawPoints XDRAWPOINTS +#define XDrawRectangle XDRAWRECTANGLE +#define XDrawSegments XDRAWSEGMENTS +#define XDrawString XDRAWSTRING +#define XDrawString16 XDRAWSTRING16 +#define XEmptyRegion XEMPTYREGION +#define XEqualRegion XEQUALREGION +#define XEventsQueued XEVENTSQUEUED +#define XExtentsOfFontSet XEXTENTSOFFONTSET +#define XFillArc XFILLARC +#define XFillPolygon XFILLPOLYGON +#define XFillRectangle XFILLRECTANGLE +#define XFillRectangles XFILLRECTANGLES +#define XFilterEvent XFILTEREVENT +#define XFlush XFLUSH +#define XFontsOfFontSet XFONTSOFFONTSET +#define XFree XFREE +#define XFreeColormap XFREECOLORMAP +#define XFreeColors XFREECOLORS +#define XFreeCursor XFREECURSOR +#define XFreeFont XFREEFONT +#define XFreeFontInfo XFREEFONTINFO +#define XFreeFontNames XFREEFONTNAMES +#define XFreeFontSet XFREEFONTSET +#define XFreeGC XFREEGC +#define XFreeModifiermap XFREEMODIFIERMAP +#define XFreePixmap XFREEPIXMAP +#define XFreeStringList XFREESTRINGLIST +#define XGetAtomName XGETATOMNAME +#define XGetDefault XGETDEFAULT +#define XGetErrorDatabaseText XGETERRORDATABASETEXT +#define XGetErrorText XGETERRORTEXT +#define XGetFontProperty XGETFONTPROPERTY +#define XGetGCValues XGETGCVALUES +#define XGetGeometry XGETGEOMETRY +#define XGetICValues XGETICVALUES +#define XGetIMValues XGETIMVALUES +#define XGetImage XGETIMAGE +#define XGetKeyboardControl XGETKEYBOARDCONTROL +#define XGetModifierMapping XGETMODIFIERMAPPING +#define XGetMotionEvents XGETMOTIONEVENTS +#define XGetNormalHints XGETNORMALHINTS +#define XGetSelectionOwner XGETSELECTIONOWNER +#define XGetSubImage XGETSUBIMAGE +#define XGetVisualInfo XGETVISUALINFO +#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS +#define XGetWMHints XGETWMHINTS +#define XGetWMName XGETWMNAME +#define XGetWMNormalHints XGETWMNORMALHINTS +#define XGetWindowAttributes XGETWINDOWATTRIBUTES +#define XGetWindowProperty XGETWINDOWPROPERTY +#define XGrabKeyboard XGRABKEYBOARD +#define XGrabPointer XGRABPOINTER +#define XGrabServer XGRABSERVER +#define XHeightOfScreen XHEIGHTOFSCREEN +#define XIfEvent XIFEVENT +#define XInternAtom XINTERNATOM +#define XIntersectRegion XINTERSECTREGION +#define XKeycodeToKeysym XKEYCODETOKEYSYM +#define XKeysymToKeycode XKEYSYMTOKEYCODE +#define XKeysymToString XKEYSYMTOSTRING +#define XListFonts XLISTFONTS +#define XListFontsWithInfo XLISTFONTSWITHINFO +#define XListPixmapFormats XLISTPIXMAPFORMATS +#define XListProperties XLISTPROPERTIES +#define XLoadQueryFont XLOADQUERYFONT +#define XLookupString XLOOKUPSTRING +#define XLowerWindow XLOWERWINDOW +#define XMapRaised XMAPRAISED +#define XMapWindow XMAPWINDOW +#define XMatchVisualInfo XMATCHVISUALINFO +#define XMoveResizeWindow XMOVERESIZEWINDOW +#define XMoveWindow XMOVEWINDOW +#define XNextEvent XNEXTEVENT +#define XOffsetRegion XOFFSETREGION +#define XOpenDisplay XOPENDISPLAY +#define XOpenIM XOPENIM +#define XParseColor XPARSECOLOR +#define XParseGeometry XPARSEGEOMETRY +#define XPeekEvent XPEEKEVENT +#define XPending XPENDING +#define XPointInRegion XPOINTINREGION +#define XPolygonRegion XPOLYGONREGION +#define XPutBackEvent XPUTBACKEVENT +#define XPutImage XPUTIMAGE +#define XQueryColor XQUERYCOLOR +#define XQueryColors XQUERYCOLORS +#define XQueryExtension XQUERYEXTENSION +#define XQueryPointer XQUERYPOINTER +#define XQueryTree XQUERYTREE +#define XRaiseWindow XRAISEWINDOW +#define XReconfigureWMWindow XRECONFIGUREWMWINDOW +#define XRectInRegion XRECTINREGION +#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING +#define XReparentWindow XREPARENTWINDOW +#define XResizeWindow XRESIZEWINDOW +#define XRestackWindows XRESTACKWINDOWS +#define XRootWindowOfScreen XROOTWINDOWOFSCREEN +#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN +#define XSelectAsyncEvent XSELECTASYNCEVENT +#define XSelectAsyncInput XSELECTASYNCINPUT +#define XSelectInput XSELECTINPUT +#define XSendEvent XSENDEVENT +#define XServerVendor XSERVERVENDOR +#define XSetBackground XSETBACKGROUND +#define XSetClassHint XSETCLASSHINT +#define XSetClipMask XSETCLIPMASK +#define XSetClipOrigin XSETCLIPORIGIN +#define XSetClipRectangles XSETCLIPRECTANGLES +#define XSetCloseDownMode XSETCLOSEDOWNMODE +#define XSetCommand XSETCOMMAND +#define XSetDashes XSETDASHES +#define XSetErrorHandler XSETERRORHANDLER +#define XSetFillStyle XSETFILLSTYLE +#define XSetFont XSETFONT +#define XSetForeground XSETFOREGROUND +#define XSetFunction XSETFUNCTION +#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES +#define XSetICFocus XSETICFOCUS +#define XSetICValues XSETICVALUES +#define XSetIOErrorHandler XSETIOERRORHANDLER +#define XSetInputFocus XSETINPUTFOCUS +#define XSetLineAttributes XSETLINEATTRIBUTES +#define XSetLocaleModifiers XSETLOCALEMODIFIERS +#define XSetNormalHints XSETNORMALHINTS +#define XSetRegion XSETREGION +#define XSetSelectionOwner XSETSELECTIONOWNER +#define XSetStipple XSETSTIPPLE +#define XSetSubwindowMode XSETSUBWINDOWMODE +#define XSetTSOrigin XSETTSORIGIN +#define XSetTile XSETTILE +#define XSetTransientForHint XSETTRANSIENTFORHINT +#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS +#define XSetWMHints XSETWMHINTS +#define XSetWMIconName XSETWMICONNAME +#define XSetWMName XSETWMNAME +#define XSetWMNormalHints XSETWMNORMALHINTS +#define XSetWMProperties XSETWMPROPERTIES +#define XSetWMProtocols XSETWMPROTOCOLS +#define XSetWindowBackground XSETWINDOWBACKGROUND +#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP +#define XSetWindowColormap XSETWINDOWCOLORMAP +#define XShapeCombineMask XSHAPECOMBINEMASK +#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES +#define XShapeGetRectangles XSHAPEGETRECTANGLES +#define XShrinkRegion XSHRINKREGION +#define XStoreColor XSTORECOLOR +#define XStoreColors XSTORECOLORS +#define XStoreName XSTORENAME +#define XStringToKeysym XSTRINGTOKEYSYM +#define XSubtractRegion XSUBTRACTREGION +#define XSupportsLocale XSUPPORTSLOCALE +#define XSync XSYNC +#define XSynchronize XSYNCHRONIZE +#define XTextExtents XTEXTEXTENTS +#define XTextExtents16 XTEXTEXTENTS16 +#define XTextWidth XTEXTWIDTH +#define XTextWidth16 XTEXTWIDTH16 +#define XTranslateCoordinates XTRANSLATECOORDINATES +#define XUndefineCursor XUNDEFINECURSOR +#define XUngrabKeyboard XUNGRABKEYBOARD +#define XUngrabPointer XUNGRABPOINTER +#define XUngrabServer XUNGRABSERVER +#define XUnionRectWithRegion XUNIONRECTWITHREGION +#define XUnionRegion XUNIONREGION +#define XUnmapWindow XUNMAPWINDOW +#define _XUnregisterFilter _XUNREGISTERFILTER +#define XUnsetICFocus XUNSETICFOCUS +#define XVaCreateNestedList XVACREATENESTEDLIST +#define XVisualIDFromVisual XVISUALIDFROMVISUAL +#define XWidthOfScreen XWIDTHOFSCREEN +#define XWindowEvent XWINDOWEVENT +#define XWithdrawWindow XWITHDRAWWINDOW +#define XXorRegion XXORREGION +#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK +#define XmAddProtocols XMADDPROTOCOLS +#define XmChangeColor XMCHANGECOLOR +#define XmClipboardCopy XMCLIPBOARDCOPY +#define XmClipboardEndCopy XMCLIPBOARDENDCOPY +#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH +#define XmClipboardLock XMCLIPBOARDLOCK +#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE +#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY +#define XmClipboardUnlock XMCLIPBOARDUNLOCK +#define XmCreateArrowButton XMCREATEARROWBUTTON +#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET +#define XmCreateCascadeButton XMCREATECASCADEBUTTON +#define XmCreateDialogShell XMCREATEDIALOGSHELL +#define XmCreateDragIcon XMCREATEDRAGICON +#define XmCreateDrawingArea XMCREATEDRAWINGAREA +#define XmCreateDrawnButton XMCREATEDRAWNBUTTON +#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX +#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG +#define XmCreateForm XMCREATEFORM +#define XmCreateFormDialog XMCREATEFORMDIALOG +#define XmCreateFrame XMCREATEFRAME +#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG +#define XmCreateLabelGadget XMCREATELABELGADGET +#define XmCreateMainWindow XMCREATEMAINWINDOW +#define XmCreateMenuBar XMCREATEMENUBAR +#define XmCreateMessageBox XMCREATEMESSAGEBOX +#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG +#define XmCreateOptionMenu XMCREATEOPTIONMENU +#define XmCreatePanedWindow XMCREATEPANEDWINDOW +#define XmCreatePopupMenu XMCREATEPOPUPMENU +#define XmCreatePromptDialog XMCREATEPROMPTDIALOG +#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU +#define XmCreatePushButton XMCREATEPUSHBUTTON +#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET +#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG +#define XmCreateRadioBox XMCREATERADIOBOX +#define XmCreateRowColumn XMCREATEROWCOLUMN +#define XmCreateScale XMCREATESCALE +#define XmCreateScrollBar XMCREATESCROLLBAR +#define XmCreateScrolledList XMCREATESCROLLEDLIST +#define XmCreateScrolledText XMCREATESCROLLEDTEXT +#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW +#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG +#define XmCreateSeparator XMCREATESEPARATOR +#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET +#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG +#define XmCreateText XMCREATETEXT +#define XmCreateTextField XMCREATETEXTFIELD +#define XmCreateToggleButton XMCREATETOGGLEBUTTON +#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET +#define XmDragStart XMDRAGSTART +#define XmDropSiteRegister XMDROPSITEREGISTER +#define XmDropSiteUnregister XMDROPSITEUNREGISTER +#define XmDropSiteUpdate XMDROPSITEUPDATE +#define XmDropTransferStart XMDROPTRANSFERSTART +#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD +#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH +#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY +#define XmFontListCopy XMFONTLISTCOPY +#define XmFontListCreate XMFONTLISTCREATE +#define XmFontListEntryCreate XMFONTLISTENTRYCREATE +#define XmFontListEntryFree XMFONTLISTENTRYFREE +#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT +#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG +#define XmFontListEntryLoad XMFONTLISTENTRYLOAD +#define XmFontListFree XMFONTLISTFREE +#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT +#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT +#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT +#define XmFontListNextEntry XMFONTLISTNEXTENTRY +#define XmGetColors XMGETCOLORS +#define XmGetFocusWidget XMGETFOCUSWIDGET +#define XmGetMenuCursor XMGETMENUCURSOR +#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH +#define XmGetTearOffControl XMGETTEAROFFCONTROL +#define XmGetXmDisplay XMGETXMDISPLAY +#define XmImMbLookupString XMIMMBLOOKUPSTRING +#define XmImRegister XMIMREGISTER +#define XmImSetFocusValues XMIMSETFOCUSVALUES +#define XmImSetValues XMIMSETVALUES +#define XmImUnregister XMIMUNREGISTER +#define XmImUnsetFocus XMIMUNSETFOCUS +#define XmInternAtom XMINTERNATOM +#define XmIsMotifWMRunning XMISMOTIFWMRUNNING +#define XmListAddItem XMLISTADDITEM +#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED +#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED +#define XmListDeleteAllItems XMLISTDELETEALLITEMS +#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS +#define XmListDeletePos XMLISTDELETEPOS +#define XmListDeselectAllItems XMLISTDESELECTALLITEMS +#define XmListDeselectPos XMLISTDESELECTPOS +#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS +#define XmListGetMatchPos XMLISTGETMATCHPOS +#define XmListGetSelectedPos XMLISTGETSELECTEDPOS +#define XmListPosSelected XMLISTPOSSELECTED +#define XmListSelectItem XMLISTSELECTITEM +#define XmListSelectPos XMLISTSELECTPOS +#define XmListSetBottomPos XMLISTSETBOTTOMPOS +#define XmListSetItem XMLISTSETITEM +#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS +#define XmListSetPos XMLISTSETPOS +#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS +#define XmMenuPosition XMMENUPOSITION +#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD +#define XmOptionButtonGadget XMOPTIONBUTTONGADGET +#define XmOptionLabelGadget XMOPTIONLABELGADGET +#define XmProcessTraversal XMPROCESSTRAVERSAL +#define XmQmotif XMQMOTIF +#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK +#define XmRepTypeGetId XMREPTYPEGETID +#define XmRepTypeGetRecord XMREPTYPEGETRECORD +#define XmRepTypeRegister XMREPTYPEREGISTER +#define XmRepTypeValidValue XMREPTYPEVALIDVALUE +#define XmScrollBarSetValues XMSCROLLBARSETVALUES +#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS +#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD +#define XmStringByteCompare XMSTRINGBYTECOMPARE +#define XmStringCompare XMSTRINGCOMPARE +#define XmStringConcat XMSTRINGCONCAT +#define XmStringCopy XMSTRINGCOPY +#define XmStringCreate XMSTRINGCREATE +#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED +#define XmStringCreateLtoR XMSTRINGCREATELTOR +#define XmStringCreateSimple XMSTRINGCREATESIMPLE +#define XmStringDraw XMSTRINGDRAW +#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE +#define XmStringExtent XMSTRINGEXTENT +#define XmStringFree XMSTRINGFREE +#define XmStringFreeContext XMSTRINGFREECONTEXT +#define XmStringGetLtoR XMSTRINGGETLTOR +#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT +#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT +#define XmStringInitContext XMSTRINGINITCONTEXT +#define XmStringLength XMSTRINGLENGTH +#define XmStringLtoRCreate XMSTRINGLTORCREATE +#define XmStringNConcat XMSTRINGNCONCAT +#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE +#define XmStringWidth XMSTRINGWIDTH +#define XmTextClearSelection XMTEXTCLEARSELECTION +#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE +#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION +#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION +#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION +#define XmTextFieldGetString XMTEXTFIELDGETSTRING +#define XmTextFieldInsert XMTEXTFIELDINSERT +#define XmTextFieldRemove XMTEXTFIELDREMOVE +#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION +#define XmTextFieldSetString XMTEXTFIELDSETSTRING +#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION +#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION +#define XmTextGetLastPosition XMTEXTGETLASTPOSITION +#define XmTextGetMaxLength XMTEXTGETMAXLENGTH +#define XmTextGetSelection XMTEXTGETSELECTION +#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION +#define XmTextGetString XMTEXTGETSTRING +#define XmTextInsert XMTEXTINSERT +#define XmTextRemove XMTEXTREMOVE +#define XmTextReplace XMTEXTREPLACE +#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION +#define XmTextSetHighlight XMTEXTSETHIGHLIGHT +#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION +#define XmTextSetSelection XMTEXTSETSELECTION +#define XmTextSetString XMTEXTSETSTRING +#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE +#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE +#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE +#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE +#define XmUpdateDisplay XMUPDATEDISPLAY +#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX +#define XmbDrawString XMBDRAWSTRING +#define XmbLookupString XMBLOOKUPSTRING +#define XmbResetIC XMBRESETIC +#define XmbSetWMProperties XMBSETWMPROPERTIES +#define XmbTextEscapement XMBTEXTESCAPEMENT +#define XmbTextExtents XMBTEXTEXTENTS +#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY +#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST +#define XmuClientWindow XMUCLIENTWINDOW +#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE +#define XrmGetDatabase XRMGETDATABASE +#define XrmGetResource XRMGETRESOURCE +#define XrmPutStringResource XRMPUTSTRINGRESOURCE +#define XrmQuarkToString XRMQUARKTOSTRING +#define XrmStringToQuark XRMSTRINGTOQUARK +#define XtAddCallback XTADDCALLBACK +#define XtAddCallbacks XTADDCALLBACKS +#define XtAddEventHandler XTADDEVENTHANDLER +#define XtAddGrab XTADDGRAB +#define XtAllocateGC XTALLOCATEGC +#define XtAppAddActions XTAPPADDACTIONS +#define XtAppAddInput XTAPPADDINPUT +#define XtAppAddTimeOut XTAPPADDTIMEOUT +#define XtAppCreateShell XTAPPCREATESHELL +#define XtAppInitialize XTAPPINITIALIZE +#define XtAppNextEvent XTAPPNEXTEVENT +#define XtAppPeekEvent XTAPPPEEKEVENT +#define XtAppPending XTAPPPENDING +#define XtAppProcessEvent XTAPPPROCESSEVENT +#define XtAppSetErrorHandler XTAPPSETERRORHANDLER +#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES +#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER +#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER +#define XtAppWarning XTAPPWARNING +#define XtCallActionProc XTCALLACTIONPROC +#define XtCallCallbackList XTCALLCALLBACKLIST +#define XtCallCallbacks XTCALLCALLBACKS +#define XtConfigureWidget XTCONFIGUREWIDGET +#define XtConvertAndStore XTCONVERTANDSTORE +#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT +#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET +#define XtCreatePopupShell XTCREATEPOPUPSHELL +#define XtCreateWidget XTCREATEWIDGET +#define XtDatabase XTDATABASE +#define XtDestroyWidget XTDESTROYWIDGET +#define XtDisownSelection XTDISOWNSELECTION +#define XtDispatchEvent XTDISPATCHEVENT +#define XtDisplayOfObject XTDISPLAYOFOBJECT +#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING +#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT +#define XtAppAddWorkProc XTAPPADDWORKPROC +#define XtRemoveWorkProc XTREMOVEWORKPROC +#define XtFree XTFREE +#define XtGetActionKeysym XTGETACTIONKEYSYM +#define XtGetActionList XTGETACTIONLIST +#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS +#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES +#define XtGetGC XTGETGC +#define XtGetMultiClickTime XTGETMULTICLICKTIME +#define XtGetSelectionValue XTGETSELECTIONVALUE +#define XtGetSelectionValues XTGETSELECTIONVALUES +#define XtGetSubresources XTGETSUBRESOURCES +#define XtGetValues XTGETVALUES +#define XtGrabKeyboard XTGRABKEYBOARD +#define XtGrabPointer XTGRABPOINTER +#define XtHasCallbacks XTHASCALLBACKS +#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS +#define XtInsertEventHandler XTINSERTEVENTHANDLER +#define XtIsManaged XTISMANAGED +#define XtIsObject XTISOBJECT +#define XtIsSensitive XTISSENSITIVE +#define XtIsSubclass XTISSUBCLASS +#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED +#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST +#define XtMakeResizeRequest XTMAKERESIZEREQUEST +#define XtMalloc XTMALLOC +#define XtManageChild XTMANAGECHILD +#define XtManageChildren XTMANAGECHILDREN +#define XtMergeArgLists XTMERGEARGLISTS +#define XtMoveWidget XTMOVEWIDGET +#define XtName XTNAME +#define XtNameToWidget XTNAMETOWIDGET +#define XtOpenDisplay XTOPENDISPLAY +#define XtOverrideTranslations XTOVERRIDETRANSLATIONS +#define XtOwnSelection XTOWNSELECTION +#define XtParseTranslationTable XTPARSETRANSLATIONTABLE +#define XtPopdown XTPOPDOWN +#define XtPopup XTPOPUP +#define XtQueryGeometry XTQUERYGEOMETRY +#define XtRealizeWidget XTREALIZEWIDGET +#define XtRealloc XTREALLOC +#define XtReleaseGC XTRELEASEGC +#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS +#define XtRemoveCallback XTREMOVECALLBACK +#define XtRemoveEventHandler XTREMOVEEVENTHANDLER +#define XtRemoveGrab XTREMOVEGRAB +#define XtRemoveInput XTREMOVEINPUT +#define XtRemoveTimeOut XTREMOVETIMEOUT +#define XtResizeWidget XTRESIZEWIDGET +#define XtResolvePathname XTRESOLVEPATHNAME +#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS +#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED +#define XtSetSensitive XTSETSENSITIVE +#define XtSetTypeConverter XTSETTYPECONVERTER +#define XtSetValues XTSETVALUES +#define XtShellStrings XTSHELLSTRINGS +#define XtStrings XTSTRINGS +#define XtToolkitInitialize XTTOOLKITINITIALIZE +#define XtTranslateCoords XTTRANSLATECOORDS +#define XtTranslateKeycode XTTRANSLATEKEYCODE +#define XtUngrabKeyboard XTUNGRABKEYBOARD +#define XtUngrabPointer XTUNGRABPOINTER +#define XtUnmanageChild XTUNMANAGECHILD +#define XtUnmanageChildren XTUNMANAGECHILDREN +#define XtUnrealizeWidget XTUNREALIZEWIDGET +#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET +#define XtVaCreateWidget XTVACREATEWIDGET +#define XtVaGetValues XTVAGETVALUES +#define XtVaSetValues XTVASETVALUES +#define XtWarning XTWARNING +#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT +#define XtWindowOfObject XTWINDOWOFOBJECT +#define XtWindowToWidget XTWINDOWTOWIDGET +#define XwcDrawString XWCDRAWSTRING +#define XwcFreeStringList XWCFREESTRINGLIST +#define XwcTextEscapement XWCTEXTESCAPEMENT +#define XwcTextExtents XWCTEXTEXTENTS +#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY +#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST +#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT +#define _XmClearBorder _XMCLEARBORDER +#define _XmConfigureObject _XMCONFIGUREOBJECT +#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK +#define _XmDrawArrow _XMDRAWARROW +#define _XmDrawShadows _XMDRAWSHADOWS +#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT +#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS +#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS +#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR +#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST +#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON +#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA +#define _XmGrabKeyboard _XMGRABKEYBOARD +#define _XmGrabPointer _XMGRABPOINTER +#define _XmInheritClass _XMINHERITCLASS +#define _XmInputInGadget _XMINPUTINGADGET +#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST +#define _XmMenuPopDown _XMMENUPOPDOWN +#define _XmMoveObject _XMMOVEOBJECT +#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED +#define _XmOSBuildFileList _XMOSBUILDFILELIST +#define _XmOSFileCompare _XMOSFILECOMPARE +#define _XmOSFindPatternPart _XMOSFINDPATTERNPART +#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC +#define _XmPostPopupMenu _XMPOSTPOPUPMENU +#define _XmPrimitiveEnter _XMPRIMITIVEENTER +#define _XmPrimitiveLeave _XMPRIMITIVELEAVE +#define _XmRedisplayGadgets _XMREDISPLAYGADGETS +#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE +#define _XmStringDraw _XMSTRINGDRAW +#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT +#define _XmStrings _XMSTRINGS +#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS +#define _XmToVerticalPixels _XMTOVERTICALPIXELS +#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT +#define _Xm_fastPtr _XM_FASTPTR +#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG +#define _XtInherit _XTINHERIT +#define _XtInheritTranslations _XTINHERITTRANSLATIONS +#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS +#define compositeWidgetClass COMPOSITEWIDGETCLASS +#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS +#define shellWidgetClass SHELLWIDGETCLASS +#define topLevelShellClassRec TOPLEVELSHELLCLASSREC +#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS +#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS +#define vendorShellClassRec VENDORSHELLCLASSREC +#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS +#define wmShellWidgetClass WMSHELLWIDGETCLASS +#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS +#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC +#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS +#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS +#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS +#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS +#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS +#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS +#define xmFormWidgetClass XMFORMWIDGETCLASS +#define xmFrameWidgetClass XMFRAMEWIDGETCLASS +#define xmGadgetClass XMGADGETCLASS +#define xmLabelGadgetClass XMLABELGADGETCLASS +#define xmLabelWidgetClass XMLABELWIDGETCLASS +#define xmListWidgetClass XMLISTWIDGETCLASS +#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS +#define xmManagerClassRec XMMANAGERCLASSREC +#define xmManagerWidgetClass XMMANAGERWIDGETCLASS +#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS +#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS +#define xmPrimitiveClassRec XMPRIMITIVECLASSREC +#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS +#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC +#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS +#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS +#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS +#define xmSashWidgetClass XMSASHWIDGETCLASS +#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS +#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC +#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS +#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS +#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS +#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS +#define xmTextWidgetClass XMTEXTWIDGETCLASS +#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS +#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS +#define XtRegisterDrawable _XTREGISTERWINDOW +#define XtUnregisterDrawable _XTUNREGISTERWINDOW +#define XQueryFont XQUERYFONT +#define XSetPlaneMask XSETPLANEMASK +#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL +#define XDestroySubwindows XDESTROYSUBWINDOWS +#define XFreeDeviceList XFREEDEVICELIST +#define XFreeDeviceState XFREEDEVICESTATE +#define XGetExtensionVersion XGETEXTENSIONVERSION +#define XGetRGBColormaps XGETRGBCOLORMAPS +#define XIconifyWindow XICONIFYWINDOW +#define XInstallColormap XINSTALLCOLORMAP +#define XListInputDevices XLISTINPUTDEVICES +#define XLookupKeysym XLOOKUPKEYSYM +#define XOpenDevice XOPENDEVICE +#define XQueryDeviceState XQUERYDEVICESTATE +#define XSelectExtensionEvent XSELECTEXTENSIONEVENT +#define XWarpPointer XWARPPOINTER +#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP +#define XAllocNamedColor XALLOCNAMEDCOLOR +#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN +#define XDefaultColormap XDEFAULTCOLORMAP +#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN +#define XDefaultDepth XDEFAULTDEPTH +#define XDefaultScreen XDEFAULTSCREEN +#define XDefaultVisual XDEFAULTVISUAL +#define XSetIconName XSETICONNAME +#define XtInitialize XTINITIALIZE +#define XtMainLoop XTMAINLOOP +#define DtSaverGetWindows DTSAVERGETWINDOWS +#define XAddHosts XADDHOSTS +#define XDisableAccessControl XDISABLEACCESSCONTROL +#define XEnableAccessControl XENABLEACCESSCONTROL +#define XFillArcs XFILLARCS +#define XForceScreenSaver XFORCESCREENSAVER +#define XGetScreenSaver XGETSCREENSAVER +#define XListHosts XLISTHOSTS +#define XReadBitmapFile XREADBITMAPFILE +#define XRemoveHosts XREMOVEHOSTS +#define XResetScreenSaver XRESETSCREENSAVER +#define XResourceManagerString XRESOURCEMANAGERSTRING +#define XSetScreenSaver XSETSCREENSAVER +#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY +#define XrmDestroyDatabase XRMDESTROYDATABASE +#define XrmGetFileDatabase XRMGETFILEDATABASE +#define XrmGetStringDatabase XRMGETSTRINGDATABASE +#define XrmInitialize XRMINITIALIZE +#define XrmMergeDatabases XRMMERGEDATABASES +#define XrmParseCommand XRMPARSECOMMAND +#define XrmPutLineResource XRMPUTLINERESOURCE +#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE +#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST +#define XrmStringToQuark XRMSTRINGTOQUARK +#define XmCreateLabel XMCREATELABEL + +#ifdef __cplusplus +extern "C" { +#endif +extern void XtFree(char*); +#ifdef __cplusplus +} +#endif + +#define pthread_attr_create PTHREAD_ATTR_CREATE +#define pthread_attr_delete PTHREAD_ATTR_DELETE +#define pthread_attr_destroy PTHREAD_ATTR_DESTROY +#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP +#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP +#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED +#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO +#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED +#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM +#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE +#define pthread_attr_init PTHREAD_ATTR_INIT +#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP +#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE +#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP +#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED +#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO +#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED +#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM +#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY +#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE +#define pthread_cancel PTHREAD_CANCEL +#define pthread_cancel_e PTHREAD_CANCEL_E +#define pthread_cond_broadcast PTHREAD_COND_BROADCAST +#define pthread_cond_destroy PTHREAD_COND_DESTROY +#define pthread_cond_init PTHREAD_COND_INIT +#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP +#define pthread_cond_signal PTHREAD_COND_SIGNAL +#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP +#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT +#define pthread_cond_wait PTHREAD_COND_WAIT +#define pthread_condattr_create PTHREAD_CONDATTR_CREATE +#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE +#define pthread_condattr_init PTHREAD_CONDATTR_INIT +#define pthread_create PTHREAD_CREATE +#define pthread_delay_np PTHREAD_DELAY_NP +#define pthread_detach PTHREAD_DETACH +#define pthread_equal PTHREAD_EQUAL +#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP +#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP +#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP +#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP +#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP +#define pthread_exit PTHREAD_EXIT +#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP +#define pthread_getprio PTHREAD_GETPRIO +#define pthread_getschedparam PTHREAD_GETSCHEDPARAM +#define pthread_getscheduler PTHREAD_GETSCHEDULER +#define pthread_getspecific PTHREAD_GETSPECIFIC +#define pthread_getunique_np PTHREAD_GETUNIQUE_NP +#define pthread_join PTHREAD_JOIN +#define pthread_join32 PTHREAD_JOIN32 +#define pthread_keycreate PTHREAD_KEYCREATE +#define pthread_key_create PTHREAD_KEY_CREATE +#define pthread_kill PTHREAD_KILL +#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP +#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY +#define pthread_mutex_init PTHREAD_MUTEX_INIT +#define pthread_mutex_lock PTHREAD_MUTEX_LOCK +#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK +#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK +#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE +#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE +#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY +#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP +#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT +#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP +#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP +#define pthread_once PTHREAD_ONCE +#define pthread_resume_np PTHREAD_RESUME_NP +#define pthread_self PTHREAD_SELF +#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL +#define pthread_setcancel PTHREAD_SETCANCEL +#define pthread_setcancelstate PTHREAD_SETCANCELSTATE +#define pthread_setprio PTHREAD_SETPRIO +#define pthread_setschedparam PTHREAD_SETSCHEDPARAM +#define pthread_setscheduler PTHREAD_SETSCHEDULER +#define pthread_setspecific PTHREAD_SETSPECIFIC +#define pthread_suspend_np PTHREAD_SUSPEND_NP +#define pthread_testcancel PTHREAD_TESTCANCEL +#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP +#define pthread_yield PTHREAD_YIELD +#define pthread_yield_np PTHREAD_YIELD_NP +#define XDefaultRootWindow XDEFAULTROOTWINDOW +#define XDisplayCells XDISPLAYCELLS +#define XMaxRequestSize XMAXREQUESTSIZE +#define XScreenOfDisplay XSCREENOFDISPLAY +#define XSetFillRule XSETFILLRULE +#define XmActivateProtocol XMACTIVATEPROTOCOL +#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG +#define XmCreateErrorDialog XMCREATEERRORDIALOG +#define XmCreateWarningDialog XMCREATEWARNINGDIALOG +#define XmCvtCTToXmString XMCVTCTTOXMSTRING +#define XmDestroyPixmap XMDESTROYPIXMAP +#define XmGetPixmap XMGETPIXMAP +#define XmInstallImage XMINSTALLIMAGE +#define XmListAddItems XMLISTADDITEMS +#define XmListDeleteItem XMLISTDELETEITEM +#define XmListItemExists XMLISTITEMEXISTS +#define XmListItemPos XMLISTITEMPOS +#define XmListReplaceItems XMLISTREPLACEITEMS +#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS +#define XmRemoveProtocols XMREMOVEPROTOCOLS +#define XmRemoveTabGroup XMREMOVETABGROUP +#define XmSetColorCalculation XMSETCOLORCALCULATION +#define XmTextCopy XMTEXTCOPY +#define XmTextCut XMTEXTCUT +#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION +#define XmTextFieldCopy XMTEXTFIELDCOPY +#define XmTextFieldCut XMTEXTFIELDCUT +#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH +#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION +#define XmTextFieldPaste XMTEXTFIELDPASTE +#define XmTextFieldReplace XMTEXTFIELDREPLACE +#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE +#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT +#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION +#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH +#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION +#define XmTextGetEditable XMTEXTGETEDITABLE +#define XmTextPaste XMTEXTPASTE +#define XmTextPosToXY XMTEXTPOSTOXY +#define XmTextSetEditable XMTEXTSETEDITABLE +#define XmTextShowPosition XMTEXTSHOWPOSITION +#define XmUninstallImage XMUNINSTALLIMAGE +#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP +#define XrmPutFileDatabase XRMPUTFILEDATABASE +#define XtAddConverter XTADDCONVERTER +#define XtError XTERROR +#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL +#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY +#define pthread_key_delete PTHREAD_KEY_DELETE +#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS +#define xmScaleWidgetClass XMSCALEWIDGETCLASS +#define XtDisplay XTDISPLAY +#define XtScreen XTSCREEN +#define XAllocIconSize XALLOCICONSIZE +#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP +#define XAllowEvents XALLOWEVENTS +#define XBlackPixel XBLACKPIXEL +#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE +#define XDefaultGC XDEFAULTGC +#define XDisplayHeight XDISPLAYHEIGHT +#define XDisplayWidth XDISPLAYWIDTH +#define XGetCommand XGETCOMMAND +#define XGetIconSizes XGETICONSIZES +#define XKillClient XKILLCLIENT +#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS +#define XRootWindow XROOTWINDOW +#define XWMGeometry XWMGEOMETRY +#define XWhitePixel XWHITEPIXEL +#define XrmCombineDatabase XRMCOMBINEDATABASE +#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE +#define XSetStandardProperties XSETSTANDARDPROPERTIES +#define XSetState XSETSTATE +#define XDrawRectangles XDRAWRECTANGLES +#define XGrabButton XGRABBUTTON +#define XLookupColor XLOOKUPCOLOR +#define XMapSubwindows XMAPSUBWINDOWS +#define XRecolorCursor XRECOLORCURSOR +#define XStoreBytes XSTOREBYTES +#define XUngrabButton XUNGRABBUTTON +#define XUninstallColormap XUNINSTALLCOLORMAP +#define lib$wait LIB$WAIT +#define lib$find_file LIB$FIND_FILE +#define lib$find_file_end LIB$FIND_FILE_END +#define lib$set_symbol LIB$SET_SYMBOL +#define lib$sfree1_dd LIB$SFREE1_DD +#define lib$spawn LIB$SPAWN +#define sys$assign SYS$ASSIGN +#define sys$crembx SYS$CREMBX +#define sys$dassgn SYS$DASSGN +#define sys$dclexh SYS$DCLEXH +#define sys$getdviw SYS$GETDVIW +#define sys$getsyiw SYS$GETSYIW +#define sys$qio SYS$QIO +#define sys$qiow SYS$QIOW +#define sys$setef SYS$SETEF +#define sys$synch SYS$SYNCH +#define XDrawText XDRAWTEXT +#define XtCloseDisplay XTCLOSEDISPLAY +#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT +#define lib$ediv LIB$EDIV +#define lib$subx LIB$SUBX +#define sys$bintim SYS$BINTIM +#define sys$gettim SYS$GETTIM +#define XFetchName XFETCHNAME +#define XPeekIfEvent XPEEKIFEVENT +#define XQueryKeymap XQUERYKEYMAP +#endif diff --git a/xc/extras/Mesa/src/OSmesa/osmesa.c b/xc/extras/Mesa/src/OSmesa/osmesa.c index cbb9d0faf..f8d9bbbca 100644 --- a/xc/extras/Mesa/src/OSmesa/osmesa.c +++ b/xc/extras/Mesa/src/OSmesa/osmesa.c @@ -489,7 +489,10 @@ OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height, else { *width = c->gl_buffer->Width; *height = c->gl_buffer->Height; - *bytesPerValue = sizeof(GLdepth); + if (c->gl_visual->DepthBits <= 16) + *bytesPerValue = sizeof(GLushort); + else + *bytesPerValue = sizeof(GLuint); *buffer = c->gl_buffer->DepthBuffer; return GL_TRUE; } diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c index 6c9f04aee..36b14fea0 100644 --- a/xc/extras/Mesa/src/X/fakeglx.c +++ b/xc/extras/Mesa/src/X/fakeglx.c @@ -64,7 +64,7 @@ #define SERVER_MINOR_VERSION 3 /* This is appended onto the glXGetClient/ServerString version strings. */ -#define MESA_GLX_VERSION "Mesa 3.4" +#define MESA_GLX_VERSION "Mesa 3.4.1" /* Who implemented this GLX? */ #define VENDOR "Brian Paul" diff --git a/xc/extras/Mesa/src/X/glxheader.h b/xc/extras/Mesa/src/X/glxheader.h index c175c56d0..5bd1f5c65 100644 --- a/xc/extras/Mesa/src/X/glxheader.h +++ b/xc/extras/Mesa/src/X/glxheader.h @@ -27,6 +27,10 @@ #ifndef GLX_HEADER_H #define GLX_HEADER_H +#ifdef VMS +#include <vms_x_fix.h> +#endif + #ifdef HAVE_CONFIG_H #include "conf.h" diff --git a/xc/extras/Mesa/src/X/xfonts.c b/xc/extras/Mesa/src/X/xfonts.c index b56d2471a..005ee3912 100644 --- a/xc/extras/Mesa/src/X/xfonts.c +++ b/xc/extras/Mesa/src/X/xfonts.c @@ -33,6 +33,11 @@ #include "conf.h" #endif +#ifdef VMS +#include <GL/vms_x_fix.h> +#endif + + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/xc/extras/Mesa/src/X/xfonts.h b/xc/extras/Mesa/src/X/xfonts.h index 1fe67f980..65da4eeef 100644 --- a/xc/extras/Mesa/src/X/xfonts.h +++ b/xc/extras/Mesa/src/X/xfonts.h @@ -27,6 +27,10 @@ #ifndef XFONTS_H #define XFONTS_H +#ifdef VMS +#include <vms_x_fix.h> +#endif + #include <X11/Xlib.h> diff --git a/xc/extras/Mesa/src/X/xmesa1.c b/xc/extras/Mesa/src/X/xmesa1.c index 338ab11f7..6bc339916 100644 --- a/xc/extras/Mesa/src/X/xmesa1.c +++ b/xc/extras/Mesa/src/X/xmesa1.c @@ -1,4 +1,4 @@ -/* $Id: xmesa1.c,v 1.1.1.10 2001/03/19 17:45:30 dawes Exp $ */ +/* $Id: xmesa1.c,v 1.1.1.11 2001/04/09 16:27:27 dawes Exp $ */ /* * Mesa 3-D graphics library @@ -2513,7 +2513,7 @@ const char *XMesaGetString( XMesaContext c, int name ) { (void) c; if (name==XMESA_VERSION) { - return "3.4"; + return "3.4.1"; } else if (name==XMESA_EXTENSIONS) { return ""; diff --git a/xc/extras/Mesa/src/X86/Makefile.am b/xc/extras/Mesa/src/X86/Makefile.am index 96c377198..ffabb1fbf 100644 --- a/xc/extras/Mesa/src/X86/Makefile.am +++ b/xc/extras/Mesa/src/X86/Makefile.am @@ -2,6 +2,28 @@ #AUTOMAKE_OPTIONS = no-dependencies + + +x86_files = \ + assyntax.h \ + common_x86.c \ + common_x86_asm.S \ + common_x86_asm.h \ + common_x86_features.h \ + glapi_x86.S \ + x86.c \ + x86.h \ + x86_cliptest.S \ + clip_args.h \ + x86_vertex.S \ + x86_xform_masked2.S \ + xform_args.h \ + x86_xform_masked3.S \ + x86_xform_masked4.S \ + x86_xform_raw2.S \ + x86_xform_raw3.S \ + x86_xform_raw4.S + x3dnow_files = \ 3dnow.c \ 3dnow.h \ @@ -14,7 +36,7 @@ x3dnow_files = \ 3dnow_xform_raw2.S \ 3dnow_xform_raw3.S \ 3dnow_xform_raw4.S \ - vertex_3dnow.S + 3dnow_vertex.S katmai_files = \ katmai.c \ @@ -28,7 +50,7 @@ katmai_files = \ katmai_xform_masked3.S \ katmai_xform_raw4.S \ katmai_xform_masked4.S \ - vertex_katmai.S + katmai_vertex.S mmx_files = mmx.h mmx_blend.S @@ -50,21 +72,12 @@ endif if HAVE_X86 # Build a libtool convenience library. noinst_LTLIBRARIES = libMesaX86.la +x86_sources = $(x86_files) CFLAGS_X86 = -DUSE_X86_ASM endif -libMesaX86_la_SOURCES = x86a.S assyntax.h \ - common_x86.c common_x86_asm.S common_x86_asm.h \ - common_x86_features.h glapi_x86.S \ - x86.c x86.h vertex.S $(mmx_sources) $(x3dnow_sources) $(katmai_sources) +libMesaX86_la_SOURCES = $(x86_sources) $(mmx_sources) $(x3dnow_sources) $(katmai_sources) INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src $(CFLAGS_X86) $(CFLAGS_MMX) $(CFLAGS_3DNOW) $(CFLAGS_KATMAI) -EXTRA_DIST = x86flatregs.m4 x86a.S.m4 $(x3dnow_files) $(mmx_files) $(katmai_files) - -x86a.S: $(srcdir)/x86flatregs.m4 -x86a.S: $(srcdir)/x86a.S.m4 - m4 $< >$@ - -x86a.asm: x86a.S - gcc -E -P -DNASM_ASSEMBLER $< >$@ +EXTRA_DIST = $(x3dnow_files) $(mmx_files) $(katmai_files) diff --git a/xc/extras/Mesa/src/X86/common_x86_asm.S b/xc/extras/Mesa/src/X86/common_x86_asm.S index f55e9b198..440aae749 100644 --- a/xc/extras/Mesa/src/X86/common_x86_asm.S +++ b/xc/extras/Mesa/src/X86/common_x86_asm.S @@ -32,7 +32,7 @@ * * Cleaned up and simplified by Gareth Hughes <gareth@valinux.com> */ -/* $XFree86: xc/extras/Mesa/src/X86/common_x86_asm.S,v 1.6 2001/01/17 12:50:11 alanh Exp $ */ +/* $XFree86: xc/extras/Mesa/src/X86/common_x86_asm.S,v 1.8 2001/03/21 02:48:58 dawes Exp $ */ #include "assyntax.h" #include "common_x86_features.h" @@ -58,8 +58,10 @@ GLNAME( found_intel ): STRING( "Genuine Intel processor found\n\0" ) GLNAME( found_amd ): STRING( "Authentic AMD processor found\n\0" ) +#ifdef USE_KATMAI_ASM GLNAME( katmai_test_dummy ): D_LONG 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 +#endif SEG_TEXT @@ -155,6 +157,7 @@ LLBL ( cpuid_done ): RET +#ifdef USE_KATMAI_ASM /* Execute an SSE instruction to see if the operating system correctly * supports SSE. A signal handler for SIGILL should have been set * before calling this function, otherwise this could kill the client @@ -203,3 +206,5 @@ GLNAME( gl_test_os_katmai_exception_support ): LEAVE RET + +#endif diff --git a/xc/extras/Mesa/src/attrib.c b/xc/extras/Mesa/src/attrib.c index 93e03802d..2c1bc1459 100644 --- a/xc/extras/Mesa/src/attrib.c +++ b/xc/extras/Mesa/src/attrib.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.4 + * Version: 3.4.1 * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * @@ -28,13 +28,29 @@ #include "all.h" #else #include "glheader.h" +#include "accum.h" +#include "alpha.h" #include "attrib.h" +#include "blend.h" #include "buffers.h" +#include "clip.h" #include "context.h" +#include "depth.h" #include "enable.h" #include "enums.h" +#include "fog.h" +#include "hint.h" +#include "light.h" +#include "lines.h" +#include "logic.h" +#include "masking.h" +#include "matrix.h" #include "mem.h" +#include "points.h" +#include "polygon.h" +#include "scissor.h" #include "simple_list.h" +#include "stencil.h" #include "texstate.h" #include "types.h" #endif @@ -562,52 +578,49 @@ _mesa_PopAttrib(void) switch (attr->kind) { case GL_ACCUM_BUFFER_BIT: - MEMCPY( &ctx->Accum, attr->data, sizeof(struct gl_accum_attrib) ); + { + const struct gl_accum_attrib *accum; + accum = (const struct gl_accum_attrib *) attr->data; + _mesa_ClearAccum(accum->ClearColor[0], + accum->ClearColor[1], + accum->ClearColor[2], + accum->ClearColor[3]); + } break; case GL_COLOR_BUFFER_BIT: { - GLenum oldDrawBuffer = ctx->Color.DrawBuffer; - GLenum oldAlphaFunc = ctx->Color.AlphaFunc; - GLubyte oldAlphaRef = ctx->Color.AlphaRef; - GLenum oldBlendSrc = ctx->Color.BlendSrcRGB; - GLenum oldBlendDst = ctx->Color.BlendDstRGB; - GLenum oldLogicOp = ctx->Color.LogicOp; - MEMCPY( &ctx->Color, attr->data, - sizeof(struct gl_colorbuffer_attrib) ); - if (ctx->Color.DrawBuffer != oldDrawBuffer) { - _mesa_DrawBuffer( ctx->Color.DrawBuffer); - } - if ((ctx->Color.BlendSrcRGB != oldBlendSrc || - ctx->Color.BlendDstRGB != oldBlendDst) && - ctx->Driver.BlendFunc) - (*ctx->Driver.BlendFunc)( ctx, ctx->Color.BlendSrcRGB, - ctx->Color.BlendDstRGB); - if (ctx->Color.LogicOp != oldLogicOp && - ctx->Driver.LogicOpcode) { - ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp ); - } - if (ctx->Visual->RGBAflag) { - GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); - GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); - GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); - GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F); - (*ctx->Driver.ClearColor)( ctx, r, g, b, a ); - if ((ctx->Color.AlphaFunc != oldAlphaFunc || - ctx->Color.AlphaRef != oldAlphaRef) && - ctx->Driver.AlphaFunc) - (*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc, - ctx->Color.AlphaRef / 255.0F); - if (ctx->Driver.ColorMask) { - (*ctx->Driver.ColorMask)(ctx, - ctx->Color.ColorMask[0], - ctx->Color.ColorMask[1], - ctx->Color.ColorMask[2], - ctx->Color.ColorMask[3]); - } - } - else { - (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex); - } + const struct gl_colorbuffer_attrib *color; + color = (const struct gl_colorbuffer_attrib *) attr->data; + _mesa_ClearIndex(color->ClearIndex); + _mesa_ClearColor(color->ClearColor[0], + color->ClearColor[1], + color->ClearColor[2], + color->ClearColor[3]); + _mesa_IndexMask(color->IndexMask); + _mesa_ColorMask((GLboolean) (color->ColorMask[0] != 0), + (GLboolean) (color->ColorMask[1] != 0), + (GLboolean) (color->ColorMask[2] != 0), + (GLboolean) (color->ColorMask[3] != 0)); + _mesa_DrawBuffer(color->DrawBuffer); + _mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled); + _mesa_AlphaFunc(color->AlphaFunc, + UBYTE_TO_FLOAT(color->AlphaRef)); + _mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled); + _mesa_BlendFuncSeparateEXT(color->BlendSrcRGB, + color->BlendDstRGB, + color->BlendSrcA, + color->BlendDstA); + _mesa_BlendEquation(color->BlendEquation); + _mesa_BlendColor(color->BlendColor[0], + color->BlendColor[1], + color->BlendColor[2], + color->BlendColor[3]); + _mesa_LogicOp(color->LogicOp); + _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, + color->ColorLogicOpEnabled); + _mesa_set_enable(ctx, GL_INDEX_LOGIC_OP, + color->IndexLogicOpEnabled); + _mesa_set_enable(ctx, GL_DITHER, color->DitherFlag); } break; case GL_CURRENT_BIT: @@ -616,20 +629,15 @@ _mesa_PopAttrib(void) break; case GL_DEPTH_BUFFER_BIT: { - GLboolean oldDepthTest = ctx->Depth.Test; - GLenum oldDepthFunc = ctx->Depth.Func; - GLboolean oldDepthMask = ctx->Depth.Mask; - GLfloat oldDepthClear = ctx->Depth.Clear; - MEMCPY( &ctx->Depth, attr->data, - sizeof(struct gl_depthbuffer_attrib) ); - if (ctx->Depth.Test != oldDepthTest && ctx->Driver.Enable) - (*ctx->Driver.Enable)( ctx, GL_DEPTH_TEST, ctx->Depth.Test); - if (ctx->Depth.Func != oldDepthFunc && ctx->Driver.DepthFunc) - (*ctx->Driver.DepthFunc)( ctx, ctx->Depth.Func ); - if (ctx->Depth.Mask != oldDepthMask && ctx->Driver.DepthMask) - (*ctx->Driver.DepthMask)( ctx, ctx->Depth.Mask ); - if (ctx->Depth.Clear != oldDepthClear && ctx->Driver.ClearDepth) - (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); + const struct gl_depthbuffer_attrib *depth; + depth = (const struct gl_depthbuffer_attrib *) attr->data; + _mesa_DepthFunc(depth->Func); + _mesa_ClearDepth(depth->Clear); + _mesa_set_enable(ctx, GL_DEPTH_TEST, depth->Test); + _mesa_DepthMask(depth->Mask); + if (ctx->Extensions.HaveHpOcclusionTest) + _mesa_set_enable(ctx, GL_OCCLUSION_TEST_HP, + depth->OcclusionTest); } break; case GL_ENABLE_BIT: @@ -637,6 +645,7 @@ _mesa_PopAttrib(void) const struct gl_enable_attrib *enable; enable = (const struct gl_enable_attrib *) attr->data; pop_enable_group(ctx, enable); + _mesa_set_enable(ctx, GL_POINT_SMOOTH, enable->PointSmooth); } break; case GL_EVAL_BIT: @@ -644,70 +653,81 @@ _mesa_PopAttrib(void) break; case GL_FOG_BIT: { - GLboolean anyChange = (GLboolean) (memcmp( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) ) != 0); - MEMCPY( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) ); - if (anyChange && ctx->Driver.Fogfv) { - const GLfloat mode = (GLfloat) ctx->Fog.Mode; - const GLfloat density = ctx->Fog.Density; - const GLfloat start = ctx->Fog.Start; - const GLfloat end = ctx->Fog.End; - const GLfloat index = ctx->Fog.Index; - (*ctx->Driver.Fogfv)( ctx, GL_FOG_MODE, &mode); - (*ctx->Driver.Fogfv)( ctx, GL_FOG_DENSITY, &density ); - (*ctx->Driver.Fogfv)( ctx, GL_FOG_START, &start ); - (*ctx->Driver.Fogfv)( ctx, GL_FOG_END, &end ); - (*ctx->Driver.Fogfv)( ctx, GL_FOG_INDEX, &index ); - (*ctx->Driver.Fogfv)( ctx, GL_FOG_COLOR, ctx->Fog.Color ); - } - ctx->Enabled &= ~ENABLE_FOG; - if (ctx->Fog.Enabled) ctx->Enabled |= ENABLE_FOG; + const struct gl_fog_attrib *fog; + fog = (const struct gl_fog_attrib *) attr->data; + _mesa_set_enable(ctx, GL_FOG, fog->Enabled); + _mesa_Fogfv(GL_FOG_COLOR, fog->Color); + _mesa_Fogf(GL_FOG_DENSITY, fog->Density); + _mesa_Fogf(GL_FOG_START, fog->Start); + _mesa_Fogf(GL_FOG_END, fog->End); + _mesa_Fogf(GL_FOG_INDEX, fog->Index); + _mesa_Fogi(GL_FOG_MODE, fog->Mode); } break; case GL_HINT_BIT: - MEMCPY( &ctx->Hint, attr->data, sizeof(struct gl_hint_attrib) ); - if (ctx->Driver.Hint) { - (*ctx->Driver.Hint)( ctx, GL_PERSPECTIVE_CORRECTION_HINT, - ctx->Hint.PerspectiveCorrection ); - (*ctx->Driver.Hint)( ctx, GL_POINT_SMOOTH_HINT, - ctx->Hint.PointSmooth); - (*ctx->Driver.Hint)( ctx, GL_LINE_SMOOTH_HINT, - ctx->Hint.LineSmooth ); - (*ctx->Driver.Hint)( ctx, GL_POLYGON_SMOOTH_HINT, - ctx->Hint.PolygonSmooth ); - (*ctx->Driver.Hint)( ctx, GL_FOG_HINT, ctx->Hint.Fog ); + { + const struct gl_hint_attrib *hint; + hint = (const struct gl_hint_attrib *) attr->data; + /* XXX this memcpy is temporary: */ + MEMCPY(&ctx->Hint, hint, sizeof(struct gl_hint_attrib)); + _mesa_Hint(GL_PERSPECTIVE_CORRECTION_HINT, + hint->PerspectiveCorrection ); + _mesa_Hint(GL_POINT_SMOOTH_HINT, hint->PointSmooth); + _mesa_Hint(GL_LINE_SMOOTH_HINT, hint->LineSmooth); + _mesa_Hint(GL_POLYGON_SMOOTH_HINT, hint->PolygonSmooth); + _mesa_Hint(GL_FOG_HINT, hint->Fog); + _mesa_Hint(GL_CLIP_VOLUME_CLIPPING_HINT_EXT, + hint->ClipVolumeClipping); + if (ctx->Extensions.HaveTextureCompression) + _mesa_Hint(GL_TEXTURE_COMPRESSION_HINT_ARB, + hint->TextureCompression); + /* XXX keep PGI_misc_hints? */ } break; case GL_LIGHTING_BIT: - MEMCPY( &ctx->Light, attr->data, sizeof(struct gl_light_attrib) ); - if (ctx->Driver.Enable) { + { GLuint i; + const struct gl_light_attrib *light; + light = (const struct gl_light_attrib *) attr->data; + /* lighting enable */ + _mesa_set_enable(ctx, GL_LIGHTING, light->Enabled); + /* per-light state */ for (i = 0; i < MAX_LIGHTS; i++) { - GLenum light = (GLenum) (GL_LIGHT0 + i); - (*ctx->Driver.Enable)( ctx, light, ctx->Light.Light[i].Enabled ); + GLenum lgt = (GLenum) (GL_LIGHT0 + i); + _mesa_set_enable(ctx, lgt, light->Light[i].Enabled); + MEMCPY(&ctx->Light.Light[i], &light->Light[i], + sizeof(struct gl_light)); } - (*ctx->Driver.Enable)( ctx, GL_LIGHTING, ctx->Light.Enabled ); + /* light model */ + _mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT, + light->Model.Ambient); + _mesa_LightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, + (GLfloat) light->Model.LocalViewer); + _mesa_LightModelf(GL_LIGHT_MODEL_TWO_SIDE, + (GLfloat) light->Model.TwoSide); + _mesa_LightModelf(GL_LIGHT_MODEL_COLOR_CONTROL, + (GLfloat) light->Model.ColorControl); + /* materials */ + MEMCPY(ctx->Light.Material, light->Material, + 2 * sizeof(struct gl_material)); + /* shade model */ + _mesa_ShadeModel(light->ShadeModel); + /* color material */ + _mesa_ColorMaterial(light->ColorMaterialFace, + light->ColorMaterialMode); + _mesa_set_enable(ctx, GL_COLOR_MATERIAL, + light->ColorMaterialEnabled); } - if (ctx->Light.ShadeModel == GL_FLAT) - ctx->TriangleCaps |= DD_FLATSHADE; - else - ctx->TriangleCaps &= ~DD_FLATSHADE; - if (ctx->Driver.ShadeModel) - (*ctx->Driver.ShadeModel)(ctx, ctx->Light.ShadeModel); - ctx->Enabled &= ~ENABLE_LIGHT; - if (ctx->Light.Enabled && !is_empty_list(&ctx->Light.EnabledList)) - ctx->Enabled |= ENABLE_LIGHT; break; case GL_LINE_BIT: - MEMCPY( &ctx->Line, attr->data, sizeof(struct gl_line_attrib) ); - if (ctx->Driver.Enable) { - (*ctx->Driver.Enable)( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag ); - (*ctx->Driver.Enable)( ctx, GL_LINE_STIPPLE, ctx->Line.StippleFlag ); + { + const struct gl_line_attrib *line; + line = (const struct gl_line_attrib *) attr->data; + _mesa_set_enable(ctx, GL_LINE_SMOOTH, line->SmoothFlag); + _mesa_set_enable(ctx, GL_LINE_STIPPLE, line->StippleFlag); + _mesa_LineStipple(line->StippleFactor, line->StipplePattern); + _mesa_LineWidth(line->Width); } - if (ctx->Driver.LineStipple) - (*ctx->Driver.LineStipple)(ctx, ctx->Line.StippleFactor, - ctx->Line.StipplePattern); - if (ctx->Driver.LineWidth) - (*ctx->Driver.LineWidth)(ctx, ctx->Line.Width); break; case GL_LIST_BIT: MEMCPY( &ctx->List, attr->data, sizeof(struct gl_list_attrib) ); @@ -716,30 +736,38 @@ _mesa_PopAttrib(void) MEMCPY( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) ); break; case GL_POINT_BIT: - MEMCPY( &ctx->Point, attr->data, sizeof(struct gl_point_attrib) ); - if (ctx->Driver.Enable) - (*ctx->Driver.Enable)( ctx, GL_POINT_SMOOTH, ctx->Point.SmoothFlag ); + { + const struct gl_point_attrib *point; + point = (const struct gl_point_attrib *) attr->data; + _mesa_PointSize(point->Size); + _mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag); + _mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, + point->Params); + _mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT, point->MinSize); + _mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT, point->MaxSize); + _mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, + point->Threshold); + } break; case GL_POLYGON_BIT: { - GLenum oldFrontMode = ctx->Polygon.FrontMode; - GLenum oldBackMode = ctx->Polygon.BackMode; - MEMCPY( &ctx->Polygon, attr->data, - sizeof(struct gl_polygon_attrib) ); - if ((ctx->Polygon.FrontMode != oldFrontMode || - ctx->Polygon.BackMode != oldBackMode) && - ctx->Driver.PolygonMode) { - (*ctx->Driver.PolygonMode)( ctx, GL_FRONT, ctx->Polygon.FrontMode); - (*ctx->Driver.PolygonMode)( ctx, GL_BACK, ctx->Polygon.BackMode); - } - if (ctx->Driver.CullFace) - ctx->Driver.CullFace( ctx, ctx->Polygon.CullFaceMode ); - - if (ctx->Driver.FrontFace) - ctx->Driver.FrontFace( ctx, ctx->Polygon.FrontFace ); - - if (ctx->Driver.Enable) - (*ctx->Driver.Enable)( ctx, GL_POLYGON_SMOOTH, ctx->Polygon.SmoothFlag ); + const struct gl_polygon_attrib *polygon; + polygon = (const struct gl_polygon_attrib *) attr->data; + _mesa_CullFace(polygon->CullFaceMode); + _mesa_FrontFace(polygon->FrontFace); + _mesa_PolygonMode(GL_FRONT, polygon->FrontMode); + _mesa_PolygonMode(GL_BACK, polygon->BackMode); + _mesa_PolygonOffset(polygon->OffsetFactor, + polygon->OffsetUnits); + _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, polygon->SmoothFlag); + _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, polygon->StippleFlag); + _mesa_set_enable(ctx, GL_CULL_FACE, polygon->CullFlag); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_POINT, + polygon->OffsetPoint); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_LINE, + polygon->OffsetLine); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, + polygon->OffsetFill); } break; case GL_POLYGON_STIPPLE_BIT: @@ -748,48 +776,53 @@ _mesa_PopAttrib(void) ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data ); break; case GL_SCISSOR_BIT: - MEMCPY( &ctx->Scissor, attr->data, - sizeof(struct gl_scissor_attrib) ); - if (ctx->Driver.Enable) - (*ctx->Driver.Enable)( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled ); - if (ctx->Driver.Scissor) - ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y, - ctx->Scissor.Width, ctx->Scissor.Height ); + { + const struct gl_scissor_attrib *scissor; + scissor = (const struct gl_scissor_attrib *) attr->data; + _mesa_Scissor(scissor->X, scissor->Y, + scissor->Width, scissor->Height); + _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->Enabled); + } break; case GL_STENCIL_BUFFER_BIT: - MEMCPY( &ctx->Stencil, attr->data, - sizeof(struct gl_stencil_attrib) ); - if (ctx->Driver.StencilFunc) - (*ctx->Driver.StencilFunc)( ctx, ctx->Stencil.Function, - ctx->Stencil.Ref, ctx->Stencil.ValueMask); - if (ctx->Driver.StencilMask) - (*ctx->Driver.StencilMask)( ctx, ctx->Stencil.WriteMask ); - if (ctx->Driver.StencilOp) - (*ctx->Driver.StencilOp)( ctx, ctx->Stencil.FailFunc, - ctx->Stencil.ZFailFunc, ctx->Stencil.ZPassFunc); - if (ctx->Driver.ClearStencil) - (*ctx->Driver.ClearStencil)( ctx, ctx->Stencil.Clear ); - if (ctx->Driver.Enable) - (*ctx->Driver.Enable)( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled ); - ctx->TriangleCaps &= ~DD_STENCIL; - if (ctx->Stencil.Enabled) - ctx->TriangleCaps |= DD_STENCIL; - + { + const struct gl_stencil_attrib *stencil; + stencil = (const struct gl_stencil_attrib *) attr->data; + _mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled); + _mesa_ClearStencil(stencil->Clear); + _mesa_StencilFunc(stencil->Function, stencil->Ref, + stencil->ValueMask); + _mesa_StencilMask(stencil->WriteMask); + _mesa_StencilOp(stencil->FailFunc, stencil->ZFailFunc, + stencil->ZPassFunc); + } break; case GL_TRANSFORM_BIT: - MEMCPY( &ctx->Transform, attr->data, - sizeof(struct gl_transform_attrib) ); - if (ctx->Driver.Enable) { - (*ctx->Driver.Enable)( ctx, GL_NORMALIZE, ctx->Transform.Normalize ); - (*ctx->Driver.Enable)( ctx, GL_RESCALE_NORMAL_EXT, ctx->Transform.RescaleNormals ); + { + GLuint i; + const struct gl_transform_attrib *xform; + xform = (const struct gl_transform_attrib *) attr->data; + _mesa_MatrixMode(xform->MatrixMode); + /* clip planes */ + MEMCPY(ctx->Transform.EyeUserPlane, xform->EyeUserPlane, + sizeof(xform->EyeUserPlane)); + MEMCPY(ctx->Transform.ClipUserPlane, xform->ClipUserPlane, + sizeof(xform->EyeUserPlane)); + /* clip plane enable flags */ + for (i = 0; i < MAX_CLIP_PLANES; i++) { + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, + xform->ClipEnabled[i]); + } + /* normalize/rescale */ + _mesa_set_enable(ctx, GL_NORMALIZE, ctx->Transform.Normalize); + _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT, + ctx->Transform.RescaleNormals); } - ctx->Enabled &= ~(ENABLE_NORMALIZE|ENABLE_RESCALE); - if (ctx->Transform.Normalize) ctx->Enabled |= ENABLE_NORMALIZE; - if (ctx->Transform.RescaleNormals) ctx->Enabled |= ENABLE_RESCALE; break; case GL_TEXTURE_BIT: /* Take care of texture object reference counters */ { + /* XXX call _mesa_Tex*() functions directly? */ GLuint u; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { ctx->Texture.Unit[u].CurrentD[1]->RefCount--; @@ -818,14 +851,13 @@ _mesa_PopAttrib(void) } break; case GL_VIEWPORT_BIT: - { - struct gl_viewport_attrib *v = - (struct gl_viewport_attrib *)attr->data; - - _mesa_Viewport( v->X, v->Y, v->Width, v->Height ); - _mesa_DepthRange( v->Near, v->Far ); - break; - } + { + const struct gl_viewport_attrib *vp; + vp = (const struct gl_viewport_attrib *)attr->data; + _mesa_Viewport(vp->X, vp->Y, vp->Width, vp->Height); + _mesa_DepthRange(vp->Near, vp->Far); + } + break; default: gl_problem( ctx, "Bad attrib flag in PopAttrib"); break; diff --git a/xc/extras/Mesa/src/clip.c b/xc/extras/Mesa/src/clip.c index 6cfd9e245..3afa104d1 100644 --- a/xc/extras/Mesa/src/clip.c +++ b/xc/extras/Mesa/src/clip.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.3 + * Version: 3.4.1 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul 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"), @@ -300,14 +300,8 @@ GLuint gl_userclip_point( GLcontext* ctx, const GLfloat v[] ) - -#if 0 -#define NEGATIVE(x) ((*(int *)&x)<0) -#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) -#else -#define NEGATIVE(x) (x < 0) -#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) -#endif +#define NEGATIVE(x) ((x) < 0.0) +#define DIFFERENT_SIGNS(a, b) (((a) * (b)) <= 0.0 && ((a) != (b))) static clip_poly_func gl_poly_clip_tab[2][5]; diff --git a/xc/extras/Mesa/src/copy_tmp.h b/xc/extras/Mesa/src/copy_tmp.h index a8b0b100c..ffc0f66c2 100644 --- a/xc/extras/Mesa/src/copy_tmp.h +++ b/xc/extras/Mesa/src/copy_tmp.h @@ -1,4 +1,4 @@ - +/* $XFree86: xc/extras/Mesa/src/copy_tmp.h,v 1.4 2001/04/01 13:59:57 tsi Exp $ */ /* * Mesa 3-D graphics library * Version: 3.1 @@ -27,7 +27,7 @@ * New (3.1) transformation code written by Keith Whitwell. */ - +#undef COPY_FUNC #define COPY_FUNC( BITS ) \ static void TAG2(copy, BITS)(GLvector4f *to, const GLvector4f *f, \ const GLubyte mask[] ) \ diff --git a/xc/extras/Mesa/src/depth.c b/xc/extras/Mesa/src/depth.c index 600ae105f..401555114 100644 --- a/xc/extras/Mesa/src/depth.c +++ b/xc/extras/Mesa/src/depth.c @@ -1629,29 +1629,31 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) if (ctx->Visual->DepthBits <= 16) { const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax); const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1; - const GLint width = ctx->DrawBuffer->Width; + const GLint cols = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1; + const GLint rowStride = ctx->DrawBuffer->Width; GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer - + ctx->DrawBuffer->Ymin * width + ctx->DrawBuffer->Xmin; + + ctx->DrawBuffer->Ymin * rowStride + ctx->DrawBuffer->Xmin; GLint i, j; for (i = 0; i < rows; i++) { - for (j = 0; j < width; j++) { + for (j = 0; j < cols; j++) { dRow[j] = clearValue; } - dRow += width; + dRow += rowStride; } } else { const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax); const GLint rows = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1; - const GLint width = ctx->DrawBuffer->Width; + const GLint cols = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1; + const GLint rowStride = ctx->DrawBuffer->Width; GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer - + ctx->DrawBuffer->Ymin * width + ctx->DrawBuffer->Xmin; + + ctx->DrawBuffer->Ymin * rowStride + ctx->DrawBuffer->Xmin; GLint i, j; for (i = 0; i < rows; i++) { - for (j = 0; j < width; j++) { + for (j = 0; j < cols; j++) { dRow[j] = clearValue; } - dRow += width; + dRow += rowStride; } } } diff --git a/xc/extras/Mesa/src/enable.c b/xc/extras/Mesa/src/enable.c index 1de2d32ac..af252e927 100644 --- a/xc/extras/Mesa/src/enable.c +++ b/xc/extras/Mesa/src/enable.c @@ -48,7 +48,7 @@ */ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) { - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" ); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, state ? "glEnable" : "glDisable" ); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "%s %s (newstate is %x)\n", diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c index 8eba883c8..d724141cb 100644 --- a/xc/extras/Mesa/src/get.c +++ b/xc/extras/Mesa/src/get.c @@ -5094,7 +5094,7 @@ _mesa_GetString( GLenum name ) GET_CURRENT_CONTEXT(ctx); static const char *vendor = "Brian Paul"; static const char *renderer = "Mesa"; - static const char *version = "1.2 Mesa 3.4"; + static const char *version = "1.2 Mesa 3.4.1"; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0); diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c index 1e857e317..3c1f10aad 100644 --- a/xc/extras/Mesa/src/image.c +++ b/xc/extras/Mesa/src/image.c @@ -1,20 +1,20 @@ /* * Mesa 3-D graphics library - * Version: 3.4 - * + * Version: 3.4.1 + * * Copyright (C) 1999-2000 Brian Paul 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 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 @@ -590,6 +590,891 @@ _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, + +void +_mesa_pack_float_rgba_span( GLcontext *ctx, + GLuint n, CONST GLfloat rgbaIn[][4], + GLenum dstFormat, GLenum dstType, + GLvoid *destination, + const struct gl_pixelstore_attrib *dstPacking, + GLboolean applyTransferOps ) +{ + const GLint comps = _mesa_components_in_format(dstFormat); + GLfloat luminance[MAX_WIDTH]; + GLfloat (*rgba)[4]; + GLuint i; + + /* + * Apply scale, bias and lookup-tables if enabled. + */ + if (applyTransferOps) { + /* make copy of incoming data */ + GLfloat rgbaCopy[MAX_WIDTH][4]; + for (i = 0; i < n; i++) { + rgbaCopy[i][0] = rgbaIn[i][0]; + rgbaCopy[i][1] = rgbaIn[i][1]; + rgbaCopy[i][2] = rgbaIn[i][2]; + rgbaCopy[i][3] = rgbaIn[i][3]; + } + + rgba = (GLfloat (*)[4]) rgbaCopy; + + /* scale & bias */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba( ctx, n, (GLfloat (*)[4]) rgba ); + } + /* color map lookup */ + if (ctx->Pixel.MapColorFlag) { + _mesa_map_rgba( ctx, n, rgba ); + } + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ + if (ctx->Pixel.PostConvolutionColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba); + } + /* color matrix transform */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); + if (ctx->MinMax.Sink) + return; + } + } + else { + /* use incoming data, not a copy */ + rgba = (GLfloat (*)[4]) rgbaIn; + } + + if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) { + for (i=0;i<n;i++) { + GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; + luminance[i] = CLAMP( sum, 0.0F, 1.0F ); + } + } + + /* + * Pack/store the pixels. Ugh! Lots of cases!!! + */ + switch (dstType) { + case GL_UNSIGNED_BYTE: + { + GLubyte *dst = (GLubyte *) destination; + switch (dstFormat) { + case GL_RED: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + break; + case GL_GREEN: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + break; + case GL_BLUE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + break; + case GL_ALPHA: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); + break; + case GL_LUMINANCE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UBYTE(luminance[i]); + break; + case GL_LUMINANCE_ALPHA: + for (i=0;i<n;i++) { + dst[i*2+0] = FLOAT_TO_UBYTE(luminance[i]); + dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); + } + break; + case GL_RGB: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + } + break; + case GL_RGBA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); + } + break; + case GL_BGR: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + } + break; + case GL_BGRA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); + } + break; + case GL_ABGR_EXT: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + } + break; + default: + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); + } + } + break; + case GL_BYTE: + { + GLbyte *dst = (GLbyte *) destination; + switch (dstFormat) { + case GL_RED: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + break; + case GL_GREEN: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + break; + case GL_BLUE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + break; + case GL_ALPHA: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + break; + case GL_LUMINANCE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_BYTE(luminance[i]); + break; + case GL_LUMINANCE_ALPHA: + for (i=0;i<n;i++) { + dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]); + dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + } + break; + case GL_RGB: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + } + break; + case GL_RGBA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + } + break; + case GL_BGR: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + } + break; + case GL_BGRA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + } + case GL_ABGR_EXT: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + } + break; + default: + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); + } + } + break; + case GL_UNSIGNED_SHORT: + { + GLushort *dst = (GLushort *) destination; + switch (dstFormat) { + case GL_RED: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + break; + case GL_GREEN: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + break; + case GL_BLUE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + break; + case GL_ALPHA: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_USHORT(rgba[i][ACOMP]); + break; + case GL_LUMINANCE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_USHORT(luminance[i]); + break; + case GL_LUMINANCE_ALPHA: + for (i=0;i<n;i++) { + dst[i*2+0] = FLOAT_TO_USHORT(luminance[i]); + dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][ACOMP]); + } + break; + case GL_RGB: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + } + break; + case GL_RGBA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); + } + break; + case GL_BGR: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + } + break; + case GL_BGRA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); + } + break; + case GL_ABGR_EXT: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + } + break; + default: + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); + } + if (dstPacking->SwapBytes) { + _mesa_swap2( (GLushort *) dst, n * comps); + } + } + break; + case GL_SHORT: + { + GLshort *dst = (GLshort *) destination; + switch (dstFormat) { + case GL_RED: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + break; + case GL_GREEN: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + break; + case GL_BLUE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + break; + case GL_ALPHA: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + break; + case GL_LUMINANCE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_SHORT(luminance[i]); + break; + case GL_LUMINANCE_ALPHA: + for (i=0;i<n;i++) { + dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]); + dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + } + break; + case GL_RGB: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + } + break; + case GL_RGBA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + } + break; + case GL_BGR: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + } + break; + case GL_BGRA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + } + case GL_ABGR_EXT: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + } + break; + default: + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); + } + if (dstPacking->SwapBytes) { + _mesa_swap2( (GLushort *) dst, n * comps ); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint *dst = (GLuint *) destination; + switch (dstFormat) { + case GL_RED: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UINT(rgba[i][RCOMP]); + break; + case GL_GREEN: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UINT(rgba[i][GCOMP]); + break; + case GL_BLUE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UINT(rgba[i][BCOMP]); + break; + case GL_ALPHA: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UINT(rgba[i][ACOMP]); + break; + case GL_LUMINANCE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_UINT(luminance[i]); + break; + case GL_LUMINANCE_ALPHA: + for (i=0;i<n;i++) { + dst[i*2+0] = FLOAT_TO_UINT(luminance[i]); + dst[i*2+1] = FLOAT_TO_UINT(rgba[i][ACOMP]); + } + break; + case GL_RGB: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); + } + break; + case GL_RGBA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); + } + break; + case GL_BGR: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); + } + break; + case GL_BGRA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); + } + break; + case GL_ABGR_EXT: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][RCOMP]); + } + break; + default: + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); + } + if (dstPacking->SwapBytes) { + _mesa_swap4( (GLuint *) dst, n * comps ); + } + } + break; + case GL_INT: + { + GLint *dst = (GLint *) destination; + switch (dstFormat) { + case GL_RED: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_INT(rgba[i][RCOMP]); + break; + case GL_GREEN: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_INT(rgba[i][GCOMP]); + break; + case GL_BLUE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_INT(rgba[i][BCOMP]); + break; + case GL_ALPHA: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_INT(rgba[i][ACOMP]); + break; + case GL_LUMINANCE: + for (i=0;i<n;i++) + dst[i] = FLOAT_TO_INT(luminance[i]); + break; + case GL_LUMINANCE_ALPHA: + for (i=0;i<n;i++) { + dst[i*2+0] = FLOAT_TO_INT(luminance[i]); + dst[i*2+1] = FLOAT_TO_INT(rgba[i][ACOMP]); + } + break; + case GL_RGB: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_INT(rgba[i][BCOMP]); + } + break; + case GL_RGBA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); + } + break; + case GL_BGR: + for (i=0;i<n;i++) { + dst[i*3+0] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_INT(rgba[i][RCOMP]); + } + break; + case GL_BGRA: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); + } + break; + case GL_ABGR_EXT: + for (i=0;i<n;i++) { + dst[i*4+0] = FLOAT_TO_INT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]); + } + break; + default: + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); + } + if (dstPacking->SwapBytes) { + _mesa_swap4( (GLuint *) dst, n * comps ); + } + } + break; + case GL_FLOAT: + { + GLfloat *dst = (GLfloat *) destination; + switch (dstFormat) { + case GL_RED: + for (i=0;i<n;i++) + dst[i] = rgba[i][RCOMP]; + break; + case GL_GREEN: + for (i=0;i<n;i++) + dst[i] = rgba[i][GCOMP]; + break; + case GL_BLUE: + for (i=0;i<n;i++) + dst[i] = rgba[i][BCOMP]; + break; + case GL_ALPHA: + for (i=0;i<n;i++) + dst[i] = rgba[i][ACOMP]; + break; + case GL_LUMINANCE: + for (i=0;i<n;i++) + dst[i] = luminance[i]; + break; + case GL_LUMINANCE_ALPHA: + for (i=0;i<n;i++) { + dst[i*2+0] = luminance[i]; + dst[i*2+1] = rgba[i][ACOMP]; + } + break; + case GL_RGB: + for (i=0;i<n;i++) { + dst[i*3+0] = rgba[i][RCOMP]; + dst[i*3+1] = rgba[i][GCOMP]; + dst[i*3+2] = rgba[i][BCOMP]; + } + break; + case GL_RGBA: + for (i=0;i<n;i++) { + dst[i*4+0] = rgba[i][RCOMP]; + dst[i*4+1] = rgba[i][GCOMP]; + dst[i*4+2] = rgba[i][BCOMP]; + dst[i*4+3] = rgba[i][ACOMP]; + } + break; + case GL_BGR: + for (i=0;i<n;i++) { + dst[i*3+0] = rgba[i][BCOMP]; + dst[i*3+1] = rgba[i][GCOMP]; + dst[i*3+2] = rgba[i][RCOMP]; + } + break; + case GL_BGRA: + for (i=0;i<n;i++) { + dst[i*4+0] = rgba[i][BCOMP]; + dst[i*4+1] = rgba[i][GCOMP]; + dst[i*4+2] = rgba[i][RCOMP]; + dst[i*4+3] = rgba[i][ACOMP]; + } + break; + case GL_ABGR_EXT: + for (i=0;i<n;i++) { + dst[i*4+0] = rgba[i][ACOMP]; + dst[i*4+1] = rgba[i][BCOMP]; + dst[i*4+2] = rgba[i][GCOMP]; + dst[i*4+3] = rgba[i][RCOMP]; + } + break; + default: + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); + } + if (dstPacking->SwapBytes) { + _mesa_swap4( (GLuint *) dst, n * comps ); + } + } + break; + case GL_UNSIGNED_BYTE_3_3_2: + if (dstFormat == GL_RGB) { + GLubyte *dst = (GLubyte *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) << 5) + | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 2) + | (((GLint) (rgba[i][BCOMP] * 3.0F)) ); + } + } + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + if (dstFormat == GL_RGB) { + GLubyte *dst = (GLubyte *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 3) + | (((GLint) (rgba[i][BCOMP] * 3.0F)) << 5); + } + } + break; + case GL_UNSIGNED_SHORT_5_6_5: + if (dstFormat == GL_RGB) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) ); + } + } + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + if (dstFormat == GL_RGB) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11); + } + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + if (dstFormat == GL_RGBA) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) ); + } + } + else if (dstFormat == GL_BGRA) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) << 12) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 12) + | (((GLint) (rgba[i][RCOMP] * 15.0F)) ); + } + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + if (dstFormat == GL_RGBA) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); + } + } + else if (dstFormat == GL_BGRA) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) ) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12); + } + } + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + if (dstFormat == GL_RGBA) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 1) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) ); + } + } + else if (dstFormat == GL_BGRA) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) + | (((GLint) (rgba[i][RCOMP] * 31.0F)) << 1) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 6) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 1) + | (((GLint) (rgba[i][RCOMP] * 1.0F)) ); + } + } + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + if (dstFormat == GL_RGBA) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 10) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); + } + } + else if (dstFormat == GL_BGRA) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) + | (((GLint) (rgba[i][RCOMP] * 31.0F)) << 10) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLushort *dst = (GLushort *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) ) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 5) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 10) + | (((GLint) (rgba[i][RCOMP] * 1.0F)) << 15); + } + } + break; + case GL_UNSIGNED_INT_8_8_8_8: + if (dstFormat == GL_RGBA) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); + } + } + else if (dstFormat == GL_BGRA) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) ); + } + } + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + if (dstFormat == GL_RGBA) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); + } + } + else if (dstFormat == GL_BGRA) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24); + } + } + break; + case GL_UNSIGNED_INT_10_10_10_2: + if (dstFormat == GL_RGBA) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); + } + } + else if (dstFormat == GL_BGRA) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][RCOMP] * 3.0F)) ); + } + } + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + if (dstFormat == GL_RGBA) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); + } + } + else if (dstFormat == GL_BGRA) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); + } + } + else if (dstFormat == GL_ABGR_EXT) { + GLuint *dst = (GLuint *) destination; + for (i=0;i<n;i++) { + dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][RCOMP] * 3.0F)) << 30); + } + } + break; + default: + gl_problem( ctx, "bad type in _mesa_pack_rgba_rgba_span" ); + } +} + + + /* * Pack the given RGBA span into client memory at 'dest' address * in the given pixel format and type. @@ -640,12 +1525,11 @@ _mesa_pack_rgba_span( GLcontext *ctx, } else { /* general solution */ - GLfloat rgba[MAX_WIDTH][4], luminance[MAX_WIDTH]; + GLfloat rgba[MAX_WIDTH][4]; const GLfloat rscale = 1.0F / 255.0F; const GLfloat gscale = 1.0F / 255.0F; const GLfloat bscale = 1.0F / 255.0F; const GLfloat ascale = 1.0F / 255.0F; - const GLint comps = _mesa_components_in_format(format); GLuint i; assert(n <= MAX_WIDTH); @@ -700,816 +1584,9 @@ _mesa_pack_rgba_span( GLcontext *ctx, } } - if (format==GL_LUMINANCE || format==GL_LUMINANCE_ALPHA) { - for (i=0;i<n;i++) { - GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; - luminance[i] = CLAMP( sum, 0.0F, 1.0F ); - } - } - - /* - * Pack/store the pixels. Ugh! Lots of cases!!! - */ - switch (type) { - case GL_UNSIGNED_BYTE: - { - GLubyte *dst = (GLubyte *) destination; - switch (format) { - case GL_RED: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); - break; - case GL_GREEN: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); - break; - case GL_BLUE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); - break; - case GL_ALPHA: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); - break; - case GL_LUMINANCE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(luminance[i]); - break; - case GL_LUMINANCE_ALPHA: - for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_UBYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); - } - break; - case GL_RGB: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); - dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); - } - break; - case GL_RGBA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); - dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); - dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); - } - break; - case GL_BGR: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); - dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); - } - break; - case GL_BGRA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); - dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); - dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); - } - break; - case GL_ABGR_EXT: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); - dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); - dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); - dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); - } - break; - default: - gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); - } - } - break; - case GL_BYTE: - { - GLbyte *dst = (GLbyte *) destination; - switch (format) { - case GL_RED: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - break; - case GL_GREEN: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - break; - case GL_BLUE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - break; - case GL_ALPHA: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]); - break; - case GL_LUMINANCE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(luminance[i]); - break; - case GL_LUMINANCE_ALPHA: - for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]); - } - break; - case GL_RGB: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - } - break; - case GL_RGBA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); - } - break; - case GL_BGR: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - } - break; - case GL_BGRA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); - } - case GL_ABGR_EXT: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]); - dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]); - dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]); - dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]); - } - break; - default: - gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); - } - } - break; - case GL_UNSIGNED_SHORT: - { - GLushort *dst = (GLushort *) destination; - switch (format) { - case GL_RED: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(rgba[i][RCOMP]); - break; - case GL_GREEN: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(rgba[i][GCOMP]); - break; - case GL_BLUE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(rgba[i][BCOMP]); - break; - case GL_ALPHA: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(rgba[i][ACOMP]); - break; - case GL_LUMINANCE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(luminance[i]); - break; - case GL_LUMINANCE_ALPHA: - for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_USHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][ACOMP]); - } - break; - case GL_RGB: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); - dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); - } - break; - case GL_RGBA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); - dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); - dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); - } - break; - case GL_BGR: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); - dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); - } - break; - case GL_BGRA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); - dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); - dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); - } - break; - case GL_ABGR_EXT: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][ACOMP]); - dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][BCOMP]); - dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][GCOMP]); - dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][RCOMP]); - } - break; - default: - gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); - } - if (packing->SwapBytes) { - _mesa_swap2( (GLushort *) dst, n * comps); - } - } - break; - case GL_SHORT: - { - GLshort *dst = (GLshort *) destination; - switch (format) { - case GL_RED: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - break; - case GL_GREEN: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - break; - case GL_BLUE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - break; - case GL_ALPHA: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]); - break; - case GL_LUMINANCE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(luminance[i]); - break; - case GL_LUMINANCE_ALPHA: - for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]); - } - break; - case GL_RGB: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - } - break; - case GL_RGBA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); - } - break; - case GL_BGR: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - } - break; - case GL_BGRA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); - } - case GL_ABGR_EXT: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]); - dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]); - dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]); - dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]); - } - break; - default: - gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); - } - if (packing->SwapBytes) { - _mesa_swap2( (GLushort *) dst, n * comps ); - } - } - break; - case GL_UNSIGNED_INT: - { - GLuint *dst = (GLuint *) destination; - switch (format) { - case GL_RED: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(rgba[i][RCOMP]); - break; - case GL_GREEN: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(rgba[i][GCOMP]); - break; - case GL_BLUE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(rgba[i][BCOMP]); - break; - case GL_ALPHA: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(rgba[i][ACOMP]); - break; - case GL_LUMINANCE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(luminance[i]); - break; - case GL_LUMINANCE_ALPHA: - for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_UINT(luminance[i]); - dst[i*2+1] = FLOAT_TO_UINT(rgba[i][ACOMP]); - } - break; - case GL_RGB: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); - dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); - } - break; - case GL_RGBA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); - dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); - dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); - } - break; - case GL_BGR: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); - dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); - } - break; - case GL_BGRA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); - dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); - dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); - } - break; - case GL_ABGR_EXT: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(rgba[i][ACOMP]); - dst[i*4+1] = FLOAT_TO_UINT(rgba[i][BCOMP]); - dst[i*4+2] = FLOAT_TO_UINT(rgba[i][GCOMP]); - dst[i*4+3] = FLOAT_TO_UINT(rgba[i][RCOMP]); - } - break; - default: - gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); - } - if (packing->SwapBytes) { - _mesa_swap4( (GLuint *) dst, n * comps ); - } - } - break; - case GL_INT: - { - GLint *dst = (GLint *) destination; - switch (format) { - case GL_RED: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(rgba[i][RCOMP]); - break; - case GL_GREEN: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(rgba[i][GCOMP]); - break; - case GL_BLUE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(rgba[i][BCOMP]); - break; - case GL_ALPHA: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(rgba[i][ACOMP]); - break; - case GL_LUMINANCE: - for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(luminance[i]); - break; - case GL_LUMINANCE_ALPHA: - for (i=0;i<n;i++) { - dst[i*2+0] = FLOAT_TO_INT(luminance[i]); - dst[i*2+1] = FLOAT_TO_INT(rgba[i][ACOMP]); - } - break; - case GL_RGB: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_INT(rgba[i][RCOMP]); - dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_INT(rgba[i][BCOMP]); - } - break; - case GL_RGBA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(rgba[i][RCOMP]); - dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_INT(rgba[i][BCOMP]); - dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); - } - break; - case GL_BGR: - for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_INT(rgba[i][BCOMP]); - dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); - dst[i*3+2] = FLOAT_TO_INT(rgba[i][RCOMP]); - } - break; - case GL_BGRA: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(rgba[i][BCOMP]); - dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); - dst[i*4+2] = FLOAT_TO_INT(rgba[i][RCOMP]); - dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); - } - break; - case GL_ABGR_EXT: - for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(rgba[i][ACOMP]); - dst[i*4+1] = FLOAT_TO_INT(rgba[i][BCOMP]); - dst[i*4+2] = FLOAT_TO_INT(rgba[i][GCOMP]); - dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]); - } - break; - default: - gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); - } - if (packing->SwapBytes) { - _mesa_swap4( (GLuint *) dst, n * comps ); - } - } - break; - case GL_FLOAT: - { - GLfloat *dst = (GLfloat *) destination; - switch (format) { - case GL_RED: - for (i=0;i<n;i++) - dst[i] = rgba[i][RCOMP]; - break; - case GL_GREEN: - for (i=0;i<n;i++) - dst[i] = rgba[i][GCOMP]; - break; - case GL_BLUE: - for (i=0;i<n;i++) - dst[i] = rgba[i][BCOMP]; - break; - case GL_ALPHA: - for (i=0;i<n;i++) - dst[i] = rgba[i][ACOMP]; - break; - case GL_LUMINANCE: - for (i=0;i<n;i++) - dst[i] = luminance[i]; - break; - case GL_LUMINANCE_ALPHA: - for (i=0;i<n;i++) { - dst[i*2+0] = luminance[i]; - dst[i*2+1] = rgba[i][ACOMP]; - } - break; - case GL_RGB: - for (i=0;i<n;i++) { - dst[i*3+0] = rgba[i][RCOMP]; - dst[i*3+1] = rgba[i][GCOMP]; - dst[i*3+2] = rgba[i][BCOMP]; - } - break; - case GL_RGBA: - for (i=0;i<n;i++) { - dst[i*4+0] = rgba[i][RCOMP]; - dst[i*4+1] = rgba[i][GCOMP]; - dst[i*4+2] = rgba[i][BCOMP]; - dst[i*4+3] = rgba[i][ACOMP]; - } - break; - case GL_BGR: - for (i=0;i<n;i++) { - dst[i*3+0] = rgba[i][BCOMP]; - dst[i*3+1] = rgba[i][GCOMP]; - dst[i*3+2] = rgba[i][RCOMP]; - } - break; - case GL_BGRA: - for (i=0;i<n;i++) { - dst[i*4+0] = rgba[i][BCOMP]; - dst[i*4+1] = rgba[i][GCOMP]; - dst[i*4+2] = rgba[i][RCOMP]; - dst[i*4+3] = rgba[i][ACOMP]; - } - break; - case GL_ABGR_EXT: - for (i=0;i<n;i++) { - dst[i*4+0] = rgba[i][ACOMP]; - dst[i*4+1] = rgba[i][BCOMP]; - dst[i*4+2] = rgba[i][GCOMP]; - dst[i*4+3] = rgba[i][RCOMP]; - } - break; - default: - gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); - } - if (packing->SwapBytes) { - _mesa_swap4( (GLuint *) dst, n * comps ); - } - } - break; - case GL_UNSIGNED_BYTE_3_3_2: - if (format == GL_RGB) { - GLubyte *dst = (GLubyte *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) << 5) - | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 2) - | (((GLint) (rgba[i][BCOMP] * 3.0F)) ); - } - } - break; - case GL_UNSIGNED_BYTE_2_3_3_REV: - if (format == GL_RGB) { - GLubyte *dst = (GLubyte *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) ) - | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 3) - | (((GLint) (rgba[i][BCOMP] * 3.0F)) << 5); - } - } - break; - case GL_UNSIGNED_SHORT_5_6_5: - if (format == GL_RGB) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) - | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) - | (((GLint) (rgba[i][BCOMP] * 31.0F)) ); - } - } - break; - case GL_UNSIGNED_SHORT_5_6_5_REV: - if (format == GL_RGB) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) - | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) - | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11); - } - } - break; - case GL_UNSIGNED_SHORT_4_4_4_4: - if (format == GL_RGBA) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12) - | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) - | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) - | (((GLint) (rgba[i][ACOMP] * 15.0F)) ); - } - } - else if (format == GL_BGRA) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) << 12) - | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) - | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 4) - | (((GLint) (rgba[i][ACOMP] * 15.0F)) ); - } - } - else if (format == GL_ABGR_EXT) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) << 4) - | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) - | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 12) - | (((GLint) (rgba[i][RCOMP] * 15.0F)) ); - } - } - break; - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - if (format == GL_RGBA) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) ) - | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) - | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) - | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); - } - } - else if (format == GL_BGRA) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) ) - | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) - | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 8) - | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); - } - } - else if (format == GL_ABGR_EXT) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) ) - | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) - | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) - | (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12); - } - } - break; - case GL_UNSIGNED_SHORT_5_5_5_1: - if (format == GL_RGBA) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) - | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) - | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 1) - | (((GLint) (rgba[i][ACOMP] * 1.0F)) ); - } - } - else if (format == GL_BGRA) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11) - | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) - | (((GLint) (rgba[i][RCOMP] * 31.0F)) << 1) - | (((GLint) (rgba[i][ACOMP] * 1.0F)) ); - } - } - else if (format == GL_ABGR_EXT) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) << 11) - | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 6) - | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 1) - | (((GLint) (rgba[i][RCOMP] * 1.0F)) ); - } - } - break; - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - if (format == GL_RGBA) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) - | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) - | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 10) - | (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); - } - } - else if (format == GL_BGRA) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) ) - | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) - | (((GLint) (rgba[i][RCOMP] * 31.0F)) << 10) - | (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); - } - } - else if (format == GL_ABGR_EXT) { - GLushort *dst = (GLushort *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) ) - | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 5) - | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 10) - | (((GLint) (rgba[i][RCOMP] * 1.0F)) << 15); - } - } - break; - case GL_UNSIGNED_INT_8_8_8_8: - if (format == GL_RGBA) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24) - | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) - | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) - | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); - } - } - else if (format == GL_BGRA) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 24) - | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) - | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 8) - | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); - } - } - else if (format == GL_ABGR_EXT) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24) - | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) - | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) - | (((GLuint) (rgba[i][RCOMP] * 255.0F)) ); - } - } - break; - case GL_UNSIGNED_INT_8_8_8_8_REV: - if (format == GL_RGBA) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) ) - | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) - | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) - | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); - } - } - else if (format == GL_BGRA) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) ) - | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) - | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 16) - | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); - } - } - else if (format == GL_ABGR_EXT) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) ) - | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) - | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) - | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24); - } - } - break; - case GL_UNSIGNED_INT_10_10_10_2: - if (format == GL_RGBA) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 22) - | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) - | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 2) - | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); - } - } - else if (format == GL_BGRA) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 22) - | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) - | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 2) - | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); - } - } - else if (format == GL_ABGR_EXT) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) << 22) - | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 12) - | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 2) - | (((GLuint) (rgba[i][RCOMP] * 3.0F)) ); - } - } - break; - case GL_UNSIGNED_INT_2_10_10_10_REV: - if (format == GL_RGBA) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) ) - | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) - | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 20) - | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); - } - } - else if (format == GL_BGRA) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) ) - | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) - | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 20) - | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); - } - } - else if (format == GL_ABGR_EXT) { - GLuint *dst = (GLuint *) destination; - for (i=0;i<n;i++) { - dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) ) - | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 10) - | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 20) - | (((GLuint) (rgba[i][RCOMP] * 3.0F)) << 30); - } - } - break; - default: - gl_problem( ctx, "bad type in _mesa_pack_rgba_span" ); - } + _mesa_pack_float_rgba_span(ctx, n, (const GLfloat (*)[4]) rgba, + format, type, destination, + packing, applyTransferOps); } } @@ -1775,7 +1852,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], alphaIndex = 0; stride = 1; break; - case GL_LUMINANCE: + case GL_LUMINANCE: redIndex = greenIndex = blueIndex = 0; alphaIndex = -1; stride = 1; @@ -2123,7 +2200,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; - rgba[i][rComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 24) ); + rgba[i][rComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 24) ); rgba[i][gComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 16) & 0xff); rgba[i][bComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 8) & 0xff); rgba[i][aComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p ) & 0xff); @@ -2137,7 +2214,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], rgba[i][rComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p ) & 0xff); rgba[i][gComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 8) & 0xff); rgba[i][bComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 16) & 0xff); - rgba[i][aComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 24) ); + rgba[i][aComp] = UBYTE_COLOR_TO_FLOAT_COLOR((p >> 24) ); } } break; @@ -2226,7 +2303,7 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, GLboolean applyTransferOps ) { ASSERT(dstFormat == GL_ALPHA || - dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || dstFormat == GL_INTENSITY || dstFormat == GL_RGB || @@ -2438,7 +2515,7 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, dstRedIndex = dstGreenIndex = dstBlueIndex = -1; dstLuminanceIndex = dstIntensityIndex = -1; break; - case GL_LUMINANCE: + case GL_LUMINANCE: dstLuminanceIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstIntensityIndex = -1; @@ -2545,7 +2622,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, GLboolean applyTransferOps, GLboolean clamp ) { ASSERT(dstFormat == GL_ALPHA || - dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || dstFormat == GL_INTENSITY || dstFormat == GL_RGB || @@ -2707,7 +2784,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, dstRedIndex = dstGreenIndex = dstBlueIndex = -1; dstLuminanceIndex = dstIntensityIndex = -1; break; - case GL_LUMINANCE: + case GL_LUMINANCE: dstLuminanceIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstIntensityIndex = -1; diff --git a/xc/extras/Mesa/src/image.h b/xc/extras/Mesa/src/image.h index 65c12c53c..c3788c44d 100644 --- a/xc/extras/Mesa/src/image.h +++ b/xc/extras/Mesa/src/image.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.3 + * Version: 3.4.1 * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * @@ -79,6 +79,15 @@ _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, extern void +_mesa_pack_float_rgba_span( GLcontext *ctx, + GLuint n, CONST GLfloat rgba[][4], + GLenum dstFormat, GLenum dstType, + GLvoid *dstAddr, + const struct gl_pixelstore_attrib *dstPacking, + GLboolean applyTransferOps ); + + +extern void _mesa_pack_rgba_span( GLcontext *ctx, GLuint n, CONST GLubyte rgba[][4], GLenum format, GLenum type, GLvoid *dest, diff --git a/xc/extras/Mesa/src/interp_tmp.h b/xc/extras/Mesa/src/interp_tmp.h index 2133629bc..0c9b4c287 100644 --- a/xc/extras/Mesa/src/interp_tmp.h +++ b/xc/extras/Mesa/src/interp_tmp.h @@ -1,4 +1,4 @@ - +/* $XFree86: xc/extras/Mesa/src/interp_tmp.h,v 1.5 2001/04/01 13:59:57 tsi Exp $ */ /* * Mesa 3-D graphics library * Version: 3.1 @@ -23,6 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#undef INTERP_UBYTE #define INTERP_UBYTE( out, t, a, b ) { \ GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR(a); \ GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR(b); \ @@ -32,6 +33,7 @@ #if 1 +#undef INTERP_RGBA #define INTERP_RGBA(nr, t, out, a, b) { \ int i; \ for (i = 0; i < nr; i++) { \ @@ -43,6 +45,7 @@ } #else +#undef INTERP_RGBA #define INTERP_RGBA(nr, t, out, a, b) { \ int n; \ const GLuint ti = FloatToInt(t*256.0F); \ diff --git a/xc/extras/Mesa/src/logic.c b/xc/extras/Mesa/src/logic.c index 872cb48d6..31d6462fb 100644 --- a/xc/extras/Mesa/src/logic.c +++ b/xc/extras/Mesa/src/logic.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.3 + * Version: 3.4.1 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul 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"), @@ -94,7 +94,7 @@ static void index_logicop( GLcontext *ctx, GLuint n, case GL_SET: for (i=0;i<n;i++) { if (mask[i]) { - index[i] = 1; + index[i] = ~0; } } break; @@ -259,7 +259,7 @@ static void rgba_logicop( const GLcontext *ctx, GLuint n, case GL_SET: for (i=0;i<n;i++) { if (mask[i]) { - src[i] = 0xffffffff; + src[i] = ~0; } } break; diff --git a/xc/extras/Mesa/src/macros.h b/xc/extras/Mesa/src/macros.h index 16038d3b1..e61db9efa 100644 --- a/xc/extras/Mesa/src/macros.h +++ b/xc/extras/Mesa/src/macros.h @@ -1,20 +1,20 @@ /* * Mesa 3-D graphics library - * Version: 3.3 - * + * Version: 3.4 + * * Copyright (C) 1999 Brian Paul 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 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 @@ -89,7 +89,7 @@ #define TEST_BITS(WORD, BITS) ((WORD) & (BITS)) -/* Stepping a GLfloat pointer by a byte stride +/* Stepping a GLfloat pointer by a byte stride */ #define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) #define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i)) @@ -160,7 +160,7 @@ do { \ case 2: (DST)[1] = (SRC)[1]; \ case 1: (DST)[0] = (SRC)[0]; \ } \ -} while(0) +} while(0) #define SUB_4V( DST, SRCA, SRCB ) \ do { \ @@ -496,4 +496,31 @@ do { \ #define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) + +/* Generic color packing macros + */ + +#define PACK_COLOR_8888( a, b, c, d ) \ + (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) + +#define PACK_COLOR_888( a, b, c ) \ + (((a) << 16) | ((b) << 8) | (c)) + +#define PACK_COLOR_565( a, b, c ) \ + ((((a) & 0xf8) << 8) | (((b) & 0xfc) << 3) | (((c) & 0xf8) >> 3)) + +#define PACK_COLOR_1555( a, b, c, d ) \ + ((((b) & 0xf8) << 7) | (((c) & 0xf8) << 2) | (((d) & 0xf8) >> 3) | \ + ((a) ? 0x8000 : 0)) + +#define PACK_COLOR_4444( a, b, c, d ) \ + ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((c) & 0xf0) | ((d) >> 4)) + +#define PACK_COLOR_88( a, b ) \ + (((a) << 8) | (b)) + +#define PACK_COLOR_332( a, b, c ) \ + (((a) & 0xe0) | (((b) & 0xe0) >> 3) | (((c) & 0xc0) >> 6)) + + #endif /*MACROS_H*/ diff --git a/xc/extras/Mesa/src/matrix.c b/xc/extras/Mesa/src/matrix.c index 7fc3e9404..3df43f4fb 100644 --- a/xc/extras/Mesa/src/matrix.c +++ b/xc/extras/Mesa/src/matrix.c @@ -1451,6 +1451,9 @@ _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) void gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { + const GLfloat n = ctx->Viewport.Near; + const GLfloat f = ctx->Viewport.Far; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glViewport"); if (width<0 || height<0) { @@ -1476,8 +1479,8 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) ctx->Viewport.WindowMap.m[MAT_TX] = ctx->Viewport.WindowMap.m[MAT_SX] + x; ctx->Viewport.WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F; ctx->Viewport.WindowMap.m[MAT_TY] = ctx->Viewport.WindowMap.m[MAT_SY] + y; - ctx->Viewport.WindowMap.m[MAT_SZ] = 0.5 * ctx->Visual->DepthMaxF; - ctx->Viewport.WindowMap.m[MAT_TZ] = 0.5 * ctx->Visual->DepthMaxF; + ctx->Viewport.WindowMap.m[MAT_SZ] = ctx->Visual->DepthMaxF * ((f - n) / 2.0); + ctx->Viewport.WindowMap.m[MAT_TZ] = ctx->Visual->DepthMaxF * ((f - n) / 2.0 + n); ctx->Viewport.WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT; diff --git a/xc/extras/Mesa/src/readpix.c b/xc/extras/Mesa/src/readpix.c index 96df972cd..eb0ccf5aa 100644 --- a/xc/extras/Mesa/src/readpix.c +++ b/xc/extras/Mesa/src/readpix.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.4 + * Version: 3.4.1 * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * @@ -587,6 +587,50 @@ read_fast_rgba_pixels( GLcontext *ctx, } +/* + * This function converts an array of GLchan colors to GLfloat colors. + * Most importantly, it undoes the non-uniform quantization of pixel + * values introduced when we convert shallow (< 8 bit) pixel values + * to GLubytes in the ctx->Driver.ReadRGBASpan() functions. + * This fixes a number of OpenGL conformance failures when running on + * 16bpp displays, for example. + */ +static void +ubyte_to_float_span(const GLcontext *ctx, GLuint n, + CONST GLubyte rgba[][4], GLfloat rgbaf[][4]) +{ + const GLuint rShift = 8 - ctx->Visual->RedBits; + const GLuint gShift = 8 - ctx->Visual->GreenBits; + const GLuint bShift = 8 - ctx->Visual->BlueBits; + GLuint aShift; + const GLfloat rScale = 1.0 / (GLfloat) ((1 << ctx->Visual->RedBits ) - 1); + const GLfloat gScale = 1.0 / (GLfloat) ((1 << ctx->Visual->GreenBits) - 1); + const GLfloat bScale = 1.0 / (GLfloat) ((1 << ctx->Visual->BlueBits ) - 1); + GLfloat aScale; + GLuint i; + + if (ctx->Visual->AlphaBits > 0) { + aShift = 8 - ctx->Visual->AlphaBits; + aScale = 1.0 / (GLfloat) ((1 << ctx->Visual->AlphaBits) - 1); + } + else { + aShift = 0; + aScale = 1.0F / 255.0F; + } + + for (i = 0; i < n; i++) { + const GLint r = rgba[i][RCOMP] >> rShift; + const GLint g = rgba[i][GCOMP] >> gShift; + const GLint b = rgba[i][BCOMP] >> bShift; + const GLint a = rgba[i][ACOMP] >> aShift; + rgbaf[i][RCOMP] = (GLfloat) r * rScale; + rgbaf[i][GCOMP] = (GLfloat) g * gScale; + rgbaf[i][BCOMP] = (GLfloat) b * bScale; + rgbaf[i][ACOMP] = (GLfloat) a * aScale; + } +} + + /* * Read R, G, B, A, RGB, L, or LA pixels. @@ -656,8 +700,26 @@ static void read_rgba_pixels( GLcontext *ctx, dest = _mesa_image_address( packing, pixels, width, height, format, type, 0, j, 0); - _mesa_pack_rgba_span( ctx, readWidth, (CONST GLubyte (*)[4]) rgba, - format, type, dest, packing, GL_TRUE ); + if (ctx->Visual->RedBits < 8 || + ctx->Visual->GreenBits < 8 || + ctx->Visual->BlueBits < 8) { + /* Requantize the color values into floating point and go from + * there. This fixes conformance failures with 16-bit color + * buffers, for example. + */ + GLfloat rgbaf[MAX_WIDTH][4]; + ubyte_to_float_span(ctx, readWidth, + (CONST GLubyte (*)[4]) rgba, rgbaf); + _mesa_pack_float_rgba_span(ctx, readWidth, + (CONST GLfloat (*)[4]) rgbaf, + format, type, dest, packing, + GL_TRUE); + } + else { + /* GLubytes are fine */ + _mesa_pack_rgba_span(ctx, readWidth, (CONST GLchan (*)[4]) rgba, + format, type, dest, packing, GL_TRUE); + } } } else { diff --git a/xc/extras/Mesa/src/shade_tmp.h b/xc/extras/Mesa/src/shade_tmp.h index 3de4182be..26cc42015 100644 --- a/xc/extras/Mesa/src/shade_tmp.h +++ b/xc/extras/Mesa/src/shade_tmp.h @@ -2,19 +2,19 @@ /* * Mesa 3-D graphics library * Version: 3.4 - * + * * Copyright (C) 1999-2000 Brian Paul 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 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 @@ -38,7 +38,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) GLuint vstride = VB->Unprojected->stride; const GLfloat *vertex = VB->Unprojected->start; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = VB->NormalPtr->start; CONST GLfloat (*first_normal)[3] = (CONST GLfloat (*)[3]) VB->NormalPtr->start; @@ -49,7 +49,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) GLubyte (*Fcolor)[4] = (GLubyte (*)[4])VB->LitColor[0]->start; GLubyte (*Bcolor)[4] = (GLubyte (*)[4])VB->LitColor[1]->start; GLubyte (*Fspec)[4] = VB->Spec[0] + VB->Start; - GLubyte (*Bspec)[4] = VB->Spec[1] + VB->Start; + GLubyte (*Bspec)[4] = VB->Spec[1] + VB->Start; GLubyte *mask = VB->CullMask + VB->Start; GLubyte *cullmask = mask; GLuint *flags = VB->Flag + VB->Start; @@ -68,7 +68,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) if (ctx->Light.ColorMaterialEnabled) { cm_flags = VERT_RGBA; - if (VB->ColorPtr->flags & VEC_BAD_STRIDE) + if (VB->ColorPtr->flags & VEC_BAD_STRIDE) gl_clean_color(VB); CMcolor = (GLubyte (*)[4])VB->ColorPtr->start; @@ -79,20 +79,19 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) VB->ColorPtr = VB->LitColor[0]; VB->Specular = VB->Spec[0]; - for ( j=0 ; j<nr ; j++,STRIDE_F(vertex,vstride),NEXT_VERTEX_NORMAL) { GLfloat sum[2][3], spec[2][3]; struct gl_light *light; - - if ( flags[j] & cm_flags ) + + if ( flags[j] & cm_flags ) gl_update_color_material( ctx, CMcolor[j] ); - + if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); - if ( CULL(*mask) ) + if ( CULL(*mask) ) continue; - + if (LIGHT_FRONT(*mask)) { COPY_3V(sum[0], base[0]); ZERO_3V(spec[0]); @@ -102,12 +101,12 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) COPY_3V(sum[1], base[1]); ZERO_3V(spec[1]); } - + /* Add contribution from each enabled light source */ foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h; GLfloat correction; - GLint side; + GLint side; GLfloat contrib[3]; GLfloat attenuation; GLfloat VP[3]; /* unit vector from vertex to light */ @@ -132,15 +131,15 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) GLfloat invd = 1.0F / d; SELF_SCALE_SCALAR_3V(VP, invd); } - - attenuation = 1.0F / (light->ConstantAttenuation + d * - (light->LinearAttenuation + d * + + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ if (light->Flags & LIGHT_SPOT) { GLfloat PV_dot_dir = - DOT3(VP, light->NormDirection); - + if (PV_dot_dir<light->CosCutoff) { continue; /* this light makes no contribution */ } @@ -155,7 +154,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) } - if (attenuation < 1e-3) + if (attenuation < 1e-3) continue; /* this light makes no contribution */ /* Compute dot product or normal and vector from V to light pos */ @@ -176,13 +175,13 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) else { if (LIGHT_REAR(*mask)) { ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->MatAmbient[1]); - } + } if (!LIGHT_FRONT(*mask)) { continue; } side = 0; correction = 1; - } + } /* diffuse term */ COPY_3V(contrib, light->MatAmbient[side]); @@ -210,7 +209,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) h = light->h_inf_norm; normalized = 1; } - + n_dot_h = correction * DOT3(normal, h); if (n_dot_h > 0.0F) { @@ -222,7 +221,7 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) n_dot_h /= LEN_SQUARED_3FV( h ); tab = ctx->ShineTable[side+2]; } - + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); if (spec_coef > 1.0e-10) { @@ -244,11 +243,11 @@ static void TAG(shade_rgba_spec)( struct vertex_buffer *VB ) FLOAT_RGB_TO_UBYTE_RGB( Bspec[j], spec[1] ); Bcolor[j][3] = sumA[1]; } - } + } - if ( flags[j] & cm_flags ) + if ( flags[j] & cm_flags ) gl_update_color_material( ctx, CMcolor[j] ); - + if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); } @@ -264,7 +263,7 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) GLuint vstride = VB->Unprojected->stride; const GLfloat *vertex = (GLfloat *)VB->Unprojected->start; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = VB->NormalPtr->start; CONST GLfloat (*first_normal)[3] = (CONST GLfloat (*)[3])VB->NormalPtr->start; @@ -288,7 +287,7 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) if (ctx->Light.ColorMaterialEnabled) { cm_flags = VERT_RGBA; - if (VB->ColorPtr->flags & VEC_BAD_STRIDE) + if (VB->ColorPtr->flags & VEC_BAD_STRIDE) gl_clean_color(VB); CMcolor = (GLubyte (*)[4])VB->ColorPtr->start; @@ -297,31 +296,32 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) VB->ColorPtr = VB->LitColor[0]; VB->Color[0] = VB->LitColor[0]; VB->Color[1] = VB->LitColor[1]; + VB->Specular = VB->Spec[0]; for ( j=0 ; j<nr ; j++,STRIDE_F(vertex,vstride),NEXT_VERTEX_NORMAL) { GLfloat sum[2][3]; struct gl_light *light; - if ( flags[j] & cm_flags ) + if ( flags[j] & cm_flags ) gl_update_color_material( ctx, CMcolor[j] ); - + if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); - if ( CULL(*mask) ) - continue; + if ( CULL(*mask) ) + continue; COPY_3V(sum[0], base[0]); - - if ( NR_SIDES == 2 ) + + if ( NR_SIDES == 2 ) COPY_3V(sum[1], base[1]); - + /* Add contribution from each enabled light source */ foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h; GLfloat correction; - GLint side; + GLint side; GLfloat contrib[3]; GLfloat attenuation = 1.0; GLfloat VP[3]; /* unit vector from vertex to light */ @@ -348,8 +348,8 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) SELF_SCALE_SCALAR_3V(VP, invd); } - attenuation = 1.0F / (light->ConstantAttenuation + d * - (light->LinearAttenuation + d * + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ @@ -369,8 +369,8 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) } } - - if (attenuation < 1e-3) + + if (attenuation < 1e-3) continue; /* this light makes no contribution */ @@ -383,7 +383,7 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->MatAmbient[0]); } if (!LIGHT_REAR(*mask)) - continue; + continue; side = 1; correction = -1; @@ -392,13 +392,13 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) else { if (LIGHT_REAR(*mask)) { ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->MatAmbient[1]); - } + } if (!LIGHT_FRONT(*mask)) - continue; + continue; side = 0; correction = 1; - } - + } + COPY_3V(contrib, light->MatAmbient[side]); /* diffuse term */ @@ -423,10 +423,10 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) h = light->h_inf_norm; normalized = 1; } - + n_dot_h = correction * DOT3(normal, h); - if (n_dot_h > 0.0F) + if (n_dot_h > 0.0F) { GLfloat spec_coef; struct gl_shine_tab *tab = ctx->ShineTable[side]; @@ -436,7 +436,7 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) n_dot_h /= LEN_SQUARED_3FV( h ); tab = ctx->ShineTable[side+2]; } - + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); ACC_SCALE_SCALAR_3V( contrib, spec_coef, @@ -445,7 +445,7 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) } ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib ); - } + } if (LIGHT_FRONT(*mask)) { FLOAT_RGB_TO_UBYTE_RGB( Fcolor[j], sum[0] ); @@ -456,11 +456,11 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) FLOAT_RGB_TO_UBYTE_RGB( Bcolor[j], sum[1] ); Bcolor[j][3] = sumA[1]; } - } + } - if ( flags[j] & cm_flags ) + if ( flags[j] & cm_flags ) gl_update_color_material( ctx, CMcolor[j] ); - + if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); } @@ -473,9 +473,9 @@ static void TAG(shade_rgba)( struct vertex_buffer *VB ) static void TAG(shade_fast_rgba_single)( struct vertex_buffer *VB ) { GLcontext *ctx = VB->ctx; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = VB->NormalPtr->start; - CONST GLfloat (*first_normal)[3] = + CONST GLfloat (*first_normal)[3] = (CONST GLfloat (*)[3])VB->NormalPtr->start; GLubyte (*Fcolor)[4] = (GLubyte (*)[4])VB->LitColor[0]->start; GLubyte (*Bcolor)[4] = (GLubyte (*)[4])VB->LitColor[1]->start; @@ -493,7 +493,7 @@ static void TAG(shade_fast_rgba_single)( struct vertex_buffer *VB ) (void) first_normal; (void) nstride; - if ( flags[j] & VERT_MATERIAL ) + if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); /* No attenuation, so incoporate MatAmbient into base color. @@ -515,12 +515,13 @@ static void TAG(shade_fast_rgba_single)( struct vertex_buffer *VB ) VB->ColorPtr = VB->LitColor[0]; VB->Color[0] = VB->LitColor[0]; VB->Color[1] = VB->LitColor[1]; + VB->Specular = VB->Spec[0]; do { do { if ( !CULL(*mask) ) { GLfloat n_dot_VP = DOT3(normal, light->VP_inf_norm); - + COPY_4UBV(Fcolor[j], baseubyte[0]); if (NR_SIDES == 2) COPY_4UBV(Bcolor[j], baseubyte[1]); @@ -534,13 +535,13 @@ static void TAG(shade_fast_rgba_single)( struct vertex_buffer *VB ) ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->MatDiffuse[1]); ACC_SCALE_SCALAR_3V(sum, spec, light->MatSpecular[1]); FLOAT_RGB_TO_UBYTE_RGB(Bcolor[j], sum ); - } + } } } else { if (LIGHT_FRONT(*mask)) { GLfloat n_dot_h = DOT3(normal, light->h_inf_norm); if (n_dot_h > 0.0F) { - GLfloat spec, sum[3]; + GLfloat spec, sum[3]; GET_SHINE_TAB_ENTRY( ctx->ShineTable[0], n_dot_h, spec ); COPY_3V(sum, base[0]); ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->MatDiffuse[0]); @@ -549,17 +550,17 @@ static void TAG(shade_fast_rgba_single)( struct vertex_buffer *VB ) } } } - } + } j++; NEXT_NORMAL; } while ((flags[j] & (VERT_MATERIAL|VERT_END_VB|VERT_NORM)) == VERT_NORM); - + if (COMPACTED) { GLuint last = j-1; for ( ; !(flags[j] & (VERT_MATERIAL|VERT_END_VB|VERT_NORM)) ; j++ ) { COPY_4UBV(Fcolor[j], Fcolor[last]); - if (NR_SIDES==2) + if (NR_SIDES==2) COPY_4UBV(Bcolor[j], Bcolor[last]); } NEXT_NORMAL; @@ -582,17 +583,17 @@ static void TAG(shade_fast_rgba_single)( struct vertex_buffer *VB ) } } while (!(flags[j] & VERT_END_VB)); -} +} -/* Vertex size doesn't matter - yay! +/* Vertex size doesn't matter - yay! */ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB ) { GLcontext *ctx = VB->ctx; GLfloat (*base)[3] = ctx->Light.BaseColor; GLubyte *sumA = ctx->Light.BaseAlpha; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = VB->NormalPtr->start; CONST GLfloat (*first_normal)[3] = (CONST GLfloat (*)[3])VB->NormalPtr->start; GLubyte (*CMcolor)[4] = 0; @@ -613,26 +614,27 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB ) (void) flags; (void) nstride; - if (ctx->Light.ColorMaterialEnabled) + if (ctx->Light.ColorMaterialEnabled) { cm_flags = VERT_RGBA; - if (VB->ColorPtr->flags & VEC_BAD_STRIDE) + if (VB->ColorPtr->flags & VEC_BAD_STRIDE) gl_clean_color(VB); CMcolor = (GLubyte (*)[4])VB->ColorPtr->start; - if ( *flags & VERT_RGBA ) + if ( *flags & VERT_RGBA ) gl_update_color_material( ctx, *CMcolor ); - + } - if ( flags[j] & VERT_MATERIAL ) + if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); interesting = cm_flags | VERT_MATERIAL | VERT_END_VB | VERT_NORM; VB->ColorPtr = VB->LitColor[0]; VB->Color[0] = VB->LitColor[0]; VB->Color[1] = VB->LitColor[1]; + VB->Specular = VB->Spec[0]; do { do { @@ -669,14 +671,14 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB ) ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->MatDiffuse[0]); if (!light->IsMatSpecular[0]) continue; n_dot_h = DOT3(normal, light->h_inf_norm); - } - + } + if (n_dot_h > 0.0F) { struct gl_shine_tab *tab = ctx->ShineTable[side]; GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); - ACC_SCALE_SCALAR_3V( sum[side], spec, + ACC_SCALE_SCALAR_3V( sum[side], spec, light->MatSpecular[side]); - } + } } if (LIGHT_FRONT(*mask)) { FLOAT_RGB_TO_UBYTE_RGB( Fcolor[j], sum[0] ); @@ -687,22 +689,22 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB ) FLOAT_RGB_TO_UBYTE_RGB( Bcolor[j], sum[1] ); Bcolor[j][3] = sumA[1]; } - } + } j++; NEXT_NORMAL; } while ((flags[j] & interesting) == VERT_NORM); - + if (COMPACTED) { GLuint last = j-1; - for ( ; !(flags[j] & interesting) ; j++ ) + for ( ; !(flags[j] & interesting) ; j++ ) { COPY_4UBV(Fcolor[j], Fcolor[last]); if (NR_SIDES==2) COPY_4UBV(Bcolor[j], Bcolor[last]); } - + NEXT_NORMAL; } @@ -713,7 +715,7 @@ static void TAG(shade_fast_rgba)( struct vertex_buffer *VB ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); } while (!(flags[j] & VERT_END_VB)); -} +} @@ -735,7 +737,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) GLcontext *ctx = VB->ctx; GLuint vstride = VB->Unprojected->stride; const GLfloat *vertex = (GLfloat *)VB->Unprojected->start; - GLuint nstride = VB->NormalPtr->stride; + GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = VB->NormalPtr->start; CONST GLfloat (*first_normal)[3] = (CONST GLfloat (*)[3])VB->NormalPtr->start; @@ -767,7 +769,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) if (ctx->Light.ColorMaterialEnabled) { cm_flags = VERT_RGBA; - if (VB->ColorPtr->flags & VEC_BAD_STRIDE) + if (VB->ColorPtr->flags & VEC_BAD_STRIDE) gl_clean_color(VB); CMcolor = (GLubyte (*)[4])VB->ColorPtr->start; @@ -777,15 +779,15 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) GLfloat diffuse[2], specular[2]; GLuint side = 0; struct gl_light *light; - - if ( flags[j] & cm_flags ) + + if ( flags[j] & cm_flags ) gl_update_color_material( ctx, CMcolor[j] ); - + if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); - if ( CULL(*mask) ) - continue; + if ( CULL(*mask) ) + continue; diffuse[0] = specular[0] = 0.0F; @@ -809,7 +811,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) } else { GLfloat d; /* distance from vertex to light */ - + SUB_3V(VP, light->Position, vertex); d = LEN_3FV( VP ); @@ -818,8 +820,8 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) SELF_SCALE_SCALAR_3V(VP, invd); } - attenuation = 1.0F / (light->ConstantAttenuation + d * - (light->LinearAttenuation + d * + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ @@ -838,14 +840,14 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) } } - if (attenuation < 1e-3) + if (attenuation < 1e-3) continue; /* this light makes no contribution */ n_dot_VP = DOT3( normal, VP ); /* which side are we lighting? */ if (n_dot_VP < 0.0F) { - if (!LIGHT_REAR(*mask)) + if (!LIGHT_REAR(*mask)) continue; side = 1; correction = -1; @@ -862,7 +864,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) /* specular term */ if (!(light->Flags & LIGHT_SPECULAR)) continue; - + if (ctx->Light.Model.LocalViewer) { GLfloat v[3]; COPY_3V(v, vertex); @@ -883,7 +885,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) n_dot_h = correction * DOT3(normal, h); - if (n_dot_h > 0.0F) + if (n_dot_h > 0.0F) { GLfloat spec_coef; struct gl_shine_tab *tab = ctx->ShineTable[side]; @@ -893,7 +895,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) n_dot_h /= LEN_SQUARED_3FV( h ); tab = ctx->ShineTable[side+2]; } - + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef); specular[side] += spec_coef * light->sli * attenuation; @@ -915,7 +917,7 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) else { GLfloat d_a = mat->DiffuseIndex - mat->AmbientIndex; GLfloat s_a = mat->SpecularIndex - mat->AmbientIndex; - + index = mat->AmbientIndex + diffuse[side] * (1.0F-specular[side]) * d_a + specular[side] * s_a; @@ -927,9 +929,9 @@ static void TAG(shade_ci)( struct vertex_buffer *VB ) } } /*for vertex*/ - if ( flags[j] & cm_flags ) + if ( flags[j] & cm_flags ) gl_update_color_material( ctx, CMcolor[j] ); - + if ( flags[j] & VERT_MATERIAL ) gl_update_material( ctx, new_material[j], new_material_mask[j] ); } @@ -948,9 +950,9 @@ static void TAG(init_shade_tab)( void ) #undef TAG #undef INVALID -#undef IDX +#undef IDX #undef LIGHT_FRONT #undef LIGHT_REAR #undef LIGHT_SIDE -#undef NR_SIDES +#undef NR_SIDES #undef CULL diff --git a/xc/extras/Mesa/src/stencil.c b/xc/extras/Mesa/src/stencil.c index 74e03af38..77755c313 100644 --- a/xc/extras/Mesa/src/stencil.c +++ b/xc/extras/Mesa/src/stencil.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.4 + * Version: 3.4.2 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul 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"), @@ -1038,47 +1038,45 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx, if (ctx->Driver.WriteStencilPixels) { /*** Hardware stencil buffer ***/ GLstencil stencil[PB_SIZE]; - GLubyte mask[PB_SIZE]; + GLubyte origMask[PB_SIZE]; ASSERT(ctx->Driver.ReadStencilPixels); (*ctx->Driver.ReadStencilPixels)(ctx, n, x, y, stencil); + MEMCPY(origMask, mask, n * sizeof(GLubyte)); - if (do_stencil_test( ctx, n, stencil, mask ) == GL_FALSE) { - /* all fragments failed the stencil test, we're done. */ - return GL_FALSE; - } + (void) do_stencil_test( ctx, n, stencil, mask ); if (ctx->Depth.Test == GL_FALSE) { apply_stencil_op( ctx, ctx->Stencil.ZPassFunc, n, stencil, mask ); } else { - GLubyte passmask[PB_SIZE], failmask[PB_SIZE], oldmask[PB_SIZE]; - GLuint i; - - MEMCPY(oldmask, mask, n * sizeof(GLubyte)); - _mesa_depth_test_pixels(ctx, n, x, y, z, mask); - for (i=0;i<n;i++) { - ASSERT(mask[i] == 0 || mask[i] == 1); - passmask[i] = oldmask[i] & mask[i]; - failmask[i] = oldmask[i] & (mask[i] ^ 1); - } - if (ctx->Stencil.ZFailFunc != GL_KEEP) { - apply_stencil_op( ctx, ctx->Stencil.ZFailFunc, n, stencil, failmask ); + GLubyte failmask[PB_SIZE]; + GLuint i; + for (i = 0; i < n; i++) { + ASSERT(mask[i] == 0 || mask[i] == 1); + failmask[i] = origMask[i] & (mask[i] ^ 1); + } + apply_stencil_op(ctx, ctx->Stencil.ZFailFunc, n, stencil, failmask); } if (ctx->Stencil.ZPassFunc != GL_KEEP) { - apply_stencil_op( ctx, ctx->Stencil.ZPassFunc, n, stencil, passmask ); + GLubyte passmask[PB_SIZE]; + GLuint i; + for (i = 0; i < n; i++) { + ASSERT(mask[i] == 0 || mask[i] == 1); + passmask[i] = origMask[i] & mask[i]; + } + apply_stencil_op(ctx, ctx->Stencil.ZPassFunc, n, stencil, passmask); } } /* Write updated stencil values into hardware stencil buffer */ - (ctx->Driver.WriteStencilPixels)(ctx, n, x, y, stencil, mask ); + (ctx->Driver.WriteStencilPixels)(ctx, n, x, y, stencil, origMask ); return GL_TRUE; - } else { /*** Software stencil buffer ***/ @@ -1088,7 +1086,6 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx, return GL_FALSE; } - if (ctx->Depth.Test==GL_FALSE) { apply_stencil_op_to_pixels( ctx, n, x, y, ctx->Stencil.ZPassFunc, mask ); } diff --git a/xc/extras/Mesa/src/texformat.c b/xc/extras/Mesa/src/texformat.c new file mode 100644 index 000000000..df2ad273d --- /dev/null +++ b/xc/extras/Mesa/src/texformat.c @@ -0,0 +1,352 @@ +/* $Id: texformat.c,v 1.1.1.1 2001/04/09 16:27:25 dawes Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.4 + * + * Copyright (C) 1999-2000 Brian Paul 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 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 + * BRIAN PAUL 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. + * + * Author: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifdef PC_HEADER +#include "all.h" +#else +#include "glheader.h" +#include "context.h" +#include "image.h" +#include "mem.h" +#include "mmath.h" +#include "span.h" +#include "texformat.h" +#include "teximage.h" +#include "texstate.h" +#include "types.h" +#endif + + +/* ================================================================ + * Texture internal formats: + */ + +const struct gl_texture_format _mesa_texformat_rgba8888 = { + MESA_FORMAT_RGBA8888, /* IntFormat */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 4, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_abgr8888 = { + MESA_FORMAT_ABGR8888, /* IntFormat */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 4, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_argb8888 = { + MESA_FORMAT_ARGB8888, /* IntFormat */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 4, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_rgb888 = { + MESA_FORMAT_RGB888, /* IntFormat */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 3, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_bgr888 = { + MESA_FORMAT_BGR888, /* IntFormat */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 3, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_rgb565 = { + MESA_FORMAT_RGB565, /* IntFormat */ + 5, /* RedBits */ + 6, /* GreenBits */ + 5, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 2, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_argb4444 = { + MESA_FORMAT_ARGB4444, /* IntFormat */ + 4, /* RedBits */ + 4, /* GreenBits */ + 4, /* BlueBits */ + 4, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 2, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_argb1555 = { + MESA_FORMAT_ARGB1555, /* IntFormat */ + 5, /* RedBits */ + 5, /* GreenBits */ + 5, /* BlueBits */ + 1, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 2, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_al88 = { + MESA_FORMAT_AL88, /* IntFormat */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8, /* AlphaBits */ + 8, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 2, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_rgb332 = { + MESA_FORMAT_RGB332, /* IntFormat */ + 3, /* RedBits */ + 3, /* GreenBits */ + 2, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 1, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_a8 = { + MESA_FORMAT_A8, /* IntFormat */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 1, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_l8 = { + MESA_FORMAT_L8, /* IntFormat */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 8, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 1, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_i8 = { + MESA_FORMAT_I8, /* IntFormat */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 8, /* IntensityBits */ + 0, /* IndexBits */ + 1, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_texformat_ci8 = { + MESA_FORMAT_CI8, /* IntFormat */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 8, /* IndexBits */ + 1, /* TexelBytes */ +}; + +const struct gl_texture_format _mesa_null_texformat = { + -1, /* IntFormat */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* TexelBytes */ +}; + + + +/* + * Given an internal texture format enum or 1, 2, 3, 4 return the + * corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE, + * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. + * Return -1 if invalid enum. + */ +void _mesa_init_texture_format( GLcontext *ctx, + struct gl_texture_image *texImage, + GLenum internalFormat ) +{ + texImage->IntFormat = internalFormat; + + /* Ask the driver for the base format, if it doesn't know, it will + * return -1; + */ + if ( ctx->Driver.BaseCompressedTexFormat ) { + GLint format = 0; /* Silence compiler warning */ + format = (*ctx->Driver.BaseCompressedTexFormat)( ctx, format ); + if ( format >= 0 ) { + internalFormat = format; + } + } + + switch ( internalFormat ) { + /* GH: Bias towards GL_RGB, GL_RGBA texture formats. This has + * got to be better than sticking them way down the end of this + * huge list. + */ + case 4: /* Quake3 uses this... */ + case GL_RGBA: + texImage->Format = GL_RGBA; + texImage->TexFormat = &_mesa_texformat_abgr8888; + break; + + case 3: /* ... and this. */ + case GL_RGB: + texImage->Format = GL_RGB; + texImage->TexFormat = &_mesa_texformat_bgr888; + break; + + /* GH: Okay, keep checking as normal. Still test for GL_RGB, + * GL_RGBA formats first. + */ + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + texImage->Format = GL_RGBA; + texImage->TexFormat = &_mesa_texformat_abgr8888; + break; + + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + texImage->Format = GL_RGB; + texImage->TexFormat = &_mesa_texformat_bgr888; + break; + + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + texImage->Format = GL_ALPHA; + texImage->TexFormat = &_mesa_texformat_a8; + break; + + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + texImage->Format = GL_LUMINANCE; + texImage->TexFormat = &_mesa_texformat_l8; + break; + + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + texImage->Format = GL_LUMINANCE_ALPHA; + texImage->TexFormat = &_mesa_texformat_al88; + break; + + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + texImage->Format = GL_INTENSITY; + texImage->TexFormat = &_mesa_texformat_i8; + break; + + case GL_COLOR_INDEX: + case GL_COLOR_INDEX1_EXT: + case GL_COLOR_INDEX2_EXT: + case GL_COLOR_INDEX4_EXT: + case GL_COLOR_INDEX8_EXT: + case GL_COLOR_INDEX12_EXT: + case GL_COLOR_INDEX16_EXT: + texImage->Format = GL_COLOR_INDEX; + texImage->TexFormat = &_mesa_texformat_ci8; + break; + + default: + gl_problem( ctx, "unexpected format in _mesa_init_texture_format" ); + return; + } +} diff --git a/xc/extras/Mesa/src/texformat.h b/xc/extras/Mesa/src/texformat.h new file mode 100644 index 000000000..518f7258b --- /dev/null +++ b/xc/extras/Mesa/src/texformat.h @@ -0,0 +1,81 @@ +/* $Id: texformat.h,v 1.1.1.1 2001/04/09 16:27:26 dawes Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.4 + * + * Copyright (C) 1999-2000 Brian Paul 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 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 + * BRIAN PAUL 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. + * + * Author: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef TEXFORMAT_H +#define TEXFORMAT_H + +#include "types.h" + + +/* The Mesa internal texture image types. These will be set to their + * default value, but may be changed by drivers as required. + */ + /* msb <------ TEXEL BITS -----------> lsb */ +enum _format { /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_ABGR8888, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ + MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ + MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */ + MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */ + MESA_FORMAT_RGB332, /* RRRG GGBB */ + MESA_FORMAT_A8, /* AAAA AAAA */ + MESA_FORMAT_L8, /* LLLL LLLL */ + MESA_FORMAT_I8, /* IIII IIII */ + MESA_FORMAT_CI8 /* CCCC CCCC */ +}; + + +extern void +_mesa_init_texture_format( GLcontext *ctx, + struct gl_texture_image *texImage, + GLenum internalFormat ); + + +extern const struct gl_texture_format _mesa_texformat_rgba8888; +extern const struct gl_texture_format _mesa_texformat_abgr8888; +extern const struct gl_texture_format _mesa_texformat_argb8888; +extern const struct gl_texture_format _mesa_texformat_rgb888; +extern const struct gl_texture_format _mesa_texformat_bgr888; +extern const struct gl_texture_format _mesa_texformat_rgb565; +extern const struct gl_texture_format _mesa_texformat_argb4444; +extern const struct gl_texture_format _mesa_texformat_argb1555; +extern const struct gl_texture_format _mesa_texformat_al88; +extern const struct gl_texture_format _mesa_texformat_rgb332; +extern const struct gl_texture_format _mesa_texformat_a8; +extern const struct gl_texture_format _mesa_texformat_l8; +extern const struct gl_texture_format _mesa_texformat_i8; +extern const struct gl_texture_format _mesa_texformat_ci8; + +extern const struct gl_texture_format _mesa_null_texformat; + +#endif diff --git a/xc/extras/Mesa/src/texgen_tmp.h b/xc/extras/Mesa/src/texgen_tmp.h index c1fa50816..18a130271 100644 --- a/xc/extras/Mesa/src/texgen_tmp.h +++ b/xc/extras/Mesa/src/texgen_tmp.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.4.1 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul 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"), @@ -43,10 +43,9 @@ static void TAG(build_m3)(GLfloat f[][3], const GLuint flags[], const GLubyte cullmask[] ) { - GLuint stride = coord_vec->stride; - GLfloat *coord = (GLfloat *)coord_vec->start; - GLuint count = coord_vec->count; - + const GLuint stride = coord_vec->stride; + const GLfloat *coord = (const GLfloat *) coord_vec->start; + const GLuint count = coord_vec->count; const GLfloat *normal = FIRST_NORMAL; GLuint i; @@ -55,26 +54,21 @@ static void TAG(build_m3)(GLfloat f[][3], (void) flags; (void) cullmask; - /* KW: Had to rearrange this loop to avoid a compiler bug with gcc - * 2.7.3.1 at -O3 optimization. Using -fno-strength-reduce - * also fixed the bug - is this generally necessary? - */ - for (i=0;i<count;i++,STRIDE_F(coord,stride)) { + for (i=0; i<count; i++, STRIDE_F(coord,stride), NEXT_NORMAL) { CHECK { - const GLfloat *norm = normal; GLfloat u[3], two_nu, fx, fy, fz; + CUR_NORMAL; COPY_3V( u, coord ); NORMALIZE_3FV( u ); - two_nu = 2.0F * DOT3(norm,u); - fx = f[i][0] = u[0] - norm[0] * two_nu; - fy = f[i][1] = u[1] - norm[1] * two_nu; - fz = f[i][2] = u[2] - norm[2] * two_nu; + two_nu = 2.0F * DOT3(normal,u); + fx = f[i][0] = u[0] - normal[0] * two_nu; + fy = f[i][1] = u[1] - normal[1] * two_nu; + fz = f[i][2] = u[2] - normal[2] * two_nu; m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); if (m[i] != 0.0F) { m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]); } } - NEXT_NORMAL; } } @@ -87,11 +81,10 @@ static void TAG(build_m2)(GLfloat f[][3], const GLuint flags[], const GLubyte cullmask[] ) { - GLuint stride = coord_vec->stride; - GLfloat *coord = coord_vec->start; - GLuint count = coord_vec->count; - - GLfloat *normal = FIRST_NORMAL; + const GLuint stride = coord_vec->stride; + const GLfloat *coord = coord_vec->start; + const GLuint count = coord_vec->count; + const GLfloat *normal = FIRST_NORMAL; GLuint i; LOCAL_VARS; @@ -99,23 +92,21 @@ static void TAG(build_m2)(GLfloat f[][3], (void) flags; (void) cullmask; - for (i=0;i<count;i++,STRIDE_F(coord,stride)) { + for (i=0; i<count; i++, STRIDE_F(coord,stride), NEXT_NORMAL) { CHECK { - GLfloat *norm = normal; GLfloat u[3], two_nu, fx, fy, fz; - COPY_2V( u, coord ); - u[2] = 0; + CUR_NORMAL; + COPY_2V( u, coord ); u[2] = 0; NORMALIZE_3FV( u ); - two_nu = 2.0F * DOT3(norm,u); - fx = f[i][0] = u[0] - norm[0] * two_nu; - fy = f[i][1] = u[1] - norm[1] * two_nu; - fz = f[i][2] = u[2] - norm[2] * two_nu; + two_nu = 2.0F * DOT3(normal,u); + fx = f[i][0] = u[0] - normal[0] * two_nu; + fy = f[i][1] = u[1] - normal[1] * two_nu; + fz = f[i][2] = u[2] - normal[2] * two_nu; m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); if (m[i] != 0.0F) { m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]); } } - NEXT_NORMAL; } } @@ -141,11 +132,10 @@ static void TAG(build_f3)( GLfloat *f, const GLuint flags[], const GLubyte cullmask[] ) { - GLuint stride = coord_vec->stride; - GLfloat *coord = coord_vec->start; - GLuint count = coord_vec->count; - - GLfloat *normal = FIRST_NORMAL; + const GLuint stride = coord_vec->stride; + const GLfloat *coord = coord_vec->start; + const GLuint count = coord_vec->count; + const GLfloat *normal = FIRST_NORMAL; GLuint i; LOCAL_VARS; @@ -153,9 +143,10 @@ static void TAG(build_f3)( GLfloat *f, (void) flags; (void) cullmask; - for (i=0;i<count;i++, STRIDE_F(coord,stride), STRIDE_F(f,fstride), NEXT_NORMAL) { + for (i=0; i<count; i++, STRIDE_F(coord,stride), STRIDE_F(f,fstride), NEXT_NORMAL) { CHECK { GLfloat u[3], two_nu; + CUR_NORMAL; COPY_3V( u, coord ); NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(normal,u); @@ -174,11 +165,10 @@ static void TAG(build_f2)( GLfloat *f, const GLuint flags[], const GLubyte cullmask[] ) { - GLuint stride = coord_vec->stride; - GLfloat *coord = coord_vec->start; - GLuint count = coord_vec->count; - - GLfloat *normal = FIRST_NORMAL; + const GLuint stride = coord_vec->stride; + const GLfloat *coord = coord_vec->start; + const GLuint count = coord_vec->count; + const GLfloat *normal = FIRST_NORMAL; GLuint i; LOCAL_VARS; @@ -186,11 +176,11 @@ static void TAG(build_f2)( GLfloat *f, (void) flags; (void) cullmask; - for (i=0;i<count;i++,STRIDE_F(coord,stride), STRIDE_F(f,fstride), NEXT_NORMAL) { + for (i=0; i<count; i++, STRIDE_F(coord,stride), STRIDE_F(f,fstride), NEXT_NORMAL) { CHECK { GLfloat u[3], two_nu; - COPY_2V( u, coord ); - u[2] = 0; + CUR_NORMAL; + COPY_2V( u, coord ); u[2] = 0; NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(normal,u); f[0] = u[0] - normal[0] * two_nu; @@ -250,16 +240,18 @@ static void TAG(texgen_normal_map_nv)( struct vertex_buffer *VB, GLubyte *cullmask = VB->CullMask + VB->Start; GLuint *flags = VB->Flag + VB->Start; GLuint count = VB->Count; - GLuint i; + const GLfloat *normal = FIRST_NORMAL; + GLuint i; LOCAL_VARS; (void) flags; - + (void) cullmask; - for (i=0;i<count;i++, NEXT_NORMAL) { + for (i=0; i<count; i++,NEXT_NORMAL) { CHECK { + CUR_NORMAL; texcoord[i][0] = normal[0]; texcoord[i][1] = normal[1]; texcoord[i][2] = normal[2]; @@ -412,7 +404,10 @@ static void TAG(texgen)( struct vertex_buffer *VB, GLuint textureUnit ) const GLfloat *normal = FIRST_NORMAL; for (i=0;i<count;i++, NEXT_NORMAL) { - CHECK texcoord[i][0] = normal[0]; + CHECK { + CUR_NORMAL; + texcoord[i][0] = normal[0]; + } } break; } @@ -443,7 +438,10 @@ static void TAG(texgen)( struct vertex_buffer *VB, GLuint textureUnit ) case GL_NORMAL_MAP_NV: { const GLfloat *normal = FIRST_NORMAL; for (i=0;i<count;i++, NEXT_NORMAL) { - CHECK texcoord[i][1] = normal[1]; + CHECK { + CUR_NORMAL; + texcoord[i][1] = normal[1]; + } } break; } @@ -470,7 +468,10 @@ static void TAG(texgen)( struct vertex_buffer *VB, GLuint textureUnit ) case GL_NORMAL_MAP_NV: { const GLfloat *normal = FIRST_NORMAL; for (i=0;i<count;i++,NEXT_NORMAL) { - CHECK texcoord[i][2] = normal[2]; + CHECK { + CUR_NORMAL; + texcoord[i][2] = normal[2]; + } } break; } @@ -508,6 +509,7 @@ static void TAG(init_texgen)( void ) #undef CULL #undef FIRST_NORMAL #undef NEXT_NORMAL +#undef CUR_NORMAL #undef LOCAL_VARS #undef CHECK diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c index ac4066e14..e1d676dbb 100644 --- a/xc/extras/Mesa/src/teximage.c +++ b/xc/extras/Mesa/src/teximage.c @@ -2,19 +2,19 @@ /* * Mesa 3-D graphics library * Version: 3.4 - * + * * Copyright (C) 1999-2000 Brian Paul 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 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 @@ -33,6 +33,7 @@ #include "mem.h" #include "mmath.h" #include "span.h" +#include "texformat.h" #include "teximage.h" #include "texstate.h" #include "types.h" @@ -300,115 +301,6 @@ is_compressed_format(GLcontext *ctx, GLenum internalFormat) -/* - * Examine the texImage->Format field and set the Red, Green, Blue, etc - * texel component sizes to default values. - * These fields are set only here by core Mesa but device drivers may - * overwritting these fields to indicate true texel resolution. - */ -static void -set_teximage_component_sizes( struct gl_texture_image *texImage ) -{ - switch (texImage->Format) { - case GL_ALPHA: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 8; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - break; - case GL_LUMINANCE: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 8; - texImage->IndexBits = 0; - break; - case GL_LUMINANCE_ALPHA: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 8; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 8; - texImage->IndexBits = 0; - break; - case GL_INTENSITY: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 8; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - break; - case GL_RED: - texImage->RedBits = 8; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - break; - case GL_GREEN: - texImage->RedBits = 0; - texImage->GreenBits = 8; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - break; - case GL_BLUE: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 8; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - break; - case GL_RGB: - case GL_BGR: - texImage->RedBits = 8; - texImage->GreenBits = 8; - texImage->BlueBits = 8; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - break; - case GL_RGBA: - case GL_BGRA: - case GL_ABGR_EXT: - texImage->RedBits = 8; - texImage->GreenBits = 8; - texImage->BlueBits = 8; - texImage->AlphaBits = 8; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 0; - break; - case GL_COLOR_INDEX: - texImage->RedBits = 0; - texImage->GreenBits = 0; - texImage->BlueBits = 0; - texImage->AlphaBits = 0; - texImage->IntensityBits = 0; - texImage->LuminanceBits = 0; - texImage->IndexBits = 8; - break; - default: - gl_problem(NULL, "unexpected format in set_teximage_component_sizes"); - } -} - - static void set_tex_image(struct gl_texture_object *tObj, GLenum target, GLint level, @@ -467,9 +359,7 @@ init_texture_image( GLcontext *ctx, { ASSERT(img); ASSERT(!img->Data); - img->Format = (GLenum) _mesa_base_tex_format(ctx, internalFormat); - set_teximage_component_sizes( img ); - img->IntFormat = (GLenum) internalFormat; + _mesa_init_texture_format( ctx, img, internalFormat ); img->Border = border; img->Width = width; img->Height = height; @@ -745,7 +635,7 @@ make_texture_image( GLcontext *ctx, } return; /* all done */ } - } + } /* @@ -851,13 +741,6 @@ clear_proxy_teximage(struct gl_texture_image *img) ASSERT(img); img->Format = 0; img->IntFormat = 0; - img->RedBits = 0; - img->GreenBits = 0; - img->BlueBits = 0; - img->AlphaBits = 0; - img->IntensityBits = 0; - img->LuminanceBits = 0; - img->IndexBits = 0; img->Border = 0; img->Width = 0; img->Height = 0; @@ -871,6 +754,7 @@ clear_proxy_teximage(struct gl_texture_image *img) img->Data = NULL; img->IsCompressed = 0; img->CompressedSize = 0; + img->TexFormat = &_mesa_null_texformat; } @@ -1088,9 +972,9 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } - destTex = texUnit->CurrentD[2]->Image[level]; + destTex = texUnit->CurrentD[dimensions]->Image[level]; if (!destTex) { - gl_error(ctx, GL_INVALID_OPERATION, "glTexSubImage2D"); + gl_error(ctx, GL_INVALID_OPERATION, "glTexSubImage1/2/3D"); return GL_TRUE; } @@ -1994,11 +1878,10 @@ void _mesa_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { - GET_CURRENT_CONTEXT(ctx); const struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean discardImage; - + GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage"); if (level < 0 || level >= ctx->Const.MaxTextureLevels) { @@ -2174,11 +2057,12 @@ _mesa_TexSubImage1D( GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels ) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexSubImage1D"); if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, format, type)) { @@ -2257,11 +2141,12 @@ _mesa_TexSubImage2D( GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels ) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexSubImage2D"); if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, type)) { @@ -2370,11 +2255,12 @@ _mesa_TexSubImage3D( GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels ) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexSubImage3D"); if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type)) { @@ -2521,7 +2407,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, return; if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA - || !ctx->Driver.CopyTexImage1D + || !ctx->Driver.CopyTexImage1D || !(*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat, x, y, width, border)) { @@ -2616,7 +2502,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" ); return; } - + /* now call glTexSubImage1D to do the real work */ unpackSave = ctx->Unpack; ctx->Unpack = _mesa_native_packing; @@ -2668,7 +2554,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, _mesa_TexSubImage2D(target, level, xoffset, yoffset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image); ctx->Unpack = unpackSave; - + FREE(image); } } @@ -2713,7 +2599,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, _mesa_TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, image); ctx->Unpack = unpackSave; - + FREE(image); } } @@ -3116,11 +3002,12 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexSubImage1DARB"); if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, format, GL_NONE)) { @@ -3153,11 +3040,12 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLenum format, GLsizei imageSize, const GLvoid *data) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexSubImage2DARB"); if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, GL_NONE)) { @@ -3191,11 +3079,12 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexSubImage3DARB"); if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, GL_NONE)) { @@ -3226,10 +3115,9 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, void _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { - GET_CURRENT_CONTEXT(ctx); const struct gl_texture_object *texObj; struct gl_texture_image *texImage; - + GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetCompressedTexImageARB"); if (level < 0 || level >= ctx->Const.MaxTextureLevels) { diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c index 1ce0c8ca2..bb82b1861 100644 --- a/xc/extras/Mesa/src/texstate.c +++ b/xc/extras/Mesa/src/texstate.c @@ -890,25 +890,25 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = img->Border; return; case GL_TEXTURE_RED_SIZE: - *params = img->RedBits; + *params = img->TexFormat->RedBits; return; case GL_TEXTURE_GREEN_SIZE: - *params = img->GreenBits; + *params = img->TexFormat->GreenBits; return; case GL_TEXTURE_BLUE_SIZE: - *params = img->BlueBits; + *params = img->TexFormat->BlueBits; return; case GL_TEXTURE_ALPHA_SIZE: - *params = img->AlphaBits; + *params = img->TexFormat->AlphaBits; return; case GL_TEXTURE_INTENSITY_SIZE: - *params = img->IntensityBits; + *params = img->TexFormat->IntensityBits; return; case GL_TEXTURE_LUMINANCE_SIZE: - *params = img->LuminanceBits; + *params = img->TexFormat->LuminanceBits; return; case GL_TEXTURE_INDEX_SIZE_EXT: - *params = img->IndexBits; + *params = img->TexFormat->IndexBits; return; /* GL_ARB_texture_compression */ diff --git a/xc/extras/Mesa/src/texture.c b/xc/extras/Mesa/src/texture.c index 7d4e66ddd..6a2b2dfb1 100644 --- a/xc/extras/Mesa/src/texture.c +++ b/xc/extras/Mesa/src/texture.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.4 + * Version: 3.4.1 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul 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"), @@ -79,41 +79,42 @@ typedef void (*build_f_func)( GLfloat *f, * gains to texture generation, but it is still necessary to cope * with the two different formats. */ +#define IDX 0 #define TAG(x) x #define FIRST_NORMAL normals->start +#define CUR_NORMAL (void) normal #define NEXT_NORMAL STRIDE_F(normal, normals->stride) +#define CHECK #define LOCAL_VARS -#define CHECK -#define IDX 0 #include "texgen_tmp.h" +#define IDX 2 #define TAG(x) x##_compacted #define FIRST_NORMAL normals->start -#define NEXT_NORMAL ((flags[i]&VERT_NORM) ? (normal=first_normal[i]) : (normal)) -#define CHECK -#define IDX 2 -#define LOCAL_VARS \ - GLfloat (*first_normal)[3] = (GLfloat (*)[3]) FIRST_NORMAL; - +#define CUR_NORMAL ((flags[i]&VERT_NORM) ? normal=normal_ptr : normal) +#define NEXT_NORMAL STRIDE_F(normal_ptr, normals->stride) +#define CHECK +#define LOCAL_VARS const GLfloat *normal_ptr = FIRST_NORMAL; #include "texgen_tmp.h" + +#define IDX 1 #define TAG(x) x##_masked #define FIRST_NORMAL normals->start +#define CUR_NORMAL (void) normal #define NEXT_NORMAL STRIDE_F(normal, normals->stride) -#define LOCAL_VARS #define CHECK if (cullmask[i]) -#define IDX 1 +#define LOCAL_VARS #include "texgen_tmp.h" +#define IDX 3 #define TAG(x) x##_compacted_masked #define FIRST_NORMAL normals->start -#define NEXT_NORMAL ((flags[i]&VERT_NORM) ? normal=first_normal[i] : 0) +#define CUR_NORMAL ((flags[i]&VERT_NORM) ? normal=normal_ptr : normal) +#define NEXT_NORMAL STRIDE_F(normal_ptr, normals->stride) #define CHECK if (cullmask[i]) -#define IDX 3 -#define LOCAL_VARS \ - GLfloat (*first_normal)[3] = (GLfloat (*)[3]) FIRST_NORMAL; - +#define LOCAL_VARS const GLfloat *normal_ptr = FIRST_NORMAL; #include "texgen_tmp.h" @@ -2216,7 +2217,7 @@ _mesa_texture_combine(const GLcontext *ctx, rgba[i][BCOMP] = (GLubyte) MIN2(b, 255); } } - break; + break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: { @@ -2228,12 +2229,12 @@ _mesa_texture_combine(const GLcontext *ctx, */ RGBshift = 6; for (i = 0; i < n; i++) { - GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - 128, - (GLint)arg1[i][RCOMP] - 128) + - S_PROD((GLint)arg0[i][GCOMP] - 128, - (GLint)arg1[i][GCOMP] - 128) + - S_PROD((GLint)arg0[i][BCOMP] - 128, - (GLint)arg1[i][BCOMP] - 128)) >> RGBshift; + GLint dot = (S_PROD((GLint) arg0[i][RCOMP] - 128, + (GLint) arg1[i][RCOMP] - 128) + + S_PROD((GLint) arg0[i][GCOMP] - 128, + (GLint) arg1[i][GCOMP] - 128) + + S_PROD((GLint) arg0[i][BCOMP] - 128, + (GLint) arg1[i][BCOMP] - 128)) >> RGBshift; rgba[i][RCOMP] = (GLubyte) CLAMP(dot, 0, 255); rgba[i][GCOMP] = (GLubyte) CLAMP(dot, 0, 255); rgba[i][BCOMP] = (GLubyte) CLAMP(dot, 0, 255); diff --git a/xc/extras/Mesa/src/texutil.c b/xc/extras/Mesa/src/texutil.c index 313ef1455..4143830c1 100644 --- a/xc/extras/Mesa/src/texutil.c +++ b/xc/extras/Mesa/src/texutil.c @@ -2,1687 +2,1304 @@ /* * Mesa 3-D graphics library * Version: 3.4 - * + * * Copyright (C) 1999-2000 Brian Paul 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 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 * BRIAN PAUL 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: + * Gareth Hughes <gareth@valinux.com> */ - #ifdef PC_HEADER #include "all.h" #else #include "glheader.h" #include "context.h" +#include "enums.h" #include "image.h" #include "mem.h" +#include "texformat.h" #include "texutil.h" #include "types.h" #endif +#define DBG 0 -/* - * Texture utilities which may be useful to device drivers. - * See the texutil.h for the list of supported internal formats. - * It's expected that new formats will be added for new hardware. - */ +struct gl_texture_convert { + GLint xoffset, yoffset, zoffset; /* Subimage offset */ + GLint width, height, depth; /* Subimage region */ -/* - * If the system is little endian and can do 4-byte word stores on - * non 4-byte-aligned addresses then we can use this optimization. - */ -#if defined(__i386__) -#define DO_32BIT_STORES000 + GLint imageWidth, imageHeight; /* Full image dimensions */ + GLenum format, type; + + const struct gl_pixelstore_attrib *packing; + + const GLvoid *srcImage; + GLvoid *dstImage; + + GLint index; +}; + +typedef GLboolean (*convert_func)( struct gl_texture_convert *convert ); +typedef void (*unconvert_func)( struct gl_texture_convert *convert ); + +#define CONVERT_STRIDE_BIT 0x1 +#define CONVERT_PACKING_BIT 0x2 + +#ifdef __GNUC__ +#define ERROR_STRING __FUNCTION__ +#else +#define ERROR_STRING __FILE__ ":" __LINE__ #endif +#define UNCONVERT_ERROR( format ) \ +do { \ + static char buffer[128]; \ + sprintf( buffer, "illegal format %s in " ERROR_STRING "\n", \ + gl_lookup_enum_by_nr( format ) ); \ + gl_problem( NULL, buffer ); \ +} while (0) -/* - * Convert texture image data into one a specific internal format. - * Input: - * dstFormat - the destination internal format - * dstWidth, dstHeight - the destination image size - * dstImage - pointer to destination image buffer - * dstRowStride - bytes to jump between image rows - * srcWidth, srcHeight - size of texture image - * srcFormat, srcType - format and datatype of source image - * srcImage - pointer to user's texture image - * packing - describes how user's texture image is packed. - * Return: pointer to resulting image data or NULL if error or out of memory - * or NULL if we can't process the given image format/type/internalFormat - * combination. - * - * Supported type conversions: - * srcFormat srcType dstFormat - * GL_INTENSITY GL_UNSIGNED_BYTE MESA_I8 - * GL_LUMINANCE GL_UNSIGNED_BYTE MESA_L8 - * GL_ALPHA GL_UNSIGNED_BYTE MESA_A8 - * GL_COLOR_INDEX GL_UNSIGNED_BYTE MESA_C8 - * GL_LUMINANCE_ALPHA GL_UNSIGNED_BYTE MESA_A8_L8 - * GL_RGB GL_UNSIGNED_BYTE MESA_R5_G6_B5 - * GL_RGB GL_UNSIGNED_SHORT_5_6_5 MESA_R5_G6_B5 - * GL_RGBA GL_UNSIGNED_BYTE MESA_A4_R4_G4_B4 - * GL_BGRA GL_UNSIGNED_SHORT_4_4_4_4_REV MESA_A4_R4_G4_B4 - * GL_BGRA GL_UNSIGHED_SHORT_1_5_5_5_REV MESA_A1_R5_G5_B5 - * GL_RGBA GL_UNSIGNED_BYTE MESA_A1_R5_G5_B5 - * GL_BGRA GL_UNSIGNED_INT_8_8_8_8_REV MESA_A8_R8_G8_B8 - * GL_RGBA GL_UNSIGNED_BYTE MESA_A8_R8_G8_B8 - * GL_RGB GL_UNSIGNED_BYTE MESA_A8_R8_G8_B8 - * more to be added for new drivers... - * - * Notes: - * Some hardware only supports texture images of specific aspect ratios. - * This code will do power-of-two image up-scaling if that's needed. - * - * +/* ================================================================ + * RGBA8888 textures: */ -GLboolean -_mesa_convert_teximage(MesaIntTexFormat dstFormat, - GLint dstWidth, GLint dstHeight, GLvoid *dstImage, - GLint dstRowStride, - GLint srcWidth, GLint srcHeight, - GLenum srcFormat, GLenum srcType, - const GLvoid *srcImage, - const struct gl_pixelstore_attrib *packing) + +#define DST_TYPE GLuint +#define DST_TEXELS_PER_DWORD 1 + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_8888( src[3], src[2], src[1], src[0] ) + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 4 + +#define TAG(x) x##_rgba8888_direct +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_8888( src[0], src[1], src[2], src[3] ) + +#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src ) + +#define SRC_TEXEL_BYTES 4 + +#define TAG(x) x##_abgr8888_to_rgba8888 +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_8888( src[0], src[1], src[2], 0xff ) + +#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src ) + +#define SRC_TEXEL_BYTES 3 + +#define TAG(x) x##_bgr888_to_rgba8888 +#include "texutil_tmp.h" + + +#define CONVERT_RGBA8888( name ) \ +static GLboolean \ +convert_##name##_rgba8888( struct gl_texture_convert *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if ( convert->format == GL_ABGR_EXT && \ + convert->type == GL_UNSIGNED_INT_8_8_8_8_REV ) \ + { \ + tab = name##_tab_rgba8888_direct; \ + } \ + else if ( convert->format == GL_RGBA && \ + ( convert->type == GL_UNSIGNED_BYTE || \ + convert->type == GL_UNSIGNED_INT_8_8_8_8 ) ) \ + { \ + tab = name##_tab_abgr8888_to_rgba8888; \ + } \ + else if ( convert->format == GL_RGB && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_bgr888_to_rgba8888; \ + } \ + else \ + { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + \ + return tab[index]( convert ); \ +} + +CONVERT_RGBA8888( texsubimage2d ) +CONVERT_RGBA8888( texsubimage3d ) + + +static void +unconvert_teximage_rgba8888( struct gl_texture_convert *convert ) { - const GLint wScale = dstWidth / srcWidth; /* must be power of two */ - const GLint hScale = dstHeight / srcHeight; /* must be power of two */ - ASSERT(dstWidth >= srcWidth); - ASSERT(dstHeight >= srcHeight); - ASSERT(dstImage); - ASSERT(srcImage); - ASSERT(packing); - - switch (dstFormat) { - case MESA_I8: - case MESA_L8: - case MESA_A8: - case MESA_C8: - if (srcType != GL_UNSIGNED_BYTE || - ((srcFormat != GL_INTENSITY) && - (srcFormat != GL_LUMINANCE) && - (srcFormat != GL_ALPHA) && - (srcFormat != GL_COLOR_INDEX))) { - /* bad internal format / srcFormat combination */ - return GL_FALSE; - } - else { - /* store as 8-bit texels */ - if (wScale == 1 && hScale == 1) { - /* no scaling needed - fast case */ - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLubyte *dst = (GLubyte *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - MEMCPY(dst, src, dstWidth * sizeof(GLubyte)); - dst += dstRowStride; - src += srcStride; - } - } - else { - /* must rescale image */ - GLubyte *dst = (GLubyte *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - dst[col] = src[col / wScale]; - } - dst += dstRowStride; - } - } - } - break; - - case MESA_A8_L8: - if (srcType != GL_UNSIGNED_BYTE || srcFormat != GL_LUMINANCE_ALPHA) { - return GL_FALSE; - } - else { - /* store as 16-bit texels */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLushort *dst = (GLushort *) dstImage; - GLint row, col; - for (row = 0; row < dstHeight; row++) { - for (col = 0; col < dstWidth; col++) { - GLubyte luminance = src[col * 2 + 0]; - GLubyte alpha = src[col * 2 + 1]; - dst[col] = ((GLushort) alpha << 8) | luminance; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - src += srcStride; - } - } - else { - /* must rescale */ - GLushort *dst = (GLushort *) dstImage; - GLint row, col; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - for (col = 0; col < dstWidth; col++) { - GLint srcCol = col / wScale; - GLubyte luminance = src[srcCol * 2 + 0]; - GLubyte alpha = src[srcCol * 2 + 1]; - dst[col] = ((GLushort) alpha << 8) | luminance; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - src += srcStride; - } - } - } - break; - - case MESA_R5_G6_B5: - if (srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5) { - /* special, optimized case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - MEMCPY(dst, src, dstWidth * sizeof(GLushort)); - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLushort *src = (const GLushort *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - dst[col] = src[col / wScale]; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); -#ifdef DO_32BIT_STORES - GLuint *dst = (GLuint *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col3; - GLint halfDstWidth = dstWidth >> 1; - for (col = col3 = 0; col < halfDstWidth; col++, col3 += 6) { - GLubyte r0 = src[col3 + 0]; - GLubyte g0 = src[col3 + 1]; - GLubyte b0 = src[col3 + 2]; - GLubyte r1 = src[col3 + 3]; - GLubyte g1 = src[col3 + 4]; - GLubyte b1 = src[col3 + 5]; - GLuint d0 = ((r0 & 0xf8) << 8) - | ((g0 & 0xfc) << 3) - | ((b0 & 0xf8) >> 3); - GLuint d1 = ((r1 & 0xf8) << 8) - | ((g1 & 0xfc) << 3) - | ((b1 & 0xf8) >> 3); - dst[col] = (d1 << 16) | d0; - } - src += srcStride; - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } -#else /* 16-bit stores */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col3; - for (col = col3 = 0; col < dstWidth; col++, col3 += 3) { - GLubyte r = src[col3 + 0]; - GLubyte g = src[col3 + 1]; - GLubyte b = src[col3 + 2]; - dst[col] = ((r & 0xf8) << 8) - | ((g & 0xfc) << 3) - | ((b & 0xf8) >> 3); - } - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } -#endif - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - GLint col3 = (col / wScale) * 3; - GLubyte r = src[col3 + 0]; - GLubyte g = src[col3 + 1]; - GLubyte b = src[col3 + 2]; - dst[col] = ((r & 0xf8) << 8) - | ((g & 0xfc) << 3) - | ((b & 0xf8) >> 3); - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { - /* general case (used by Quake3) */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); -#ifdef DO_32BIT_STORES - GLuint *dst = dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col4; - GLint halfDstWidth = dstWidth >> 1; - for (col = col4 = 0; col < halfDstWidth; col++, col4 += 8) { - GLubyte r0 = src[col4 + 0]; - GLubyte g0 = src[col4 + 1]; - GLubyte b0 = src[col4 + 2]; - GLubyte r1 = src[col4 + 4]; - GLubyte g1 = src[col4 + 5]; - GLubyte b1 = src[col4 + 6]; - GLuint d0 = ((r0 & 0xf8) << 8) - | ((g0 & 0xfc) << 3) - | ((b0 & 0xf8) >> 3); - GLuint d1 = ((r1 & 0xf8) << 8) - | ((g1 & 0xfc) << 3) - | ((b1 & 0xf8) >> 3); - dst[col] = (d1 << 16) | d0; - } - src += srcStride; - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } -#else /* 16-bit stores */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col4; - for (col = col4 = 0; col < dstWidth; col++, col4 += 4) { - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - dst[col] = ((r & 0xf8) << 8) - | ((g & 0xfc) << 3) - | ((b & 0xf8) >> 3); - } - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } -#endif - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - GLint col4 = (col / wScale) * 4; - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - dst[col] = ((r & 0xf8) << 8) - | ((g & 0xfc) << 3) - | ((b & 0xf8) >> 3); - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else { - /* can't handle this srcFormat/srcType combination */ - return GL_FALSE; - } - break; - - case MESA_A4_R4_G4_B4: - /* store as 16-bit texels (GR_TEXFMT_ARGB_4444) */ - if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV){ - /* special, optimized case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - MEMCPY(dst, src, dstWidth * sizeof(GLushort)); - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLushort *src = (const GLushort *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - dst[col] = src[col / wScale]; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); -#ifdef DO_32BIT_STORES - GLuint *dst = dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col4; - GLint halfDstWidth = dstWidth >> 1; - for (col = col4 = 0; col < halfDstWidth; col++, col4 += 8) { - GLubyte r0 = src[col4 + 0]; - GLubyte g0 = src[col4 + 1]; - GLubyte b0 = src[col4 + 2]; - GLubyte a0 = src[col4 + 3]; - GLubyte r1 = src[col4 + 4]; - GLubyte g1 = src[col4 + 5]; - GLubyte b1 = src[col4 + 6]; - GLubyte a1 = src[col4 + 7]; - GLuint d0 = ((a0 & 0xf0) << 8) - | ((r0 & 0xf0) << 4) - | ((g0 & 0xf0) ) - | ((b0 & 0xf0) >> 4); - GLuint d1 = ((a1 & 0xf0) << 8) - | ((r1 & 0xf0) << 4) - | ((g1 & 0xf0) ) - | ((b1 & 0xf0) >> 4); - dst[col] = (d1 << 16) | d0; - } - src += srcStride; - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } -#else /* 16-bit stores */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col4; - for (col = col4 = 0; col < dstWidth; col++, col4 += 4) { - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = ((a & 0xf0) << 8) - | ((r & 0xf0) << 4) - | ((g & 0xf0) ) - | ((b & 0xf0) >> 4); - } - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } -#endif - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - GLint col4 = (col / wScale) * 4; - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = ((a & 0xf0) << 8) - | ((r & 0xf0) << 4) - | ((g & 0xf0) ) - | ((b & 0xf0) >> 4); - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else { - /* can't handle this format/srcType combination */ - return GL_FALSE; - } - break; - - case MESA_A1_R5_G5_B5: - /* store as 16-bit texels (GR_TEXFMT_ARGB_1555) */ - if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV){ - /* special, optimized case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - MEMCPY(dst, src, dstWidth * sizeof(GLushort)); - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLushort *src = (const GLushort *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - dst[col] = src[col / wScale]; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col4; - for (col = col4 = 0; col < dstWidth; col++, col4 += 4) { - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = ((a & 0x80) << 8) - | ((r & 0xf8) << 7) - | ((g & 0xf8) << 2) - | ((b & 0xf8) >> 3); - } - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - GLint col4 = (col / wScale) * 4; - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = ((a & 0x80) << 8) - | ((r & 0xf8) << 7) - | ((g & 0xf8) << 2) - | ((b & 0xf8) >> 3); - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else { - /* can't handle this source format/type combination */ - return GL_FALSE; - } - break; - - case MESA_A8_R8_G8_B8: - case MESA_FF_R8_G8_B8: - /* 32-bit texels */ - if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV){ - /* special, optimized case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLuint *dst = (GLuint *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - MEMCPY(dst, src, dstWidth * sizeof(GLuint)); - src += srcStride; - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLuint *dst = (GLuint *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLuint *src = (const GLuint *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - dst[col] = src[col / wScale]; - } - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLuint *dst = (GLuint *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col4; - for (col = col4 = 0; col < dstWidth; col++, col4 += 4) { - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = (a << 24) | (r << 16) | (g << 8) | b; - } - src += srcStride; - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLuint *dst = (GLuint *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - GLint col4 = (col / wScale) * 4; - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = (a << 24) | (r << 16) | (g << 8) | b; - } - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - srcWidth, srcFormat, srcType); - GLuint *dst = (GLuint *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint col, col3; - for (col = col3 = 0; col < dstWidth; col++, col3 += 3) { - GLubyte r = src[col3 + 0]; - GLubyte g = src[col3 + 1]; - GLubyte b = src[col3 + 2]; - GLubyte a = 255; - dst[col] = (a << 24) | (r << 16) | (g << 8) | b; - } - src += srcStride; - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLuint *dst = (GLuint *) dstImage; - GLint row; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < dstWidth; col++) { - GLint col3 = (col / wScale) * 3; - GLubyte r = src[col3 + 0]; - GLubyte g = src[col3 + 1]; - GLubyte b = src[col3 + 2]; - GLubyte a = 255; - dst[col] = (a << 24) | (r << 16) | (g << 8) | b; - } - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - } - else { - /* can't handle this source format/type combination */ - return GL_FALSE; - } - if (dstFormat == MESA_FF_R8_G8_B8) { - /* set alpha bytes to 0xff */ - GLint i; - GLubyte *dst = (GLubyte *) dstImage; - for (i = 0; i < dstWidth * dstHeight; i++) { - dst[i * 4 + 3] = 0xff; - } - } - break; - - default: - /* unexpected internal format! */ - return GL_FALSE; + const GLubyte *src = (const GLubyte *)convert->srcImage; + GLint texels, i; + + texels = convert->width * convert->height * convert->depth; + + switch ( convert->format ) { + case GL_RGBA: { + GLuint *dst = (GLuint *)convert->dstImage; + for ( i = 0 ; i < texels ; i++ ) { + *dst++ = PACK_COLOR_8888( src[0], src[1], src[2], src[3] ); + src += 4; + } + break; + } + case GL_RGB: { + GLubyte *dst = (GLubyte *)convert->dstImage; + for ( i = 0 ; i < texels ; i++ ) { + *dst++ = src[3]; + *dst++ = src[2]; + *dst++ = src[1]; + src += 4; + } + break; + } + default: + UNCONVERT_ERROR( convert->format ); + break; } - return GL_TRUE; } -/* - * Replace a subregion of a texture image with new data. - * Input: - * dstFormat - destination image format - * dstXoffset, dstYoffset - destination for new subregion (in texels) - * dstWidth, dstHeight - total size of dest image (in texels) - * dstImage - pointer to dest image - * dstRowStride - bytes to jump between image rows (in bytes) - * width, height - size of region to copy/replace (in texels) - * srcWidth, srcHeight - size of the corresponding gl_texture_image - * srcFormat, srcType - source image format and datatype - * srcImage - source image - * packing - source image packing information. - * Return: GL_TRUE or GL_FALSE for success, failure - * - * Notes: - * Like _mesa_convert_teximage(), we can do power-of-two image scaling - * to accomodate hardware with texture image aspect ratio constraints. - * dstWidth / srcWidth is used to compute the horizontal scaling factor and - * dstHeight / srcHeight is used to compute the vertical scaling factor. +/* ================================================================ + * ABGR8888 textures: */ -GLboolean -_mesa_convert_texsubimage(MesaIntTexFormat dstFormat, - GLint dstXoffset, GLint dstYoffset, - GLint dstWidth, GLint dstHeight, GLvoid *dstImage, - GLint dstRowStride, - GLint width, GLint height, - GLint srcWidth, GLint srcHeight, - GLenum srcFormat, GLenum srcType, - const GLvoid *srcImage, - const struct gl_pixelstore_attrib *packing) + +#define DST_TYPE GLuint +#define DST_TEXELS_PER_DWORD 1 + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_8888( src[3], src[2], src[1], src[0] ) + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 4 + +#define TAG(x) x##_abgr8888_direct +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_8888( 0xff, src[2], src[1], src[0] ) + +#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src ) + +#define SRC_TEXEL_BYTES 3 + +#define TAG(x) x##_bgr888_to_abgr8888 +#include "texutil_tmp.h" + + +#define CONVERT_ABGR8888( name ) \ +static GLboolean \ +convert_##name##_abgr8888( struct gl_texture_convert *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if ( convert->format == GL_RGBA && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_abgr8888_direct; \ + } \ + else if ( convert->format == GL_RGB && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_bgr888_to_abgr8888; \ + } \ + else \ + { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + \ + return tab[index]( convert ); \ +} + +CONVERT_ABGR8888( texsubimage2d ) +CONVERT_ABGR8888( texsubimage3d ) + + +static void +unconvert_teximage_abgr8888( struct gl_texture_convert *convert ) { - const GLint wScale = dstWidth / srcWidth; /* must be power of two */ - const GLint hScale = dstHeight / srcHeight; /* must be power of two */ - ASSERT(dstWidth >= srcWidth); - ASSERT(dstHeight >= srcHeight); - ASSERT(dstImage); - ASSERT(srcImage); - ASSERT(packing); - - width *= wScale; - height *= hScale; - dstXoffset *= wScale; - dstYoffset *= hScale; - - /* XXX hscale != 1 and wscale != 1 not tested!!!! */ - - switch (dstFormat) { - case MESA_I8: - case MESA_L8: - case MESA_A8: - case MESA_C8: - if (srcType != GL_UNSIGNED_BYTE || - ((srcFormat != GL_INTENSITY) && - (srcFormat != GL_LUMINANCE) && - (srcFormat != GL_ALPHA) && - (srcFormat != GL_COLOR_INDEX))) { - /* bad internal format / srcFormat combination */ - return GL_FALSE; - } - else { - /* store as 8-bit texels */ - if (wScale == 1 && hScale == 1) { - /* no scaling needed - fast case */ - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcRowStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLubyte *dst = (GLubyte *) dstImage - + dstYoffset * dstRowStride + dstXoffset; - const GLint rowSize = width * sizeof(GLubyte); - GLint row; - if (dstRowStride == srcRowStride && dstRowStride == rowSize) { - MEMCPY(dst, src, rowSize * height); - } - else { - for (row = 0; row < height; row++) { - MEMCPY(dst, src, rowSize); - dst += dstRowStride; - src += srcRowStride; - } - } - } - else { - /* must rescale image */ - GLubyte *dst = (GLubyte *) dstImage - + dstYoffset * dstRowStride + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - dst[col] = src[col / wScale]; - } - dst += dstRowStride; - } - } - } - break; - - case MESA_A8_L8: - if (srcType != GL_UNSIGNED_BYTE || srcFormat != GL_LUMINANCE_ALPHA) { - return GL_FALSE; - } - else { - /* store as 16-bit texels */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row, col; - for (row = 0; row < height; row++) { - for (col = 0; col < width; col++) { - GLubyte luminance = src[col * 2 + 0]; - GLubyte alpha = src[col * 2 + 1]; - dst[col] = ((GLushort) alpha << 8) | luminance; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - src += srcStride; - } - } - else { - /* must rescale */ - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row, col; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - for (col = 0; col < width; col++) { - GLint srcCol = col / wScale; - GLubyte luminance = src[srcCol * 2 + 0]; - GLubyte alpha = src[srcCol * 2 + 1]; - dst[col] = ((GLushort) alpha << 8) | luminance; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - src += srcStride; - } - } - } - break; - - case MESA_R5_G6_B5: - if (srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5) { - /* special, optimized case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, width * sizeof(GLushort)); - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLushort *src = (const GLushort *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - dst[col] = src[col / wScale]; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint col, col3; - for (col = col3 = 0; col < width; col++, col3 += 3) { - GLubyte r = src[col3 + 0]; - GLubyte g = src[col3 + 1]; - GLubyte b = src[col3 + 2]; - dst[col] = ((r & 0xf8) << 8) - | ((g & 0xfc) << 3) - | ((b & 0xf8) >> 3); - } - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - GLint col3 = (col / wScale) * 3; - GLubyte r = src[col3 + 0]; - GLubyte g = src[col3 + 1]; - GLubyte b = src[col3 + 2]; - dst[col] = ((r & 0xf8) << 8) - | ((g & 0xfc) << 3) - | ((b & 0xf8) >> 3); - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { - /* general case (used by Quake3) */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint col, col4; - for (col = col4 = 0; col < width; col++, col4 += 4) { - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - dst[col] = ((r & 0xf8) << 8) - | ((g & 0xfc) << 3) - | ((b & 0xf8) >> 3); - } - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - GLint col4 = (col / wScale) * 4; - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - dst[col] = ((r & 0xf8) << 8) - | ((g & 0xfc) << 3) - | ((b & 0xf8) >> 3); - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else { - /* can't handle this srcFormat/srcType combination */ - return GL_FALSE; - } - break; - - case MESA_A4_R4_G4_B4: - /* store as 16-bit texels (GR_TEXFMT_ARGB_4444) */ - if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV){ - /* special, optimized case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, width * sizeof(GLushort)); - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLushort *src = (const GLushort *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - dst[col] = src[col / wScale]; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint col, col4; - for (col = col4 = 0; col < width; col++, col4 += 4) { - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = ((a & 0xf0) << 8) - | ((r & 0xf0) << 4) - | ((g & 0xf0) ) - | ((b & 0xf0) >> 4); - } - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - GLint col4 = (col / wScale) * 4; - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = ((a & 0xf0) << 8) - | ((r & 0xf0) << 4) - | ((g & 0xf0) ) - | ((b & 0xf0) >> 4); - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else { - /* can't handle this format/srcType combination */ - return GL_FALSE; - } - break; - - case MESA_A1_R5_G5_B5: - /* store as 16-bit texels (GR_TEXFMT_ARGB_1555) */ - if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV){ - /* special, optimized case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, width * sizeof(GLushort)); - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLushort *src = (const GLushort *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - dst[col] = src[col / wScale]; - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else if (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint col, col4; - for (col = col4 = 0; col < width; col++, col4 += 4) { - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = ((a & 0x80) << 8) - | ((r & 0xf8) << 7) - | ((g & 0xf8) << 2) - | ((b & 0xf8) >> 3); - } - src += srcStride; - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLushort *dst = (GLushort *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - GLint col4 = (col / wScale) * 4; - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3]; - dst[col] = ((a & 0x80) << 8) - | ((r & 0xf8) << 7) - | ((g & 0xf8) << 2) - | ((b & 0xf8) >> 3); - } - dst = (GLushort *) ((GLubyte *) dst + dstRowStride); - } - } - } - else { - /* can't handle this source format/type combination */ - return GL_FALSE; - } - break; - - case MESA_A8_R8_G8_B8: - case MESA_FF_R8_G8_B8: - /* 32-bit texels */ - if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) { - /* special, optimized case */ - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLuint *dst = (GLuint *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - MEMCPY(dst, src, width * sizeof(GLuint)); - src += srcStride; - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLuint *dst = (GLuint *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLuint *src = (const GLuint *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - dst[col] = src[col / wScale]; - } - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - if (dstFormat == MESA_FF_R8_G8_B8) { - /* set alpha bytes to 0xff */ - GLint row, col; - GLubyte *dst = (GLubyte *) dstImage - + dstYoffset * dstRowStride + dstXoffset * 4; - assert(wScale == 1 && hScale == 1); /* XXX not done */ - for (row = 0; row < height; row++) { - for (col = 0; col < width; col++) { - dst[col * 4 + 3] = 0xff; - } - dst = dst + dstRowStride; - } - } - } - else if (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { - /* general case */ - const GLubyte aMask = (dstFormat==MESA_FF_R8_G8_B8) ? 0xff : 0x00; - if (wScale == 1 && hScale == 1) { - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, srcHeight, - srcFormat, srcType, 0, 0, 0); - const GLint srcStride = _mesa_image_row_stride(packing, - width, srcFormat, srcType); - GLuint *dst = (GLuint *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint col, col4; - for (col = col4 = 0; col < width; col++, col4 += 4) { - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3] | aMask; - dst[col] = (a << 24) | (r << 16) | (g << 8) | b; - } - src += srcStride; - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - else { - /* must rescale image */ - GLuint *dst = (GLuint *) ((GLubyte *) dstImage - + dstYoffset * dstRowStride) + dstXoffset; - GLint row; - for (row = 0; row < height; row++) { - GLint srcRow = row / hScale; - const GLubyte *src = (const GLubyte *) - _mesa_image_address(packing, srcImage, srcWidth, - srcHeight, srcFormat, srcType, 0, srcRow, 0); - GLint col; - for (col = 0; col < width; col++) { - GLint col4 = (col / wScale) * 4; - GLubyte r = src[col4 + 0]; - GLubyte g = src[col4 + 1]; - GLubyte b = src[col4 + 2]; - GLubyte a = src[col4 + 3] | aMask; - dst[col] = (a << 24) | (r << 16) | (g << 8) | b; - } - dst = (GLuint *) ((GLubyte *) dst + dstRowStride); - } - } - } - else { - /* can't handle this source format/type combination */ - return GL_FALSE; - } - break; - - - default: - /* unexpected internal format! */ - return GL_FALSE; + const GLubyte *src = (const GLubyte *)convert->srcImage; + GLint texels, i; + + texels = convert->width * convert->height * convert->depth; + + switch ( convert->format ) { + case GL_RGBA: + MEMCPY( convert->dstImage, src, texels * 4 ); + break; + case GL_RGB: { + GLubyte *dst = (GLubyte *)convert->dstImage; + for ( i = 0 ; i < texels ; i++ ) { + *dst++ = src[0]; + *dst++ = src[1]; + *dst++ = src[2]; + src += 4; + } + break; + } + default: + UNCONVERT_ERROR( convert->format ); + break; } - return GL_TRUE; } +/* ================================================================ + * ARGB8888 textures: + */ -/* - * Used to convert 16-bit texels into GLubyte color components. +#define DST_TYPE GLuint +#define DST_TEXELS_PER_DWORD 1 + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_8888( src[3], src[2], src[1], src[0] ) + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 4 + +#define TAG(x) x##_argb8888_direct +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_8888( src[3], src[0], src[1], src[2] ) + +#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src ) + +#define SRC_TEXEL_BYTES 4 + +#define TAG(x) x##_abgr8888_to_argb8888 +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_8888( 0xff, src[0], src[1], src[2] ) + +#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src ) + +#define SRC_TEXEL_BYTES 3 + +#define TAG(x) x##_bgr888_to_argb8888 +#include "texutil_tmp.h" + + +#define CONVERT_ARGB8888( name ) \ +static GLboolean \ +convert_##name##_argb8888( struct gl_texture_convert *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if ( convert->format == GL_BGRA && \ + convert->type == GL_UNSIGNED_INT_8_8_8_8_REV ) \ + { \ + tab = name##_tab_argb8888_direct; \ + } \ + else if ( convert->format == GL_RGBA && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_abgr8888_to_argb8888; \ + } \ + else if ( convert->format == GL_RGB && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_bgr888_to_argb8888; \ + } \ + else \ + { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + \ + return tab[index]( convert ); \ +} + +CONVERT_ARGB8888( texsubimage2d ) +CONVERT_ARGB8888( texsubimage3d ) + + +static void +unconvert_teximage_argb8888( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *)convert->srcImage; + GLint texels, i; + + texels = convert->width * convert->height * convert->depth; + + switch ( convert->format ) { + case GL_RGBA: { + GLuint *dst = (GLuint *)convert->dstImage; + for ( i = 0 ; i < texels ; i++ ) { + *dst++ = PACK_COLOR_8888( src[3], src[0], src[1], src[2] ); + src += 4; + } + break; + } + case GL_RGB: { + GLubyte *dst = (GLubyte *)convert->dstImage; + for ( i = 0 ; i < texels ; i++ ) { + *dst++ = src[2]; + *dst++ = src[1]; + *dst++ = src[0]; + src += 4; + } + break; + } + default: + UNCONVERT_ERROR( convert->format ); + break; + } +} + + + +/* ================================================================ + * RGB888 textures: + */ + +static GLboolean +convert_texsubimage2d_rgb888( struct gl_texture_convert *convert ) +{ + /* This is a placeholder for now... + */ + return GL_FALSE; +} + +static GLboolean +convert_texsubimage3d_rgb888( struct gl_texture_convert *convert ) +{ + /* This is a placeholder for now... + */ + return GL_FALSE; +} + + +static void +unconvert_teximage_rgb888( struct gl_texture_convert *convert ) +{ + UNCONVERT_ERROR( convert->format ); +} + + + +/* ================================================================ + * BGR888 textures: */ -static GLubyte R5G6B5toRed[0xffff]; -static GLubyte R5G6B5toGreen[0xffff]; -static GLubyte R5G6B5toBlue[0xffff]; -static GLubyte A4R4G4B4toRed[0xffff]; -static GLubyte A4R4G4B4toGreen[0xffff]; -static GLubyte A4R4G4B4toBlue[0xffff]; -static GLubyte A4R4G4B4toAlpha[0xffff]; +static GLboolean +convert_texsubimage2d_bgr888( struct gl_texture_convert *convert ) +{ + /* This is a placeholder for now... + */ + return GL_FALSE; +} + +static GLboolean +convert_texsubimage3d_bgr888( struct gl_texture_convert *convert ) +{ + /* This is a placeholder for now... + */ + return GL_FALSE; +} + + +static void +unconvert_teximage_bgr888( struct gl_texture_convert *convert ) +{ + UNCONVERT_ERROR( convert->format ); +} + + + +/* ================================================================ + * RGB565 textures: + */ + +#define DST_TYPE GLushort +#define DST_TEXELS_PER_DWORD 2 + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_565( src[0], src[1], src[2] ) + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 2 + +#define TAG(x) x##_rgb565_direct +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_565( src[0], src[1], src[2] ) + +#define CONVERT_TEXEL_DWORD( src ) \ + ((PACK_COLOR_565( src[0], src[1], src[2] )) | \ + (PACK_COLOR_565( src[3], src[4], src[5] ) << 16)) + +#define SRC_TEXEL_BYTES 3 + +#define TAG(x) x##_bgr888_to_rgb565 +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_565( src[0], src[1], src[2] ) + +#define CONVERT_TEXEL_DWORD( src ) \ + ((PACK_COLOR_565( src[0], src[1], src[2] )) | \ + (PACK_COLOR_565( src[4], src[5], src[6] ) << 16)) + +#define SRC_TEXEL_BYTES 4 + +#define TAG(x) x##_abgr8888_to_rgb565 +#include "texutil_tmp.h" + + +#define CONVERT_RGB565( name ) \ +static GLboolean \ +convert_##name##_rgb565( struct gl_texture_convert *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if ( convert->format == GL_RGB && \ + convert->type == GL_UNSIGNED_SHORT_5_6_5 ) \ + { \ + tab = name##_tab_rgb565_direct; \ + } \ + else if ( convert->format == GL_RGB && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_bgr888_to_rgb565; \ + } \ + else if ( convert->format == GL_RGBA && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_abgr8888_to_rgb565; \ + } \ + else \ + { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + \ + return tab[index]( convert ); \ +} + +CONVERT_RGB565( texsubimage2d ) +CONVERT_RGB565( texsubimage3d ) + + +static void +unconvert_teximage_rgb565( struct gl_texture_convert *convert ) +{ + const GLushort *src = (const GLushort *)convert->srcImage; + GLubyte *dst = (GLubyte *)convert->dstImage; + GLint texels, i; + + texels = convert->width * convert->height * convert->depth; + + switch ( convert->format ) { + case GL_RGBA: + for ( i = 0 ; i < texels ; i++ ) { + GLushort s = *src++; + *dst++ = ((s >> 8) & 0xf8) * 255 / 0xf8; + *dst++ = ((s >> 3) & 0xfc) * 255 / 0xfc; + *dst++ = ((s << 3) & 0xf8) * 255 / 0xf8; + *dst++ = 0xff; + } + break; + case GL_RGB: + for ( i = 0 ; i < texels ; i++ ) { + GLushort s = *src++; + *dst++ = ((s >> 8) & 0xf8) * 255 / 0xf8; + *dst++ = ((s >> 3) & 0xfc) * 255 / 0xfc; + *dst++ = ((s << 3) & 0xf8) * 255 / 0xf8; + } + break; + default: + UNCONVERT_ERROR( convert->format ); + break; + } +} + + + +/* ================================================================ + * ARGB4444 textures: + */ + +#define DST_TYPE GLushort +#define DST_TEXELS_PER_DWORD 2 + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_4444( src[3], src[0], src[1], src[2] ) + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 2 + +#define TAG(x) x##_argb4444_direct +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_4444( src[3], src[0], src[1], src[2] ) + +#define CONVERT_TEXEL_DWORD( src ) \ + ((PACK_COLOR_4444( src[3], src[0], src[1], src[2] )) | \ + (PACK_COLOR_4444( src[7], src[4], src[5], src[6] ) << 16)) + +#define SRC_TEXEL_BYTES 4 + +#define TAG(x) x##_rgba8888_to_argb4444 +#include "texutil_tmp.h" + + +#define CONVERT_ARGB4444( name ) \ +static GLboolean \ +convert_##name##_argb4444( struct gl_texture_convert *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if ( convert->format == GL_BGRA && \ + convert->type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) \ + { \ + tab = name##_tab_argb4444_direct; \ + } \ + else if ( convert->format == GL_RGBA && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_rgba8888_to_argb4444; \ + } \ + else \ + { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + \ + return tab[index]( convert ); \ +} + +CONVERT_ARGB4444( texsubimage2d ) +CONVERT_ARGB4444( texsubimage3d ) -static GLubyte A1R5G5B5toRed[0xffff]; -static GLubyte A1R5G5B5toGreen[0xffff]; -static GLubyte A1R5G5B5toBlue[0xffff]; -static GLubyte A1R5G5B5toAlpha[0xffff]; static void -generate_lookup_tables(void) +unconvert_teximage_argb4444( struct gl_texture_convert *convert ) { - GLint i; - for (i = 0; i <= 0xffff; i++) { - GLint r = (i >> 8) & 0xf8; - GLint g = (i >> 3) & 0xfc; - GLint b = (i << 3) & 0xf8; - r = r * 255 / 0xf8; - g = g * 255 / 0xfc; - b = b * 255 / 0xf8; - R5G6B5toRed[i] = r; - R5G6B5toGreen[i] = g; - R5G6B5toBlue[i] = b; + const GLushort *src = (const GLushort *)convert->srcImage; + GLubyte *dst = (GLubyte *)convert->dstImage; + GLint texels, i; + + texels = convert->width * convert->height * convert->depth; + + switch ( convert->format ) { + case GL_RGBA: + for ( i = 0 ; i < texels ; i++ ) { + GLushort s = *src++; + *dst++ = ((s >> 8) & 0xf) * 255 / 0xf; + *dst++ = ((s >> 4) & 0xf) * 255 / 0xf; + *dst++ = ((s ) & 0xf) * 255 / 0xf; + *dst++ = ((s >> 12) & 0xf) * 255 / 0xf; + } + break; + default: + UNCONVERT_ERROR( convert->format ); + break; } +} + + + +/* ================================================================ + * ARGB1555 textures: + */ + +#define DST_TYPE GLushort +#define DST_TEXELS_PER_DWORD 2 + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_1555( src[3], src[0], src[1], src[2] ) + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 2 - for (i = 0; i <= 0xffff; i++) { - GLint r = (i >> 8) & 0xf; - GLint g = (i >> 4) & 0xf; - GLint b = (i ) & 0xf; - GLint a = (i >> 12) & 0xf; - r = r * 255 / 0xf; - g = g * 255 / 0xf; - b = b * 255 / 0xf; - a = a * 255 / 0xf; - A4R4G4B4toRed[i] = r; - A4R4G4B4toGreen[i] = g; - A4R4G4B4toBlue[i] = b; - A4R4G4B4toAlpha[i] = a; +#define TAG(x) x##_argb1555_direct +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_1555( src[3], src[0], src[1], src[2] ) + +#define CONVERT_TEXEL_DWORD( src ) \ + ((PACK_COLOR_1555( src[3], src[0], src[1], src[2] )) | \ + (PACK_COLOR_1555( src[7], src[4], src[5], src[6] ) << 16)) + +#define SRC_TEXEL_BYTES 4 + +#define TAG(x) x##_rgba8888_to_argb1555 +#include "texutil_tmp.h" + + +#define CONVERT_ARGB1555( name ) \ +static GLboolean \ +convert_##name##_argb1555( struct gl_texture_convert *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if ( convert->format == GL_BGRA && \ + convert->type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) \ + { \ + tab = name##_tab_argb1555_direct; \ + } \ + else if ( convert->format == GL_RGBA && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_rgba8888_to_argb1555; \ + } \ + else \ + { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + \ + return tab[index]( convert ); \ +} + +CONVERT_ARGB1555( texsubimage2d ) +CONVERT_ARGB1555( texsubimage3d ) + + +static void +unconvert_teximage_argb1555( struct gl_texture_convert *convert ) +{ + const GLushort *src = (const GLushort *)convert->srcImage; + GLubyte *dst = (GLubyte *)convert->dstImage; + GLint texels, i; + + texels = convert->width * convert->height * convert->depth; + + switch ( convert->format ) { + case GL_RGBA: + for ( i = 0 ; i < texels ; i++ ) { + GLushort s = *src++; + *dst++ = ((s >> 10) & 0xf8) * 255 / 0xf8; + *dst++ = ((s >> 5) & 0xf8) * 255 / 0xf8; + *dst++ = ((s ) & 0xf8) * 255 / 0xf8; + *dst++ = ((s >> 15) & 0x01) * 255; + } + break; + default: + UNCONVERT_ERROR( convert->format ); + break; } +} + + + +/* ================================================================ + * AL88 textures: + */ + +#define DST_TYPE GLushort +#define DST_TEXELS_PER_DWORD 2 - for (i = 0; i <= 0xffff; i++) { - GLint r = (i >> 10) & 0xf8; - GLint g = (i >> 5) & 0xf8; - GLint b = (i ) & 0xf8; - GLint a = (i >> 15) & 0x1; - r = r * 255 / 0xf8; - g = g * 255 / 0xf8; - b = b * 255 / 0xf8; - a = a * 255; - A1R5G5B5toRed[i] = r; - A1R5G5B5toGreen[i] = g; - A1R5G5B5toBlue[i] = b; - A1R5G5B5toAlpha[i] = a; +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_88( src[0], src[1] ) + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 2 + +#define TAG(x) x##_al88_direct +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_88( src[0], 0x00 ) + +#define CONVERT_TEXEL_DWORD( src ) \ + ((PACK_COLOR_88( src[0], 0x00 )) | \ + (PACK_COLOR_88( src[1], 0x00 ) << 16)) + +#define SRC_TEXEL_BYTES 1 + +#define TAG(x) x##_a8_to_al88 +#define PRESERVE_DST_TYPE +#include "texutil_tmp.h" + + +#define CONVERT_TEXEL( src ) \ + PACK_COLOR_88( 0xff, src[0] ) + +#define CONVERT_TEXEL_DWORD( src ) \ + ((PACK_COLOR_88( 0xff, src[0] )) | \ + (PACK_COLOR_88( 0xff, src[1] ) << 16)) + +#define SRC_TEXEL_BYTES 1 + +#define TAG(x) x##_l8_to_al88 +#include "texutil_tmp.h" + + +#define CONVERT_AL88( name ) \ +static GLboolean \ +convert_##name##_al88( struct gl_texture_convert *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if ( convert->format == GL_LUMINANCE_ALPHA && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_al88_direct; \ + } \ + else if ( convert->format == GL_ALPHA && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_a8_to_al88; \ + } \ + else if ( convert->format == GL_LUMINANCE && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_l8_to_al88; \ + } \ + else \ + { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + \ + return tab[index]( convert ); \ +} + +CONVERT_AL88( texsubimage2d ) +CONVERT_AL88( texsubimage3d ) + + +static void +unconvert_teximage_al88( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *)convert->srcImage; + GLint texels, i; + + texels = convert->width * convert->height * convert->depth; + + switch ( convert->format ) { + case GL_LUMINANCE_ALPHA: + MEMCPY( convert->dstImage, src, texels * 2 ); + break; + case GL_ALPHA: { + GLubyte *dst = (GLubyte *)convert->dstImage; + for ( i = 0 ; i < texels ; i++ ) { + *dst++ = src[1]; + src += 2; + } + break; + } + case GL_LUMINANCE: { + GLubyte *dst = (GLubyte *)convert->dstImage; + for ( i = 0 ; i < texels ; i++ ) { + *dst++ = src[0]; + src += 2; + } + break; + } + default: + UNCONVERT_ERROR( convert->format ); + break; } } -/* - * Convert a texture image from an internal format to one of Mesa's - * core internal formats. This is likely to be used by glGetTexImage - * and for fetching texture images when falling back to software rendering. - * - * Input: - * srcFormat - source image format - * srcWidth, srcHeight - source image size - * srcImage - source image pointer - * srcRowStride - bytes to jump between image rows - * dstWidth, dstHeight - size of dest image - * dstFormat - format of dest image (must be one of Mesa's IntFormat values) - * dstImage - pointer to dest image - * Notes: - * This function will do power of two image down-scaling to accomodate - * drivers with limited texture image aspect ratios. - * The implicit dest data type is GL_UNSIGNED_BYTE. +/* ================================================================ + * RGB332 textures: + */ + +static GLboolean +convert_texsubimage2d_rgb332( struct gl_texture_convert *convert ) +{ + /* This is a placeholder for now... + */ + return GL_FALSE; +} + +static GLboolean +convert_texsubimage3d_rgb332( struct gl_texture_convert *convert ) +{ + /* This is a placeholder for now... + */ + return GL_FALSE; +} + + +static void +unconvert_teximage_rgb332( struct gl_texture_convert *convert ) +{ + UNCONVERT_ERROR( convert->format ); +} + + + +/* ================================================================ + * CI8 (and all other single-byte texel) textures: */ -void -_mesa_unconvert_teximage(MesaIntTexFormat srcFormat, - GLint srcWidth, GLint srcHeight, - const GLvoid *srcImage, GLint srcRowStride, - GLint dstWidth, GLint dstHeight, - GLenum dstFormat, GLubyte *dstImage) + +#define DST_TYPE GLubyte +#define DST_TEXELS_PER_DWORD 4 + +#define CONVERT_TEXEL( src ) src[0] + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 1 + +#define TAG(x) x##_ci8_direct +#include "texutil_tmp.h" + + +#define CONVERT_CI8( name ) \ +static GLboolean \ +convert_##name##_ci8( struct gl_texture_convert *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if ( ( convert->format == GL_ALPHA || \ + convert->format == GL_LUMINANCE || \ + convert->format == GL_INTENSITY || \ + convert->format == GL_COLOR_INDEX ) && \ + convert->type == GL_UNSIGNED_BYTE ) \ + { \ + tab = name##_tab_ci8_direct; \ + } \ + else \ + { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + \ + return tab[index]( convert ); \ +} + +CONVERT_CI8( texsubimage2d ) +CONVERT_CI8( texsubimage3d ) + + +static void +unconvert_teximage_ci8( struct gl_texture_convert *convert ) { - static GLboolean firstCall = GL_TRUE; - const GLint wScale = srcWidth / dstWidth; /* must be power of two */ - const GLint hScale = srcHeight / dstHeight; /* must be power of two */ - ASSERT(srcWidth >= dstWidth); - ASSERT(srcHeight >= dstHeight); - ASSERT(dstImage); - ASSERT(srcImage); - - if (firstCall) { - generate_lookup_tables(); - firstCall = GL_FALSE; + const GLubyte *src = (const GLubyte *)convert->srcImage; + GLint texels; + + texels = convert->width * convert->height * convert->depth; + + switch ( convert->format ) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_INTENSITY: + case GL_COLOR_INDEX: + MEMCPY( convert->dstImage, src, texels ); + break; + default: + UNCONVERT_ERROR( convert->format ); + break; } +} - switch (srcFormat) { - case MESA_I8: - case MESA_L8: - case MESA_A8: - case MESA_C8: -#ifdef DEBUG - if (srcFormat == MESA_I8) { - ASSERT(dstFormat == GL_INTENSITY); - } - else if (srcFormat == MESA_L8) { - ASSERT(dstFormat == GL_LUMINANCE); - } - else if (srcFormat == MESA_A8) { - ASSERT(dstFormat == GL_ALPHA); - } - else if (srcFormat == MESA_C8) { - ASSERT(dstFormat == GL_COLOR_INDEX); - } -#endif - if (wScale == 1 && hScale == 1) { - /* easy! */ - MEMCPY(dstImage, srcImage, dstWidth * dstHeight * sizeof(GLubyte)); - } - else { - /* rescale */ - const GLubyte *src8 = (const GLubyte *) srcImage; - GLint row, col; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row * hScale; - for (col = 0; col < dstWidth; col++) { - GLint srcCol = col * wScale; - *dstImage++ = src8[srcRow * srcWidth + srcCol]; - } - } - } - break; - case MESA_A8_L8: - ASSERT(dstFormat == GL_LUMINANCE_ALPHA); - if (wScale == 1 && hScale == 1) { - GLint i, n = dstWidth * dstHeight; - const GLushort *texel = (const GLushort *) srcImage; - for (i = 0; i < n; i++) { - const GLushort tex = *texel++; - *dstImage++ = (tex & 0xff); /* luminance */ - *dstImage++ = (tex >> 8); /* alpha */ - } - } - else { - /* rescale */ - const GLushort *src16 = (const GLushort *) srcImage; - GLint row, col; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row * hScale; - for (col = 0; col < dstWidth; col++) { - GLint srcCol = col * wScale; - const GLushort tex = src16[srcRow * srcWidth + srcCol]; - *dstImage++ = (tex & 0xff); /* luminance */ - *dstImage++ = (tex >> 8); /* alpha */ - } - } - } - break; - case MESA_R5_G6_B5: - ASSERT(dstFormat == GL_RGB); - if (wScale == 1 && hScale == 1) { - GLint i, n = dstWidth * dstHeight; - const GLushort *texel = (const GLushort *) srcImage; - for (i = 0; i < n; i++) { - const GLushort tex = *texel++; - *dstImage++ = R5G6B5toRed[tex]; - *dstImage++ = R5G6B5toGreen[tex]; - *dstImage++ = R5G6B5toBlue[tex]; - } - } - else { - /* rescale */ - const GLushort *src16 = (const GLushort *) srcImage; - GLint row, col; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row * hScale; - for (col = 0; col < dstWidth; col++) { - GLint srcCol = col * wScale; - const GLushort tex = src16[srcRow * srcWidth + srcCol]; - *dstImage++ = R5G6B5toRed[tex]; - *dstImage++ = R5G6B5toGreen[tex]; - *dstImage++ = R5G6B5toBlue[tex]; - } - } - } - break; - case MESA_A4_R4_G4_B4: - ASSERT(dstFormat == GL_RGBA); - if (wScale == 1 && hScale == 1) { - GLint i, n = dstWidth * dstHeight; - const GLushort *texel = (const GLushort *) srcImage; - for (i = 0; i < n; i++) { - const GLushort tex = *texel++; - *dstImage++ = A4R4G4B4toRed[tex]; - *dstImage++ = A4R4G4B4toGreen[tex]; - *dstImage++ = A4R4G4B4toBlue[tex]; - *dstImage++ = A4R4G4B4toAlpha[tex]; - } - } - else { - /* rescale */ - const GLushort *src16 = (const GLushort *) srcImage; - GLint row, col; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row * hScale; - for (col = 0; col < dstWidth; col++) { - GLint srcCol = col * wScale; - const GLushort tex = src16[srcRow * srcWidth + srcCol]; - *dstImage++ = A4R4G4B4toRed[tex]; - *dstImage++ = A4R4G4B4toGreen[tex]; - *dstImage++ = A4R4G4B4toBlue[tex]; - *dstImage++ = A4R4G4B4toAlpha[tex]; - } - } - } - break; - case MESA_A1_R5_G5_B5: - ASSERT(dstFormat == GL_RGBA); - if (wScale == 1 && hScale == 1) { - GLint i, n = dstWidth * dstHeight; - const GLushort *texel = (const GLushort *) srcImage; - for (i = 0; i < n; i++) { - const GLushort tex = *texel++; - *dstImage++ = A1R5G5B5toRed[tex]; - *dstImage++ = A1R5G5B5toGreen[tex]; - *dstImage++ = A1R5G5B5toBlue[tex]; - *dstImage++ = A1R5G5B5toAlpha[tex]; - } - } - else { - /* rescale */ - const GLushort *src16 = (const GLushort *) srcImage; - GLint row, col; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row * hScale; - for (col = 0; col < dstWidth; col++) { - GLint srcCol = col * wScale; - const GLushort tex = src16[srcRow * srcWidth + srcCol]; - *dstImage++ = A1R5G5B5toRed[tex]; - *dstImage++ = A1R5G5B5toGreen[tex]; - *dstImage++ = A1R5G5B5toBlue[tex]; - *dstImage++ = A1R5G5B5toAlpha[tex]; - } - } - } - break; - case MESA_A8_R8_G8_B8: - case MESA_FF_R8_G8_B8: - ASSERT(dstFormat == GL_RGBA); - if (wScale == 1 && hScale == 1) { - GLint i, n = dstWidth * dstHeight; - const GLuint *texel = (const GLuint *) srcImage; - for (i = 0; i < n; i++) { - const GLuint tex = *texel++; - *dstImage++ = (tex >> 16) & 0xff; /* R */ - *dstImage++ = (tex >> 8) & 0xff; /* G */ - *dstImage++ = (tex ) & 0xff; /* B */ - *dstImage++ = (tex >> 24) & 0xff; /* A */ - } - } - else { - /* rescale */ - const GLuint *src = (const GLuint *) srcImage; - GLint row, col; - for (row = 0; row < dstHeight; row++) { - GLint srcRow = row * hScale; - for (col = 0; col < dstWidth; col++) { - GLint srcCol = col * wScale; - const GLuint tex = src[srcRow * srcWidth + srcCol]; - *dstImage++ = (tex >> 16) & 0xff; /* R */ - *dstImage++ = (tex >> 8) & 0xff; /* G */ - *dstImage++ = (tex ) & 0xff; /* B */ - *dstImage++ = (tex >> 24) & 0xff; /* A */ - } - } - } - break; - default: - gl_problem(NULL, "bad srcFormat in _mesa_uncovert_teximage()"); + + +/* ================================================================ + * Global entry points + */ + +static convert_func gl_convert_texsubimage2d_tab[] = { + convert_texsubimage2d_rgba8888, + convert_texsubimage2d_abgr8888, + convert_texsubimage2d_argb8888, + convert_texsubimage2d_rgb888, + convert_texsubimage2d_bgr888, + convert_texsubimage2d_rgb565, + convert_texsubimage2d_argb4444, + convert_texsubimage2d_argb1555, + convert_texsubimage2d_al88, + convert_texsubimage2d_rgb332, + convert_texsubimage2d_ci8, /* These are all the same... */ + convert_texsubimage2d_ci8, + convert_texsubimage2d_ci8, + convert_texsubimage2d_ci8, +}; + +static convert_func gl_convert_texsubimage3d_tab[] = { + convert_texsubimage3d_rgba8888, + convert_texsubimage3d_abgr8888, + convert_texsubimage3d_argb8888, + convert_texsubimage3d_rgb888, + convert_texsubimage3d_bgr888, + convert_texsubimage3d_rgb565, + convert_texsubimage3d_argb4444, + convert_texsubimage3d_argb1555, + convert_texsubimage3d_al88, + convert_texsubimage3d_rgb332, + convert_texsubimage3d_ci8, /* These are all the same... */ + convert_texsubimage3d_ci8, + convert_texsubimage3d_ci8, + convert_texsubimage3d_ci8, +}; + +static unconvert_func gl_unconvert_teximage_tab[] = { + unconvert_teximage_rgba8888, + unconvert_teximage_abgr8888, + unconvert_teximage_argb8888, + unconvert_teximage_rgb888, + unconvert_teximage_bgr888, + unconvert_teximage_rgb565, + unconvert_teximage_argb4444, + unconvert_teximage_argb1555, + unconvert_teximage_al88, + unconvert_teximage_rgb332, + unconvert_teximage_ci8, /* These are all the same... */ + unconvert_teximage_ci8, + unconvert_teximage_ci8, + unconvert_teximage_ci8, +}; + + +/* See if we need to care about the pixel store attributes when we're + * converting the texture image. This should be stored as + * packing->_SomeBoolean and updated when the values change, to avoid + * testing every time... + */ +static INLINE GLboolean +convert_needs_packing( const struct gl_pixelstore_attrib *packing, + GLenum format, GLenum type ) +{ + if ( ( packing->Alignment == 1 || + ( packing->Alignment == 4 && /* Pick up the common Q3A case... */ + format == GL_RGBA && type == GL_UNSIGNED_BYTE ) ) && + packing->RowLength == 0 && + packing->SkipPixels == 0 && + packing->SkipRows == 0 && + packing->ImageHeight == 0 && + packing->SkipImages == 0 && + packing->SwapBytes == GL_FALSE && + packing->LsbFirst == GL_FALSE ) { + return GL_FALSE; + } else { + return GL_TRUE; } } +GLboolean +_mesa_convert_texsubimage1d( GLint mesaFormat, + GLint xoffset, + GLint width, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + const GLvoid *srcImage, GLvoid *dstImage ) +{ + struct gl_texture_convert convert; -/* - * Given an internal Mesa driver texture format, fill in the component - * bit sizes in the given texture image struct. + ASSERT( packing ); + ASSERT( srcImage ); + ASSERT( dstImage ); + + ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); + ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + + /* Make it easier to pass all the parameters around. + */ + convert.xoffset = xoffset; + convert.yoffset = 0; + convert.width = width; + convert.height = 1; + convert.format = format; + convert.type = type; + convert.packing = packing; + convert.srcImage = srcImage; + convert.dstImage = dstImage; + + convert.index = 0; + + if ( convert_needs_packing( packing, format, type ) ) + convert.index |= CONVERT_PACKING_BIT; + + return gl_convert_texsubimage2d_tab[mesaFormat]( &convert ); +} + +GLboolean +_mesa_convert_texsubimage2d( GLint mesaFormat, + GLint xoffset, GLint yoffset, + GLint width, GLint height, + GLint imageWidth, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + const GLvoid *srcImage, GLvoid *dstImage ) +{ + struct gl_texture_convert convert; + + ASSERT( packing ); + ASSERT( srcImage ); + ASSERT( dstImage ); + + ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); + ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + + /* Make it easier to pass all the parameters around. + */ + convert.xoffset = xoffset; + convert.yoffset = yoffset; + convert.width = width; + convert.height = height; + convert.imageWidth = imageWidth; + convert.format = format; + convert.type = type; + convert.packing = packing; + convert.srcImage = srcImage; + convert.dstImage = dstImage; + + convert.index = 0; + + if ( convert_needs_packing( packing, format, type ) ) + convert.index |= CONVERT_PACKING_BIT; + + if ( width != imageWidth ) + convert.index |= CONVERT_STRIDE_BIT; + + return gl_convert_texsubimage2d_tab[mesaFormat]( &convert ); +} + +GLboolean +_mesa_convert_texsubimage3d( GLint mesaFormat, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLint imageWidth, GLint imageHeight, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + const GLvoid *srcImage, GLvoid *dstImage ) +{ + struct gl_texture_convert convert; + + ASSERT( packing ); + ASSERT( srcImage ); + ASSERT( dstImage ); + + ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); + ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + + /* Make it easier to pass all the parameters around. + */ + convert.xoffset = xoffset; + convert.yoffset = yoffset; + convert.zoffset = zoffset; + convert.width = width; + convert.height = height; + convert.depth = depth; + convert.imageWidth = imageWidth; + convert.imageHeight = imageHeight; + convert.format = format; + convert.type = type; + convert.packing = packing; + convert.srcImage = srcImage; + convert.dstImage = dstImage; + + convert.index = 0; + + if ( convert_needs_packing( packing, format, type ) ) + convert.index |= CONVERT_PACKING_BIT; + + if ( width != imageWidth || height != imageHeight ) + convert.index |= CONVERT_STRIDE_BIT; + + return gl_convert_texsubimage3d_tab[mesaFormat]( &convert ); +} + + + +void _mesa_unconvert_teximage1d( GLint mesaFormat, GLenum format, GLint width, + const GLvoid *srcImage, GLvoid *dstImage ) +{ + struct gl_texture_convert convert; + + ASSERT( srcImage ); + ASSERT( dstImage ); + + ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); + ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + + /* Make it easier to pass all the parameters around. + */ + convert.width = width; + convert.height = 1; + convert.depth = 1; + convert.format = format; + convert.srcImage = srcImage; + convert.dstImage = dstImage; + + gl_unconvert_teximage_tab[mesaFormat]( &convert ); +} + +void _mesa_unconvert_teximage2d( GLint mesaFormat, GLenum format, + GLint width, GLint height, + const GLvoid *srcImage, GLvoid *dstImage ) +{ + struct gl_texture_convert convert; + + ASSERT( srcImage ); + ASSERT( dstImage ); + + ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); + ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + + /* Make it easier to pass all the parameters around. + */ + convert.width = width; + convert.height = height; + convert.depth = 1; + convert.format = format; + convert.srcImage = srcImage; + convert.dstImage = dstImage; + + gl_unconvert_teximage_tab[mesaFormat]( &convert ); +} + +void _mesa_unconvert_teximage3d( GLint mesaFormat, GLenum format, + GLint width, GLint height, GLint depth, + const GLvoid *srcImage, GLvoid *dstImage ) +{ + struct gl_texture_convert convert; + + ASSERT( srcImage ); + ASSERT( dstImage ); + + ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); + ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + + /* Make it easier to pass all the parameters around. + */ + convert.width = width; + convert.height = height; + convert.depth = depth; + convert.format = format; + convert.srcImage = srcImage; + convert.dstImage = dstImage; + + gl_unconvert_teximage_tab[mesaFormat]( &convert ); +} + + + +/* Nearest filtering only (for broken hardware that can't support + * all aspect ratios). This can be made a lot faster, but I don't + * really care enough... */ -void -_mesa_set_teximage_component_sizes(MesaIntTexFormat mesaFormat, - struct gl_texture_image *texImage) +void _mesa_rescale_teximage2d( const struct gl_texture_format *texFormat, + GLint srcWidth, GLint srcHeight, + GLint dstWidth, GLint dstHeight, + const GLvoid *srcImage, GLvoid *dstImage ) { - static const GLint bitSizes [][8] = { - /* format R G B A I L C */ - { MESA_I8, 0, 0, 0, 0, 8, 0, 0 }, - { MESA_L8, 0, 0, 0, 0, 0, 8, 0 }, - { MESA_A8, 0, 0, 0, 8, 0, 0, 0 }, - { MESA_C8, 0, 0, 0, 0, 0, 0, 8 }, - { MESA_A8_L8, 0, 0, 0, 8, 0, 8, 0 }, - { MESA_R5_G6_B5, 5, 6, 5, 0, 0, 0, 0 }, - { MESA_A4_R4_G4_B4, 4, 4, 4, 4, 0, 0, 0 }, - { MESA_A1_R5_G5_B5, 5, 5, 5, 1, 0, 0, 0 }, - { MESA_A8_R8_G8_B8, 8, 8, 8, 8, 0, 0, 0 }, - { MESA_FF_R8_G8_B8, 8, 8, 8, 8, 0, 0, 0 }, - { -1, 0, 0, 0, 0, 0, 0, 0 } - }; - GLint i; - for (i = 0; i < bitSizes[i][0] >= 0; i++) { - if (bitSizes[i][0] == mesaFormat) { - texImage->RedBits = bitSizes[i][1]; - texImage->GreenBits = bitSizes[i][2]; - texImage->BlueBits = bitSizes[i][3]; - texImage->AlphaBits = bitSizes[i][4]; - texImage->IntensityBits = bitSizes[i][5]; - texImage->LuminanceBits = bitSizes[i][6]; - texImage->IndexBits = bitSizes[i][7]; - return; - } + GLint row, col; + +#define INNER_LOOP( HOP, WOP ) \ + for ( row = 0 ; row < dstHeight ; row++ ) { \ + GLint srcRow = row HOP hScale; \ + for ( col = 0 ; col < dstWidth ; col++ ) { \ + GLint srcCol = col WOP wScale; \ + *dst++ = src[srcRow * srcWidth + srcCol]; \ + } \ + } \ + +#define RESCALE_IMAGE( TYPE ) \ +do { \ + const TYPE *src = (const TYPE *)srcImage; \ + TYPE *dst = (TYPE *)dstImage; \ + \ + if ( srcHeight <= dstHeight ) { \ + const GLint hScale = dstHeight / srcHeight; \ + if ( srcWidth <= dstWidth ) { \ + const GLint wScale = dstWidth / srcWidth; \ + INNER_LOOP( /, / ); \ + } \ + else { \ + const GLint wScale = srcWidth / dstWidth; \ + INNER_LOOP( /, * ); \ + } \ + } \ + else { \ + const GLint hScale = srcHeight / dstHeight; \ + if ( srcWidth <= dstWidth ) { \ + const GLint wScale = dstWidth / srcWidth; \ + INNER_LOOP( *, / ); \ + } \ + else { \ + const GLint wScale = srcWidth / dstWidth; \ + INNER_LOOP( *, * ); \ + } \ + } \ +} while (0) + + switch ( texFormat->TexelBytes ) { + case 4: + RESCALE_IMAGE( GLuint ); + break; + + case 2: + RESCALE_IMAGE( GLushort ); + break; + + case 1: + RESCALE_IMAGE( GLubyte ); + break; } - gl_problem(NULL, "bad format in _mesa_set_teximage_component_sizes"); } diff --git a/xc/extras/Mesa/src/texutil.h b/xc/extras/Mesa/src/texutil.h index 22e916d50..a3e842667 100644 --- a/xc/extras/Mesa/src/texutil.h +++ b/xc/extras/Mesa/src/texutil.h @@ -2,91 +2,86 @@ /* * Mesa 3-D graphics library * Version: 3.4 - * + * * Copyright (C) 1999-2000 Brian Paul 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 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 * BRIAN PAUL 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: + * Gareth Hughes <gareth@valinux.com> */ #ifndef TEXUTIL_H #define TEXUTIL_H - #include "types.h" - - - -/* - * NOTE: "FF" means fill with byte value 0xff - */ - /* msb <------ TEXEL BITS -----------> lsb */ -typedef enum { /* ---- ---- ---- ---- ---- ---- ---- ---- */ - MESA_I8, /* IIII IIII */ - MESA_L8, /* LLLL LLLL */ - MESA_A8, /* AAAA AAAA */ - MESA_C8, /* CCCC CCCC */ - MESA_A8_L8, /* AAAA AAAA LLLL LLLL */ - MESA_R5_G6_B5, /* RRRR RGGG GGGB BBBB */ - MESA_A4_R4_G4_B4, /* AAAA RRRR GGGG BBBB */ - MESA_A1_R5_G5_B5, /* ARRR RRGG GGGB BBBB */ - MESA_A8_R8_G8_B8, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FF_R8_G8_B8 /* FFFF FFFF RRRR RRRR GGGG GGGG BBBB BBBB */ -} MesaIntTexFormat; - - - +#include "texformat.h" extern GLboolean -_mesa_convert_teximage(MesaIntTexFormat dstFormat, - GLint dstWidth, GLint dstHeight, GLvoid *dstImage, - GLint dstRowStride, - GLint srcWidth, GLint srcHeight, - GLenum srcFormat, GLenum srcType, - const GLvoid *srcImage, - const struct gl_pixelstore_attrib *packing); - - +_mesa_convert_texsubimage1d( GLint mesaFormat, + GLint xoffset, + GLint width, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + const GLvoid *srcImage, GLvoid *dstImage ); extern GLboolean -_mesa_convert_texsubimage(MesaIntTexFormat dstFormat, - GLint dstXoffset, GLint dstYoffset, - GLint dstWidth, GLint dstHeight, GLvoid *dstImage, - GLint dstRowStride, - GLint width, GLint height, - GLint srcWidth, GLint srcHeight, - GLenum srcFormat, GLenum srcType, - const GLvoid *srcImage, - const struct gl_pixelstore_attrib *packing); - +_mesa_convert_texsubimage2d( GLint mesaFormat, + GLint xoffset, GLint yoffset, + GLint width, GLint height, + GLint imageWidth, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + const GLvoid *srcImage, GLvoid *dstImage ); +extern GLboolean +_mesa_convert_texsubimage3d( GLint mesaFormat, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLint imageWidth, GLint imageHeight, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + const GLvoid *srcImage, GLvoid *dstImage ); + +/* Deprecated in 3.5: + */ extern void -_mesa_unconvert_teximage(MesaIntTexFormat srcFormat, - GLint srcWidth, GLint srcHeight, - const GLvoid *srcImage, GLint srcRowStride, - GLint dstWidth, GLint dstHeight, - GLenum dstFormat, GLubyte *dstImage); +_mesa_unconvert_teximage1d( GLint mesaFormat, GLenum format, GLint width, + const GLvoid *srcImage, GLvoid *dstImage ); +extern void +_mesa_unconvert_teximage2d( GLint mesaFormat, GLenum format, + GLint width, GLint height, + const GLvoid *srcImage, GLvoid *dstImage ); extern void -_mesa_set_teximage_component_sizes(MesaIntTexFormat mesaFormat, - struct gl_texture_image *texImage); +_mesa_unconvert_teximage3d( GLint mesaFormat, GLenum format, + GLint width, GLint height, GLint depth, + const GLvoid *srcImage, GLvoid *dstImage ); +/* Nearest filtering only (for broken hardware that can't support + * all aspect ratios). FIXME: Make this a subimage update as well... + */ +extern void +_mesa_rescale_teximage2d( const struct gl_texture_format *texFormat, + GLint srcWidth, GLint srcHeight, + GLint dstWidth, GLint dstHeight, + const GLvoid *srcImage, GLvoid *dstImage ); #endif - diff --git a/xc/extras/Mesa/src/texutil_tmp.h b/xc/extras/Mesa/src/texutil_tmp.h new file mode 100644 index 000000000..ea6c4ee52 --- /dev/null +++ b/xc/extras/Mesa/src/texutil_tmp.h @@ -0,0 +1,375 @@ +/* + * NOTE: All 3D code is untested and most definitely broken... + */ + +#define DST_TEXEL_BYTES (4 / DST_TEXELS_PER_DWORD) +#define DST_ROW_WIDTH (convert->width * DST_TEXEL_BYTES) +#define DST_ROW_STRIDE (convert->imageWidth * DST_TEXEL_BYTES) +#define DST_IMG_STRIDE (convert->imageWidth * \ + convert->imageHeight * DST_TEXEL_BYTES) + + +/* ================================================================ + * PRE: No pixelstore attribs, width == imageWidth. + */ +static GLboolean +TAG(texsubimage2d)( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *)convert->srcImage; + GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + + (convert->yoffset * convert->imageWidth + + convert->xoffset) * DST_TEXEL_BYTES); + GLint dwords, i; + (void) dwords; (void) i; + + if ( DBG ) + fprintf( stderr, __FUNCTION__ "\n" ); + +#ifdef CONVERT_DIRECT + MEMCPY( dst, src, convert->height * DST_ROW_WIDTH ); +#else + dwords = (convert->width * convert->height + + DST_TEXELS_PER_DWORD - 1) / DST_TEXELS_PER_DWORD; + + for ( i = 0 ; i < dwords ; i++ ) { + *dst++ = CONVERT_TEXEL_DWORD( src ); + src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD; + } +#endif + + return GL_TRUE; +} + +/* PRE: As above, height == imageHeight also. + */ +static GLboolean +TAG(texsubimage3d)( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *)convert->srcImage; + GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + + ((convert->zoffset * convert->height + + convert->yoffset) * convert->width + + convert->xoffset) * DST_TEXEL_BYTES); + GLint dwords, i; + (void) dwords; (void) i; + + if ( DBG ) + fprintf( stderr, __FUNCTION__ "\n" ); + +#ifdef CONVERT_DIRECT + MEMCPY( dst, src, convert->depth * convert->height * DST_ROW_WIDTH ); +#else + dwords = (convert->width * convert->height * convert->depth + + DST_TEXELS_PER_DWORD - 1) / DST_TEXELS_PER_DWORD; + + for ( i = 0 ; i < dwords ; i++ ) { + *dst++ = CONVERT_TEXEL_DWORD( src ); + src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD; + } +#endif + + return GL_TRUE; +} + + + +/* ================================================================ + * PRE: No pixelstore attribs, width != imageWidth. + */ +static GLboolean +TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *)convert->srcImage; + DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + + (convert->yoffset * convert->imageWidth + + convert->xoffset) * DST_TEXEL_BYTES); + GLint adjust; + GLint row, col; + + adjust = convert->imageWidth - convert->width; + + if ( DBG ) { + fprintf( stderr, __FUNCTION__ ":\n" ); + fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + convert->xoffset, convert->yoffset, convert->width, + convert->height, convert->imageWidth ); + fprintf( stderr, " adjust=%d\n", adjust ); + } + + for ( row = 0 ; row < convert->height ; row++ ) { + for ( col = 0 ; col < convert->width ; col++ ) { + *dst++ = CONVERT_TEXEL( src ); + src += SRC_TEXEL_BYTES; + } + dst += adjust; + } + + return GL_TRUE; +} + +/* PRE: As above, or height != imageHeight also. + */ +static GLboolean +TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *)convert->srcImage; + DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + + ((convert->zoffset * convert->imageHeight + + convert->yoffset) * convert->imageWidth + + convert->xoffset) * DST_TEXEL_BYTES); + GLint adjust; + GLint row, col, img; + + adjust = convert->imageWidth - convert->width; + + if ( DBG ) { + fprintf( stderr, __FUNCTION__ ":\n" ); + fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + convert->xoffset, convert->yoffset, convert->width, + convert->height, convert->imageWidth ); + fprintf( stderr, " adjust=%d\n", adjust ); + } + + for ( img = 0 ; img < convert->depth ; img++ ) { + for ( row = 0 ; row < convert->height ; row++ ) { + for ( col = 0 ; col < convert->width ; col++ ) { + *dst++ = CONVERT_TEXEL( src ); + src += SRC_TEXEL_BYTES; + } + dst += adjust; + } + /* FIXME: ... */ + } + + return GL_TRUE; +} + + + +/* ================================================================ + * PRE: Require pixelstore attribs, width == imageWidth. + */ +static GLboolean +TAG(texsubimage2d_pack)( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *) + _mesa_image_address( convert->packing, convert->srcImage, + convert->width, convert->height, + convert->format, convert->type, 0, 0, 0 ); + const GLint srcRowStride = + _mesa_image_row_stride( convert->packing, convert->width, + convert->format, convert->type ); + GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + + (convert->yoffset * convert->width + + convert->xoffset) * DST_TEXEL_BYTES); + GLint width; + GLint row, col; + (void) col; + + if ( DBG ) + fprintf( stderr, __FUNCTION__ "\n" ); + + width = ((convert->width + DST_TEXELS_PER_DWORD - 1) + & ~(DST_TEXELS_PER_DWORD - 1)); + + for ( row = 0 ; row < convert->height ; row++ ) { +#ifdef CONVERT_DIRECT + MEMCPY( dst, src, DST_ROW_STRIDE ); + src += srcRowStride; + dst = (GLuint *)((GLubyte *)dst + DST_ROW_STRIDE); +#else + const GLubyte *srcRow = src; + for ( col = width / DST_TEXELS_PER_DWORD ; col ; col-- ) { + *dst++ = CONVERT_TEXEL_DWORD( src ); + src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD; + } + src = srcRow + srcRowStride; +#endif + } + + return GL_TRUE; +} + +/* PRE: as above, height == imageHeight also. + */ +static GLboolean +TAG(texsubimage3d_pack)( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *) + _mesa_image_address( convert->packing, convert->srcImage, + convert->width, convert->height, + convert->format, convert->type, 0, 0, 0 ); + const GLint srcRowStride = + _mesa_image_row_stride( convert->packing, convert->width, + convert->format, convert->type ); + GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + + ((convert->zoffset * convert->height + + convert->yoffset) * convert->width + + convert->xoffset) * DST_TEXEL_BYTES); + GLint width; + GLint row, col, img; + (void) col; + + if ( DBG ) + fprintf( stderr, __FUNCTION__ "\n" ); + + width = ((convert->width + DST_TEXELS_PER_DWORD - 1) + & ~(DST_TEXELS_PER_DWORD - 1)); + + for ( img = 0 ; img < convert->depth ; img++ ) { + for ( row = 0 ; row < convert->height ; row++ ) { +#ifdef CONVERT_DIRECT + MEMCPY( dst, src, DST_ROW_STRIDE ); + src += srcRowStride; + dst = (GLuint *)((GLubyte *)dst + DST_ROW_STRIDE); +#else + const GLubyte *srcRow = src; + for ( col = width / DST_TEXELS_PER_DWORD ; col ; col-- ) { + *dst++ = CONVERT_TEXEL_DWORD( src ); + src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD; + } + src = srcRow + srcRowStride; +#endif + } + } + + return GL_TRUE; +} + + + +/* ================================================================ + * PRE: Require pixelstore attribs, width != imageWidth. + */ +static GLboolean +TAG(texsubimage2d_stride_pack)( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *) + _mesa_image_address( convert->packing, convert->srcImage, + convert->width, convert->height, + convert->format, convert->type, 0, 0, 0 ); + const GLint srcRowStride = + _mesa_image_row_stride( convert->packing, convert->width, + convert->format, convert->type ); + DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + + (convert->yoffset * convert->imageWidth + + convert->xoffset) * DST_TEXEL_BYTES); + GLint adjust; + GLint row, col; + (void) col; + + adjust = convert->imageWidth - convert->width; + + if ( DBG ) { + fprintf( stderr, __FUNCTION__ ":\n" ); + fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + convert->xoffset, convert->yoffset, convert->width, + convert->height, convert->imageWidth ); + fprintf( stderr, " adjust=%d\n", adjust ); + } + + for ( row = 0 ; row < convert->height ; row++ ) { +#ifdef CONVERT_DIRECT + MEMCPY( dst, src, DST_ROW_WIDTH ); + src += srcRowStride; + dst += convert->imageWidth; +#else + const GLubyte *srcRow = src; + for ( col = 0 ; col < convert->width ; col++ ) { + *dst++ = CONVERT_TEXEL( src ); + src += SRC_TEXEL_BYTES; + } + src = srcRow + srcRowStride; + dst += adjust; +#endif + } + + return GL_TRUE; +} + +/* PRE: As above, or height != imageHeight also. + */ +static GLboolean +TAG(texsubimage3d_stride_pack)( struct gl_texture_convert *convert ) +{ + const GLubyte *src = (const GLubyte *) + _mesa_image_address( convert->packing, convert->srcImage, + convert->width, convert->height, + convert->format, convert->type, 0, 0, 0 ); + const GLint srcRowStride = + _mesa_image_row_stride( convert->packing, convert->width, + convert->format, convert->type ); + DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + + ((convert->zoffset * convert->imageHeight + + convert->yoffset) * convert->imageWidth + + convert->xoffset) * DST_TEXEL_BYTES); + GLint adjust; + GLint row, col, img; + (void) col; + + adjust = convert->imageWidth - convert->width; + + if ( DBG ) { + fprintf( stderr, __FUNCTION__ ":\n" ); + fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + convert->xoffset, convert->yoffset, convert->width, + convert->height, convert->imageWidth ); + fprintf( stderr, " adjust=%d\n", adjust ); + } + + for ( img = 0 ; img < convert->depth ; img++ ) { + for ( row = 0 ; row < convert->height ; row++ ) { +#ifdef CONVERT_DIRECT + MEMCPY( dst, src, DST_ROW_WIDTH ); + src += srcRowStride; + dst += convert->imageWidth; +#else + const GLubyte *srcRow = src; + for ( col = 0 ; col < convert->width ; col++ ) { + *dst++ = CONVERT_TEXEL( src ); + src += SRC_TEXEL_BYTES; + } + src = srcRow + srcRowStride; + dst += adjust; +#endif + } + /* FIXME: ... */ + } + + return GL_TRUE; +} + + + +static convert_func TAG(texsubimage2d_tab)[] = { + TAG(texsubimage2d), + TAG(texsubimage2d_stride), + TAG(texsubimage2d_pack), + TAG(texsubimage2d_stride_pack), +}; + +static convert_func TAG(texsubimage3d_tab)[] = { + TAG(texsubimage3d), + TAG(texsubimage3d_stride), + TAG(texsubimage3d_pack), + TAG(texsubimage3d_stride_pack), +}; + + +#ifndef PRESERVE_DST_TYPE +#undef DST_TYPE +#undef DST_TEXELS_PER_DWORD +#endif + +#undef SRC_TEXEL_BYTES +#undef DST_TEXEL_BYTES +#undef DST_ROW_WIDTH +#undef DST_ROW_STRIDE + +#undef CONVERT_TEXEL +#undef CONVERT_TEXEL_DWORD +#undef CONVERT_DIRECT + +#undef TAG + +#undef PRESERVE_DST_TYPE diff --git a/xc/extras/Mesa/src/tritemp.h b/xc/extras/Mesa/src/tritemp.h index d0135dc1d..9605d00f8 100644 --- a/xc/extras/Mesa/src/tritemp.h +++ b/xc/extras/Mesa/src/tritemp.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.3 + * Version: 3.4.1 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul 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"), @@ -97,6 +97,7 @@ GLfloat oneOverArea; int vMin, vMid, vMax; /* vertex indexes: Y(vMin)<=Y(vMid)<=Y(vMax) */ float bf = ctx->backface_sign; + GLboolean tiny; /* find the order of the 3 vertices along the Y axis */ { @@ -153,10 +154,14 @@ return; /* check for very tiny triangle */ - if (area * area < 0.0025F) /* square it to ensure positive value */ + if (area * area < 0.0025F) { /* square it to ensure positive value */ oneOverArea = 1.0F / 0.0025F; /* a close-enough value */ - else + tiny = GL_TRUE; + } + else { oneOverArea = 1.0F / area; + tiny = GL_FALSE; + } } #ifndef DO_OCCLUSION_TEST @@ -309,26 +314,37 @@ } #endif #ifdef INTERP_RGB - { + if (tiny) { + /* This is kind of a hack to eliminate RGB color over/underflow + * problems when rendering very tiny triangles. We're not doing + * anything with alpha or specular color at this time. + */ + drdx = drdy = 0.0; fdrdx = 0; + dgdx = dgdy = 0.0; fdgdx = 0; + dbdx = dbdy = 0.0; fdbdx = 0; + } + else { GLfloat eMaj_dr, eBot_dr; - eMaj_dr = (GLint) VB->ColorPtr->data[vMax][0] - (GLint) VB->ColorPtr->data[vMin][0]; - eBot_dr = (GLint) VB->ColorPtr->data[vMid][0] - (GLint) VB->ColorPtr->data[vMin][0]; + GLfloat eMaj_dg, eBot_dg; + GLfloat eMaj_db, eBot_db; + eMaj_dr = (GLint) VB->ColorPtr->data[vMax][0] + - (GLint) VB->ColorPtr->data[vMin][0]; + eBot_dr = (GLint) VB->ColorPtr->data[vMid][0] + - (GLint) VB->ColorPtr->data[vMin][0]; drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); fdrdx = SignedFloatToFixed(drdx); drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); - } - { - GLfloat eMaj_dg, eBot_dg; - eMaj_dg = (GLint) VB->ColorPtr->data[vMax][1] - (GLint) VB->ColorPtr->data[vMin][1]; - eBot_dg = (GLint) VB->ColorPtr->data[vMid][1] - (GLint) VB->ColorPtr->data[vMin][1]; + eMaj_dg = (GLint) VB->ColorPtr->data[vMax][1] + - (GLint) VB->ColorPtr->data[vMin][1]; + eBot_dg = (GLint) VB->ColorPtr->data[vMid][1] + - (GLint) VB->ColorPtr->data[vMin][1]; dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); fdgdx = SignedFloatToFixed(dgdx); dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); - } - { - GLfloat eMaj_db, eBot_db; - eMaj_db = (GLint) VB->ColorPtr->data[vMax][2] - (GLint) VB->ColorPtr->data[vMin][2]; - eBot_db = (GLint) VB->ColorPtr->data[vMid][2] - (GLint) VB->ColorPtr->data[vMin][2]; + eMaj_db = (GLint) VB->ColorPtr->data[vMax][2] + - (GLint) VB->ColorPtr->data[vMin][2]; + eBot_db = (GLint) VB->ColorPtr->data[vMid][2] + - (GLint) VB->ColorPtr->data[vMin][2]; dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); fdbdx = SignedFloatToFixed(dbdx); dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); diff --git a/xc/extras/Mesa/src/types.h b/xc/extras/Mesa/src/types.h index 804de925e..5c297eb2a 100644 --- a/xc/extras/Mesa/src/types.h +++ b/xc/extras/Mesa/src/types.h @@ -1,4 +1,4 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:8 -*- */ +/* -*- mode: C; tab-width:8; c-basic-offset:3 -*- */ /* * Mesa 3-D graphics library @@ -171,7 +171,21 @@ typedef void (*TextureSampleFunc)( const struct gl_texture_object *tObj, const GLfloat u[], const GLfloat lambda[], GLubyte rgba[][4] ); +/* Texture format record */ +/* GH: This is an interim structure until 3.5 */ +struct gl_texture_format { + GLint IntFormat; /* One of the MESA_FORMAT_* values */ + GLubyte RedBits; /* Bits per texel component */ + GLubyte GreenBits; + GLubyte BlueBits; + GLubyte AlphaBits; + GLubyte LuminanceBits; + GLubyte IntensityBits; + GLubyte IndexBits; + + GLint TexelBytes; +}; /* Texture image record */ struct gl_texture_image { @@ -180,13 +194,6 @@ struct gl_texture_image { * GL_COLOR_INDEX only */ GLenum IntFormat; /* Internal format as given by the user */ - GLubyte RedBits; /* Bits per texel component */ - GLubyte GreenBits; /* These are initialized by Mesa but */ - GLubyte BlueBits; /* may be reassigned by the device */ - GLubyte AlphaBits; /* driver to indicate the true texture */ - GLubyte IntensityBits; /* color resolution. */ - GLubyte LuminanceBits; - GLubyte IndexBits; GLuint Border; /* 0 or 1 */ GLuint Width; /* = 2^WidthLog2 + 2*Border */ GLuint Height; /* = 2^HeightLog2 + 2*Border */ @@ -200,6 +207,8 @@ struct gl_texture_image { GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */ GLubyte *Data; /* Image data as unsigned bytes */ + const struct gl_texture_format *TexFormat; + GLboolean IsCompressed; /* GL_ARB_texture_compression */ GLuint CompressedSize; /* GL_ARB_texture_compression */ diff --git a/xc/extras/Mesa/src/vbxform.c b/xc/extras/Mesa/src/vbxform.c index dc3e3e709..f89207acd 100644 --- a/xc/extras/Mesa/src/vbxform.c +++ b/xc/extras/Mesa/src/vbxform.c @@ -762,7 +762,7 @@ static void fixup_primitives( struct vertex_buffer *VB, struct immediate *IM ) if (err) { /* Occurred somewhere inside the vb. Don't know/care where/why. */ - gl_error( ctx, GL_INVALID_OPERATION, "begin/end"); + gl_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd"); } interesting = transition | VERT_END_VB; diff --git a/xc/extras/Mesa/src/xform_tmp.h b/xc/extras/Mesa/src/xform_tmp.h index aacbee841..258dca1f3 100644 --- a/xc/extras/Mesa/src/xform_tmp.h +++ b/xc/extras/Mesa/src/xform_tmp.h @@ -1,4 +1,4 @@ - +/* $XFree86: xc/extras/Mesa/src/xform_tmp.h,v 1.7 2001/04/01 13:59:57 tsi Exp $ */ /* * Mesa 3-D graphics library * Version: 3.1 @@ -970,4 +970,8 @@ static void _XFORMAPI TAG(init_c_transformations)( void ) TAG_TAB_4[MATRIX_3D] = TAG(transform_points4_3d); #undef TAG_TAB +#undef TAG_TAB_1 +#undef TAG_TAB_2 +#undef TAG_TAB_3 +#undef TAG_TAB_4 } diff --git a/xc/extras/X-TrueType/BIG5HKSCS/BIG5HKSCStoUCS2.c b/xc/extras/X-TrueType/BIG5HKSCS/BIG5HKSCStoUCS2.c new file mode 100644 index 000000000..78ab13600 --- /dev/null +++ b/xc/extras/X-TrueType/BIG5HKSCS/BIG5HKSCStoUCS2.c @@ -0,0 +1,3236 @@ +/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */ +/* ===FileName: === + Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved. + Copyright (c) 1998 Go Watanabe, All rights reserved. + Copyright (c) 1998 X-TrueType Server Project, All rights reserved. + Copyright (c) 2001 Roger So, All rights reserved. + +===Notice + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + Major Release ID: X-TrueType Server Version 1.3 [Aoi MATSUBARA Release 3] + +Notice=== + + This table data derived from Unicode, Inc. + (ftp://ftp.unicode.org/Public/MAPPINGS/EASTASIA/OTHER/BIG5.TXT) + + Hong Kong Supplementary Character Set (HKSCS) mappings derived from data + available from the Government of Hong Kong Special Administrative Region. + (http://www.info.gov.hk/digital21/chi/hkscs/download/isov2cmp.txt) + */ + +/* $XFree86: xc/extras/X-TrueType/BIG5HKSCS/BIG5HKSCStoUCS2.c,v 1.1 2001/03/06 18:54:40 dawes Exp $ */ + +#include "xttversion.h" + +static char const * const releaseID = + _XTT_RELEASE_NAME; + +#include "xttcommon.h" +#include "xttcap.h" +#include "xttcconv.h" +#include "xttcconvP.h" + +#define ALTCHR 0x3000 + +static ucs2_t tblBig5HKSCSToUcs2[] = { +/* HKSCS defines characters in 0x8140 - 0xA0FE and 0xC6A1 - 0xC8FE. + * + * These are generated from the ISO 10646 v2 conversion tables + * available on the HKSAR Govt's website: + * + * http://www.info.gov.hk/digital21/eng/hkscs/download/ + * + * - Roger So <roger.so@sw-linux.com>, 1 Mar 2001 + */ +/* 0x8140 - 0x81FF */ + 0xEEB8, 0xEEB9, 0xEEBA, 0xEEBB, 0xEEBC, 0xEEBD, 0xEEBE, 0xEEBF, + 0xEEC0, 0xEEC1, 0xEEC2, 0xEEC3, 0xEEC4, 0xEEC5, 0xEEC6, 0xEEC7, + 0xEEC8, 0xEEC9, 0xEECA, 0xEECB, 0xEECC, 0xEECD, 0xEECE, 0xEECF, + 0xEED0, 0xEED1, 0xEED2, 0xEED3, 0xEED4, 0xEED5, 0xEED6, 0xEED7, + 0xEED8, 0xEED9, 0xEEDA, 0xEEDB, 0xEEDC, 0xEEDD, 0xEEDE, 0xEEDF, + 0xEEE0, 0xEEE1, 0xEEE2, 0xEEE3, 0xEEE4, 0xEEE5, 0xEEE6, 0xEEE7, + 0xEEE8, 0xEEE9, 0xEEEA, 0xEEEB, 0xEEEC, 0xEEED, 0xEEEE, 0xEEEF, + 0xEEF0, 0xEEF1, 0xEEF2, 0xEEF3, 0xEEF4, 0xEEF5, 0xEEF6, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xEEF7, 0xEEF8, 0xEEF9, 0xEEFA, 0xEEFB, 0xEEFC, 0xEEFD, + 0xEEFE, 0xEEFF, 0xEF00, 0xEF01, 0xEF02, 0xEF03, 0xEF04, 0xEF05, + 0xEF06, 0xEF07, 0xEF08, 0xEF09, 0xEF0A, 0xEF0B, 0xEF0C, 0xEF0D, + 0xEF0E, 0xEF0F, 0xEF10, 0xEF11, 0xEF12, 0xEF13, 0xEF14, 0xEF15, + 0xEF16, 0xEF17, 0xEF18, 0xEF19, 0xEF1A, 0xEF1B, 0xEF1C, 0xEF1D, + 0xEF1E, 0xEF1F, 0xEF20, 0xEF21, 0xEF22, 0xEF23, 0xEF24, 0xEF25, + 0xEF26, 0xEF27, 0xEF28, 0xEF29, 0xEF2A, 0xEF2B, 0xEF2C, 0xEF2D, + 0xEF2E, 0xEF2F, 0xEF30, 0xEF31, 0xEF32, 0xEF33, 0xEF34, 0xEF35, + 0xEF36, 0xEF37, 0xEF38, 0xEF39, 0xEF3A, 0xEF3B, 0xEF3C, 0xEF3D, + 0xEF3E, 0xEF3F, 0xEF40, 0xEF41, 0xEF42, 0xEF43, 0xEF44, 0xEF45, + 0xEF46, 0xEF47, 0xEF48, 0xEF49, 0xEF4A, 0xEF4B, 0xEF4C, 0xEF4D, + 0xEF4E, 0xEF4F, 0xEF50, 0xEF51, 0xEF52, 0xEF53, 0xEF54, ALTCHR, +/* 0x8240 - 0x82FF */ + 0xEF55, 0xEF56, 0xEF57, 0xEF58, 0xEF59, 0xEF5A, 0xEF5B, 0xEF5C, + 0xEF5D, 0xEF5E, 0xEF5F, 0xEF60, 0xEF61, 0xEF62, 0xEF63, 0xEF64, + 0xEF65, 0xEF66, 0xEF67, 0xEF68, 0xEF69, 0xEF6A, 0xEF6B, 0xEF6C, + 0xEF6D, 0xEF6E, 0xEF6F, 0xEF70, 0xEF71, 0xEF72, 0xEF73, 0xEF74, + 0xEF75, 0xEF76, 0xEF77, 0xEF78, 0xEF79, 0xEF7A, 0xEF7B, 0xEF7C, + 0xEF7D, 0xEF7E, 0xEF7F, 0xEF80, 0xEF81, 0xEF82, 0xEF83, 0xEF84, + 0xEF85, 0xEF86, 0xEF87, 0xEF88, 0xEF89, 0xEF8A, 0xEF8B, 0xEF8C, + 0xEF8D, 0xEF8E, 0xEF8F, 0xEF90, 0xEF91, 0xEF92, 0xEF93, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xEF94, 0xEF95, 0xEF96, 0xEF97, 0xEF98, 0xEF99, 0xEF9A, + 0xEF9B, 0xEF9C, 0xEF9D, 0xEF9E, 0xEF9F, 0xEFA0, 0xEFA1, 0xEFA2, + 0xEFA3, 0xEFA4, 0xEFA5, 0xEFA6, 0xEFA7, 0xEFA8, 0xEFA9, 0xEFAA, + 0xEFAB, 0xEFAC, 0xEFAD, 0xEFAE, 0xEFAF, 0xEFB0, 0xEFB1, 0xEFB2, + 0xEFB3, 0xEFB4, 0xEFB5, 0xEFB6, 0xEFB7, 0xEFB8, 0xEFB9, 0xEFBA, + 0xEFBB, 0xEFBC, 0xEFBD, 0xEFBE, 0xEFBF, 0xEFC0, 0xEFC1, 0xEFC2, + 0xEFC3, 0xEFC4, 0xEFC5, 0xEFC6, 0xEFC7, 0xEFC8, 0xEFC9, 0xEFCA, + 0xEFCB, 0xEFCC, 0xEFCD, 0xEFCE, 0xEFCF, 0xEFD0, 0xEFD1, 0xEFD2, + 0xEFD3, 0xEFD4, 0xEFD5, 0xEFD6, 0xEFD7, 0xEFD8, 0xEFD9, 0xEFDA, + 0xEFDB, 0xEFDC, 0xEFDD, 0xEFDE, 0xEFDF, 0xEFE0, 0xEFE1, 0xEFE2, + 0xEFE3, 0xEFE4, 0xEFE5, 0xEFE6, 0xEFE7, 0xEFE8, 0xEFE9, 0xEFEA, + 0xEFEB, 0xEFEC, 0xEFED, 0xEFEE, 0xEFEF, 0xEFF0, 0xEFF1, ALTCHR, +/* 0x8340 - 0x83FF */ + 0xEFF2, 0xEFF3, 0xEFF4, 0xEFF5, 0xEFF6, 0xEFF7, 0xEFF8, 0xEFF9, + 0xEFFA, 0xEFFB, 0xEFFC, 0xEFFD, 0xEFFE, 0xEFFF, 0xF000, 0xF001, + 0xF002, 0xF003, 0xF004, 0xF005, 0xF006, 0xF007, 0xF008, 0xF009, + 0xF00A, 0xF00B, 0xF00C, 0xF00D, 0xF00E, 0xF00F, 0xF010, 0xF011, + 0xF012, 0xF013, 0xF014, 0xF015, 0xF016, 0xF017, 0xF018, 0xF019, + 0xF01A, 0xF01B, 0xF01C, 0xF01D, 0xF01E, 0xF01F, 0xF020, 0xF021, + 0xF022, 0xF023, 0xF024, 0xF025, 0xF026, 0xF027, 0xF028, 0xF029, + 0xF02A, 0xF02B, 0xF02C, 0xF02D, 0xF02E, 0xF02F, 0xF030, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF031, 0xF032, 0xF033, 0xF034, 0xF035, 0xF036, 0xF037, + 0xF038, 0xF039, 0xF03A, 0xF03B, 0xF03C, 0xF03D, 0xF03E, 0xF03F, + 0xF040, 0xF041, 0xF042, 0xF043, 0xF044, 0xF045, 0xF046, 0xF047, + 0xF048, 0xF049, 0xF04A, 0xF04B, 0xF04C, 0xF04D, 0xF04E, 0xF04F, + 0xF050, 0xF051, 0xF052, 0xF053, 0xF054, 0xF055, 0xF056, 0xF057, + 0xF058, 0xF059, 0xF05A, 0xF05B, 0xF05C, 0xF05D, 0xF05E, 0xF05F, + 0xF060, 0xF061, 0xF062, 0xF063, 0xF064, 0xF065, 0xF066, 0xF067, + 0xF068, 0xF069, 0xF06A, 0xF06B, 0xF06C, 0xF06D, 0xF06E, 0xF06F, + 0xF070, 0xF071, 0xF072, 0xF073, 0xF074, 0xF075, 0xF076, 0xF077, + 0xF078, 0xF079, 0xF07A, 0xF07B, 0xF07C, 0xF07D, 0xF07E, 0xF07F, + 0xF080, 0xF081, 0xF082, 0xF083, 0xF084, 0xF085, 0xF086, 0xF087, + 0xF088, 0xF089, 0xF08A, 0xF08B, 0xF08C, 0xF08D, 0xF08E, ALTCHR, +/* 0x8440 - 0x84FF */ + 0xF08F, 0xF090, 0xF091, 0xF092, 0xF093, 0xF094, 0xF095, 0xF096, + 0xF097, 0xF098, 0xF099, 0xF09A, 0xF09B, 0xF09C, 0xF09D, 0xF09E, + 0xF09F, 0xF0A0, 0xF0A1, 0xF0A2, 0xF0A3, 0xF0A4, 0xF0A5, 0xF0A6, + 0xF0A7, 0xF0A8, 0xF0A9, 0xF0AA, 0xF0AB, 0xF0AC, 0xF0AD, 0xF0AE, + 0xF0AF, 0xF0B0, 0xF0B1, 0xF0B2, 0xF0B3, 0xF0B4, 0xF0B5, 0xF0B6, + 0xF0B7, 0xF0B8, 0xF0B9, 0xF0BA, 0xF0BB, 0xF0BC, 0xF0BD, 0xF0BE, + 0xF0BF, 0xF0C0, 0xF0C1, 0xF0C2, 0xF0C3, 0xF0C4, 0xF0C5, 0xF0C6, + 0xF0C7, 0xF0C8, 0xF0C9, 0xF0CA, 0xF0CB, 0xF0CC, 0xF0CD, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF0CE, 0xF0CF, 0xF0D0, 0xF0D1, 0xF0D2, 0xF0D3, 0xF0D4, + 0xF0D5, 0xF0D6, 0xF0D7, 0xF0D8, 0xF0D9, 0xF0DA, 0xF0DB, 0xF0DC, + 0xF0DD, 0xF0DE, 0xF0DF, 0xF0E0, 0xF0E1, 0xF0E2, 0xF0E3, 0xF0E4, + 0xF0E5, 0xF0E6, 0xF0E7, 0xF0E8, 0xF0E9, 0xF0EA, 0xF0EB, 0xF0EC, + 0xF0ED, 0xF0EE, 0xF0EF, 0xF0F0, 0xF0F1, 0xF0F2, 0xF0F3, 0xF0F4, + 0xF0F5, 0xF0F6, 0xF0F7, 0xF0F8, 0xF0F9, 0xF0FA, 0xF0FB, 0xF0FC, + 0xF0FD, 0xF0FE, 0xF0FF, 0xF100, 0xF101, 0xF102, 0xF103, 0xF104, + 0xF105, 0xF106, 0xF107, 0xF108, 0xF109, 0xF10A, 0xF10B, 0xF10C, + 0xF10D, 0xF10E, 0xF10F, 0xF110, 0xF111, 0xF112, 0xF113, 0xF114, + 0xF115, 0xF116, 0xF117, 0xF118, 0xF119, 0xF11A, 0xF11B, 0xF11C, + 0xF11D, 0xF11E, 0xF11F, 0xF120, 0xF121, 0xF122, 0xF123, 0xF124, + 0xF125, 0xF126, 0xF127, 0xF128, 0xF129, 0xF12A, 0xF12B, ALTCHR, +/* 0x8540 - 0x85FF */ + 0xF12C, 0xF12D, 0xF12E, 0xF12F, 0xF130, 0xF131, 0xF132, 0xF133, + 0xF134, 0xF135, 0xF136, 0xF137, 0xF138, 0xF139, 0xF13A, 0xF13B, + 0xF13C, 0xF13D, 0xF13E, 0xF13F, 0xF140, 0xF141, 0xF142, 0xF143, + 0xF144, 0xF145, 0xF146, 0xF147, 0xF148, 0xF149, 0xF14A, 0xF14B, + 0xF14C, 0xF14D, 0xF14E, 0xF14F, 0xF150, 0xF151, 0xF152, 0xF153, + 0xF154, 0xF155, 0xF156, 0xF157, 0xF158, 0xF159, 0xF15A, 0xF15B, + 0xF15C, 0xF15D, 0xF15E, 0xF15F, 0xF160, 0xF161, 0xF162, 0xF163, + 0xF164, 0xF165, 0xF166, 0xF167, 0xF168, 0xF169, 0xF16A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF16B, 0xF16C, 0xF16D, 0xF16E, 0xF16F, 0xF170, 0xF171, + 0xF172, 0xF173, 0xF174, 0xF175, 0xF176, 0xF177, 0xF178, 0xF179, + 0xF17A, 0xF17B, 0xF17C, 0xF17D, 0xF17E, 0xF17F, 0xF180, 0xF181, + 0xF182, 0xF183, 0xF184, 0xF185, 0xF186, 0xF187, 0xF188, 0xF189, + 0xF18A, 0xF18B, 0xF18C, 0xF18D, 0xF18E, 0xF18F, 0xF190, 0xF191, + 0xF192, 0xF193, 0xF194, 0xF195, 0xF196, 0xF197, 0xF198, 0xF199, + 0xF19A, 0xF19B, 0xF19C, 0xF19D, 0xF19E, 0xF19F, 0xF1A0, 0xF1A1, + 0xF1A2, 0xF1A3, 0xF1A4, 0xF1A5, 0xF1A6, 0xF1A7, 0xF1A8, 0xF1A9, + 0xF1AA, 0xF1AB, 0xF1AC, 0xF1AD, 0xF1AE, 0xF1AF, 0xF1B0, 0xF1B1, + 0xF1B2, 0xF1B3, 0xF1B4, 0xF1B5, 0xF1B6, 0xF1B7, 0xF1B8, 0xF1B9, + 0xF1BA, 0xF1BB, 0xF1BC, 0xF1BD, 0xF1BE, 0xF1BF, 0xF1C0, 0xF1C1, + 0xF1C2, 0xF1C3, 0xF1C4, 0xF1C5, 0xF1C6, 0xF1C7, 0xF1C8, ALTCHR, +/* 0x8640 - 0x86FF */ + 0xF1C9, 0xF1CA, 0xF1CB, 0xF1CC, 0xF1CD, 0xF1CE, 0xF1CF, 0xF1D0, + 0xF1D1, 0xF1D2, 0xF1D3, 0xF1D4, 0xF1D5, 0xF1D6, 0xF1D7, 0xF1D8, + 0xF1D9, 0xF1DA, 0xF1DB, 0xF1DC, 0xF1DD, 0xF1DE, 0xF1DF, 0xF1E0, + 0xF1E1, 0xF1E2, 0xF1E3, 0xF1E4, 0xF1E5, 0xF1E6, 0xF1E7, 0xF1E8, + 0xF1E9, 0xF1EA, 0xF1EB, 0xF1EC, 0xF1ED, 0xF1EE, 0xF1EF, 0xF1F0, + 0xF1F1, 0xF1F2, 0xF1F3, 0xF1F4, 0xF1F5, 0xF1F6, 0xF1F7, 0xF1F8, + 0xF1F9, 0xF1FA, 0xF1FB, 0xF1FC, 0xF1FD, 0xF1FE, 0xF1FF, 0xF200, + 0xF201, 0xF202, 0xF203, 0xF204, 0xF205, 0xF206, 0xF207, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF208, 0xF209, 0xF20A, 0xF20B, 0xF20C, 0xF20D, 0xF20E, + 0xF20F, 0xF210, 0xF211, 0xF212, 0xF213, 0xF214, 0xF215, 0xF216, + 0xF217, 0xF218, 0xF219, 0xF21A, 0xF21B, 0xF21C, 0xF21D, 0xF21E, + 0xF21F, 0xF220, 0xF221, 0xF222, 0xF223, 0xF224, 0xF225, 0xF226, + 0xF227, 0xF228, 0xF229, 0xF22A, 0xF22B, 0xF22C, 0xF22D, 0xF22E, + 0xF22F, 0xF230, 0xF231, 0xF232, 0xF233, 0xF234, 0xF235, 0xF236, + 0xF237, 0xF238, 0xF239, 0xF23A, 0xF23B, 0xF23C, 0xF23D, 0xF23E, + 0xF23F, 0xF240, 0xF241, 0xF242, 0xF243, 0xF244, 0xF245, 0xF246, + 0xF247, 0xF248, 0xF249, 0xF24A, 0xF24B, 0xF24C, 0xF24D, 0xF24E, + 0xF24F, 0xF250, 0xF251, 0xF252, 0xF253, 0xF254, 0xF255, 0xF256, + 0xF257, 0xF258, 0xF259, 0xF25A, 0xF25B, 0xF25C, 0xF25D, 0xF25E, + 0xF25F, 0xF260, 0xF261, 0xF262, 0xF263, 0xF264, 0xF265, ALTCHR, +/* 0x8740 - 0x87FF */ + 0xF266, 0xF267, 0xF268, 0xF269, 0xF26A, 0xF26B, 0xF26C, 0xF26D, + 0xF26E, 0xF26F, 0xF270, 0xF271, 0xF272, 0xF273, 0xF274, 0xF275, + 0xF276, 0xF277, 0xF278, 0xF279, 0xF27A, 0xF27B, 0xF27C, 0xF27D, + 0xF27E, 0xF27F, 0xF280, 0xF281, 0xF282, 0xF283, 0xF284, 0xF285, + 0xF286, 0xF287, 0xF288, 0xF289, 0xF28A, 0xF28B, 0xF28C, 0xF28D, + 0xF28E, 0xF28F, 0xF290, 0xF291, 0xF292, 0xF293, 0xF294, 0xF295, + 0xF296, 0xF297, 0xF298, 0xF299, 0xF29A, 0xF29B, 0xF29C, 0xF29D, + 0xF29E, 0xF29F, 0xF2A0, 0xF2A1, 0xF2A2, 0xF2A3, 0xF2A4, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF2A5, 0xF2A6, 0xF2A7, 0xF2A8, 0xF2A9, 0xF2AA, 0xF2AB, + 0xF2AC, 0xF2AD, 0xF2AE, 0xF2AF, 0xF2B0, 0xF2B1, 0xF2B2, 0xF2B3, + 0xF2B4, 0xF2B5, 0xF2B6, 0xF2B7, 0xF2B8, 0xF2B9, 0xF2BA, 0xF2BB, + 0xF2BC, 0xF2BD, 0xF2BE, 0xF2BF, 0xF2C0, 0xF2C1, 0xF2C2, 0xF2C3, + 0xF2C4, 0xF2C5, 0xF2C6, 0xF2C7, 0xF2C8, 0xF2C9, 0xF2CA, 0xF2CB, + 0xF2CC, 0xF2CD, 0xF2CE, 0xF2CF, 0xF2D0, 0xF2D1, 0xF2D2, 0xF2D3, + 0xF2D4, 0xF2D5, 0xF2D6, 0xF2D7, 0xF2D8, 0xF2D9, 0xF2DA, 0xF2DB, + 0xF2DC, 0xF2DD, 0xF2DE, 0xF2DF, 0xF2E0, 0xF2E1, 0xF2E2, 0xF2E3, + 0xF2E4, 0xF2E5, 0xF2E6, 0xF2E7, 0xF2E8, 0xF2E9, 0xF2EA, 0xF2EB, + 0xF2EC, 0xF2ED, 0xF2EE, 0xF2EF, 0xF2F0, 0xF2F1, 0xF2F2, 0xF2F3, + 0xF2F4, 0xF2F5, 0xF2F6, 0xF2F7, 0xF2F8, 0xF2F9, 0xF2FA, 0xF2FB, + 0xF2FC, 0xF2FD, 0xF2FE, 0xF2FF, 0xF300, 0xF301, 0xF302, ALTCHR, +/* 0x8840 - 0x88FF */ + 0xF303, 0xF304, 0xF305, 0xF306, 0xF307, 0xF308, 0xF309, 0xF30A, + 0xF30B, 0xF30C, 0xF30D, 0xF30E, 0xF30F, 0xF310, 0xF311, 0xF312, + 0xF313, 0xF314, 0xF315, 0xF316, 0xF317, 0xF318, 0x0100, 0x00C1, + 0x01CD, 0x00C0, 0x0112, 0x00C9, 0x011A, 0x00C8, 0x014C, 0x00D3, + 0x01D1, 0x00D2, 0xF325, 0x1EBE, 0xF327, 0x1EC0, 0x00CA, 0x0101, + 0x00E1, 0x01CE, 0x00E0, 0x0251, 0x0113, 0x00E9, 0x011B, 0x00E8, + 0x012B, 0x00ED, 0x01D0, 0x00EC, 0x014D, 0x00F3, 0x01D2, 0x00F2, + 0x016B, 0x00FA, 0x01D4, 0x00F9, 0x01D6, 0x01D8, 0x01DA, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x01DC, 0x00FC, 0xF344, 0x1EBF, 0xF346, 0x1EC1, 0x00EA, + 0x0261, 0xF34A, 0xF34B, 0xF34C, 0xF34D, 0xF34E, 0xF34F, 0xF350, + 0xF351, 0xF352, 0xF353, 0xF354, 0xF355, 0xF356, 0xF357, 0xF358, + 0xF359, 0xF35A, 0xF35B, 0xF35C, 0xF35D, 0xF35E, 0xF35F, 0xF360, + 0xF361, 0xF362, 0xF363, 0xF364, 0xF365, 0xF366, 0xF367, 0xF368, + 0xF369, 0xF36A, 0xF36B, 0xF36C, 0xF36D, 0xF36E, 0xF36F, 0xF370, + 0xF371, 0xF372, 0xF373, 0xF374, 0xF375, 0xF376, 0xF377, 0xF378, + 0xF379, 0xF37A, 0xF37B, 0xF37C, 0xF37D, 0xF37E, 0xF37F, 0xF380, + 0xF381, 0xF382, 0xF383, 0xF384, 0xF385, 0xF386, 0xF387, 0xF388, + 0xF389, 0xF38A, 0xF38B, 0xF38C, 0xF38D, 0xF38E, 0xF38F, 0xF390, + 0xF391, 0xF392, 0xF393, 0xF394, 0xF395, 0xF396, 0xF397, 0xF398, + 0xF399, 0xF39A, 0xF39B, 0xF39C, 0xF39D, 0xF39E, 0xF39F, ALTCHR, +/* 0x8940 - 0x89FF */ + 0xF3A0, 0xF3A1, 0xF3A2, 0x650A, 0xF3A4, 0xF3A5, 0x4E3D, 0x6EDD, + 0x9D4E, 0x91DF, 0xF3AA, 0xF3AB, 0xF3AC, 0x6491, 0x4F1A, 0x4F28, + 0x4FA8, 0x5156, 0x5174, 0x519C, 0x51E4, 0x52A1, 0x52A8, 0x533B, + 0x534E, 0x53D1, 0x53D8, 0x56E2, 0x58F0, 0x5904, 0x5907, 0x5932, + 0x5934, 0x5B66, 0x5B9E, 0x5B9F, 0x5C9A, 0x5E86, 0x603B, 0x6589, + 0x67FE, 0x6804, 0x6865, 0x6D4E, 0x70BC, 0x7535, 0x7EA4, 0x7EAC, + 0x7EBA, 0x7EC7, 0x7ECF, 0x7EDF, 0x7F06, 0x7F37, 0x827A, 0x82CF, + 0x836F, 0x89C6, 0x8BBE, 0x8BE2, 0x8F66, 0x8F67, 0x8F6E, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7411, 0x7CFC, 0x7DCD, 0x6946, 0x7AC9, 0x5227, 0xF3E5, + 0xF3E6, 0xF3E7, 0xF3E8, 0x918C, 0x78B8, 0x915E, 0x80BC, 0xF3ED, + 0x8D0B, 0x80F6, 0xF3F0, 0xF3F1, 0xF3F2, 0x809F, 0x9EC7, 0x4CCD, + 0x9DC9, 0x9E0C, 0x4C3E, 0xF3F9, 0xF3FA, 0x9E0A, 0xF3FC, 0x35C1, + 0xF3FE, 0x6E9A, 0x823E, 0x7519, 0xF402, 0x4911, 0x9A6C, 0x9A8F, + 0x9F99, 0x7987, 0xF408, 0xF409, 0xF40A, 0xF40B, 0x4E24, 0x4E81, + 0x4E80, 0x4E87, 0x4EBF, 0x4EEB, 0x4F37, 0x344C, 0x4FBD, 0x3E48, + 0x5003, 0x5088, 0x347D, 0x3493, 0x34A5, 0x5186, 0x5905, 0x51DB, + 0x51FC, 0x5205, 0x4E89, 0x5279, 0x5290, 0x5327, 0x35C7, 0x53A9, + 0x3551, 0x53B0, 0x3553, 0x53C2, 0x5423, 0x356D, 0x3572, 0x3681, + 0x5493, 0x54A3, 0x54B4, 0x54B9, 0x54D0, 0x54EF, 0x5518, 0x5523, + 0x5528, 0x3598, 0x553F, 0x35A5, 0x35BF, 0x55D7, 0x35C5, ALTCHR, +/* 0x8A40 - 0x8AFF */ + 0xF43D, 0x5525, 0xF43F, 0xF440, 0xF441, 0xF442, 0x5590, 0xF444, + 0x39EC, 0xF446, 0x8E46, 0xF448, 0xF449, 0x4053, 0xF44B, 0x777A, + 0xF44D, 0x3A34, 0x47D5, 0xF450, 0xF451, 0xF452, 0x64DD, 0xF454, + 0xF455, 0xF456, 0xF457, 0x648D, 0x8E7E, 0xF45A, 0xF45B, 0xF45C, + 0xF45D, 0xF45E, 0xF45F, 0xF460, 0xF461, 0xF462, 0xF463, 0x47F4, + 0xF465, 0xF466, 0x9AB2, 0x3A67, 0xF469, 0x3FED, 0x3506, 0xF46C, + 0xF46D, 0xF46E, 0xF46F, 0x9D6E, 0x9815, 0xF472, 0x43D9, 0xF474, + 0x64B4, 0x54E3, 0xF477, 0xF478, 0xF479, 0x39FB, 0xF47B, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF47C, 0xF47D, 0xF47E, 0x64EA, 0xF480, 0xF481, 0x8E68, + 0xF483, 0xF484, 0xF485, 0xF486, 0x480B, 0xF488, 0x3FFA, 0x5873, + 0xF48B, 0xF48C, 0xF48D, 0xF48E, 0xF48F, 0xF490, 0xF491, 0x5579, + 0x40BB, 0x43BA, 0xF495, 0x4AB4, 0xF497, 0xF498, 0x81AA, 0x98F5, + 0xF49B, 0x6379, 0x39FE, 0xF49E, 0x8DC0, 0x56A1, 0x647C, 0x3E43, + 0xF4A3, 0xF4A4, 0xF4A5, 0xF4A6, 0xF4A7, 0xF4A8, 0xF4A9, 0xF4AA, + 0x3992, 0x3A06, 0xF4AD, 0x3578, 0xF4AF, 0xF4B0, 0x5652, 0xF4B2, + 0xF4B3, 0xF4B4, 0x34BC, 0x6C3D, 0xF4B7, 0xF4B8, 0xF4B9, 0xF4BA, + 0xF4BB, 0xF4BC, 0xF4BD, 0xF4BE, 0xF4BF, 0xF4C0, 0xF4C1, 0x7F93, + 0xF4C3, 0xF4C4, 0xF4C5, 0x35FB, 0xF4C7, 0xF4C8, 0xF4C9, 0xF4CA, + 0x3F93, 0xF4CC, 0xF4CD, 0xF4CE, 0xF4CF, 0xF4D0, 0xF4D1, 0xF4D2, + 0xF4D3, 0xF4D4, 0xF4D5, 0x3FF9, 0xF4D7, 0x6432, 0xF4D9, ALTCHR, +/* 0x8B40 - 0x8BFF */ + 0xF4DA, 0xF4DB, 0xF4DC, 0xF4DD, 0xF4DE, 0xF4DF, 0xF4E0, 0x3A18, + 0xF4E2, 0xF4E3, 0xF4E4, 0xF4E5, 0xF4E6, 0xF4E7, 0xF4E8, 0xF4E9, + 0x95AA, 0x54CC, 0x82C4, 0x55B9, 0xF4EE, 0xF4EF, 0x9C26, 0x9AB6, + 0xF4F2, 0xF4F3, 0x7140, 0x816D, 0x80EC, 0x5C1C, 0xF4F8, 0x8134, + 0x3797, 0x535F, 0xF4FC, 0x91B6, 0xF4FE, 0xF4FF, 0xF500, 0xF501, + 0x35DD, 0xF503, 0x3609, 0xF505, 0x56AF, 0xF507, 0xF508, 0xF509, + 0xF50A, 0xF50B, 0xF50C, 0xF50D, 0xF50E, 0xF50F, 0xF510, 0xF511, + 0x5A54, 0xF513, 0xF514, 0xF515, 0xF516, 0x579C, 0xF518, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF519, 0xF51A, 0xF51B, 0xF51C, 0xF51D, 0x3703, 0xF51F, + 0xF520, 0xF521, 0xF522, 0xF523, 0xF524, 0xF525, 0xF526, 0x5899, + 0x5268, 0x361A, 0xF52A, 0x7BB2, 0x5B68, 0x4800, 0x4B2C, 0x9F27, + 0x49E7, 0x9C1F, 0x9B8D, 0xF533, 0xF534, 0x55FB, 0x35F2, 0x5689, + 0x4E28, 0x5902, 0xF53A, 0xF53B, 0x9751, 0xF53D, 0x4E5B, 0x4EBB, + 0x353E, 0x5C23, 0x5F51, 0x5FC4, 0x38FA, 0x624C, 0x6535, 0x6B7A, + 0x6C35, 0x6C3A, 0x706C, 0x722B, 0x4E2C, 0x72AD, 0xF54E, 0x7F52, + 0x793B, 0x7CF9, 0x7F53, 0xF553, 0x34C1, 0xF555, 0xF556, 0x8002, + 0x8080, 0xF559, 0xF55A, 0x535D, 0x8864, 0x89C1, 0xF55E, 0x8BA0, + 0x8D1D, 0x9485, 0x9578, 0x957F, 0x95E8, 0xF565, 0x97E6, 0x9875, + 0x98CE, 0x98DE, 0x9963, 0xF56B, 0x9C7C, 0x9E1F, 0x9EC4, 0x6B6F, + 0x9F9C, 0x4E37, 0xF572, 0x961D, 0x6237, 0x94A2, 0xF576, ALTCHR, +/* 0x8C40 - 0x8CFF */ + 0xF577, 0xF578, 0xF579, 0xF57A, 0xF57B, 0xF57C, 0xF57D, 0xF57E, + 0xF57F, 0xF580, 0xF581, 0xF582, 0xF583, 0xF584, 0xF585, 0xF586, + 0xF587, 0xF588, 0xF589, 0xF58A, 0xF58B, 0xF58C, 0xF58D, 0xF58E, + 0xF58F, 0xF590, 0xF591, 0xF592, 0xF593, 0xF594, 0xF595, 0xF596, + 0xF597, 0xF598, 0xF599, 0xF59A, 0xF59B, 0xF59C, 0xF59D, 0xF59E, + 0xF59F, 0xF5A0, 0xF5A1, 0xF5A2, 0xF5A3, 0xF5A4, 0xF5A5, 0xF5A6, + 0xF5A7, 0xF5A8, 0xF5A9, 0xF5AA, 0xF5AB, 0xF5AC, 0xF5AD, 0xF5AE, + 0xF5AF, 0xF5B0, 0xF5B1, 0xF5B2, 0xF5B3, 0xF5B4, 0xF5B5, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF5B6, 0xF5B7, 0xF5B8, 0xF5B9, 0xF5BA, 0xF5BB, 0xF5BC, + 0xF5BD, 0xF5BE, 0xF5BF, 0xF5C0, 0xF5C1, 0xF5C2, 0xF5C3, 0xF5C4, + 0xF5C5, 0xF5C6, 0xF5C7, 0xF5C8, 0xF5C9, 0xF5CA, 0xF5CB, 0xF5CC, + 0xF5CD, 0xF5CE, 0xF5CF, 0xF5D0, 0xF5D1, 0xF5D2, 0xF5D3, 0xF5D4, + 0xF5D5, 0xF5D6, 0xF5D7, 0xF5D8, 0xF5D9, 0xF5DA, 0xF5DB, 0xF5DC, + 0xF5DD, 0xF5DE, 0xF5DF, 0xF5E0, 0xF5E1, 0xF5E2, 0xF5E3, 0xF5E4, + 0xF5E5, 0xF5E6, 0xF5E7, 0xF5E8, 0xF5E9, 0xF5EA, 0xF5EB, 0xF5EC, + 0xF5ED, 0xF5EE, 0xF5EF, 0xF5F0, 0xF5F1, 0xF5F2, 0xF5F3, 0xF5F4, + 0xF5F5, 0xF5F6, 0xF5F7, 0xF5F8, 0xF5F9, 0xF5FA, 0xF5FB, 0xF5FC, + 0xF5FD, 0xF5FE, 0xF5FF, 0xF600, 0xF601, 0xF602, 0xF603, 0xF604, + 0xF605, 0xF606, 0xF607, 0xF608, 0xF609, 0xF60A, 0xF60B, 0xF60C, + 0xF60D, 0xF60E, 0xF60F, 0xF610, 0xF611, 0xF612, 0xF613, ALTCHR, +/* 0x8D40 - 0x8DFF */ + 0xF614, 0xF615, 0xF616, 0xF617, 0xF618, 0xF619, 0xF61A, 0xF61B, + 0xF61C, 0xF61D, 0xF61E, 0xF61F, 0xF620, 0xF621, 0xF622, 0xF623, + 0xF624, 0xF625, 0xF626, 0xF627, 0xF628, 0xF629, 0xF62A, 0xF62B, + 0xF62C, 0xF62D, 0xF62E, 0xF62F, 0xF630, 0xF631, 0xF632, 0xF633, + 0x5D3E, 0x5D48, 0x5D56, 0x3DFC, 0x380F, 0x5DA4, 0x5DB9, 0x3820, + 0x3838, 0x5E42, 0x5EBD, 0x5F25, 0x5F83, 0x3908, 0x3914, 0x393F, + 0x394D, 0x60D7, 0x613D, 0x5CE5, 0x3989, 0x61B7, 0x61B9, 0x61CF, + 0x39B8, 0x622C, 0x6290, 0x62E5, 0x6318, 0x39F8, 0x56B1, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x3A03, 0x63E2, 0x63FB, 0x6407, 0x645A, 0x3A4B, 0x64C0, + 0x5D15, 0x5621, 0x9F9F, 0x3A97, 0x6586, 0x3ABD, 0x65FF, 0x6653, + 0x3AF2, 0x6692, 0x3B22, 0x6716, 0x3B42, 0x67A4, 0x6800, 0x3B58, + 0x684A, 0x6884, 0x3B72, 0x3B71, 0x3B7B, 0x6909, 0x6943, 0x725C, + 0x6964, 0x699F, 0x6985, 0x3BBC, 0x69D6, 0x3BDD, 0x6A65, 0x6A74, + 0x6A71, 0x6A82, 0x3BEC, 0x6A99, 0x3BF2, 0x6AAB, 0x6AB5, 0x6AD4, + 0x6AF6, 0x6B81, 0x6BC1, 0x6BEA, 0x6C75, 0x6CAA, 0x3CCB, 0x6D02, + 0x6D06, 0x6D26, 0x6D81, 0x3CEF, 0x6DA4, 0x6DB1, 0x6E15, 0x6E18, + 0x6E29, 0x6E86, 0xF694, 0x6EBB, 0x6EE2, 0x6EDA, 0x9F7F, 0x6EE8, + 0x6EE9, 0x6F24, 0x6F34, 0x3D46, 0xF69E, 0x6F81, 0x6FBE, 0x3D6A, + 0x3D75, 0x71B7, 0x5C99, 0x3D8A, 0x702C, 0x3D91, 0x7050, 0x7054, + 0x706F, 0x707F, 0x7089, 0xF6AD, 0x43C1, 0x35F1, 0xF6B0, ALTCHR, +/* 0x8E40 - 0x8EFF */ + 0xE311, 0x57BE, 0xE313, 0x713E, 0xE315, 0x364E, 0x69A2, 0xE318, + 0x5B74, 0x7A49, 0xE31B, 0xE31C, 0x7A65, 0x7A7D, 0xE31F, 0x7ABB, + 0x7AB0, 0x7AC2, 0x7AC3, 0x71D1, 0xE325, 0x41CA, 0x7ADA, 0x7ADD, + 0x7AEA, 0x41EF, 0x54B2, 0xE32C, 0x7B0B, 0x7B55, 0x7B29, 0xE330, + 0xE331, 0x7BA2, 0x7B6F, 0x839C, 0xE335, 0xE336, 0x7BD0, 0x8421, + 0x7B92, 0xE33A, 0xE33B, 0x3DAD, 0xE33D, 0x8492, 0x7BFA, 0xE340, + 0x7C35, 0xE342, 0x7C44, 0x7C83, 0xE345, 0x7CA6, 0x667D, 0xE348, + 0x7CC9, 0x7CC7, 0x7CE6, 0x7C74, 0x7CF3, 0x7CF5, 0xE34F, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7E67, 0x451D, 0xE352, 0x7D5D, 0xE354, 0x748D, 0x7D89, + 0x7DAB, 0x7135, 0x7DB3, 0xE35A, 0xE35B, 0xE35C, 0x7DE4, 0x3D13, + 0x7DF5, 0xE360, 0x7DE5, 0xE362, 0xE363, 0xE364, 0xE365, 0x7E6E, + 0x7E92, 0x432B, 0x946C, 0x7E27, 0x7F40, 0x7F41, 0x7F47, 0x7936, + 0xE36F, 0x99E1, 0x7F97, 0xE372, 0x7FA3, 0xE374, 0xE375, 0x455C, + 0xE377, 0x4503, 0xE379, 0x7FFA, 0xE37B, 0xE37C, 0x8008, 0x801D, + 0xE37F, 0x802F, 0xE381, 0xE382, 0x803B, 0x803C, 0x8061, 0xE386, + 0x4989, 0xE388, 0xE389, 0xE38A, 0x6725, 0x80A7, 0xE38D, 0x8107, + 0x811A, 0x58B0, 0xE391, 0x6C7F, 0xE393, 0xE394, 0x64E7, 0xE396, + 0x8218, 0xE398, 0x6A53, 0xE39A, 0xE39B, 0x447A, 0x8229, 0xE39E, + 0xE39F, 0xE3A0, 0x4FF9, 0xE3A2, 0x84E2, 0x8362, 0xE3A5, 0xE3A6, + 0xE3A7, 0xE3A8, 0xE3A9, 0x82AA, 0x691B, 0xE3AC, 0x41DB, ALTCHR, +/* 0x8F40 - 0x8FFF */ + 0x854B, 0x82D0, 0x831A, 0xE3B1, 0xE3B2, 0x36C1, 0xE3B4, 0xE3B5, + 0x827B, 0x82E2, 0x8318, 0xE3B9, 0xE3BA, 0xE3BB, 0xE3BC, 0xE3BD, + 0x3DBF, 0x831D, 0x55EC, 0x8385, 0x450B, 0xE3C3, 0x83AC, 0xE3C5, + 0x83D3, 0x347E, 0xE3C8, 0x6A57, 0x855A, 0x3496, 0xE3CC, 0xE3CD, + 0x8458, 0xE3CF, 0x8471, 0x3DD3, 0x44E4, 0x6AA7, 0x844A, 0xE3D5, + 0x7958, 0xE3D7, 0xE3D8, 0xE3D9, 0xE3DA, 0x84DE, 0xE3DC, 0x8391, + 0x44A0, 0x8493, 0x84E4, 0xE3E1, 0x4240, 0xE3E3, 0x4543, 0x8534, + 0x5AF2, 0xE3E7, 0x4527, 0x8573, 0x4516, 0x67BF, 0x8616, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xE3ED, 0xE3EE, 0x85C1, 0xE3F0, 0x8602, 0xE3F2, 0xE3F3, + 0xE3F4, 0x456A, 0x8628, 0x3648, 0xE3F8, 0x53F7, 0xE3FA, 0x867E, + 0x8771, 0xE3FD, 0x87EE, 0xE3FF, 0x87B1, 0x87DA, 0x880F, 0x5661, + 0x866C, 0x6856, 0x460F, 0x8845, 0x8846, 0xE409, 0xE40A, 0xE40B, + 0x885E, 0x889C, 0x465B, 0x88B4, 0x88B5, 0x63C1, 0x88C5, 0x7777, + 0xE414, 0x8987, 0x898A, 0xE417, 0xE418, 0x89A7, 0x89BC, 0xE41B, + 0x89E7, 0xE41D, 0xE41E, 0x8A9C, 0x7793, 0x91FE, 0x8A90, 0xE423, + 0x7AE9, 0xE425, 0xE426, 0x4713, 0xE428, 0x717C, 0x8B0C, 0x8B1F, + 0xE42C, 0xE42D, 0x8B3F, 0x8B4C, 0x8B4D, 0x8AA9, 0xE432, 0x8B90, + 0x8B9B, 0x8AAF, 0xE436, 0x4615, 0x884F, 0x8C9B, 0xE43A, 0xE43B, + 0xE43C, 0x3725, 0xE43E, 0x8CD6, 0xE440, 0xE441, 0x8D12, 0x8D03, + 0xE444, 0x8CDB, 0x705C, 0x8D11, 0xE448, 0x3ED0, 0xE44A, ALTCHR, +/* 0x9040 - 0x90FF */ + 0x8DA9, 0xE44C, 0xE44D, 0xE44E, 0x3B7C, 0xE450, 0xE451, 0x7AE7, + 0x8EAD, 0x8EB6, 0x8EC3, 0x92D4, 0x8F19, 0x8F2D, 0xE459, 0xE45A, + 0x8FA5, 0x9303, 0xE45D, 0xE45E, 0x8FB3, 0x492A, 0xE461, 0xE462, + 0xE463, 0x5EF8, 0xE465, 0x8FF9, 0xE467, 0xE468, 0xE469, 0xE46A, + 0x3980, 0xE46C, 0x9037, 0xE46E, 0xE46F, 0x9061, 0xE471, 0xE472, + 0x90A8, 0xE474, 0x90C4, 0xE476, 0x90AE, 0xE478, 0x9167, 0x3AF0, + 0x91A9, 0x91C4, 0x7CAC, 0xE47E, 0xE47F, 0x920E, 0x6C9F, 0x9241, + 0x9262, 0xE484, 0xE485, 0xE486, 0xE487, 0xE488, 0xE489, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xE48A, 0x932C, 0x936B, 0xE48D, 0xE48E, 0x708F, 0x5AC3, + 0xE491, 0xE492, 0x4965, 0x9244, 0xE495, 0xE496, 0xE497, 0x9373, + 0x945B, 0x8EBC, 0x9585, 0x95A6, 0x9426, 0x95A0, 0x6FF6, 0x42B9, + 0xE4A1, 0xE4A2, 0xE4A3, 0xE4A4, 0x49DF, 0x6C1C, 0x967B, 0x9696, + 0x416C, 0x96A3, 0xE4AB, 0x61DA, 0x96B6, 0x78F5, 0xE4AF, 0x96BD, + 0x53CC, 0x49A1, 0xE4B3, 0xE4B4, 0xE4B5, 0xE4B6, 0xE4B7, 0xE4B8, + 0xE4B9, 0xE4BA, 0x9731, 0x8642, 0x9736, 0x4A0F, 0x453D, 0x4585, + 0xE4C1, 0x7075, 0x5B41, 0x971B, 0xE4C5, 0xE4C6, 0x9757, 0x5B4A, + 0xE4C9, 0x975F, 0x9425, 0x50D0, 0xE4CD, 0xE4CE, 0x9789, 0x979F, + 0x97B1, 0x97BE, 0x97C0, 0x97D2, 0x97E0, 0xE4D6, 0x97EE, 0x741C, + 0xE4D9, 0xE4DA, 0x97F5, 0xE4DC, 0xE4DD, 0x4AD1, 0x9834, 0x9833, + 0x984B, 0x9866, 0x3B0E, 0xE4E4, 0x3D51, 0xE4E6, 0xE4E7, ALTCHR, +/* 0x9140 - 0x91FF */ + 0xE4E8, 0x98CA, 0x98B7, 0x98C8, 0x98C7, 0x4AFF, 0xE4EE, 0xE4EF, + 0x55B0, 0x98E1, 0x98E6, 0x98EC, 0x9378, 0x9939, 0xE4F6, 0x4B72, + 0xE4F8, 0xE4F9, 0x99F5, 0x9A0C, 0x9A3B, 0x9A10, 0x9A58, 0xE4FF, + 0x36C4, 0xE501, 0xE502, 0x9AE0, 0x9AE2, 0xE505, 0x9AF4, 0x4C0E, + 0x9B14, 0x9B2D, 0xE50A, 0x5034, 0x9B34, 0xE50D, 0x38C3, 0xE50F, + 0x9B50, 0x9B40, 0xE512, 0x5A45, 0xE514, 0x9B8E, 0xE516, 0x9C02, + 0x9BFF, 0x9C0C, 0xE51A, 0x9DD4, 0xE51C, 0xE51D, 0xE51E, 0xE51F, + 0xE520, 0xE521, 0x9D7E, 0x9D83, 0xE524, 0x9E0E, 0x6888, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9DC4, 0xE528, 0xE529, 0xE52A, 0xE52B, 0xE52C, 0x9D39, + 0xE52E, 0xE52F, 0x9E90, 0x9E95, 0x9E9E, 0x9EA2, 0x4D34, 0x9EAA, + 0x9EAF, 0xE537, 0x9EC1, 0x3B60, 0x39E5, 0x3D1D, 0x4F32, 0x37BE, + 0xE53E, 0x9F02, 0x9F08, 0x4B96, 0x9424, 0xE543, 0x9F17, 0xE545, + 0x9F39, 0x569F, 0x568A, 0x9F45, 0x99B8, 0xE54B, 0x97F2, 0x847F, + 0x9F62, 0x9F69, 0x7ADC, 0x9F8E, 0x7216, 0x4BBE, 0xE554, 0xE555, + 0x7177, 0xE557, 0xE558, 0xE559, 0x739E, 0xE55B, 0xE55C, 0x799F, + 0xE55E, 0xE55F, 0x9369, 0x93F3, 0xE562, 0x92EC, 0x9381, 0x93CB, + 0xE566, 0xE567, 0x7217, 0x3EEB, 0x7772, 0x7A43, 0x70D0, 0xE56D, + 0xE56E, 0x717E, 0xE570, 0x70A3, 0xE572, 0xE573, 0x3EC7, 0xE575, + 0xE576, 0xE577, 0x3722, 0xE579, 0xE57A, 0x36E1, 0xE57C, 0xE57D, + 0xE57E, 0x3723, 0xE580, 0x575B, 0xE582, 0xE583, 0xE584, ALTCHR, +/* 0x9240 - 0x92FF */ + 0xE585, 0xE586, 0x8503, 0xE588, 0xE589, 0x8455, 0xE58B, 0xE58C, + 0xE58D, 0xE58E, 0xE58F, 0xE590, 0x44F4, 0xE592, 0xE593, 0xE594, + 0x67F9, 0x3733, 0x3C15, 0x3DE7, 0x586C, 0xE59A, 0x6810, 0x4057, + 0xE59D, 0xE59E, 0xE59F, 0xE5A0, 0xE5A1, 0x54CB, 0x569E, 0xE5A4, + 0x5692, 0xE5A6, 0xE5A7, 0xE5A8, 0x93C6, 0xE5AA, 0x939C, 0x4EF8, + 0x512B, 0x3819, 0xE5AF, 0x4EBC, 0xE5B1, 0xE5B2, 0x4F4B, 0x4F8A, + 0xE5B5, 0x5A68, 0xE5B7, 0xE5B8, 0x3999, 0xE5BA, 0xE5BB, 0x3435, + 0x4F29, 0xE5BE, 0xE5BF, 0xE5C0, 0x8ADA, 0xE5C2, 0x4E98, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x50CD, 0x510D, 0x4FA2, 0x4F03, 0xE5C8, 0xE5C9, 0x4F42, + 0x502E, 0x506C, 0x5081, 0x4FCC, 0x4FE5, 0x5058, 0x50FC, 0xE5D2, + 0xE5D3, 0xE5D4, 0xE5D5, 0x6E76, 0xE5D7, 0xE5D8, 0xE5D9, 0x6D72, + 0xE5DB, 0xE5DC, 0x51A8, 0x51C3, 0xE5DF, 0x44DD, 0xE5E1, 0xE5E2, + 0xE5E3, 0x8D7A, 0xE5E5, 0xE5E6, 0x5259, 0x52A4, 0xE5E9, 0x52E1, + 0xE5EB, 0x467A, 0x718C, 0xE5EE, 0xE5EF, 0xE5F0, 0xE5F1, 0x69D1, + 0xE5F3, 0xE5F4, 0x3EDE, 0x7499, 0x7414, 0x7456, 0x7398, 0x4B8E, + 0xE5FB, 0xE5FC, 0x53D0, 0x3584, 0x720F, 0xE600, 0x55B4, 0xE602, + 0x54CD, 0xE604, 0x571D, 0x925D, 0x96F4, 0x9366, 0x57DD, 0x578D, + 0x577F, 0x363E, 0x58CB, 0x5A99, 0xE60F, 0xE610, 0xE611, 0xE612, + 0x5A2C, 0x59B8, 0x928F, 0x5A7E, 0x5ACF, 0x5A12, 0xE619, 0xE61A, + 0xE61B, 0xE61C, 0x36F5, 0x6D05, 0x7443, 0x5A21, 0xE621, ALTCHR, +/* 0x9340 - 0x93FF */ + 0x5A81, 0xE623, 0xE624, 0x93E0, 0x748C, 0xE627, 0x7105, 0x4972, + 0x9408, 0xE62B, 0x93BD, 0x37A0, 0x5C1E, 0x5C9E, 0x5E5E, 0x5E48, + 0xE632, 0xE633, 0xE634, 0x5ECD, 0x5B4F, 0xE637, 0xE638, 0x3701, + 0xE63A, 0x36DD, 0xE63C, 0x36D3, 0x812A, 0xE63F, 0xE640, 0xE641, + 0xE642, 0x5F0C, 0x5F0E, 0xE645, 0xE646, 0x5A6B, 0xE648, 0x5B44, + 0x8614, 0xE64B, 0x8860, 0x607E, 0xE64E, 0xE64F, 0x5FDB, 0x3EB8, + 0xE652, 0xE653, 0xE654, 0xE655, 0x61C0, 0xE657, 0xE658, 0xE659, + 0x6199, 0x6198, 0x6075, 0xE65D, 0xE65E, 0xE65F, 0xE660, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6471, 0xE662, 0xE663, 0x3A29, 0xE665, 0xE666, 0xE667, + 0xE668, 0x6337, 0xE66A, 0x64B6, 0x6331, 0x63D1, 0xE66E, 0xE66F, + 0x62A4, 0xE671, 0x643B, 0x656B, 0x6972, 0x3BF4, 0xE676, 0xE677, + 0xE678, 0xE679, 0x550D, 0xE67B, 0xE67C, 0xE67D, 0x66CE, 0xE67F, + 0xE680, 0x3AE0, 0x4190, 0xE683, 0xE684, 0xE685, 0xE686, 0xE687, + 0xE688, 0x78EE, 0xE68A, 0xE68B, 0xE68C, 0x3464, 0xE68E, 0xE68F, + 0xE690, 0x668E, 0xE692, 0x666B, 0x4B93, 0x6630, 0xE696, 0xE697, + 0x6663, 0xE699, 0xE69A, 0x661E, 0xE69C, 0x38D1, 0xE69E, 0xE69F, + 0x3B99, 0xE6A1, 0xE6A2, 0x74D0, 0x3B96, 0x678F, 0xE6A6, 0x68B6, + 0x681E, 0x3BC4, 0x6ABE, 0x3863, 0xE6AC, 0xE6AD, 0x6A33, 0x6A52, + 0x6AC9, 0x6B05, 0xE6B2, 0x6511, 0x6898, 0x6A4C, 0x3BD7, 0x6A7A, + 0x6B57, 0xE6B9, 0xE6BA, 0x93A0, 0x92F2, 0xE6BD, 0xE6BE, ALTCHR, +/* 0x9440 - 0x94FF */ + 0x9289, 0xE6C0, 0xE6C1, 0x9467, 0x6DA5, 0x6F0B, 0xE6C5, 0xE6C6, + 0xE6C7, 0x3D8F, 0x6E04, 0xE6CA, 0x5A3D, 0x6E0A, 0x5847, 0x6D24, + 0x7842, 0x713B, 0xE6D1, 0xE6D2, 0x70F1, 0x7250, 0x7287, 0x7294, + 0xE6D7, 0xE6D8, 0x5179, 0xE6DA, 0xE6DB, 0x747A, 0xE6DD, 0xE6DE, + 0xE6DF, 0xE6E0, 0xE6E1, 0x3F06, 0x3EB1, 0xE6E4, 0xE6E5, 0xE6E6, + 0x60A7, 0x3EF3, 0x74CC, 0x743C, 0x9387, 0x7437, 0x449F, 0xE6EE, + 0x4551, 0x7583, 0x3F63, 0xE6F2, 0xE6F3, 0x3F58, 0x7555, 0x7673, + 0xE6F7, 0x3B19, 0x7468, 0xE6FA, 0xE6FB, 0xE6FC, 0x3AFB, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x3DCD, 0xE6FF, 0x3EFF, 0xE701, 0xE702, 0x91FA, 0x5732, + 0x9342, 0xE706, 0xE707, 0x50DF, 0xE709, 0xE70A, 0x7778, 0xE70C, + 0x770E, 0x770F, 0x777B, 0xE710, 0xE711, 0x3A5E, 0xE713, 0x7438, + 0x749B, 0x3EBF, 0xE717, 0xE718, 0x40C8, 0xE71A, 0xE71B, 0x9307, + 0xE71D, 0x781E, 0x788D, 0x7888, 0x78D2, 0x73D0, 0x7959, 0xE724, + 0xE725, 0x410E, 0xE727, 0x8496, 0x79A5, 0x6A2D, 0xE72B, 0x7A3A, + 0x79F4, 0x416E, 0xE72F, 0x4132, 0x9235, 0x79F1, 0xE733, 0xE734, + 0xE735, 0xE736, 0xE737, 0x3597, 0x556B, 0x3570, 0x36AA, 0xE73C, + 0xE73D, 0x7AE2, 0x5A59, 0xE740, 0xE741, 0xE742, 0x5A0D, 0xE744, + 0x78F0, 0x5A2A, 0xE747, 0x7AFE, 0x41F9, 0x7C5D, 0x7C6D, 0x4211, + 0xE74D, 0xE74E, 0xE74F, 0x7CCD, 0xE751, 0xE752, 0x7C8E, 0x7C7C, + 0x7CAE, 0x6AB2, 0x7DDC, 0x7E07, 0x7DD3, 0x7F4E, 0xE75B, ALTCHR, +/* 0x9540 - 0x95FF */ + 0xE75C, 0xE75D, 0x7D97, 0xE75F, 0x426A, 0xE761, 0xE762, 0x67D6, + 0xE764, 0xE765, 0x57C4, 0xE767, 0xE768, 0xE769, 0x7FDD, 0x7B27, + 0xE76C, 0xE76D, 0xE76E, 0x7B0C, 0xE770, 0x99E6, 0x8645, 0x9A63, + 0x6A1C, 0xE775, 0x39E2, 0xE777, 0xE778, 0x9A1F, 0xE77A, 0x8480, + 0xE77C, 0xE77D, 0x44EA, 0x8137, 0x4402, 0x80C6, 0x8109, 0x8142, + 0xE784, 0x98C3, 0xE786, 0x8262, 0x8265, 0xE789, 0x8453, 0xE78B, + 0x8610, 0xE78D, 0x5A86, 0x417F, 0xE790, 0x5B2B, 0xE792, 0x5AE4, + 0xE794, 0x86A0, 0xE796, 0xE797, 0x882D, 0xE799, 0x5A02, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x886E, 0x4F45, 0x8887, 0x88BF, 0x88E6, 0x8965, 0x894D, + 0xE7A2, 0x8954, 0xE7A4, 0xE7A5, 0xE7A6, 0xE7A7, 0xE7A8, 0xE7A9, + 0x3EAD, 0x84A3, 0x46F5, 0x46CF, 0x37F2, 0x8A3D, 0x8A1C, 0xE7B1, + 0x5F4D, 0x922B, 0xE7B4, 0x65D4, 0x7129, 0x70C4, 0xE7B8, 0x9D6D, + 0x8C9F, 0x8CE9, 0xE7BC, 0x599A, 0x77C3, 0x59F0, 0x436E, 0x36D4, + 0x8E2A, 0x8EA7, 0xE7C4, 0x8F30, 0x8F4A, 0x42F4, 0x6C58, 0x6FBB, + 0xE7CA, 0x489B, 0x6F79, 0x6E8B, 0xE7CE, 0x9BE9, 0x36B5, 0xE7D1, + 0x90BB, 0xE7D3, 0x5571, 0x4906, 0x91BB, 0x9404, 0xE7D8, 0x4062, + 0xE7DA, 0x9427, 0xE7DC, 0xE7DD, 0x84E5, 0x8A2B, 0x9599, 0x95A7, + 0x9597, 0x9596, 0xE7E4, 0x7445, 0x3EC2, 0xE7E7, 0xE7E8, 0xE7E9, + 0x3EE7, 0xE7EB, 0x968F, 0xE7ED, 0xE7EE, 0xE7EF, 0x3ECC, 0xE7F1, + 0xE7F2, 0xE7F3, 0x7412, 0x746B, 0x3EFC, 0x9741, 0xE7F8, ALTCHR, +/* 0x9640 - 0x96FF */ + 0x6847, 0x4A1D, 0xE7FB, 0xE7FC, 0xE7FD, 0x9368, 0xE7FF, 0xE800, + 0xE801, 0xE802, 0x92BA, 0x5B11, 0x8B69, 0x493C, 0x73F9, 0xE808, + 0x979B, 0x9771, 0x9938, 0xE80C, 0x5DC1, 0xE80E, 0xE80F, 0x981F, + 0xE811, 0x92F6, 0xE813, 0x91E5, 0x44C0, 0xE816, 0xE817, 0xE818, + 0x98DC, 0xE81A, 0x3F00, 0x922A, 0x4925, 0x8414, 0x993B, 0x994D, + 0xE821, 0x3DFD, 0x999B, 0x4B6F, 0x99AA, 0x9A5C, 0xE827, 0xE828, + 0x6A8F, 0x9A21, 0x5AFE, 0x9A2F, 0xE82D, 0x4B90, 0xE82F, 0x99BC, + 0x4BBD, 0x4B97, 0x937D, 0x5872, 0xE835, 0x5822, 0xE837, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xE838, 0x7844, 0xE83A, 0xE83B, 0x68C5, 0x3D7D, 0x9458, + 0x3927, 0x6150, 0xE841, 0xE842, 0x6107, 0x9C4F, 0x9C53, 0x9C7B, + 0x9C35, 0x9C10, 0x9B7F, 0x9BCF, 0xE84B, 0x9B9F, 0xE84D, 0xE84E, + 0x9D21, 0x4CAE, 0xE851, 0x9E18, 0x4CB0, 0x9D0C, 0xE855, 0xE856, + 0xE857, 0xE858, 0x9DA5, 0x84BD, 0xE85B, 0xE85C, 0xE85D, 0x85FC, + 0x4533, 0xE860, 0xE861, 0xE862, 0x8420, 0x85EE, 0xE865, 0xE866, + 0xE867, 0x79E2, 0xE869, 0xE86A, 0x492D, 0xE86C, 0x3D62, 0x93DB, + 0x92BE, 0x9348, 0xE871, 0x78B9, 0x9277, 0x944D, 0x4FE4, 0x3440, + 0x9064, 0xE878, 0x783D, 0x7854, 0x78B6, 0x784B, 0xE87D, 0xE87E, + 0xE87F, 0x369A, 0x4F72, 0x6FDA, 0x6FD9, 0xE884, 0x701E, 0x5414, + 0xE887, 0x57BB, 0x58F3, 0x578A, 0x9D16, 0x57D7, 0x7134, 0x34AF, + 0xE88F, 0x71EB, 0xE891, 0xE892, 0xE893, 0xE894, 0xE895, ALTCHR, +/* 0x9740 - 0x97FF */ + 0x610C, 0x5ACE, 0x5A0B, 0x42BC, 0xE89A, 0x372C, 0x4B7B, 0xE89D, + 0x93BB, 0x93B8, 0xE8A0, 0xE8A1, 0x8472, 0xE8A3, 0xE8A4, 0xE8A5, + 0xE8A6, 0xE8A7, 0x5994, 0xE8A9, 0xE8AA, 0x7DA8, 0xE8AC, 0xE8AD, + 0xE8AE, 0xE8AF, 0xE8B0, 0x92E5, 0x73E2, 0x3EE9, 0x74B4, 0xE8B5, + 0xE8B6, 0x3EE1, 0xE8B8, 0x6AD8, 0x73F3, 0x73FB, 0x3ED6, 0xE8BD, + 0xE8BE, 0xE8BF, 0xE8C0, 0xE8C1, 0xE8C2, 0xE8C3, 0x7448, 0xE8C5, + 0x70A5, 0xE8C7, 0x9284, 0x73E6, 0x935F, 0xE8CB, 0x9331, 0xE8CD, + 0xE8CE, 0x9386, 0xE8D0, 0xE8D1, 0x4935, 0xE8D3, 0x716B, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xE8D5, 0xE8D6, 0x56A4, 0xE8D8, 0xE8D9, 0xE8DA, 0x5502, + 0x79C4, 0xE8DD, 0x7DFE, 0xE8DF, 0xE8E0, 0xE8E1, 0x452E, 0x9401, + 0x370A, 0xE8E5, 0xE8E6, 0x59B0, 0xE8E8, 0xE8E9, 0xE8EA, 0x5AA1, + 0x36E2, 0xE8ED, 0x36B0, 0x925F, 0x5A79, 0xE8F1, 0xE8F2, 0x9374, + 0x3CCD, 0xE8F5, 0x4A96, 0x398A, 0x50F4, 0x3D69, 0x3D4C, 0xE8FB, + 0x7175, 0x42FB, 0xE8FE, 0x6E0F, 0xE900, 0x44EB, 0x6D57, 0xE903, + 0x7067, 0x6CAF, 0x3CD6, 0xE907, 0xE908, 0x6E02, 0x6F0C, 0x3D6F, + 0xE90C, 0x7551, 0x36BC, 0x34C8, 0x4680, 0x3EDA, 0x4871, 0x59C4, + 0x926E, 0x493E, 0x8F41, 0xE917, 0xE918, 0x5812, 0x57C8, 0x36D6, + 0xE91C, 0x70FE, 0xE91E, 0xE91F, 0xE920, 0xE921, 0xE922, 0x68B9, + 0x6967, 0xE925, 0xE926, 0xE927, 0xE928, 0xE929, 0xE92A, 0xE92B, + 0xE92C, 0x6A1A, 0xE92E, 0xE92F, 0x843E, 0x44DF, 0x44CE, ALTCHR, +/* 0x9840 - 0x98FF */ + 0xE933, 0xE934, 0xE935, 0xE936, 0x6F17, 0xE938, 0x833D, 0xE93A, + 0x83ED, 0xE93C, 0xE93D, 0xE93E, 0x5989, 0x5A82, 0xE941, 0x5A61, + 0x5A71, 0xE944, 0xE945, 0x372D, 0x59EF, 0xE948, 0x36C7, 0x718E, + 0x9390, 0x669A, 0xE94D, 0x5A6E, 0x5A2B, 0xE950, 0x6A2B, 0xE952, + 0xE953, 0xE954, 0xE955, 0x711D, 0xE957, 0xE958, 0x4FB0, 0xE95A, + 0x5CC2, 0xE95C, 0xE95D, 0xE95E, 0x6A0C, 0xE960, 0xE961, 0x70A6, + 0x7133, 0xE964, 0x3DA5, 0x6CDF, 0xE967, 0xE968, 0x7E65, 0x59EB, + 0x5D2F, 0x3DF3, 0x5F5C, 0xE96E, 0xE96F, 0x7DA4, 0x8426, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x5485, 0xE973, 0xE974, 0xE975, 0x577E, 0xE977, 0xE978, + 0x3FE5, 0xE97A, 0xE97B, 0x7003, 0xE97D, 0x5D70, 0x738F, 0x7CD3, + 0xE981, 0xE982, 0x4FC8, 0x7FE7, 0x72CD, 0x7310, 0xE987, 0x7338, + 0x7339, 0xE98A, 0x7341, 0x7348, 0x3EA9, 0xE98E, 0x906C, 0x71F5, + 0xE991, 0x73E1, 0x81F6, 0x3ECA, 0x770C, 0x3ED1, 0x6CA2, 0x56FD, + 0x7419, 0x741E, 0x741F, 0x3EE2, 0x3EF0, 0x3EF4, 0x3EFA, 0x74D3, + 0x3F0E, 0x3F53, 0x7542, 0x756D, 0x7572, 0x758D, 0x3F7C, 0x75C8, + 0x75DC, 0x3FC0, 0x764D, 0x3FD7, 0x7674, 0x3FDC, 0x767A, 0xE9B0, + 0x7188, 0x5623, 0x8980, 0x5869, 0x401D, 0x7743, 0x4039, 0x6761, + 0x4045, 0x35DB, 0x7798, 0x406A, 0x406F, 0x5C5E, 0x77BE, 0x77CB, + 0x58F2, 0x7818, 0x70B9, 0x781C, 0x40A8, 0x7839, 0x7847, 0x7851, + 0x7866, 0x8448, 0xE9CB, 0x7933, 0x6803, 0x7932, 0x4103, ALTCHR, +/* 0x9940 - 0x99FF */ + 0x4109, 0x7991, 0x7999, 0x8FBB, 0x7A06, 0x8FBC, 0x4167, 0x7A91, + 0x41B2, 0x7ABC, 0x8279, 0x41C4, 0x7ACF, 0x7ADB, 0x41CF, 0x4E21, + 0x7B62, 0x7B6C, 0x7B7B, 0x7C12, 0x7C1B, 0x4260, 0x427A, 0x7C7B, + 0x7C9C, 0x428C, 0x7CB8, 0x4294, 0x7CED, 0x8F93, 0x70C0, 0xE9EF, + 0x7DCF, 0x7DD4, 0x7DD0, 0x7DFD, 0x7FAE, 0x7FB4, 0x729F, 0x4397, + 0x8020, 0x8025, 0x7B39, 0x802E, 0x8031, 0x8054, 0x3DCC, 0x57B4, + 0x70A0, 0x80B7, 0x80E9, 0x43ED, 0x810C, 0x732A, 0x810E, 0x8112, + 0x7560, 0x8114, 0x4401, 0x3B39, 0x8156, 0x8159, 0x815A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x4413, 0x583A, 0x817C, 0x8184, 0x4425, 0x8193, 0x442D, + 0x81A5, 0x57EF, 0x81C1, 0x81E4, 0x8254, 0x448F, 0x82A6, 0x8276, + 0x82CA, 0x82D8, 0x82FF, 0x44B0, 0x8357, 0x9669, 0x698A, 0x8405, + 0x70F5, 0x8464, 0x60E3, 0x8488, 0x4504, 0x84BE, 0x84E1, 0x84F8, + 0x8510, 0x8538, 0x8552, 0x453B, 0x856F, 0x8570, 0x85E0, 0x4577, + 0x8672, 0x8692, 0x86B2, 0x86EF, 0x9645, 0x878B, 0x4606, 0x4617, + 0x88AE, 0x88FF, 0x8924, 0x8947, 0x8991, 0xEA43, 0x8A29, 0x8A38, + 0x8A94, 0x8AB4, 0x8C51, 0x8CD4, 0x8CF2, 0x8D1C, 0x4798, 0x585F, + 0x8DC3, 0x47ED, 0x4EEE, 0x8E3A, 0x55D8, 0x5754, 0x8E71, 0x55F5, + 0x8EB0, 0x4837, 0x8ECE, 0x8EE2, 0x8EE4, 0x8EED, 0x8EF2, 0x8FB7, + 0x8FC1, 0x8FCA, 0x8FCC, 0x9033, 0x99C4, 0x48AD, 0x98E0, 0x9213, + 0x491E, 0x9228, 0x9258, 0x926B, 0x92B1, 0x92AE, 0x92BF, ALTCHR, +/* 0x9A40 - 0x9AFF */ + 0x92E3, 0x92EB, 0x92F3, 0x92F4, 0x92FD, 0x9343, 0x9384, 0x93AD, + 0x4945, 0x4951, 0x9EBF, 0x9417, 0x5301, 0x941D, 0x942D, 0x943E, + 0x496A, 0x9454, 0x9479, 0x952D, 0x95A2, 0x49A7, 0x95F4, 0x9633, + 0x49E5, 0x67A0, 0x4A24, 0x9740, 0x4A35, 0x97B2, 0x97C2, 0x5654, + 0x4AE4, 0x60E8, 0x98B9, 0x4B19, 0x98F1, 0x5844, 0x990E, 0x9919, + 0x51B4, 0x991C, 0x9937, 0x9942, 0x995D, 0x9962, 0x4B70, 0x99C5, + 0x4B9D, 0x9A3C, 0x9B0F, 0x7A83, 0x9B69, 0x9B81, 0x9BDD, 0x9BF1, + 0x9BF4, 0x4C6D, 0x9C20, 0x376F, 0xEAA9, 0x9D49, 0x9C3A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9EFE, 0x5650, 0x9D93, 0x9DBD, 0x9DC0, 0x9DFC, 0x94F6, + 0x8FB6, 0x9E7B, 0x9EAC, 0x9EB1, 0x9EBD, 0x9EC6, 0x94DC, 0x9EE2, + 0x9EF1, 0x9EF8, 0x7AC8, 0x9F44, 0xEABF, 0xEAC0, 0xEAC1, 0x691A, + 0x94C3, 0x59AC, 0xEAC5, 0x5840, 0x94C1, 0x37B9, 0xEAC9, 0xEACA, + 0xEACB, 0xEACC, 0x5757, 0x7173, 0xEACF, 0xEAD0, 0xEAD1, 0x546A, + 0xEAD3, 0xEAD4, 0x549E, 0xEAD6, 0xEAD7, 0xEAD8, 0xEAD9, 0xEADA, + 0x60E7, 0xEADC, 0x567A, 0xEADE, 0xEADF, 0xEAE0, 0xEAE1, 0xEAE2, + 0xEAE3, 0x6955, 0x9C2F, 0x87A5, 0xEAE7, 0xEAE8, 0xEAE9, 0xEAEA, + 0xEAEB, 0xEAEC, 0x5C20, 0xEAEE, 0x5E0B, 0xEAF0, 0xEAF1, 0xEAF2, + 0x671E, 0xEAF4, 0xEAF5, 0xEAF6, 0x3647, 0xEAF8, 0xEAF9, 0xEAFA, + 0xEAFB, 0x5364, 0x84AD, 0xEAFE, 0xEAFF, 0xEB00, 0x8B81, 0xEB02, + 0xEB03, 0xEB04, 0xEB05, 0x4E78, 0x70BB, 0xEB08, 0xEB09, ALTCHR, +/* 0x9B40 - 0x9BFF */ + 0xEB0A, 0xEB0B, 0xEB0C, 0xEB0D, 0xEB0E, 0xEB0F, 0x62C3, 0xEB11, + 0xEB12, 0x7198, 0x6855, 0xEB15, 0x69E9, 0x36C8, 0xEB18, 0xEB19, + 0xEB1A, 0xEB1B, 0xEB1C, 0xEB1D, 0x82FD, 0xEB1F, 0xEB20, 0xEB21, + 0x89A5, 0xEB23, 0x8FA0, 0xEB25, 0x97B8, 0xEB27, 0x9847, 0x9ABD, + 0xEB2A, 0xEB2B, 0xEB2C, 0xEB2D, 0xEB2E, 0xEB2F, 0xEB30, 0xEB31, + 0xEB32, 0xEB33, 0xEB34, 0xEB35, 0xEB36, 0xEB37, 0xEB38, 0xEB39, + 0x5FB1, 0x6648, 0x66BF, 0xEB3D, 0xEB3E, 0xEB3F, 0xEB40, 0xEB41, + 0xEB42, 0xEB43, 0xEB44, 0xEB45, 0xEB46, 0x58B5, 0x670E, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6918, 0xEB4A, 0xEB4B, 0xEB4C, 0xEB4D, 0xEB4E, 0xEB4F, + 0xEB50, 0x48D0, 0x4AB8, 0xEB53, 0xEB54, 0xEB55, 0xEB56, 0xEB57, + 0xEB58, 0xEB59, 0xEB5A, 0xEB5B, 0x51D2, 0xEB5D, 0x599F, 0xEB5F, + 0x3BBE, 0xEB61, 0xEB62, 0xEB63, 0x5788, 0xEB65, 0x399B, 0xEB67, + 0xEB68, 0xEB69, 0x3762, 0xEB6B, 0x8B5E, 0xEB6D, 0xEB6E, 0xEB6F, + 0xEB70, 0xEB71, 0x7209, 0xEB73, 0xEB74, 0x5965, 0xEB76, 0xEB77, + 0xEB78, 0x8EDA, 0xEB7A, 0x528F, 0x573F, 0x7171, 0xEB7E, 0xEB7F, + 0xEB80, 0xEB81, 0x55BC, 0xEB83, 0xEB84, 0xEB85, 0xEB86, 0x3473, + 0xEB88, 0xEB89, 0xEB8A, 0x4718, 0xEB8C, 0xEB8D, 0xEB8E, 0xEB8F, + 0xEB90, 0x5066, 0x34FB, 0xEB93, 0xEB94, 0xEB95, 0x477C, 0xEB97, + 0xEB98, 0xEB99, 0xEB9A, 0xEB9B, 0x57A1, 0x7151, 0xEB9E, 0xEB9F, + 0xEBA0, 0x9056, 0xEBA2, 0xEBA3, 0x8B62, 0xEBA5, 0xEBA6, ALTCHR, +/* 0x9C40 - 0x9CFF */ + 0x5D5B, 0xEBA8, 0xEBA9, 0xEBAA, 0xEBAB, 0x8AEA, 0xEBAD, 0xEBAE, + 0xEBAF, 0xEBB0, 0x4BC0, 0xEBB2, 0xEBB3, 0xEBB4, 0x9465, 0xEBB6, + 0x6195, 0x5A27, 0xEBB9, 0xEBBA, 0x56B9, 0xEBBC, 0xEBBD, 0x4E6A, + 0xEBBF, 0x9656, 0x6D8F, 0xEBC2, 0x3618, 0x8977, 0xEBC5, 0xEBC6, + 0xEBC7, 0xEBC8, 0xEBC9, 0xEBCA, 0x7B42, 0xEBCC, 0xEBCD, 0xEBCE, + 0xEBCF, 0xEBD0, 0x7A45, 0xEBD2, 0xEBD3, 0x9A26, 0xEBD5, 0x365F, + 0xEBD7, 0xEBD8, 0x7983, 0xEBDA, 0xEBDB, 0x5D2C, 0xEBDD, 0xEBDE, + 0xEBDF, 0x46D0, 0xEBE1, 0x753B, 0x8865, 0xEBE4, 0x58B6, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x371C, 0xEBE7, 0xEBE8, 0xEBE9, 0x3C54, 0xEBEB, 0xEBEC, + 0x9281, 0xEBEE, 0xEBEF, 0x9330, 0xEBF1, 0xEBF2, 0x6C39, 0x949F, + 0xEBF5, 0xEBF6, 0x8827, 0x88F5, 0xEBF9, 0xEBFA, 0xEBFB, 0x6EB8, + 0xEBFD, 0xEBFE, 0x39A4, 0x36B9, 0xEC01, 0xEC02, 0x453F, 0x66B6, + 0xEC05, 0xEC06, 0x8943, 0xEC08, 0xEC09, 0x56D6, 0x40DF, 0xEC0C, + 0x39A1, 0xEC0E, 0xEC0F, 0xEC10, 0x71AD, 0x8366, 0xEC13, 0xEC14, + 0xEC15, 0x4CB7, 0xEC17, 0xEC18, 0xEC19, 0xEC1A, 0xEC1B, 0xEC1C, + 0xEC1D, 0x7B43, 0x797E, 0xEC20, 0x6FB5, 0xEC22, 0x6A03, 0xEC24, + 0x53A2, 0xEC26, 0x93BF, 0x6836, 0x975D, 0xEC2A, 0xEC2B, 0xEC2C, + 0xEC2D, 0xEC2E, 0xEC2F, 0x5D85, 0xEC31, 0xEC32, 0x5715, 0x9823, + 0xEC35, 0x5DAB, 0xEC37, 0x65BE, 0x69D5, 0x53D2, 0xEC3B, 0xEC3C, + 0x3C11, 0x6736, 0xEC3F, 0xEC40, 0xEC41, 0xEC42, 0xEC43, ALTCHR, +/* 0x9D40 - 0x9DFF */ + 0xEC44, 0xEC45, 0xEC46, 0xEC47, 0xEC48, 0xEC49, 0x35CA, 0xEC4B, + 0xEC4C, 0x48FA, 0x63E6, 0xEC4F, 0x7808, 0x9255, 0xEC52, 0x43F2, + 0xEC54, 0x43DF, 0xEC56, 0xEC57, 0xEC58, 0x59F8, 0xEC5A, 0xEC5B, + 0xEC5C, 0xEC5D, 0xEC5E, 0xEC5F, 0xEC60, 0x3DF7, 0xEC62, 0xEC63, + 0x8FD0, 0x728F, 0x568B, 0xEC67, 0xEC68, 0xEC69, 0xEC6A, 0xEC6B, + 0xEC6C, 0xEC6D, 0xEC6E, 0xEC6F, 0xEC70, 0xEC71, 0xEC72, 0xEC73, + 0x7E9F, 0xEC75, 0xEC76, 0x4CA4, 0x9547, 0xEC79, 0x71A2, 0xEC7B, + 0x4D91, 0x9012, 0xEC7E, 0x4D9C, 0xEC80, 0x8FBE, 0x55C1, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8FBA, 0xEC84, 0x8FB9, 0xEC86, 0x4509, 0x7E7F, 0x6F56, + 0x6AB1, 0x4EEA, 0x34E4, 0xEC8D, 0xEC8E, 0x373A, 0x8E80, 0xEC91, + 0xEC92, 0xEC93, 0xEC94, 0xEC95, 0xEC96, 0x3DEB, 0xEC98, 0xEC99, + 0xEC9A, 0xEC9B, 0x4E9A, 0xEC9D, 0xEC9E, 0x56BF, 0xECA0, 0x8E0E, + 0x5B6D, 0xECA3, 0xECA4, 0x63DE, 0xECA6, 0xECA7, 0xECA8, 0x6530, + 0x562D, 0xECAB, 0x541A, 0xECAD, 0x3DC6, 0xECAF, 0x4C7D, 0x5622, + 0x561E, 0x7F49, 0xECB4, 0x5975, 0xECB6, 0x8770, 0x4E1C, 0xECB9, + 0xECBA, 0xECBB, 0x8117, 0x9D5E, 0x8D18, 0x763B, 0x9C45, 0x764E, + 0x77B9, 0x9345, 0x5432, 0x8148, 0x82F7, 0x5625, 0x8132, 0x8418, + 0x80BD, 0x55EA, 0x7962, 0x5643, 0x5416, 0xECCF, 0x35CE, 0x5605, + 0x55F1, 0x66F1, 0xECD4, 0x362D, 0x7534, 0x55F0, 0x55BA, 0x5497, + 0x5572, 0xECDB, 0xECDC, 0x5ED0, 0xECDE, 0xECDF, 0xECE0, ALTCHR, +/* 0x9E40 - 0x9EFF */ + 0xECE1, 0x9EAB, 0x7D5A, 0x55DE, 0xECE5, 0x629D, 0x976D, 0x5494, + 0x8CCD, 0x71F6, 0x9176, 0x63FC, 0x63B9, 0x63FE, 0x5569, 0xECF0, + 0x9C72, 0xECF2, 0x519A, 0x34DF, 0xECF5, 0x51A7, 0x544D, 0x551E, + 0x5513, 0x7666, 0x8E2D, 0xECFC, 0x75B1, 0x80B6, 0x8804, 0x8786, + 0x88C7, 0x81B6, 0x841C, 0xED04, 0x44EC, 0x7304, 0xED07, 0x5B90, + 0x830B, 0xED0A, 0x567B, 0xED0C, 0xED0D, 0xED0E, 0xED0F, 0xED10, + 0xED11, 0x9170, 0xED13, 0x9208, 0xED15, 0xED16, 0xED17, 0xED18, + 0x7266, 0xED1A, 0x474E, 0xED1C, 0xED1D, 0xED1E, 0x40FA, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9C5D, 0x651F, 0xED22, 0x48F3, 0xED24, 0xED25, 0xED26, + 0xED27, 0xED28, 0xED29, 0xED2A, 0xED2B, 0xED2C, 0xED2D, 0x71A3, + 0x7E8E, 0x9D50, 0x4E1A, 0x4E04, 0x3577, 0x5B0D, 0x6CB2, 0x5367, + 0x36AC, 0x39DC, 0x537D, 0x36A5, 0xED3B, 0x589A, 0xED3D, 0x822D, + 0x544B, 0x57AA, 0xED41, 0xED42, 0xED43, 0x3A52, 0xED45, 0x7374, + 0xED47, 0x4D09, 0x9BED, 0xED4A, 0xED4B, 0x4C5B, 0xED4D, 0xED4E, + 0xED4F, 0x845C, 0xED51, 0xED52, 0xED53, 0xED54, 0x632E, 0x7D25, + 0xED57, 0xED58, 0x3A2A, 0x9008, 0x52CC, 0x3E74, 0x367A, 0x45E9, + 0xED5F, 0x7640, 0x5AF0, 0xED62, 0x787A, 0x47B6, 0x58A7, 0x40BF, + 0x567C, 0x9B8B, 0x5D74, 0x7654, 0xED6B, 0x9E85, 0x4CE1, 0xED6E, + 0x37FB, 0x6119, 0xED71, 0xED72, 0xED73, 0x565D, 0xED75, 0x57A7, + 0xED77, 0xED78, 0x5234, 0xED7A, 0x35AD, 0xED7C, 0x9D7C, ALTCHR, +/* 0x9F40 - 0x9FFF */ + 0x7C56, 0x9B39, 0x57DE, 0xED81, 0x5C53, 0x64D3, 0xED84, 0xED85, + 0xED86, 0x86AD, 0xED88, 0xED89, 0xED8A, 0xED8B, 0xED8C, 0x51FE, + 0xED8E, 0x5D8E, 0x9703, 0xED91, 0x9E81, 0x904C, 0x7B1F, 0x9B02, + 0x5CD1, 0x7BA3, 0x6268, 0x6335, 0x9AFF, 0x7BCF, 0x9B2A, 0x7C7E, + 0xED9E, 0x7C42, 0x7C86, 0x9C15, 0x7BFC, 0x9B09, 0xEDA4, 0x9C1B, + 0xEDA6, 0x9F5A, 0x5573, 0x5BC3, 0x4FFD, 0x9E98, 0x4FF2, 0x5260, + 0x3E06, 0x52D1, 0x5767, 0x5056, 0x59B7, 0x5E12, 0x97C8, 0x9DAB, + 0x8F5C, 0x5469, 0x97B4, 0x9940, 0x97BA, 0x532C, 0x6130, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x692C, 0x53DA, 0x9C0A, 0x9D02, 0x4C3B, 0x9641, 0x6980, + 0x50A6, 0x7546, 0xEDC6, 0x99DA, 0x5273, 0xEDC9, 0x9159, 0x9681, + 0x915C, 0xEDCD, 0x9151, 0xEDCF, 0x637F, 0xEDD1, 0x6ACA, 0x5611, + 0x918E, 0x757A, 0x6285, 0xEDD7, 0x734F, 0x7C70, 0xEDDA, 0xEDDB, + 0xEDDC, 0xEDDD, 0x76D6, 0x9B9D, 0x4E2A, 0xEDE1, 0x83BE, 0x8842, + 0xEDE4, 0x5C4A, 0x69C0, 0xEDE7, 0x577A, 0x521F, 0x5DF5, 0x4ECE, + 0x6C31, 0xEDED, 0x4F39, 0x549C, 0x54DA, 0x529A, 0x8D82, 0x35FE, + 0xEDF4, 0x35F3, 0xEDF6, 0x6B52, 0x917C, 0x9FA5, 0x9B97, 0x982E, + 0x98B4, 0x9ABA, 0x9EA8, 0x9E84, 0x717A, 0x7B14, 0xEE02, 0x6BFA, + 0x8818, 0x7F78, 0xEE06, 0x5620, 0xEE08, 0x8E77, 0x9F53, 0xEE0B, + 0x8DD4, 0x8E4F, 0x9E1C, 0x8E01, 0x6282, 0xEE11, 0x8E28, 0x8E75, + 0x7AD3, 0xEE15, 0x7A3E, 0x78D8, 0x6CEA, 0x8A67, 0x7607, ALTCHR, +/* 0xA040 - 0xA0FF */ + 0xEE1B, 0x9F26, 0x6CCE, 0x87D6, 0x75C3, 0xEE20, 0x7853, 0xEE22, + 0x8D0C, 0x72E2, 0x7371, 0x8B2D, 0x7302, 0x74F1, 0x8CEB, 0xEE2A, + 0x862F, 0x5FBA, 0x88A0, 0x44B7, 0xEE2F, 0xEE30, 0xEE31, 0xEE32, + 0x8A7E, 0xEE34, 0xEE35, 0x60FD, 0x7667, 0x9AD7, 0x9D44, 0x936E, + 0x9B8F, 0x87F5, 0xEE3D, 0xEE3E, 0x8CF7, 0x732C, 0x9721, 0x9BB0, + 0x35D6, 0x72B2, 0x4C07, 0x7C51, 0x994A, 0xEE48, 0x6159, 0x4C04, + 0x9E96, 0x617D, 0xEE4D, 0x575F, 0x616F, 0x62A6, 0x6239, 0xEE52, + 0x3A5C, 0x61E2, 0x53AA, 0xEE56, 0x6364, 0x6802, 0x35D2, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x5D57, 0xEE5B, 0x8FDA, 0xEE5D, 0xEE5E, 0x50D9, 0xEE60, + 0x7906, 0x5332, 0x9638, 0xEE64, 0x4065, 0xEE66, 0x77FE, 0xEE68, + 0x7CC2, 0xEE6A, 0x7CDA, 0x7A2D, 0x8066, 0x8063, 0x7D4D, 0x7505, + 0x74F2, 0x8994, 0x821A, 0x670C, 0x8062, 0xEE76, 0x805B, 0x74F0, + 0x8103, 0x7724, 0x8989, 0xEE7C, 0x7553, 0xEE7E, 0x87A9, 0x87CE, + 0x81C8, 0x878C, 0x8A49, 0x8CAD, 0x8B43, 0x772B, 0x74F8, 0x84DA, + 0x3635, 0x69B2, 0x8DA6, 0xEE8C, 0x89A9, 0xEE8E, 0x6DB9, 0x87C1, + 0xEE91, 0x74E7, 0x3DDB, 0x7176, 0x60A4, 0x619C, 0x3CD1, 0xEE98, + 0x6077, 0xEE9A, 0x7F71, 0xEE9C, 0xEE9D, 0x60E9, 0x4B7E, 0x5220, + 0xEEA1, 0xEEA2, 0xEEA3, 0xEEA4, 0xEEA5, 0xEEA6, 0xEEA7, 0xEEA8, + 0xEEA9, 0xEEAA, 0x5CC1, 0xEEAC, 0xEEAD, 0xEEAE, 0xEEAF, 0xEEB0, + 0xEEB1, 0x4562, 0x5B1F, 0xEEB4, 0x9F50, 0x9EA6, 0xEEB7, ALTCHR, +/******************** end HKSCS ********************/ +/* 0xA140 - 0xA1FF */ + 0x3000, 0xFF0C, 0x3001, 0x3002, 0xFF0E, 0x2022, 0xFF1B, 0xFF1A, + 0xFF1F, 0xFF01, 0xFE30, 0x2026, 0x2025, 0xFE50, 0xFF64, 0xFE52, + 0x00B7, 0xFE54, 0xFE55, 0xFE56, 0xFE57, 0xFF5C, 0x2013, 0xFE31, + 0x2014, 0xFE33, 0xFFFD, 0xFE34, 0xFE4F, 0xFF08, 0xFF09, 0xFE35, + 0xFE36, 0xFF5B, 0xFF5D, 0xFE37, 0xFE38, 0x3014, 0x3015, 0xFE39, + 0xFE3A, 0x3010, 0x3011, 0xFE3B, 0xFE3C, 0x300A, 0x300B, 0xFE3D, + 0xFE3E, 0x3008, 0x3009, 0xFE3F, 0xFE40, 0x300C, 0x300D, 0xFE41, + 0xFE42, 0x300E, 0x300F, 0xFE43, 0xFE44, 0xFE59, 0xFE5A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xFE5B, 0xFE5C, 0xFE5D, 0xFE5E, 0x2018, 0x2019, 0x201C, + 0x201D, 0x301D, 0x301E, 0x2035, 0x2032, 0xFF03, 0xFF06, 0xFF0A, + 0x203B, 0x00A7, 0x3003, 0x25CB, 0x25CF, 0x25B3, 0x25B2, 0x25CE, + 0x2606, 0x2605, 0x25C7, 0x25C6, 0x25A1, 0x25A0, 0x25BD, 0x25BC, + 0x32A3, 0x2105, 0x203E, 0xFFFD, 0xFF3F, 0xFFFD, 0xFE49, 0xFE4A, + 0xFE4D, 0xFE4E, 0xFE4B, 0xFE4C, 0xFE5F, 0xFE60, 0xFE61, 0xFF0B, + 0xFF0D, 0x00D7, 0x00F7, 0x00B1, 0x221A, 0xFF1C, 0xFF1E, 0xFF1D, + 0x2266, 0x2267, 0x2260, 0x221E, 0x2252, 0x2261, 0xFE62, 0xFE63, + 0xFE64, 0xFE65, 0xFE66, 0x223C, 0x2229, 0x222A, 0x22A5, 0x2220, + 0x221F, 0x22BF, 0x33D2, 0x33D1, 0x222B, 0x222E, 0x2235, 0x2234, + 0x2640, 0x2642, 0x2641, 0x2609, 0x2191, 0x2193, 0x2190, 0x2192, + 0x2196, 0x2197, 0x2199, 0x2198, 0x2225, 0x2223, 0xFFFD, ALTCHR, +/* 0xA240 - 0xA2FF */ + 0xFFFD, 0xFF0F, 0xFF3C, 0xFF04, 0x00A5, 0x3012, 0x00A2, 0x00A3, + 0xFF05, 0xFF20, 0x2103, 0x2109, 0xFE69, 0xFE6A, 0xFE6B, 0x33D5, + 0x339C, 0x339D, 0x339E, 0x33CE, 0x33A1, 0x338E, 0x338F, 0x33C4, + 0x00B0, 0x5159, 0x515B, 0x515E, 0x515D, 0x5161, 0x5163, 0x55E7, + 0x74E9, 0x7CCE, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, + 0x2587, 0x2588, 0x258F, 0x258E, 0x258D, 0x258C, 0x258B, 0x258A, + 0x2589, 0x253C, 0x2534, 0x252C, 0x2524, 0x251C, 0x2594, 0x2500, + 0x2502, 0x2595, 0x250C, 0x2510, 0x2514, 0x2518, 0x256D, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x256E, 0x2570, 0x256F, 0x2550, 0x255E, 0x256A, 0x2561, + 0x25E2, 0x25E3, 0x25E5, 0x25E4, 0x2571, 0x2572, 0x2573, 0xFF10, + 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, 0xFF18, + 0xFF19, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, + 0x2167, 0x2168, 0x2169, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, + 0x3026, 0x3027, 0x3028, 0x3029, 0xFFFD, 0x5344, 0xFFFD, 0xFF21, + 0xFF22, 0xFF23, 0xFF24, 0xFF25, 0xFF26, 0xFF27, 0xFF28, 0xFF29, + 0xFF2A, 0xFF2B, 0xFF2C, 0xFF2D, 0xFF2E, 0xFF2F, 0xFF30, 0xFF31, + 0xFF32, 0xFF33, 0xFF34, 0xFF35, 0xFF36, 0xFF37, 0xFF38, 0xFF39, + 0xFF3A, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, + 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, + 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, ALTCHR, +/* 0xA340 - 0xA3FF */ + 0xFF57, 0xFF58, 0xFF59, 0xFF5A, 0x0391, 0x0392, 0x0393, 0x0394, + 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, + 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0x03A3, 0x03A4, 0x03A5, + 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, 0x03B3, 0x03B4, + 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, + 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C4, 0x03C5, + 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x3105, 0x3106, 0x3107, 0x3108, + 0x3109, 0x310A, 0x310B, 0x310C, 0x310D, 0x310E, 0x310F, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x3110, 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, + 0x3117, 0x3118, 0x3119, 0x311A, 0x311B, 0x311C, 0x311D, 0x311E, + 0x311F, 0x3120, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, + 0x3127, 0x3128, 0x3129, 0x02D9, 0x02C9, 0x02CA, 0x02C7, 0x02CB, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xA440 - 0xA4FF */ + 0x4E00, 0x4E59, 0x4E01, 0x4E03, 0x4E43, 0x4E5D, 0x4E86, 0x4E8C, + 0x4EBA, 0x513F, 0x5165, 0x516B, 0x51E0, 0x5200, 0x5201, 0x529B, + 0x5315, 0x5341, 0x535C, 0x53C8, 0x4E09, 0x4E0B, 0x4E08, 0x4E0A, + 0x4E2B, 0x4E38, 0x51E1, 0x4E45, 0x4E48, 0x4E5F, 0x4E5E, 0x4E8E, + 0x4EA1, 0x5140, 0x5203, 0x52FA, 0x5343, 0x53C9, 0x53E3, 0x571F, + 0x58EB, 0x5915, 0x5927, 0x5973, 0x5B50, 0x5B51, 0x5B53, 0x5BF8, + 0x5C0F, 0x5C22, 0x5C38, 0x5C71, 0x5DDD, 0x5DE5, 0x5DF1, 0x5DF2, + 0x5DF3, 0x5DFE, 0x5E72, 0x5EFE, 0x5F0B, 0x5F13, 0x624D, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x4E11, 0x4E10, 0x4E0D, 0x4E2D, 0x4E30, 0x4E39, 0x4E4B, + 0x5C39, 0x4E88, 0x4E91, 0x4E95, 0x4E92, 0x4E94, 0x4EA2, 0x4EC1, + 0x4EC0, 0x4EC3, 0x4EC6, 0x4EC7, 0x4ECD, 0x4ECA, 0x4ECB, 0x4EC4, + 0x5143, 0x5141, 0x5167, 0x516D, 0x516E, 0x516C, 0x5197, 0x51F6, + 0x5206, 0x5207, 0x5208, 0x52FB, 0x52FE, 0x52FF, 0x5316, 0x5339, + 0x5348, 0x5347, 0x5345, 0x535E, 0x5384, 0x53CB, 0x53CA, 0x53CD, + 0x58EC, 0x5929, 0x592B, 0x592A, 0x592D, 0x5B54, 0x5C11, 0x5C24, + 0x5C3A, 0x5C6F, 0x5DF4, 0x5E7B, 0x5EFF, 0x5F14, 0x5F15, 0x5FC3, + 0x6208, 0x6236, 0x624B, 0x624E, 0x652F, 0x6587, 0x6597, 0x65A4, + 0x65B9, 0x65E5, 0x66F0, 0x6708, 0x6728, 0x6B20, 0x6B62, 0x6B79, + 0x6BCB, 0x6BD4, 0x6BDB, 0x6C0F, 0x6C34, 0x706B, 0x722A, 0x7236, + 0x723B, 0x7247, 0x7259, 0x725B, 0x72AC, 0x738B, 0x4E19, ALTCHR, +/* 0xA540 - 0xA5FF */ + 0x4E16, 0x4E15, 0x4E14, 0x4E18, 0x4E3B, 0x4E4D, 0x4E4F, 0x4E4E, + 0x4EE5, 0x4ED8, 0x4ED4, 0x4ED5, 0x4ED6, 0x4ED7, 0x4EE3, 0x4EE4, + 0x4ED9, 0x4EDE, 0x5145, 0x5144, 0x5189, 0x518A, 0x51AC, 0x51F9, + 0x51FA, 0x51F8, 0x520A, 0x52A0, 0x529F, 0x5305, 0x5306, 0x5317, + 0x531D, 0x4EDF, 0x534A, 0x5349, 0x5361, 0x5360, 0x536F, 0x536E, + 0x53BB, 0x53EF, 0x53E4, 0x53F3, 0x53EC, 0x53EE, 0x53E9, 0x53E8, + 0x53FC, 0x53F8, 0x53F5, 0x53EB, 0x53E6, 0x53EA, 0x53F2, 0x53F1, + 0x53F0, 0x53E5, 0x53ED, 0x53FB, 0x56DB, 0x56DA, 0x5916, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x592E, 0x5931, 0x5974, 0x5976, 0x5B55, 0x5B83, 0x5C3C, + 0x5DE8, 0x5DE7, 0x5DE6, 0x5E02, 0x5E03, 0x5E73, 0x5E7C, 0x5F01, + 0x5F18, 0x5F17, 0x5FC5, 0x620A, 0x6253, 0x6254, 0x6252, 0x6251, + 0x65A5, 0x65E6, 0x672E, 0x672C, 0x672A, 0x672B, 0x672D, 0x6B63, + 0x6BCD, 0x6C11, 0x6C10, 0x6C38, 0x6C41, 0x6C40, 0x6C3E, 0x72AF, + 0x7384, 0x7389, 0x74DC, 0x74E6, 0x7518, 0x751F, 0x7528, 0x7529, + 0x7530, 0x7531, 0x7532, 0x7533, 0x758B, 0x767D, 0x76AE, 0x76BF, + 0x76EE, 0x77DB, 0x77E2, 0x77F3, 0x793A, 0x79BE, 0x7A74, 0x7ACB, + 0x4E1E, 0x4E1F, 0x4E52, 0x4E53, 0x4E69, 0x4E99, 0x4EA4, 0x4EA6, + 0x4EA5, 0x4EFF, 0x4F09, 0x4F19, 0x4F0A, 0x4F15, 0x4F0D, 0x4F10, + 0x4F11, 0x4F0F, 0x4EF2, 0x4EF6, 0x4EFB, 0x4EF0, 0x4EF3, 0x4EFD, + 0x4F01, 0x4F0B, 0x5149, 0x5147, 0x5146, 0x5148, 0x5168, ALTCHR, +/* 0xA640 - 0xA6FF */ + 0x5171, 0x518D, 0x51B0, 0x5217, 0x5211, 0x5212, 0x520E, 0x5216, + 0x52A3, 0x5308, 0x5321, 0x5320, 0x5370, 0x5371, 0x5409, 0x540F, + 0x540C, 0x540A, 0x5410, 0x5401, 0x540B, 0x5404, 0x5411, 0x540D, + 0x5408, 0x5403, 0x540E, 0x5406, 0x5412, 0x56E0, 0x56DE, 0x56DD, + 0x5733, 0x5730, 0x5728, 0x572D, 0x572C, 0x572F, 0x5729, 0x5919, + 0x591A, 0x5937, 0x5938, 0x5984, 0x5978, 0x5983, 0x597D, 0x5979, + 0x5982, 0x5981, 0x5B57, 0x5B58, 0x5B87, 0x5B88, 0x5B85, 0x5B89, + 0x5BFA, 0x5C16, 0x5C79, 0x5DDE, 0x5E06, 0x5E76, 0x5E74, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x5F0F, 0x5F1B, 0x5FD9, 0x5FD6, 0x620E, 0x620C, 0x620D, + 0x6210, 0x6263, 0x625B, 0x6258, 0x6536, 0x65E9, 0x65E8, 0x65EC, + 0x65ED, 0x66F2, 0x66F3, 0x6709, 0x673D, 0x6734, 0x6731, 0x6735, + 0x6B21, 0x6B64, 0x6B7B, 0x6C16, 0x6C5D, 0x6C57, 0x6C59, 0x6C5F, + 0x6C60, 0x6C50, 0x6C55, 0x6C61, 0x6C5B, 0x6C4D, 0x6C4E, 0x7070, + 0x725F, 0x725D, 0x767E, 0x7AF9, 0x7C73, 0x7CF8, 0x7F36, 0x7F8A, + 0x7FBD, 0x8001, 0x8003, 0x800C, 0x8012, 0x8033, 0x807F, 0x8089, + 0x808B, 0x808C, 0x81E3, 0x81EA, 0x81F3, 0x81FC, 0x820C, 0x821B, + 0x821F, 0x826E, 0x8272, 0x827E, 0x866B, 0x8840, 0x884C, 0x8863, + 0x897F, 0x9621, 0x4E32, 0x4EA8, 0x4F4D, 0x4F4F, 0x4F47, 0x4F57, + 0x4F5E, 0x4F34, 0x4F5B, 0x4F55, 0x4F30, 0x4F50, 0x4F51, 0x4F3D, + 0x4F3A, 0x4F38, 0x4F43, 0x4F54, 0x4F3C, 0x4F46, 0x4F63, ALTCHR, +/* 0xA740 - 0xA7FF */ + 0x4F5C, 0x4F60, 0x4F2F, 0x4F4E, 0x4F36, 0x4F59, 0x4F5D, 0x4F48, + 0x4F5A, 0x514C, 0x514B, 0x514D, 0x5175, 0x51B6, 0x51B7, 0x5225, + 0x5224, 0x5229, 0x522A, 0x5228, 0x52AB, 0x52A9, 0x52AA, 0x52AC, + 0x5323, 0x5373, 0x5375, 0x541D, 0x542D, 0x541E, 0x543E, 0x5426, + 0x544E, 0x5427, 0x5446, 0x5443, 0x5433, 0x5448, 0x5442, 0x541B, + 0x5429, 0x544A, 0x5439, 0x543B, 0x5438, 0x542E, 0x5435, 0x5436, + 0x5420, 0x543C, 0x5440, 0x5431, 0x542B, 0x541F, 0x542C, 0x56EA, + 0x56F0, 0x56E4, 0x56EB, 0x574A, 0x5751, 0x5740, 0x574D, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x5747, 0x574E, 0x573E, 0x5750, 0x574F, 0x573B, 0x58EF, + 0x593E, 0x599D, 0x5992, 0x59A8, 0x599E, 0x59A3, 0x5999, 0x5996, + 0x598D, 0x59A4, 0x5993, 0x598A, 0x59A5, 0x5B5D, 0x5B5C, 0x5B5A, + 0x5B5B, 0x5B8C, 0x5B8B, 0x5B8F, 0x5C2C, 0x5C40, 0x5C41, 0x5C3F, + 0x5C3E, 0x5C90, 0x5C91, 0x5C94, 0x5C8C, 0x5DEB, 0x5E0C, 0x5E8F, + 0x5E87, 0x5E8A, 0x5EF7, 0x5F04, 0x5F1F, 0x5F64, 0x5F62, 0x5F77, + 0x5F79, 0x5FD8, 0x5FCC, 0x5FD7, 0x5FCD, 0x5FF1, 0x5FEB, 0x5FF8, + 0x5FEA, 0x6212, 0x6211, 0x6284, 0x6297, 0x6296, 0x6280, 0x6276, + 0x6289, 0x626D, 0x628A, 0x627C, 0x627E, 0x6279, 0x6273, 0x6292, + 0x626F, 0x6298, 0x626E, 0x6295, 0x6293, 0x6291, 0x6286, 0x6539, + 0x653B, 0x6538, 0x65F1, 0x66F4, 0x675F, 0x674E, 0x674F, 0x6750, + 0x6751, 0x675C, 0x6756, 0x675E, 0x6749, 0x6746, 0x6760, ALTCHR, +/* 0xA840 - 0xA8FF */ + 0x6753, 0x6757, 0x6B65, 0x6BCF, 0x6C42, 0x6C5E, 0x6C99, 0x6C81, + 0x6C88, 0x6C89, 0x6C85, 0x6C9B, 0x6C6A, 0x6C7A, 0x6C90, 0x6C70, + 0x6C8C, 0x6C68, 0x6C96, 0x6C92, 0x6C7D, 0x6C83, 0x6C72, 0x6C7E, + 0x6C74, 0x6C86, 0x6C76, 0x6C8D, 0x6C94, 0x6C98, 0x6C82, 0x7076, + 0x707C, 0x707D, 0x7078, 0x7262, 0x7261, 0x7260, 0x72C4, 0x72C2, + 0x7396, 0x752C, 0x752B, 0x7537, 0x7538, 0x7682, 0x76EF, 0x77E3, + 0x79C1, 0x79C0, 0x79BF, 0x7A76, 0x7CFB, 0x7F55, 0x8096, 0x8093, + 0x809D, 0x8098, 0x809B, 0x809A, 0x80B2, 0x826F, 0x8292, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x828B, 0x828D, 0x898B, 0x89D2, 0x8A00, 0x8C37, 0x8C46, + 0x8C55, 0x8C9D, 0x8D64, 0x8D70, 0x8DB3, 0x8EAB, 0x8ECA, 0x8F9B, + 0x8FB0, 0x8FC2, 0x8FC6, 0x8FC5, 0x8FC4, 0x5DE1, 0x9091, 0x90A2, + 0x90AA, 0x90A6, 0x90A3, 0x9149, 0x91C6, 0x91CC, 0x9632, 0x962E, + 0x9631, 0x962A, 0x962C, 0x4E26, 0x4E56, 0x4E73, 0x4E8B, 0x4E9B, + 0x4E9E, 0x4EAB, 0x4EAC, 0x4F6F, 0x4F9D, 0x4F8D, 0x4F73, 0x4F7F, + 0x4F6C, 0x4F9B, 0x4F8B, 0x4F86, 0x4F83, 0x4F70, 0x4F75, 0x4F88, + 0x4F69, 0x4F7B, 0x4F96, 0x4F7E, 0x4F8F, 0x4F91, 0x4F7A, 0x5154, + 0x5152, 0x5155, 0x5169, 0x5177, 0x5176, 0x5178, 0x51BD, 0x51FD, + 0x523B, 0x5238, 0x5237, 0x523A, 0x5230, 0x522E, 0x5236, 0x5241, + 0x52BE, 0x52BB, 0x5352, 0x5354, 0x5353, 0x5351, 0x5366, 0x5377, + 0x5378, 0x5379, 0x53D6, 0x53D4, 0x53D7, 0x5473, 0x5475, ALTCHR, +/* 0xA940 - 0xA9FF */ + 0x5496, 0x5478, 0x5495, 0x5480, 0x547B, 0x5477, 0x5484, 0x5492, + 0x5486, 0x547C, 0x5490, 0x5471, 0x5476, 0x548C, 0x549A, 0x5462, + 0x5468, 0x548B, 0x547D, 0x548E, 0x56FA, 0x5783, 0x5777, 0x576A, + 0x5769, 0x5761, 0x5766, 0x5764, 0x577C, 0x591C, 0x5949, 0x5947, + 0x5948, 0x5944, 0x5954, 0x59BE, 0x59BB, 0x59D4, 0x59B9, 0x59AE, + 0x59D1, 0x59C6, 0x59D0, 0x59CD, 0x59CB, 0x59D3, 0x59CA, 0x59AF, + 0x59B3, 0x59D2, 0x59C5, 0x5B5F, 0x5B64, 0x5B63, 0x5B97, 0x5B9A, + 0x5B98, 0x5B9C, 0x5B99, 0x5B9B, 0x5C1A, 0x5C48, 0x5C45, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x5C46, 0x5CB7, 0x5CA1, 0x5CB8, 0x5CA9, 0x5CAB, 0x5CB1, + 0x5CB3, 0x5E18, 0x5E1A, 0x5E16, 0x5E15, 0x5E1B, 0x5E11, 0x5E78, + 0x5E9A, 0x5E97, 0x5E9C, 0x5E95, 0x5E96, 0x5EF6, 0x5F26, 0x5F27, + 0x5F29, 0x5F80, 0x5F81, 0x5F7F, 0x5F7C, 0x5FDD, 0x5FE0, 0x5FFD, + 0x5FF5, 0x5FFF, 0x600F, 0x6014, 0x602F, 0x6035, 0x6016, 0x602A, + 0x6015, 0x6021, 0x6027, 0x6029, 0x602B, 0x601B, 0x6216, 0x6215, + 0x623F, 0x623E, 0x6240, 0x627F, 0x62C9, 0x62CC, 0x62C4, 0x62BF, + 0x62C2, 0x62B9, 0x62D2, 0x62DB, 0x62AB, 0x62D3, 0x62D4, 0x62CB, + 0x62C8, 0x62A8, 0x62BD, 0x62BC, 0x62D0, 0x62D9, 0x62C7, 0x62CD, + 0x62B5, 0x62DA, 0x62B1, 0x62D8, 0x62D6, 0x62D7, 0x62C6, 0x62AC, + 0x62CE, 0x653E, 0x65A7, 0x65BC, 0x65FA, 0x6614, 0x6613, 0x660C, + 0x6606, 0x6602, 0x660E, 0x6600, 0x660F, 0x6615, 0x660A, ALTCHR, +/* 0xAA40 - 0xAAFF */ + 0x6607, 0x670D, 0x670B, 0x676D, 0x678B, 0x6795, 0x6771, 0x679C, + 0x6773, 0x6777, 0x6787, 0x679D, 0x6797, 0x676F, 0x6770, 0x677F, + 0x6789, 0x677E, 0x6790, 0x6775, 0x679A, 0x6793, 0x677C, 0x676A, + 0x6772, 0x6B23, 0x6B66, 0x6B67, 0x6B7F, 0x6C13, 0x6C1B, 0x6CE3, + 0x6CE8, 0x6CF3, 0x6CB1, 0x6CCC, 0x6CE5, 0x6CB3, 0x6CBD, 0x6CBE, + 0x6CBC, 0x6CE2, 0x6CAB, 0x6CD5, 0x6CD3, 0x6CB8, 0x6CC4, 0x6CB9, + 0x6CC1, 0x6CAE, 0x6CD7, 0x6CC5, 0x6CF1, 0x6CBF, 0x6CBB, 0x6CE1, + 0x6CDB, 0x6CCA, 0x6CAC, 0x6CEF, 0x6CDC, 0x6CD6, 0x6CE0, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7095, 0x708E, 0x7092, 0x708A, 0x7099, 0x722C, 0x722D, + 0x7238, 0x7248, 0x7267, 0x7269, 0x72C0, 0x72CE, 0x72D9, 0x72D7, + 0x72D0, 0x73A9, 0x73A8, 0x739F, 0x73AB, 0x73A5, 0x753D, 0x759D, + 0x7599, 0x759A, 0x7684, 0x76C2, 0x76F2, 0x76F4, 0x77E5, 0x77FD, + 0x793E, 0x7940, 0x7941, 0x79C9, 0x79C8, 0x7A7A, 0x7A79, 0x7AFA, + 0x7CFE, 0x7F54, 0x7F8C, 0x7F8B, 0x8005, 0x80BA, 0x80A5, 0x80A2, + 0x80B1, 0x80A1, 0x80AB, 0x80A9, 0x80B4, 0x80AA, 0x80AF, 0x81E5, + 0x81FE, 0x820D, 0x82B3, 0x829D, 0x8299, 0x82AD, 0x82BD, 0x829F, + 0x82B9, 0x82B1, 0x82AC, 0x82A5, 0x82AF, 0x82B8, 0x82A3, 0x82B0, + 0x82BE, 0x82B7, 0x864E, 0x8671, 0x521D, 0x8868, 0x8ECB, 0x8FCE, + 0x8FD4, 0x8FD1, 0x90B5, 0x90B8, 0x90B1, 0x90B6, 0x91C7, 0x91D1, + 0x9577, 0x9580, 0x961C, 0x9640, 0x963F, 0x963B, 0x9644, ALTCHR, +/* 0xAB40 - 0xABFF */ + 0x9642, 0x96B9, 0x96E8, 0x9752, 0x975E, 0x4E9F, 0x4EAD, 0x4EAE, + 0x4FE1, 0x4FB5, 0x4FAF, 0x4FBF, 0x4FE0, 0x4FD1, 0x4FCF, 0x4FDD, + 0x4FC3, 0x4FB6, 0x4FD8, 0x4FDF, 0x4FCA, 0x4FD7, 0x4FAE, 0x4FD0, + 0x4FC4, 0x4FC2, 0x4FDA, 0x4FCE, 0x4FDE, 0x4FB7, 0x5157, 0x5192, + 0x5191, 0x51A0, 0x524E, 0x5243, 0x524A, 0x524D, 0x524C, 0x524B, + 0x5247, 0x52C7, 0x52C9, 0x52C3, 0x52C1, 0x530D, 0x5357, 0x537B, + 0x539A, 0x53DB, 0x54AC, 0x54C0, 0x54A8, 0x54CE, 0x54C9, 0x54B8, + 0x54A6, 0x54B3, 0x54C7, 0x54C2, 0x54BD, 0x54AA, 0x54C1, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x54C4, 0x54C8, 0x54AF, 0x54AB, 0x54B1, 0x54BB, 0x54A9, + 0x54A7, 0x54BF, 0x56FF, 0x5782, 0x578B, 0x57A0, 0x57A3, 0x57A2, + 0x57CE, 0x57AE, 0x5793, 0x5955, 0x5951, 0x594F, 0x594E, 0x5950, + 0x59DC, 0x59D8, 0x59FF, 0x59E3, 0x59E8, 0x5A03, 0x59E5, 0x59EA, + 0x59DA, 0x59E6, 0x5A01, 0x59FB, 0x5B69, 0x5BA3, 0x5BA6, 0x5BA4, + 0x5BA2, 0x5BA5, 0x5C01, 0x5C4E, 0x5C4F, 0x5C4D, 0x5C4B, 0x5CD9, + 0x5CD2, 0x5DF7, 0x5E1D, 0x5E25, 0x5E1F, 0x5E7D, 0x5EA0, 0x5EA6, + 0x5EFA, 0x5F08, 0x5F2D, 0x5F65, 0x5F88, 0x5F85, 0x5F8A, 0x5F8B, + 0x5F87, 0x5F8C, 0x5F89, 0x6012, 0x601D, 0x6020, 0x6025, 0x600E, + 0x6028, 0x604D, 0x6070, 0x6068, 0x6062, 0x6046, 0x6043, 0x606C, + 0x606B, 0x606A, 0x6064, 0x6241, 0x62DC, 0x6316, 0x6309, 0x62FC, + 0x62ED, 0x6301, 0x62EE, 0x62FD, 0x6307, 0x62F1, 0x62F7, ALTCHR, +/* 0xAC40 - 0xACFF */ + 0x62EF, 0x62EC, 0x62FE, 0x62F4, 0x6311, 0x6302, 0x653F, 0x6545, + 0x65AB, 0x65BD, 0x65E2, 0x6625, 0x662D, 0x6620, 0x6627, 0x662F, + 0x661F, 0x6628, 0x6631, 0x6624, 0x66F7, 0x67FF, 0x67D3, 0x67F1, + 0x67D4, 0x67D0, 0x67EC, 0x67B6, 0x67AF, 0x67F5, 0x67E9, 0x67EF, + 0x67C4, 0x67D1, 0x67B4, 0x67DA, 0x67E5, 0x67B8, 0x67CF, 0x67DE, + 0x67F3, 0x67B0, 0x67D9, 0x67E2, 0x67DD, 0x67D2, 0x6B6A, 0x6B83, + 0x6B86, 0x6BB5, 0x6BD2, 0x6BD7, 0x6C1F, 0x6CC9, 0x6D0B, 0x6D32, + 0x6D2A, 0x6D41, 0x6D25, 0x6D0C, 0x6D31, 0x6D1E, 0x6D17, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6D3B, 0x6D3D, 0x6D3E, 0x6D36, 0x6D1B, 0x6CF5, 0x6D39, + 0x6D27, 0x6D38, 0x6D29, 0x6D2E, 0x6D35, 0x6D0E, 0x6D2B, 0x70AB, + 0x70BA, 0x70B3, 0x70AC, 0x70AF, 0x70AD, 0x70B8, 0x70AE, 0x70A4, + 0x7230, 0x7272, 0x726F, 0x7274, 0x72E9, 0x72E0, 0x72E1, 0x73B7, + 0x73CA, 0x73BB, 0x73B2, 0x73CD, 0x73C0, 0x73B3, 0x751A, 0x752D, + 0x754F, 0x754C, 0x754E, 0x754B, 0x75AB, 0x75A4, 0x75A5, 0x75A2, + 0x75A3, 0x7678, 0x7686, 0x7687, 0x7688, 0x76C8, 0x76C6, 0x76C3, + 0x76C5, 0x7701, 0x76F9, 0x76F8, 0x7709, 0x770B, 0x76FE, 0x76FC, + 0x7707, 0x77DC, 0x7802, 0x7814, 0x780C, 0x780D, 0x7946, 0x7949, + 0x7948, 0x7947, 0x79B9, 0x79BA, 0x79D1, 0x79D2, 0x79CB, 0x7A7F, + 0x7A81, 0x7AFF, 0x7AFD, 0x7C7D, 0x7D02, 0x7D05, 0x7D00, 0x7D09, + 0x7D07, 0x7D04, 0x7D06, 0x7F38, 0x7F8E, 0x7FBF, 0x8004, ALTCHR, +/* 0xAD40 - 0xADFF */ + 0x8010, 0x800D, 0x8011, 0x8036, 0x80D6, 0x80E5, 0x80DA, 0x80C3, + 0x80C4, 0x80CC, 0x80E1, 0x80DB, 0x80CE, 0x80DE, 0x80E4, 0x80DD, + 0x81F4, 0x8222, 0x82E7, 0x8303, 0x8305, 0x82E3, 0x82DB, 0x82E6, + 0x8304, 0x82E5, 0x8302, 0x8309, 0x82D2, 0x82D7, 0x82F1, 0x8301, + 0x82DC, 0x82D4, 0x82D1, 0x82DE, 0x82D3, 0x82DF, 0x82EF, 0x8306, + 0x8650, 0x8679, 0x867B, 0x867A, 0x884D, 0x886B, 0x8981, 0x89D4, + 0x8A08, 0x8A02, 0x8A03, 0x8C9E, 0x8CA0, 0x8D74, 0x8D73, 0x8DB4, + 0x8ECD, 0x8ECC, 0x8FF0, 0x8FE6, 0x8FE2, 0x8FEA, 0x8FE5, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8FED, 0x8FEB, 0x8FE4, 0x8FE8, 0x90CA, 0x90CE, 0x90C1, + 0x90C3, 0x914B, 0x914A, 0x91CD, 0x9582, 0x9650, 0x964B, 0x964C, + 0x964D, 0x9762, 0x9769, 0x97CB, 0x97ED, 0x97F3, 0x9801, 0x98A8, + 0x98DB, 0x98DF, 0x9996, 0x9999, 0x4E58, 0x4EB3, 0x500C, 0x500D, + 0x5023, 0x4FEF, 0x5026, 0x5025, 0x4FF8, 0x5029, 0x5016, 0x5006, + 0x503C, 0x501F, 0x501A, 0x5012, 0x5011, 0x4FFA, 0x5000, 0x5014, + 0x5028, 0x4FF1, 0x5021, 0x500B, 0x5019, 0x5018, 0x4FF3, 0x4FEE, + 0x502D, 0x502A, 0x4FFE, 0x502B, 0x5009, 0x517C, 0x51A4, 0x51A5, + 0x51A2, 0x51CD, 0x51CC, 0x51C6, 0x51CB, 0x5256, 0x525C, 0x5254, + 0x525B, 0x525D, 0x532A, 0x537F, 0x539F, 0x539D, 0x53DF, 0x54E8, + 0x5510, 0x5501, 0x5537, 0x54FC, 0x54E5, 0x54F2, 0x5506, 0x54FA, + 0x5514, 0x54E9, 0x54ED, 0x54E1, 0x5509, 0x54EE, 0x54EA, ALTCHR, +/* 0xAE40 - 0xAEFF */ + 0x54E6, 0x5527, 0x5507, 0x54FD, 0x550F, 0x5703, 0x5704, 0x57C2, + 0x57D4, 0x57CB, 0x57C3, 0x5809, 0x590F, 0x5957, 0x5958, 0x595A, + 0x5A11, 0x5A18, 0x5A1C, 0x5A1F, 0x5A1B, 0x5A13, 0x59EC, 0x5A20, + 0x5A23, 0x5A29, 0x5A25, 0x5A0C, 0x5A09, 0x5B6B, 0x5C58, 0x5BB0, + 0x5BB3, 0x5BB6, 0x5BB4, 0x5BAE, 0x5BB5, 0x5BB9, 0x5BB8, 0x5C04, + 0x5C51, 0x5C55, 0x5C50, 0x5CED, 0x5CFD, 0x5CFB, 0x5CEA, 0x5CE8, + 0x5CF0, 0x5CF6, 0x5D01, 0x5CF4, 0x5DEE, 0x5E2D, 0x5E2B, 0x5EAB, + 0x5EAD, 0x5EA7, 0x5F31, 0x5F92, 0x5F91, 0x5F90, 0x6059, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6063, 0x6065, 0x6050, 0x6055, 0x606D, 0x6069, 0x606F, + 0x6084, 0x609F, 0x609A, 0x608D, 0x6094, 0x608C, 0x6085, 0x6096, + 0x6247, 0x62F3, 0x6308, 0x62FF, 0x634E, 0x633E, 0x632F, 0x6355, + 0x6342, 0x6346, 0x634F, 0x6349, 0x633A, 0x6350, 0x633D, 0x632A, + 0x632B, 0x6328, 0x634D, 0x634C, 0x6548, 0x6549, 0x6599, 0x65C1, + 0x65C5, 0x6642, 0x6649, 0x664F, 0x6643, 0x6652, 0x664C, 0x6645, + 0x6641, 0x66F8, 0x6714, 0x6715, 0x6717, 0x6821, 0x6838, 0x6848, + 0x6846, 0x6853, 0x6839, 0x6842, 0x6854, 0x6829, 0x68B3, 0x6817, + 0x684C, 0x6851, 0x683D, 0x67F4, 0x6850, 0x6840, 0x683C, 0x6843, + 0x682A, 0x6845, 0x6813, 0x6818, 0x6841, 0x6B8A, 0x6B89, 0x6BB7, + 0x6C23, 0x6C27, 0x6C28, 0x6C26, 0x6C24, 0x6CF0, 0x6D6A, 0x6D95, + 0x6D88, 0x6D87, 0x6D66, 0x6D78, 0x6D77, 0x6D59, 0x6D93, ALTCHR, +/* 0xAF40 - 0xAFFF */ + 0x6D6C, 0x6D89, 0x6D6E, 0x6D5A, 0x6D74, 0x6D69, 0x6D8C, 0x6D8A, + 0x6D79, 0x6D85, 0x6D65, 0x6D94, 0x70CA, 0x70D8, 0x70E4, 0x70D9, + 0x70C8, 0x70CF, 0x7239, 0x7279, 0x72FC, 0x72F9, 0x72FD, 0x72F8, + 0x72F7, 0x7386, 0x73ED, 0x7409, 0x73EE, 0x73E0, 0x73EA, 0x73DE, + 0x7554, 0x755D, 0x755C, 0x755A, 0x7559, 0x75BE, 0x75C5, 0x75C7, + 0x75B2, 0x75B3, 0x75BD, 0x75BC, 0x75B9, 0x75C2, 0x75B8, 0x768B, + 0x76B0, 0x76CA, 0x76CD, 0x76CE, 0x7729, 0x771F, 0x7720, 0x7728, + 0x77E9, 0x7830, 0x7827, 0x7838, 0x781D, 0x7834, 0x7837, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7825, 0x782D, 0x7820, 0x781F, 0x7832, 0x7955, 0x7950, + 0x7960, 0x795F, 0x7956, 0x795E, 0x795D, 0x7957, 0x795A, 0x79E4, + 0x79E3, 0x79E7, 0x79DF, 0x79E6, 0x79E9, 0x79D8, 0x7A84, 0x7A88, + 0x7AD9, 0x7B06, 0x7B11, 0x7C89, 0x7D21, 0x7D17, 0x7D0B, 0x7D0A, + 0x7D20, 0x7D22, 0x7D14, 0x7D10, 0x7D15, 0x7D1A, 0x7D1C, 0x7D0D, + 0x7D19, 0x7D1B, 0x7F3A, 0x7F5F, 0x7F94, 0x7FC5, 0x7FC1, 0x8006, + 0x8018, 0x8015, 0x8019, 0x8017, 0x803D, 0x803F, 0x80F1, 0x8102, + 0x80F0, 0x8105, 0x80ED, 0x80F4, 0x8106, 0x80F8, 0x80F3, 0x8108, + 0x80FD, 0x810A, 0x80FC, 0x80EF, 0x81ED, 0x81EC, 0x8200, 0x8210, + 0x822A, 0x822B, 0x8228, 0x822C, 0x82BB, 0x832B, 0x8352, 0x8354, + 0x834A, 0x8338, 0x8350, 0x8349, 0x8335, 0x8334, 0x834F, 0x8332, + 0x8339, 0x8336, 0x8317, 0x8340, 0x8331, 0x8328, 0x8343, ALTCHR, +/* 0xB040 - 0xB0FF */ + 0x8654, 0x868A, 0x86AA, 0x8693, 0x86A4, 0x86A9, 0x868C, 0x86A3, + 0x869C, 0x8870, 0x8877, 0x8881, 0x8882, 0x887D, 0x8879, 0x8A18, + 0x8A10, 0x8A0E, 0x8A0C, 0x8A15, 0x8A0A, 0x8A17, 0x8A13, 0x8A16, + 0x8A0F, 0x8A11, 0x8C48, 0x8C7A, 0x8C79, 0x8CA1, 0x8CA2, 0x8D77, + 0x8EAC, 0x8ED2, 0x8ED4, 0x8ECF, 0x8FB1, 0x9001, 0x9006, 0x8FF7, + 0x9000, 0x8FFA, 0x8FF4, 0x9003, 0x8FFD, 0x9005, 0x8FF8, 0x9095, + 0x90E1, 0x90DD, 0x90E2, 0x9152, 0x914D, 0x914C, 0x91D8, 0x91DD, + 0x91D7, 0x91DC, 0x91D9, 0x9583, 0x9662, 0x9663, 0x9661, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x965B, 0x965D, 0x9664, 0x9658, 0x965E, 0x96BB, 0x98E2, + 0x99AC, 0x9AA8, 0x9AD8, 0x9B25, 0x9B32, 0x9B3C, 0x4E7E, 0x507A, + 0x507D, 0x505C, 0x5047, 0x5043, 0x504C, 0x505A, 0x5049, 0x5065, + 0x5076, 0x504E, 0x5055, 0x5075, 0x5074, 0x5077, 0x504F, 0x500F, + 0x506F, 0x506D, 0x515C, 0x5195, 0x51F0, 0x526A, 0x526F, 0x52D2, + 0x52D9, 0x52D8, 0x52D5, 0x5310, 0x530F, 0x5319, 0x533F, 0x5340, + 0x533E, 0x53C3, 0x66FC, 0x5546, 0x556A, 0x5566, 0x5544, 0x555E, + 0x5561, 0x5543, 0x554A, 0x5531, 0x5556, 0x554F, 0x5555, 0x552F, + 0x5564, 0x5538, 0x552E, 0x555C, 0x552C, 0x5563, 0x5533, 0x5541, + 0x5557, 0x5708, 0x570B, 0x5709, 0x57DF, 0x5805, 0x580A, 0x5806, + 0x57E0, 0x57E4, 0x57FA, 0x5802, 0x5835, 0x57F7, 0x57F9, 0x5920, + 0x5962, 0x5A36, 0x5A41, 0x5A49, 0x5A66, 0x5A6A, 0x5A40, ALTCHR, +/* 0xB140 - 0xB1FF */ + 0x5A3C, 0x5A62, 0x5A5A, 0x5A46, 0x5A4A, 0x5B70, 0x5BC7, 0x5BC5, + 0x5BC4, 0x5BC2, 0x5BBF, 0x5BC6, 0x5C09, 0x5C08, 0x5C07, 0x5C60, + 0x5C5C, 0x5C5D, 0x5D07, 0x5D06, 0x5D0E, 0x5D1B, 0x5D16, 0x5D22, + 0x5D11, 0x5D29, 0x5D14, 0x5D19, 0x5D24, 0x5D27, 0x5D17, 0x5DE2, + 0x5E38, 0x5E36, 0x5E33, 0x5E37, 0x5EB7, 0x5EB8, 0x5EB6, 0x5EB5, + 0x5EBE, 0x5F35, 0x5F37, 0x5F57, 0x5F6C, 0x5F69, 0x5F6B, 0x5F97, + 0x5F99, 0x5F9E, 0x5F98, 0x5FA1, 0x5FA0, 0x5F9C, 0x607F, 0x60A3, + 0x6089, 0x60A0, 0x60A8, 0x60CB, 0x60B4, 0x60E6, 0x60BD, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x60C5, 0x60BB, 0x60B5, 0x60DC, 0x60BC, 0x60D8, 0x60D5, + 0x60C6, 0x60DF, 0x60B8, 0x60DA, 0x60C7, 0x621A, 0x621B, 0x6248, + 0x63A0, 0x63A7, 0x6372, 0x6396, 0x63A2, 0x63A5, 0x6377, 0x6367, + 0x6398, 0x63AA, 0x6371, 0x63A9, 0x6389, 0x6383, 0x639B, 0x636B, + 0x63A8, 0x6384, 0x6388, 0x6399, 0x63A1, 0x63AC, 0x6392, 0x638F, + 0x6380, 0x637B, 0x6369, 0x6368, 0x637A, 0x655D, 0x6556, 0x6551, + 0x6559, 0x6557, 0x555F, 0x654F, 0x6558, 0x6555, 0x6554, 0x659C, + 0x659B, 0x65AC, 0x65CF, 0x65CB, 0x65CC, 0x65CE, 0x665D, 0x665A, + 0x6664, 0x6668, 0x6666, 0x665E, 0x66F9, 0x52D7, 0x671B, 0x6881, + 0x68AF, 0x68A2, 0x6893, 0x68B5, 0x687F, 0x6876, 0x68B1, 0x68A7, + 0x6897, 0x68B0, 0x6883, 0x68C4, 0x68AD, 0x6886, 0x6885, 0x6894, + 0x689D, 0x68A8, 0x689F, 0x68A1, 0x6882, 0x6B32, 0x6BBA, ALTCHR, +/* 0xB240 - 0xB2FF */ + 0x6BEB, 0x6BEC, 0x6C2B, 0x6D8E, 0x6DBC, 0x6DF3, 0x6DD9, 0x6DB2, + 0x6DE1, 0x6DCC, 0x6DE4, 0x6DFB, 0x6DFA, 0x6E05, 0x6DC7, 0x6DCB, + 0x6DAF, 0x6DD1, 0x6DAE, 0x6DDE, 0x6DF9, 0x6DB8, 0x6DF7, 0x6DF5, + 0x6DC5, 0x6DD2, 0x6E1A, 0x6DB5, 0x6DDA, 0x6DEB, 0x6DD8, 0x6DEA, + 0x6DF1, 0x6DEE, 0x6DE8, 0x6DC6, 0x6DC4, 0x6DAA, 0x6DEC, 0x6DBF, + 0x6DE6, 0x70F9, 0x7109, 0x710A, 0x70FD, 0x70EF, 0x723D, 0x727D, + 0x7281, 0x731C, 0x731B, 0x7316, 0x7313, 0x7319, 0x7387, 0x7405, + 0x740A, 0x7403, 0x7406, 0x73FE, 0x740D, 0x74E0, 0x74F6, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x74F7, 0x751C, 0x7522, 0x7565, 0x7566, 0x7562, 0x7570, + 0x758F, 0x75D4, 0x75D5, 0x75B5, 0x75CA, 0x75CD, 0x768E, 0x76D4, + 0x76D2, 0x76DB, 0x7737, 0x773E, 0x773C, 0x7736, 0x7738, 0x773A, + 0x786B, 0x7843, 0x784E, 0x7965, 0x7968, 0x796D, 0x79FB, 0x7A92, + 0x7A95, 0x7B20, 0x7B28, 0x7B1B, 0x7B2C, 0x7B26, 0x7B19, 0x7B1E, + 0x7B2E, 0x7C92, 0x7C97, 0x7C95, 0x7D46, 0x7D43, 0x7D71, 0x7D2E, + 0x7D39, 0x7D3C, 0x7D40, 0x7D30, 0x7D33, 0x7D44, 0x7D2F, 0x7D42, + 0x7D32, 0x7D31, 0x7F3D, 0x7F9E, 0x7F9A, 0x7FCC, 0x7FCE, 0x7FD2, + 0x801C, 0x804A, 0x8046, 0x812F, 0x8116, 0x8123, 0x812B, 0x8129, + 0x8130, 0x8124, 0x8202, 0x8235, 0x8237, 0x8236, 0x8239, 0x838E, + 0x839E, 0x8398, 0x8378, 0x83A2, 0x8396, 0x83BD, 0x83AB, 0x8392, + 0x838A, 0x8393, 0x8389, 0x83A0, 0x8377, 0x837B, 0x837C, ALTCHR, +/* 0xB340 - 0xB3FF */ + 0x8386, 0x83A7, 0x8655, 0x5F6A, 0x86C7, 0x86C0, 0x86B6, 0x86C4, + 0x86B5, 0x86C6, 0x86CB, 0x86B1, 0x86AF, 0x86C9, 0x8853, 0x889E, + 0x8888, 0x88AB, 0x8892, 0x8896, 0x888D, 0x888B, 0x8993, 0x898F, + 0x8A2A, 0x8A1D, 0x8A23, 0x8A25, 0x8A31, 0x8A2D, 0x8A1F, 0x8A1B, + 0x8A22, 0x8C49, 0x8C5A, 0x8CA9, 0x8CAC, 0x8CAB, 0x8CA8, 0x8CAA, + 0x8CA7, 0x8D67, 0x8D66, 0x8DBE, 0x8DBA, 0x8EDB, 0x8EDF, 0x9019, + 0x900D, 0x901A, 0x9017, 0x9023, 0x901F, 0x901D, 0x9010, 0x9015, + 0x901E, 0x9020, 0x900F, 0x9022, 0x9016, 0x901B, 0x9014, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x90E8, 0x90ED, 0x90FD, 0x9157, 0x91CE, 0x91F5, 0x91E6, + 0x91E3, 0x91E7, 0x91ED, 0x91E9, 0x9589, 0x966A, 0x9675, 0x9673, + 0x9678, 0x9670, 0x9674, 0x9676, 0x9677, 0x966C, 0x96C0, 0x96EA, + 0x96E9, 0x7AE0, 0x7ADF, 0x9802, 0x9803, 0x9B5A, 0x9CE5, 0x9E75, + 0x9E7F, 0x9EA5, 0x9EBB, 0x50A2, 0x508D, 0x5085, 0x5099, 0x5091, + 0x5080, 0x5096, 0x5098, 0x509A, 0x6700, 0x51F1, 0x5272, 0x5274, + 0x5275, 0x5269, 0x52DE, 0x52DD, 0x52DB, 0x535A, 0x53A5, 0x557B, + 0x5580, 0x55A7, 0x557C, 0x558A, 0x559D, 0x5598, 0x5582, 0x559C, + 0x55AA, 0x5594, 0x5587, 0x558B, 0x5583, 0x55B3, 0x55AE, 0x559F, + 0x553E, 0x55B2, 0x559A, 0x55BB, 0x55AC, 0x55B1, 0x557E, 0x5589, + 0x55AB, 0x5599, 0x570D, 0x582F, 0x582A, 0x5834, 0x5824, 0x5830, + 0x5831, 0x5821, 0x581D, 0x5820, 0x58F9, 0x58FA, 0x5960, ALTCHR, +/* 0xB440 - 0xB4FF */ + 0x5A77, 0x5A9A, 0x5A7F, 0x5A92, 0x5A9B, 0x5AA7, 0x5B73, 0x5B71, + 0x5BD2, 0x5BCC, 0x5BD3, 0x5BD0, 0x5C0A, 0x5C0B, 0x5C31, 0x5D4C, + 0x5D50, 0x5D34, 0x5D47, 0x5DFD, 0x5E45, 0x5E3D, 0x5E40, 0x5E43, + 0x5E7E, 0x5ECA, 0x5EC1, 0x5EC2, 0x5EC4, 0x5F3C, 0x5F6D, 0x5FA9, + 0x5FAA, 0x5FA8, 0x60D1, 0x60E1, 0x60B2, 0x60B6, 0x60E0, 0x611C, + 0x6123, 0x60FA, 0x6115, 0x60F0, 0x60FB, 0x60F4, 0x6168, 0x60F1, + 0x610E, 0x60F6, 0x6109, 0x6100, 0x6112, 0x621F, 0x6249, 0x63A3, + 0x638C, 0x63CF, 0x63C0, 0x63E9, 0x63C9, 0x63C6, 0x63CD, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x63D2, 0x63E3, 0x63D0, 0x63E1, 0x63D6, 0x63ED, 0x63EE, + 0x6376, 0x63F4, 0x63EA, 0x63DB, 0x6452, 0x63DA, 0x63F9, 0x655E, + 0x6566, 0x6562, 0x6563, 0x6591, 0x6590, 0x65AF, 0x666E, 0x6670, + 0x6674, 0x6676, 0x666F, 0x6691, 0x667A, 0x667E, 0x6677, 0x66FE, + 0x66FF, 0x671F, 0x671D, 0x68FA, 0x68D5, 0x68E0, 0x68D8, 0x68D7, + 0x6905, 0x68DF, 0x68F5, 0x68EE, 0x68E7, 0x68F9, 0x68D2, 0x68F2, + 0x68E3, 0x68CB, 0x68CD, 0x690D, 0x6912, 0x690E, 0x68C9, 0x68DA, + 0x696E, 0x68FB, 0x6B3E, 0x6B3A, 0x6B3D, 0x6B98, 0x6B96, 0x6BBC, + 0x6BEF, 0x6C2E, 0x6C2F, 0x6C2C, 0x6E2F, 0x6E38, 0x6E54, 0x6E21, + 0x6E32, 0x6E67, 0x6E4A, 0x6E20, 0x6E25, 0x6E23, 0x6E1B, 0x6E5B, + 0x6E58, 0x6E24, 0x6E56, 0x6E6E, 0x6E2D, 0x6E26, 0x6E6F, 0x6E34, + 0x6E4D, 0x6E3A, 0x6E2C, 0x6E43, 0x6E1D, 0x6E3E, 0x6ECB, ALTCHR, +/* 0xB540 - 0xB5FF */ + 0x6E89, 0x6E19, 0x6E4E, 0x6E63, 0x6E44, 0x6E72, 0x6E69, 0x6E5F, + 0x7119, 0x711A, 0x7126, 0x7130, 0x7121, 0x7136, 0x716E, 0x711C, + 0x724C, 0x7284, 0x7280, 0x7336, 0x7325, 0x7334, 0x7329, 0x743A, + 0x742A, 0x7433, 0x7422, 0x7425, 0x7435, 0x7436, 0x7434, 0x742F, + 0x741B, 0x7426, 0x7428, 0x7525, 0x7526, 0x756B, 0x756A, 0x75E2, + 0x75DB, 0x75E3, 0x75D9, 0x75D8, 0x75DE, 0x75E0, 0x767B, 0x767C, + 0x7696, 0x7693, 0x76B4, 0x76DC, 0x774F, 0x77ED, 0x785D, 0x786C, + 0x786F, 0x7A0D, 0x7A08, 0x7A0B, 0x7A05, 0x7A00, 0x7A98, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7A97, 0x7A96, 0x7AE5, 0x7AE3, 0x7B49, 0x7B56, 0x7B46, + 0x7B50, 0x7B52, 0x7B54, 0x7B4D, 0x7B4B, 0x7B4F, 0x7B51, 0x7C9F, + 0x7CA5, 0x7D5E, 0x7D50, 0x7D68, 0x7D55, 0x7D2B, 0x7D6E, 0x7D72, + 0x7D61, 0x7D66, 0x7D62, 0x7D70, 0x7D73, 0x5584, 0x7FD4, 0x7FD5, + 0x800B, 0x8052, 0x8085, 0x8155, 0x8154, 0x814B, 0x8151, 0x814E, + 0x8139, 0x8146, 0x813E, 0x814C, 0x8153, 0x8174, 0x8212, 0x821C, + 0x83E9, 0x8403, 0x83F8, 0x840D, 0x83E0, 0x83C5, 0x840B, 0x83C1, + 0x83EF, 0x83F1, 0x83F4, 0x8457, 0x840A, 0x83F0, 0x840C, 0x83CC, + 0x83FD, 0x83F2, 0x83CA, 0x8438, 0x840E, 0x8404, 0x83DC, 0x8407, + 0x83D4, 0x83DF, 0x865B, 0x86DF, 0x86D9, 0x86ED, 0x86D4, 0x86DB, + 0x86E4, 0x86D0, 0x86DE, 0x8857, 0x88C1, 0x88C2, 0x88B1, 0x8983, + 0x8996, 0x8A3B, 0x8A60, 0x8A55, 0x8A5E, 0x8A3C, 0x8A41, ALTCHR, +/* 0xB640 - 0xB6FF */ + 0x8A54, 0x8A5B, 0x8A50, 0x8A46, 0x8A34, 0x8A3A, 0x8A36, 0x8A56, + 0x8C61, 0x8C82, 0x8CAF, 0x8CBC, 0x8CB3, 0x8CBD, 0x8CC1, 0x8CBB, + 0x8CC0, 0x8CB4, 0x8CB7, 0x8CB6, 0x8CBF, 0x8CB8, 0x8D8A, 0x8D85, + 0x8D81, 0x8DCE, 0x8DDD, 0x8DCB, 0x8DDA, 0x8DD1, 0x8DCC, 0x8DDB, + 0x8DC6, 0x8EFB, 0x8EF8, 0x8EFC, 0x8F9C, 0x902E, 0x9035, 0x9031, + 0x9038, 0x9032, 0x9036, 0x9102, 0x90F5, 0x9109, 0x90FE, 0x9163, + 0x9165, 0x91CF, 0x9214, 0x9215, 0x9223, 0x9209, 0x921E, 0x920D, + 0x9210, 0x9207, 0x9211, 0x9594, 0x958F, 0x958B, 0x9591, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9593, 0x9592, 0x958E, 0x968A, 0x968E, 0x968B, 0x967D, + 0x9685, 0x9686, 0x968D, 0x9672, 0x9684, 0x96C1, 0x96C5, 0x96C4, + 0x96C6, 0x96C7, 0x96EF, 0x96F2, 0x97CC, 0x9805, 0x9806, 0x9808, + 0x98E7, 0x98EA, 0x98EF, 0x98E9, 0x98F2, 0x98ED, 0x99AE, 0x99AD, + 0x9EC3, 0x9ECD, 0x9ED1, 0x4E82, 0x50AD, 0x50B5, 0x50B2, 0x50B3, + 0x50C5, 0x50BE, 0x50AC, 0x50B7, 0x50BB, 0x50AF, 0x50C7, 0x527F, + 0x5277, 0x527D, 0x52DF, 0x52E6, 0x52E4, 0x52E2, 0x52E3, 0x532F, + 0x55DF, 0x55E8, 0x55D3, 0x55E6, 0x55CE, 0x55DC, 0x55C7, 0x55D1, + 0x55E3, 0x55E4, 0x55EF, 0x55DA, 0x55E1, 0x55C5, 0x55C6, 0x55E5, + 0x55C9, 0x5712, 0x5713, 0x585E, 0x5851, 0x5858, 0x5857, 0x585A, + 0x5854, 0x586B, 0x584C, 0x586D, 0x584A, 0x5862, 0x5852, 0x584B, + 0x5967, 0x5AC1, 0x5AC9, 0x5ACC, 0x5ABE, 0x5ABD, 0x5ABC, ALTCHR, +/* 0xB740 - 0xB7FF */ + 0x5AB3, 0x5AC2, 0x5AB2, 0x5D69, 0x5D6F, 0x5E4C, 0x5E79, 0x5EC9, + 0x5EC8, 0x5F12, 0x5F59, 0x5FAC, 0x5FAE, 0x611A, 0x610F, 0x6148, + 0x611F, 0x60F3, 0x611B, 0x60F9, 0x6101, 0x6108, 0x614E, 0x614C, + 0x6144, 0x614D, 0x613E, 0x6134, 0x6127, 0x610D, 0x6106, 0x6137, + 0x6221, 0x6222, 0x6413, 0x643E, 0x641E, 0x642A, 0x642D, 0x643D, + 0x642C, 0x640F, 0x641C, 0x6414, 0x640D, 0x6436, 0x6416, 0x6417, + 0x6406, 0x656C, 0x659F, 0x65B0, 0x6697, 0x6689, 0x6687, 0x6688, + 0x6696, 0x6684, 0x6698, 0x668D, 0x6703, 0x6994, 0x696D, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x695A, 0x6977, 0x6960, 0x6954, 0x6975, 0x6930, 0x6982, + 0x694A, 0x6968, 0x696B, 0x695E, 0x6953, 0x6979, 0x6986, 0x695D, + 0x6963, 0x695B, 0x6B47, 0x6B72, 0x6BC0, 0x6BBF, 0x6BD3, 0x6BFD, + 0x6EA2, 0x6EAF, 0x6ED3, 0x6EB6, 0x6EC2, 0x6E90, 0x6E9D, 0x6EC7, + 0x6EC5, 0x6EA5, 0x6E98, 0x6EBC, 0x6EBA, 0x6EAB, 0x6ED1, 0x6E96, + 0x6E9C, 0x6EC4, 0x6ED4, 0x6EAA, 0x6EA7, 0x6EB4, 0x714E, 0x7159, + 0x7169, 0x7164, 0x7149, 0x7167, 0x715C, 0x716C, 0x7166, 0x714C, + 0x7165, 0x715E, 0x7146, 0x7168, 0x7156, 0x723A, 0x7252, 0x7337, + 0x7345, 0x733F, 0x733E, 0x746F, 0x745A, 0x7455, 0x745F, 0x745E, + 0x7441, 0x743F, 0x7459, 0x745B, 0x745C, 0x7576, 0x7578, 0x7600, + 0x75F0, 0x7601, 0x75F2, 0x75F1, 0x75FA, 0x75FF, 0x75F4, 0x75F3, + 0x76DE, 0x76DF, 0x775B, 0x776B, 0x7766, 0x775E, 0x7763, ALTCHR, +/* 0xB840 - 0xB8FF */ + 0x7779, 0x776A, 0x776C, 0x775C, 0x7765, 0x7768, 0x7762, 0x77EE, + 0x788E, 0x78B0, 0x7897, 0x7898, 0x788C, 0x7889, 0x787C, 0x7891, + 0x7893, 0x787F, 0x797A, 0x797F, 0x7981, 0x842C, 0x79BD, 0x7A1C, + 0x7A1A, 0x7A20, 0x7A14, 0x7A1F, 0x7A1E, 0x7A9F, 0x7AA0, 0x7B77, + 0x7BC0, 0x7B60, 0x7B6E, 0x7B67, 0x7CB1, 0x7CB3, 0x7CB5, 0x7D93, + 0x7D79, 0x7D91, 0x7D81, 0x7D8F, 0x7D5B, 0x7F6E, 0x7F69, 0x7F6A, + 0x7F72, 0x7FA9, 0x7FA8, 0x7FA4, 0x8056, 0x8058, 0x8086, 0x8084, + 0x8171, 0x8170, 0x8178, 0x8165, 0x816E, 0x8173, 0x816B, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8179, 0x817A, 0x8166, 0x8205, 0x8247, 0x8482, 0x8477, + 0x843D, 0x8431, 0x8475, 0x8466, 0x846B, 0x8449, 0x846C, 0x845B, + 0x843C, 0x8435, 0x8461, 0x8463, 0x8469, 0x846D, 0x8446, 0x865E, + 0x865C, 0x865F, 0x86F9, 0x8713, 0x8708, 0x8707, 0x8700, 0x86FE, + 0x86FB, 0x8702, 0x8703, 0x8706, 0x870A, 0x8859, 0x88DF, 0x88D4, + 0x88D9, 0x88DC, 0x88D8, 0x88DD, 0x88E1, 0x88CA, 0x88D5, 0x88D2, + 0x899C, 0x89E3, 0x8A6B, 0x8A72, 0x8A73, 0x8A66, 0x8A69, 0x8A70, + 0x8A87, 0x8A7C, 0x8A63, 0x8AA0, 0x8A71, 0x8A85, 0x8A6D, 0x8A62, + 0x8A6E, 0x8A6C, 0x8A79, 0x8A7B, 0x8A3E, 0x8A68, 0x8C62, 0x8C8A, + 0x8C89, 0x8CCA, 0x8CC7, 0x8CC8, 0x8CC4, 0x8CB2, 0x8CC3, 0x8CC2, + 0x8CC5, 0x8DE1, 0x8DDF, 0x8DE8, 0x8DEF, 0x8DF3, 0x8DFA, 0x8DEA, + 0x8DE4, 0x8DE6, 0x8EB2, 0x8F03, 0x8F09, 0x8EFE, 0x8F0A, ALTCHR, +/* 0xB940 - 0xB9FF */ + 0x8F9F, 0x8FB2, 0x904B, 0x904A, 0x9053, 0x9042, 0x9054, 0x903C, + 0x9055, 0x9050, 0x9047, 0x904F, 0x904E, 0x904D, 0x9051, 0x903E, + 0x9041, 0x9112, 0x9117, 0x916C, 0x916A, 0x9169, 0x91C9, 0x9237, + 0x9257, 0x9238, 0x923D, 0x9240, 0x923E, 0x925B, 0x924B, 0x9264, + 0x9251, 0x9234, 0x9249, 0x924D, 0x9245, 0x9239, 0x923F, 0x925A, + 0x9598, 0x9698, 0x9694, 0x9695, 0x96CD, 0x96CB, 0x96C9, 0x96CA, + 0x96F7, 0x96FB, 0x96F9, 0x96F6, 0x9756, 0x9774, 0x9776, 0x9810, + 0x9811, 0x9813, 0x980A, 0x9812, 0x980C, 0x98FC, 0x98F4, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x98FD, 0x98FE, 0x99B3, 0x99B1, 0x99B4, 0x9AE1, 0x9CE9, + 0x9E82, 0x9F0E, 0x9F13, 0x9F20, 0x50E7, 0x50EE, 0x50E5, 0x50D6, + 0x50ED, 0x50DA, 0x50D5, 0x50CF, 0x50D1, 0x50F1, 0x50CE, 0x50E9, + 0x5162, 0x51F3, 0x5283, 0x5282, 0x5331, 0x53AD, 0x55FE, 0x5600, + 0x561B, 0x5617, 0x55FD, 0x5614, 0x5606, 0x5609, 0x560D, 0x560E, + 0x55F7, 0x5616, 0x561F, 0x5608, 0x5610, 0x55F6, 0x5718, 0x5716, + 0x5875, 0x587E, 0x5883, 0x5893, 0x588A, 0x5879, 0x5885, 0x587D, + 0x58FD, 0x5925, 0x5922, 0x5924, 0x596A, 0x5969, 0x5AE1, 0x5AE6, + 0x5AE9, 0x5AD7, 0x5AD6, 0x5AD8, 0x5AE3, 0x5B75, 0x5BDE, 0x5BE7, + 0x5BE1, 0x5BE5, 0x5BE6, 0x5BE8, 0x5BE2, 0x5BE4, 0x5BDF, 0x5C0D, + 0x5C62, 0x5D84, 0x5D87, 0x5E5B, 0x5E63, 0x5E55, 0x5E57, 0x5E54, + 0x5ED3, 0x5ED6, 0x5F0A, 0x5F46, 0x5F70, 0x5FB9, 0x6147, ALTCHR, +/* 0xBA40 - 0xBAFF */ + 0x613F, 0x614B, 0x6177, 0x6162, 0x6163, 0x615F, 0x615A, 0x6158, + 0x6175, 0x622A, 0x6487, 0x6458, 0x6454, 0x64A4, 0x6478, 0x645F, + 0x647A, 0x6451, 0x6467, 0x6434, 0x646D, 0x647B, 0x6572, 0x65A1, + 0x65D7, 0x65D6, 0x66A2, 0x66A8, 0x669D, 0x699C, 0x69A8, 0x6995, + 0x69C1, 0x69AE, 0x69D3, 0x69CB, 0x699B, 0x69B7, 0x69BB, 0x69AB, + 0x69B4, 0x69D0, 0x69CD, 0x69AD, 0x69CC, 0x69A6, 0x69C3, 0x69A3, + 0x6B49, 0x6B4C, 0x6C33, 0x6F33, 0x6F14, 0x6EFE, 0x6F13, 0x6EF4, + 0x6F29, 0x6F3E, 0x6F20, 0x6F2C, 0x6F0F, 0x6F02, 0x6F22, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6EFF, 0x6EEF, 0x6F06, 0x6F31, 0x6F38, 0x6F32, 0x6F23, + 0x6F15, 0x6F2B, 0x6F2F, 0x6F88, 0x6F2A, 0x6EEC, 0x6F01, 0x6EF2, + 0x6ECC, 0x6EF7, 0x7194, 0x7199, 0x717D, 0x718A, 0x7184, 0x7192, + 0x723E, 0x7292, 0x7296, 0x7344, 0x7350, 0x7464, 0x7463, 0x746A, + 0x7470, 0x746D, 0x7504, 0x7591, 0x7627, 0x760D, 0x760B, 0x7609, + 0x7613, 0x76E1, 0x76E3, 0x7784, 0x777D, 0x777F, 0x7761, 0x78C1, + 0x789F, 0x78A7, 0x78B3, 0x78A9, 0x78A3, 0x798E, 0x798F, 0x798D, + 0x7A2E, 0x7A31, 0x7AAA, 0x7AA9, 0x7AED, 0x7AEF, 0x7BA1, 0x7B95, + 0x7B8B, 0x7B75, 0x7B97, 0x7B9D, 0x7B94, 0x7B8F, 0x7BB8, 0x7B87, + 0x7B84, 0x7CB9, 0x7CBD, 0x7CBE, 0x7DBB, 0x7DB0, 0x7D9C, 0x7DBD, + 0x7DBE, 0x7DA0, 0x7DCA, 0x7DB4, 0x7DB2, 0x7DB1, 0x7DBA, 0x7DA2, + 0x7DBF, 0x7DB5, 0x7DB8, 0x7DAD, 0x7DD2, 0x7DC7, 0x7DAC, ALTCHR, +/* 0xBB40 - 0xBBFF */ + 0x7F70, 0x7FE0, 0x7FE1, 0x7FDF, 0x805E, 0x805A, 0x8087, 0x8150, + 0x8180, 0x818F, 0x8188, 0x818A, 0x817F, 0x8182, 0x81E7, 0x81FA, + 0x8207, 0x8214, 0x821E, 0x824B, 0x84C9, 0x84BF, 0x84C6, 0x84C4, + 0x8499, 0x849E, 0x84B2, 0x849C, 0x84CB, 0x84B8, 0x84C0, 0x84D3, + 0x8490, 0x84BC, 0x84D1, 0x84CA, 0x873F, 0x871C, 0x873B, 0x8722, + 0x8725, 0x8734, 0x8718, 0x8755, 0x8737, 0x8729, 0x88F3, 0x8902, + 0x88F4, 0x88F9, 0x88F8, 0x88FD, 0x88E8, 0x891A, 0x88EF, 0x8AA6, + 0x8A8C, 0x8A9E, 0x8AA3, 0x8A8D, 0x8AA1, 0x8A93, 0x8AA4, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8AAA, 0x8AA5, 0x8AA8, 0x8A98, 0x8A91, 0x8A9A, 0x8AA7, + 0x8C6A, 0x8C8D, 0x8C8C, 0x8CD3, 0x8CD1, 0x8CD2, 0x8D6B, 0x8D99, + 0x8D95, 0x8DFC, 0x8F14, 0x8F12, 0x8F15, 0x8F13, 0x8FA3, 0x9060, + 0x9058, 0x905C, 0x9063, 0x9059, 0x905E, 0x9062, 0x905D, 0x905B, + 0x9119, 0x9118, 0x911E, 0x9175, 0x9178, 0x9177, 0x9174, 0x9278, + 0x9280, 0x9285, 0x9298, 0x9296, 0x927B, 0x9293, 0x929C, 0x92A8, + 0x927C, 0x9291, 0x95A1, 0x95A8, 0x95A9, 0x95A3, 0x95A5, 0x95A4, + 0x9699, 0x969C, 0x969B, 0x96CC, 0x96D2, 0x9700, 0x977C, 0x9785, + 0x97F6, 0x9817, 0x9818, 0x98AF, 0x98B1, 0x9903, 0x9905, 0x990C, + 0x9909, 0x99C1, 0x9AAF, 0x9AB0, 0x9AE6, 0x9B41, 0x9B42, 0x9CF4, + 0x9CF6, 0x9CF3, 0x9EBC, 0x9F3B, 0x9F4A, 0x5104, 0x5100, 0x50FB, + 0x50F5, 0x50F9, 0x5102, 0x5108, 0x5109, 0x5105, 0x51DC, ALTCHR, +/* 0xBC40 - 0xBCFF */ + 0x5287, 0x5288, 0x5289, 0x528D, 0x528A, 0x52F0, 0x53B2, 0x562E, + 0x563B, 0x5639, 0x5632, 0x563F, 0x5634, 0x5629, 0x5653, 0x564E, + 0x5657, 0x5674, 0x5636, 0x562F, 0x5630, 0x5880, 0x589F, 0x589E, + 0x58B3, 0x589C, 0x58AE, 0x58A9, 0x58A6, 0x596D, 0x5B09, 0x5AFB, + 0x5B0B, 0x5AF5, 0x5B0C, 0x5B08, 0x5BEE, 0x5BEC, 0x5BE9, 0x5BEB, + 0x5C64, 0x5C65, 0x5D9D, 0x5D94, 0x5E62, 0x5E5F, 0x5E61, 0x5EE2, + 0x5EDA, 0x5EDF, 0x5EDD, 0x5EE3, 0x5EE0, 0x5F48, 0x5F71, 0x5FB7, + 0x5FB5, 0x6176, 0x6167, 0x616E, 0x615D, 0x6155, 0x6182, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x617C, 0x6170, 0x616B, 0x617E, 0x61A7, 0x6190, 0x61AB, + 0x618E, 0x61AC, 0x619A, 0x61A4, 0x6194, 0x61AE, 0x622E, 0x6469, + 0x646F, 0x6479, 0x649E, 0x64B2, 0x6488, 0x6490, 0x64B0, 0x64A5, + 0x6493, 0x6495, 0x64A9, 0x6492, 0x64AE, 0x64AD, 0x64AB, 0x649A, + 0x64AC, 0x6499, 0x64A2, 0x64B3, 0x6575, 0x6577, 0x6578, 0x66AE, + 0x66AB, 0x66B4, 0x66B1, 0x6A23, 0x6A1F, 0x69E8, 0x6A01, 0x6A1E, + 0x6A19, 0x69FD, 0x6A21, 0x6A13, 0x6A0A, 0x69F3, 0x6A02, 0x6A05, + 0x69ED, 0x6A11, 0x6B50, 0x6B4E, 0x6BA4, 0x6BC5, 0x6BC6, 0x6F3F, + 0x6F7C, 0x6F84, 0x6F51, 0x6F66, 0x6F54, 0x6F86, 0x6F6D, 0x6F5B, + 0x6F78, 0x6F6E, 0x6F8E, 0x6F7A, 0x6F70, 0x6F64, 0x6F97, 0x6F58, + 0x6ED5, 0x6F6F, 0x6F60, 0x6F5F, 0x719F, 0x71AC, 0x71B1, 0x71A8, + 0x7256, 0x729B, 0x734E, 0x7357, 0x7469, 0x748B, 0x7483, ALTCHR, +/* 0xBD40 - 0xBDFF */ + 0x747E, 0x7480, 0x757F, 0x7620, 0x7629, 0x761F, 0x7624, 0x7626, + 0x7621, 0x7622, 0x769A, 0x76BA, 0x76E4, 0x778E, 0x7787, 0x778C, + 0x7791, 0x778B, 0x78CB, 0x78C5, 0x78BA, 0x78CA, 0x78BE, 0x78D5, + 0x78BC, 0x78D0, 0x7A3F, 0x7A3C, 0x7A40, 0x7A3D, 0x7A37, 0x7A3B, + 0x7AAF, 0x7AAE, 0x7BAD, 0x7BB1, 0x7BC4, 0x7BB4, 0x7BC6, 0x7BC7, + 0x7BC1, 0x7BA0, 0x7BCC, 0x7CCA, 0x7DE0, 0x7DF4, 0x7DEF, 0x7DFB, + 0x7DD8, 0x7DEC, 0x7DDD, 0x7DE8, 0x7DE3, 0x7DDA, 0x7DDE, 0x7DE9, + 0x7D9E, 0x7DD9, 0x7DF2, 0x7DF9, 0x7F75, 0x7F77, 0x7FAF, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7FE9, 0x8026, 0x819B, 0x819C, 0x819D, 0x81A0, 0x819A, + 0x8198, 0x8517, 0x853D, 0x851A, 0x84EE, 0x852C, 0x852D, 0x8513, + 0x8511, 0x8523, 0x8521, 0x8514, 0x84EC, 0x8525, 0x84FF, 0x8506, + 0x8782, 0x8774, 0x8776, 0x8760, 0x8766, 0x8778, 0x8768, 0x8759, + 0x8757, 0x874C, 0x8753, 0x885B, 0x885D, 0x8910, 0x8907, 0x8912, + 0x8913, 0x8915, 0x890A, 0x8ABC, 0x8AD2, 0x8AC7, 0x8AC4, 0x8A95, + 0x8ACB, 0x8AF8, 0x8AB2, 0x8AC9, 0x8AC2, 0x8ABF, 0x8AB0, 0x8AD6, + 0x8ACD, 0x8AB6, 0x8AB9, 0x8ADB, 0x8C4C, 0x8C4E, 0x8C6C, 0x8CE0, + 0x8CDE, 0x8CE6, 0x8CE4, 0x8CEC, 0x8CED, 0x8CE2, 0x8CE3, 0x8CDC, + 0x8CEA, 0x8CE1, 0x8D6D, 0x8D9F, 0x8DA3, 0x8E2B, 0x8E10, 0x8E1D, + 0x8E22, 0x8E0F, 0x8E29, 0x8E1F, 0x8E21, 0x8E1E, 0x8EBA, 0x8F1D, + 0x8F1B, 0x8F1F, 0x8F29, 0x8F26, 0x8F2A, 0x8F1C, 0x8F1E, ALTCHR, +/* 0xBE40 - 0xBEFF */ + 0x8F25, 0x9069, 0x906E, 0x9068, 0x906D, 0x9077, 0x9130, 0x912D, + 0x9127, 0x9131, 0x9187, 0x9189, 0x918B, 0x9183, 0x92C5, 0x92BB, + 0x92B7, 0x92EA, 0x92AC, 0x92E4, 0x92C1, 0x92B3, 0x92BC, 0x92D2, + 0x92C7, 0x92F0, 0x92B2, 0x95AD, 0x95B1, 0x9704, 0x9706, 0x9707, + 0x9709, 0x9760, 0x978D, 0x978B, 0x978F, 0x9821, 0x982B, 0x981C, + 0x98B3, 0x990A, 0x9913, 0x9912, 0x9918, 0x99DD, 0x99D0, 0x99DF, + 0x99DB, 0x99D1, 0x99D5, 0x99D2, 0x99D9, 0x9AB7, 0x9AEE, 0x9AEF, + 0x9B27, 0x9B45, 0x9B44, 0x9B77, 0x9B6F, 0x9D06, 0x9D09, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9D03, 0x9EA9, 0x9EBE, 0x9ECE, 0x58A8, 0x9F52, 0x5112, + 0x5118, 0x5114, 0x5110, 0x5115, 0x5180, 0x51AA, 0x51DD, 0x5291, + 0x5293, 0x52F3, 0x5659, 0x566B, 0x5679, 0x5669, 0x5664, 0x5678, + 0x566A, 0x5668, 0x5665, 0x5671, 0x566F, 0x566C, 0x5662, 0x5676, + 0x58C1, 0x58BE, 0x58C7, 0x58C5, 0x596E, 0x5B1D, 0x5B34, 0x5B78, + 0x5BF0, 0x5C0E, 0x5F4A, 0x61B2, 0x6191, 0x61A9, 0x618A, 0x61CD, + 0x61B6, 0x61BE, 0x61CA, 0x61C8, 0x6230, 0x64C5, 0x64C1, 0x64CB, + 0x64BB, 0x64BC, 0x64DA, 0x64C4, 0x64C7, 0x64C2, 0x64CD, 0x64BF, + 0x64D2, 0x64D4, 0x64BE, 0x6574, 0x66C6, 0x66C9, 0x66B9, 0x66C4, + 0x66C7, 0x66B8, 0x6A3D, 0x6A38, 0x6A3A, 0x6A59, 0x6A6B, 0x6A58, + 0x6A39, 0x6A44, 0x6A62, 0x6A61, 0x6A4B, 0x6A47, 0x6A35, 0x6A5F, + 0x6A48, 0x6B59, 0x6B77, 0x6C05, 0x6FC2, 0x6FB1, 0x6FA1, ALTCHR, +/* 0xBF40 - 0xBFFF */ + 0x6FC3, 0x6FA4, 0x6FC1, 0x6FA7, 0x6FB3, 0x6FC0, 0x6FB9, 0x6FB6, + 0x6FA6, 0x6FA0, 0x6FB4, 0x71BE, 0x71C9, 0x71D0, 0x71D2, 0x71C8, + 0x71D5, 0x71B9, 0x71CE, 0x71D9, 0x71DC, 0x71C3, 0x71C4, 0x7368, + 0x749C, 0x74A3, 0x7498, 0x749F, 0x749E, 0x74E2, 0x750C, 0x750D, + 0x7634, 0x7638, 0x763A, 0x76E7, 0x76E5, 0x77A0, 0x779E, 0x779F, + 0x77A5, 0x78E8, 0x78DA, 0x78EC, 0x78E7, 0x79A6, 0x7A4D, 0x7A4E, + 0x7A46, 0x7A4C, 0x7A4B, 0x7ABA, 0x7BD9, 0x7C11, 0x7BC9, 0x7BE4, + 0x7BDB, 0x7BE1, 0x7BE9, 0x7BE6, 0x7CD5, 0x7CD6, 0x7E0A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7E11, 0x7E08, 0x7E1B, 0x7E23, 0x7E1E, 0x7E1D, 0x7E09, + 0x7E10, 0x7F79, 0x7FB2, 0x7FF0, 0x7FF1, 0x7FEE, 0x8028, 0x81B3, + 0x81A9, 0x81A8, 0x81FB, 0x8208, 0x8258, 0x8259, 0x854A, 0x8559, + 0x8548, 0x8568, 0x8569, 0x8543, 0x8549, 0x856D, 0x856A, 0x855E, + 0x8783, 0x879F, 0x879E, 0x87A2, 0x878D, 0x8861, 0x892A, 0x8932, + 0x8925, 0x892B, 0x8921, 0x89AA, 0x89A6, 0x8AE6, 0x8AFA, 0x8AEB, + 0x8AF1, 0x8B00, 0x8ADC, 0x8AE7, 0x8AEE, 0x8AFE, 0x8B01, 0x8B02, + 0x8AF7, 0x8AED, 0x8AF3, 0x8AF6, 0x8AFC, 0x8C6B, 0x8C6D, 0x8C93, + 0x8CF4, 0x8E44, 0x8E31, 0x8E34, 0x8E42, 0x8E39, 0x8E35, 0x8F3B, + 0x8F2F, 0x8F38, 0x8F33, 0x8FA8, 0x8FA6, 0x9075, 0x9074, 0x9078, + 0x9072, 0x907C, 0x907A, 0x9134, 0x9192, 0x9320, 0x9336, 0x92F8, + 0x9333, 0x932F, 0x9322, 0x92FC, 0x932B, 0x9304, 0x931A, ALTCHR, +/* 0xC040 - 0xC0FF */ + 0x9310, 0x9326, 0x9321, 0x9315, 0x932E, 0x9319, 0x95BB, 0x96A7, + 0x96A8, 0x96AA, 0x96D5, 0x970E, 0x9711, 0x9716, 0x970D, 0x9713, + 0x970F, 0x975B, 0x975C, 0x9766, 0x9798, 0x9830, 0x9838, 0x983B, + 0x9837, 0x982D, 0x9839, 0x9824, 0x9910, 0x9928, 0x991E, 0x991B, + 0x9921, 0x991A, 0x99ED, 0x99E2, 0x99F1, 0x9AB8, 0x9ABC, 0x9AFB, + 0x9AED, 0x9B28, 0x9B91, 0x9D15, 0x9D23, 0x9D26, 0x9D28, 0x9D12, + 0x9D1B, 0x9ED8, 0x9ED4, 0x9F8D, 0x9F9C, 0x512A, 0x511F, 0x5121, + 0x5132, 0x52F5, 0x568E, 0x5680, 0x5690, 0x5685, 0x5687, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x568F, 0x58D5, 0x58D3, 0x58D1, 0x58CE, 0x5B30, 0x5B2A, + 0x5B24, 0x5B7A, 0x5C37, 0x5C68, 0x5DBC, 0x5DBA, 0x5DBD, 0x5DB8, + 0x5E6B, 0x5F4C, 0x5FBD, 0x61C9, 0x61C2, 0x61C7, 0x61E6, 0x61CB, + 0x6232, 0x6234, 0x64CE, 0x64CA, 0x64D8, 0x64E0, 0x64F0, 0x64E6, + 0x64EC, 0x64F1, 0x64E2, 0x64ED, 0x6582, 0x6583, 0x66D9, 0x66D6, + 0x6A80, 0x6A94, 0x6A84, 0x6AA2, 0x6A9C, 0x6ADB, 0x6AA3, 0x6A7E, + 0x6A97, 0x6A90, 0x6AA0, 0x6B5C, 0x6BAE, 0x6BDA, 0x6C08, 0x6FD8, + 0x6FF1, 0x6FDF, 0x6FE0, 0x6FDB, 0x6FE4, 0x6FEB, 0x6FEF, 0x6F80, + 0x6FEC, 0x6FE1, 0x6FE9, 0x6FD5, 0x6FEE, 0x6FF0, 0x71E7, 0x71DF, + 0x71EE, 0x71E6, 0x71E5, 0x71ED, 0x71EC, 0x71F4, 0x71E0, 0x7235, + 0x7246, 0x7370, 0x7372, 0x74A9, 0x74B0, 0x74A6, 0x74A8, 0x7646, + 0x7642, 0x764C, 0x76EA, 0x77B3, 0x77AA, 0x77B0, 0x77AC, ALTCHR, +/* 0xC140 - 0xC1FF */ + 0x77A7, 0x77AD, 0x77EF, 0x78F7, 0x78FA, 0x78F4, 0x78EF, 0x7901, + 0x79A7, 0x79AA, 0x7A57, 0x7ABF, 0x7C07, 0x7C0D, 0x7BFE, 0x7BF7, + 0x7C0C, 0x7BE0, 0x7CE0, 0x7CDC, 0x7CDE, 0x7CE2, 0x7CDF, 0x7CD9, + 0x7CDD, 0x7E2E, 0x7E3E, 0x7E46, 0x7E37, 0x7E32, 0x7E43, 0x7E2B, + 0x7E3D, 0x7E31, 0x7E45, 0x7E41, 0x7E34, 0x7E39, 0x7E48, 0x7E35, + 0x7E3F, 0x7E2F, 0x7F44, 0x7FF3, 0x7FFC, 0x8071, 0x8072, 0x8070, + 0x806F, 0x8073, 0x81C6, 0x81C3, 0x81BA, 0x81C2, 0x81C0, 0x81BF, + 0x81BD, 0x81C9, 0x81BE, 0x81E8, 0x8209, 0x8271, 0x85AA, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8584, 0x857E, 0x859C, 0x8591, 0x8594, 0x85AF, 0x859B, + 0x8587, 0x85A8, 0x858A, 0x8667, 0x87C0, 0x87D1, 0x87B3, 0x87D2, + 0x87C6, 0x87AB, 0x87BB, 0x87BA, 0x87C8, 0x87CB, 0x893B, 0x8936, + 0x8944, 0x8938, 0x893D, 0x89AC, 0x8B0E, 0x8B17, 0x8B19, 0x8B1B, + 0x8B0A, 0x8B20, 0x8B1D, 0x8B04, 0x8B10, 0x8C41, 0x8C3F, 0x8C73, + 0x8CFA, 0x8CFD, 0x8CFC, 0x8CF8, 0x8CFB, 0x8DA8, 0x8E49, 0x8E4B, + 0x8E48, 0x8E4A, 0x8F44, 0x8F3E, 0x8F42, 0x8F45, 0x8F3F, 0x907F, + 0x907D, 0x9084, 0x9081, 0x9082, 0x9080, 0x9139, 0x91A3, 0x919E, + 0x919C, 0x934D, 0x9382, 0x9328, 0x9375, 0x934A, 0x9365, 0x934B, + 0x9318, 0x937E, 0x936C, 0x935B, 0x9370, 0x935A, 0x9354, 0x95CA, + 0x95CB, 0x95CC, 0x95C8, 0x95C6, 0x96B1, 0x96B8, 0x96D6, 0x971C, + 0x971E, 0x97A0, 0x97D3, 0x9846, 0x98B6, 0x9935, 0x9A01, ALTCHR, +/* 0xC240 - 0xC2FF */ + 0x99FF, 0x9BAE, 0x9BAB, 0x9BAA, 0x9BAD, 0x9D3B, 0x9D3F, 0x9E8B, + 0x9ECF, 0x9EDE, 0x9EDC, 0x9EDD, 0x9EDB, 0x9F3E, 0x9F4B, 0x53E2, + 0x5695, 0x56AE, 0x58D9, 0x58D8, 0x5B38, 0x5F5D, 0x61E3, 0x6233, + 0x64F4, 0x64F2, 0x64FE, 0x6506, 0x64FA, 0x64FB, 0x64F7, 0x65B7, + 0x66DC, 0x6726, 0x6AB3, 0x6AAC, 0x6AC3, 0x6ABB, 0x6AB8, 0x6AC2, + 0x6AAE, 0x6AAF, 0x6B5F, 0x6B78, 0x6BAF, 0x7009, 0x700B, 0x6FFE, + 0x7006, 0x6FFA, 0x7011, 0x700F, 0x71FB, 0x71FC, 0x71FE, 0x71F8, + 0x7377, 0x7375, 0x74A7, 0x74BF, 0x7515, 0x7656, 0x7658, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7652, 0x77BD, 0x77BF, 0x77BB, 0x77BC, 0x790E, 0x79AE, + 0x7A61, 0x7A62, 0x7A60, 0x7AC4, 0x7AC5, 0x7C2B, 0x7C27, 0x7C2A, + 0x7C1E, 0x7C23, 0x7C21, 0x7CE7, 0x7E54, 0x7E55, 0x7E5E, 0x7E5A, + 0x7E61, 0x7E52, 0x7E59, 0x7F48, 0x7FF9, 0x7FFB, 0x8077, 0x8076, + 0x81CD, 0x81CF, 0x820A, 0x85CF, 0x85A9, 0x85CD, 0x85D0, 0x85C9, + 0x85B0, 0x85BA, 0x85B9, 0x85A6, 0x87EF, 0x87EC, 0x87F2, 0x87E0, + 0x8986, 0x89B2, 0x89F4, 0x8B28, 0x8B39, 0x8B2C, 0x8B2B, 0x8C50, + 0x8D05, 0x8E59, 0x8E63, 0x8E66, 0x8E64, 0x8E5F, 0x8E55, 0x8EC0, + 0x8F49, 0x8F4D, 0x9087, 0x9083, 0x9088, 0x91AB, 0x91AC, 0x91D0, + 0x9394, 0x938A, 0x9396, 0x93A2, 0x93B3, 0x93AE, 0x93AC, 0x93B0, + 0x9398, 0x939A, 0x9397, 0x95D4, 0x95D6, 0x95D0, 0x95D5, 0x96E2, + 0x96DC, 0x96D9, 0x96DB, 0x96DE, 0x9724, 0x97A3, 0x97A6, ALTCHR, +/* 0xC340 - 0xC3FF */ + 0x97AD, 0x97F9, 0x984D, 0x984F, 0x984C, 0x984E, 0x9853, 0x98BA, + 0x993E, 0x993F, 0x993D, 0x992E, 0x99A5, 0x9A0E, 0x9AC1, 0x9B03, + 0x9B06, 0x9B4F, 0x9B4E, 0x9B4D, 0x9BCA, 0x9BC9, 0x9BFD, 0x9BC8, + 0x9BC0, 0x9D51, 0x9D5D, 0x9D60, 0x9EE0, 0x9F15, 0x9F2C, 0x5133, + 0x56A5, 0x58DE, 0x58DF, 0x58E2, 0x5BF5, 0x9F90, 0x5EEC, 0x61F2, + 0x61F7, 0x61F6, 0x61F5, 0x6500, 0x650F, 0x66E0, 0x66DD, 0x6AE5, + 0x6ADD, 0x6ADA, 0x6AD3, 0x701B, 0x701F, 0x7028, 0x701A, 0x701D, + 0x7015, 0x7018, 0x7206, 0x720D, 0x7258, 0x72A2, 0x7378, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x737A, 0x74BD, 0x74CA, 0x74E3, 0x7587, 0x7586, 0x765F, + 0x7661, 0x77C7, 0x7919, 0x79B1, 0x7A6B, 0x7A69, 0x7C3E, 0x7C3F, + 0x7C38, 0x7C3D, 0x7C37, 0x7C40, 0x7E6B, 0x7E6D, 0x7E79, 0x7E69, + 0x7E6A, 0x7F85, 0x7E73, 0x7FB6, 0x7FB9, 0x7FB8, 0x81D8, 0x85E9, + 0x85DD, 0x85EA, 0x85D5, 0x85E4, 0x85E5, 0x85F7, 0x87FB, 0x8805, + 0x880D, 0x87F9, 0x87FE, 0x8960, 0x895F, 0x8956, 0x895E, 0x8B41, + 0x8B5C, 0x8B58, 0x8B49, 0x8B5A, 0x8B4E, 0x8B4F, 0x8B46, 0x8B59, + 0x8D08, 0x8D0A, 0x8E7C, 0x8E72, 0x8E87, 0x8E76, 0x8E6C, 0x8E7A, + 0x8E74, 0x8F54, 0x8F4E, 0x8FAD, 0x908A, 0x908B, 0x91B1, 0x91AE, + 0x93E1, 0x93D1, 0x93DF, 0x93C3, 0x93C8, 0x93DC, 0x93DD, 0x93D6, + 0x93E2, 0x93CD, 0x93D8, 0x93E4, 0x93D7, 0x93E8, 0x95DC, 0x96B4, + 0x96E3, 0x972A, 0x9727, 0x9761, 0x97DC, 0x97FB, 0x985E, ALTCHR, +/* 0xC440 - 0xC4FF */ + 0x9858, 0x985B, 0x98BC, 0x9945, 0x9949, 0x9A16, 0x9A19, 0x9B0D, + 0x9BE8, 0x9BE7, 0x9BD6, 0x9BDB, 0x9D89, 0x9D61, 0x9D72, 0x9D6A, + 0x9D6C, 0x9E92, 0x9E97, 0x9E93, 0x9EB4, 0x52F8, 0x56A8, 0x56B7, + 0x56B6, 0x56B4, 0x56BC, 0x58E4, 0x5B40, 0x5B43, 0x5B7D, 0x5BF6, + 0x5DC9, 0x61F8, 0x61FA, 0x6518, 0x6514, 0x6519, 0x66E6, 0x6727, + 0x6AEC, 0x703E, 0x7030, 0x7032, 0x7210, 0x737B, 0x74CF, 0x7662, + 0x7665, 0x7926, 0x792A, 0x792C, 0x792B, 0x7AC7, 0x7AF6, 0x7C4C, + 0x7C43, 0x7C4D, 0x7CEF, 0x7CF0, 0x8FAE, 0x7E7D, 0x7E7C, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7E82, 0x7F4C, 0x8000, 0x81DA, 0x8266, 0x85FB, 0x85F9, + 0x8611, 0x85FA, 0x8606, 0x860B, 0x8607, 0x860A, 0x8814, 0x8815, + 0x8964, 0x89BA, 0x89F8, 0x8B70, 0x8B6C, 0x8B66, 0x8B6F, 0x8B5F, + 0x8B6B, 0x8D0F, 0x8D0D, 0x8E89, 0x8E81, 0x8E85, 0x8E82, 0x91B4, + 0x91CB, 0x9418, 0x9403, 0x93FD, 0x95E1, 0x9730, 0x98C4, 0x9952, + 0x9951, 0x99A8, 0x9A2B, 0x9A30, 0x9A37, 0x9A35, 0x9C13, 0x9C0D, + 0x9E79, 0x9EB5, 0x9EE8, 0x9F2F, 0x9F5F, 0x9F63, 0x9F61, 0x5137, + 0x5138, 0x56C1, 0x56C0, 0x56C2, 0x5914, 0x5C6C, 0x5DCD, 0x61FC, + 0x61FE, 0x651D, 0x651C, 0x6595, 0x66E9, 0x6AFB, 0x6B04, 0x6AFA, + 0x6BB2, 0x704C, 0x721B, 0x72A7, 0x74D6, 0x74D4, 0x7669, 0x77D3, + 0x7C50, 0x7E8F, 0x7E8C, 0x7FBC, 0x8617, 0x862D, 0x861A, 0x8823, + 0x8822, 0x8821, 0x881F, 0x896A, 0x896C, 0x89BD, 0x8B74, ALTCHR, +/* 0xC540 - 0xC5FF */ + 0x8B77, 0x8B7D, 0x8D13, 0x8E8A, 0x8E8D, 0x8E8B, 0x8F5F, 0x8FAF, + 0x91BA, 0x942E, 0x9433, 0x9435, 0x943A, 0x9438, 0x9432, 0x942B, + 0x95E2, 0x9738, 0x9739, 0x9732, 0x97FF, 0x9867, 0x9865, 0x9957, + 0x9A45, 0x9A43, 0x9A40, 0x9A3E, 0x9ACF, 0x9B54, 0x9B51, 0x9C2D, + 0x9C25, 0x9DAF, 0x9DB4, 0x9DC2, 0x9DB8, 0x9E9D, 0x9EEF, 0x9F19, + 0x9F5C, 0x9F66, 0x9F67, 0x513C, 0x513B, 0x56C8, 0x56CA, 0x56C9, + 0x5B7F, 0x5DD4, 0x5DD2, 0x5F4E, 0x61FF, 0x6524, 0x6B0A, 0x6B61, + 0x7051, 0x7058, 0x7380, 0x74E4, 0x758A, 0x766E, 0x766C, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x79B3, 0x7C60, 0x7C5F, 0x807E, 0x807D, 0x81DF, 0x8972, + 0x896F, 0x89FC, 0x8B80, 0x8D16, 0x8D17, 0x8E91, 0x8E93, 0x8F61, + 0x9148, 0x9444, 0x9451, 0x9452, 0x973D, 0x973E, 0x97C3, 0x97C1, + 0x986B, 0x9955, 0x9A55, 0x9A4D, 0x9AD2, 0x9B1A, 0x9C49, 0x9C31, + 0x9C3E, 0x9C3B, 0x9DD3, 0x9DD7, 0x9F34, 0x9F6C, 0x9F6A, 0x9F94, + 0x56CC, 0x5DD6, 0x6200, 0x6523, 0x652B, 0x652A, 0x66EC, 0x6B10, + 0x74DA, 0x7ACA, 0x7C64, 0x7C63, 0x7C65, 0x7E93, 0x7E96, 0x7E94, + 0x81E2, 0x8638, 0x863F, 0x8831, 0x8B8A, 0x9090, 0x908F, 0x9463, + 0x9460, 0x9464, 0x9768, 0x986F, 0x995C, 0x9A5A, 0x9A5B, 0x9A57, + 0x9AD3, 0x9AD4, 0x9AD1, 0x9C54, 0x9C57, 0x9C56, 0x9DE5, 0x9E9F, + 0x9EF4, 0x56D1, 0x58E9, 0x652C, 0x705E, 0x7671, 0x7672, 0x77D7, + 0x7F50, 0x7F88, 0x8836, 0x8839, 0x8862, 0x8B93, 0x8B92, ALTCHR, +/* 0xC640 - 0xC6FF */ + 0x8B96, 0x8277, 0x8D1B, 0x91C0, 0x946A, 0x9742, 0x9748, 0x9744, + 0x97C6, 0x9870, 0x9A5F, 0x9B22, 0x9B58, 0x9C5F, 0x9DF9, 0x9DFA, + 0x9E7C, 0x9E7D, 0x9F07, 0x9F77, 0x9F72, 0x5EF3, 0x6B16, 0x7063, + 0x7C6C, 0x7C6E, 0x883B, 0x89C0, 0x8EA1, 0x91C1, 0x9472, 0x9470, + 0x9871, 0x995E, 0x9AD6, 0x9B23, 0x9ECC, 0x7064, 0x77DA, 0x8B9A, + 0x9477, 0x97C9, 0x9A62, 0x9A65, 0x7E9C, 0x8B9C, 0x8EAA, 0x91C5, + 0x947D, 0x947E, 0x947C, 0x9C77, 0x9C78, 0x9EF7, 0x8C54, 0x947F, + 0x9E1A, 0x7228, 0x9A6A, 0x9B31, 0x9E1B, 0x9E1E, 0x7C72, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* + * Another HKSCS area (0xC6A0 - 0xC8FE) + * Why is it different from the defacto ET standard? -_-; + * + * - Roger So <spacehunt@e-fever.org>, 29 Jun 2000 + */ +/* 0xC6A0 - 0xC6FF */ + ALTCHR, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, + 0x2467, 0x2468, 0x2469, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, + 0x2479, 0x247A, 0x247B, 0x247C, 0x247D, 0x2170, 0x2171, 0x2172, + 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x4E36, + 0x4E3F, 0x4E85, 0x4EA0, 0x5182, 0x5196, 0x51AB, 0x52F9, 0x5338, + 0x5369, 0x53B6, 0x590A, 0x5B80, 0x5DDB, 0x2F33, 0x5E7F, 0xF6DF, + 0x5F50, 0x5F61, 0x6534, 0xF6E3, 0x7592, 0xF6E5, 0x8FB5, 0xF6E7, + 0x00A8, 0x02C6, 0x30FD, 0x30FE, 0x309D, 0x309E, 0xF6EE, 0xF6EF, + 0x3005, 0x3006, 0x3007, 0x30FC, 0xFF3B, 0xFF3D, 0x273D, 0x3041, + 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, + 0x304A, 0x304B, 0x304C, 0x304D, 0x304E, 0x304F, 0x3050, 0x3051, + 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, ALTCHR, +/* 0xC740 - 0xC7FF */ + 0x3059, 0x305A, 0x305B, 0x305C, 0x305D, 0x305E, 0x305F, 0x3060, + 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, + 0x3069, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, 0x3070, + 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, + 0x3079, 0x307A, 0x307B, 0x307C, 0x307D, 0x307E, 0x307F, 0x3080, + 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, + 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308E, 0x308F, 0x3090, + 0x3091, 0x3092, 0x3093, 0x30A1, 0x30A2, 0x30A3, 0x30A4, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x30A5, 0x30A6, 0x30A7, 0x30A8, 0x30A9, 0x30AA, 0x30AB, + 0x30AC, 0x30AD, 0x30AE, 0x30AF, 0x30B0, 0x30B1, 0x30B2, 0x30B3, + 0x30B4, 0x30B5, 0x30B6, 0x30B7, 0x30B8, 0x30B9, 0x30BA, 0x30BB, + 0x30BC, 0x30BD, 0x30BE, 0x30BF, 0x30C0, 0x30C1, 0x30C2, 0x30C3, + 0x30C4, 0x30C5, 0x30C6, 0x30C7, 0x30C8, 0x30C9, 0x30CA, 0x30CB, + 0x30CC, 0x30CD, 0x30CE, 0x30CF, 0x30D0, 0x30D1, 0x30D2, 0x30D3, + 0x30D4, 0x30D5, 0x30D6, 0x30D7, 0x30D8, 0x30D9, 0x30DA, 0x30DB, + 0x30DC, 0x30DD, 0x30DE, 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E3, + 0x30E4, 0x30E5, 0x30E6, 0x30E7, 0x30E8, 0x30E9, 0x30EA, 0x30EB, + 0x30EC, 0x30ED, 0x30EE, 0x30EF, 0x30F0, 0x30F1, 0x30F2, 0x30F3, + 0x30F4, 0x30F5, 0x30F6, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, + 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, ALTCHR, +/* 0xC840 - 0xC8FF */ + 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, + 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, + 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, + 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, + 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, + 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, + 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x21E7, 0x21B8, + 0x21B9, 0xF7E5, 0xF7E6, 0x4E5A, 0xF7E8, 0x5202, 0xF7EA, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xF7EB, 0x5188, 0xF7ED, 0xF7EE, 0xF7EF, 0xF7F0, 0xF7F1, + 0xF7F2, 0xF7F3, 0xF7F4, 0xF7F5, 0xF7F6, 0xF7F7, 0xF7F8, 0xF7F9, + 0xF7FA, 0xF7FB, 0xF7FC, 0xF7FD, 0xF7FE, 0xF7FF, 0xF800, 0xF801, + 0xF802, 0xF803, 0xF804, 0xF805, 0xF806, 0xF807, 0xF808, 0xF809, + 0xF80A, 0xF80B, 0xF80C, 0xF80D, 0xF80E, 0xF80F, 0xF810, 0xF811, + 0xF812, 0xF813, 0xF814, 0xF815, 0xF816, 0xFFE2, 0xFFE4, 0xFF07, + 0xFF02, 0x3231, 0x2116, 0x2121, 0x309B, 0x309C, 0x2E80, 0x2E84, + 0x2E86, 0x2E87, 0x2E88, 0x2E8A, 0x2E8C, 0x2E8D, 0x2E95, 0x2E9C, + 0x2E9D, 0x2EA5, 0x2EA7, 0x2EAA, 0x2EAC, 0x2EAE, 0x2EB6, 0x2EBC, + 0x2EBE, 0x2EC6, 0x2ECA, 0x2ECC, 0x2ECD, 0x2ECF, 0x2ED6, 0x2ED7, + 0x2EDE, 0x2EE3, 0xF83C, 0xF83D, 0xF83E, 0x0283, 0x0250, 0x025B, + 0x0254, 0x0275, 0x0153, 0x00F8, 0x014B, 0x028A, 0x026A, ALTCHR, +/******************** end HKSCS ********************/ +/* 0xC940 - 0xC9FF */ + 0x4E42, 0x4E5C, 0x51F5, 0x531A, 0x5382, 0x4E07, 0x4E0C, 0x4E47, + 0x4E8D, 0x56D7, 0xFA0C, 0x5C6E, 0x5F73, 0x4E0F, 0x5187, 0x4E0E, + 0x4E2E, 0x4E93, 0x4EC2, 0x4EC9, 0x4EC8, 0x5198, 0x52FC, 0x536C, + 0x53B9, 0x5720, 0x5903, 0x592C, 0x5C10, 0x5DFF, 0x65E1, 0x6BB3, + 0x6BCC, 0x6C14, 0x723F, 0x4E31, 0x4E3C, 0x4EE8, 0x4EDC, 0x4EE9, + 0x4EE1, 0x4EDD, 0x4EDA, 0x520C, 0x531C, 0x534C, 0x5722, 0x5723, + 0x5917, 0x592F, 0x5B81, 0x5B84, 0x5C12, 0x5C3B, 0x5C74, 0x5C73, + 0x5E04, 0x5E80, 0x5E82, 0x5FC9, 0x6209, 0x6250, 0x6C15, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6C36, 0x6C43, 0x6C3F, 0x6C3B, 0x72AE, 0x72B0, 0x738A, + 0x79B8, 0x808A, 0x961E, 0x4F0E, 0x4F18, 0x4F2C, 0x4EF5, 0x4F14, + 0x4EF1, 0x4F00, 0x4EF7, 0x4F08, 0x4F1D, 0x4F02, 0x4F05, 0x4F22, + 0x4F13, 0x4F04, 0x4EF4, 0x4F12, 0x51B1, 0x5213, 0x5209, 0x5210, + 0x52A6, 0x5322, 0x531F, 0x534D, 0x538A, 0x5407, 0x56E1, 0x56DF, + 0x572E, 0x572A, 0x5734, 0x593C, 0x5980, 0x597C, 0x5985, 0x597B, + 0x597E, 0x5977, 0x597F, 0x5B56, 0x5C15, 0x5C25, 0x5C7C, 0x5C7A, + 0x5C7B, 0x5C7E, 0x5DDF, 0x5E75, 0x5E84, 0x5F02, 0x5F1A, 0x5F74, + 0x5FD5, 0x5FD4, 0x5FCF, 0x625C, 0x625E, 0x6264, 0x6261, 0x6266, + 0x6262, 0x6259, 0x6260, 0x625A, 0x6265, 0x65EF, 0x65EE, 0x673E, + 0x6739, 0x6738, 0x673B, 0x673A, 0x673F, 0x673C, 0x6733, 0x6C18, + 0x6C46, 0x6C52, 0x6C5C, 0x6C4F, 0x6C4A, 0x6C54, 0x6C4B, ALTCHR, +/* 0xCA40 - 0xCAFF */ + 0x6C4C, 0x7071, 0x725E, 0x72B4, 0x72B5, 0x738E, 0x752A, 0x767F, + 0x7A75, 0x7F51, 0x8278, 0x827C, 0x8280, 0x827D, 0x827F, 0x864D, + 0x897E, 0x9099, 0x9097, 0x9098, 0x909B, 0x9094, 0x9622, 0x9624, + 0x9620, 0x9623, 0x4F56, 0x4F3B, 0x4F62, 0x4F49, 0x4F53, 0x4F64, + 0x4F3E, 0x4F67, 0x4F52, 0x4F5F, 0x4F41, 0x4F58, 0x4F2D, 0x4F33, + 0x4F3F, 0x4F61, 0x518F, 0x51B9, 0x521C, 0x521E, 0x5221, 0x52AD, + 0x52AE, 0x5309, 0x5363, 0x5372, 0x538E, 0x538F, 0x5430, 0x5437, + 0x542A, 0x5454, 0x5445, 0x5419, 0x541C, 0x5425, 0x5418, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x543D, 0x544F, 0x5441, 0x5428, 0x5424, 0x5447, 0x56EE, + 0x56E7, 0x56E5, 0x5741, 0x5745, 0x574C, 0x5749, 0x574B, 0x5752, + 0x5906, 0x5940, 0x59A6, 0x5998, 0x59A0, 0x5997, 0x598E, 0x59A2, + 0x5990, 0x598F, 0x59A7, 0x59A1, 0x5B8E, 0x5B92, 0x5C28, 0x5C2A, + 0x5C8D, 0x5C8F, 0x5C88, 0x5C8B, 0x5C89, 0x5C92, 0x5C8A, 0x5C86, + 0x5C93, 0x5C95, 0x5DE0, 0x5E0A, 0x5E0E, 0x5E8B, 0x5E89, 0x5E8C, + 0x5E88, 0x5E8D, 0x5F05, 0x5F1D, 0x5F78, 0x5F76, 0x5FD2, 0x5FD1, + 0x5FD0, 0x5FED, 0x5FE8, 0x5FEE, 0x5FF3, 0x5FE1, 0x5FE4, 0x5FE3, + 0x5FFA, 0x5FEF, 0x5FF7, 0x5FFB, 0x6000, 0x5FF4, 0x623A, 0x6283, + 0x628C, 0x628E, 0x628F, 0x6294, 0x6287, 0x6271, 0x627B, 0x627A, + 0x6270, 0x6281, 0x6288, 0x6277, 0x627D, 0x6272, 0x6274, 0x6537, + 0x65F0, 0x65F4, 0x65F3, 0x65F2, 0x65F5, 0x6745, 0x6747, ALTCHR, +/* 0xCB40 - 0xCBFF */ + 0x6759, 0x6755, 0x674C, 0x6748, 0x675D, 0x674D, 0x675A, 0x674B, + 0x6BD0, 0x6C19, 0x6C1A, 0x6C78, 0x6C67, 0x6C6B, 0x6C84, 0x6C8B, + 0x6C8F, 0x6C71, 0x6C6F, 0x6C69, 0x6C9A, 0x6C6D, 0x6C87, 0x6C95, + 0x6C9C, 0x6C66, 0x6C73, 0x6C65, 0x6C7B, 0x6C8E, 0x7074, 0x707A, + 0x7263, 0x72BF, 0x72BD, 0x72C3, 0x72C6, 0x72C1, 0x72BA, 0x72C5, + 0x7395, 0x7397, 0x7393, 0x7394, 0x7392, 0x753A, 0x7539, 0x7594, + 0x7595, 0x7681, 0x793D, 0x8034, 0x8095, 0x8099, 0x8090, 0x8092, + 0x809C, 0x8290, 0x828F, 0x8285, 0x828E, 0x8291, 0x8293, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x828A, 0x8283, 0x8284, 0x8C78, 0x8FC9, 0x8FBF, 0x909F, + 0x90A1, 0x90A5, 0x909E, 0x90A7, 0x90A0, 0x9630, 0x9628, 0x962F, + 0x962D, 0x4E33, 0x4F98, 0x4F7C, 0x4F85, 0x4F7D, 0x4F80, 0x4F87, + 0x4F76, 0x4F74, 0x4F89, 0x4F84, 0x4F77, 0x4F4C, 0x4F97, 0x4F6A, + 0x4F9A, 0x4F79, 0x4F81, 0x4F78, 0x4F90, 0x4F9C, 0x4F94, 0x4F9E, + 0x4F92, 0x4F82, 0x4F95, 0x4F6B, 0x4F6E, 0x519E, 0x51BC, 0x51BE, + 0x5235, 0x5232, 0x5233, 0x5246, 0x5231, 0x52BC, 0x530A, 0x530B, + 0x533C, 0x5392, 0x5394, 0x5487, 0x547F, 0x5481, 0x5491, 0x5482, + 0x5488, 0x546B, 0x547A, 0x547E, 0x5465, 0x546C, 0x5474, 0x5466, + 0x548D, 0x546F, 0x5461, 0x5460, 0x5498, 0x5463, 0x5467, 0x5464, + 0x56F7, 0x56F9, 0x576F, 0x5772, 0x576D, 0x576B, 0x5771, 0x5770, + 0x5776, 0x5780, 0x5775, 0x577B, 0x5773, 0x5774, 0x5762, ALTCHR, +/* 0xCC40 - 0xCCFF */ + 0x5768, 0x577D, 0x590C, 0x5945, 0x59B5, 0x59BA, 0x59CF, 0x59CE, + 0x59B2, 0x59CC, 0x59C1, 0x59B6, 0x59BC, 0x59C3, 0x59D6, 0x59B1, + 0x59BD, 0x59C0, 0x59C8, 0x59B4, 0x59C7, 0x5B62, 0x5B65, 0x5B93, + 0x5B95, 0x5C44, 0x5C47, 0x5CAE, 0x5CA4, 0x5CA0, 0x5CB5, 0x5CAF, + 0x5CA8, 0x5CAC, 0x5C9F, 0x5CA3, 0x5CAD, 0x5CA2, 0x5CAA, 0x5CA7, + 0x5C9D, 0x5CA5, 0x5CB6, 0x5CB0, 0x5CA6, 0x5E17, 0x5E14, 0x5E19, + 0x5F28, 0x5F22, 0x5F23, 0x5F24, 0x5F54, 0x5F82, 0x5F7E, 0x5F7D, + 0x5FDE, 0x5FE5, 0x602D, 0x6026, 0x6019, 0x6032, 0x600B, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6034, 0x600A, 0x6017, 0x6033, 0x601A, 0x601E, 0x602C, + 0x6022, 0x600D, 0x6010, 0x602E, 0x6013, 0x6011, 0x600C, 0x6009, + 0x601C, 0x6214, 0x623D, 0x62AD, 0x62B4, 0x62D1, 0x62BE, 0x62AA, + 0x62B6, 0x62CA, 0x62AE, 0x62B3, 0x62AF, 0x62BB, 0x62A9, 0x62B0, + 0x62B8, 0x653D, 0x65A8, 0x65BB, 0x6609, 0x65FC, 0x6604, 0x6612, + 0x6608, 0x65FB, 0x6603, 0x660B, 0x660D, 0x6605, 0x65FD, 0x6611, + 0x6610, 0x66F6, 0x670A, 0x6785, 0x676C, 0x678E, 0x6792, 0x6776, + 0x677B, 0x6798, 0x6786, 0x6784, 0x6774, 0x678D, 0x678C, 0x677A, + 0x679F, 0x6791, 0x6799, 0x6783, 0x677D, 0x6781, 0x6778, 0x6779, + 0x6794, 0x6B25, 0x6B80, 0x6B7E, 0x6BDE, 0x6C1D, 0x6C93, 0x6CEC, + 0x6CEB, 0x6CEE, 0x6CD9, 0x6CB6, 0x6CD4, 0x6CAD, 0x6CE7, 0x6CB7, + 0x6CD0, 0x6CC2, 0x6CBA, 0x6CC3, 0x6CC6, 0x6CED, 0x6CF2, ALTCHR, +/* 0xCD40 - 0xCDFF */ + 0x6CD2, 0x6CDD, 0x6CB4, 0x6C8A, 0x6C9D, 0x6C80, 0x6CDE, 0x6CC0, + 0x6D30, 0x6CCD, 0x6CC7, 0x6CB0, 0x6CF9, 0x6CCF, 0x6CE9, 0x6CD1, + 0x7094, 0x7098, 0x7085, 0x7093, 0x7086, 0x7084, 0x7091, 0x7096, + 0x7082, 0x709A, 0x7083, 0x726A, 0x72D6, 0x72CB, 0x72D8, 0x72C9, + 0x72DC, 0x72D2, 0x72D4, 0x72DA, 0x72CC, 0x72D1, 0x73A4, 0x73A1, + 0x73AD, 0x73A6, 0x73A2, 0x73A0, 0x73AC, 0x739D, 0x74DD, 0x74E8, + 0x753F, 0x7540, 0x753E, 0x758C, 0x7598, 0x76AF, 0x76F3, 0x76F1, + 0x76F0, 0x76F5, 0x77F8, 0x77FC, 0x77F9, 0x77FB, 0x77FA, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x77F7, 0x7942, 0x793F, 0x79C5, 0x7A78, 0x7A7B, 0x7AFB, + 0x7C75, 0x7CFD, 0x8035, 0x808F, 0x80AE, 0x80A3, 0x80B8, 0x80B5, + 0x80AD, 0x8220, 0x82A0, 0x82C0, 0x82AB, 0x829A, 0x8298, 0x829B, + 0x82B5, 0x82A7, 0x82AE, 0x82BC, 0x829E, 0x82BA, 0x82B4, 0x82A8, + 0x82A1, 0x82A9, 0x82C2, 0x82A4, 0x82C3, 0x82B6, 0x82A2, 0x8670, + 0x866F, 0x866D, 0x866E, 0x8C56, 0x8FD2, 0x8FCB, 0x8FD3, 0x8FCD, + 0x8FD6, 0x8FD5, 0x8FD7, 0x90B2, 0x90B4, 0x90AF, 0x90B3, 0x90B0, + 0x9639, 0x963D, 0x963C, 0x963A, 0x9643, 0x4FCD, 0x4FC5, 0x4FD3, + 0x4FB2, 0x4FC9, 0x4FCB, 0x4FC1, 0x4FD4, 0x4FDC, 0x4FD9, 0x4FBB, + 0x4FB3, 0x4FDB, 0x4FC7, 0x4FD6, 0x4FBA, 0x4FC0, 0x4FB9, 0x4FEC, + 0x5244, 0x5249, 0x52C0, 0x52C2, 0x533D, 0x537C, 0x5397, 0x5396, + 0x5399, 0x5398, 0x54BA, 0x54A1, 0x54AD, 0x54A5, 0x54CF, ALTCHR, +/* 0xCE40 - 0xCEFF */ + 0x54C3, 0x830D, 0x54B7, 0x54AE, 0x54D6, 0x54B6, 0x54C5, 0x54C6, + 0x54A0, 0x5470, 0x54BC, 0x54A2, 0x54BE, 0x5472, 0x54DE, 0x54B0, + 0x57B5, 0x579E, 0x579F, 0x57A4, 0x578C, 0x5797, 0x579D, 0x579B, + 0x5794, 0x5798, 0x578F, 0x5799, 0x57A5, 0x579A, 0x5795, 0x58F4, + 0x590D, 0x5953, 0x59E1, 0x59DE, 0x59EE, 0x5A00, 0x59F1, 0x59DD, + 0x59FA, 0x59FD, 0x59FC, 0x59F6, 0x59E4, 0x59F2, 0x59F7, 0x59DB, + 0x59E9, 0x59F3, 0x59F5, 0x59E0, 0x59FE, 0x59F4, 0x59ED, 0x5BA8, + 0x5C4C, 0x5CD0, 0x5CD8, 0x5CCC, 0x5CD7, 0x5CCB, 0x5CDB, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x5CDE, 0x5CDA, 0x5CC9, 0x5CC7, 0x5CCA, 0x5CD6, 0x5CD3, + 0x5CD4, 0x5CCF, 0x5CC8, 0x5CC6, 0x5CCE, 0x5CDF, 0x5CF8, 0x5DF9, + 0x5E21, 0x5E22, 0x5E23, 0x5E20, 0x5E24, 0x5EB0, 0x5EA4, 0x5EA2, + 0x5E9B, 0x5EA3, 0x5EA5, 0x5F07, 0x5F2E, 0x5F56, 0x5F86, 0x6037, + 0x6039, 0x6054, 0x6072, 0x605E, 0x6045, 0x6053, 0x6047, 0x6049, + 0x605B, 0x604C, 0x6040, 0x6042, 0x605F, 0x6024, 0x6044, 0x6058, + 0x6066, 0x606E, 0x6242, 0x6243, 0x62CF, 0x630D, 0x630B, 0x62F5, + 0x630E, 0x6303, 0x62EB, 0x62F9, 0x630F, 0x630C, 0x62F8, 0x62F6, + 0x6300, 0x6313, 0x6314, 0x62FA, 0x6315, 0x62FB, 0x62F0, 0x6541, + 0x6543, 0x65AA, 0x65BF, 0x6636, 0x6621, 0x6632, 0x6635, 0x661C, + 0x6626, 0x6622, 0x6633, 0x662B, 0x663A, 0x661D, 0x6634, 0x6639, + 0x662E, 0x670F, 0x6710, 0x67C1, 0x67F2, 0x67C8, 0x67BA, ALTCHR, +/* 0xCF40 - 0xCFFF */ + 0x67DC, 0x67BB, 0x67F8, 0x67D8, 0x67C0, 0x67B7, 0x67C5, 0x67EB, + 0x67E4, 0x67DF, 0x67B5, 0x67CD, 0x67B3, 0x67F7, 0x67F6, 0x67EE, + 0x67E3, 0x67C2, 0x67B9, 0x67CE, 0x67E7, 0x67F0, 0x67B2, 0x67FC, + 0x67C6, 0x67ED, 0x67CC, 0x67AE, 0x67E6, 0x67DB, 0x67FA, 0x67C9, + 0x67CA, 0x67C3, 0x67EA, 0x67CB, 0x6B28, 0x6B82, 0x6B84, 0x6BB6, + 0x6BD6, 0x6BD8, 0x6BE0, 0x6C20, 0x6C21, 0x6D28, 0x6D34, 0x6D2D, + 0x6D1F, 0x6D3C, 0x6D3F, 0x6D12, 0x6D0A, 0x6CDA, 0x6D33, 0x6D04, + 0x6D19, 0x6D3A, 0x6D1A, 0x6D11, 0x6D00, 0x6D1D, 0x6D42, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6D01, 0x6D18, 0x6D37, 0x6D03, 0x6D0F, 0x6D40, 0x6D07, + 0x6D20, 0x6D2C, 0x6D08, 0x6D22, 0x6D09, 0x6D10, 0x70B7, 0x709F, + 0x70BE, 0x70B1, 0x70B0, 0x70A1, 0x70B4, 0x70B5, 0x70A9, 0x7241, + 0x7249, 0x724A, 0x726C, 0x7270, 0x7273, 0x726E, 0x72CA, 0x72E4, + 0x72E8, 0x72EB, 0x72DF, 0x72EA, 0x72E6, 0x72E3, 0x7385, 0x73CC, + 0x73C2, 0x73C8, 0x73C5, 0x73B9, 0x73B6, 0x73B5, 0x73B4, 0x73EB, + 0x73BF, 0x73C7, 0x73BE, 0x73C3, 0x73C6, 0x73B8, 0x73CB, 0x74EC, + 0x74EE, 0x752E, 0x7547, 0x7548, 0x75A7, 0x75AA, 0x7679, 0x76C4, + 0x7708, 0x7703, 0x7704, 0x7705, 0x770A, 0x76F7, 0x76FB, 0x76FA, + 0x77E7, 0x77E8, 0x7806, 0x7811, 0x7812, 0x7805, 0x7810, 0x780F, + 0x780E, 0x7809, 0x7803, 0x7813, 0x794A, 0x794C, 0x794B, 0x7945, + 0x7944, 0x79D5, 0x79CD, 0x79CF, 0x79D6, 0x79CE, 0x7A80, ALTCHR, +/* 0xD040 - 0xD0FF */ + 0x7A7E, 0x7AD1, 0x7B00, 0x7B01, 0x7C7A, 0x7C78, 0x7C79, 0x7C7F, + 0x7C80, 0x7C81, 0x7D03, 0x7D08, 0x7D01, 0x7F58, 0x7F91, 0x7F8D, + 0x7FBE, 0x8007, 0x800E, 0x800F, 0x8014, 0x8037, 0x80D8, 0x80C7, + 0x80E0, 0x80D1, 0x80C8, 0x80C2, 0x80D0, 0x80C5, 0x80E3, 0x80D9, + 0x80DC, 0x80CA, 0x80D5, 0x80C9, 0x80CF, 0x80D7, 0x80E6, 0x80CD, + 0x81FF, 0x8221, 0x8294, 0x82D9, 0x82FE, 0x82F9, 0x8307, 0x82E8, + 0x8300, 0x82D5, 0x833A, 0x82EB, 0x82D6, 0x82F4, 0x82EC, 0x82E1, + 0x82F2, 0x82F5, 0x830C, 0x82FB, 0x82F6, 0x82F0, 0x82EA, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x82E4, 0x82E0, 0x82FA, 0x82F3, 0x82ED, 0x8677, 0x8674, + 0x867C, 0x8673, 0x8841, 0x884E, 0x8867, 0x886A, 0x8869, 0x89D3, + 0x8A04, 0x8A07, 0x8D72, 0x8FE3, 0x8FE1, 0x8FEE, 0x8FE0, 0x90F1, + 0x90BD, 0x90BF, 0x90D5, 0x90C5, 0x90BE, 0x90C7, 0x90CB, 0x90C8, + 0x91D4, 0x91D3, 0x9654, 0x964F, 0x9651, 0x9653, 0x964A, 0x964E, + 0x501E, 0x5005, 0x5007, 0x5013, 0x5022, 0x5030, 0x501B, 0x4FF5, + 0x4FF4, 0x5033, 0x5037, 0x502C, 0x4FF6, 0x4FF7, 0x5017, 0x501C, + 0x5020, 0x5027, 0x5035, 0x502F, 0x5031, 0x500E, 0x515A, 0x5194, + 0x5193, 0x51CA, 0x51C4, 0x51C5, 0x51C8, 0x51CE, 0x5261, 0x525A, + 0x5252, 0x525E, 0x525F, 0x5255, 0x5262, 0x52CD, 0x530E, 0x539E, + 0x5526, 0x54E2, 0x5517, 0x5512, 0x54E7, 0x54F3, 0x54E4, 0x551A, + 0x54FF, 0x5504, 0x5508, 0x54EB, 0x5511, 0x5505, 0x54F1, ALTCHR, +/* 0xD140 - 0xD1FF */ + 0x550A, 0x54FB, 0x54F7, 0x54F8, 0x54E0, 0x550E, 0x5503, 0x550B, + 0x5701, 0x5702, 0x57CC, 0x5832, 0x57D5, 0x57D2, 0x57BA, 0x57C6, + 0x57BD, 0x57BC, 0x57B8, 0x57B6, 0x57BF, 0x57C7, 0x57D0, 0x57B9, + 0x57C1, 0x590E, 0x594A, 0x5A19, 0x5A16, 0x5A2D, 0x5A2E, 0x5A15, + 0x5A0F, 0x5A17, 0x5A0A, 0x5A1E, 0x5A33, 0x5B6C, 0x5BA7, 0x5BAD, + 0x5BAC, 0x5C03, 0x5C56, 0x5C54, 0x5CEC, 0x5CFF, 0x5CEE, 0x5CF1, + 0x5CF7, 0x5D00, 0x5CF9, 0x5E29, 0x5E28, 0x5EA8, 0x5EAE, 0x5EAA, + 0x5EAC, 0x5F33, 0x5F30, 0x5F67, 0x605D, 0x605A, 0x6067, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6041, 0x60A2, 0x6088, 0x6080, 0x6092, 0x6081, 0x609D, + 0x6083, 0x6095, 0x609B, 0x6097, 0x6087, 0x609C, 0x608E, 0x6219, + 0x6246, 0x62F2, 0x6310, 0x6356, 0x632C, 0x6344, 0x6345, 0x6336, + 0x6343, 0x63E4, 0x6339, 0x634B, 0x634A, 0x633C, 0x6329, 0x6341, + 0x6334, 0x6358, 0x6354, 0x6359, 0x632D, 0x6347, 0x6333, 0x635A, + 0x6351, 0x6338, 0x6357, 0x6340, 0x6348, 0x654A, 0x6546, 0x65C6, + 0x65C3, 0x65C4, 0x65C2, 0x664A, 0x665F, 0x6647, 0x6651, 0x6712, + 0x6713, 0x681F, 0x681A, 0x6849, 0x6832, 0x6833, 0x683B, 0x684B, + 0x684F, 0x6816, 0x6831, 0x681C, 0x6835, 0x682B, 0x682D, 0x682F, + 0x684E, 0x6844, 0x6834, 0x681D, 0x6812, 0x6814, 0x6826, 0x6828, + 0x682E, 0x684D, 0x683A, 0x6825, 0x6820, 0x6B2C, 0x6B2F, 0x6B2D, + 0x6B31, 0x6B34, 0x6B6D, 0x8082, 0x6B88, 0x6BE6, 0x6BE4, ALTCHR, +/* 0xD240 - 0xD2FF */ + 0x6BE8, 0x6BE3, 0x6BE2, 0x6BE7, 0x6C25, 0x6D7A, 0x6D63, 0x6D64, + 0x6D76, 0x6D0D, 0x6D61, 0x6D92, 0x6D58, 0x6D62, 0x6D6D, 0x6D6F, + 0x6D91, 0x6D8D, 0x6DEF, 0x6D7F, 0x6D86, 0x6D5E, 0x6D67, 0x6D60, + 0x6D97, 0x6D70, 0x6D7C, 0x6D5F, 0x6D82, 0x6D98, 0x6D2F, 0x6D68, + 0x6D8B, 0x6D7E, 0x6D80, 0x6D84, 0x6D16, 0x6D83, 0x6D7B, 0x6D7D, + 0x6D75, 0x6D90, 0x70DC, 0x70D3, 0x70D1, 0x70DD, 0x70CB, 0x7F39, + 0x70E2, 0x70D7, 0x70D2, 0x70DE, 0x70E0, 0x70D4, 0x70CD, 0x70C5, + 0x70C6, 0x70C7, 0x70DA, 0x70CE, 0x70E1, 0x7242, 0x7278, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7277, 0x7276, 0x7300, 0x72FA, 0x72F4, 0x72FE, 0x72F6, + 0x72F3, 0x72FB, 0x7301, 0x73D3, 0x73D9, 0x73E5, 0x73D6, 0x73BC, + 0x73E7, 0x73E3, 0x73E9, 0x73DC, 0x73D2, 0x73DB, 0x73D4, 0x73DD, + 0x73DA, 0x73D7, 0x73D8, 0x73E8, 0x74DE, 0x74DF, 0x74F4, 0x74F5, + 0x7521, 0x755B, 0x755F, 0x75B0, 0x75C1, 0x75BB, 0x75C4, 0x75C0, + 0x75BF, 0x75B6, 0x75BA, 0x768A, 0x76C9, 0x771D, 0x771B, 0x7710, + 0x7713, 0x7712, 0x7723, 0x7711, 0x7715, 0x7719, 0x771A, 0x7722, + 0x7727, 0x7823, 0x782C, 0x7822, 0x7835, 0x782F, 0x7828, 0x782E, + 0x782B, 0x7821, 0x7829, 0x7833, 0x782A, 0x7831, 0x7954, 0x795B, + 0x794F, 0x795C, 0x7953, 0x7952, 0x7951, 0x79EB, 0x79EC, 0x79E0, + 0x79EE, 0x79ED, 0x79EA, 0x79DC, 0x79DE, 0x79DD, 0x7A86, 0x7A89, + 0x7A85, 0x7A8B, 0x7A8C, 0x7A8A, 0x7A87, 0x7AD8, 0x7B10, ALTCHR, +/* 0xD340 - 0xD3FF */ + 0x7B04, 0x7B13, 0x7B05, 0x7B0F, 0x7B08, 0x7B0A, 0x7B0E, 0x7B09, + 0x7B12, 0x7C84, 0x7C91, 0x7C8A, 0x7C8C, 0x7C88, 0x7C8D, 0x7C85, + 0x7D1E, 0x7D1D, 0x7D11, 0x7D0E, 0x7D18, 0x7D16, 0x7D13, 0x7D1F, + 0x7D12, 0x7D0F, 0x7D0C, 0x7F5C, 0x7F61, 0x7F5E, 0x7F60, 0x7F5D, + 0x7F5B, 0x7F96, 0x7F92, 0x7FC3, 0x7FC2, 0x7FC0, 0x8016, 0x803E, + 0x8039, 0x80FA, 0x80F2, 0x80F9, 0x80F5, 0x8101, 0x80FB, 0x8100, + 0x8201, 0x822F, 0x8225, 0x8333, 0x832D, 0x8344, 0x8319, 0x8351, + 0x8325, 0x8356, 0x833F, 0x8341, 0x8326, 0x831C, 0x8322, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8342, 0x834E, 0x831B, 0x832A, 0x8308, 0x833C, 0x834D, + 0x8316, 0x8324, 0x8320, 0x8337, 0x832F, 0x8329, 0x8347, 0x8345, + 0x834C, 0x8353, 0x831E, 0x832C, 0x834B, 0x8327, 0x8348, 0x8653, + 0x8652, 0x86A2, 0x86A8, 0x8696, 0x868D, 0x8691, 0x869E, 0x8687, + 0x8697, 0x8686, 0x868B, 0x869A, 0x8685, 0x86A5, 0x8699, 0x86A1, + 0x86A7, 0x8695, 0x8698, 0x868E, 0x869D, 0x8690, 0x8694, 0x8843, + 0x8844, 0x886D, 0x8875, 0x8876, 0x8872, 0x8880, 0x8871, 0x887F, + 0x886F, 0x8883, 0x887E, 0x8874, 0x887C, 0x8A12, 0x8C47, 0x8C57, + 0x8C7B, 0x8CA4, 0x8CA3, 0x8D76, 0x8D78, 0x8DB5, 0x8DB7, 0x8DB6, + 0x8ED1, 0x8ED3, 0x8FFE, 0x8FF5, 0x9002, 0x8FFF, 0x8FFB, 0x9004, + 0x8FFC, 0x8FF6, 0x90D6, 0x90E0, 0x90D9, 0x90DA, 0x90E3, 0x90DF, + 0x90E5, 0x90D8, 0x90DB, 0x90D7, 0x90DC, 0x90E4, 0x9150, ALTCHR, +/* 0xD440 - 0xD4FF */ + 0x914E, 0x914F, 0x91D5, 0x91E2, 0x91DA, 0x965C, 0x965F, 0x96BC, + 0x98E3, 0x9ADF, 0x9B2F, 0x4E7F, 0x5070, 0x506A, 0x5061, 0x505E, + 0x5060, 0x5053, 0x504B, 0x505D, 0x5072, 0x5048, 0x504D, 0x5041, + 0x505B, 0x504A, 0x5062, 0x5015, 0x5045, 0x505F, 0x5069, 0x506B, + 0x5063, 0x5064, 0x5046, 0x5040, 0x506E, 0x5073, 0x5057, 0x5051, + 0x51D0, 0x526B, 0x526D, 0x526C, 0x526E, 0x52D6, 0x52D3, 0x532D, + 0x539C, 0x5575, 0x5576, 0x553C, 0x554D, 0x5550, 0x5534, 0x552A, + 0x5551, 0x5562, 0x5536, 0x5535, 0x5530, 0x5552, 0x5545, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x550C, 0x5532, 0x5565, 0x554E, 0x5539, 0x5548, 0x552D, + 0x553B, 0x5540, 0x554B, 0x570A, 0x5707, 0x57FB, 0x5814, 0x57E2, + 0x57F6, 0x57DC, 0x57F4, 0x5800, 0x57ED, 0x57FD, 0x5808, 0x57F8, + 0x580B, 0x57F3, 0x57CF, 0x5807, 0x57EE, 0x57E3, 0x57F2, 0x57E5, + 0x57EC, 0x57E1, 0x580E, 0x57FC, 0x5810, 0x57E7, 0x5801, 0x580C, + 0x57F1, 0x57E9, 0x57F0, 0x580D, 0x5804, 0x595C, 0x5A60, 0x5A58, + 0x5A55, 0x5A67, 0x5A5E, 0x5A38, 0x5A35, 0x5A6D, 0x5A50, 0x5A5F, + 0x5A65, 0x5A6C, 0x5A53, 0x5A64, 0x5A57, 0x5A43, 0x5A5D, 0x5A52, + 0x5A44, 0x5A5B, 0x5A48, 0x5A8E, 0x5A3E, 0x5A4D, 0x5A39, 0x5A4C, + 0x5A70, 0x5A69, 0x5A47, 0x5A51, 0x5A56, 0x5A42, 0x5A5C, 0x5B72, + 0x5B6E, 0x5BC1, 0x5BC0, 0x5C59, 0x5D1E, 0x5D0B, 0x5D1D, 0x5D1A, + 0x5D20, 0x5D0C, 0x5D28, 0x5D0D, 0x5D26, 0x5D25, 0x5D0F, ALTCHR, +/* 0xD540 - 0xD5FF */ + 0x5D30, 0x5D12, 0x5D23, 0x5D1F, 0x5D2E, 0x5E3E, 0x5E34, 0x5EB1, + 0x5EB4, 0x5EB9, 0x5EB2, 0x5EB3, 0x5F36, 0x5F38, 0x5F9B, 0x5F96, + 0x5F9F, 0x608A, 0x6090, 0x6086, 0x60BE, 0x60B0, 0x60BA, 0x60D3, + 0x60D4, 0x60CF, 0x60E4, 0x60D9, 0x60DD, 0x60C8, 0x60B1, 0x60DB, + 0x60B7, 0x60CA, 0x60BF, 0x60C3, 0x60CD, 0x60C0, 0x6332, 0x6365, + 0x638A, 0x6382, 0x637D, 0x63BD, 0x639E, 0x63AD, 0x639D, 0x6397, + 0x63AB, 0x638E, 0x636F, 0x6387, 0x6390, 0x636E, 0x63AF, 0x6375, + 0x639C, 0x636D, 0x63AE, 0x637C, 0x63A4, 0x633B, 0x639F, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6378, 0x6385, 0x6381, 0x6391, 0x638D, 0x6370, 0x6553, + 0x65CD, 0x6665, 0x6661, 0x665B, 0x6659, 0x665C, 0x6662, 0x6718, + 0x6879, 0x6887, 0x6890, 0x689C, 0x686D, 0x686E, 0x68AE, 0x68AB, + 0x6956, 0x686F, 0x68A3, 0x68AC, 0x68A9, 0x6875, 0x6874, 0x68B2, + 0x688F, 0x6877, 0x6892, 0x687C, 0x686B, 0x6872, 0x68AA, 0x6880, + 0x6871, 0x687E, 0x689B, 0x6896, 0x688B, 0x68A0, 0x6889, 0x68A4, + 0x6878, 0x687B, 0x6891, 0x688C, 0x688A, 0x687D, 0x6B36, 0x6B33, + 0x6B37, 0x6B38, 0x6B91, 0x6B8F, 0x6B8D, 0x6B8E, 0x6B8C, 0x6C2A, + 0x6DC0, 0x6DAB, 0x6DB4, 0x6DB3, 0x6E74, 0x6DAC, 0x6DE9, 0x6DE2, + 0x6DB7, 0x6DF6, 0x6DD4, 0x6E00, 0x6DC8, 0x6DE0, 0x6DDF, 0x6DD6, + 0x6DBE, 0x6DE5, 0x6DDC, 0x6DDD, 0x6DDB, 0x6DF4, 0x6DCA, 0x6DBD, + 0x6DED, 0x6DF0, 0x6DBA, 0x6DD5, 0x6DC2, 0x6DCF, 0x6DC9, ALTCHR, +/* 0xD640 - 0xD6FF */ + 0x6DD0, 0x6DF2, 0x6DD3, 0x6DFD, 0x6DD7, 0x6DCD, 0x6DE3, 0x6DBB, + 0x70FA, 0x710D, 0x70F7, 0x7117, 0x70F4, 0x710C, 0x70F0, 0x7104, + 0x70F3, 0x7110, 0x70FC, 0x70FF, 0x7106, 0x7113, 0x7100, 0x70F8, + 0x70F6, 0x710B, 0x7102, 0x710E, 0x727E, 0x727B, 0x727C, 0x727F, + 0x731D, 0x7317, 0x7307, 0x7311, 0x7318, 0x730A, 0x7308, 0x72FF, + 0x730F, 0x731E, 0x7388, 0x73F6, 0x73F8, 0x73F5, 0x7404, 0x7401, + 0x73FD, 0x7407, 0x7400, 0x73FA, 0x73FC, 0x73FF, 0x740C, 0x740B, + 0x73F4, 0x7408, 0x7564, 0x7563, 0x75CE, 0x75D2, 0x75CF, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x75CB, 0x75CC, 0x75D1, 0x75D0, 0x768F, 0x7689, 0x76D3, + 0x7739, 0x772F, 0x772D, 0x7731, 0x7732, 0x7734, 0x7733, 0x773D, + 0x7725, 0x773B, 0x7735, 0x7848, 0x7852, 0x7849, 0x784D, 0x784A, + 0x784C, 0x7826, 0x7845, 0x7850, 0x7964, 0x7967, 0x7969, 0x796A, + 0x7963, 0x796B, 0x7961, 0x79BB, 0x79FA, 0x79F8, 0x79F6, 0x79F7, + 0x7A8F, 0x7A94, 0x7A90, 0x7B35, 0x7B47, 0x7B34, 0x7B25, 0x7B30, + 0x7B22, 0x7B24, 0x7B33, 0x7B18, 0x7B2A, 0x7B1D, 0x7B31, 0x7B2B, + 0x7B2D, 0x7B2F, 0x7B32, 0x7B38, 0x7B1A, 0x7B23, 0x7C94, 0x7C98, + 0x7C96, 0x7CA3, 0x7D35, 0x7D3D, 0x7D38, 0x7D36, 0x7D3A, 0x7D45, + 0x7D2C, 0x7D29, 0x7D41, 0x7D47, 0x7D3E, 0x7D3F, 0x7D4A, 0x7D3B, + 0x7D28, 0x7F63, 0x7F95, 0x7F9C, 0x7F9D, 0x7F9B, 0x7FCA, 0x7FCB, + 0x7FCD, 0x7FD0, 0x7FD1, 0x7FC7, 0x7FCF, 0x7FC9, 0x801F, ALTCHR, +/* 0xD740 - 0xD7FF */ + 0x801E, 0x801B, 0x8047, 0x8043, 0x8048, 0x8118, 0x8125, 0x8119, + 0x811B, 0x812D, 0x811F, 0x812C, 0x811E, 0x8121, 0x8115, 0x8127, + 0x811D, 0x8122, 0x8211, 0x8238, 0x8233, 0x823A, 0x8234, 0x8232, + 0x8274, 0x8390, 0x83A3, 0x83A8, 0x838D, 0x837A, 0x8373, 0x83A4, + 0x8374, 0x838F, 0x8381, 0x8395, 0x8399, 0x8375, 0x8394, 0x83A9, + 0x837D, 0x8383, 0x838C, 0x839D, 0x839B, 0x83AA, 0x838B, 0x837E, + 0x83A5, 0x83AF, 0x8388, 0x8397, 0x83B0, 0x837F, 0x83A6, 0x8387, + 0x83AE, 0x8376, 0x839A, 0x8659, 0x8656, 0x86BF, 0x86B7, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x86C2, 0x86C1, 0x86C5, 0x86BA, 0x86B0, 0x86C8, 0x86B9, + 0x86B3, 0x86B8, 0x86CC, 0x86B4, 0x86BB, 0x86BC, 0x86C3, 0x86BD, + 0x86BE, 0x8852, 0x8889, 0x8895, 0x88A8, 0x88A2, 0x88AA, 0x889A, + 0x8891, 0x88A1, 0x889F, 0x8898, 0x88A7, 0x8899, 0x889B, 0x8897, + 0x88A4, 0x88AC, 0x888C, 0x8893, 0x888E, 0x8982, 0x89D6, 0x89D9, + 0x89D5, 0x8A30, 0x8A27, 0x8A2C, 0x8A1E, 0x8C39, 0x8C3B, 0x8C5C, + 0x8C5D, 0x8C7D, 0x8CA5, 0x8D7D, 0x8D7B, 0x8D79, 0x8DBC, 0x8DC2, + 0x8DB9, 0x8DBF, 0x8DC1, 0x8ED8, 0x8EDE, 0x8EDD, 0x8EDC, 0x8ED7, + 0x8EE0, 0x8EE1, 0x9024, 0x900B, 0x9011, 0x901C, 0x900C, 0x9021, + 0x90EF, 0x90EA, 0x90F0, 0x90F4, 0x90F2, 0x90F3, 0x90D4, 0x90EB, + 0x90EC, 0x90E9, 0x9156, 0x9158, 0x915A, 0x9153, 0x9155, 0x91EC, + 0x91F4, 0x91F1, 0x91F3, 0x91F8, 0x91E4, 0x91F9, 0x91EA, ALTCHR, +/* 0xD840 - 0xD8FF */ + 0x91EB, 0x91F7, 0x91E8, 0x91EE, 0x957A, 0x9586, 0x9588, 0x967C, + 0x966D, 0x966B, 0x9671, 0x966F, 0x96BF, 0x976A, 0x9804, 0x98E5, + 0x9997, 0x509B, 0x5095, 0x5094, 0x509E, 0x508B, 0x50A3, 0x5083, + 0x508C, 0x508E, 0x509D, 0x5068, 0x509C, 0x5092, 0x5082, 0x5087, + 0x515F, 0x51D4, 0x5312, 0x5311, 0x53A4, 0x53A7, 0x5591, 0x55A8, + 0x55A5, 0x55AD, 0x5577, 0x5645, 0x55A2, 0x5593, 0x5588, 0x558F, + 0x55B5, 0x5581, 0x55A3, 0x5592, 0x55A4, 0x557D, 0x558C, 0x55A6, + 0x557F, 0x5595, 0x55A1, 0x558E, 0x570C, 0x5829, 0x5837, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x5819, 0x581E, 0x5827, 0x5823, 0x5828, 0x57F5, 0x5848, + 0x5825, 0x581C, 0x581B, 0x5833, 0x583F, 0x5836, 0x582E, 0x5839, + 0x5838, 0x582D, 0x582C, 0x583B, 0x5961, 0x5AAF, 0x5A94, 0x5A9F, + 0x5A7A, 0x5AA2, 0x5A9E, 0x5A78, 0x5AA6, 0x5A7C, 0x5AA5, 0x5AAC, + 0x5A95, 0x5AAE, 0x5A37, 0x5A84, 0x5A8A, 0x5A97, 0x5A83, 0x5A8B, + 0x5AA9, 0x5A7B, 0x5A7D, 0x5A8C, 0x5A9C, 0x5A8F, 0x5A93, 0x5A9D, + 0x5BEA, 0x5BCD, 0x5BCB, 0x5BD4, 0x5BD1, 0x5BCA, 0x5BCE, 0x5C0C, + 0x5C30, 0x5D37, 0x5D43, 0x5D6B, 0x5D41, 0x5D4B, 0x5D3F, 0x5D35, + 0x5D51, 0x5D4E, 0x5D55, 0x5D33, 0x5D3A, 0x5D52, 0x5D3D, 0x5D31, + 0x5D59, 0x5D42, 0x5D39, 0x5D49, 0x5D38, 0x5D3C, 0x5D32, 0x5D36, + 0x5D40, 0x5D45, 0x5E44, 0x5E41, 0x5F58, 0x5FA6, 0x5FA5, 0x5FAB, + 0x60C9, 0x60B9, 0x60CC, 0x60E2, 0x60CE, 0x60C4, 0x6114, ALTCHR, +/* 0xD940 - 0xD9FF */ + 0x60F2, 0x610A, 0x6116, 0x6105, 0x60F5, 0x6113, 0x60F8, 0x60FC, + 0x60FE, 0x60C1, 0x6103, 0x6118, 0x611D, 0x6110, 0x60FF, 0x6104, + 0x610B, 0x624A, 0x6394, 0x63B1, 0x63B0, 0x63CE, 0x63E5, 0x63E8, + 0x63EF, 0x63C3, 0x649D, 0x63F3, 0x63CA, 0x63E0, 0x63F6, 0x63D5, + 0x63F2, 0x63F5, 0x6461, 0x63DF, 0x63BE, 0x63DD, 0x63DC, 0x63C4, + 0x63D8, 0x63D3, 0x63C2, 0x63C7, 0x63CC, 0x63CB, 0x63C8, 0x63F0, + 0x63D7, 0x63D9, 0x6532, 0x6567, 0x656A, 0x6564, 0x655C, 0x6568, + 0x6565, 0x658C, 0x659D, 0x659E, 0x65AE, 0x65D0, 0x65D2, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x667C, 0x666C, 0x667B, 0x6680, 0x6671, 0x6679, 0x666A, + 0x6672, 0x6701, 0x690C, 0x68D3, 0x6904, 0x68DC, 0x692A, 0x68EC, + 0x68EA, 0x68F1, 0x690F, 0x68D6, 0x68F7, 0x68EB, 0x68E4, 0x68F6, + 0x6913, 0x6910, 0x68F3, 0x68E1, 0x6907, 0x68CC, 0x6908, 0x6970, + 0x68B4, 0x6911, 0x68EF, 0x68C6, 0x6914, 0x68F8, 0x68D0, 0x68FD, + 0x68FC, 0x68E8, 0x690B, 0x690A, 0x6917, 0x68CE, 0x68C8, 0x68DD, + 0x68DE, 0x68E6, 0x68F4, 0x68D1, 0x6906, 0x68D4, 0x68E9, 0x6915, + 0x6925, 0x68C7, 0x6B39, 0x6B3B, 0x6B3F, 0x6B3C, 0x6B94, 0x6B97, + 0x6B99, 0x6B95, 0x6BBD, 0x6BF0, 0x6BF2, 0x6BF3, 0x6C30, 0x6DFC, + 0x6E46, 0x6E47, 0x6E1F, 0x6E49, 0x6E88, 0x6E3C, 0x6E3D, 0x6E45, + 0x6E62, 0x6E2B, 0x6E3F, 0x6E41, 0x6E5D, 0x6E73, 0x6E1C, 0x6E33, + 0x6E4B, 0x6E40, 0x6E51, 0x6E3B, 0x6E03, 0x6E2E, 0x6E5E, ALTCHR, +/* 0xDA40 - 0xDAFF */ + 0x6E68, 0x6E5C, 0x6E61, 0x6E31, 0x6E28, 0x6E60, 0x6E71, 0x6E6B, + 0x6E39, 0x6E22, 0x6E30, 0x6E53, 0x6E65, 0x6E27, 0x6E78, 0x6E64, + 0x6E77, 0x6E55, 0x6E79, 0x6E52, 0x6E66, 0x6E35, 0x6E36, 0x6E5A, + 0x7120, 0x711E, 0x712F, 0x70FB, 0x712E, 0x7131, 0x7123, 0x7125, + 0x7122, 0x7132, 0x711F, 0x7128, 0x713A, 0x711B, 0x724B, 0x725A, + 0x7288, 0x7289, 0x7286, 0x7285, 0x728B, 0x7312, 0x730B, 0x7330, + 0x7322, 0x7331, 0x7333, 0x7327, 0x7332, 0x732D, 0x7326, 0x7323, + 0x7335, 0x730C, 0x742E, 0x742C, 0x7430, 0x742B, 0x7416, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x741A, 0x7421, 0x742D, 0x7431, 0x7424, 0x7423, 0x741D, + 0x7429, 0x7420, 0x7432, 0x74FB, 0x752F, 0x756F, 0x756C, 0x75E7, + 0x75DA, 0x75E1, 0x75E6, 0x75DD, 0x75DF, 0x75E4, 0x75D7, 0x7695, + 0x7692, 0x76DA, 0x7746, 0x7747, 0x7744, 0x774D, 0x7745, 0x774A, + 0x774E, 0x774B, 0x774C, 0x77DE, 0x77EC, 0x7860, 0x7864, 0x7865, + 0x785C, 0x786D, 0x7871, 0x786A, 0x786E, 0x7870, 0x7869, 0x7868, + 0x785E, 0x7862, 0x7974, 0x7973, 0x7972, 0x7970, 0x7A02, 0x7A0A, + 0x7A03, 0x7A0C, 0x7A04, 0x7A99, 0x7AE6, 0x7AE4, 0x7B4A, 0x7B3B, + 0x7B44, 0x7B48, 0x7B4C, 0x7B4E, 0x7B40, 0x7B58, 0x7B45, 0x7CA2, + 0x7C9E, 0x7CA8, 0x7CA1, 0x7D58, 0x7D6F, 0x7D63, 0x7D53, 0x7D56, + 0x7D67, 0x7D6A, 0x7D4F, 0x7D6D, 0x7D5C, 0x7D6B, 0x7D52, 0x7D54, + 0x7D69, 0x7D51, 0x7D5F, 0x7D4E, 0x7F3E, 0x7F3F, 0x7F65, ALTCHR, +/* 0xDB40 - 0xDBFF */ + 0x7F66, 0x7FA2, 0x7FA0, 0x7FA1, 0x7FD7, 0x8051, 0x804F, 0x8050, + 0x80FE, 0x80D4, 0x8143, 0x814A, 0x8152, 0x814F, 0x8147, 0x813D, + 0x814D, 0x813A, 0x81E6, 0x81EE, 0x81F7, 0x81F8, 0x81F9, 0x8204, + 0x823C, 0x823D, 0x823F, 0x8275, 0x833B, 0x83CF, 0x83F9, 0x8423, + 0x83C0, 0x83E8, 0x8412, 0x83E7, 0x83E4, 0x83FC, 0x83F6, 0x8410, + 0x83C6, 0x83C8, 0x83EB, 0x83E3, 0x83BF, 0x8401, 0x83DD, 0x83E5, + 0x83D8, 0x83FF, 0x83E1, 0x83CB, 0x83CE, 0x83D6, 0x83F5, 0x83C9, + 0x8409, 0x840F, 0x83DE, 0x8411, 0x8406, 0x83C2, 0x83F3, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x83D5, 0x83FA, 0x83C7, 0x83D1, 0x83EA, 0x8413, 0x83C3, + 0x83EC, 0x83EE, 0x83C4, 0x83FB, 0x83D7, 0x83E2, 0x841B, 0x83DB, + 0x83FE, 0x86D8, 0x86E2, 0x86E6, 0x86D3, 0x86E3, 0x86DA, 0x86EA, + 0x86DD, 0x86EB, 0x86DC, 0x86EC, 0x86E9, 0x86D7, 0x86E8, 0x86D1, + 0x8848, 0x8856, 0x8855, 0x88BA, 0x88D7, 0x88B9, 0x88B8, 0x88C0, + 0x88BE, 0x88B6, 0x88BC, 0x88B7, 0x88BD, 0x88B2, 0x8901, 0x88C9, + 0x8995, 0x8998, 0x8997, 0x89DD, 0x89DA, 0x89DB, 0x8A4E, 0x8A4D, + 0x8A39, 0x8A59, 0x8A40, 0x8A57, 0x8A58, 0x8A44, 0x8A45, 0x8A52, + 0x8A48, 0x8A51, 0x8A4A, 0x8A4C, 0x8A4F, 0x8C5F, 0x8C81, 0x8C80, + 0x8CBA, 0x8CBE, 0x8CB0, 0x8CB9, 0x8CB5, 0x8D84, 0x8D80, 0x8D89, + 0x8DD8, 0x8DD3, 0x8DCD, 0x8DC7, 0x8DD6, 0x8DDC, 0x8DCF, 0x8DD5, + 0x8DD9, 0x8DC8, 0x8DD7, 0x8DC5, 0x8EEF, 0x8EF7, 0x8EFA, ALTCHR, +/* 0xDC40 - 0xDCFF */ + 0x8EF9, 0x8EE6, 0x8EEE, 0x8EE5, 0x8EF5, 0x8EE7, 0x8EE8, 0x8EF6, + 0x8EEB, 0x8EF1, 0x8EEC, 0x8EF4, 0x8EE9, 0x902D, 0x9034, 0x902F, + 0x9106, 0x912C, 0x9104, 0x90FF, 0x90FC, 0x9108, 0x90F9, 0x90FB, + 0x9101, 0x9100, 0x9107, 0x9105, 0x9103, 0x9161, 0x9164, 0x915F, + 0x9162, 0x9160, 0x9201, 0x920A, 0x9225, 0x9203, 0x921A, 0x9226, + 0x920F, 0x920C, 0x9200, 0x9212, 0x91FF, 0x91FD, 0x9206, 0x9204, + 0x9227, 0x9202, 0x921C, 0x9224, 0x9219, 0x9217, 0x9205, 0x9216, + 0x957B, 0x958D, 0x958C, 0x9590, 0x9687, 0x967E, 0x9688, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9689, 0x9683, 0x9680, 0x96C2, 0x96C8, 0x96C3, 0x96F1, + 0x96F0, 0x976C, 0x9770, 0x976E, 0x9807, 0x98A9, 0x98EB, 0x9CE6, + 0x9EF9, 0x4E83, 0x4E84, 0x4EB6, 0x50BD, 0x50BF, 0x50C6, 0x50AE, + 0x50C4, 0x50CA, 0x50B4, 0x50C8, 0x50C2, 0x50B0, 0x50C1, 0x50BA, + 0x50B1, 0x50CB, 0x50C9, 0x50B6, 0x50B8, 0x51D7, 0x527A, 0x5278, + 0x527B, 0x527C, 0x55C3, 0x55DB, 0x55CC, 0x55D0, 0x55CB, 0x55CA, + 0x55DD, 0x55C0, 0x55D4, 0x55C4, 0x55E9, 0x55BF, 0x55D2, 0x558D, + 0x55CF, 0x55D5, 0x55E2, 0x55D6, 0x55C8, 0x55F2, 0x55CD, 0x55D9, + 0x55C2, 0x5714, 0x5853, 0x5868, 0x5864, 0x584F, 0x584D, 0x5849, + 0x586F, 0x5855, 0x584E, 0x585D, 0x5859, 0x5865, 0x585B, 0x583D, + 0x5863, 0x5871, 0x58FC, 0x5AC7, 0x5AC4, 0x5ACB, 0x5ABA, 0x5AB8, + 0x5AB1, 0x5AB5, 0x5AB0, 0x5ABF, 0x5AC8, 0x5ABB, 0x5AC6, ALTCHR, +/* 0xDD40 - 0xDDFF */ + 0x5AB7, 0x5AC0, 0x5ACA, 0x5AB4, 0x5AB6, 0x5ACD, 0x5AB9, 0x5A90, + 0x5BD6, 0x5BD8, 0x5BD9, 0x5C1F, 0x5C33, 0x5D71, 0x5D63, 0x5D4A, + 0x5D65, 0x5D72, 0x5D6C, 0x5D5E, 0x5D68, 0x5D67, 0x5D62, 0x5DF0, + 0x5E4F, 0x5E4E, 0x5E4A, 0x5E4D, 0x5E4B, 0x5EC5, 0x5ECC, 0x5EC6, + 0x5ECB, 0x5EC7, 0x5F40, 0x5FAF, 0x5FAD, 0x60F7, 0x6149, 0x614A, + 0x612B, 0x6145, 0x6136, 0x6132, 0x612E, 0x6146, 0x612F, 0x614F, + 0x6129, 0x6140, 0x6220, 0x9168, 0x6223, 0x6225, 0x6224, 0x63C5, + 0x63F1, 0x63EB, 0x6410, 0x6412, 0x6409, 0x6420, 0x6424, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6433, 0x6443, 0x641F, 0x6415, 0x6418, 0x6439, 0x6437, + 0x6422, 0x6423, 0x640C, 0x6426, 0x6430, 0x6428, 0x6441, 0x6435, + 0x642F, 0x640A, 0x641A, 0x6440, 0x6425, 0x6427, 0x640B, 0x63E7, + 0x641B, 0x642E, 0x6421, 0x640E, 0x656F, 0x6592, 0x65D3, 0x6686, + 0x668C, 0x6695, 0x6690, 0x668B, 0x668A, 0x6699, 0x6694, 0x6678, + 0x6720, 0x6966, 0x695F, 0x6938, 0x694E, 0x6962, 0x6971, 0x693F, + 0x6945, 0x696A, 0x6939, 0x6942, 0x6957, 0x6959, 0x697A, 0x6948, + 0x6949, 0x6935, 0x696C, 0x6933, 0x693D, 0x6965, 0x68F0, 0x6978, + 0x6934, 0x6969, 0x6940, 0x696F, 0x6944, 0x6976, 0x6958, 0x6941, + 0x6974, 0x694C, 0x693B, 0x694B, 0x6937, 0x695C, 0x694F, 0x6951, + 0x6932, 0x6952, 0x692F, 0x697B, 0x693C, 0x6B46, 0x6B45, 0x6B43, + 0x6B42, 0x6B48, 0x6B41, 0x6B9B, 0xFA0D, 0x6BFB, 0x6BFC, ALTCHR, +/* 0xDE40 - 0xDEFF */ + 0x6BF9, 0x6BF7, 0x6BF8, 0x6E9B, 0x6ED6, 0x6EC8, 0x6E8F, 0x6EC0, + 0x6E9F, 0x6E93, 0x6E94, 0x6EA0, 0x6EB1, 0x6EB9, 0x6EC6, 0x6ED2, + 0x6EBD, 0x6EC1, 0x6E9E, 0x6EC9, 0x6EB7, 0x6EB0, 0x6ECD, 0x6EA6, + 0x6ECF, 0x6EB2, 0x6EBE, 0x6EC3, 0x6EDC, 0x6ED8, 0x6E99, 0x6E92, + 0x6E8E, 0x6E8D, 0x6EA4, 0x6EA1, 0x6EBF, 0x6EB3, 0x6ED0, 0x6ECA, + 0x6E97, 0x6EAE, 0x6EA3, 0x7147, 0x7154, 0x7152, 0x7163, 0x7160, + 0x7141, 0x715D, 0x7162, 0x7172, 0x7178, 0x716A, 0x7161, 0x7142, + 0x7158, 0x7143, 0x714B, 0x7170, 0x715F, 0x7150, 0x7153, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7144, 0x714D, 0x715A, 0x724F, 0x728D, 0x728C, 0x7291, + 0x7290, 0x728E, 0x733C, 0x7342, 0x733B, 0x733A, 0x7340, 0x734A, + 0x7349, 0x7444, 0x744A, 0x744B, 0x7452, 0x7451, 0x7457, 0x7440, + 0x744F, 0x7450, 0x744E, 0x7442, 0x7446, 0x744D, 0x7454, 0x74E1, + 0x74FF, 0x74FE, 0x74FD, 0x751D, 0x7579, 0x7577, 0x6983, 0x75EF, + 0x760F, 0x7603, 0x75F7, 0x75FE, 0x75FC, 0x75F9, 0x75F8, 0x7610, + 0x75FB, 0x75F6, 0x75ED, 0x75F5, 0x75FD, 0x7699, 0x76B5, 0x76DD, + 0x7755, 0x775F, 0x7760, 0x7752, 0x7756, 0x775A, 0x7769, 0x7767, + 0x7754, 0x7759, 0x776D, 0x77E0, 0x7887, 0x789A, 0x7894, 0x788F, + 0x7884, 0x7895, 0x7885, 0x7886, 0x78A1, 0x7883, 0x7879, 0x7899, + 0x7880, 0x7896, 0x787B, 0x797C, 0x7982, 0x797D, 0x7979, 0x7A11, + 0x7A18, 0x7A19, 0x7A12, 0x7A17, 0x7A15, 0x7A22, 0x7A13, ALTCHR, +/* 0xDF40 - 0xDFFF */ + 0x7A1B, 0x7A10, 0x7AA3, 0x7AA2, 0x7A9E, 0x7AEB, 0x7B66, 0x7B64, + 0x7B6D, 0x7B74, 0x7B69, 0x7B72, 0x7B65, 0x7B73, 0x7B71, 0x7B70, + 0x7B61, 0x7B78, 0x7B76, 0x7B63, 0x7CB2, 0x7CB4, 0x7CAF, 0x7D88, + 0x7D86, 0x7D80, 0x7D8D, 0x7D7F, 0x7D85, 0x7D7A, 0x7D8E, 0x7D7B, + 0x7D83, 0x7D7C, 0x7D8C, 0x7D94, 0x7D84, 0x7D7D, 0x7D92, 0x7F6D, + 0x7F6B, 0x7F67, 0x7F68, 0x7F6C, 0x7FA6, 0x7FA5, 0x7FA7, 0x7FDB, + 0x7FDC, 0x8021, 0x8164, 0x8160, 0x8177, 0x815C, 0x8169, 0x815B, + 0x8162, 0x8172, 0x6721, 0x815E, 0x8176, 0x8167, 0x816F, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8144, 0x8161, 0x821D, 0x8249, 0x8244, 0x8240, 0x8242, + 0x8245, 0x84F1, 0x843F, 0x8456, 0x8476, 0x8479, 0x848F, 0x848D, + 0x8465, 0x8451, 0x8440, 0x8486, 0x8467, 0x8430, 0x844D, 0x847D, + 0x845A, 0x8459, 0x8474, 0x8473, 0x845D, 0x8507, 0x845E, 0x8437, + 0x843A, 0x8434, 0x847A, 0x8443, 0x8478, 0x8432, 0x8445, 0x8429, + 0x83D9, 0x844B, 0x842F, 0x8442, 0x842D, 0x845F, 0x8470, 0x8439, + 0x844E, 0x844C, 0x8452, 0x846F, 0x84C5, 0x848E, 0x843B, 0x8447, + 0x8436, 0x8433, 0x8468, 0x847E, 0x8444, 0x842B, 0x8460, 0x8454, + 0x846E, 0x8450, 0x870B, 0x8704, 0x86F7, 0x870C, 0x86FA, 0x86D6, + 0x86F5, 0x874D, 0x86F8, 0x870E, 0x8709, 0x8701, 0x86F6, 0x870D, + 0x8705, 0x88D6, 0x88CB, 0x88CD, 0x88CE, 0x88DE, 0x88DB, 0x88DA, + 0x88CC, 0x88D0, 0x8985, 0x899B, 0x89DF, 0x89E5, 0x89E4, ALTCHR, +/* 0xE040 - 0xE0FF */ + 0x89E1, 0x89E0, 0x89E2, 0x89DC, 0x89E6, 0x8A76, 0x8A86, 0x8A7F, + 0x8A61, 0x8A3F, 0x8A77, 0x8A82, 0x8A84, 0x8A75, 0x8A83, 0x8A81, + 0x8A74, 0x8A7A, 0x8C3C, 0x8C4B, 0x8C4A, 0x8C65, 0x8C64, 0x8C66, + 0x8C86, 0x8C84, 0x8C85, 0x8CCC, 0x8D68, 0x8D69, 0x8D91, 0x8D8C, + 0x8D8E, 0x8D8F, 0x8D8D, 0x8D93, 0x8D94, 0x8D90, 0x8D92, 0x8DF0, + 0x8DE0, 0x8DEC, 0x8DF1, 0x8DEE, 0x8DD0, 0x8DE9, 0x8DE3, 0x8DE2, + 0x8DE7, 0x8DF2, 0x8DEB, 0x8DF4, 0x8F06, 0x8EFF, 0x8F01, 0x8F00, + 0x8F05, 0x8F07, 0x8F08, 0x8F02, 0x8F0B, 0x9052, 0x903F, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9044, 0x9049, 0x903D, 0x9110, 0x910D, 0x910F, 0x9111, + 0x9116, 0x9114, 0x910B, 0x910E, 0x916E, 0x916F, 0x9248, 0x9252, + 0x9230, 0x923A, 0x9266, 0x9233, 0x9265, 0x925E, 0x9283, 0x922E, + 0x924A, 0x9246, 0x926D, 0x926C, 0x924F, 0x9260, 0x9267, 0x926F, + 0x9236, 0x9261, 0x9270, 0x9231, 0x9254, 0x9263, 0x9250, 0x9272, + 0x924E, 0x9253, 0x924C, 0x9256, 0x9232, 0x959F, 0x959C, 0x959E, + 0x959B, 0x9692, 0x9693, 0x9691, 0x9697, 0x96CE, 0x96FA, 0x96FD, + 0x96F8, 0x96F5, 0x9773, 0x9777, 0x9778, 0x9772, 0x980F, 0x980D, + 0x980E, 0x98AC, 0x98F6, 0x98F9, 0x99AF, 0x99B2, 0x99B0, 0x99B5, + 0x9AAD, 0x9AAB, 0x9B5B, 0x9CEA, 0x9CED, 0x9CE7, 0x9E80, 0x9EFD, + 0x50E6, 0x50D4, 0x50D7, 0x50E8, 0x50F3, 0x50DB, 0x50EA, 0x50DD, + 0x50E4, 0x50D3, 0x50EC, 0x50F0, 0x50EF, 0x50E3, 0x50E0, ALTCHR, +/* 0xE140 - 0xE1FF */ + 0x51D8, 0x5280, 0x5281, 0x52E9, 0x52EB, 0x5330, 0x53AC, 0x5627, + 0x5615, 0x560C, 0x5612, 0x55FC, 0x560F, 0x561C, 0x5601, 0x5613, + 0x5602, 0x55FA, 0x561D, 0x5604, 0x55FF, 0x55F9, 0x5889, 0x587C, + 0x5890, 0x5898, 0x5886, 0x5881, 0x587F, 0x5874, 0x588B, 0x587A, + 0x5887, 0x5891, 0x588E, 0x5876, 0x5882, 0x5888, 0x587B, 0x5894, + 0x588F, 0x58FE, 0x596B, 0x5ADC, 0x5AEE, 0x5AE5, 0x5AD5, 0x5AEA, + 0x5ADA, 0x5AED, 0x5AEB, 0x5AF3, 0x5AE2, 0x5AE0, 0x5ADB, 0x5AEC, + 0x5ADE, 0x5ADD, 0x5AD9, 0x5AE8, 0x5ADF, 0x5B77, 0x5BE0, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x5BE3, 0x5C63, 0x5D82, 0x5D80, 0x5D7D, 0x5D86, 0x5D7A, + 0x5D81, 0x5D77, 0x5D8A, 0x5D89, 0x5D88, 0x5D7E, 0x5D7C, 0x5D8D, + 0x5D79, 0x5D7F, 0x5E58, 0x5E59, 0x5E53, 0x5ED8, 0x5ED1, 0x5ED7, + 0x5ECE, 0x5EDC, 0x5ED5, 0x5ED9, 0x5ED2, 0x5ED4, 0x5F44, 0x5F43, + 0x5F6F, 0x5FB6, 0x612C, 0x6128, 0x6141, 0x615E, 0x6171, 0x6173, + 0x6152, 0x6153, 0x6172, 0x616C, 0x6180, 0x6174, 0x6154, 0x617A, + 0x615B, 0x6165, 0x613B, 0x616A, 0x6161, 0x6156, 0x6229, 0x6227, + 0x622B, 0x642B, 0x644D, 0x645B, 0x645D, 0x6474, 0x6476, 0x6472, + 0x6473, 0x647D, 0x6475, 0x6466, 0x64A6, 0x644E, 0x6482, 0x645E, + 0x645C, 0x644B, 0x6453, 0x6460, 0x6450, 0x647F, 0x643F, 0x646C, + 0x646B, 0x6459, 0x6465, 0x6477, 0x6573, 0x65A0, 0x66A1, 0x66A0, + 0x669F, 0x6705, 0x6704, 0x6722, 0x69B1, 0x69B6, 0x69C9, ALTCHR, +/* 0xE240 - 0xE2FF */ + 0x69A0, 0x69CE, 0x6996, 0x69B0, 0x69AC, 0x69BC, 0x6991, 0x6999, + 0x698E, 0x69A7, 0x698D, 0x69A9, 0x69BE, 0x69AF, 0x69BF, 0x69C4, + 0x69BD, 0x69A4, 0x69D4, 0x69B9, 0x69CA, 0x699A, 0x69CF, 0x69B3, + 0x6993, 0x69AA, 0x69A1, 0x699E, 0x69D9, 0x6997, 0x6990, 0x69C2, + 0x69B5, 0x69A5, 0x69C6, 0x6B4A, 0x6B4D, 0x6B4B, 0x6B9E, 0x6B9F, + 0x6BA0, 0x6BC3, 0x6BC4, 0x6BFE, 0x6ECE, 0x6EF5, 0x6EF1, 0x6F03, + 0x6F25, 0x6EF8, 0x6F37, 0x6EFB, 0x6F2E, 0x6F09, 0x6F4E, 0x6F19, + 0x6F1A, 0x6F27, 0x6F18, 0x6F3B, 0x6F12, 0x6EED, 0x6F0A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x6F36, 0x6F73, 0x6EF9, 0x6EEE, 0x6F2D, 0x6F40, 0x6F30, + 0x6F3C, 0x6F35, 0x6EEB, 0x6F07, 0x6F0E, 0x6F43, 0x6F05, 0x6EFD, + 0x6EF6, 0x6F39, 0x6F1C, 0x6EFC, 0x6F3A, 0x6F1F, 0x6F0D, 0x6F1E, + 0x6F08, 0x6F21, 0x7187, 0x7190, 0x7189, 0x7180, 0x7185, 0x7182, + 0x718F, 0x717B, 0x7186, 0x7181, 0x7197, 0x7244, 0x7253, 0x7297, + 0x7295, 0x7293, 0x7343, 0x734D, 0x7351, 0x734C, 0x7462, 0x7473, + 0x7471, 0x7475, 0x7472, 0x7467, 0x746E, 0x7500, 0x7502, 0x7503, + 0x757D, 0x7590, 0x7616, 0x7608, 0x760C, 0x7615, 0x7611, 0x760A, + 0x7614, 0x76B8, 0x7781, 0x777C, 0x7785, 0x7782, 0x776E, 0x7780, + 0x776F, 0x777E, 0x7783, 0x78B2, 0x78AA, 0x78B4, 0x78AD, 0x78A8, + 0x787E, 0x78AB, 0x789E, 0x78A5, 0x78A0, 0x78AC, 0x78A2, 0x78A4, + 0x7998, 0x798A, 0x798B, 0x7996, 0x7995, 0x7994, 0x7993, ALTCHR, +/* 0xE340 - 0xE3FF */ + 0x7997, 0x7988, 0x7992, 0x7990, 0x7A2B, 0x7A4A, 0x7A30, 0x7A2F, + 0x7A28, 0x7A26, 0x7AA8, 0x7AAB, 0x7AAC, 0x7AEE, 0x7B88, 0x7B9C, + 0x7B8A, 0x7B91, 0x7B90, 0x7B96, 0x7B8D, 0x7B8C, 0x7B9B, 0x7B8E, + 0x7B85, 0x7B98, 0x5284, 0x7B99, 0x7BA4, 0x7B82, 0x7CBB, 0x7CBF, + 0x7CBC, 0x7CBA, 0x7DA7, 0x7DB7, 0x7DC2, 0x7DA3, 0x7DAA, 0x7DC1, + 0x7DC0, 0x7DC5, 0x7D9D, 0x7DCE, 0x7DC4, 0x7DC6, 0x7DCB, 0x7DCC, + 0x7DAF, 0x7DB9, 0x7D96, 0x7DBC, 0x7D9F, 0x7DA6, 0x7DAE, 0x7DA9, + 0x7DA1, 0x7DC9, 0x7F73, 0x7FE2, 0x7FE3, 0x7FE5, 0x7FDE, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8024, 0x805D, 0x805C, 0x8189, 0x8186, 0x8183, 0x8187, + 0x818D, 0x818C, 0x818B, 0x8215, 0x8497, 0x84A4, 0x84A1, 0x849F, + 0x84BA, 0x84CE, 0x84C2, 0x84AC, 0x84AE, 0x84AB, 0x84B9, 0x84B4, + 0x84C1, 0x84CD, 0x84AA, 0x849A, 0x84B1, 0x84D0, 0x849D, 0x84A7, + 0x84BB, 0x84A2, 0x8494, 0x84C7, 0x84CC, 0x849B, 0x84A9, 0x84AF, + 0x84A8, 0x84D6, 0x8498, 0x84B6, 0x84CF, 0x84A0, 0x84D7, 0x84D4, + 0x84D2, 0x84DB, 0x84B0, 0x8491, 0x8661, 0x8733, 0x8723, 0x8728, + 0x876B, 0x8740, 0x872E, 0x871E, 0x8721, 0x8719, 0x871B, 0x8743, + 0x872C, 0x8741, 0x873E, 0x8746, 0x8720, 0x8732, 0x872A, 0x872D, + 0x873C, 0x8712, 0x873A, 0x8731, 0x8735, 0x8742, 0x8726, 0x8727, + 0x8738, 0x8724, 0x871A, 0x8730, 0x8711, 0x88F7, 0x88E7, 0x88F1, + 0x88F2, 0x88FA, 0x88FE, 0x88EE, 0x88FC, 0x88F6, 0x88FB, ALTCHR, +/* 0xE440 - 0xE4FF */ + 0x88F0, 0x88EC, 0x88EB, 0x899D, 0x89A1, 0x899F, 0x899E, 0x89E9, + 0x89EB, 0x89E8, 0x8AAB, 0x8A99, 0x8A8B, 0x8A92, 0x8A8F, 0x8A96, + 0x8C3D, 0x8C68, 0x8C69, 0x8CD5, 0x8CCF, 0x8CD7, 0x8D96, 0x8E09, + 0x8E02, 0x8DFF, 0x8E0D, 0x8DFD, 0x8E0A, 0x8E03, 0x8E07, 0x8E06, + 0x8E05, 0x8DFE, 0x8E00, 0x8E04, 0x8F10, 0x8F11, 0x8F0E, 0x8F0D, + 0x9123, 0x911C, 0x9120, 0x9122, 0x911F, 0x911D, 0x911A, 0x9124, + 0x9121, 0x911B, 0x917A, 0x9172, 0x9179, 0x9173, 0x92A5, 0x92A4, + 0x9276, 0x929B, 0x927A, 0x92A0, 0x9294, 0x92AA, 0x928D, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x92A6, 0x929A, 0x92AB, 0x9279, 0x9297, 0x927F, 0x92A3, + 0x92EE, 0x928E, 0x9282, 0x9295, 0x92A2, 0x927D, 0x9288, 0x92A1, + 0x928A, 0x9286, 0x928C, 0x9299, 0x92A7, 0x927E, 0x9287, 0x92A9, + 0x929D, 0x928B, 0x922D, 0x969E, 0x96A1, 0x96FF, 0x9758, 0x977D, + 0x977A, 0x977E, 0x9783, 0x9780, 0x9782, 0x977B, 0x9784, 0x9781, + 0x977F, 0x97CE, 0x97CD, 0x9816, 0x98AD, 0x98AE, 0x9902, 0x9900, + 0x9907, 0x999D, 0x999C, 0x99C3, 0x99B9, 0x99BB, 0x99BA, 0x99C2, + 0x99BD, 0x99C7, 0x9AB1, 0x9AE3, 0x9AE7, 0x9B3E, 0x9B3F, 0x9B60, + 0x9B61, 0x9B5F, 0x9CF1, 0x9CF2, 0x9CF5, 0x9EA7, 0x50FF, 0x5103, + 0x5130, 0x50F8, 0x5106, 0x5107, 0x50F6, 0x50FE, 0x510B, 0x510C, + 0x50FD, 0x510A, 0x528B, 0x528C, 0x52F1, 0x52EF, 0x5648, 0x5642, + 0x564C, 0x5635, 0x5641, 0x564A, 0x5649, 0x5646, 0x5658, ALTCHR, +/* 0xE540 - 0xE5FF */ + 0x565A, 0x5640, 0x5633, 0x563D, 0x562C, 0x563E, 0x5638, 0x562A, + 0x563A, 0x571A, 0x58AB, 0x589D, 0x58B1, 0x58A0, 0x58A3, 0x58AF, + 0x58AC, 0x58A5, 0x58A1, 0x58FF, 0x5AFF, 0x5AF4, 0x5AFD, 0x5AF7, + 0x5AF6, 0x5B03, 0x5AF8, 0x5B02, 0x5AF9, 0x5B01, 0x5B07, 0x5B05, + 0x5B0F, 0x5C67, 0x5D99, 0x5D97, 0x5D9F, 0x5D92, 0x5DA2, 0x5D93, + 0x5D95, 0x5DA0, 0x5D9C, 0x5DA1, 0x5D9A, 0x5D9E, 0x5E69, 0x5E5D, + 0x5E60, 0x5E5C, 0x7DF3, 0x5EDB, 0x5EDE, 0x5EE1, 0x5F49, 0x5FB2, + 0x618B, 0x6183, 0x6179, 0x61B1, 0x61B0, 0x61A2, 0x6189, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x619B, 0x6193, 0x61AF, 0x61AD, 0x619F, 0x6192, 0x61AA, + 0x61A1, 0x618D, 0x6166, 0x61B3, 0x622D, 0x646E, 0x6470, 0x6496, + 0x64A0, 0x6485, 0x6497, 0x649C, 0x648F, 0x648B, 0x648A, 0x648C, + 0x64A3, 0x649F, 0x6468, 0x64B1, 0x6498, 0x6576, 0x657A, 0x6579, + 0x657B, 0x65B2, 0x65B3, 0x66B5, 0x66B0, 0x66A9, 0x66B2, 0x66B7, + 0x66AA, 0x66AF, 0x6A00, 0x6A06, 0x6A17, 0x69E5, 0x69F8, 0x6A15, + 0x69F1, 0x69E4, 0x6A20, 0x69FF, 0x69EC, 0x69E2, 0x6A1B, 0x6A1D, + 0x69FE, 0x6A27, 0x69F2, 0x69EE, 0x6A14, 0x69F7, 0x69E7, 0x6A40, + 0x6A08, 0x69E6, 0x69FB, 0x6A0D, 0x69FC, 0x69EB, 0x6A09, 0x6A04, + 0x6A18, 0x6A25, 0x6A0F, 0x69F6, 0x6A26, 0x6A07, 0x69F4, 0x6A16, + 0x6B51, 0x6BA5, 0x6BA3, 0x6BA2, 0x6BA6, 0x6C01, 0x6C00, 0x6BFF, + 0x6C02, 0x6F41, 0x6F26, 0x6F7E, 0x6F87, 0x6FC6, 0x6F92, ALTCHR, +/* 0xE640 - 0xE6FF */ + 0x6F8D, 0x6F89, 0x6F8C, 0x6F62, 0x6F4F, 0x6F85, 0x6F5A, 0x6F96, + 0x6F76, 0x6F6C, 0x6F82, 0x6F55, 0x6F72, 0x6F52, 0x6F50, 0x6F57, + 0x6F94, 0x6F93, 0x6F5D, 0x6F00, 0x6F61, 0x6F6B, 0x6F7D, 0x6F67, + 0x6F90, 0x6F53, 0x6F8B, 0x6F69, 0x6F7F, 0x6F95, 0x6F63, 0x6F77, + 0x6F6A, 0x6F7B, 0x71B2, 0x71AF, 0x719B, 0x71B0, 0x71A0, 0x719A, + 0x71A9, 0x71B5, 0x719D, 0x71A5, 0x719E, 0x71A4, 0x71A1, 0x71AA, + 0x719C, 0x71A7, 0x71B3, 0x7298, 0x729A, 0x7358, 0x7352, 0x735E, + 0x735F, 0x7360, 0x735D, 0x735B, 0x7361, 0x735A, 0x7359, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7362, 0x7487, 0x7489, 0x748A, 0x7486, 0x7481, 0x747D, + 0x7485, 0x7488, 0x747C, 0x7479, 0x7508, 0x7507, 0x757E, 0x7625, + 0x761E, 0x7619, 0x761D, 0x761C, 0x7623, 0x761A, 0x7628, 0x761B, + 0x769C, 0x769D, 0x769E, 0x769B, 0x778D, 0x778F, 0x7789, 0x7788, + 0x78CD, 0x78BB, 0x78CF, 0x78CC, 0x78D1, 0x78CE, 0x78D4, 0x78C8, + 0x78C3, 0x78C4, 0x78C9, 0x799A, 0x79A1, 0x79A0, 0x799C, 0x79A2, + 0x799B, 0x6B76, 0x7A39, 0x7AB2, 0x7AB4, 0x7AB3, 0x7BB7, 0x7BCB, + 0x7BBE, 0x7BAC, 0x7BCE, 0x7BAF, 0x7BB9, 0x7BCA, 0x7BB5, 0x7CC5, + 0x7CC8, 0x7CCC, 0x7CCB, 0x7DF7, 0x7DDB, 0x7DEA, 0x7DE7, 0x7DD7, + 0x7DE1, 0x7E03, 0x7DFA, 0x7DE6, 0x7DF6, 0x7DF1, 0x7DF0, 0x7DEE, + 0x7DDF, 0x7F76, 0x7FAC, 0x7FB0, 0x7FAD, 0x7FED, 0x7FEB, 0x7FEA, + 0x7FEC, 0x7FE6, 0x7FE8, 0x8064, 0x8067, 0x81A3, 0x819F, ALTCHR, +/* 0xE740 - 0xE7FF */ + 0x819E, 0x8195, 0x81A2, 0x8199, 0x8197, 0x8216, 0x824F, 0x8253, + 0x8252, 0x8250, 0x824E, 0x8251, 0x8524, 0x853B, 0x850F, 0x8500, + 0x8529, 0x850E, 0x8509, 0x850D, 0x851F, 0x850A, 0x8527, 0x851C, + 0x84FB, 0x852B, 0x84FA, 0x8508, 0x850C, 0x84F4, 0x852A, 0x84F2, + 0x8515, 0x84F7, 0x84EB, 0x84F3, 0x84FC, 0x8512, 0x84EA, 0x84E9, + 0x8516, 0x84FE, 0x8528, 0x851D, 0x852E, 0x8502, 0x84FD, 0x851E, + 0x84F6, 0x8531, 0x8526, 0x84E7, 0x84E8, 0x84F0, 0x84EF, 0x84F9, + 0x8518, 0x8520, 0x8530, 0x850B, 0x8519, 0x852F, 0x8662, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8756, 0x8763, 0x8764, 0x8777, 0x87E1, 0x8773, 0x8758, + 0x8754, 0x875B, 0x8752, 0x8761, 0x875A, 0x8751, 0x875E, 0x876D, + 0x876A, 0x8750, 0x874E, 0x875F, 0x875D, 0x876F, 0x876C, 0x877A, + 0x876E, 0x875C, 0x8765, 0x874F, 0x877B, 0x8775, 0x8762, 0x8767, + 0x8769, 0x885A, 0x8905, 0x890C, 0x8914, 0x890B, 0x8917, 0x8918, + 0x8919, 0x8906, 0x8916, 0x8911, 0x890E, 0x8909, 0x89A2, 0x89A4, + 0x89A3, 0x89ED, 0x89F0, 0x89EC, 0x8ACF, 0x8AC6, 0x8AB8, 0x8AD3, + 0x8AD1, 0x8AD4, 0x8AD5, 0x8ABB, 0x8AD7, 0x8ABE, 0x8AC0, 0x8AC5, + 0x8AD8, 0x8AC3, 0x8ABA, 0x8ABD, 0x8AD9, 0x8C3E, 0x8C4D, 0x8C8F, + 0x8CE5, 0x8CDF, 0x8CD9, 0x8CE8, 0x8CDA, 0x8CDD, 0x8CE7, 0x8DA0, + 0x8D9C, 0x8DA1, 0x8D9B, 0x8E20, 0x8E23, 0x8E25, 0x8E24, 0x8E2E, + 0x8E15, 0x8E1B, 0x8E16, 0x8E11, 0x8E19, 0x8E26, 0x8E27, ALTCHR, +/* 0xE840 - 0xE8FF */ + 0x8E14, 0x8E12, 0x8E18, 0x8E13, 0x8E1C, 0x8E17, 0x8E1A, 0x8F2C, + 0x8F24, 0x8F18, 0x8F1A, 0x8F20, 0x8F23, 0x8F16, 0x8F17, 0x9073, + 0x9070, 0x906F, 0x9067, 0x906B, 0x912F, 0x912B, 0x9129, 0x912A, + 0x9132, 0x9126, 0x912E, 0x9185, 0x9186, 0x918A, 0x9181, 0x9182, + 0x9184, 0x9180, 0x92D0, 0x92C3, 0x92C4, 0x92C0, 0x92D9, 0x92B6, + 0x92CF, 0x92F1, 0x92DF, 0x92D8, 0x92E9, 0x92D7, 0x92DD, 0x92CC, + 0x92EF, 0x92C2, 0x92E8, 0x92CA, 0x92C8, 0x92CE, 0x92E6, 0x92CD, + 0x92D5, 0x92C9, 0x92E0, 0x92DE, 0x92E7, 0x92D1, 0x92D3, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x92B5, 0x92E1, 0x92C6, 0x92B4, 0x957C, 0x95AC, 0x95AB, + 0x95AE, 0x95B0, 0x96A4, 0x96A2, 0x96D3, 0x9705, 0x9708, 0x9702, + 0x975A, 0x978A, 0x978E, 0x9788, 0x97D0, 0x97CF, 0x981E, 0x981D, + 0x9826, 0x9829, 0x9828, 0x9820, 0x981B, 0x9827, 0x98B2, 0x9908, + 0x98FA, 0x9911, 0x9914, 0x9916, 0x9917, 0x9915, 0x99DC, 0x99CD, + 0x99CF, 0x99D3, 0x99D4, 0x99CE, 0x99C9, 0x99D6, 0x99D8, 0x99CB, + 0x99D7, 0x99CC, 0x9AB3, 0x9AEC, 0x9AEB, 0x9AF3, 0x9AF2, 0x9AF1, + 0x9B46, 0x9B43, 0x9B67, 0x9B74, 0x9B71, 0x9B66, 0x9B76, 0x9B75, + 0x9B70, 0x9B68, 0x9B64, 0x9B6C, 0x9CFC, 0x9CFA, 0x9CFD, 0x9CFF, + 0x9CF7, 0x9D07, 0x9D00, 0x9CF9, 0x9CFB, 0x9D08, 0x9D05, 0x9D04, + 0x9E83, 0x9ED3, 0x9F0F, 0x9F10, 0x511C, 0x5113, 0x5117, 0x511A, + 0x5111, 0x51DE, 0x5334, 0x53E1, 0x5670, 0x5660, 0x566E, ALTCHR, +/* 0xE940 - 0xE9FF */ + 0x5673, 0x5666, 0x5663, 0x566D, 0x5672, 0x565E, 0x5677, 0x571C, + 0x571B, 0x58C8, 0x58BD, 0x58C9, 0x58BF, 0x58BA, 0x58C2, 0x58BC, + 0x58C6, 0x5B17, 0x5B19, 0x5B1B, 0x5B21, 0x5B14, 0x5B13, 0x5B10, + 0x5B16, 0x5B28, 0x5B1A, 0x5B20, 0x5B1E, 0x5BEF, 0x5DAC, 0x5DB1, + 0x5DA9, 0x5DA7, 0x5DB5, 0x5DB0, 0x5DAE, 0x5DAA, 0x5DA8, 0x5DB2, + 0x5DAD, 0x5DAF, 0x5DB4, 0x5E67, 0x5E68, 0x5E66, 0x5E6F, 0x5EE9, + 0x5EE7, 0x5EE6, 0x5EE8, 0x5EE5, 0x5F4B, 0x5FBC, 0x619D, 0x61A8, + 0x6196, 0x61C5, 0x61B4, 0x61C6, 0x61C1, 0x61CC, 0x61BA, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x61BF, 0x61B8, 0x618C, 0x64D7, 0x64D6, 0x64D0, 0x64CF, + 0x64C9, 0x64BD, 0x6489, 0x64C3, 0x64DB, 0x64F3, 0x64D9, 0x6533, + 0x657F, 0x657C, 0x65A2, 0x66C8, 0x66BE, 0x66C0, 0x66CA, 0x66CB, + 0x66CF, 0x66BD, 0x66BB, 0x66BA, 0x66CC, 0x6723, 0x6A34, 0x6A66, + 0x6A49, 0x6A67, 0x6A32, 0x6A68, 0x6A3E, 0x6A5D, 0x6A6D, 0x6A76, + 0x6A5B, 0x6A51, 0x6A28, 0x6A5A, 0x6A3B, 0x6A3F, 0x6A41, 0x6A6A, + 0x6A64, 0x6A50, 0x6A4F, 0x6A54, 0x6A6F, 0x6A69, 0x6A60, 0x6A3C, + 0x6A5E, 0x6A56, 0x6A55, 0x6A4D, 0x6A4E, 0x6A46, 0x6B55, 0x6B54, + 0x6B56, 0x6BA7, 0x6BAA, 0x6BAB, 0x6BC8, 0x6BC7, 0x6C04, 0x6C03, + 0x6C06, 0x6FAD, 0x6FCB, 0x6FA3, 0x6FC7, 0x6FBC, 0x6FCE, 0x6FC8, + 0x6F5E, 0x6FC4, 0x6FBD, 0x6F9E, 0x6FCA, 0x6FA8, 0x7004, 0x6FA5, + 0x6FAE, 0x6FBA, 0x6FAC, 0x6FAA, 0x6FCF, 0x6FBF, 0x6FB8, ALTCHR, +/* 0xEA40 - 0xEAFF */ + 0x6FA2, 0x6FC9, 0x6FAB, 0x6FCD, 0x6FAF, 0x6FB2, 0x6FB0, 0x71C5, + 0x71C2, 0x71BF, 0x71B8, 0x71D6, 0x71C0, 0x71C1, 0x71CB, 0x71D4, + 0x71CA, 0x71C7, 0x71CF, 0x71BD, 0x71D8, 0x71BC, 0x71C6, 0x71DA, + 0x71DB, 0x729D, 0x729E, 0x7369, 0x7366, 0x7367, 0x736C, 0x7365, + 0x736B, 0x736A, 0x747F, 0x749A, 0x74A0, 0x7494, 0x7492, 0x7495, + 0x74A1, 0x750B, 0x7580, 0x762F, 0x762D, 0x7631, 0x763D, 0x7633, + 0x763C, 0x7635, 0x7632, 0x7630, 0x76BB, 0x76E6, 0x779A, 0x779D, + 0x77A1, 0x779C, 0x779B, 0x77A2, 0x77A3, 0x7795, 0x7799, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7797, 0x78DD, 0x78E9, 0x78E5, 0x78EA, 0x78DE, 0x78E3, + 0x78DB, 0x78E1, 0x78E2, 0x78ED, 0x78DF, 0x78E0, 0x79A4, 0x7A44, + 0x7A48, 0x7A47, 0x7AB6, 0x7AB8, 0x7AB5, 0x7AB1, 0x7AB7, 0x7BDE, + 0x7BE3, 0x7BE7, 0x7BDD, 0x7BD5, 0x7BE5, 0x7BDA, 0x7BE8, 0x7BF9, + 0x7BD4, 0x7BEA, 0x7BE2, 0x7BDC, 0x7BEB, 0x7BD8, 0x7BDF, 0x7CD2, + 0x7CD4, 0x7CD7, 0x7CD0, 0x7CD1, 0x7E12, 0x7E21, 0x7E17, 0x7E0C, + 0x7E1F, 0x7E20, 0x7E13, 0x7E0E, 0x7E1C, 0x7E15, 0x7E1A, 0x7E22, + 0x7E0B, 0x7E0F, 0x7E16, 0x7E0D, 0x7E14, 0x7E25, 0x7E24, 0x7F43, + 0x7F7B, 0x7F7C, 0x7F7A, 0x7FB1, 0x7FEF, 0x802A, 0x8029, 0x806C, + 0x81B1, 0x81A6, 0x81AE, 0x81B9, 0x81B5, 0x81AB, 0x81B0, 0x81AC, + 0x81B4, 0x81B2, 0x81B7, 0x81A7, 0x81F2, 0x8255, 0x8256, 0x8257, + 0x8556, 0x8545, 0x856B, 0x854D, 0x8553, 0x8561, 0x8558, ALTCHR, +/* 0xEB40 - 0xEBFF */ + 0x8540, 0x8546, 0x8564, 0x8541, 0x8562, 0x8544, 0x8551, 0x8547, + 0x8563, 0x853E, 0x855B, 0x8571, 0x854E, 0x856E, 0x8575, 0x8555, + 0x8567, 0x8560, 0x858C, 0x8566, 0x855D, 0x8554, 0x8565, 0x856C, + 0x8663, 0x8665, 0x8664, 0x879B, 0x878F, 0x8797, 0x8793, 0x8792, + 0x8788, 0x8781, 0x8796, 0x8798, 0x8779, 0x8787, 0x87A3, 0x8785, + 0x8790, 0x8791, 0x879D, 0x8784, 0x8794, 0x879C, 0x879A, 0x8789, + 0x891E, 0x8926, 0x8930, 0x892D, 0x892E, 0x8927, 0x8931, 0x8922, + 0x8929, 0x8923, 0x892F, 0x892C, 0x891F, 0x89F1, 0x8AE0, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8AE2, 0x8AF2, 0x8AF4, 0x8AF5, 0x8ADD, 0x8B14, 0x8AE4, + 0x8ADF, 0x8AF0, 0x8AC8, 0x8ADE, 0x8AE1, 0x8AE8, 0x8AFF, 0x8AEF, + 0x8AFB, 0x8C91, 0x8C92, 0x8C90, 0x8CF5, 0x8CEE, 0x8CF1, 0x8CF0, + 0x8CF3, 0x8D6C, 0x8D6E, 0x8DA5, 0x8DA7, 0x8E33, 0x8E3E, 0x8E38, + 0x8E40, 0x8E45, 0x8E36, 0x8E3C, 0x8E3D, 0x8E41, 0x8E30, 0x8E3F, + 0x8EBD, 0x8F36, 0x8F2E, 0x8F35, 0x8F32, 0x8F39, 0x8F37, 0x8F34, + 0x9076, 0x9079, 0x907B, 0x9086, 0x90FA, 0x9133, 0x9135, 0x9136, + 0x9193, 0x9190, 0x9191, 0x918D, 0x918F, 0x9327, 0x931E, 0x9308, + 0x931F, 0x9306, 0x930F, 0x937A, 0x9338, 0x933C, 0x931B, 0x9323, + 0x9312, 0x9301, 0x9346, 0x932D, 0x930E, 0x930D, 0x92CB, 0x931D, + 0x92FA, 0x9325, 0x9313, 0x92F9, 0x92F7, 0x9334, 0x9302, 0x9324, + 0x92FF, 0x9329, 0x9339, 0x9335, 0x932A, 0x9314, 0x930C, ALTCHR, +/* 0xEC40 - 0xECFF */ + 0x930B, 0x92FE, 0x9309, 0x9300, 0x92FB, 0x9316, 0x95BC, 0x95CD, + 0x95BE, 0x95B9, 0x95BA, 0x95B6, 0x95BF, 0x95B5, 0x95BD, 0x96A9, + 0x96D4, 0x970B, 0x9712, 0x9710, 0x9799, 0x9797, 0x9794, 0x97F0, + 0x97F8, 0x9835, 0x982F, 0x9832, 0x9924, 0x991F, 0x9927, 0x9929, + 0x999E, 0x99EE, 0x99EC, 0x99E5, 0x99E4, 0x99F0, 0x99E3, 0x99EA, + 0x99E9, 0x99E7, 0x9AB9, 0x9ABF, 0x9AB4, 0x9ABB, 0x9AF6, 0x9AFA, + 0x9AF9, 0x9AF7, 0x9B33, 0x9B80, 0x9B85, 0x9B87, 0x9B7C, 0x9B7E, + 0x9B7B, 0x9B82, 0x9B93, 0x9B92, 0x9B90, 0x9B7A, 0x9B95, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9B7D, 0x9B88, 0x9D25, 0x9D17, 0x9D20, 0x9D1E, 0x9D14, + 0x9D29, 0x9D1D, 0x9D18, 0x9D22, 0x9D10, 0x9D19, 0x9D1F, 0x9E88, + 0x9E86, 0x9E87, 0x9EAE, 0x9EAD, 0x9ED5, 0x9ED6, 0x9EFA, 0x9F12, + 0x9F3D, 0x5126, 0x5125, 0x5122, 0x5124, 0x5120, 0x5129, 0x52F4, + 0x5693, 0x568C, 0x568D, 0x5686, 0x5684, 0x5683, 0x567E, 0x5682, + 0x567F, 0x5681, 0x58D6, 0x58D4, 0x58CF, 0x58D2, 0x5B2D, 0x5B25, + 0x5B32, 0x5B23, 0x5B2C, 0x5B27, 0x5B26, 0x5B2F, 0x5B2E, 0x5B7B, + 0x5BF1, 0x5BF2, 0x5DB7, 0x5E6C, 0x5E6A, 0x5FBE, 0x5FBB, 0x61C3, + 0x61B5, 0x61BC, 0x61E7, 0x61E0, 0x61E5, 0x61E4, 0x61E8, 0x61DE, + 0x64EF, 0x64E9, 0x64E3, 0x64EB, 0x64E4, 0x64E8, 0x6581, 0x6580, + 0x65B6, 0x65DA, 0x66D2, 0x6A8D, 0x6A96, 0x6A81, 0x6AA5, 0x6A89, + 0x6A9F, 0x6A9B, 0x6AA1, 0x6A9E, 0x6A87, 0x6A93, 0x6A8E, ALTCHR, +/* 0xED40 - 0xEDFF */ + 0x6A95, 0x6A83, 0x6AA8, 0x6AA4, 0x6A91, 0x6A7F, 0x6AA6, 0x6A9A, + 0x6A85, 0x6A8C, 0x6A92, 0x6B5B, 0x6BAD, 0x6C09, 0x6FCC, 0x6FA9, + 0x6FF4, 0x6FD4, 0x6FE3, 0x6FDC, 0x6FED, 0x6FE7, 0x6FE6, 0x6FDE, + 0x6FF2, 0x6FDD, 0x6FE2, 0x6FE8, 0x71E1, 0x71F1, 0x71E8, 0x71F2, + 0x71E4, 0x71F0, 0x71E2, 0x7373, 0x736E, 0x736F, 0x7497, 0x74B2, + 0x74AB, 0x7490, 0x74AA, 0x74AD, 0x74B1, 0x74A5, 0x74AF, 0x7510, + 0x7511, 0x7512, 0x750F, 0x7584, 0x7643, 0x7648, 0x7649, 0x7647, + 0x76A4, 0x76E9, 0x77B5, 0x77AB, 0x77B2, 0x77B7, 0x77B6, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x77B4, 0x77B1, 0x77A8, 0x77F0, 0x78F3, 0x78FD, 0x7902, + 0x78FB, 0x78FC, 0x78F2, 0x7905, 0x78F9, 0x78FE, 0x7904, 0x79AB, + 0x79A8, 0x7A5C, 0x7A5B, 0x7A56, 0x7A58, 0x7A54, 0x7A5A, 0x7ABE, + 0x7AC0, 0x7AC1, 0x7C05, 0x7C0F, 0x7BF2, 0x7C00, 0x7BFF, 0x7BFB, + 0x7C0E, 0x7BF4, 0x7C0B, 0x7BF3, 0x7C02, 0x7C09, 0x7C03, 0x7C01, + 0x7BF8, 0x7BFD, 0x7C06, 0x7BF0, 0x7BF1, 0x7C10, 0x7C0A, 0x7CE8, + 0x7E2D, 0x7E3C, 0x7E42, 0x7E33, 0x9848, 0x7E38, 0x7E2A, 0x7E49, + 0x7E40, 0x7E47, 0x7E29, 0x7E4C, 0x7E30, 0x7E3B, 0x7E36, 0x7E44, + 0x7E3A, 0x7F45, 0x7F7F, 0x7F7E, 0x7F7D, 0x7FF4, 0x7FF2, 0x802C, + 0x81BB, 0x81C4, 0x81CC, 0x81CA, 0x81C5, 0x81C7, 0x81BC, 0x81E9, + 0x825B, 0x825A, 0x825C, 0x8583, 0x8580, 0x858F, 0x85A7, 0x8595, + 0x85A0, 0x858B, 0x85A3, 0x857B, 0x85A4, 0x859A, 0x859E, ALTCHR, +/* 0xEE40 - 0xEEFF */ + 0x8577, 0x857C, 0x8589, 0x85A1, 0x857A, 0x8578, 0x8557, 0x858E, + 0x8596, 0x8586, 0x858D, 0x8599, 0x859D, 0x8581, 0x85A2, 0x8582, + 0x8588, 0x8585, 0x8579, 0x8576, 0x8598, 0x8590, 0x859F, 0x8668, + 0x87BE, 0x87AA, 0x87AD, 0x87C5, 0x87B0, 0x87AC, 0x87B9, 0x87B5, + 0x87BC, 0x87AE, 0x87C9, 0x87C3, 0x87C2, 0x87CC, 0x87B7, 0x87AF, + 0x87C4, 0x87CA, 0x87B4, 0x87B6, 0x87BF, 0x87B8, 0x87BD, 0x87DE, + 0x87B2, 0x8935, 0x8933, 0x893C, 0x893E, 0x8941, 0x8952, 0x8937, + 0x8942, 0x89AD, 0x89AF, 0x89AE, 0x89F2, 0x89F3, 0x8B1E, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x8B18, 0x8B16, 0x8B11, 0x8B05, 0x8B0B, 0x8B22, 0x8B0F, + 0x8B12, 0x8B15, 0x8B07, 0x8B0D, 0x8B08, 0x8B06, 0x8B1C, 0x8B13, + 0x8B1A, 0x8C4F, 0x8C70, 0x8C72, 0x8C71, 0x8C6F, 0x8C95, 0x8C94, + 0x8CF9, 0x8D6F, 0x8E4E, 0x8E4D, 0x8E53, 0x8E50, 0x8E4C, 0x8E47, + 0x8F43, 0x8F40, 0x9085, 0x907E, 0x9138, 0x919A, 0x91A2, 0x919B, + 0x9199, 0x919F, 0x91A1, 0x919D, 0x91A0, 0x93A1, 0x9383, 0x93AF, + 0x9364, 0x9356, 0x9347, 0x937C, 0x9358, 0x935C, 0x9376, 0x9349, + 0x9350, 0x9351, 0x9360, 0x936D, 0x938F, 0x934C, 0x936A, 0x9379, + 0x9357, 0x9355, 0x9352, 0x934F, 0x9371, 0x9377, 0x937B, 0x9361, + 0x935E, 0x9363, 0x9367, 0x9380, 0x934E, 0x9359, 0x95C7, 0x95C0, + 0x95C9, 0x95C3, 0x95C5, 0x95B7, 0x96AE, 0x96B0, 0x96AC, 0x9720, + 0x971F, 0x9718, 0x971D, 0x9719, 0x979A, 0x97A1, 0x979C, ALTCHR, +/* 0xEF40 - 0xEFFF */ + 0x979E, 0x979D, 0x97D5, 0x97D4, 0x97F1, 0x9841, 0x9844, 0x984A, + 0x9849, 0x9845, 0x9843, 0x9925, 0x992B, 0x992C, 0x992A, 0x9933, + 0x9932, 0x992F, 0x992D, 0x9931, 0x9930, 0x9998, 0x99A3, 0x99A1, + 0x9A02, 0x99FA, 0x99F4, 0x99F7, 0x99F9, 0x99F8, 0x99F6, 0x99FB, + 0x99FD, 0x99FE, 0x99FC, 0x9A03, 0x9ABE, 0x9AFE, 0x9AFD, 0x9B01, + 0x9AFC, 0x9B48, 0x9B9A, 0x9BA8, 0x9B9E, 0x9B9B, 0x9BA6, 0x9BA1, + 0x9BA5, 0x9BA4, 0x9B86, 0x9BA2, 0x9BA0, 0x9BAF, 0x9D33, 0x9D41, + 0x9D67, 0x9D36, 0x9D2E, 0x9D2F, 0x9D31, 0x9D38, 0x9D30, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9D45, 0x9D42, 0x9D43, 0x9D3E, 0x9D37, 0x9D40, 0x9D3D, + 0x7FF5, 0x9D2D, 0x9E8A, 0x9E89, 0x9E8D, 0x9EB0, 0x9EC8, 0x9EDA, + 0x9EFB, 0x9EFF, 0x9F24, 0x9F23, 0x9F22, 0x9F54, 0x9FA0, 0x5131, + 0x512D, 0x512E, 0x5698, 0x569C, 0x5697, 0x569A, 0x569D, 0x5699, + 0x5970, 0x5B3C, 0x5C69, 0x5C6A, 0x5DC0, 0x5E6D, 0x5E6E, 0x61D8, + 0x61DF, 0x61ED, 0x61EE, 0x61F1, 0x61EA, 0x61F0, 0x61EB, 0x61D6, + 0x61E9, 0x64FF, 0x6504, 0x64FD, 0x64F8, 0x6501, 0x6503, 0x64FC, + 0x6594, 0x65DB, 0x66DA, 0x66DB, 0x66D8, 0x6AC5, 0x6AB9, 0x6ABD, + 0x6AE1, 0x6AC6, 0x6ABA, 0x6AB6, 0x6AB7, 0x6AC7, 0x6AB4, 0x6AAD, + 0x6B5E, 0x6BC9, 0x6C0B, 0x7007, 0x700C, 0x700D, 0x7001, 0x7005, + 0x7014, 0x700E, 0x6FFF, 0x7000, 0x6FFB, 0x7026, 0x6FFC, 0x6FF7, + 0x700A, 0x7201, 0x71FF, 0x71F9, 0x7203, 0x71FD, 0x7376, ALTCHR, +/* 0xF040 - 0xF0FF */ + 0x74B8, 0x74C0, 0x74B5, 0x74C1, 0x74BE, 0x74B6, 0x74BB, 0x74C2, + 0x7514, 0x7513, 0x765C, 0x7664, 0x7659, 0x7650, 0x7653, 0x7657, + 0x765A, 0x76A6, 0x76BD, 0x76EC, 0x77C2, 0x77BA, 0x78FF, 0x790C, + 0x7913, 0x7914, 0x7909, 0x7910, 0x7912, 0x7911, 0x79AD, 0x79AC, + 0x7A5F, 0x7C1C, 0x7C29, 0x7C19, 0x7C20, 0x7C1F, 0x7C2D, 0x7C1D, + 0x7C26, 0x7C28, 0x7C22, 0x7C25, 0x7C30, 0x7E5C, 0x7E50, 0x7E56, + 0x7E63, 0x7E58, 0x7E62, 0x7E5F, 0x7E51, 0x7E60, 0x7E57, 0x7E53, + 0x7FB5, 0x7FB3, 0x7FF7, 0x7FF8, 0x8075, 0x81D1, 0x81D2, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x81D0, 0x825F, 0x825E, 0x85B4, 0x85C6, 0x85C0, 0x85C3, + 0x85C2, 0x85B3, 0x85B5, 0x85BD, 0x85C7, 0x85C4, 0x85BF, 0x85CB, + 0x85CE, 0x85C8, 0x85C5, 0x85B1, 0x85B6, 0x85D2, 0x8624, 0x85B8, + 0x85B7, 0x85BE, 0x8669, 0x87E7, 0x87E6, 0x87E2, 0x87DB, 0x87EB, + 0x87EA, 0x87E5, 0x87DF, 0x87F3, 0x87E4, 0x87D4, 0x87DC, 0x87D3, + 0x87ED, 0x87D8, 0x87E3, 0x87A4, 0x87D7, 0x87D9, 0x8801, 0x87F4, + 0x87E8, 0x87DD, 0x8953, 0x894B, 0x894F, 0x894C, 0x8946, 0x8950, + 0x8951, 0x8949, 0x8B2A, 0x8B27, 0x8B23, 0x8B33, 0x8B30, 0x8B35, + 0x8B47, 0x8B2F, 0x8B3C, 0x8B3E, 0x8B31, 0x8B25, 0x8B37, 0x8B26, + 0x8B36, 0x8B2E, 0x8B24, 0x8B3B, 0x8B3D, 0x8B3A, 0x8C42, 0x8C75, + 0x8C99, 0x8C98, 0x8C97, 0x8CFE, 0x8D04, 0x8D02, 0x8D00, 0x8E5C, + 0x8E62, 0x8E60, 0x8E57, 0x8E56, 0x8E5E, 0x8E65, 0x8E67, ALTCHR, +/* 0xF140 - 0xF1FF */ + 0x8E5B, 0x8E5A, 0x8E61, 0x8E5D, 0x8E69, 0x8E54, 0x8F46, 0x8F47, + 0x8F48, 0x8F4B, 0x9128, 0x913A, 0x913B, 0x913E, 0x91A8, 0x91A5, + 0x91A7, 0x91AF, 0x91AA, 0x93B5, 0x938C, 0x9392, 0x93B7, 0x939B, + 0x939D, 0x9389, 0x93A7, 0x938E, 0x93AA, 0x939E, 0x93A6, 0x9395, + 0x9388, 0x9399, 0x939F, 0x938D, 0x93B1, 0x9391, 0x93B2, 0x93A4, + 0x93A8, 0x93B4, 0x93A3, 0x93A5, 0x95D2, 0x95D3, 0x95D1, 0x96B3, + 0x96D7, 0x96DA, 0x5DC2, 0x96DF, 0x96D8, 0x96DD, 0x9723, 0x9722, + 0x9725, 0x97AC, 0x97AE, 0x97A8, 0x97AB, 0x97A4, 0x97AA, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x97A2, 0x97A5, 0x97D7, 0x97D9, 0x97D6, 0x97D8, 0x97FA, + 0x9850, 0x9851, 0x9852, 0x98B8, 0x9941, 0x993C, 0x993A, 0x9A0F, + 0x9A0B, 0x9A09, 0x9A0D, 0x9A04, 0x9A11, 0x9A0A, 0x9A05, 0x9A07, + 0x9A06, 0x9AC0, 0x9ADC, 0x9B08, 0x9B04, 0x9B05, 0x9B29, 0x9B35, + 0x9B4A, 0x9B4C, 0x9B4B, 0x9BC7, 0x9BC6, 0x9BC3, 0x9BBF, 0x9BC1, + 0x9BB5, 0x9BB8, 0x9BD3, 0x9BB6, 0x9BC4, 0x9BB9, 0x9BBD, 0x9D5C, + 0x9D53, 0x9D4F, 0x9D4A, 0x9D5B, 0x9D4B, 0x9D59, 0x9D56, 0x9D4C, + 0x9D57, 0x9D52, 0x9D54, 0x9D5F, 0x9D58, 0x9D5A, 0x9E8E, 0x9E8C, + 0x9EDF, 0x9F01, 0x9F00, 0x9F16, 0x9F25, 0x9F2B, 0x9F2A, 0x9F29, + 0x9F28, 0x9F4C, 0x9F55, 0x5134, 0x5135, 0x5296, 0x52F7, 0x53B4, + 0x56AB, 0x56AD, 0x56A6, 0x56A7, 0x56AA, 0x56AC, 0x58DA, 0x58DD, + 0x58DB, 0x5912, 0x5B3D, 0x5B3E, 0x5B3F, 0x5DC3, 0x5E70, ALTCHR, +/* 0xF240 - 0xF2FF */ + 0x5FBF, 0x61FB, 0x6507, 0x6510, 0x650D, 0x6509, 0x650C, 0x650E, + 0x6584, 0x65DE, 0x65DD, 0x66DE, 0x6AE7, 0x6AE0, 0x6ACC, 0x6AD1, + 0x6AD9, 0x6ACB, 0x6ADF, 0x6ADC, 0x6AD0, 0x6AEB, 0x6ACF, 0x6ACD, + 0x6ADE, 0x6B60, 0x6BB0, 0x6C0C, 0x7019, 0x7027, 0x7020, 0x7016, + 0x702B, 0x7021, 0x7022, 0x7023, 0x7029, 0x7017, 0x7024, 0x701C, + 0x702A, 0x720C, 0x720A, 0x7207, 0x7202, 0x7205, 0x72A5, 0x72A6, + 0x72A4, 0x72A3, 0x72A1, 0x74CB, 0x74C5, 0x74B7, 0x74C3, 0x7516, + 0x7660, 0x77C9, 0x77CA, 0x77C4, 0x77F1, 0x791D, 0x791B, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x7921, 0x791C, 0x7917, 0x791E, 0x79B0, 0x7A67, 0x7A68, + 0x7C33, 0x7C3C, 0x7C39, 0x7C2C, 0x7C3B, 0x7CEC, 0x7CEA, 0x7E76, + 0x7E75, 0x7E78, 0x7E70, 0x7E77, 0x7E6F, 0x7E7A, 0x7E72, 0x7E74, + 0x7E68, 0x7F4B, 0x7F4A, 0x7F83, 0x7F86, 0x7FB7, 0x7FFD, 0x7FFE, + 0x8078, 0x81D7, 0x81D5, 0x8264, 0x8261, 0x8263, 0x85EB, 0x85F1, + 0x85ED, 0x85D9, 0x85E1, 0x85E8, 0x85DA, 0x85D7, 0x85EC, 0x85F2, + 0x85F8, 0x85D8, 0x85DF, 0x85E3, 0x85DC, 0x85D1, 0x85F0, 0x85E6, + 0x85EF, 0x85DE, 0x85E2, 0x8800, 0x87FA, 0x8803, 0x87F6, 0x87F7, + 0x8809, 0x880C, 0x880B, 0x8806, 0x87FC, 0x8808, 0x87FF, 0x880A, + 0x8802, 0x8962, 0x895A, 0x895B, 0x8957, 0x8961, 0x895C, 0x8958, + 0x895D, 0x8959, 0x8988, 0x89B7, 0x89B6, 0x89F6, 0x8B50, 0x8B48, + 0x8B4A, 0x8B40, 0x8B53, 0x8B56, 0x8B54, 0x8B4B, 0x8B55, ALTCHR, +/* 0xF340 - 0xF3FF */ + 0x8B51, 0x8B42, 0x8B52, 0x8B57, 0x8C43, 0x8C77, 0x8C76, 0x8C9A, + 0x8D06, 0x8D07, 0x8D09, 0x8DAC, 0x8DAA, 0x8DAD, 0x8DAB, 0x8E6D, + 0x8E78, 0x8E73, 0x8E6A, 0x8E6F, 0x8E7B, 0x8EC2, 0x8F52, 0x8F51, + 0x8F4F, 0x8F50, 0x8F53, 0x8FB4, 0x9140, 0x913F, 0x91B0, 0x91AD, + 0x93DE, 0x93C7, 0x93CF, 0x93C2, 0x93DA, 0x93D0, 0x93F9, 0x93EC, + 0x93CC, 0x93D9, 0x93A9, 0x93E6, 0x93CA, 0x93D4, 0x93EE, 0x93E3, + 0x93D5, 0x93C4, 0x93CE, 0x93C0, 0x93D2, 0x93E7, 0x957D, 0x95DA, + 0x95DB, 0x96E1, 0x9729, 0x972B, 0x972C, 0x9728, 0x9726, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x97B3, 0x97B7, 0x97B6, 0x97DD, 0x97DE, 0x97DF, 0x985C, + 0x9859, 0x985D, 0x9857, 0x98BF, 0x98BD, 0x98BB, 0x98BE, 0x9948, + 0x9947, 0x9943, 0x99A6, 0x99A7, 0x9A1A, 0x9A15, 0x9A25, 0x9A1D, + 0x9A24, 0x9A1B, 0x9A22, 0x9A20, 0x9A27, 0x9A23, 0x9A1E, 0x9A1C, + 0x9A14, 0x9AC2, 0x9B0B, 0x9B0A, 0x9B0E, 0x9B0C, 0x9B37, 0x9BEA, + 0x9BEB, 0x9BE0, 0x9BDE, 0x9BE4, 0x9BE6, 0x9BE2, 0x9BF0, 0x9BD4, + 0x9BD7, 0x9BEC, 0x9BDC, 0x9BD9, 0x9BE5, 0x9BD5, 0x9BE1, 0x9BDA, + 0x9D77, 0x9D81, 0x9D8A, 0x9D84, 0x9D88, 0x9D71, 0x9D80, 0x9D78, + 0x9D86, 0x9D8B, 0x9D8C, 0x9D7D, 0x9D6B, 0x9D74, 0x9D75, 0x9D70, + 0x9D69, 0x9D85, 0x9D73, 0x9D7B, 0x9D82, 0x9D6F, 0x9D79, 0x9D7F, + 0x9D87, 0x9D68, 0x9E94, 0x9E91, 0x9EC0, 0x9EFC, 0x9F2D, 0x9F40, + 0x9F41, 0x9F4D, 0x9F56, 0x9F57, 0x9F58, 0x5337, 0x56B2, ALTCHR, +/* 0xF440 - 0xF4FF */ + 0x56B5, 0x56B3, 0x58E3, 0x5B45, 0x5DC6, 0x5DC7, 0x5EEE, 0x5EEF, + 0x5FC0, 0x5FC1, 0x61F9, 0x6517, 0x6516, 0x6515, 0x6513, 0x65DF, + 0x66E8, 0x66E3, 0x66E4, 0x6AF3, 0x6AF0, 0x6AEA, 0x6AE8, 0x6AF9, + 0x6AF1, 0x6AEE, 0x6AEF, 0x703C, 0x7035, 0x702F, 0x7037, 0x7034, + 0x7031, 0x7042, 0x7038, 0x703F, 0x703A, 0x7039, 0x7040, 0x703B, + 0x7033, 0x7041, 0x7213, 0x7214, 0x72A8, 0x737D, 0x737C, 0x74BA, + 0x76AB, 0x76AA, 0x76BE, 0x76ED, 0x77CC, 0x77CE, 0x77CF, 0x77CD, + 0x77F2, 0x7925, 0x7923, 0x7927, 0x7928, 0x7924, 0x7929, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x79B2, 0x7A6E, 0x7A6C, 0x7A6D, 0x7AF7, 0x7C49, 0x7C48, + 0x7C4A, 0x7C47, 0x7C45, 0x7CEE, 0x7E7B, 0x7E7E, 0x7E81, 0x7E80, + 0x7FBA, 0x7FFF, 0x8079, 0x81DB, 0x81D9, 0x820B, 0x8268, 0x8269, + 0x8622, 0x85FF, 0x8601, 0x85FE, 0x861B, 0x8600, 0x85F6, 0x8604, + 0x8609, 0x8605, 0x860C, 0x85FD, 0x8819, 0x8810, 0x8811, 0x8817, + 0x8813, 0x8816, 0x8963, 0x8966, 0x89B9, 0x89F7, 0x8B60, 0x8B6A, + 0x8B5D, 0x8B68, 0x8B63, 0x8B65, 0x8B67, 0x8B6D, 0x8DAE, 0x8E86, + 0x8E88, 0x8E84, 0x8F59, 0x8F56, 0x8F57, 0x8F55, 0x8F58, 0x8F5A, + 0x908D, 0x9143, 0x9141, 0x91B7, 0x91B5, 0x91B2, 0x91B3, 0x940B, + 0x9413, 0x93FB, 0x9420, 0x940F, 0x9414, 0x93FE, 0x9415, 0x9410, + 0x9428, 0x9419, 0x940D, 0x93F5, 0x9400, 0x93F7, 0x9407, 0x940E, + 0x9416, 0x9412, 0x93FA, 0x9409, 0x93F8, 0x940A, 0x93FF, ALTCHR, +/* 0xF540 - 0xF5FF */ + 0x93FC, 0x940C, 0x93F6, 0x9411, 0x9406, 0x95DE, 0x95E0, 0x95DF, + 0x972E, 0x972F, 0x97B9, 0x97BB, 0x97FD, 0x97FE, 0x9860, 0x9862, + 0x9863, 0x985F, 0x98C1, 0x98C2, 0x9950, 0x994E, 0x9959, 0x994C, + 0x994B, 0x9953, 0x9A32, 0x9A34, 0x9A31, 0x9A2C, 0x9A2A, 0x9A36, + 0x9A29, 0x9A2E, 0x9A38, 0x9A2D, 0x9AC7, 0x9ACA, 0x9AC6, 0x9B10, + 0x9B12, 0x9B11, 0x9C0B, 0x9C08, 0x9BF7, 0x9C05, 0x9C12, 0x9BF8, + 0x9C40, 0x9C07, 0x9C0E, 0x9C06, 0x9C17, 0x9C14, 0x9C09, 0x9D9F, + 0x9D99, 0x9DA4, 0x9D9D, 0x9D92, 0x9D98, 0x9D90, 0x9D9B, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9DA0, 0x9D94, 0x9D9C, 0x9DAA, 0x9D97, 0x9DA1, 0x9D9A, + 0x9DA2, 0x9DA8, 0x9D9E, 0x9DA3, 0x9DBF, 0x9DA9, 0x9D96, 0x9DA6, + 0x9DA7, 0x9E99, 0x9E9B, 0x9E9A, 0x9EE5, 0x9EE4, 0x9EE7, 0x9EE6, + 0x9F30, 0x9F2E, 0x9F5B, 0x9F60, 0x9F5E, 0x9F5D, 0x9F59, 0x9F91, + 0x513A, 0x5139, 0x5298, 0x5297, 0x56C3, 0x56BD, 0x56BE, 0x5B48, + 0x5B47, 0x5DCB, 0x5DCF, 0x5EF1, 0x61FD, 0x651B, 0x6B02, 0x6AFC, + 0x6B03, 0x6AF8, 0x6B00, 0x7043, 0x7044, 0x704A, 0x7048, 0x7049, + 0x7045, 0x7046, 0x721D, 0x721A, 0x7219, 0x737E, 0x7517, 0x766A, + 0x77D0, 0x792D, 0x7931, 0x792F, 0x7C54, 0x7C53, 0x7CF2, 0x7E8A, + 0x7E87, 0x7E88, 0x7E8B, 0x7E86, 0x7E8D, 0x7F4D, 0x7FBB, 0x8030, + 0x81DD, 0x8618, 0x862A, 0x8626, 0x861F, 0x8623, 0x861C, 0x8619, + 0x8627, 0x862E, 0x8621, 0x8620, 0x8629, 0x861E, 0x8625, ALTCHR, +/* 0xF640 - 0xF6FF */ + 0x8829, 0x881D, 0x881B, 0x8820, 0x8824, 0x881C, 0x882B, 0x884A, + 0x896D, 0x8969, 0x896E, 0x896B, 0x89FA, 0x8B79, 0x8B78, 0x8B45, + 0x8B7A, 0x8B7B, 0x8D10, 0x8D14, 0x8DAF, 0x8E8E, 0x8E8C, 0x8F5E, + 0x8F5B, 0x8F5D, 0x9146, 0x9144, 0x9145, 0x91B9, 0x943F, 0x943B, + 0x9436, 0x9429, 0x943D, 0x943C, 0x9430, 0x9439, 0x942A, 0x9437, + 0x942C, 0x9440, 0x9431, 0x95E5, 0x95E4, 0x95E3, 0x9735, 0x973A, + 0x97BF, 0x97E1, 0x9864, 0x98C9, 0x98C6, 0x98C0, 0x9958, 0x9956, + 0x9A39, 0x9A3D, 0x9A46, 0x9A44, 0x9A42, 0x9A41, 0x9A3A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9A3F, 0x9ACD, 0x9B15, 0x9B17, 0x9B18, 0x9B16, 0x9B3A, + 0x9B52, 0x9C2B, 0x9C1D, 0x9C1C, 0x9C2C, 0x9C23, 0x9C28, 0x9C29, + 0x9C24, 0x9C21, 0x9DB7, 0x9DB6, 0x9DBC, 0x9DC1, 0x9DC7, 0x9DCA, + 0x9DCF, 0x9DBE, 0x9DC5, 0x9DC3, 0x9DBB, 0x9DB5, 0x9DCE, 0x9DB9, + 0x9DBA, 0x9DAC, 0x9DC8, 0x9DB1, 0x9DAD, 0x9DCC, 0x9DB3, 0x9DCD, + 0x9DB2, 0x9E7A, 0x9E9C, 0x9EEB, 0x9EEE, 0x9EED, 0x9F1B, 0x9F18, + 0x9F1A, 0x9F31, 0x9F4E, 0x9F65, 0x9F64, 0x9F92, 0x4EB9, 0x56C6, + 0x56C5, 0x56CB, 0x5971, 0x5B4B, 0x5B4C, 0x5DD5, 0x5DD1, 0x5EF2, + 0x6521, 0x6520, 0x6526, 0x6522, 0x6B0B, 0x6B08, 0x6B09, 0x6C0D, + 0x7055, 0x7056, 0x7057, 0x7052, 0x721E, 0x721F, 0x72A9, 0x737F, + 0x74D8, 0x74D5, 0x74D9, 0x74D7, 0x766D, 0x76AD, 0x7935, 0x79B4, + 0x7A70, 0x7A71, 0x7C57, 0x7C5C, 0x7C59, 0x7C5B, 0x7C5A, ALTCHR, +/* 0xF740 - 0xF7FF */ + 0x7CF4, 0x7CF1, 0x7E91, 0x7F4F, 0x7F87, 0x81DE, 0x826B, 0x8634, + 0x8635, 0x8633, 0x862C, 0x8632, 0x8636, 0x882C, 0x8828, 0x8826, + 0x882A, 0x8825, 0x8971, 0x89BF, 0x89BE, 0x89FB, 0x8B7E, 0x8B84, + 0x8B82, 0x8B86, 0x8B85, 0x8B7F, 0x8D15, 0x8E95, 0x8E94, 0x8E9A, + 0x8E92, 0x8E90, 0x8E96, 0x8E97, 0x8F60, 0x8F62, 0x9147, 0x944C, + 0x9450, 0x944A, 0x944B, 0x944F, 0x9447, 0x9445, 0x9448, 0x9449, + 0x9446, 0x973F, 0x97E3, 0x986A, 0x9869, 0x98CB, 0x9954, 0x995B, + 0x9A4E, 0x9A53, 0x9A54, 0x9A4C, 0x9A4F, 0x9A48, 0x9A4A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9A49, 0x9A52, 0x9A50, 0x9AD0, 0x9B19, 0x9B2B, 0x9B3B, + 0x9B56, 0x9B55, 0x9C46, 0x9C48, 0x9C3F, 0x9C44, 0x9C39, 0x9C33, + 0x9C41, 0x9C3C, 0x9C37, 0x9C34, 0x9C32, 0x9C3D, 0x9C36, 0x9DDB, + 0x9DD2, 0x9DDE, 0x9DDA, 0x9DCB, 0x9DD0, 0x9DDC, 0x9DD1, 0x9DDF, + 0x9DE9, 0x9DD9, 0x9DD8, 0x9DD6, 0x9DF5, 0x9DD5, 0x9DDD, 0x9EB6, + 0x9EF0, 0x9F35, 0x9F33, 0x9F32, 0x9F42, 0x9F6B, 0x9F95, 0x9FA2, + 0x513D, 0x5299, 0x58E8, 0x58E7, 0x5972, 0x5B4D, 0x5DD8, 0x882F, + 0x5F4F, 0x6201, 0x6203, 0x6204, 0x6529, 0x6525, 0x6596, 0x66EB, + 0x6B11, 0x6B12, 0x6B0F, 0x6BCA, 0x705B, 0x705A, 0x7222, 0x7382, + 0x7381, 0x7383, 0x7670, 0x77D4, 0x7C67, 0x7C66, 0x7E95, 0x826C, + 0x863A, 0x8640, 0x8639, 0x863C, 0x8631, 0x863B, 0x863E, 0x8830, + 0x8832, 0x882E, 0x8833, 0x8976, 0x8974, 0x8973, 0x89FE, ALTCHR, +/* 0xF840 - 0xF8FF */ + 0x8B8C, 0x8B8E, 0x8B8B, 0x8B88, 0x8C45, 0x8D19, 0x8E98, 0x8F64, + 0x8F63, 0x91BC, 0x9462, 0x9455, 0x945D, 0x9457, 0x945E, 0x97C4, + 0x97C5, 0x9800, 0x9A56, 0x9A59, 0x9B1E, 0x9B1F, 0x9B20, 0x9C52, + 0x9C58, 0x9C50, 0x9C4A, 0x9C4D, 0x9C4B, 0x9C55, 0x9C59, 0x9C4C, + 0x9C4E, 0x9DFB, 0x9DF7, 0x9DEF, 0x9DE3, 0x9DEB, 0x9DF8, 0x9DE4, + 0x9DF6, 0x9DE1, 0x9DEE, 0x9DE6, 0x9DF2, 0x9DF0, 0x9DE2, 0x9DEC, + 0x9DF4, 0x9DF3, 0x9DE8, 0x9DED, 0x9EC2, 0x9ED0, 0x9EF2, 0x9EF3, + 0x9F06, 0x9F1C, 0x9F38, 0x9F37, 0x9F36, 0x9F43, 0x9F4F, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9F71, 0x9F70, 0x9F6E, 0x9F6F, 0x56D3, 0x56CD, 0x5B4E, + 0x5C6D, 0x652D, 0x66ED, 0x66EE, 0x6B13, 0x705F, 0x7061, 0x705D, + 0x7060, 0x7223, 0x74DB, 0x74E5, 0x77D5, 0x7938, 0x79B7, 0x79B6, + 0x7C6A, 0x7E97, 0x7F89, 0x826D, 0x8643, 0x8838, 0x8837, 0x8835, + 0x884B, 0x8B94, 0x8B95, 0x8E9E, 0x8E9F, 0x8EA0, 0x8E9D, 0x91BE, + 0x91BD, 0x91C2, 0x946B, 0x9468, 0x9469, 0x96E5, 0x9746, 0x9743, + 0x9747, 0x97C7, 0x97E5, 0x9A5E, 0x9AD5, 0x9B59, 0x9C63, 0x9C67, + 0x9C66, 0x9C62, 0x9C5E, 0x9C60, 0x9E02, 0x9DFE, 0x9E07, 0x9E03, + 0x9E06, 0x9E05, 0x9E00, 0x9E01, 0x9E09, 0x9DFF, 0x9DFD, 0x9E04, + 0x9EA0, 0x9F1E, 0x9F46, 0x9F74, 0x9F75, 0x9F76, 0x56D4, 0x652E, + 0x65B8, 0x6B18, 0x6B19, 0x6B17, 0x6B1A, 0x7062, 0x7226, 0x72AA, + 0x77D8, 0x77D9, 0x7939, 0x7C69, 0x7C6B, 0x7CF6, 0x7E9A, ALTCHR, +/* 0xF940 - 0xF9FF */ + 0x7E98, 0x7E9B, 0x7E99, 0x81E0, 0x81E1, 0x8646, 0x8647, 0x8648, + 0x8979, 0x897A, 0x897C, 0x897B, 0x89FF, 0x8B98, 0x8B99, 0x8EA5, + 0x8EA4, 0x8EA3, 0x946E, 0x946D, 0x946F, 0x9471, 0x9473, 0x9749, + 0x9872, 0x995F, 0x9C68, 0x9C6E, 0x9C6D, 0x9E0B, 0x9E0D, 0x9E10, + 0x9E0F, 0x9E12, 0x9E11, 0x9EA1, 0x9EF5, 0x9F09, 0x9F47, 0x9F78, + 0x9F7B, 0x9F7A, 0x9F79, 0x571E, 0x7066, 0x7C6F, 0x883C, 0x8DB2, + 0x8EA6, 0x91C3, 0x9474, 0x9478, 0x9476, 0x9475, 0x9A60, 0x9C74, + 0x9C73, 0x9C71, 0x9C75, 0x9E14, 0x9E13, 0x9EF6, 0x9F0A, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9FA4, 0x7068, 0x7065, 0x7CF7, 0x866A, 0x883E, 0x883D, + 0x883F, 0x8B9E, 0x8C9C, 0x8EA9, 0x8EC9, 0x974B, 0x9873, 0x9874, + 0x98CC, 0x9961, 0x99AB, 0x9A64, 0x9A66, 0x9A67, 0x9B24, 0x9E15, + 0x9E17, 0x9F48, 0x6207, 0x6B1E, 0x7227, 0x864C, 0x8EA8, 0x9482, + 0x9480, 0x9481, 0x9A69, 0x9A68, 0x9B2E, 0x9E19, 0x7229, 0x864B, + 0x8B9F, 0x9483, 0x9C79, 0x9EB7, 0x7675, 0x9A6B, 0x9C7A, 0x9E1D, + 0x7069, 0x706A, 0x9EA4, 0x9F7E, 0x9F49, 0x9F98, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* start of HKSCS area */ +/* 0xFA40 - 0xFAFF */ + 0xE000, 0x92DB, 0xE002, 0xE003, 0x854C, 0x42B5, 0x73EF, 0x51B5, + 0x3649, 0xE009, 0xE00A, 0x9344, 0xE00C, 0x82EE, 0xE00E, 0x783C, + 0x6744, 0x62DF, 0xE012, 0xE013, 0xE014, 0xE015, 0xE016, 0x4FAB, + 0xE018, 0x5008, 0xE01A, 0xE01B, 0xE01C, 0xE01D, 0xE01E, 0xE01F, + 0xE020, 0x5FA4, 0xE022, 0xE023, 0x6EDB, 0xE025, 0xE026, 0x5101, + 0x347A, 0x510E, 0x986C, 0x3743, 0x8416, 0xE02D, 0xE02E, 0x5160, + 0xE030, 0x516A, 0xE032, 0xE033, 0xE034, 0xE035, 0xE036, 0xE037, + 0xE038, 0x5B82, 0x877D, 0xE03B, 0xE03C, 0x51B2, 0x51B8, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x9D34, 0x51C9, 0x51CF, 0x51D1, 0x3CDC, 0x51D3, 0xE045, + 0x51B3, 0x51E2, 0x5342, 0x51ED, 0x83CD, 0x693E, 0xE04C, 0x5F7B, + 0x520B, 0x5226, 0x523C, 0x52B5, 0x5257, 0x5294, 0x52B9, 0x52C5, + 0x7C15, 0x8542, 0x52E0, 0x860D, 0xE05A, 0xE05B, 0xE05C, 0x5549, + 0x6ED9, 0xE05F, 0xE060, 0xE061, 0x5333, 0xE063, 0xE064, 0x6CCB, + 0xE066, 0x681B, 0x73D5, 0x604A, 0x3EAA, 0x38CC, 0xE06C, 0x71DD, + 0x44A2, 0x536D, 0x5374, 0xE071, 0x537E, 0xE073, 0xE074, 0xE075, + 0x77E6, 0x5393, 0xE078, 0x53A0, 0x53AB, 0x53AE, 0x73A7, 0xE07D, + 0x3F59, 0x739C, 0x53C1, 0x53C5, 0x6C49, 0x4E49, 0x57FE, 0x53D9, + 0x3AAB, 0xE087, 0x53E0, 0xE089, 0xE08A, 0x53F6, 0xE08C, 0x5413, + 0x7079, 0x552B, 0x6657, 0x6D5B, 0x546D, 0xE093, 0xE094, 0x555D, + 0x548F, 0x54A4, 0x47A6, 0xE099, 0xE09A, 0x3DB4, 0xE09C, ALTCHR, +/* 0xFB40 - 0xFBFF */ + 0xE09D, 0xE09E, 0x5547, 0x4CED, 0x542F, 0x7417, 0x5586, 0x55A9, + 0xE0A5, 0xE0A6, 0xE0A7, 0x4552, 0xE0A9, 0x66B3, 0xE0AB, 0x5637, + 0x66CD, 0xE0AE, 0x66A4, 0x66AD, 0x564D, 0x564F, 0x78F1, 0x56F1, + 0x9787, 0x53FE, 0x5700, 0x56EF, 0x56ED, 0xE0BA, 0x3623, 0xE0BC, + 0x5746, 0xE0BE, 0x6C6E, 0x708B, 0x5742, 0x36B1, 0xE0C3, 0x57E6, + 0xE0C5, 0x5803, 0xE0C7, 0xE0C8, 0x5826, 0xE0CA, 0x585C, 0x58AA, + 0x3561, 0x58E0, 0x58DC, 0xE0D0, 0x58FB, 0x5BFF, 0x5743, 0xE0D4, + 0xE0D5, 0x93D3, 0x35A1, 0x591F, 0x68A6, 0x36C3, 0x6E59, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xE0DC, 0x5A24, 0x5553, 0xE0DF, 0x8505, 0x59C9, 0xE0E2, + 0xE0E3, 0xE0E4, 0xE0E5, 0x59D9, 0xE0E7, 0xE0E8, 0xE0E9, 0x6D71, + 0xE0EB, 0xE0EC, 0x59F9, 0xE0EE, 0x5AAB, 0x5A63, 0x36E6, 0xE0F2, + 0xE0F3, 0x3708, 0x5A96, 0x7465, 0x5AD3, 0xE0F8, 0xE0F9, 0x3D85, + 0xE0FB, 0x3732, 0xE0FD, 0x5E83, 0x52D0, 0x5B76, 0x6588, 0x5B7C, + 0xE103, 0x4004, 0x485D, 0xE106, 0x5BD5, 0x6160, 0xE109, 0xE10A, + 0xE10B, 0x5BF3, 0x5B9D, 0x4D10, 0x5C05, 0xE110, 0x5C13, 0x73CE, + 0x5C14, 0xE114, 0xE115, 0x5C49, 0x48DD, 0x5C85, 0x5CE9, 0x5CEF, + 0x5D8B, 0xE11C, 0xE11D, 0x5D10, 0x5D18, 0x5D46, 0xE121, 0x5CBA, + 0x5DD7, 0x82FC, 0x382D, 0xE126, 0xE127, 0xE128, 0x8287, 0x3836, + 0x3BC2, 0x5E2E, 0x6A8A, 0xE12E, 0x5E7A, 0xE130, 0xE131, 0x53A6, + 0x4EB7, 0xE134, 0x53A8, 0xE136, 0x5E09, 0x5EF4, 0xE139, ALTCHR, +/* 0xFC40 - 0xFCFF */ + 0x5EF9, 0x5EFB, 0x38A0, 0x5EFC, 0x683E, 0x941B, 0x5F0D, 0xE141, + 0xE142, 0x3ADE, 0x48AE, 0xE145, 0x5F3A, 0xE147, 0xE148, 0xE149, + 0xE14A, 0x5F63, 0x97BD, 0xE14D, 0x5F72, 0x9340, 0xE150, 0x5FA7, + 0x5DB6, 0x3D5F, 0xE154, 0xE155, 0xE156, 0xE157, 0x91D6, 0xE159, + 0xE15A, 0x6031, 0x6685, 0xE15D, 0x3963, 0x3DC7, 0x3639, 0x5790, + 0xE162, 0x7971, 0x3E40, 0x609E, 0xE166, 0x60B3, 0xE168, 0xE169, + 0xE16A, 0x74A4, 0x50E1, 0x5AA0, 0x6164, 0x8424, 0x6142, 0xE171, + 0xE172, 0x6181, 0x51F4, 0xE175, 0x6187, 0x5BAA, 0xE178, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xE179, 0x61D3, 0xE17B, 0xE17C, 0x61D0, 0x3932, 0xE17F, + 0xE180, 0x6023, 0x615C, 0x651E, 0x638B, 0xE185, 0x62C5, 0xE187, + 0x62D5, 0xE189, 0x636C, 0xE18B, 0x3A17, 0x6438, 0x63F8, 0xE18F, + 0xE190, 0xE191, 0x6F8A, 0xE193, 0x9814, 0xE195, 0xE196, 0x64E1, + 0x64E5, 0x947B, 0x3A66, 0x643A, 0x3A57, 0x654D, 0x6F16, 0xE19F, + 0xE1A0, 0x6585, 0x656D, 0x655F, 0xE1A4, 0x65B5, 0xE1A6, 0x4B37, + 0x65D1, 0x40D8, 0xE1AA, 0x65E0, 0x65E3, 0x5FDF, 0xE1AE, 0x6618, + 0xE1B0, 0xE1B1, 0x6644, 0xE1B3, 0xE1B4, 0x664B, 0xE1B6, 0x6667, + 0xE1B8, 0x6673, 0xE1BA, 0xE1BB, 0xE1BC, 0xE1BD, 0xE1BE, 0xE1BF, + 0x77C5, 0xE1C1, 0x99A4, 0x6702, 0xE1C4, 0xE1C5, 0x3B2B, 0x69FA, + 0xE1C8, 0xE1C9, 0x6767, 0x6762, 0xE1CC, 0xE1CD, 0x67D7, 0x44E9, + 0x6822, 0x6E50, 0x923C, 0x6801, 0xE1D4, 0xE1D5, 0x685D, ALTCHR, +/* 0xFD40 - 0xFDFF */ + 0xE1D7, 0x69E1, 0x6A0B, 0xE1DA, 0x6973, 0x68C3, 0xE1DD, 0x6901, + 0x6900, 0x3D32, 0x3A01, 0xE1E2, 0x3B80, 0x67AC, 0x6961, 0xE1E6, + 0x42FC, 0x6936, 0x6998, 0x3BA1, 0xE1EB, 0x8363, 0x5090, 0x69F9, + 0xE1EF, 0xE1F0, 0x6A45, 0xE1F2, 0x6A9D, 0x3BF3, 0x67B1, 0x6AC8, + 0xE1F7, 0x3C0D, 0x6B1D, 0xE1FA, 0x60DE, 0x6B35, 0x6B74, 0xE1FE, + 0x6EB5, 0xE200, 0xE201, 0xE202, 0x3740, 0x5421, 0xE205, 0x6BE1, + 0xE207, 0x6BDC, 0x6C37, 0xE20A, 0xE20B, 0xE20C, 0x6C5A, 0x8226, + 0x6C79, 0xE210, 0x44C5, 0xE212, 0xE213, 0xE214, 0xE215, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xE216, 0x36E5, 0x3CEB, 0xE219, 0x9B83, 0xE21B, 0xE21C, + 0x7F8F, 0x6837, 0xE21F, 0xE220, 0xE221, 0x6D96, 0x6D5C, 0x6E7C, + 0x6F04, 0xE226, 0xE227, 0xE228, 0x8533, 0xE22A, 0x51C7, 0xE22C, + 0xE22D, 0x842E, 0xE22F, 0xE230, 0xE231, 0x7453, 0xE233, 0x79CC, + 0x6E4F, 0x5A91, 0xE237, 0x6FF8, 0x370D, 0x6F9D, 0xE23B, 0x6EFA, + 0xE23D, 0xE23E, 0x4555, 0x93F0, 0x6F44, 0x6F5C, 0x3D4E, 0x6F74, + 0xE245, 0x3D3B, 0x6F9F, 0xE248, 0x6FD3, 0xE24A, 0xE24B, 0xE24C, + 0xE24D, 0xE24E, 0xE24F, 0x51DF, 0xE251, 0xE252, 0xE253, 0xE254, + 0x704B, 0x707E, 0x70A7, 0x7081, 0x70CC, 0x70D5, 0x70D6, 0x70DF, + 0x4104, 0x3DE8, 0x71B4, 0x7196, 0xE261, 0x712B, 0x7145, 0x5A88, + 0x714A, 0xE266, 0x5C9C, 0xE268, 0x714F, 0x9362, 0xE26B, 0x712C, + 0xE26D, 0xE26E, 0xE26F, 0x71BA, 0xE271, 0x70BD, 0x720E, ALTCHR, +/* 0xFE40 - 0xFEFF */ + 0x9442, 0x7215, 0x5911, 0x9443, 0x7224, 0x9341, 0xE27A, 0x722E, + 0x7240, 0xE27D, 0x68BD, 0x7255, 0x7257, 0x3E55, 0xE282, 0x680D, + 0x6F3D, 0x7282, 0xE286, 0x732B, 0xE288, 0xE289, 0x48ED, 0xE28B, + 0x7328, 0x732E, 0x73CF, 0x73AA, 0xE290, 0xE291, 0x73C9, 0x7449, + 0xE294, 0xE295, 0xE296, 0x6623, 0x36C5, 0xE299, 0xE29A, 0xE29B, + 0x73F7, 0x7415, 0x6903, 0xE29F, 0x7439, 0xE2A1, 0x3ED7, 0xE2A3, + 0xE2A4, 0x7460, 0xE2A6, 0x7447, 0x73E4, 0x7476, 0x83B9, 0x746C, + 0x3730, 0x7474, 0x93F1, 0x6A2C, 0x7482, 0x4953, 0xE2B2, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xE2B3, 0xE2B4, 0xE2B5, 0x5B46, 0xE2B7, 0xE2B8, 0x74C8, + 0xE2BA, 0x750E, 0xE2BC, 0x751E, 0xE2BE, 0xE2BF, 0x5BD7, 0xE2C1, + 0x9385, 0x754D, 0x754A, 0x7567, 0x756E, 0xE2C7, 0x3F04, 0xE2C9, + 0x758E, 0x745D, 0x759E, 0x75B4, 0x7602, 0x762C, 0x7651, 0x764F, + 0x766F, 0x7676, 0xE2D4, 0x7690, 0x81EF, 0x37F8, 0xE2D8, 0xE2D9, + 0x76A1, 0x76A5, 0x76B7, 0x76CC, 0xE2DE, 0x8462, 0xE2E0, 0xE2E1, + 0xE2E2, 0x771E, 0x7726, 0x7740, 0x64AF, 0xE2E7, 0x7758, 0xE2E9, + 0x77AF, 0xE2EB, 0xE2EC, 0xE2ED, 0x77F4, 0xE2EF, 0xE2F0, 0xE2F1, + 0x68CA, 0x78AF, 0x78C7, 0x78D3, 0x96A5, 0x792E, 0xE2F8, 0x78D7, + 0x7934, 0x78B1, 0xE2FC, 0x8FB8, 0x8884, 0xE2FF, 0xE300, 0xE301, + 0x7986, 0x8900, 0x6902, 0x7980, 0xE306, 0x799D, 0xE308, 0x793C, + 0x79A9, 0x6E2A, 0xE30C, 0x3EA8, 0x79C6, 0xE30F, 0x79D4, ALTCHR, +/* end */ +}; + +CODE_CONV_TWO_OCTET_TO_UCS2(cc_big5hkscs_to_ucs2, /* function name */ + tblBig5HKSCSToUcs2, /* table name */ + 0x0081, 0x00FE, /* code range (high byte) */ + 0x0040, 0x00FF, /* code range (low byte) */ + ALTCHR /* alt char code (on UCS2) */ + ) + +/* end of file */ diff --git a/xc/extras/X-TrueType/BIG5HKSCS/Imakefile b/xc/extras/X-TrueType/BIG5HKSCS/Imakefile new file mode 100644 index 000000000..f5730c06f --- /dev/null +++ b/xc/extras/X-TrueType/BIG5HKSCS/Imakefile @@ -0,0 +1,11 @@ +XCOMM $XFree86: xc/extras/X-TrueType/BIG5HKSCS/Imakefile,v 1.1 2001/03/06 18:54:42 dawes Exp $ + +/* code converter: BIG5HKSCS */ + +#define ModuleName BIG5HKSCS +SRCS = BIG5HKSCStoUCS2.c main.c +OBJS = BIG5HKSCStoUCS2.o main.o + +#include <xttMod.tmpl> + +/* end of file */ diff --git a/xc/extras/X-TrueType/BIG5HKSCS/main.c b/xc/extras/X-TrueType/BIG5HKSCS/main.c new file mode 100644 index 000000000..7e23c9778 --- /dev/null +++ b/xc/extras/X-TrueType/BIG5HKSCS/main.c @@ -0,0 +1,71 @@ +/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */ +/* ===FileName: === + Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved. + Copyright (c) 1998 X-TrueType Server Project, All rights reserved. + +===Notice + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + Major Release ID: X-TrueType Server Version 1.3 [Aoi MATSUBARA Release 3] + +Notice=== + */ + +/* $XFree86: xc/extras/X-TrueType/BIG5HKSCS/main.c,v 1.1 2001/03/06 18:54:42 dawes Exp $ */ + +#include "xttversion.h" + +static char const * const releaseID = + _XTT_RELEASE_NAME; + +#include "xttcommon.h" +#include "xttcap.h" +#include "xttcconv.h" +#include "xttcconvP.h" + + +typedef enum +{ + BIG5HKSCS +} CharSetMagic; + +static CharSetRelation const charSetRelations[] = { + { "big5hkscs", NULL, NULL, BIG5HKSCS, { 0x40, 0xff, 0x81, 0xfe, 0x8140 } }, + { NULL, NULL, NULL, 0, { 0, 0, 0, 0, 0 } } +}; + + +CODECONV_TEMPLATE(cc_big5hkscs_to_ucs2); +static MapIDRelation const mapIDRelations[] = { + { BIG5HKSCS, EPlfmISO, EEncISO10646, + cc_big5hkscs_to_ucs2, NULL }, + { BIG5HKSCS, EPlfmUnicode, EEncAny, + cc_big5hkscs_to_ucs2, NULL }, + { BIG5HKSCS, EPlfmMS, EEncMSUnicode, + cc_big5hkscs_to_ucs2, NULL }, + { BIG5HKSCS, EPlfmMS, EEncMSBig5WGL4, NULL, NULL }, + { -1, 0, 0, NULL, NULL } +}; + +STD_ENTRYFUNC_TEMPLATE(BIG5HKSCS_entrypoint) + +/* end of file */ diff --git a/xc/extras/X-TrueType/GB2312/GB2312toUCS2.c b/xc/extras/X-TrueType/GB2312/GB2312toUCS2.c index 4698683a0..867688412 100644 --- a/xc/extras/X-TrueType/GB2312/GB2312toUCS2.c +++ b/xc/extras/X-TrueType/GB2312/GB2312toUCS2.c @@ -32,6 +32,7 @@ Notice=== This table data derived from Unicode, Inc. (ftp://ftp.unicode.org/Public/MAPPINGS/EASTASIA/GB/GB2312.TXT) */ +/* $XFree86: xc/extras/X-TrueType/GB2312/GB2312toUCS2.c,v 1.2 2001/03/06 18:03:13 dawes Exp $ */ #include "xttversion.h" @@ -47,8 +48,8 @@ static char const * const releaseID = static ucs2_t tblGb2312ToUcs2[] = { /* 0x2120 - 0x217F */ - ALTCHR, 0x3000, 0x3001, 0x3002, 0x30FB, 0x02C9, 0x02C7, 0x00A8, - 0x3003, 0x3005, 0x2015, 0xFF5E, 0x2225, 0x2026, 0x2018, 0x2019, + ALTCHR, 0x3000, 0x3001, 0x3002, 0x00B7, 0x02C9, 0x02C7, 0x00A8, + 0x3003, 0x3005, 0x2014, 0xFF5E, 0x2225, 0x2026, 0x2018, 0x2019, 0x201C, 0x201D, 0x3014, 0x3015, 0x3008, 0x3009, 0x300A, 0x300B, 0x300C, 0x300D, 0x300E, 0x300F, 0x3016, 0x3017, 0x3010, 0x3011, 0x00B1, 0x00D7, 0x00F7, 0x2236, 0x2227, 0x2228, 0x2211, 0x220F, diff --git a/xc/extras/X-TrueType/GBK/GBKtoUCS2.c b/xc/extras/X-TrueType/GBK/GBKtoUCS2.c new file mode 100644 index 000000000..c7f3465d4 --- /dev/null +++ b/xc/extras/X-TrueType/GBK/GBKtoUCS2.c @@ -0,0 +1,3211 @@ +/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */ +/* ===FileName: === + Copyright (c) 1998,1999 Chen Xiangyang, All Rights reserved. + Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved. + Copyright (c) 1998 Go Watanabe, All rights reserved. + Copyright (c) 1998 X-TrueType Server Project, All rights reserved. + +===Notice + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + Major Release ID: X-TrueType Server Version 1.2 [Aoi MATSUBARA Release 2] + +Notice=== + + This table data derived from Unicode, Inc. + (ftp://ftp.unicode.org/Public/MAPPING/EASTASIA/UNIHAN.TXT) + */ +/* $XFree86: xc/extras/X-TrueType/GBK/GBKtoUCS2.c,v 1.1 2001/03/06 18:03:13 dawes Exp $ */ + +#include "xttversion.h" + +static char const * const releaseID = + _XTT_RELEASE_NAME; + +#include "xttcommon.h" +#include "xttcap.h" +#include "xttcconv.h" +#include "xttcconvP.h" + +#define ALTCHR 0x3000 + +static ucs2_t tblGbkToUcs2[] = { +/* 0x8140 - 0x81FF */ + 0x4E02, 0x4E04, 0x4E05, 0x4E06, 0x4E0F, 0x4E12, 0x4E17, 0x4E1F, + 0x4E20, 0x4E21, 0x4E23, 0x4E26, 0x4E29, 0x4E2E, 0x4E2F, 0x4E31, + 0x4E33, 0x4E35, 0x4E37, 0x4E3C, 0x4E40, 0x4E41, 0x4E42, 0x4E44, + 0x4E46, 0x4E4A, 0x4E51, 0x4E55, 0x4E57, 0x4E5A, 0x4E5B, 0x4E62, + 0x4E63, 0x4E64, 0x4E65, 0x4E67, 0x4E68, 0x4E6A, 0x4E6B, 0x4E6C, + 0x4E6D, 0x4E6E, 0x4E6F, 0x4E72, 0x4E74, 0x4E75, 0x4E76, 0x4E77, + 0x4E78, 0x4E79, 0x4E7A, 0x4E7B, 0x4E7C, 0x4E7D, 0x4E7F, 0x4E80, + 0x4E81, 0x4E82, 0x4E83, 0x4E84, 0x4E85, 0x4E87, 0x4E8A, ALTCHR, + 0x4E90, 0x4E96, 0x4E97, 0x4E99, 0x4E9C, 0x4E9D, 0x4E9E, 0x4EA3, + 0x4EAA, 0x4EAF, 0x4EB0, 0x4EB1, 0x4EB4, 0x4EB6, 0x4EB7, 0x4EB8, + 0x4EB9, 0x4EBC, 0x4EBD, 0x4EBE, 0x4EC8, 0x4ECC, 0x4ECF, 0x4ED0, + 0x4ED2, 0x4EDA, 0x4EDB, 0x4EDC, 0x4EE0, 0x4EE2, 0x4EE6, 0x4EE7, + 0x4EE9, 0x4EED, 0x4EEE, 0x4EEF, 0x4EF1, 0x4EF4, 0x4EF8, 0x4EF9, + 0x4EFA, 0x4EFC, 0x4EFE, 0x4F00, 0x4F02, 0x4F03, 0x4F04, 0x4F05, + 0x4F06, 0x4F07, 0x4F08, 0x4F0B, 0x4F0C, 0x4F12, 0x4F13, 0x4F14, + 0x4F15, 0x4F16, 0x4F1C, 0x4F1D, 0x4F21, 0x4F23, 0x4F28, 0x4F29, + 0x4F2C, 0x4F2D, 0x4F2E, 0x4F31, 0x4F33, 0x4F35, 0x4F37, 0x4F39, + 0x4F3B, 0x4F3E, 0x4F3F, 0x4F40, 0x4F41, 0x4F42, 0x4F44, 0x4F45, + 0x4F47, 0x4F48, 0x4F49, 0x4F4A, 0x4F4B, 0x4F4C, 0x4F52, 0x4F54, + 0x4F56, 0x4F61, 0x4F62, 0x4F66, 0x4F68, 0x4F6A, 0x4F6B, 0x4F6D, + 0x4F6E, 0x4F71, 0x4F72, 0x4F75, 0x4F77, 0x4F78, 0x4F79, 0x4F7A, + 0x4F7D, 0x4F80, 0x4F81, 0x4F82, 0x4F85, 0x4F86, 0x4F87, 0x4F8A, + 0x4F8C, 0x4F8E, 0x4F90, 0x4F92, 0x4F93, 0x4F95, 0x4F96, 0x4F98, + 0x4F99, 0x4F9A, 0x4F9C, 0x4F9E, 0x4F9F, 0x4FA1, 0x4FA2, ALTCHR, +/* 0x8240 - 0x82FF */ + 0x4FA4, 0x4FAB, 0x4FAD, 0x4FB0, 0x4FB1, 0x4FB2, 0x4FB3, 0x4FB4, + 0x4FB6, 0x4FB7, 0x4FB8, 0x4FB9, 0x4FBA, 0x4FBB, 0x4FBC, 0x4FBD, + 0x4FBE, 0x4FC0, 0x4FC1, 0x4FC2, 0x4FC6, 0x4FC7, 0x4FC8, 0x4FC9, + 0x4FCB, 0x4FCC, 0x4FCD, 0x4FD2, 0x4FD3, 0x4FD4, 0x4FD5, 0x4FD6, + 0x4FD9, 0x4FDB, 0x4FE0, 0x4FE2, 0x4FE4, 0x4FE5, 0x4FE7, 0x4FEB, + 0x4FEC, 0x4FF0, 0x4FF2, 0x4FF4, 0x4FF5, 0x4FF6, 0x4FF7, 0x4FF9, + 0x4FFB, 0x4FFC, 0x4FFD, 0x4FFF, 0x5000, 0x5001, 0x5002, 0x5003, + 0x5004, 0x5005, 0x5006, 0x5007, 0x5008, 0x5009, 0x500A, ALTCHR, + 0x500B, 0x500E, 0x5010, 0x5011, 0x5013, 0x5015, 0x5016, 0x5017, + 0x501B, 0x501D, 0x501E, 0x5020, 0x5022, 0x5023, 0x5024, 0x5027, + 0x502B, 0x502F, 0x5030, 0x5031, 0x5032, 0x5033, 0x5034, 0x5035, + 0x5036, 0x5037, 0x5038, 0x5039, 0x503B, 0x503D, 0x503F, 0x5040, + 0x5041, 0x5042, 0x5044, 0x5045, 0x5046, 0x5049, 0x504A, 0x504B, + 0x504D, 0x5050, 0x5051, 0x5052, 0x5053, 0x5054, 0x5056, 0x5057, + 0x5058, 0x5059, 0x505B, 0x505D, 0x505E, 0x505F, 0x5060, 0x5061, + 0x5062, 0x5063, 0x5064, 0x5066, 0x5067, 0x5068, 0x5069, 0x506A, + 0x506B, 0x506D, 0x506E, 0x506F, 0x5070, 0x5071, 0x5072, 0x5073, + 0x5074, 0x5075, 0x5078, 0x5079, 0x507A, 0x507C, 0x507D, 0x5081, + 0x5082, 0x5083, 0x5084, 0x5086, 0x5087, 0x5089, 0x508A, 0x508B, + 0x508C, 0x508E, 0x508F, 0x5090, 0x5091, 0x5092, 0x5093, 0x5094, + 0x5095, 0x5096, 0x5097, 0x5098, 0x5099, 0x509A, 0x509B, 0x509C, + 0x509D, 0x509E, 0x509F, 0x50A0, 0x50A1, 0x50A2, 0x50A4, 0x50A6, + 0x50AA, 0x50AB, 0x50AD, 0x50AE, 0x50AF, 0x50B0, 0x50B1, 0x50B3, + 0x50B4, 0x50B5, 0x50B6, 0x50B7, 0x50B8, 0x50B9, 0x50BC, ALTCHR, +/* 0x8340 - 0x83FF */ + 0x50BD, 0x50BE, 0x50BF, 0x50C0, 0x50C1, 0x50C2, 0x50C3, 0x50C4, + 0x50C5, 0x50C6, 0x50C7, 0x50C8, 0x50C9, 0x50CA, 0x50CB, 0x50CC, + 0x50CD, 0x50CE, 0x50D0, 0x50D1, 0x50D2, 0x50D3, 0x50D4, 0x50D5, + 0x50D7, 0x50D8, 0x50D9, 0x50DB, 0x50DC, 0x50DD, 0x50DE, 0x50DF, + 0x50E0, 0x50E1, 0x50E2, 0x50E3, 0x50E4, 0x50E5, 0x50E8, 0x50E9, + 0x50EA, 0x50EB, 0x50EF, 0x50F0, 0x50F1, 0x50F2, 0x50F4, 0x50F6, + 0x50F7, 0x50F8, 0x50F9, 0x50FA, 0x50FC, 0x50FD, 0x50FE, 0x50FF, + 0x5100, 0x5101, 0x5102, 0x5103, 0x5104, 0x5105, 0x5108, ALTCHR, + 0x5109, 0x510A, 0x510C, 0x510D, 0x510E, 0x510F, 0x5110, 0x5111, + 0x5113, 0x5114, 0x5115, 0x5116, 0x5117, 0x5118, 0x5119, 0x511A, + 0x511B, 0x511C, 0x511D, 0x511E, 0x511F, 0x5120, 0x5122, 0x5123, + 0x5124, 0x5125, 0x5126, 0x5127, 0x5128, 0x5129, 0x512A, 0x512B, + 0x512C, 0x512D, 0x512E, 0x512F, 0x5130, 0x5131, 0x5132, 0x5133, + 0x5134, 0x5135, 0x5136, 0x5137, 0x5138, 0x5139, 0x513A, 0x513B, + 0x513C, 0x513D, 0x513E, 0x5142, 0x5147, 0x514A, 0x514C, 0x514E, + 0x514F, 0x5150, 0x5152, 0x5153, 0x5157, 0x5158, 0x5159, 0x515B, + 0x515D, 0x515E, 0x515F, 0x5160, 0x5161, 0x5163, 0x5164, 0x5166, + 0x5167, 0x5169, 0x516A, 0x516F, 0x5172, 0x517A, 0x517E, 0x517F, + 0x5183, 0x5184, 0x5186, 0x5187, 0x518A, 0x518B, 0x518E, 0x518F, + 0x5190, 0x5191, 0x5193, 0x5194, 0x5198, 0x519A, 0x519D, 0x519E, + 0x519F, 0x51A1, 0x51A3, 0x51A6, 0x51A7, 0x51A8, 0x51A9, 0x51AA, + 0x51AD, 0x51AE, 0x51B4, 0x51B8, 0x51B9, 0x51BA, 0x51BE, 0x51BF, + 0x51C1, 0x51C2, 0x51C3, 0x51C5, 0x51C8, 0x51CA, 0x51CD, 0x51CE, + 0x51D0, 0x51D2, 0x51D3, 0x51D4, 0x51D5, 0x51D6, 0x51D7, ALTCHR, +/* 0x8440 - 0x84FF */ + 0x51D8, 0x51D9, 0x51DA, 0x51DC, 0x51DE, 0x51DF, 0x51E2, 0x51E3, + 0x51E5, 0x51E6, 0x51E7, 0x51E8, 0x51E9, 0x51EA, 0x51EC, 0x51EE, + 0x51F1, 0x51F2, 0x51F4, 0x51F7, 0x51FE, 0x5204, 0x5205, 0x5209, + 0x520B, 0x520C, 0x520F, 0x5210, 0x5213, 0x5214, 0x5215, 0x521C, + 0x521E, 0x521F, 0x5221, 0x5222, 0x5223, 0x5225, 0x5226, 0x5227, + 0x522A, 0x522C, 0x522F, 0x5231, 0x5232, 0x5234, 0x5235, 0x523C, + 0x523E, 0x5244, 0x5245, 0x5246, 0x5247, 0x5248, 0x5249, 0x524B, + 0x524E, 0x524F, 0x5252, 0x5253, 0x5255, 0x5257, 0x5258, ALTCHR, + 0x5259, 0x525A, 0x525B, 0x525D, 0x525F, 0x5260, 0x5262, 0x5263, + 0x5264, 0x5266, 0x5268, 0x526B, 0x526C, 0x526D, 0x526E, 0x5270, + 0x5271, 0x5273, 0x5274, 0x5275, 0x5276, 0x5277, 0x5278, 0x5279, + 0x527A, 0x527B, 0x527C, 0x527E, 0x5280, 0x5283, 0x5284, 0x5285, + 0x5286, 0x5287, 0x5289, 0x528A, 0x528B, 0x528C, 0x528D, 0x528E, + 0x528F, 0x5291, 0x5292, 0x5294, 0x5295, 0x5296, 0x5297, 0x5298, + 0x5299, 0x529A, 0x529C, 0x52A4, 0x52A5, 0x52A6, 0x52A7, 0x52AE, + 0x52AF, 0x52B0, 0x52B4, 0x52B5, 0x52B6, 0x52B7, 0x52B8, 0x52B9, + 0x52BA, 0x52BB, 0x52BC, 0x52BD, 0x52C0, 0x52C1, 0x52C2, 0x52C4, + 0x52C5, 0x52C6, 0x52C8, 0x52CA, 0x52CC, 0x52CD, 0x52CE, 0x52CF, + 0x52D1, 0x52D3, 0x52D4, 0x52D5, 0x52D7, 0x52D9, 0x52DA, 0x52DB, + 0x52DC, 0x52DD, 0x52DE, 0x52E0, 0x52E1, 0x52E2, 0x52E3, 0x52E5, + 0x52E6, 0x52E7, 0x52E8, 0x52E9, 0x52EA, 0x52EB, 0x52EC, 0x52ED, + 0x52EE, 0x52EF, 0x52F1, 0x52F2, 0x52F3, 0x52F4, 0x52F5, 0x52F6, + 0x52F7, 0x52F8, 0x52FB, 0x52FC, 0x52FD, 0x5301, 0x5302, 0x5303, + 0x5304, 0x5307, 0x5309, 0x530A, 0x530B, 0x530C, 0x530E, ALTCHR, +/* 0x8540 - 0x85FF */ + 0x5311, 0x5312, 0x5313, 0x5314, 0x5318, 0x531B, 0x531C, 0x531E, + 0x531F, 0x5322, 0x5324, 0x5325, 0x5327, 0x5328, 0x5329, 0x532B, + 0x532C, 0x532D, 0x532F, 0x5330, 0x5331, 0x5332, 0x5333, 0x5334, + 0x5335, 0x5336, 0x5337, 0x5338, 0x533C, 0x533D, 0x5340, 0x5342, + 0x5344, 0x5346, 0x534B, 0x534C, 0x534D, 0x5350, 0x5354, 0x5358, + 0x5359, 0x535B, 0x535D, 0x5365, 0x5368, 0x536A, 0x536C, 0x536D, + 0x5372, 0x5376, 0x5379, 0x537B, 0x537C, 0x537D, 0x537E, 0x5380, + 0x5381, 0x5383, 0x5387, 0x5388, 0x538A, 0x538E, 0x538F, ALTCHR, + 0x5390, 0x5391, 0x5392, 0x5393, 0x5394, 0x5396, 0x5397, 0x5399, + 0x539B, 0x539C, 0x539E, 0x53A0, 0x53A1, 0x53A4, 0x53A7, 0x53AA, + 0x53AB, 0x53AC, 0x53AD, 0x53AF, 0x53B0, 0x53B1, 0x53B2, 0x53B3, + 0x53B4, 0x53B5, 0x53B7, 0x53B8, 0x53B9, 0x53BA, 0x53BC, 0x53BD, + 0x53BE, 0x53C0, 0x53C3, 0x53C4, 0x53C5, 0x53C6, 0x53C7, 0x53CE, + 0x53CF, 0x53D0, 0x53D2, 0x53D3, 0x53D5, 0x53DA, 0x53DC, 0x53DD, + 0x53DE, 0x53E1, 0x53E2, 0x53E7, 0x53F4, 0x53FA, 0x53FE, 0x53FF, + 0x5400, 0x5402, 0x5405, 0x5407, 0x540B, 0x5414, 0x5418, 0x5419, + 0x541A, 0x541C, 0x5422, 0x5424, 0x5425, 0x542A, 0x5430, 0x5433, + 0x5436, 0x5437, 0x543A, 0x543D, 0x543F, 0x5441, 0x5442, 0x5444, + 0x5445, 0x5447, 0x5449, 0x544C, 0x544D, 0x544E, 0x544F, 0x5451, + 0x545A, 0x545D, 0x545E, 0x545F, 0x5460, 0x5461, 0x5463, 0x5465, + 0x5467, 0x5469, 0x546A, 0x546B, 0x546C, 0x546D, 0x546E, 0x546F, + 0x5470, 0x5474, 0x5479, 0x547A, 0x547E, 0x547F, 0x5481, 0x5483, + 0x5485, 0x5487, 0x5488, 0x5489, 0x548A, 0x548D, 0x5491, 0x5493, + 0x5497, 0x5498, 0x549C, 0x549E, 0x549F, 0x54A0, 0x54A1, ALTCHR, +/* 0x8640 - 0x86FF */ + 0x54A2, 0x54A5, 0x54AE, 0x54B0, 0x54B2, 0x54B5, 0x54B6, 0x54B7, + 0x54B9, 0x54BA, 0x54BC, 0x54BE, 0x54C3, 0x54C5, 0x54CA, 0x54CB, + 0x54D6, 0x54D8, 0x54DB, 0x54E0, 0x54E1, 0x54E2, 0x54E3, 0x54E4, + 0x54EB, 0x54EC, 0x54EF, 0x54F0, 0x54F1, 0x54F4, 0x54F5, 0x54F6, + 0x54F7, 0x54F8, 0x54F9, 0x54FB, 0x54FE, 0x5500, 0x5502, 0x5503, + 0x5504, 0x5505, 0x5508, 0x550A, 0x550B, 0x550C, 0x550D, 0x550E, + 0x5512, 0x5513, 0x5515, 0x5516, 0x5517, 0x5518, 0x5519, 0x551A, + 0x551C, 0x551D, 0x551E, 0x551F, 0x5521, 0x5525, 0x5526, ALTCHR, + 0x5528, 0x5529, 0x552B, 0x552D, 0x5532, 0x5534, 0x5535, 0x5536, + 0x5538, 0x5539, 0x553A, 0x553B, 0x553D, 0x5540, 0x5542, 0x5545, + 0x5547, 0x5548, 0x554B, 0x554C, 0x554D, 0x554E, 0x554F, 0x5551, + 0x5552, 0x5553, 0x5554, 0x5557, 0x5558, 0x5559, 0x555A, 0x555B, + 0x555D, 0x555E, 0x555F, 0x5560, 0x5562, 0x5563, 0x5568, 0x5569, + 0x556B, 0x556F, 0x5570, 0x5571, 0x5572, 0x5573, 0x5574, 0x5579, + 0x557A, 0x557D, 0x557F, 0x5585, 0x5586, 0x558C, 0x558D, 0x558E, + 0x5590, 0x5592, 0x5593, 0x5595, 0x5596, 0x5597, 0x559A, 0x559B, + 0x559E, 0x55A0, 0x55A1, 0x55A2, 0x55A3, 0x55A4, 0x55A5, 0x55A6, + 0x55A8, 0x55A9, 0x55AA, 0x55AB, 0x55AC, 0x55AD, 0x55AE, 0x55AF, + 0x55B0, 0x55B2, 0x55B4, 0x55B6, 0x55B8, 0x55BA, 0x55BC, 0x55BF, + 0x55C0, 0x55C1, 0x55C2, 0x55C3, 0x55C6, 0x55C7, 0x55C8, 0x55CA, + 0x55CB, 0x55CE, 0x55CF, 0x55D0, 0x55D5, 0x55D7, 0x55D8, 0x55D9, + 0x55DA, 0x55DB, 0x55DE, 0x55E0, 0x55E2, 0x55E7, 0x55E9, 0x55ED, + 0x55EE, 0x55F0, 0x55F1, 0x55F4, 0x55F6, 0x55F8, 0x55F9, 0x55FA, + 0x55FB, 0x55FC, 0x55FF, 0x5602, 0x5603, 0x5604, 0x5605, ALTCHR, +/* 0x8740 - 0x87FF */ + 0x5606, 0x5607, 0x560A, 0x560B, 0x560D, 0x5610, 0x5611, 0x5612, + 0x5613, 0x5614, 0x5615, 0x5616, 0x5617, 0x5619, 0x561A, 0x561C, + 0x561D, 0x5620, 0x5621, 0x5622, 0x5625, 0x5626, 0x5628, 0x5629, + 0x562A, 0x562B, 0x562E, 0x562F, 0x5630, 0x5633, 0x5635, 0x5637, + 0x5638, 0x563A, 0x563C, 0x563D, 0x563E, 0x5640, 0x5641, 0x5642, + 0x5643, 0x5644, 0x5645, 0x5646, 0x5647, 0x5648, 0x5649, 0x564A, + 0x564B, 0x564F, 0x5650, 0x5651, 0x5652, 0x5653, 0x5655, 0x5656, + 0x565A, 0x565B, 0x565D, 0x565E, 0x565F, 0x5660, 0x5661, ALTCHR, + 0x5663, 0x5665, 0x5666, 0x5667, 0x566D, 0x566E, 0x566F, 0x5670, + 0x5672, 0x5673, 0x5674, 0x5675, 0x5677, 0x5678, 0x5679, 0x567A, + 0x567D, 0x567E, 0x567F, 0x5680, 0x5681, 0x5682, 0x5683, 0x5684, + 0x5687, 0x5688, 0x5689, 0x568A, 0x568B, 0x568C, 0x568D, 0x5690, + 0x5691, 0x5692, 0x5694, 0x5695, 0x5696, 0x5697, 0x5698, 0x5699, + 0x569A, 0x569B, 0x569C, 0x569D, 0x569E, 0x569F, 0x56A0, 0x56A1, + 0x56A2, 0x56A4, 0x56A5, 0x56A6, 0x56A7, 0x56A8, 0x56A9, 0x56AA, + 0x56AB, 0x56AC, 0x56AD, 0x56AE, 0x56B0, 0x56B1, 0x56B2, 0x56B3, + 0x56B4, 0x56B5, 0x56B6, 0x56B8, 0x56B9, 0x56BA, 0x56BB, 0x56BD, + 0x56BE, 0x56BF, 0x56C0, 0x56C1, 0x56C2, 0x56C3, 0x56C4, 0x56C5, + 0x56C6, 0x56C7, 0x56C8, 0x56C9, 0x56CB, 0x56CC, 0x56CD, 0x56CE, + 0x56CF, 0x56D0, 0x56D1, 0x56D2, 0x56D3, 0x56D5, 0x56D6, 0x56D8, + 0x56D9, 0x56DC, 0x56E3, 0x56E5, 0x56E6, 0x56E7, 0x56E8, 0x56E9, + 0x56EA, 0x56EC, 0x56EE, 0x56EF, 0x56F2, 0x56F3, 0x56F6, 0x56F7, + 0x56F8, 0x56FB, 0x56FC, 0x5700, 0x5701, 0x5702, 0x5705, 0x5707, + 0x570B, 0x570C, 0x570D, 0x570E, 0x570F, 0x5710, 0x5711, ALTCHR, +/* 0x8840 - 0x88FF */ + 0x5712, 0x5713, 0x5714, 0x5715, 0x5716, 0x5717, 0x5718, 0x5719, + 0x571A, 0x571B, 0x571D, 0x571E, 0x5720, 0x5721, 0x5722, 0x5724, + 0x5725, 0x5726, 0x5727, 0x572B, 0x5731, 0x5732, 0x5734, 0x5735, + 0x5736, 0x5737, 0x5738, 0x573C, 0x573D, 0x573F, 0x5741, 0x5743, + 0x5744, 0x5745, 0x5746, 0x5748, 0x5749, 0x574B, 0x5752, 0x5753, + 0x5754, 0x5755, 0x5756, 0x5758, 0x5759, 0x5762, 0x5763, 0x5765, + 0x5767, 0x576C, 0x576E, 0x5770, 0x5771, 0x5772, 0x5774, 0x5775, + 0x5778, 0x5779, 0x577A, 0x577D, 0x577E, 0x577F, 0x5780, ALTCHR, + 0x5781, 0x5787, 0x5788, 0x5789, 0x578A, 0x578D, 0x578E, 0x578F, + 0x5790, 0x5791, 0x5794, 0x5795, 0x5796, 0x5797, 0x5798, 0x5799, + 0x579A, 0x579C, 0x579D, 0x579E, 0x579F, 0x57A5, 0x57A8, 0x57AA, + 0x57AC, 0x57AF, 0x57B0, 0x57B1, 0x57B3, 0x57B5, 0x57B6, 0x57B7, + 0x57B9, 0x57BA, 0x57BB, 0x57BC, 0x57BD, 0x57BE, 0x57BF, 0x57C0, + 0x57C1, 0x57C4, 0x57C5, 0x57C6, 0x57C7, 0x57C8, 0x57C9, 0x57CA, + 0x57CC, 0x57CD, 0x57D0, 0x57D1, 0x57D3, 0x57D6, 0x57D7, 0x57DB, + 0x57DC, 0x57DE, 0x57E1, 0x57E2, 0x57E3, 0x57E5, 0x57E6, 0x57E7, + 0x57E8, 0x57E9, 0x57EA, 0x57EB, 0x57EC, 0x57EE, 0x57F0, 0x57F1, + 0x57F2, 0x57F3, 0x57F5, 0x57F6, 0x57F7, 0x57FB, 0x57FC, 0x57FE, + 0x57FF, 0x5801, 0x5803, 0x5804, 0x5805, 0x5808, 0x5809, 0x580A, + 0x580C, 0x580E, 0x580F, 0x5810, 0x5812, 0x5813, 0x5814, 0x5816, + 0x5817, 0x5818, 0x581A, 0x581B, 0x581C, 0x581D, 0x581F, 0x5822, + 0x5823, 0x5825, 0x5826, 0x5827, 0x5828, 0x5829, 0x582B, 0x582C, + 0x582D, 0x582E, 0x582F, 0x5831, 0x5832, 0x5833, 0x5834, 0x5836, + 0x5837, 0x5838, 0x5839, 0x583A, 0x583B, 0x583C, 0x583D, ALTCHR, +/* 0x8940 - 0x89FF */ + 0x583E, 0x583F, 0x5840, 0x5841, 0x5842, 0x5843, 0x5845, 0x5846, + 0x5847, 0x5848, 0x5849, 0x584A, 0x584B, 0x584E, 0x584F, 0x5850, + 0x5852, 0x5853, 0x5855, 0x5856, 0x5857, 0x5859, 0x585A, 0x585B, + 0x585C, 0x585D, 0x585F, 0x5860, 0x5861, 0x5862, 0x5863, 0x5864, + 0x5866, 0x5867, 0x5868, 0x5869, 0x586A, 0x586D, 0x586E, 0x586F, + 0x5870, 0x5871, 0x5872, 0x5873, 0x5874, 0x5875, 0x5876, 0x5877, + 0x5878, 0x5879, 0x587A, 0x587B, 0x587C, 0x587D, 0x587F, 0x5882, + 0x5884, 0x5886, 0x5887, 0x5888, 0x588A, 0x588B, 0x588C, ALTCHR, + 0x588D, 0x588E, 0x588F, 0x5890, 0x5891, 0x5894, 0x5895, 0x5896, + 0x5897, 0x5898, 0x589B, 0x589C, 0x589D, 0x58A0, 0x58A1, 0x58A2, + 0x58A3, 0x58A4, 0x58A5, 0x58A6, 0x58A7, 0x58AA, 0x58AB, 0x58AC, + 0x58AD, 0x58AE, 0x58AF, 0x58B0, 0x58B1, 0x58B2, 0x58B3, 0x58B4, + 0x58B5, 0x58B6, 0x58B7, 0x58B8, 0x58B9, 0x58BA, 0x58BB, 0x58BD, + 0x58BE, 0x58BF, 0x58C0, 0x58C2, 0x58C3, 0x58C4, 0x58C6, 0x58C7, + 0x58C8, 0x58C9, 0x58CA, 0x58CB, 0x58CC, 0x58CD, 0x58CE, 0x58CF, + 0x58D0, 0x58D2, 0x58D3, 0x58D4, 0x58D6, 0x58D7, 0x58D8, 0x58D9, + 0x58DA, 0x58DB, 0x58DC, 0x58DD, 0x58DE, 0x58DF, 0x58E0, 0x58E1, + 0x58E2, 0x58E3, 0x58E5, 0x58E6, 0x58E7, 0x58E8, 0x58E9, 0x58EA, + 0x58ED, 0x58EF, 0x58F1, 0x58F2, 0x58F4, 0x58F5, 0x58F7, 0x58F8, + 0x58FA, 0x58FB, 0x58FC, 0x58FD, 0x58FE, 0x58FF, 0x5900, 0x5901, + 0x5903, 0x5905, 0x5906, 0x5908, 0x5909, 0x590A, 0x590B, 0x590C, + 0x590E, 0x5910, 0x5911, 0x5912, 0x5913, 0x5917, 0x5918, 0x591B, + 0x591D, 0x591E, 0x5920, 0x5921, 0x5922, 0x5923, 0x5926, 0x5928, + 0x592C, 0x5930, 0x5932, 0x5933, 0x5935, 0x5936, 0x593B, ALTCHR, +/* 0x8A40 - 0x8AFF */ + 0x593D, 0x593E, 0x593F, 0x5940, 0x5943, 0x5945, 0x5946, 0x594A, + 0x594C, 0x594D, 0x5950, 0x5952, 0x5953, 0x5959, 0x595B, 0x595C, + 0x595D, 0x595E, 0x595F, 0x5961, 0x5963, 0x5964, 0x5966, 0x5967, + 0x5968, 0x5969, 0x596A, 0x596B, 0x596C, 0x596D, 0x596E, 0x596F, + 0x5970, 0x5971, 0x5972, 0x5975, 0x5977, 0x597A, 0x597B, 0x597C, + 0x597E, 0x597F, 0x5980, 0x5985, 0x5989, 0x598B, 0x598C, 0x598E, + 0x598F, 0x5990, 0x5991, 0x5994, 0x5995, 0x5998, 0x599A, 0x599B, + 0x599C, 0x599D, 0x599F, 0x59A0, 0x59A1, 0x59A2, 0x59A6, ALTCHR, + 0x59A7, 0x59AC, 0x59AD, 0x59B0, 0x59B1, 0x59B3, 0x59B4, 0x59B5, + 0x59B6, 0x59B7, 0x59B8, 0x59BA, 0x59BC, 0x59BD, 0x59BF, 0x59C0, + 0x59C1, 0x59C2, 0x59C3, 0x59C4, 0x59C5, 0x59C7, 0x59C8, 0x59C9, + 0x59CC, 0x59CD, 0x59CE, 0x59CF, 0x59D5, 0x59D6, 0x59D9, 0x59DB, + 0x59DE, 0x59DF, 0x59E0, 0x59E1, 0x59E2, 0x59E4, 0x59E6, 0x59E7, + 0x59E9, 0x59EA, 0x59EB, 0x59ED, 0x59EE, 0x59EF, 0x59F0, 0x59F1, + 0x59F2, 0x59F3, 0x59F4, 0x59F5, 0x59F6, 0x59F7, 0x59F8, 0x59FA, + 0x59FC, 0x59FD, 0x59FE, 0x5A00, 0x5A02, 0x5A0A, 0x5A0B, 0x5A0D, + 0x5A0E, 0x5A0F, 0x5A10, 0x5A12, 0x5A14, 0x5A15, 0x5A16, 0x5A17, + 0x5A19, 0x5A1A, 0x5A1B, 0x5A1D, 0x5A1E, 0x5A21, 0x5A22, 0x5A24, + 0x5A26, 0x5A27, 0x5A28, 0x5A2A, 0x5A2B, 0x5A2C, 0x5A2D, 0x5A2E, + 0x5A2F, 0x5A30, 0x5A33, 0x5A35, 0x5A37, 0x5A38, 0x5A39, 0x5A3A, + 0x5A3B, 0x5A3D, 0x5A3E, 0x5A3F, 0x5A41, 0x5A42, 0x5A43, 0x5A44, + 0x5A45, 0x5A47, 0x5A48, 0x5A4B, 0x5A4C, 0x5A4D, 0x5A4E, 0x5A4F, + 0x5A50, 0x5A51, 0x5A52, 0x5A53, 0x5A54, 0x5A56, 0x5A57, 0x5A58, + 0x5A59, 0x5A5B, 0x5A5C, 0x5A5D, 0x5A5E, 0x5A5F, 0x5A60, ALTCHR, +/* 0x8B40 - 0x8BFF */ + 0x5A61, 0x5A63, 0x5A64, 0x5A65, 0x5A66, 0x5A68, 0x5A69, 0x5A6B, + 0x5A6C, 0x5A6D, 0x5A6E, 0x5A6F, 0x5A70, 0x5A71, 0x5A72, 0x5A73, + 0x5A78, 0x5A79, 0x5A7B, 0x5A7C, 0x5A7D, 0x5A7E, 0x5A80, 0x5A81, + 0x5A82, 0x5A83, 0x5A84, 0x5A85, 0x5A86, 0x5A87, 0x5A88, 0x5A89, + 0x5A8A, 0x5A8B, 0x5A8C, 0x5A8D, 0x5A8E, 0x5A8F, 0x5A90, 0x5A91, + 0x5A93, 0x5A94, 0x5A95, 0x5A96, 0x5A97, 0x5A98, 0x5A99, 0x5A9C, + 0x5A9D, 0x5A9E, 0x5A9F, 0x5AA0, 0x5AA1, 0x5AA2, 0x5AA3, 0x5AA4, + 0x5AA5, 0x5AA6, 0x5AA7, 0x5AA8, 0x5AA9, 0x5AAB, 0x5AAC, ALTCHR, + 0x5AAD, 0x5AAE, 0x5AAF, 0x5AB0, 0x5AB1, 0x5AB4, 0x5AB6, 0x5AB7, + 0x5AB9, 0x5ABA, 0x5ABB, 0x5ABC, 0x5ABD, 0x5ABF, 0x5AC0, 0x5AC3, + 0x5AC4, 0x5AC5, 0x5AC6, 0x5AC7, 0x5AC8, 0x5ACA, 0x5ACB, 0x5ACD, + 0x5ACE, 0x5ACF, 0x5AD0, 0x5AD1, 0x5AD3, 0x5AD5, 0x5AD7, 0x5AD9, + 0x5ADA, 0x5ADB, 0x5ADD, 0x5ADE, 0x5ADF, 0x5AE2, 0x5AE4, 0x5AE5, + 0x5AE7, 0x5AE8, 0x5AEA, 0x5AEC, 0x5AED, 0x5AEE, 0x5AEF, 0x5AF0, + 0x5AF2, 0x5AF3, 0x5AF4, 0x5AF5, 0x5AF6, 0x5AF7, 0x5AF8, 0x5AF9, + 0x5AFA, 0x5AFB, 0x5AFC, 0x5AFD, 0x5AFE, 0x5AFF, 0x5B00, 0x5B01, + 0x5B02, 0x5B03, 0x5B04, 0x5B05, 0x5B06, 0x5B07, 0x5B08, 0x5B0A, + 0x5B0B, 0x5B0C, 0x5B0D, 0x5B0E, 0x5B0F, 0x5B10, 0x5B11, 0x5B12, + 0x5B13, 0x5B14, 0x5B15, 0x5B18, 0x5B19, 0x5B1A, 0x5B1B, 0x5B1C, + 0x5B1D, 0x5B1E, 0x5B1F, 0x5B20, 0x5B21, 0x5B22, 0x5B23, 0x5B24, + 0x5B25, 0x5B26, 0x5B27, 0x5B28, 0x5B29, 0x5B2A, 0x5B2B, 0x5B2C, + 0x5B2D, 0x5B2E, 0x5B2F, 0x5B30, 0x5B31, 0x5B33, 0x5B35, 0x5B36, + 0x5B38, 0x5B39, 0x5B3A, 0x5B3B, 0x5B3C, 0x5B3D, 0x5B3E, 0x5B3F, + 0x5B41, 0x5B42, 0x5B43, 0x5B44, 0x5B45, 0x5B46, 0x5B47, ALTCHR, +/* 0x8C40 - 0x8CFF */ + 0x5B48, 0x5B49, 0x5B4A, 0x5B4B, 0x5B4C, 0x5B4D, 0x5B4E, 0x5B4F, + 0x5B52, 0x5B56, 0x5B5E, 0x5B60, 0x5B61, 0x5B67, 0x5B68, 0x5B6B, + 0x5B6D, 0x5B6E, 0x5B6F, 0x5B72, 0x5B74, 0x5B76, 0x5B77, 0x5B78, + 0x5B79, 0x5B7B, 0x5B7C, 0x5B7E, 0x5B7F, 0x5B82, 0x5B86, 0x5B8A, + 0x5B8D, 0x5B8E, 0x5B90, 0x5B91, 0x5B92, 0x5B94, 0x5B96, 0x5B9F, + 0x5BA7, 0x5BA8, 0x5BA9, 0x5BAC, 0x5BAD, 0x5BAE, 0x5BAF, 0x5BB1, + 0x5BB2, 0x5BB7, 0x5BBA, 0x5BBB, 0x5BBC, 0x5BC0, 0x5BC1, 0x5BC3, + 0x5BC8, 0x5BC9, 0x5BCA, 0x5BCB, 0x5BCD, 0x5BCE, 0x5BCF, ALTCHR, + 0x5BD1, 0x5BD4, 0x5BD5, 0x5BD6, 0x5BD7, 0x5BD8, 0x5BD9, 0x5BDA, + 0x5BDB, 0x5BDC, 0x5BE0, 0x5BE2, 0x5BE3, 0x5BE6, 0x5BE7, 0x5BE9, + 0x5BEA, 0x5BEB, 0x5BEC, 0x5BED, 0x5BEF, 0x5BF1, 0x5BF2, 0x5BF3, + 0x5BF4, 0x5BF5, 0x5BF6, 0x5BF7, 0x5BFD, 0x5BFE, 0x5C00, 0x5C02, + 0x5C03, 0x5C05, 0x5C07, 0x5C08, 0x5C0B, 0x5C0C, 0x5C0D, 0x5C0E, + 0x5C10, 0x5C12, 0x5C13, 0x5C17, 0x5C19, 0x5C1B, 0x5C1E, 0x5C1F, + 0x5C20, 0x5C21, 0x5C23, 0x5C26, 0x5C28, 0x5C29, 0x5C2A, 0x5C2B, + 0x5C2D, 0x5C2E, 0x5C2F, 0x5C30, 0x5C32, 0x5C33, 0x5C35, 0x5C36, + 0x5C37, 0x5C43, 0x5C44, 0x5C46, 0x5C47, 0x5C4C, 0x5C4D, 0x5C52, + 0x5C53, 0x5C54, 0x5C56, 0x5C57, 0x5C58, 0x5C5A, 0x5C5B, 0x5C5C, + 0x5C5D, 0x5C5F, 0x5C62, 0x5C64, 0x5C67, 0x5C68, 0x5C69, 0x5C6A, + 0x5C6B, 0x5C6C, 0x5C6D, 0x5C70, 0x5C72, 0x5C73, 0x5C74, 0x5C75, + 0x5C76, 0x5C77, 0x5C78, 0x5C7B, 0x5C7C, 0x5C7D, 0x5C7E, 0x5C80, + 0x5C83, 0x5C84, 0x5C85, 0x5C86, 0x5C87, 0x5C89, 0x5C8A, 0x5C8B, + 0x5C8E, 0x5C8F, 0x5C92, 0x5C93, 0x5C95, 0x5C9D, 0x5C9E, 0x5C9F, + 0x5CA0, 0x5CA1, 0x5CA4, 0x5CA5, 0x5CA6, 0x5CA7, 0x5CA8, ALTCHR, +/* 0x8D40 - 0x8DFF */ + 0x5CAA, 0x5CAE, 0x5CAF, 0x5CB0, 0x5CB2, 0x5CB4, 0x5CB6, 0x5CB9, + 0x5CBA, 0x5CBB, 0x5CBC, 0x5CBE, 0x5CC0, 0x5CC2, 0x5CC3, 0x5CC5, + 0x5CC6, 0x5CC7, 0x5CC8, 0x5CC9, 0x5CCA, 0x5CCC, 0x5CCD, 0x5CCE, + 0x5CCF, 0x5CD0, 0x5CD1, 0x5CD3, 0x5CD4, 0x5CD5, 0x5CD6, 0x5CD7, + 0x5CD8, 0x5CDA, 0x5CDB, 0x5CDC, 0x5CDD, 0x5CDE, 0x5CDF, 0x5CE0, + 0x5CE2, 0x5CE3, 0x5CE7, 0x5CE9, 0x5CEB, 0x5CEC, 0x5CEE, 0x5CEF, + 0x5CF1, 0x5CF2, 0x5CF3, 0x5CF4, 0x5CF5, 0x5CF6, 0x5CF7, 0x5CF8, + 0x5CF9, 0x5CFA, 0x5CFC, 0x5CFD, 0x5CFE, 0x5CFF, 0x5D00, ALTCHR, + 0x5D01, 0x5D04, 0x5D05, 0x5D08, 0x5D09, 0x5D0A, 0x5D0B, 0x5D0C, + 0x5D0D, 0x5D0F, 0x5D10, 0x5D11, 0x5D12, 0x5D13, 0x5D15, 0x5D17, + 0x5D18, 0x5D19, 0x5D1A, 0x5D1C, 0x5D1D, 0x5D1F, 0x5D20, 0x5D21, + 0x5D22, 0x5D23, 0x5D25, 0x5D28, 0x5D2A, 0x5D2B, 0x5D2C, 0x5D2F, + 0x5D30, 0x5D31, 0x5D32, 0x5D33, 0x5D35, 0x5D36, 0x5D37, 0x5D38, + 0x5D39, 0x5D3A, 0x5D3B, 0x5D3C, 0x5D3F, 0x5D40, 0x5D41, 0x5D42, + 0x5D43, 0x5D44, 0x5D45, 0x5D46, 0x5D48, 0x5D49, 0x5D4D, 0x5D4E, + 0x5D4F, 0x5D50, 0x5D51, 0x5D52, 0x5D53, 0x5D54, 0x5D55, 0x5D56, + 0x5D57, 0x5D59, 0x5D5A, 0x5D5C, 0x5D5E, 0x5D5F, 0x5D60, 0x5D61, + 0x5D62, 0x5D63, 0x5D64, 0x5D65, 0x5D66, 0x5D67, 0x5D68, 0x5D6A, + 0x5D6D, 0x5D6E, 0x5D70, 0x5D71, 0x5D72, 0x5D73, 0x5D75, 0x5D76, + 0x5D77, 0x5D78, 0x5D79, 0x5D7A, 0x5D7B, 0x5D7C, 0x5D7D, 0x5D7E, + 0x5D7F, 0x5D80, 0x5D81, 0x5D83, 0x5D84, 0x5D85, 0x5D86, 0x5D87, + 0x5D88, 0x5D89, 0x5D8A, 0x5D8B, 0x5D8C, 0x5D8D, 0x5D8E, 0x5D8F, + 0x5D90, 0x5D91, 0x5D92, 0x5D93, 0x5D94, 0x5D95, 0x5D96, 0x5D97, + 0x5D98, 0x5D9A, 0x5D9B, 0x5D9C, 0x5D9E, 0x5D9F, 0x5DA0, ALTCHR, +/* 0x8E40 - 0x8EFF */ + 0x5DA1, 0x5DA2, 0x5DA3, 0x5DA4, 0x5DA5, 0x5DA6, 0x5DA7, 0x5DA8, + 0x5DA9, 0x5DAA, 0x5DAB, 0x5DAC, 0x5DAD, 0x5DAE, 0x5DAF, 0x5DB0, + 0x5DB1, 0x5DB2, 0x5DB3, 0x5DB4, 0x5DB5, 0x5DB6, 0x5DB8, 0x5DB9, + 0x5DBA, 0x5DBB, 0x5DBC, 0x5DBD, 0x5DBE, 0x5DBF, 0x5DC0, 0x5DC1, + 0x5DC2, 0x5DC3, 0x5DC4, 0x5DC6, 0x5DC7, 0x5DC8, 0x5DC9, 0x5DCA, + 0x5DCB, 0x5DCC, 0x5DCE, 0x5DCF, 0x5DD0, 0x5DD1, 0x5DD2, 0x5DD3, + 0x5DD4, 0x5DD5, 0x5DD6, 0x5DD7, 0x5DD8, 0x5DD9, 0x5DDA, 0x5DDC, + 0x5DDF, 0x5DE0, 0x5DE3, 0x5DE4, 0x5DEA, 0x5DEC, 0x5DED, ALTCHR, + 0x5DF0, 0x5DF5, 0x5DF6, 0x5DF8, 0x5DF9, 0x5DFA, 0x5DFB, 0x5DFC, + 0x5DFF, 0x5E00, 0x5E04, 0x5E07, 0x5E09, 0x5E0A, 0x5E0B, 0x5E0D, + 0x5E0E, 0x5E12, 0x5E13, 0x5E17, 0x5E1E, 0x5E1F, 0x5E20, 0x5E21, + 0x5E22, 0x5E23, 0x5E24, 0x5E25, 0x5E28, 0x5E29, 0x5E2A, 0x5E2B, + 0x5E2C, 0x5E2F, 0x5E30, 0x5E32, 0x5E33, 0x5E34, 0x5E35, 0x5E36, + 0x5E39, 0x5E3A, 0x5E3E, 0x5E3F, 0x5E40, 0x5E41, 0x5E43, 0x5E46, + 0x5E47, 0x5E48, 0x5E49, 0x5E4A, 0x5E4B, 0x5E4D, 0x5E4E, 0x5E4F, + 0x5E50, 0x5E51, 0x5E52, 0x5E53, 0x5E56, 0x5E57, 0x5E58, 0x5E59, + 0x5E5A, 0x5E5C, 0x5E5D, 0x5E5F, 0x5E60, 0x5E63, 0x5E64, 0x5E65, + 0x5E66, 0x5E67, 0x5E68, 0x5E69, 0x5E6A, 0x5E6B, 0x5E6C, 0x5E6D, + 0x5E6E, 0x5E6F, 0x5E70, 0x5E71, 0x5E75, 0x5E77, 0x5E79, 0x5E7E, + 0x5E81, 0x5E82, 0x5E83, 0x5E85, 0x5E88, 0x5E89, 0x5E8C, 0x5E8D, + 0x5E8E, 0x5E92, 0x5E98, 0x5E9B, 0x5E9D, 0x5EA1, 0x5EA2, 0x5EA3, + 0x5EA4, 0x5EA8, 0x5EA9, 0x5EAA, 0x5EAB, 0x5EAC, 0x5EAE, 0x5EAF, + 0x5EB0, 0x5EB1, 0x5EB2, 0x5EB4, 0x5EBA, 0x5EBB, 0x5EBC, 0x5EBD, + 0x5EBF, 0x5EC0, 0x5EC1, 0x5EC2, 0x5EC3, 0x5EC4, 0x5EC5, ALTCHR, +/* 0x8F40 - 0x8FFF */ + 0x5EC6, 0x5EC7, 0x5EC8, 0x5ECB, 0x5ECC, 0x5ECD, 0x5ECE, 0x5ECF, + 0x5ED0, 0x5ED4, 0x5ED5, 0x5ED7, 0x5ED8, 0x5ED9, 0x5EDA, 0x5EDC, + 0x5EDD, 0x5EDE, 0x5EDF, 0x5EE0, 0x5EE1, 0x5EE2, 0x5EE3, 0x5EE4, + 0x5EE5, 0x5EE6, 0x5EE7, 0x5EE9, 0x5EEB, 0x5EEC, 0x5EED, 0x5EEE, + 0x5EEF, 0x5EF0, 0x5EF1, 0x5EF2, 0x5EF3, 0x5EF5, 0x5EF8, 0x5EF9, + 0x5EFB, 0x5EFC, 0x5EFD, 0x5F05, 0x5F06, 0x5F07, 0x5F09, 0x5F0C, + 0x5F0D, 0x5F0E, 0x5F10, 0x5F12, 0x5F14, 0x5F16, 0x5F19, 0x5F1A, + 0x5F1C, 0x5F1D, 0x5F1E, 0x5F21, 0x5F22, 0x5F23, 0x5F24, ALTCHR, + 0x5F28, 0x5F2B, 0x5F2C, 0x5F2E, 0x5F30, 0x5F32, 0x5F33, 0x5F34, + 0x5F35, 0x5F36, 0x5F37, 0x5F38, 0x5F3B, 0x5F3D, 0x5F3E, 0x5F3F, + 0x5F41, 0x5F42, 0x5F43, 0x5F44, 0x5F45, 0x5F46, 0x5F47, 0x5F48, + 0x5F49, 0x5F4A, 0x5F4B, 0x5F4C, 0x5F4D, 0x5F4E, 0x5F4F, 0x5F51, + 0x5F54, 0x5F59, 0x5F5A, 0x5F5B, 0x5F5C, 0x5F5E, 0x5F5F, 0x5F60, + 0x5F63, 0x5F65, 0x5F67, 0x5F68, 0x5F6B, 0x5F6E, 0x5F6F, 0x5F72, + 0x5F74, 0x5F75, 0x5F76, 0x5F78, 0x5F7A, 0x5F7D, 0x5F7E, 0x5F7F, + 0x5F83, 0x5F86, 0x5F8D, 0x5F8E, 0x5F8F, 0x5F91, 0x5F93, 0x5F94, + 0x5F96, 0x5F9A, 0x5F9B, 0x5F9D, 0x5F9E, 0x5F9F, 0x5FA0, 0x5FA2, + 0x5FA3, 0x5FA4, 0x5FA5, 0x5FA6, 0x5FA7, 0x5FA9, 0x5FAB, 0x5FAC, + 0x5FAF, 0x5FB0, 0x5FB1, 0x5FB2, 0x5FB3, 0x5FB4, 0x5FB6, 0x5FB8, + 0x5FB9, 0x5FBA, 0x5FBB, 0x5FBE, 0x5FBF, 0x5FC0, 0x5FC1, 0x5FC2, + 0x5FC7, 0x5FC8, 0x5FCA, 0x5FCB, 0x5FCE, 0x5FD3, 0x5FD4, 0x5FD5, + 0x5FDA, 0x5FDB, 0x5FDC, 0x5FDE, 0x5FDF, 0x5FE2, 0x5FE3, 0x5FE5, + 0x5FE6, 0x5FE8, 0x5FE9, 0x5FEC, 0x5FEF, 0x5FF0, 0x5FF2, 0x5FF3, + 0x5FF4, 0x5FF6, 0x5FF7, 0x5FF9, 0x5FFA, 0x5FFC, 0x6007, ALTCHR, +/* 0x9040 - 0x90FF */ + 0x6008, 0x6009, 0x600B, 0x600C, 0x6010, 0x6011, 0x6013, 0x6017, + 0x6018, 0x601A, 0x601E, 0x601F, 0x6022, 0x6023, 0x6024, 0x602C, + 0x602D, 0x602E, 0x6030, 0x6031, 0x6032, 0x6033, 0x6034, 0x6036, + 0x6037, 0x6038, 0x6039, 0x603A, 0x603D, 0x603E, 0x6040, 0x6044, + 0x6045, 0x6046, 0x6047, 0x6048, 0x6049, 0x604A, 0x604C, 0x604E, + 0x604F, 0x6051, 0x6053, 0x6054, 0x6056, 0x6057, 0x6058, 0x605B, + 0x605C, 0x605E, 0x605F, 0x6060, 0x6061, 0x6065, 0x6066, 0x606E, + 0x6071, 0x6072, 0x6074, 0x6075, 0x6077, 0x607E, 0x6080, ALTCHR, + 0x6081, 0x6082, 0x6085, 0x6086, 0x6087, 0x6088, 0x608A, 0x608B, + 0x608E, 0x608F, 0x6090, 0x6091, 0x6093, 0x6095, 0x6097, 0x6098, + 0x6099, 0x609C, 0x609E, 0x60A1, 0x60A2, 0x60A4, 0x60A5, 0x60A7, + 0x60A9, 0x60AA, 0x60AE, 0x60B0, 0x60B3, 0x60B5, 0x60B6, 0x60B7, + 0x60B9, 0x60BA, 0x60BD, 0x60BE, 0x60BF, 0x60C0, 0x60C1, 0x60C2, + 0x60C3, 0x60C4, 0x60C7, 0x60C8, 0x60C9, 0x60CC, 0x60CD, 0x60CE, + 0x60CF, 0x60D0, 0x60D2, 0x60D3, 0x60D4, 0x60D6, 0x60D7, 0x60D9, + 0x60DB, 0x60DE, 0x60E1, 0x60E2, 0x60E3, 0x60E4, 0x60E5, 0x60EA, + 0x60F1, 0x60F2, 0x60F5, 0x60F7, 0x60F8, 0x60FB, 0x60FC, 0x60FD, + 0x60FE, 0x60FF, 0x6102, 0x6103, 0x6104, 0x6105, 0x6107, 0x610A, + 0x610B, 0x610C, 0x6110, 0x6111, 0x6112, 0x6113, 0x6114, 0x6116, + 0x6117, 0x6118, 0x6119, 0x611B, 0x611C, 0x611D, 0x611E, 0x6121, + 0x6122, 0x6125, 0x6128, 0x6129, 0x612A, 0x612C, 0x612D, 0x612E, + 0x612F, 0x6130, 0x6131, 0x6132, 0x6133, 0x6134, 0x6135, 0x6136, + 0x6137, 0x6138, 0x6139, 0x613A, 0x613B, 0x613C, 0x613D, 0x613E, + 0x6140, 0x6141, 0x6142, 0x6143, 0x6144, 0x6145, 0x6146, ALTCHR, +/* 0x9140 - 0x91FF */ + 0x6147, 0x6149, 0x614B, 0x614D, 0x614F, 0x6150, 0x6152, 0x6153, + 0x6154, 0x6156, 0x6157, 0x6158, 0x6159, 0x615A, 0x615B, 0x615C, + 0x615E, 0x615F, 0x6160, 0x6161, 0x6163, 0x6164, 0x6165, 0x6166, + 0x6169, 0x616A, 0x616B, 0x616C, 0x616D, 0x616E, 0x616F, 0x6171, + 0x6172, 0x6173, 0x6174, 0x6176, 0x6178, 0x6179, 0x617A, 0x617B, + 0x617C, 0x617D, 0x617E, 0x617F, 0x6180, 0x6181, 0x6182, 0x6183, + 0x6184, 0x6185, 0x6186, 0x6187, 0x6188, 0x6189, 0x618A, 0x618C, + 0x618D, 0x618F, 0x6190, 0x6191, 0x6192, 0x6193, 0x6195, ALTCHR, + 0x6196, 0x6197, 0x6198, 0x6199, 0x619A, 0x619B, 0x619C, 0x619E, + 0x619F, 0x61A0, 0x61A1, 0x61A2, 0x61A3, 0x61A4, 0x61A5, 0x61A6, + 0x61AA, 0x61AB, 0x61AD, 0x61AE, 0x61AF, 0x61B0, 0x61B1, 0x61B2, + 0x61B3, 0x61B4, 0x61B5, 0x61B6, 0x61B8, 0x61B9, 0x61BA, 0x61BB, + 0x61BC, 0x61BD, 0x61BF, 0x61C0, 0x61C1, 0x61C3, 0x61C4, 0x61C5, + 0x61C6, 0x61C7, 0x61C9, 0x61CC, 0x61CD, 0x61CE, 0x61CF, 0x61D0, + 0x61D3, 0x61D5, 0x61D6, 0x61D7, 0x61D8, 0x61D9, 0x61DA, 0x61DB, + 0x61DC, 0x61DD, 0x61DE, 0x61DF, 0x61E0, 0x61E1, 0x61E2, 0x61E3, + 0x61E4, 0x61E5, 0x61E7, 0x61E8, 0x61E9, 0x61EA, 0x61EB, 0x61EC, + 0x61ED, 0x61EE, 0x61EF, 0x61F0, 0x61F1, 0x61F2, 0x61F3, 0x61F4, + 0x61F6, 0x61F7, 0x61F8, 0x61F9, 0x61FA, 0x61FB, 0x61FC, 0x61FD, + 0x61FE, 0x6200, 0x6201, 0x6202, 0x6203, 0x6204, 0x6205, 0x6207, + 0x6209, 0x6213, 0x6214, 0x6219, 0x621C, 0x621D, 0x621E, 0x6220, + 0x6223, 0x6226, 0x6227, 0x6228, 0x6229, 0x622B, 0x622D, 0x622F, + 0x6230, 0x6231, 0x6232, 0x6235, 0x6236, 0x6238, 0x6239, 0x623A, + 0x623B, 0x623C, 0x6242, 0x6244, 0x6245, 0x6246, 0x624A, ALTCHR, +/* 0x9240 - 0x92FF */ + 0x624F, 0x6250, 0x6255, 0x6256, 0x6257, 0x6259, 0x625A, 0x625C, + 0x625D, 0x625E, 0x625F, 0x6260, 0x6261, 0x6262, 0x6264, 0x6265, + 0x6268, 0x6271, 0x6272, 0x6274, 0x6275, 0x6277, 0x6278, 0x627A, + 0x627B, 0x627D, 0x6281, 0x6282, 0x6283, 0x6285, 0x6286, 0x6287, + 0x6288, 0x628B, 0x628C, 0x628D, 0x628E, 0x628F, 0x6290, 0x6294, + 0x6299, 0x629C, 0x629D, 0x629E, 0x62A3, 0x62A6, 0x62A7, 0x62A9, + 0x62AA, 0x62AD, 0x62AE, 0x62AF, 0x62B0, 0x62B2, 0x62B3, 0x62B4, + 0x62B6, 0x62B7, 0x62B8, 0x62BA, 0x62BE, 0x62C0, 0x62C1, ALTCHR, + 0x62C3, 0x62CB, 0x62CF, 0x62D1, 0x62D5, 0x62DD, 0x62DE, 0x62E0, + 0x62E1, 0x62E4, 0x62EA, 0x62EB, 0x62F0, 0x62F2, 0x62F5, 0x62F8, + 0x62F9, 0x62FA, 0x62FB, 0x6300, 0x6303, 0x6304, 0x6305, 0x6306, + 0x630A, 0x630B, 0x630C, 0x630D, 0x630F, 0x6310, 0x6312, 0x6313, + 0x6314, 0x6315, 0x6317, 0x6318, 0x6319, 0x631C, 0x6326, 0x6327, + 0x6329, 0x632C, 0x632D, 0x632E, 0x6330, 0x6331, 0x6333, 0x6334, + 0x6335, 0x6336, 0x6337, 0x6338, 0x633B, 0x633C, 0x633E, 0x633F, + 0x6340, 0x6341, 0x6344, 0x6347, 0x6348, 0x634A, 0x6351, 0x6352, + 0x6353, 0x6354, 0x6356, 0x6357, 0x6358, 0x6359, 0x635A, 0x635B, + 0x635C, 0x635D, 0x6360, 0x6364, 0x6365, 0x6366, 0x6368, 0x636A, + 0x636B, 0x636C, 0x636F, 0x6370, 0x6372, 0x6373, 0x6374, 0x6375, + 0x6378, 0x6379, 0x637C, 0x637D, 0x637E, 0x637F, 0x6381, 0x6383, + 0x6384, 0x6385, 0x6386, 0x638B, 0x638D, 0x6391, 0x6393, 0x6394, + 0x6395, 0x6397, 0x6399, 0x639A, 0x639B, 0x639C, 0x639D, 0x639E, + 0x639F, 0x63A1, 0x63A4, 0x63A6, 0x63AB, 0x63AF, 0x63B1, 0x63B2, + 0x63B5, 0x63B6, 0x63B9, 0x63BB, 0x63BD, 0x63BF, 0x63C0, ALTCHR, +/* 0x9340 - 0x93FF */ + 0x63C1, 0x63C2, 0x63C3, 0x63C5, 0x63C7, 0x63C8, 0x63CA, 0x63CB, + 0x63CC, 0x63D1, 0x63D3, 0x63D4, 0x63D5, 0x63D7, 0x63D8, 0x63D9, + 0x63DA, 0x63DB, 0x63DC, 0x63DD, 0x63DF, 0x63E2, 0x63E4, 0x63E5, + 0x63E6, 0x63E7, 0x63E8, 0x63EB, 0x63EC, 0x63EE, 0x63EF, 0x63F0, + 0x63F1, 0x63F3, 0x63F5, 0x63F7, 0x63F9, 0x63FA, 0x63FB, 0x63FC, + 0x63FE, 0x6403, 0x6404, 0x6406, 0x6407, 0x6408, 0x6409, 0x640A, + 0x640D, 0x640E, 0x6411, 0x6412, 0x6415, 0x6416, 0x6417, 0x6418, + 0x6419, 0x641A, 0x641D, 0x641F, 0x6422, 0x6423, 0x6424, ALTCHR, + 0x6425, 0x6427, 0x6428, 0x6429, 0x642B, 0x642E, 0x642F, 0x6430, + 0x6431, 0x6432, 0x6433, 0x6435, 0x6436, 0x6437, 0x6438, 0x6439, + 0x643B, 0x643C, 0x643E, 0x6440, 0x6442, 0x6443, 0x6449, 0x644B, + 0x644C, 0x644D, 0x644E, 0x644F, 0x6450, 0x6451, 0x6453, 0x6455, + 0x6456, 0x6457, 0x6459, 0x645A, 0x645B, 0x645C, 0x645D, 0x645F, + 0x6460, 0x6461, 0x6462, 0x6463, 0x6464, 0x6465, 0x6466, 0x6468, + 0x646A, 0x646B, 0x646C, 0x646E, 0x646F, 0x6470, 0x6471, 0x6472, + 0x6473, 0x6474, 0x6475, 0x6476, 0x6477, 0x647B, 0x647C, 0x647D, + 0x647E, 0x647F, 0x6480, 0x6481, 0x6483, 0x6486, 0x6488, 0x6489, + 0x648A, 0x648B, 0x648C, 0x648D, 0x648E, 0x648F, 0x6490, 0x6493, + 0x6494, 0x6497, 0x6498, 0x649A, 0x649B, 0x649C, 0x649D, 0x649F, + 0x64A0, 0x64A1, 0x64A2, 0x64A3, 0x64A5, 0x64A6, 0x64A7, 0x64A8, + 0x64AA, 0x64AB, 0x64AF, 0x64B1, 0x64B2, 0x64B3, 0x64B4, 0x64B6, + 0x64B9, 0x64BB, 0x64BD, 0x64BE, 0x64BF, 0x64C1, 0x64C3, 0x64C4, + 0x64C6, 0x64C7, 0x64C8, 0x64C9, 0x64CA, 0x64CB, 0x64CC, 0x64CF, + 0x64D1, 0x64D3, 0x64D4, 0x64D5, 0x64D6, 0x64D9, 0x64DA, ALTCHR, +/* 0x9440 - 0x94FF */ + 0x64DB, 0x64DC, 0x64DD, 0x64DF, 0x64E0, 0x64E1, 0x64E3, 0x64E5, + 0x64E7, 0x64E8, 0x64E9, 0x64EA, 0x64EB, 0x64EC, 0x64ED, 0x64EE, + 0x64EF, 0x64F0, 0x64F1, 0x64F2, 0x64F3, 0x64F4, 0x64F5, 0x64F6, + 0x64F7, 0x64F8, 0x64F9, 0x64FA, 0x64FB, 0x64FC, 0x64FD, 0x64FE, + 0x64FF, 0x6501, 0x6502, 0x6503, 0x6504, 0x6505, 0x6506, 0x6507, + 0x6508, 0x650A, 0x650B, 0x650C, 0x650D, 0x650E, 0x650F, 0x6510, + 0x6511, 0x6513, 0x6514, 0x6515, 0x6516, 0x6517, 0x6519, 0x651A, + 0x651B, 0x651C, 0x651D, 0x651E, 0x651F, 0x6520, 0x6521, ALTCHR, + 0x6522, 0x6523, 0x6524, 0x6526, 0x6527, 0x6528, 0x6529, 0x652A, + 0x652C, 0x652D, 0x6530, 0x6531, 0x6532, 0x6533, 0x6537, 0x653A, + 0x653C, 0x653D, 0x6540, 0x6541, 0x6542, 0x6543, 0x6544, 0x6546, + 0x6547, 0x654A, 0x654B, 0x654D, 0x654E, 0x6550, 0x6552, 0x6553, + 0x6554, 0x6557, 0x6558, 0x655A, 0x655C, 0x655F, 0x6560, 0x6561, + 0x6564, 0x6565, 0x6567, 0x6568, 0x6569, 0x656A, 0x656D, 0x656E, + 0x656F, 0x6571, 0x6573, 0x6575, 0x6576, 0x6578, 0x6579, 0x657A, + 0x657B, 0x657C, 0x657D, 0x657E, 0x657F, 0x6580, 0x6581, 0x6582, + 0x6583, 0x6584, 0x6585, 0x6586, 0x6588, 0x6589, 0x658A, 0x658D, + 0x658E, 0x658F, 0x6592, 0x6594, 0x6595, 0x6596, 0x6598, 0x659A, + 0x659D, 0x659E, 0x65A0, 0x65A2, 0x65A3, 0x65A6, 0x65A8, 0x65AA, + 0x65AC, 0x65AE, 0x65B1, 0x65B2, 0x65B3, 0x65B4, 0x65B5, 0x65B6, + 0x65B7, 0x65B8, 0x65BA, 0x65BB, 0x65BE, 0x65BF, 0x65C0, 0x65C2, + 0x65C7, 0x65C8, 0x65C9, 0x65CA, 0x65CD, 0x65D0, 0x65D1, 0x65D3, + 0x65D4, 0x65D5, 0x65D8, 0x65D9, 0x65DA, 0x65DB, 0x65DC, 0x65DD, + 0x65DE, 0x65DF, 0x65E1, 0x65E3, 0x65E4, 0x65EA, 0x65EB, ALTCHR, +/* 0x9540 - 0x95FF */ + 0x65F2, 0x65F3, 0x65F4, 0x65F5, 0x65F8, 0x65F9, 0x65FB, 0x65FC, + 0x65FD, 0x65FE, 0x65FF, 0x6601, 0x6604, 0x6605, 0x6607, 0x6608, + 0x6609, 0x660B, 0x660D, 0x6610, 0x6611, 0x6612, 0x6616, 0x6617, + 0x6618, 0x661A, 0x661B, 0x661C, 0x661E, 0x6621, 0x6622, 0x6623, + 0x6624, 0x6626, 0x6629, 0x662A, 0x662B, 0x662C, 0x662E, 0x6630, + 0x6632, 0x6633, 0x6637, 0x6638, 0x6639, 0x663A, 0x663B, 0x663D, + 0x663F, 0x6640, 0x6642, 0x6644, 0x6645, 0x6646, 0x6647, 0x6648, + 0x6649, 0x664A, 0x664D, 0x664E, 0x6650, 0x6651, 0x6658, ALTCHR, + 0x6659, 0x665B, 0x665C, 0x665D, 0x665E, 0x6660, 0x6662, 0x6663, + 0x6665, 0x6667, 0x6669, 0x666A, 0x666B, 0x666C, 0x666D, 0x6671, + 0x6672, 0x6673, 0x6675, 0x6678, 0x6679, 0x667B, 0x667C, 0x667D, + 0x667F, 0x6680, 0x6681, 0x6683, 0x6685, 0x6686, 0x6688, 0x6689, + 0x668A, 0x668B, 0x668D, 0x668E, 0x668F, 0x6690, 0x6692, 0x6693, + 0x6694, 0x6695, 0x6698, 0x6699, 0x669A, 0x669B, 0x669C, 0x669E, + 0x669F, 0x66A0, 0x66A1, 0x66A2, 0x66A3, 0x66A4, 0x66A5, 0x66A6, + 0x66A9, 0x66AA, 0x66AB, 0x66AC, 0x66AD, 0x66AF, 0x66B0, 0x66B1, + 0x66B2, 0x66B3, 0x66B5, 0x66B6, 0x66B7, 0x66B8, 0x66BA, 0x66BB, + 0x66BC, 0x66BD, 0x66BF, 0x66C0, 0x66C1, 0x66C2, 0x66C3, 0x66C4, + 0x66C5, 0x66C6, 0x66C7, 0x66C8, 0x66C9, 0x66CA, 0x66CB, 0x66CC, + 0x66CD, 0x66CE, 0x66CF, 0x66D0, 0x66D1, 0x66D2, 0x66D3, 0x66D4, + 0x66D5, 0x66D6, 0x66D7, 0x66D8, 0x66DA, 0x66DE, 0x66DF, 0x66E0, + 0x66E1, 0x66E2, 0x66E3, 0x66E4, 0x66E5, 0x66E7, 0x66E8, 0x66EA, + 0x66EB, 0x66EC, 0x66ED, 0x66EE, 0x66EF, 0x66F1, 0x66F5, 0x66F6, + 0x66F8, 0x66FA, 0x66FB, 0x66FD, 0x6701, 0x6702, 0x6703, ALTCHR, +/* 0x9640 - 0x96FF */ + 0x6704, 0x6705, 0x6706, 0x6707, 0x670C, 0x670E, 0x670F, 0x6711, + 0x6712, 0x6713, 0x6716, 0x6718, 0x6719, 0x671A, 0x671C, 0x671E, + 0x6720, 0x6721, 0x6722, 0x6723, 0x6724, 0x6725, 0x6727, 0x6729, + 0x672E, 0x6730, 0x6732, 0x6733, 0x6736, 0x6737, 0x6738, 0x6739, + 0x673B, 0x673C, 0x673E, 0x673F, 0x6741, 0x6744, 0x6745, 0x6747, + 0x674A, 0x674B, 0x674D, 0x6752, 0x6754, 0x6755, 0x6757, 0x6758, + 0x6759, 0x675A, 0x675B, 0x675D, 0x6762, 0x6763, 0x6764, 0x6766, + 0x6767, 0x676B, 0x676C, 0x676E, 0x6771, 0x6774, 0x6776, ALTCHR, + 0x6778, 0x6779, 0x677A, 0x677B, 0x677D, 0x6780, 0x6782, 0x6783, + 0x6785, 0x6786, 0x6788, 0x678A, 0x678C, 0x678D, 0x678E, 0x678F, + 0x6791, 0x6792, 0x6793, 0x6794, 0x6796, 0x6799, 0x679B, 0x679F, + 0x67A0, 0x67A1, 0x67A4, 0x67A6, 0x67A9, 0x67AC, 0x67AE, 0x67B1, + 0x67B2, 0x67B4, 0x67B9, 0x67BA, 0x67BB, 0x67BC, 0x67BD, 0x67BE, + 0x67BF, 0x67C0, 0x67C2, 0x67C5, 0x67C6, 0x67C7, 0x67C8, 0x67C9, + 0x67CA, 0x67CB, 0x67CC, 0x67CD, 0x67CE, 0x67D5, 0x67D6, 0x67D7, + 0x67DB, 0x67DF, 0x67E1, 0x67E3, 0x67E4, 0x67E6, 0x67E7, 0x67E8, + 0x67EA, 0x67EB, 0x67ED, 0x67EE, 0x67F2, 0x67F5, 0x67F6, 0x67F7, + 0x67F8, 0x67F9, 0x67FA, 0x67FB, 0x67FC, 0x67FE, 0x6801, 0x6802, + 0x6803, 0x6804, 0x6806, 0x680D, 0x6810, 0x6812, 0x6814, 0x6815, + 0x6818, 0x6819, 0x681A, 0x681B, 0x681C, 0x681E, 0x681F, 0x6820, + 0x6822, 0x6823, 0x6824, 0x6825, 0x6826, 0x6827, 0x6828, 0x682B, + 0x682C, 0x682D, 0x682E, 0x682F, 0x6830, 0x6831, 0x6834, 0x6835, + 0x6836, 0x683A, 0x683B, 0x683F, 0x6847, 0x684B, 0x684D, 0x684F, + 0x6852, 0x6856, 0x6857, 0x6858, 0x6859, 0x685A, 0x685B, ALTCHR, +/* 0x9740 - 0x97FF */ + 0x685C, 0x685D, 0x685E, 0x685F, 0x686A, 0x686C, 0x686D, 0x686E, + 0x686F, 0x6870, 0x6871, 0x6872, 0x6873, 0x6875, 0x6878, 0x6879, + 0x687A, 0x687B, 0x687C, 0x687D, 0x687E, 0x687F, 0x6880, 0x6882, + 0x6884, 0x6887, 0x6888, 0x6889, 0x688A, 0x688B, 0x688C, 0x688D, + 0x688E, 0x6890, 0x6891, 0x6892, 0x6894, 0x6895, 0x6896, 0x6898, + 0x6899, 0x689A, 0x689B, 0x689C, 0x689D, 0x689E, 0x689F, 0x68A0, + 0x68A1, 0x68A3, 0x68A4, 0x68A5, 0x68A9, 0x68AA, 0x68AB, 0x68AC, + 0x68AE, 0x68B1, 0x68B2, 0x68B4, 0x68B6, 0x68B7, 0x68B8, ALTCHR, + 0x68B9, 0x68BA, 0x68BB, 0x68BC, 0x68BD, 0x68BE, 0x68BF, 0x68C1, + 0x68C3, 0x68C4, 0x68C5, 0x68C6, 0x68C7, 0x68C8, 0x68CA, 0x68CC, + 0x68CE, 0x68CF, 0x68D0, 0x68D1, 0x68D3, 0x68D4, 0x68D6, 0x68D7, + 0x68D9, 0x68DB, 0x68DC, 0x68DD, 0x68DE, 0x68DF, 0x68E1, 0x68E2, + 0x68E4, 0x68E5, 0x68E6, 0x68E7, 0x68E8, 0x68E9, 0x68EA, 0x68EB, + 0x68EC, 0x68ED, 0x68EF, 0x68F2, 0x68F3, 0x68F4, 0x68F6, 0x68F7, + 0x68F8, 0x68FB, 0x68FD, 0x68FE, 0x68FF, 0x6900, 0x6902, 0x6903, + 0x6904, 0x6906, 0x6907, 0x6908, 0x6909, 0x690A, 0x690C, 0x690F, + 0x6911, 0x6913, 0x6914, 0x6915, 0x6916, 0x6917, 0x6918, 0x6919, + 0x691A, 0x691B, 0x691C, 0x691D, 0x691E, 0x6921, 0x6922, 0x6923, + 0x6925, 0x6926, 0x6927, 0x6928, 0x6929, 0x692A, 0x692B, 0x692C, + 0x692E, 0x692F, 0x6931, 0x6932, 0x6933, 0x6935, 0x6936, 0x6937, + 0x6938, 0x693A, 0x693B, 0x693C, 0x693E, 0x6940, 0x6941, 0x6943, + 0x6944, 0x6945, 0x6946, 0x6947, 0x6948, 0x6949, 0x694A, 0x694B, + 0x694C, 0x694D, 0x694E, 0x694F, 0x6950, 0x6951, 0x6952, 0x6953, + 0x6955, 0x6956, 0x6958, 0x6959, 0x695B, 0x695C, 0x695F, ALTCHR, +/* 0x9840 - 0x98FF */ + 0x6961, 0x6962, 0x6964, 0x6965, 0x6967, 0x6968, 0x6969, 0x696A, + 0x696C, 0x696D, 0x696F, 0x6970, 0x6972, 0x6973, 0x6974, 0x6975, + 0x6976, 0x697A, 0x697B, 0x697D, 0x697E, 0x697F, 0x6981, 0x6983, + 0x6985, 0x698A, 0x698B, 0x698C, 0x698E, 0x698F, 0x6990, 0x6991, + 0x6992, 0x6993, 0x6996, 0x6997, 0x6999, 0x699A, 0x699D, 0x699E, + 0x699F, 0x69A0, 0x69A1, 0x69A2, 0x69A3, 0x69A4, 0x69A5, 0x69A6, + 0x69A9, 0x69AA, 0x69AC, 0x69AE, 0x69AF, 0x69B0, 0x69B2, 0x69B3, + 0x69B5, 0x69B6, 0x69B8, 0x69B9, 0x69BA, 0x69BC, 0x69BD, ALTCHR, + 0x69BE, 0x69BF, 0x69C0, 0x69C2, 0x69C3, 0x69C4, 0x69C5, 0x69C6, + 0x69C7, 0x69C8, 0x69C9, 0x69CB, 0x69CD, 0x69CF, 0x69D1, 0x69D2, + 0x69D3, 0x69D5, 0x69D6, 0x69D7, 0x69D8, 0x69D9, 0x69DA, 0x69DC, + 0x69DD, 0x69DE, 0x69E1, 0x69E2, 0x69E3, 0x69E4, 0x69E5, 0x69E6, + 0x69E7, 0x69E8, 0x69E9, 0x69EA, 0x69EB, 0x69EC, 0x69EE, 0x69EF, + 0x69F0, 0x69F1, 0x69F3, 0x69F4, 0x69F5, 0x69F6, 0x69F7, 0x69F8, + 0x69F9, 0x69FA, 0x69FB, 0x69FC, 0x69FE, 0x6A00, 0x6A01, 0x6A02, + 0x6A03, 0x6A04, 0x6A05, 0x6A06, 0x6A07, 0x6A08, 0x6A09, 0x6A0B, + 0x6A0C, 0x6A0D, 0x6A0E, 0x6A0F, 0x6A10, 0x6A11, 0x6A12, 0x6A13, + 0x6A14, 0x6A15, 0x6A16, 0x6A19, 0x6A1A, 0x6A1B, 0x6A1C, 0x6A1D, + 0x6A1E, 0x6A20, 0x6A22, 0x6A23, 0x6A24, 0x6A25, 0x6A26, 0x6A27, + 0x6A29, 0x6A2B, 0x6A2C, 0x6A2D, 0x6A2E, 0x6A30, 0x6A32, 0x6A33, + 0x6A34, 0x6A36, 0x6A37, 0x6A38, 0x6A39, 0x6A3A, 0x6A3B, 0x6A3C, + 0x6A3F, 0x6A40, 0x6A41, 0x6A42, 0x6A43, 0x6A45, 0x6A46, 0x6A48, + 0x6A49, 0x6A4A, 0x6A4B, 0x6A4C, 0x6A4D, 0x6A4E, 0x6A4F, 0x6A51, + 0x6A52, 0x6A53, 0x6A54, 0x6A55, 0x6A56, 0x6A57, 0x6A5A, ALTCHR, +/* 0x9940 - 0x99FF */ + 0x6A5C, 0x6A5D, 0x6A5E, 0x6A5F, 0x6A60, 0x6A62, 0x6A63, 0x6A64, + 0x6A66, 0x6A67, 0x6A68, 0x6A69, 0x6A6A, 0x6A6B, 0x6A6C, 0x6A6D, + 0x6A6E, 0x6A6F, 0x6A70, 0x6A72, 0x6A73, 0x6A74, 0x6A75, 0x6A76, + 0x6A77, 0x6A78, 0x6A7A, 0x6A7B, 0x6A7D, 0x6A7E, 0x6A7F, 0x6A81, + 0x6A82, 0x6A83, 0x6A85, 0x6A86, 0x6A87, 0x6A88, 0x6A89, 0x6A8A, + 0x6A8B, 0x6A8C, 0x6A8D, 0x6A8F, 0x6A92, 0x6A93, 0x6A94, 0x6A95, + 0x6A96, 0x6A98, 0x6A99, 0x6A9A, 0x6A9B, 0x6A9C, 0x6A9D, 0x6A9E, + 0x6A9F, 0x6AA1, 0x6AA2, 0x6AA3, 0x6AA4, 0x6AA5, 0x6AA6, ALTCHR, + 0x6AA7, 0x6AA8, 0x6AAA, 0x6AAD, 0x6AAE, 0x6AAF, 0x6AB0, 0x6AB1, + 0x6AB2, 0x6AB3, 0x6AB4, 0x6AB5, 0x6AB6, 0x6AB7, 0x6AB8, 0x6AB9, + 0x6ABA, 0x6ABB, 0x6ABC, 0x6ABD, 0x6ABE, 0x6ABF, 0x6AC0, 0x6AC1, + 0x6AC2, 0x6AC3, 0x6AC4, 0x6AC5, 0x6AC6, 0x6AC7, 0x6AC8, 0x6AC9, + 0x6ACA, 0x6ACB, 0x6ACC, 0x6ACD, 0x6ACE, 0x6ACF, 0x6AD0, 0x6AD1, + 0x6AD2, 0x6AD3, 0x6AD4, 0x6AD5, 0x6AD6, 0x6AD7, 0x6AD8, 0x6AD9, + 0x6ADA, 0x6ADB, 0x6ADC, 0x6ADD, 0x6ADE, 0x6ADF, 0x6AE0, 0x6AE1, + 0x6AE2, 0x6AE3, 0x6AE4, 0x6AE5, 0x6AE6, 0x6AE7, 0x6AE8, 0x6AE9, + 0x6AEA, 0x6AEB, 0x6AEC, 0x6AED, 0x6AEE, 0x6AEF, 0x6AF0, 0x6AF1, + 0x6AF2, 0x6AF3, 0x6AF4, 0x6AF5, 0x6AF6, 0x6AF7, 0x6AF8, 0x6AF9, + 0x6AFA, 0x6AFB, 0x6AFC, 0x6AFD, 0x6AFE, 0x6AFF, 0x6B00, 0x6B01, + 0x6B02, 0x6B03, 0x6B04, 0x6B05, 0x6B06, 0x6B07, 0x6B08, 0x6B09, + 0x6B0A, 0x6B0B, 0x6B0C, 0x6B0D, 0x6B0E, 0x6B0F, 0x6B10, 0x6B11, + 0x6B12, 0x6B13, 0x6B14, 0x6B15, 0x6B16, 0x6B17, 0x6B18, 0x6B19, + 0x6B1A, 0x6B1B, 0x6B1C, 0x6B1D, 0x6B1E, 0x6B1F, 0x6B25, 0x6B26, + 0x6B28, 0x6B29, 0x6B2A, 0x6B2B, 0x6B2C, 0x6B2D, 0x6B2E, ALTCHR, +/* 0x9A40 - 0x9AFF */ + 0x6B2F, 0x6B30, 0x6B31, 0x6B33, 0x6B34, 0x6B35, 0x6B36, 0x6B38, + 0x6B3B, 0x6B3C, 0x6B3D, 0x6B3F, 0x6B40, 0x6B41, 0x6B42, 0x6B44, + 0x6B45, 0x6B48, 0x6B4A, 0x6B4B, 0x6B4D, 0x6B4E, 0x6B4F, 0x6B50, + 0x6B51, 0x6B52, 0x6B53, 0x6B54, 0x6B55, 0x6B56, 0x6B57, 0x6B58, + 0x6B5A, 0x6B5B, 0x6B5C, 0x6B5D, 0x6B5E, 0x6B5F, 0x6B60, 0x6B61, + 0x6B68, 0x6B69, 0x6B6B, 0x6B6C, 0x6B6D, 0x6B6E, 0x6B6F, 0x6B70, + 0x6B71, 0x6B72, 0x6B73, 0x6B74, 0x6B75, 0x6B76, 0x6B77, 0x6B78, + 0x6B7A, 0x6B7D, 0x6B7E, 0x6B7F, 0x6B80, 0x6B85, 0x6B88, ALTCHR, + 0x6B8C, 0x6B8E, 0x6B8F, 0x6B90, 0x6B91, 0x6B94, 0x6B95, 0x6B97, + 0x6B98, 0x6B99, 0x6B9C, 0x6B9D, 0x6B9E, 0x6B9F, 0x6BA0, 0x6BA2, + 0x6BA3, 0x6BA4, 0x6BA5, 0x6BA6, 0x6BA7, 0x6BA8, 0x6BA9, 0x6BAB, + 0x6BAC, 0x6BAD, 0x6BAE, 0x6BAF, 0x6BB0, 0x6BB1, 0x6BB2, 0x6BB6, + 0x6BB8, 0x6BB9, 0x6BBA, 0x6BBB, 0x6BBC, 0x6BBD, 0x6BBE, 0x6BC0, + 0x6BC3, 0x6BC4, 0x6BC6, 0x6BC7, 0x6BC8, 0x6BC9, 0x6BCA, 0x6BCC, + 0x6BCE, 0x6BD0, 0x6BD1, 0x6BD8, 0x6BDA, 0x6BDC, 0x6BDD, 0x6BDE, + 0x6BDF, 0x6BE0, 0x6BE2, 0x6BE3, 0x6BE4, 0x6BE5, 0x6BE6, 0x6BE7, + 0x6BE8, 0x6BE9, 0x6BEC, 0x6BED, 0x6BEE, 0x6BF0, 0x6BF1, 0x6BF2, + 0x6BF4, 0x6BF6, 0x6BF7, 0x6BF8, 0x6BFA, 0x6BFB, 0x6BFC, 0x6BFE, + 0x6BFF, 0x6C00, 0x6C01, 0x6C02, 0x6C03, 0x6C04, 0x6C08, 0x6C09, + 0x6C0A, 0x6C0B, 0x6C0C, 0x6C0E, 0x6C12, 0x6C17, 0x6C1C, 0x6C1D, + 0x6C1E, 0x6C20, 0x6C23, 0x6C25, 0x6C2B, 0x6C2C, 0x6C2D, 0x6C31, + 0x6C33, 0x6C36, 0x6C37, 0x6C39, 0x6C3A, 0x6C3B, 0x6C3C, 0x6C3E, + 0x6C3F, 0x6C43, 0x6C44, 0x6C45, 0x6C48, 0x6C4B, 0x6C4C, 0x6C4D, + 0x6C4E, 0x6C4F, 0x6C51, 0x6C52, 0x6C53, 0x6C56, 0x6C58, ALTCHR, +/* 0x9B40 - 0x9BFF */ + 0x6C59, 0x6C5A, 0x6C62, 0x6C63, 0x6C65, 0x6C66, 0x6C67, 0x6C6B, + 0x6C6C, 0x6C6D, 0x6C6E, 0x6C6F, 0x6C71, 0x6C73, 0x6C75, 0x6C77, + 0x6C78, 0x6C7A, 0x6C7B, 0x6C7C, 0x6C7F, 0x6C80, 0x6C84, 0x6C87, + 0x6C8A, 0x6C8B, 0x6C8D, 0x6C8E, 0x6C91, 0x6C92, 0x6C95, 0x6C96, + 0x6C97, 0x6C98, 0x6C9A, 0x6C9C, 0x6C9D, 0x6C9E, 0x6CA0, 0x6CA2, + 0x6CA8, 0x6CAC, 0x6CAF, 0x6CB0, 0x6CB4, 0x6CB5, 0x6CB6, 0x6CB7, + 0x6CBA, 0x6CC0, 0x6CC1, 0x6CC2, 0x6CC3, 0x6CC6, 0x6CC7, 0x6CC8, + 0x6CCB, 0x6CCD, 0x6CCE, 0x6CCF, 0x6CD1, 0x6CD2, 0x6CD8, ALTCHR, + 0x6CD9, 0x6CDA, 0x6CDC, 0x6CDD, 0x6CDF, 0x6CE4, 0x6CE6, 0x6CE7, + 0x6CE9, 0x6CEC, 0x6CED, 0x6CF2, 0x6CF4, 0x6CF9, 0x6CFF, 0x6D00, + 0x6D02, 0x6D03, 0x6D05, 0x6D06, 0x6D08, 0x6D09, 0x6D0A, 0x6D0D, + 0x6D0F, 0x6D10, 0x6D11, 0x6D13, 0x6D14, 0x6D15, 0x6D16, 0x6D18, + 0x6D1C, 0x6D1D, 0x6D1F, 0x6D20, 0x6D21, 0x6D22, 0x6D23, 0x6D24, + 0x6D26, 0x6D28, 0x6D29, 0x6D2C, 0x6D2D, 0x6D2F, 0x6D30, 0x6D34, + 0x6D36, 0x6D37, 0x6D38, 0x6D3A, 0x6D3F, 0x6D40, 0x6D42, 0x6D44, + 0x6D49, 0x6D4C, 0x6D50, 0x6D55, 0x6D56, 0x6D57, 0x6D58, 0x6D5B, + 0x6D5D, 0x6D5F, 0x6D61, 0x6D62, 0x6D64, 0x6D65, 0x6D67, 0x6D68, + 0x6D6B, 0x6D6C, 0x6D6D, 0x6D70, 0x6D71, 0x6D72, 0x6D73, 0x6D75, + 0x6D76, 0x6D79, 0x6D7A, 0x6D7B, 0x6D7D, 0x6D7E, 0x6D7F, 0x6D80, + 0x6D81, 0x6D83, 0x6D84, 0x6D86, 0x6D87, 0x6D8A, 0x6D8B, 0x6D8D, + 0x6D8F, 0x6D90, 0x6D92, 0x6D96, 0x6D97, 0x6D98, 0x6D99, 0x6D9A, + 0x6D9C, 0x6DA2, 0x6DA5, 0x6DAC, 0x6DAD, 0x6DB0, 0x6DB1, 0x6DB3, + 0x6DB4, 0x6DB6, 0x6DB7, 0x6DB9, 0x6DBA, 0x6DBB, 0x6DBC, 0x6DBD, + 0x6DBE, 0x6DC1, 0x6DC2, 0x6DC3, 0x6DC8, 0x6DC9, 0x6DCA, ALTCHR, +/* 0x9C40 - 0x9CFF */ + 0x6DCD, 0x6DCE, 0x6DCF, 0x6DD0, 0x6DD2, 0x6DD3, 0x6DD4, 0x6DD5, + 0x6DD7, 0x6DDA, 0x6DDB, 0x6DDC, 0x6DDF, 0x6DE2, 0x6DE3, 0x6DE5, + 0x6DE7, 0x6DE8, 0x6DE9, 0x6DEA, 0x6DED, 0x6DEF, 0x6DF0, 0x6DF2, + 0x6DF4, 0x6DF5, 0x6DF6, 0x6DF8, 0x6DFA, 0x6DFD, 0x6DFE, 0x6DFF, + 0x6E00, 0x6E01, 0x6E02, 0x6E03, 0x6E04, 0x6E06, 0x6E07, 0x6E08, + 0x6E09, 0x6E0B, 0x6E0F, 0x6E12, 0x6E13, 0x6E15, 0x6E18, 0x6E19, + 0x6E1B, 0x6E1C, 0x6E1E, 0x6E1F, 0x6E22, 0x6E26, 0x6E27, 0x6E28, + 0x6E2A, 0x6E2C, 0x6E2E, 0x6E30, 0x6E31, 0x6E33, 0x6E35, ALTCHR, + 0x6E36, 0x6E37, 0x6E39, 0x6E3B, 0x6E3C, 0x6E3D, 0x6E3E, 0x6E3F, + 0x6E40, 0x6E41, 0x6E42, 0x6E45, 0x6E46, 0x6E47, 0x6E48, 0x6E49, + 0x6E4A, 0x6E4B, 0x6E4C, 0x6E4F, 0x6E50, 0x6E51, 0x6E52, 0x6E55, + 0x6E57, 0x6E59, 0x6E5A, 0x6E5C, 0x6E5D, 0x6E5E, 0x6E60, 0x6E61, + 0x6E62, 0x6E63, 0x6E64, 0x6E65, 0x6E66, 0x6E67, 0x6E68, 0x6E69, + 0x6E6A, 0x6E6C, 0x6E6D, 0x6E6F, 0x6E70, 0x6E71, 0x6E72, 0x6E73, + 0x6E74, 0x6E75, 0x6E76, 0x6E77, 0x6E78, 0x6E79, 0x6E7A, 0x6E7B, + 0x6E7C, 0x6E7D, 0x6E80, 0x6E81, 0x6E82, 0x6E84, 0x6E87, 0x6E88, + 0x6E8A, 0x6E8B, 0x6E8C, 0x6E8D, 0x6E8E, 0x6E91, 0x6E92, 0x6E93, + 0x6E94, 0x6E95, 0x6E96, 0x6E97, 0x6E99, 0x6E9A, 0x6E9B, 0x6E9D, + 0x6E9E, 0x6EA0, 0x6EA1, 0x6EA3, 0x6EA4, 0x6EA6, 0x6EA8, 0x6EA9, + 0x6EAB, 0x6EAC, 0x6EAD, 0x6EAE, 0x6EB0, 0x6EB3, 0x6EB5, 0x6EB8, + 0x6EB9, 0x6EBC, 0x6EBE, 0x6EBF, 0x6EC0, 0x6EC3, 0x6EC4, 0x6EC5, + 0x6EC6, 0x6EC8, 0x6EC9, 0x6ECA, 0x6ECC, 0x6ECD, 0x6ECE, 0x6ED0, + 0x6ED2, 0x6ED6, 0x6ED8, 0x6ED9, 0x6EDB, 0x6EDC, 0x6EDD, 0x6EE3, + 0x6EE7, 0x6EEA, 0x6EEB, 0x6EEC, 0x6EED, 0x6EEE, 0x6EEF, ALTCHR, +/* 0x9D40 - 0x9DFF */ + 0x6EF0, 0x6EF1, 0x6EF2, 0x6EF3, 0x6EF5, 0x6EF6, 0x6EF7, 0x6EF8, + 0x6EFA, 0x6EFB, 0x6EFC, 0x6EFD, 0x6EFE, 0x6EFF, 0x6F00, 0x6F01, + 0x6F03, 0x6F04, 0x6F05, 0x6F07, 0x6F08, 0x6F0A, 0x6F0B, 0x6F0C, + 0x6F0D, 0x6F0E, 0x6F10, 0x6F11, 0x6F12, 0x6F16, 0x6F17, 0x6F18, + 0x6F19, 0x6F1A, 0x6F1B, 0x6F1C, 0x6F1D, 0x6F1E, 0x6F1F, 0x6F21, + 0x6F22, 0x6F23, 0x6F25, 0x6F26, 0x6F27, 0x6F28, 0x6F2C, 0x6F2E, + 0x6F30, 0x6F32, 0x6F34, 0x6F35, 0x6F37, 0x6F38, 0x6F39, 0x6F3A, + 0x6F3B, 0x6F3C, 0x6F3D, 0x6F3F, 0x6F40, 0x6F41, 0x6F42, ALTCHR, + 0x6F43, 0x6F44, 0x6F45, 0x6F48, 0x6F49, 0x6F4A, 0x6F4C, 0x6F4E, + 0x6F4F, 0x6F50, 0x6F51, 0x6F52, 0x6F53, 0x6F54, 0x6F55, 0x6F56, + 0x6F57, 0x6F59, 0x6F5A, 0x6F5B, 0x6F5D, 0x6F5F, 0x6F60, 0x6F61, + 0x6F63, 0x6F64, 0x6F65, 0x6F67, 0x6F68, 0x6F69, 0x6F6A, 0x6F6B, + 0x6F6C, 0x6F6F, 0x6F70, 0x6F71, 0x6F73, 0x6F75, 0x6F76, 0x6F77, + 0x6F79, 0x6F7B, 0x6F7D, 0x6F7E, 0x6F7F, 0x6F80, 0x6F81, 0x6F82, + 0x6F83, 0x6F85, 0x6F86, 0x6F87, 0x6F8A, 0x6F8B, 0x6F8F, 0x6F90, + 0x6F91, 0x6F92, 0x6F93, 0x6F94, 0x6F95, 0x6F96, 0x6F97, 0x6F98, + 0x6F99, 0x6F9A, 0x6F9B, 0x6F9D, 0x6F9E, 0x6F9F, 0x6FA0, 0x6FA2, + 0x6FA3, 0x6FA4, 0x6FA5, 0x6FA6, 0x6FA8, 0x6FA9, 0x6FAA, 0x6FAB, + 0x6FAC, 0x6FAD, 0x6FAE, 0x6FAF, 0x6FB0, 0x6FB1, 0x6FB2, 0x6FB4, + 0x6FB5, 0x6FB7, 0x6FB8, 0x6FBA, 0x6FBB, 0x6FBC, 0x6FBD, 0x6FBE, + 0x6FBF, 0x6FC1, 0x6FC3, 0x6FC4, 0x6FC5, 0x6FC6, 0x6FC7, 0x6FC8, + 0x6FCA, 0x6FCB, 0x6FCC, 0x6FCD, 0x6FCE, 0x6FCF, 0x6FD0, 0x6FD3, + 0x6FD4, 0x6FD5, 0x6FD6, 0x6FD7, 0x6FD8, 0x6FD9, 0x6FDA, 0x6FDB, + 0x6FDC, 0x6FDD, 0x6FDF, 0x6FE2, 0x6FE3, 0x6FE4, 0x6FE5, ALTCHR, +/* 0x9E40 - 0x9EFF */ + 0x6FE6, 0x6FE7, 0x6FE8, 0x6FE9, 0x6FEA, 0x6FEB, 0x6FEC, 0x6FED, + 0x6FF0, 0x6FF1, 0x6FF2, 0x6FF3, 0x6FF4, 0x6FF5, 0x6FF6, 0x6FF7, + 0x6FF8, 0x6FF9, 0x6FFA, 0x6FFB, 0x6FFC, 0x6FFD, 0x6FFE, 0x6FFF, + 0x7000, 0x7001, 0x7002, 0x7003, 0x7004, 0x7005, 0x7006, 0x7007, + 0x7008, 0x7009, 0x700A, 0x700B, 0x700C, 0x700D, 0x700E, 0x700F, + 0x7010, 0x7012, 0x7013, 0x7014, 0x7015, 0x7016, 0x7017, 0x7018, + 0x7019, 0x701C, 0x701D, 0x701E, 0x701F, 0x7020, 0x7021, 0x7022, + 0x7024, 0x7025, 0x7026, 0x7027, 0x7028, 0x7029, 0x702A, ALTCHR, + 0x702B, 0x702C, 0x702D, 0x702E, 0x702F, 0x7030, 0x7031, 0x7032, + 0x7033, 0x7034, 0x7036, 0x7037, 0x7038, 0x703A, 0x703B, 0x703C, + 0x703D, 0x703E, 0x703F, 0x7040, 0x7041, 0x7042, 0x7043, 0x7044, + 0x7045, 0x7046, 0x7047, 0x7048, 0x7049, 0x704A, 0x704B, 0x704D, + 0x704E, 0x7050, 0x7051, 0x7052, 0x7053, 0x7054, 0x7055, 0x7056, + 0x7057, 0x7058, 0x7059, 0x705A, 0x705B, 0x705C, 0x705D, 0x705F, + 0x7060, 0x7061, 0x7062, 0x7063, 0x7064, 0x7065, 0x7066, 0x7067, + 0x7068, 0x7069, 0x706A, 0x706E, 0x7071, 0x7072, 0x7073, 0x7074, + 0x7077, 0x7079, 0x707A, 0x707B, 0x707D, 0x7081, 0x7082, 0x7083, + 0x7084, 0x7086, 0x7087, 0x7088, 0x708B, 0x708C, 0x708D, 0x708F, + 0x7090, 0x7091, 0x7093, 0x7097, 0x7098, 0x709A, 0x709B, 0x709E, + 0x709F, 0x70A0, 0x70A1, 0x70A2, 0x70A3, 0x70A4, 0x70A5, 0x70A6, + 0x70A7, 0x70A8, 0x70A9, 0x70AA, 0x70B0, 0x70B2, 0x70B4, 0x70B5, + 0x70B6, 0x70BA, 0x70BE, 0x70BF, 0x70C4, 0x70C5, 0x70C6, 0x70C7, + 0x70C9, 0x70CB, 0x70CC, 0x70CD, 0x70CE, 0x70CF, 0x70D0, 0x70D1, + 0x70D2, 0x70D3, 0x70D4, 0x70D5, 0x70D6, 0x70D7, 0x70DA, ALTCHR, +/* 0x9F40 - 0x9FFF */ + 0x70DC, 0x70DD, 0x70DE, 0x70E0, 0x70E1, 0x70E2, 0x70E3, 0x70E5, + 0x70EA, 0x70EE, 0x70F0, 0x70F1, 0x70F2, 0x70F3, 0x70F4, 0x70F5, + 0x70F6, 0x70F8, 0x70FA, 0x70FB, 0x70FC, 0x70FE, 0x70FF, 0x7100, + 0x7101, 0x7102, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x7108, + 0x710B, 0x710C, 0x710D, 0x710E, 0x710F, 0x7111, 0x7112, 0x7114, + 0x7117, 0x711B, 0x711C, 0x711D, 0x711E, 0x711F, 0x7120, 0x7121, + 0x7122, 0x7123, 0x7124, 0x7125, 0x7127, 0x7128, 0x7129, 0x712A, + 0x712B, 0x712C, 0x712D, 0x712E, 0x7132, 0x7133, 0x7134, ALTCHR, + 0x7135, 0x7137, 0x7138, 0x7139, 0x713A, 0x713B, 0x713C, 0x713D, + 0x713E, 0x713F, 0x7140, 0x7141, 0x7142, 0x7143, 0x7144, 0x7146, + 0x7147, 0x7148, 0x7149, 0x714B, 0x714D, 0x714F, 0x7150, 0x7151, + 0x7152, 0x7153, 0x7154, 0x7155, 0x7156, 0x7157, 0x7158, 0x7159, + 0x715A, 0x715B, 0x715D, 0x715F, 0x7160, 0x7161, 0x7162, 0x7163, + 0x7165, 0x7169, 0x716A, 0x716B, 0x716C, 0x716D, 0x716F, 0x7170, + 0x7171, 0x7174, 0x7175, 0x7176, 0x7177, 0x7179, 0x717B, 0x717C, + 0x717E, 0x717F, 0x7180, 0x7181, 0x7182, 0x7183, 0x7185, 0x7186, + 0x7187, 0x7188, 0x7189, 0x718B, 0x718C, 0x718D, 0x718E, 0x7190, + 0x7191, 0x7192, 0x7193, 0x7195, 0x7196, 0x7197, 0x719A, 0x719B, + 0x719C, 0x719D, 0x719E, 0x71A1, 0x71A2, 0x71A3, 0x71A4, 0x71A5, + 0x71A6, 0x71A7, 0x71A9, 0x71AA, 0x71AB, 0x71AD, 0x71AE, 0x71AF, + 0x71B0, 0x71B1, 0x71B2, 0x71B4, 0x71B6, 0x71B7, 0x71B8, 0x71BA, + 0x71BB, 0x71BC, 0x71BD, 0x71BE, 0x71BF, 0x71C0, 0x71C1, 0x71C2, + 0x71C4, 0x71C5, 0x71C6, 0x71C7, 0x71C8, 0x71C9, 0x71CA, 0x71CB, + 0x71CC, 0x71CD, 0x71CF, 0x71D0, 0x71D1, 0x71D2, 0x71D3, ALTCHR, +/* 0xA040 - 0xA0FF */ + 0x71D6, 0x71D7, 0x71D8, 0x71D9, 0x71DA, 0x71DB, 0x71DC, 0x71DD, + 0x71DE, 0x71DF, 0x71E1, 0x71E2, 0x71E3, 0x71E4, 0x71E6, 0x71E8, + 0x71E9, 0x71EA, 0x71EB, 0x71EC, 0x71ED, 0x71EF, 0x71F0, 0x71F1, + 0x71F2, 0x71F3, 0x71F4, 0x71F5, 0x71F6, 0x71F7, 0x71F8, 0x71FA, + 0x71FB, 0x71FC, 0x71FD, 0x71FE, 0x71FF, 0x7200, 0x7201, 0x7202, + 0x7203, 0x7204, 0x7205, 0x7207, 0x7208, 0x7209, 0x720A, 0x720B, + 0x720C, 0x720D, 0x720E, 0x720F, 0x7210, 0x7211, 0x7212, 0x7213, + 0x7214, 0x7215, 0x7216, 0x7217, 0x7218, 0x7219, 0x721A, ALTCHR, + 0x721B, 0x721C, 0x721E, 0x721F, 0x7220, 0x7221, 0x7222, 0x7223, + 0x7224, 0x7225, 0x7226, 0x7227, 0x7229, 0x722B, 0x722D, 0x722E, + 0x722F, 0x7232, 0x7233, 0x7234, 0x723A, 0x723C, 0x723E, 0x7240, + 0x7241, 0x7242, 0x7243, 0x7244, 0x7245, 0x7246, 0x7249, 0x724A, + 0x724B, 0x724E, 0x724F, 0x7250, 0x7251, 0x7253, 0x7254, 0x7255, + 0x7257, 0x7258, 0x725A, 0x725C, 0x725E, 0x7260, 0x7263, 0x7264, + 0x7265, 0x7268, 0x726A, 0x726B, 0x726C, 0x726D, 0x7270, 0x7271, + 0x7273, 0x7274, 0x7276, 0x7277, 0x7278, 0x727B, 0x727C, 0x727D, + 0x7282, 0x7283, 0x7285, 0x7286, 0x7287, 0x7288, 0x7289, 0x728C, + 0x728E, 0x7290, 0x7291, 0x7293, 0x7294, 0x7295, 0x7296, 0x7297, + 0x7298, 0x7299, 0x729A, 0x729B, 0x729C, 0x729D, 0x729E, 0x72A0, + 0x72A1, 0x72A2, 0x72A3, 0x72A4, 0x72A5, 0x72A6, 0x72A7, 0x72A8, + 0x72A9, 0x72AA, 0x72AB, 0x72AE, 0x72B1, 0x72B2, 0x72B3, 0x72B5, + 0x72BA, 0x72BB, 0x72BC, 0x72BD, 0x72BE, 0x72BF, 0x72C0, 0x72C5, + 0x72C6, 0x72C7, 0x72C9, 0x72CA, 0x72CB, 0x72CC, 0x72CF, 0x72D1, + 0x72D3, 0x72D4, 0x72D5, 0x72D6, 0x72D8, 0x72DA, 0x72DB, ALTCHR, +/* 0xA140 - 0xA1FF */ + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x3000, 0x3001, 0x3002, 0xB7 , 0x2C9 , 0x2C7 , 0xA8 , + 0x3003, 0x3005, 0x2015, 0xFF5E, 0x2016, 0x2026, 0x2018, 0x2019, + 0x201C, 0x201D, 0x3014, 0x3015, 0x3008, 0x3009, 0x300A, 0x300B, + 0x300C, 0x300D, 0x300E, 0x300F, 0x3016, 0x3017, 0x3010, 0x3011, + 0xB1 , 0xD7 , 0xF7 , 0x2236, 0x2227, 0x2228, 0x2211, 0x220F, + 0x222A, 0x2229, 0x2208, 0x2237, 0x221A, 0x22A5, 0x2225, 0x2220, + 0x2312, 0x2299, 0x222B, 0x222E, 0x2261, 0x224C, 0x2248, 0x223D, + 0x221D, 0x2260, 0x226E, 0x226F, 0x2264, 0x2265, 0x221E, 0x2235, + 0x2234, 0x2642, 0x2640, 0xB0 , 0x2032, 0x2033, 0x2103, 0xFF04, + 0xA4 , 0xFFE0, 0xFFE1, 0x2030, 0xA7 , 0x2116, 0x2606, 0x2605, + 0x25CB, 0x25CF, 0x25CE, 0x25C7, 0x25C6, 0x25A1, 0x25A0, 0x25B3, + 0x25B2, 0x203B, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, ALTCHR, +/* 0xA240 - 0xA2FF */ + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, + 0x2177, 0x2178, 0x2179, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x2488, 0x2489, 0x248A, 0x248B, 0x248C, 0x248D, 0x248E, + 0x248F, 0x2490, 0x2491, 0x2492, 0x2493, 0x2494, 0x2495, 0x2496, + 0x2497, 0x2498, 0x2499, 0x249A, 0x249B, 0x2474, 0x2475, 0x2476, + 0x2477, 0x2478, 0x2479, 0x247A, 0x247B, 0x247C, 0x247D, 0x247E, + 0x247F, 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, 0x2485, 0x2486, + 0x2487, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, + 0x2467, 0x2468, 0x2469, ALTCHR, ALTCHR, 0x3220, 0x3221, 0x3222, + 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, ALTCHR, + ALTCHR, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, + 0x2167, 0x2168, 0x2169, 0x216A, 0x216B, ALTCHR, ALTCHR, ALTCHR, +/* 0xA340 - 0xA3FF */ + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0xFF01, 0xFF02, 0xFF03, 0xFFE5, 0xFF05, 0xFF06, 0xFF07, + 0xFF08, 0xFF09, 0xFF0A, 0xFF0B, 0xFF0C, 0xFF0D, 0xFF0E, 0xFF0F, + 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, + 0xFF18, 0xFF19, 0xFF1A, 0xFF1B, 0xFF1C, 0xFF1D, 0xFF1E, 0xFF1F, + 0xFF20, 0xFF21, 0xFF22, 0xFF23, 0xFF24, 0xFF25, 0xFF26, 0xFF27, + 0xFF28, 0xFF29, 0xFF2A, 0xFF2B, 0xFF2C, 0xFF2D, 0xFF2E, 0xFF2F, + 0xFF30, 0xFF31, 0xFF32, 0xFF33, 0xFF34, 0xFF35, 0xFF36, 0xFF37, + 0xFF38, 0xFF39, 0xFF3A, 0xFF3B, 0xFF3C, 0xFF3D, 0xFF3E, 0xFF3F, + 0xFF40, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, + 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, + 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57, + 0xFF58, 0xFF59, 0xFF5A, 0xFF5B, 0xFF5C, 0xFF5D, 0xFFE3, ALTCHR, +/* 0xA440 - 0xA4FF */ + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, + 0x3048, 0x3049, 0x304A, 0x304B, 0x304C, 0x304D, 0x304E, 0x304F, + 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, + 0x3058, 0x3059, 0x305A, 0x305B, 0x305C, 0x305D, 0x305E, 0x305F, + 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, + 0x3068, 0x3069, 0x306A, 0x306B, 0x306C, 0x306D, 0x306E, 0x306F, + 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, + 0x3078, 0x3079, 0x307A, 0x307B, 0x307C, 0x307D, 0x307E, 0x307F, + 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, + 0x3088, 0x3089, 0x308A, 0x308B, 0x308C, 0x308D, 0x308E, 0x308F, + 0x3090, 0x3091, 0x3092, 0x3093, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xA540 - 0xA5FF */ + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x30A1, 0x30A2, 0x30A3, 0x30A4, 0x30A5, 0x30A6, 0x30A7, + 0x30A8, 0x30A9, 0x30AA, 0x30AB, 0x30AC, 0x30AD, 0x30AE, 0x30AF, + 0x30B0, 0x30B1, 0x30B2, 0x30B3, 0x30B4, 0x30B5, 0x30B6, 0x30B7, + 0x30B8, 0x30B9, 0x30BA, 0x30BB, 0x30BC, 0x30BD, 0x30BE, 0x30BF, + 0x30C0, 0x30C1, 0x30C2, 0x30C3, 0x30C4, 0x30C5, 0x30C6, 0x30C7, + 0x30C8, 0x30C9, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, 0x30CF, + 0x30D0, 0x30D1, 0x30D2, 0x30D3, 0x30D4, 0x30D5, 0x30D6, 0x30D7, + 0x30D8, 0x30D9, 0x30DA, 0x30DB, 0x30DC, 0x30DD, 0x30DE, 0x30DF, + 0x30E0, 0x30E1, 0x30E2, 0x30E3, 0x30E4, 0x30E5, 0x30E6, 0x30E7, + 0x30E8, 0x30E9, 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EE, 0x30EF, + 0x30F0, 0x30F1, 0x30F2, 0x30F3, 0x30F4, 0x30F5, 0x30F6, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xA640 - 0xA6FF */ + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x391 , 0x392 , 0x393 , 0x394 , 0x395 , 0x396 , 0x397 , + 0x398 , 0x399 , 0x39A , 0x39B , 0x39C , 0x39D , 0x39E , 0x39F , + 0x3A0 , 0x3A1 , 0x3A3 , 0x3A4 , 0x3A5 , 0x3A6 , 0x3A7 , 0x3A8 , + 0x3A9 , ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x3B1 , 0x3B2 , 0x3B3 , 0x3B4 , 0x3B5 , 0x3B6 , 0x3B7 , + 0x3B8 , 0x3B9 , 0x3BA , 0x3BB , 0x3BC , 0x3BD , 0x3BE , 0x3BF , + 0x3C0 , 0x3C1 , 0x3C3 , 0x3C4 , 0x3C5 , 0x3C6 , 0x3C7 , 0x3C8 , + 0x3C9 , ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + 0xFE35, 0xFE36, 0xFE39, 0xFE3A, 0xFE3F, 0xFE40, 0xFE3D, 0xFE3E, + 0xFE41, 0xFE42, 0xFE43, 0xFE44, ALTCHR, ALTCHR, 0xFE3B, 0xFE3C, + 0xFE37, 0xFE38, 0xFE31, ALTCHR, 0xFE33, 0xFE34, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xA740 - 0xA7FF */ + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x410 , 0x411 , 0x412 , 0x413 , 0x414 , 0x415 , 0x401 , + 0x416 , 0x417 , 0x418 , 0x419 , 0x41A , 0x41B , 0x41C , 0x41D , + 0x41E , 0x41F , 0x420 , 0x421 , 0x422 , 0x423 , 0x424 , 0x425 , + 0x426 , 0x427 , 0x428 , 0x429 , 0x42A , 0x42B , 0x42C , 0x42D , + 0x42E , 0x42F , ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x430 , 0x431 , 0x432 , 0x433 , 0x434 , 0x435 , 0x451 , + 0x436 , 0x437 , 0x438 , 0x439 , 0x43A , 0x43B , 0x43C , 0x43D , + 0x43E , 0x43F , 0x440 , 0x441 , 0x442 , 0x443 , 0x444 , 0x445 , + 0x446 , 0x447 , 0x448 , 0x449 , 0x44A , 0x44B , 0x44C , 0x44D , + 0x44E , 0x44F , ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xA840 - 0xA8FF */ + 0x2CA , 0x2CB , 0x2D9 , 0x2013, 0x2014, 0x2025, 0x2035, 0x2105, + 0x2109, 0x2196, 0x2197, 0x2198, 0x2199, 0x2215, 0x221F, 0x2223, + 0x2252, 0x2266, 0x2267, 0x22BF, 0x2550, 0x2551, 0x2552, 0x2553, + 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, + 0x255C, 0x255D, 0x255E, 0x255F, 0x2560, 0x2561, 0x2562, 0x2563, + 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, + 0x256C, 0x256D, 0x256E, 0x256F, 0x2570, 0x2571, 0x2572, 0x2573, + 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, 0x2587, ALTCHR, + 0x2588, 0x2589, 0x258A, 0x258B, 0x258C, 0x258D, 0x258E, 0x258F, + 0x2593, 0x2594, 0x2595, 0x25BC, 0x25BD, 0x25E2, 0x25E3, 0x25E4, + 0x25E5, 0x2609, 0x2295, 0x3012, 0x301D, 0x301E, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, 0x101 , 0xE1 , 0x1CE , 0xE0 , 0x113 , 0xE9 , 0x11B , + 0xE8 , 0x12B , 0xED , 0x1D0 , 0xEC , 0x14D , 0xF3 , 0x1D2 , + 0xF2 , 0x16B , 0xFA , 0x1D4 , 0xF9 , 0x1D6 , 0x1D8 , 0x1DA , + 0x1DC , 0xFC , 0xEA , 0x251 , 0xE7C7, 0x144 , 0x148 , 0xE7C8, + 0x261 , ALTCHR, ALTCHR, ALTCHR, ALTCHR, 0x3105, 0x3106, 0x3107, + 0x3108, 0x3109, 0x310A, 0x310B, 0x310C, 0x310D, 0x310E, 0x310F, + 0x3110, 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, + 0x3118, 0x3119, 0x311A, 0x311B, 0x311C, 0x311D, 0x311E, 0x311F, + 0x3120, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, + 0x3128, 0x3129, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xA940 - 0xA9FF */ + 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, + 0x3029, 0x32A3, 0x338E, 0x338F, 0x339C, 0x339D, 0x339E, 0x33A1, + 0x33C4, 0x33CE, 0x33D1, 0x33D2, 0x33D5, 0xFE30, 0xFFE2, 0xFFE4, + ALTCHR, 0x2121, 0x3231, ALTCHR, 0x2010, ALTCHR, ALTCHR, ALTCHR, + 0x30FC, 0x309B, 0x309C, 0x30FD, 0x30FE, 0x3006, 0x309D, 0x309E, + 0xFE49, 0xFE4A, 0xFE4B, 0xFE4C, 0xFE4D, 0xFE4E, 0xFE4F, 0xFE50, + 0xFE51, 0xFE52, 0xFE54, 0xFE55, 0xFE56, 0xFE57, 0xFE59, 0xFE5A, + 0xFE5B, 0xFE5C, 0xFE5D, 0xFE5E, 0xFE5F, 0xFE60, 0xFE61, ALTCHR, + 0xFE62, 0xFE63, 0xFE64, 0xFE65, 0xFE66, 0xFE68, 0xFE69, 0xFE6A, + 0xFE6B, 0xE7E7, 0xE7E8, 0xE7E9, 0xE7EA, 0xE7EB, 0xE7EC, 0xE7ED, + 0xE7EE, 0xE7EF, 0xE7F0, 0xE7F1, 0xE7F2, 0xE7F3, 0x3007, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, 0x2500, 0x2501, 0x2502, 0x2503, + 0x2504, 0x2505, 0x2506, 0x2507, 0x2508, 0x2509, 0x250A, 0x250B, + 0x250C, 0x250D, 0x250E, 0x250F, 0x2510, 0x2511, 0x2512, 0x2513, + 0x2514, 0x2515, 0x2516, 0x2517, 0x2518, 0x2519, 0x251A, 0x251B, + 0x251C, 0x251D, 0x251E, 0x251F, 0x2520, 0x2521, 0x2522, 0x2523, + 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252A, 0x252B, + 0x252C, 0x252D, 0x252E, 0x252F, 0x2530, 0x2531, 0x2532, 0x2533, + 0x2534, 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253A, 0x253B, + 0x253C, 0x253D, 0x253E, 0x253F, 0x2540, 0x2541, 0x2542, 0x2543, + 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254A, 0x254B, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xAA40 - 0xAAFF */ + 0x72DC, 0x72DD, 0x72DF, 0x72E2, 0x72E3, 0x72E4, 0x72E5, 0x72E6, + 0x72E7, 0x72EA, 0x72EB, 0x72F5, 0x72F6, 0x72F9, 0x72FD, 0x72FE, + 0x72FF, 0x7300, 0x7302, 0x7304, 0x7305, 0x7306, 0x7307, 0x7308, + 0x7309, 0x730B, 0x730C, 0x730D, 0x730F, 0x7310, 0x7311, 0x7312, + 0x7314, 0x7318, 0x7319, 0x731A, 0x731F, 0x7320, 0x7323, 0x7324, + 0x7326, 0x7327, 0x7328, 0x732D, 0x732F, 0x7330, 0x7332, 0x7333, + 0x7335, 0x7336, 0x733A, 0x733B, 0x733C, 0x733D, 0x7340, 0x7341, + 0x7342, 0x7343, 0x7344, 0x7345, 0x7346, 0x7347, 0x7348, ALTCHR, + 0x7349, 0x734A, 0x734B, 0x734C, 0x734E, 0x734F, 0x7351, 0x7353, + 0x7354, 0x7355, 0x7356, 0x7358, 0x7359, 0x735A, 0x735B, 0x735C, + 0x735D, 0x735E, 0x735F, 0x7361, 0x7362, 0x7363, 0x7364, 0x7365, + 0x7366, 0x7367, 0x7368, 0x7369, 0x736A, 0x736B, 0x736E, 0x7370, + 0x7371, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xAB40 - 0xABFF */ + 0x7372, 0x7373, 0x7374, 0x7375, 0x7376, 0x7377, 0x7378, 0x7379, + 0x737A, 0x737B, 0x737C, 0x737D, 0x737F, 0x7380, 0x7381, 0x7382, + 0x7383, 0x7385, 0x7386, 0x7388, 0x738A, 0x738C, 0x738D, 0x738F, + 0x7390, 0x7392, 0x7393, 0x7394, 0x7395, 0x7397, 0x7398, 0x7399, + 0x739A, 0x739C, 0x739D, 0x739E, 0x73A0, 0x73A1, 0x73A3, 0x73A4, + 0x73A5, 0x73A6, 0x73A7, 0x73A8, 0x73AA, 0x73AC, 0x73AD, 0x73B1, + 0x73B4, 0x73B5, 0x73B6, 0x73B8, 0x73B9, 0x73BC, 0x73BD, 0x73BE, + 0x73BF, 0x73C1, 0x73C3, 0x73C4, 0x73C5, 0x73C6, 0x73C7, ALTCHR, + 0x73CB, 0x73CC, 0x73CE, 0x73D2, 0x73D3, 0x73D4, 0x73D5, 0x73D6, + 0x73D7, 0x73D8, 0x73DA, 0x73DB, 0x73DC, 0x73DD, 0x73DF, 0x73E1, + 0x73E2, 0x73E3, 0x73E4, 0x73E6, 0x73E8, 0x73EA, 0x73EB, 0x73EC, + 0x73EE, 0x73EF, 0x73F0, 0x73F1, 0x73F3, 0x73F4, 0x73F5, 0x73F6, + 0x73F7, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xAC40 - 0xACFF */ + 0x73F8, 0x73F9, 0x73FA, 0x73FB, 0x73FC, 0x73FD, 0x73FE, 0x73FF, + 0x7400, 0x7401, 0x7402, 0x7404, 0x7407, 0x7408, 0x740B, 0x740C, + 0x740D, 0x740E, 0x7411, 0x7412, 0x7413, 0x7414, 0x7415, 0x7416, + 0x7417, 0x7418, 0x7419, 0x741C, 0x741D, 0x741E, 0x741F, 0x7420, + 0x7421, 0x7423, 0x7424, 0x7427, 0x7429, 0x742B, 0x742D, 0x742F, + 0x7431, 0x7432, 0x7437, 0x7438, 0x7439, 0x743A, 0x743B, 0x743D, + 0x743E, 0x743F, 0x7440, 0x7442, 0x7443, 0x7444, 0x7445, 0x7446, + 0x7447, 0x7448, 0x7449, 0x744A, 0x744B, 0x744C, 0x744D, ALTCHR, + 0x744E, 0x744F, 0x7450, 0x7451, 0x7452, 0x7453, 0x7454, 0x7456, + 0x7458, 0x745D, 0x7460, 0x7461, 0x7462, 0x7463, 0x7464, 0x7465, + 0x7466, 0x7467, 0x7468, 0x7469, 0x746A, 0x746B, 0x746C, 0x746E, + 0x746F, 0x7471, 0x7472, 0x7473, 0x7474, 0x7475, 0x7478, 0x7479, + 0x747A, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xAD40 - 0xADFF */ + 0x747B, 0x747C, 0x747D, 0x747F, 0x7482, 0x7484, 0x7485, 0x7486, + 0x7488, 0x7489, 0x748A, 0x748C, 0x748D, 0x748F, 0x7491, 0x7492, + 0x7493, 0x7494, 0x7495, 0x7496, 0x7497, 0x7498, 0x7499, 0x749A, + 0x749B, 0x749D, 0x749F, 0x74A0, 0x74A1, 0x74A2, 0x74A3, 0x74A4, + 0x74A5, 0x74A6, 0x74AA, 0x74AB, 0x74AC, 0x74AD, 0x74AE, 0x74AF, + 0x74B0, 0x74B1, 0x74B2, 0x74B3, 0x74B4, 0x74B5, 0x74B6, 0x74B7, + 0x74B8, 0x74B9, 0x74BB, 0x74BC, 0x74BD, 0x74BE, 0x74BF, 0x74C0, + 0x74C1, 0x74C2, 0x74C3, 0x74C4, 0x74C5, 0x74C6, 0x74C7, ALTCHR, + 0x74C8, 0x74C9, 0x74CA, 0x74CB, 0x74CC, 0x74CD, 0x74CE, 0x74CF, + 0x74D0, 0x74D1, 0x74D3, 0x74D4, 0x74D5, 0x74D6, 0x74D7, 0x74D8, + 0x74D9, 0x74DA, 0x74DB, 0x74DD, 0x74DF, 0x74E1, 0x74E5, 0x74E7, + 0x74E8, 0x74E9, 0x74EA, 0x74EB, 0x74EC, 0x74ED, 0x74F0, 0x74F1, + 0x74F2, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xAE40 - 0xAEFF */ + 0x74F3, 0x74F5, 0x74F8, 0x74F9, 0x74FA, 0x74FB, 0x74FC, 0x74FD, + 0x74FE, 0x7500, 0x7501, 0x7502, 0x7503, 0x7505, 0x7506, 0x7507, + 0x7508, 0x7509, 0x750A, 0x750B, 0x750C, 0x750E, 0x7510, 0x7512, + 0x7514, 0x7515, 0x7516, 0x7517, 0x751B, 0x751D, 0x751E, 0x7520, + 0x7521, 0x7522, 0x7523, 0x7524, 0x7526, 0x7527, 0x752A, 0x752E, + 0x7534, 0x7536, 0x7539, 0x753C, 0x753D, 0x753F, 0x7541, 0x7542, + 0x7543, 0x7544, 0x7546, 0x7547, 0x7549, 0x754A, 0x754D, 0x7550, + 0x7551, 0x7552, 0x7553, 0x7555, 0x7556, 0x7557, 0x7558, ALTCHR, + 0x755D, 0x755E, 0x755F, 0x7560, 0x7561, 0x7562, 0x7563, 0x7564, + 0x7567, 0x7568, 0x7569, 0x756B, 0x756C, 0x756D, 0x756E, 0x756F, + 0x7570, 0x7571, 0x7573, 0x7575, 0x7576, 0x7577, 0x757A, 0x757B, + 0x757C, 0x757D, 0x757E, 0x7580, 0x7581, 0x7582, 0x7584, 0x7585, + 0x7587, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xAF40 - 0xAFFF */ + 0x7588, 0x7589, 0x758A, 0x758C, 0x758D, 0x758E, 0x7590, 0x7593, + 0x7595, 0x7598, 0x759B, 0x759C, 0x759E, 0x75A2, 0x75A6, 0x75A7, + 0x75A8, 0x75A9, 0x75AA, 0x75AD, 0x75B6, 0x75B7, 0x75BA, 0x75BB, + 0x75BF, 0x75C0, 0x75C1, 0x75C6, 0x75CB, 0x75CC, 0x75CE, 0x75CF, + 0x75D0, 0x75D1, 0x75D3, 0x75D7, 0x75D9, 0x75DA, 0x75DC, 0x75DD, + 0x75DF, 0x75E0, 0x75E1, 0x75E5, 0x75E9, 0x75EC, 0x75ED, 0x75EE, + 0x75EF, 0x75F2, 0x75F3, 0x75F5, 0x75F6, 0x75F7, 0x75F8, 0x75FA, + 0x75FB, 0x75FD, 0x75FE, 0x7602, 0x7604, 0x7606, 0x7607, ALTCHR, + 0x7608, 0x7609, 0x760B, 0x760D, 0x760E, 0x760F, 0x7611, 0x7612, + 0x7613, 0x7614, 0x7616, 0x761A, 0x761C, 0x761D, 0x761E, 0x7621, + 0x7623, 0x7627, 0x7628, 0x762C, 0x762E, 0x762F, 0x7631, 0x7632, + 0x7636, 0x7637, 0x7639, 0x763A, 0x763B, 0x763D, 0x7641, 0x7642, + 0x7644, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xB040 - 0xB0FF */ + 0x7645, 0x7646, 0x7647, 0x7648, 0x7649, 0x764A, 0x764B, 0x764E, + 0x764F, 0x7650, 0x7651, 0x7652, 0x7653, 0x7655, 0x7657, 0x7658, + 0x7659, 0x765A, 0x765B, 0x765D, 0x765F, 0x7660, 0x7661, 0x7662, + 0x7664, 0x7665, 0x7666, 0x7667, 0x7668, 0x7669, 0x766A, 0x766C, + 0x766D, 0x766E, 0x7670, 0x7671, 0x7672, 0x7673, 0x7674, 0x7675, + 0x7676, 0x7677, 0x7679, 0x767A, 0x767C, 0x767F, 0x7680, 0x7681, + 0x7683, 0x7685, 0x7689, 0x768A, 0x768C, 0x768D, 0x768F, 0x7690, + 0x7692, 0x7694, 0x7695, 0x7697, 0x7698, 0x769A, 0x769B, ALTCHR, + 0x769C, 0x769D, 0x769E, 0x769F, 0x76A0, 0x76A1, 0x76A2, 0x76A3, + 0x76A5, 0x76A6, 0x76A7, 0x76A8, 0x76A9, 0x76AA, 0x76AB, 0x76AC, + 0x76AD, 0x76AF, 0x76B0, 0x76B3, 0x76B5, 0x76B6, 0x76B7, 0x76B8, + 0x76B9, 0x76BA, 0x76BB, 0x76BC, 0x76BD, 0x76BE, 0x76C0, 0x76C1, + 0x76C3, 0x554A, 0x963F, 0x57C3, 0x6328, 0x54CE, 0x5509, 0x54C0, + 0x7691, 0x764C, 0x853C, 0x77EE, 0x827E, 0x788D, 0x7231, 0x9698, + 0x978D, 0x6C28, 0x5B89, 0x4FFA, 0x6309, 0x6697, 0x5CB8, 0x80FA, + 0x6848, 0x80AE, 0x6602, 0x76CE, 0x51F9, 0x6556, 0x71AC, 0x7FF1, + 0x8884, 0x50B2, 0x5965, 0x61CA, 0x6FB3, 0x82AD, 0x634C, 0x6252, + 0x53ED, 0x5427, 0x7B06, 0x516B, 0x75A4, 0x5DF4, 0x62D4, 0x8DCB, + 0x9776, 0x628A, 0x8019, 0x575D, 0x9738, 0x7F62, 0x7238, 0x767D, + 0x67CF, 0x767E, 0x6446, 0x4F70, 0x8D25, 0x62DC, 0x7A17, 0x6591, + 0x73ED, 0x642C, 0x6273, 0x822C, 0x9881, 0x677F, 0x7248, 0x626E, + 0x62CC, 0x4F34, 0x74E3, 0x534A, 0x529E, 0x7ECA, 0x90A6, 0x5E2E, + 0x6886, 0x699C, 0x8180, 0x7ED1, 0x68D2, 0x78C5, 0x868C, 0x9551, + 0x508D, 0x8C24, 0x82DE, 0x80DE, 0x5305, 0x8912, 0x5265, ALTCHR, +/* 0xB140 - 0xB1FF */ + 0x76C4, 0x76C7, 0x76C9, 0x76CB, 0x76CC, 0x76D3, 0x76D5, 0x76D9, + 0x76DA, 0x76DC, 0x76DD, 0x76DE, 0x76E0, 0x76E1, 0x76E2, 0x76E3, + 0x76E4, 0x76E6, 0x76E7, 0x76E8, 0x76E9, 0x76EA, 0x76EB, 0x76EC, + 0x76ED, 0x76F0, 0x76F3, 0x76F5, 0x76F6, 0x76F7, 0x76FA, 0x76FB, + 0x76FD, 0x76FF, 0x7700, 0x7702, 0x7703, 0x7705, 0x7706, 0x770A, + 0x770C, 0x770E, 0x770F, 0x7710, 0x7711, 0x7712, 0x7713, 0x7714, + 0x7715, 0x7716, 0x7717, 0x7718, 0x771B, 0x771C, 0x771D, 0x771E, + 0x7721, 0x7723, 0x7724, 0x7725, 0x7727, 0x772A, 0x772B, ALTCHR, + 0x772C, 0x772E, 0x7730, 0x7731, 0x7732, 0x7733, 0x7734, 0x7739, + 0x773B, 0x773D, 0x773E, 0x773F, 0x7742, 0x7744, 0x7745, 0x7746, + 0x7748, 0x7749, 0x774A, 0x774B, 0x774C, 0x774D, 0x774E, 0x774F, + 0x7752, 0x7753, 0x7754, 0x7755, 0x7756, 0x7757, 0x7758, 0x7759, + 0x775C, 0x8584, 0x96F9, 0x4FDD, 0x5821, 0x9971, 0x5B9D, 0x62B1, + 0x62A5, 0x66B4, 0x8C79, 0x9C8D, 0x7206, 0x676F, 0x7891, 0x60B2, + 0x5351, 0x5317, 0x8F88, 0x80CC, 0x8D1D, 0x94A1, 0x500D, 0x72C8, + 0x5907, 0x60EB, 0x7119, 0x88AB, 0x5954, 0x82EF, 0x672C, 0x7B28, + 0x5D29, 0x7EF7, 0x752D, 0x6CF5, 0x8E66, 0x8FF8, 0x903C, 0x9F3B, + 0x6BD4, 0x9119, 0x7B14, 0x5F7C, 0x78A7, 0x84D6, 0x853D, 0x6BD5, + 0x6BD9, 0x6BD6, 0x5E01, 0x5E87, 0x75F9, 0x95ED, 0x655D, 0x5F0A, + 0x5FC5, 0x8F9F, 0x58C1, 0x81C2, 0x907F, 0x965B, 0x97AD, 0x8FB9, + 0x7F16, 0x8D2C, 0x6241, 0x4FBF, 0x53D8, 0x535E, 0x8FA8, 0x8FA9, + 0x8FAB, 0x904D, 0x6807, 0x5F6A, 0x8198, 0x8868, 0x9CD6, 0x618B, + 0x522B, 0x762A, 0x5F6C, 0x658C, 0x6FD2, 0x6EE8, 0x5BBE, 0x6448, + 0x5175, 0x51B0, 0x67C4, 0x4E19, 0x79C9, 0x997C, 0x70B3, ALTCHR, +/* 0xB240 - 0xB2FF */ + 0x775D, 0x775E, 0x775F, 0x7760, 0x7764, 0x7767, 0x7769, 0x776A, + 0x776D, 0x776E, 0x776F, 0x7770, 0x7771, 0x7772, 0x7773, 0x7774, + 0x7775, 0x7776, 0x7777, 0x7778, 0x777A, 0x777B, 0x777C, 0x7781, + 0x7782, 0x7783, 0x7786, 0x7787, 0x7788, 0x7789, 0x778A, 0x778B, + 0x778F, 0x7790, 0x7793, 0x7794, 0x7795, 0x7796, 0x7797, 0x7798, + 0x7799, 0x779A, 0x779B, 0x779C, 0x779D, 0x779E, 0x77A1, 0x77A3, + 0x77A4, 0x77A6, 0x77A8, 0x77AB, 0x77AD, 0x77AE, 0x77AF, 0x77B1, + 0x77B2, 0x77B4, 0x77B6, 0x77B7, 0x77B8, 0x77B9, 0x77BA, ALTCHR, + 0x77BC, 0x77BE, 0x77C0, 0x77C1, 0x77C2, 0x77C3, 0x77C4, 0x77C5, + 0x77C6, 0x77C7, 0x77C8, 0x77C9, 0x77CA, 0x77CB, 0x77CC, 0x77CE, + 0x77CF, 0x77D0, 0x77D1, 0x77D2, 0x77D3, 0x77D4, 0x77D5, 0x77D6, + 0x77D8, 0x77D9, 0x77DA, 0x77DD, 0x77DE, 0x77DF, 0x77E0, 0x77E1, + 0x77E4, 0x75C5, 0x5E76, 0x73BB, 0x83E0, 0x64AD, 0x62E8, 0x94B5, + 0x6CE2, 0x535A, 0x52C3, 0x640F, 0x94C2, 0x7B94, 0x4F2F, 0x5E1B, + 0x8236, 0x8116, 0x818A, 0x6E24, 0x6CCA, 0x9A73, 0x6355, 0x535C, + 0x54FA, 0x8865, 0x57E0, 0x4E0D, 0x5E03, 0x6B65, 0x7C3F, 0x90E8, + 0x6016, 0x64E6, 0x731C, 0x88C1, 0x6750, 0x624D, 0x8D22, 0x776C, + 0x8E29, 0x91C7, 0x5F69, 0x83DC, 0x8521, 0x9910, 0x53C2, 0x8695, + 0x6B8B, 0x60ED, 0x60E8, 0x707F, 0x82CD, 0x8231, 0x4ED3, 0x6CA7, + 0x85CF, 0x64CD, 0x7CD9, 0x69FD, 0x66F9, 0x8349, 0x5395, 0x7B56, + 0x4FA7, 0x518C, 0x6D4B, 0x5C42, 0x8E6D, 0x63D2, 0x53C9, 0x832C, + 0x8336, 0x67E5, 0x78B4, 0x643D, 0x5BDF, 0x5C94, 0x5DEE, 0x8BE7, + 0x62C6, 0x67F4, 0x8C7A, 0x6400, 0x63BA, 0x8749, 0x998B, 0x8C17, + 0x7F20, 0x94F2, 0x4EA7, 0x9610, 0x98A4, 0x660C, 0x7316, ALTCHR, +/* 0xB340 - 0xB3FF */ + 0x77E6, 0x77E8, 0x77EA, 0x77EF, 0x77F0, 0x77F1, 0x77F2, 0x77F4, + 0x77F5, 0x77F7, 0x77F9, 0x77FA, 0x77FB, 0x77FC, 0x7803, 0x7804, + 0x7805, 0x7806, 0x7807, 0x7808, 0x780A, 0x780B, 0x780E, 0x780F, + 0x7810, 0x7813, 0x7815, 0x7819, 0x781B, 0x781E, 0x7820, 0x7821, + 0x7822, 0x7824, 0x7828, 0x782A, 0x782B, 0x782E, 0x782F, 0x7831, + 0x7832, 0x7833, 0x7835, 0x7836, 0x783D, 0x783F, 0x7841, 0x7842, + 0x7843, 0x7844, 0x7846, 0x7848, 0x7849, 0x784A, 0x784B, 0x784D, + 0x784F, 0x7851, 0x7853, 0x7854, 0x7858, 0x7859, 0x785A, ALTCHR, + 0x785B, 0x785C, 0x785E, 0x785F, 0x7860, 0x7861, 0x7862, 0x7863, + 0x7864, 0x7865, 0x7866, 0x7867, 0x7868, 0x7869, 0x786F, 0x7870, + 0x7871, 0x7872, 0x7873, 0x7874, 0x7875, 0x7876, 0x7878, 0x7879, + 0x787A, 0x787B, 0x787D, 0x787E, 0x787F, 0x7880, 0x7881, 0x7882, + 0x7883, 0x573A, 0x5C1D, 0x5E38, 0x957F, 0x507F, 0x80A0, 0x5382, + 0x655E, 0x7545, 0x5531, 0x5021, 0x8D85, 0x6284, 0x949E, 0x671D, + 0x5632, 0x6F6E, 0x5DE2, 0x5435, 0x7092, 0x8F66, 0x626F, 0x64A4, + 0x63A3, 0x5F7B, 0x6F88, 0x90F4, 0x81E3, 0x8FB0, 0x5C18, 0x6668, + 0x5FF1, 0x6C89, 0x9648, 0x8D81, 0x886C, 0x6491, 0x79F0, 0x57CE, + 0x6A59, 0x6210, 0x5448, 0x4E58, 0x7A0B, 0x60E9, 0x6F84, 0x8BDA, + 0x627F, 0x901E, 0x9A8B, 0x79E4, 0x5403, 0x75F4, 0x6301, 0x5319, + 0x6C60, 0x8FDF, 0x5F1B, 0x9A70, 0x803B, 0x9F7F, 0x4F88, 0x5C3A, + 0x8D64, 0x7FC5, 0x65A5, 0x70BD, 0x5145, 0x51B2, 0x866B, 0x5D07, + 0x5BA0, 0x62BD, 0x916C, 0x7574, 0x8E0C, 0x7A20, 0x6101, 0x7B79, + 0x4EC7, 0x7EF8, 0x7785, 0x4E11, 0x81ED, 0x521D, 0x51FA, 0x6A71, + 0x53A8, 0x8E87, 0x9504, 0x96CF, 0x6EC1, 0x9664, 0x695A, ALTCHR, +/* 0xB440 - 0xB4FF */ + 0x7884, 0x7885, 0x7886, 0x7888, 0x788A, 0x788B, 0x788F, 0x7890, + 0x7892, 0x7894, 0x7895, 0x7896, 0x7899, 0x789D, 0x789E, 0x78A0, + 0x78A2, 0x78A4, 0x78A6, 0x78A8, 0x78A9, 0x78AA, 0x78AB, 0x78AC, + 0x78AD, 0x78AE, 0x78AF, 0x78B5, 0x78B6, 0x78B7, 0x78B8, 0x78BA, + 0x78BB, 0x78BC, 0x78BD, 0x78BF, 0x78C0, 0x78C2, 0x78C3, 0x78C4, + 0x78C6, 0x78C7, 0x78C8, 0x78CC, 0x78CD, 0x78CE, 0x78CF, 0x78D1, + 0x78D2, 0x78D3, 0x78D6, 0x78D7, 0x78D8, 0x78DA, 0x78DB, 0x78DC, + 0x78DD, 0x78DE, 0x78DF, 0x78E0, 0x78E1, 0x78E2, 0x78E3, ALTCHR, + 0x78E4, 0x78E5, 0x78E6, 0x78E7, 0x78E9, 0x78EA, 0x78EB, 0x78ED, + 0x78EE, 0x78EF, 0x78F0, 0x78F1, 0x78F3, 0x78F5, 0x78F6, 0x78F8, + 0x78F9, 0x78FB, 0x78FC, 0x78FD, 0x78FE, 0x78FF, 0x7900, 0x7902, + 0x7903, 0x7904, 0x7906, 0x7907, 0x7908, 0x7909, 0x790A, 0x790B, + 0x790C, 0x7840, 0x50A8, 0x77D7, 0x6410, 0x89E6, 0x5904, 0x63E3, + 0x5DDD, 0x7A7F, 0x693D, 0x4F20, 0x8239, 0x5598, 0x4E32, 0x75AE, + 0x7A97, 0x5E62, 0x5E8A, 0x95EF, 0x521B, 0x5439, 0x708A, 0x6376, + 0x9524, 0x5782, 0x6625, 0x693F, 0x9187, 0x5507, 0x6DF3, 0x7EAF, + 0x8822, 0x6233, 0x7EF0, 0x75B5, 0x8328, 0x78C1, 0x96CC, 0x8F9E, + 0x6148, 0x74F7, 0x8BCD, 0x6B64, 0x523A, 0x8D50, 0x6B21, 0x806A, + 0x8471, 0x56F1, 0x5306, 0x4ECE, 0x4E1B, 0x51D1, 0x7C97, 0x918B, + 0x7C07, 0x4FC3, 0x8E7F, 0x7BE1, 0x7A9C, 0x6467, 0x5D14, 0x50AC, + 0x8106, 0x7601, 0x7CB9, 0x6DEC, 0x7FE0, 0x6751, 0x5B58, 0x5BF8, + 0x78CB, 0x64AE, 0x6413, 0x63AA, 0x632B, 0x9519, 0x642D, 0x8FBE, + 0x7B54, 0x7629, 0x6253, 0x5927, 0x5446, 0x6B79, 0x50A3, 0x6234, + 0x5E26, 0x6B86, 0x4EE3, 0x8D37, 0x888B, 0x5F85, 0x902E, ALTCHR, +/* 0xB540 - 0xB5FF */ + 0x790D, 0x790E, 0x790F, 0x7910, 0x7911, 0x7912, 0x7914, 0x7915, + 0x7916, 0x7917, 0x7918, 0x7919, 0x791A, 0x791B, 0x791C, 0x791D, + 0x791F, 0x7920, 0x7921, 0x7922, 0x7923, 0x7925, 0x7926, 0x7927, + 0x7928, 0x7929, 0x792A, 0x792B, 0x792C, 0x792D, 0x792E, 0x792F, + 0x7930, 0x7931, 0x7932, 0x7933, 0x7935, 0x7936, 0x7937, 0x7938, + 0x7939, 0x793D, 0x793F, 0x7942, 0x7943, 0x7944, 0x7945, 0x7947, + 0x794A, 0x794B, 0x794C, 0x794D, 0x794E, 0x794F, 0x7950, 0x7951, + 0x7952, 0x7954, 0x7955, 0x7958, 0x7959, 0x7961, 0x7963, ALTCHR, + 0x7964, 0x7966, 0x7969, 0x796A, 0x796B, 0x796C, 0x796E, 0x7970, + 0x7971, 0x7972, 0x7973, 0x7974, 0x7975, 0x7976, 0x7979, 0x797B, + 0x797C, 0x797D, 0x797E, 0x797F, 0x7982, 0x7983, 0x7986, 0x7987, + 0x7988, 0x7989, 0x798B, 0x798C, 0x798D, 0x798E, 0x7990, 0x7991, + 0x7992, 0x6020, 0x803D, 0x62C5, 0x4E39, 0x5355, 0x90F8, 0x63B8, + 0x80C6, 0x65E6, 0x6C2E, 0x4F46, 0x60EE, 0x6DE1, 0x8BDE, 0x5F39, + 0x86CB, 0x5F53, 0x6321, 0x515A, 0x8361, 0x6863, 0x5200, 0x6363, + 0x8E48, 0x5012, 0x5C9B, 0x7977, 0x5BFC, 0x5230, 0x7A3B, 0x60BC, + 0x9053, 0x76D7, 0x5FB7, 0x5F97, 0x7684, 0x8E6C, 0x706F, 0x767B, + 0x7B49, 0x77AA, 0x51F3, 0x9093, 0x5824, 0x4F4E, 0x6EF4, 0x8FEA, + 0x654C, 0x7B1B, 0x72C4, 0x6DA4, 0x7FDF, 0x5AE1, 0x62B5, 0x5E95, + 0x5730, 0x8482, 0x7B2C, 0x5E1D, 0x5F1F, 0x9012, 0x7F14, 0x98A0, + 0x6382, 0x6EC7, 0x7898, 0x70B9, 0x5178, 0x975B, 0x57AB, 0x7535, + 0x4F43, 0x7538, 0x5E97, 0x60E6, 0x5960, 0x6DC0, 0x6BBF, 0x7889, + 0x53FC, 0x96D5, 0x51CB, 0x5201, 0x6389, 0x540A, 0x9493, 0x8C03, + 0x8DCC, 0x7239, 0x789F, 0x8776, 0x8FED, 0x8C0D, 0x53E0, ALTCHR, +/* 0xB640 - 0xB6FF */ + 0x7993, 0x7994, 0x7995, 0x7996, 0x7997, 0x7998, 0x7999, 0x799B, + 0x799C, 0x799D, 0x799E, 0x799F, 0x79A0, 0x79A1, 0x79A2, 0x79A3, + 0x79A4, 0x79A5, 0x79A6, 0x79A8, 0x79A9, 0x79AA, 0x79AB, 0x79AC, + 0x79AD, 0x79AE, 0x79AF, 0x79B0, 0x79B1, 0x79B2, 0x79B4, 0x79B5, + 0x79B6, 0x79B7, 0x79B8, 0x79BC, 0x79BF, 0x79C2, 0x79C4, 0x79C5, + 0x79C7, 0x79C8, 0x79CA, 0x79CC, 0x79CE, 0x79CF, 0x79D0, 0x79D3, + 0x79D4, 0x79D6, 0x79D7, 0x79D9, 0x79DA, 0x79DB, 0x79DC, 0x79DD, + 0x79DE, 0x79E0, 0x79E1, 0x79E2, 0x79E5, 0x79E8, 0x79EA, ALTCHR, + 0x79EC, 0x79EE, 0x79F1, 0x79F2, 0x79F3, 0x79F4, 0x79F5, 0x79F6, + 0x79F7, 0x79F9, 0x79FA, 0x79FC, 0x79FE, 0x79FF, 0x7A01, 0x7A04, + 0x7A05, 0x7A07, 0x7A08, 0x7A09, 0x7A0A, 0x7A0C, 0x7A0F, 0x7A10, + 0x7A11, 0x7A12, 0x7A13, 0x7A15, 0x7A16, 0x7A18, 0x7A19, 0x7A1B, + 0x7A1C, 0x4E01, 0x76EF, 0x53EE, 0x9489, 0x9876, 0x9F0E, 0x952D, + 0x5B9A, 0x8BA2, 0x4E22, 0x4E1C, 0x51AC, 0x8463, 0x61C2, 0x52A8, + 0x680B, 0x4F97, 0x606B, 0x51BB, 0x6D1E, 0x515C, 0x6296, 0x6597, + 0x9661, 0x8C46, 0x9017, 0x75D8, 0x90FD, 0x7763, 0x6BD2, 0x728A, + 0x72EC, 0x8BFB, 0x5835, 0x7779, 0x8D4C, 0x675C, 0x9540, 0x809A, + 0x5EA6, 0x6E21, 0x5992, 0x7AEF, 0x77ED, 0x953B, 0x6BB5, 0x65AD, + 0x7F0E, 0x5806, 0x5151, 0x961F, 0x5BF9, 0x58A9, 0x5428, 0x8E72, + 0x6566, 0x987F, 0x56E4, 0x949D, 0x76FE, 0x9041, 0x6387, 0x54C6, + 0x591A, 0x593A, 0x579B, 0x8EB2, 0x6735, 0x8DFA, 0x8235, 0x5241, + 0x60F0, 0x5815, 0x86FE, 0x5CE8, 0x9E45, 0x4FC4, 0x989D, 0x8BB9, + 0x5A25, 0x6076, 0x5384, 0x627C, 0x904F, 0x9102, 0x997F, 0x6069, + 0x800C, 0x513F, 0x8033, 0x5C14, 0x9975, 0x6D31, 0x4E8C, ALTCHR, +/* 0xB740 - 0xB7FF */ + 0x7A1D, 0x7A1F, 0x7A21, 0x7A22, 0x7A24, 0x7A25, 0x7A26, 0x7A27, + 0x7A28, 0x7A29, 0x7A2A, 0x7A2B, 0x7A2C, 0x7A2D, 0x7A2E, 0x7A2F, + 0x7A30, 0x7A31, 0x7A32, 0x7A34, 0x7A35, 0x7A36, 0x7A38, 0x7A3A, + 0x7A3E, 0x7A40, 0x7A41, 0x7A42, 0x7A43, 0x7A44, 0x7A45, 0x7A47, + 0x7A48, 0x7A49, 0x7A4A, 0x7A4B, 0x7A4C, 0x7A4D, 0x7A4E, 0x7A4F, + 0x7A50, 0x7A52, 0x7A53, 0x7A54, 0x7A55, 0x7A56, 0x7A58, 0x7A59, + 0x7A5A, 0x7A5B, 0x7A5C, 0x7A5D, 0x7A5E, 0x7A5F, 0x7A60, 0x7A61, + 0x7A62, 0x7A63, 0x7A64, 0x7A65, 0x7A66, 0x7A67, 0x7A68, ALTCHR, + 0x7A69, 0x7A6A, 0x7A6B, 0x7A6C, 0x7A6D, 0x7A6E, 0x7A6F, 0x7A71, + 0x7A72, 0x7A73, 0x7A75, 0x7A7B, 0x7A7C, 0x7A7D, 0x7A7E, 0x7A82, + 0x7A85, 0x7A87, 0x7A89, 0x7A8A, 0x7A8B, 0x7A8C, 0x7A8E, 0x7A8F, + 0x7A90, 0x7A93, 0x7A94, 0x7A99, 0x7A9A, 0x7A9B, 0x7A9E, 0x7AA1, + 0x7AA2, 0x8D30, 0x53D1, 0x7F5A, 0x7B4F, 0x4F10, 0x4E4F, 0x9600, + 0x6CD5, 0x73D0, 0x85E9, 0x5E06, 0x756A, 0x7FFB, 0x6A0A, 0x77FE, + 0x9492, 0x7E41, 0x51E1, 0x70E6, 0x53CD, 0x8FD4, 0x8303, 0x8D29, + 0x72AF, 0x996D, 0x6CDB, 0x574A, 0x82B3, 0x65B9, 0x80AA, 0x623F, + 0x9632, 0x59A8, 0x4EFF, 0x8BBF, 0x7EBA, 0x653E, 0x83F2, 0x975E, + 0x5561, 0x98DE, 0x80A5, 0x532A, 0x8BFD, 0x5420, 0x80BA, 0x5E9F, + 0x6CB8, 0x8D39, 0x82AC, 0x915A, 0x5429, 0x6C1B, 0x5206, 0x7EB7, + 0x575F, 0x711A, 0x6C7E, 0x7C89, 0x594B, 0x4EFD, 0x5FFF, 0x6124, + 0x7CAA, 0x4E30, 0x5C01, 0x67AB, 0x8702, 0x5CF0, 0x950B, 0x98CE, + 0x75AF, 0x70FD, 0x9022, 0x51AF, 0x7F1D, 0x8BBD, 0x5949, 0x51E4, + 0x4F5B, 0x5426, 0x592B, 0x6577, 0x80A4, 0x5B75, 0x6276, 0x62C2, + 0x8F90, 0x5E45, 0x6C1F, 0x7B26, 0x4F0F, 0x4FD8, 0x670D, ALTCHR, +/* 0xB840 - 0xB8FF */ + 0x7AA3, 0x7AA4, 0x7AA7, 0x7AA9, 0x7AAA, 0x7AAB, 0x7AAE, 0x7AAF, + 0x7AB0, 0x7AB1, 0x7AB2, 0x7AB4, 0x7AB5, 0x7AB6, 0x7AB7, 0x7AB8, + 0x7AB9, 0x7ABA, 0x7ABB, 0x7ABC, 0x7ABD, 0x7ABE, 0x7AC0, 0x7AC1, + 0x7AC2, 0x7AC3, 0x7AC4, 0x7AC5, 0x7AC6, 0x7AC7, 0x7AC8, 0x7AC9, + 0x7ACA, 0x7ACC, 0x7ACD, 0x7ACE, 0x7ACF, 0x7AD0, 0x7AD1, 0x7AD2, + 0x7AD3, 0x7AD4, 0x7AD5, 0x7AD7, 0x7AD8, 0x7ADA, 0x7ADB, 0x7ADC, + 0x7ADD, 0x7AE1, 0x7AE2, 0x7AE4, 0x7AE7, 0x7AE8, 0x7AE9, 0x7AEA, + 0x7AEB, 0x7AEC, 0x7AEE, 0x7AF0, 0x7AF1, 0x7AF2, 0x7AF3, ALTCHR, + 0x7AF4, 0x7AF5, 0x7AF6, 0x7AF7, 0x7AF8, 0x7AFB, 0x7AFC, 0x7AFE, + 0x7B00, 0x7B01, 0x7B02, 0x7B05, 0x7B07, 0x7B09, 0x7B0C, 0x7B0D, + 0x7B0E, 0x7B10, 0x7B12, 0x7B13, 0x7B16, 0x7B17, 0x7B18, 0x7B1A, + 0x7B1C, 0x7B1D, 0x7B1F, 0x7B21, 0x7B22, 0x7B23, 0x7B27, 0x7B29, + 0x7B2D, 0x6D6E, 0x6DAA, 0x798F, 0x88B1, 0x5F17, 0x752B, 0x629A, + 0x8F85, 0x4FEF, 0x91DC, 0x65A7, 0x812F, 0x8151, 0x5E9C, 0x8150, + 0x8D74, 0x526F, 0x8986, 0x8D4B, 0x590D, 0x5085, 0x4ED8, 0x961C, + 0x7236, 0x8179, 0x8D1F, 0x5BCC, 0x8BA3, 0x9644, 0x5987, 0x7F1A, + 0x5490, 0x5676, 0x560E, 0x8BE5, 0x6539, 0x6982, 0x9499, 0x76D6, + 0x6E89, 0x5E72, 0x7518, 0x6746, 0x67D1, 0x7AFF, 0x809D, 0x8D76, + 0x611F, 0x79C6, 0x6562, 0x8D63, 0x5188, 0x521A, 0x94A2, 0x7F38, + 0x809B, 0x7EB2, 0x5C97, 0x6E2F, 0x6760, 0x7BD9, 0x768B, 0x9AD8, + 0x818F, 0x7F94, 0x7CD5, 0x641E, 0x9550, 0x7A3F, 0x544A, 0x54E5, + 0x6B4C, 0x6401, 0x6208, 0x9E3D, 0x80F3, 0x7599, 0x5272, 0x9769, + 0x845B, 0x683C, 0x86E4, 0x9601, 0x9694, 0x94EC, 0x4E2A, 0x5404, + 0x7ED9, 0x6839, 0x8DDF, 0x8015, 0x66F4, 0x5E9A, 0x7FB9, ALTCHR, +/* 0xB940 - 0xB9FF */ + 0x7B2F, 0x7B30, 0x7B32, 0x7B34, 0x7B35, 0x7B36, 0x7B37, 0x7B39, + 0x7B3B, 0x7B3D, 0x7B3F, 0x7B40, 0x7B41, 0x7B42, 0x7B43, 0x7B44, + 0x7B46, 0x7B48, 0x7B4A, 0x7B4D, 0x7B4E, 0x7B53, 0x7B55, 0x7B57, + 0x7B59, 0x7B5C, 0x7B5E, 0x7B5F, 0x7B61, 0x7B63, 0x7B64, 0x7B65, + 0x7B66, 0x7B67, 0x7B68, 0x7B69, 0x7B6A, 0x7B6B, 0x7B6C, 0x7B6D, + 0x7B6F, 0x7B70, 0x7B73, 0x7B74, 0x7B76, 0x7B78, 0x7B7A, 0x7B7C, + 0x7B7D, 0x7B7F, 0x7B81, 0x7B82, 0x7B83, 0x7B84, 0x7B86, 0x7B87, + 0x7B88, 0x7B89, 0x7B8A, 0x7B8B, 0x7B8C, 0x7B8E, 0x7B8F, ALTCHR, + 0x7B91, 0x7B92, 0x7B93, 0x7B96, 0x7B98, 0x7B99, 0x7B9A, 0x7B9B, + 0x7B9E, 0x7B9F, 0x7BA0, 0x7BA3, 0x7BA4, 0x7BA5, 0x7BAE, 0x7BAF, + 0x7BB0, 0x7BB2, 0x7BB3, 0x7BB5, 0x7BB6, 0x7BB7, 0x7BB9, 0x7BBA, + 0x7BBB, 0x7BBC, 0x7BBD, 0x7BBE, 0x7BBF, 0x7BC0, 0x7BC2, 0x7BC3, + 0x7BC4, 0x57C2, 0x803F, 0x6897, 0x5DE5, 0x653B, 0x529F, 0x606D, + 0x9F9A, 0x4F9B, 0x8EAC, 0x516C, 0x5BAB, 0x5F13, 0x5DE9, 0x6C5E, + 0x62F1, 0x8D21, 0x5171, 0x94A9, 0x52FE, 0x6C9F, 0x82DF, 0x72D7, + 0x57A2, 0x6784, 0x8D2D, 0x591F, 0x8F9C, 0x83C7, 0x5495, 0x7B8D, + 0x4F30, 0x6CBD, 0x5B64, 0x59D1, 0x9F13, 0x53E4, 0x86CA, 0x9AA8, + 0x8C37, 0x80A1, 0x6545, 0x987E, 0x56FA, 0x96C7, 0x522E, 0x74DC, + 0x5250, 0x5BE1, 0x6302, 0x8902, 0x4E56, 0x62D0, 0x602A, 0x68FA, + 0x5173, 0x5B98, 0x51A0, 0x89C2, 0x7BA1, 0x9986, 0x7F50, 0x60EF, + 0x704C, 0x8D2F, 0x5149, 0x5E7F, 0x901B, 0x7470, 0x89C4, 0x572D, + 0x7845, 0x5F52, 0x9F9F, 0x95FA, 0x8F68, 0x9B3C, 0x8BE1, 0x7678, + 0x6842, 0x67DC, 0x8DEA, 0x8D35, 0x523D, 0x8F8A, 0x6EDA, 0x68CD, + 0x9505, 0x90ED, 0x56FD, 0x679C, 0x88F9, 0x8FC7, 0x54C8, ALTCHR, +/* 0xBA40 - 0xBAFF */ + 0x7BC5, 0x7BC8, 0x7BC9, 0x7BCA, 0x7BCB, 0x7BCD, 0x7BCE, 0x7BCF, + 0x7BD0, 0x7BD2, 0x7BD4, 0x7BD5, 0x7BD6, 0x7BD7, 0x7BD8, 0x7BDB, + 0x7BDC, 0x7BDE, 0x7BDF, 0x7BE0, 0x7BE2, 0x7BE3, 0x7BE4, 0x7BE7, + 0x7BE8, 0x7BE9, 0x7BEB, 0x7BEC, 0x7BED, 0x7BEF, 0x7BF0, 0x7BF2, + 0x7BF3, 0x7BF4, 0x7BF5, 0x7BF6, 0x7BF8, 0x7BF9, 0x7BFA, 0x7BFB, + 0x7BFD, 0x7BFF, 0x7C00, 0x7C01, 0x7C02, 0x7C03, 0x7C04, 0x7C05, + 0x7C06, 0x7C08, 0x7C09, 0x7C0A, 0x7C0D, 0x7C0E, 0x7C10, 0x7C11, + 0x7C12, 0x7C13, 0x7C14, 0x7C15, 0x7C17, 0x7C18, 0x7C19, ALTCHR, + 0x7C1A, 0x7C1B, 0x7C1C, 0x7C1D, 0x7C1E, 0x7C20, 0x7C21, 0x7C22, + 0x7C23, 0x7C24, 0x7C25, 0x7C28, 0x7C29, 0x7C2B, 0x7C2C, 0x7C2D, + 0x7C2E, 0x7C2F, 0x7C30, 0x7C31, 0x7C32, 0x7C33, 0x7C34, 0x7C35, + 0x7C36, 0x7C37, 0x7C39, 0x7C3A, 0x7C3B, 0x7C3C, 0x7C3D, 0x7C3E, + 0x7C42, 0x9AB8, 0x5B69, 0x6D77, 0x6C26, 0x4EA5, 0x5BB3, 0x9A87, + 0x9163, 0x61A8, 0x90AF, 0x97E9, 0x542B, 0x6DB5, 0x5BD2, 0x51FD, + 0x558A, 0x7F55, 0x7FF0, 0x64BC, 0x634D, 0x65F1, 0x61BE, 0x608D, + 0x710A, 0x6C57, 0x6C49, 0x592F, 0x676D, 0x822A, 0x58D5, 0x568E, + 0x8C6A, 0x6BEB, 0x90DD, 0x597D, 0x8017, 0x53F7, 0x6D69, 0x5475, + 0x559D, 0x8377, 0x83CF, 0x6838, 0x79BE, 0x548C, 0x4F55, 0x5408, + 0x76D2, 0x8C89, 0x9602, 0x6CB3, 0x6DB8, 0x8D6B, 0x8910, 0x9E64, + 0x8D3A, 0x563F, 0x9ED1, 0x75D5, 0x5F88, 0x72E0, 0x6068, 0x54FC, + 0x4EA8, 0x6A2A, 0x8861, 0x6052, 0x8F70, 0x54C4, 0x70D8, 0x8679, + 0x9E3F, 0x6D2A, 0x5B8F, 0x5F18, 0x7EA2, 0x5589, 0x4FAF, 0x7334, + 0x543C, 0x539A, 0x5019, 0x540E, 0x547C, 0x4E4E, 0x5FFD, 0x745A, + 0x58F6, 0x846B, 0x80E1, 0x8774, 0x72D0, 0x7CCA, 0x6E56, ALTCHR, +/* 0xBB40 - 0xBBFF */ + 0x7C43, 0x7C44, 0x7C45, 0x7C46, 0x7C47, 0x7C48, 0x7C49, 0x7C4A, + 0x7C4B, 0x7C4C, 0x7C4E, 0x7C4F, 0x7C50, 0x7C51, 0x7C52, 0x7C53, + 0x7C54, 0x7C55, 0x7C56, 0x7C57, 0x7C58, 0x7C59, 0x7C5A, 0x7C5B, + 0x7C5C, 0x7C5D, 0x7C5E, 0x7C5F, 0x7C60, 0x7C61, 0x7C62, 0x7C63, + 0x7C64, 0x7C65, 0x7C66, 0x7C67, 0x7C68, 0x7C69, 0x7C6A, 0x7C6B, + 0x7C6C, 0x7C6D, 0x7C6E, 0x7C6F, 0x7C70, 0x7C71, 0x7C72, 0x7C75, + 0x7C76, 0x7C77, 0x7C78, 0x7C79, 0x7C7A, 0x7C7E, 0x7C7F, 0x7C80, + 0x7C81, 0x7C82, 0x7C83, 0x7C84, 0x7C85, 0x7C86, 0x7C87, ALTCHR, + 0x7C88, 0x7C8A, 0x7C8B, 0x7C8C, 0x7C8D, 0x7C8E, 0x7C8F, 0x7C90, + 0x7C93, 0x7C94, 0x7C96, 0x7C99, 0x7C9A, 0x7C9B, 0x7CA0, 0x7CA1, + 0x7CA3, 0x7CA6, 0x7CA7, 0x7CA8, 0x7CA9, 0x7CAB, 0x7CAC, 0x7CAD, + 0x7CAF, 0x7CB0, 0x7CB4, 0x7CB5, 0x7CB6, 0x7CB7, 0x7CB8, 0x7CBA, + 0x7CBB, 0x5F27, 0x864E, 0x552C, 0x62A4, 0x4E92, 0x6CAA, 0x6237, + 0x82B1, 0x54D7, 0x534E, 0x733E, 0x6ED1, 0x753B, 0x5212, 0x5316, + 0x8BDD, 0x69D0, 0x5F8A, 0x6000, 0x6DEE, 0x574F, 0x6B22, 0x73AF, + 0x6853, 0x8FD8, 0x7F13, 0x6362, 0x60A3, 0x5524, 0x75EA, 0x8C62, + 0x7115, 0x6DA3, 0x5BA6, 0x5E7B, 0x8352, 0x614C, 0x9EC4, 0x78FA, + 0x8757, 0x7C27, 0x7687, 0x51F0, 0x60F6, 0x714C, 0x6643, 0x5E4C, + 0x604D, 0x8C0E, 0x7070, 0x6325, 0x8F89, 0x5FBD, 0x6062, 0x86D4, + 0x56DE, 0x6BC1, 0x6094, 0x6167, 0x5349, 0x60E0, 0x6666, 0x8D3F, + 0x79FD, 0x4F1A, 0x70E9, 0x6C47, 0x8BB3, 0x8BF2, 0x7ED8, 0x8364, + 0x660F, 0x5A5A, 0x9B42, 0x6D51, 0x6DF7, 0x8C41, 0x6D3B, 0x4F19, + 0x706B, 0x83B7, 0x6216, 0x60D1, 0x970D, 0x8D27, 0x7978, 0x51FB, + 0x573E, 0x57FA, 0x673A, 0x7578, 0x7A3D, 0x79EF, 0x7B95, ALTCHR, +/* 0xBC40 - 0xBCFF */ + 0x7CBF, 0x7CC0, 0x7CC2, 0x7CC3, 0x7CC4, 0x7CC6, 0x7CC9, 0x7CCB, + 0x7CCE, 0x7CCF, 0x7CD0, 0x7CD1, 0x7CD2, 0x7CD3, 0x7CD4, 0x7CD8, + 0x7CDA, 0x7CDB, 0x7CDD, 0x7CDE, 0x7CE1, 0x7CE2, 0x7CE3, 0x7CE4, + 0x7CE5, 0x7CE6, 0x7CE7, 0x7CE9, 0x7CEA, 0x7CEB, 0x7CEC, 0x7CED, + 0x7CEE, 0x7CF0, 0x7CF1, 0x7CF2, 0x7CF3, 0x7CF4, 0x7CF5, 0x7CF6, + 0x7CF7, 0x7CF9, 0x7CFA, 0x7CFC, 0x7CFD, 0x7CFE, 0x7CFF, 0x7D00, + 0x7D01, 0x7D02, 0x7D03, 0x7D04, 0x7D05, 0x7D06, 0x7D07, 0x7D08, + 0x7D09, 0x7D0B, 0x7D0C, 0x7D0D, 0x7D0E, 0x7D0F, 0x7D10, ALTCHR, + 0x7D11, 0x7D12, 0x7D13, 0x7D14, 0x7D15, 0x7D16, 0x7D17, 0x7D18, + 0x7D19, 0x7D1A, 0x7D1B, 0x7D1C, 0x7D1D, 0x7D1E, 0x7D1F, 0x7D21, + 0x7D23, 0x7D24, 0x7D25, 0x7D26, 0x7D28, 0x7D29, 0x7D2A, 0x7D2C, + 0x7D2D, 0x7D2E, 0x7D30, 0x7D31, 0x7D32, 0x7D33, 0x7D34, 0x7D35, + 0x7D36, 0x808C, 0x9965, 0x8FF9, 0x6FC0, 0x8BA5, 0x9E21, 0x59EC, + 0x7EE9, 0x7F09, 0x5409, 0x6781, 0x68D8, 0x8F91, 0x7C4D, 0x96C6, + 0x53CA, 0x6025, 0x75BE, 0x6C72, 0x5373, 0x5AC9, 0x7EA7, 0x6324, + 0x51E0, 0x810A, 0x5DF1, 0x84DF, 0x6280, 0x5180, 0x5B63, 0x4F0E, + 0x796D, 0x5242, 0x60B8, 0x6D4E, 0x5BC4, 0x5BC2, 0x8BA1, 0x8BB0, + 0x65E2, 0x5FCC, 0x9645, 0x5993, 0x7EE7, 0x7EAA, 0x5609, 0x67B7, + 0x5939, 0x4F73, 0x5BB6, 0x52A0, 0x835A, 0x988A, 0x8D3E, 0x7532, + 0x94BE, 0x5047, 0x7A3C, 0x4EF7, 0x67B6, 0x9A7E, 0x5AC1, 0x6B7C, + 0x76D1, 0x575A, 0x5C16, 0x7B3A, 0x95F4, 0x714E, 0x517C, 0x80A9, + 0x8270, 0x5978, 0x7F04, 0x8327, 0x68C0, 0x67EC, 0x78B1, 0x7877, + 0x62E3, 0x6361, 0x7B80, 0x4FED, 0x526A, 0x51CF, 0x8350, 0x69DB, + 0x9274, 0x8DF5, 0x8D31, 0x89C1, 0x952E, 0x7BAD, 0x4EF6, ALTCHR, +/* 0xBD40 - 0xBDFF */ + 0x7D37, 0x7D38, 0x7D39, 0x7D3A, 0x7D3B, 0x7D3C, 0x7D3D, 0x7D3E, + 0x7D3F, 0x7D40, 0x7D41, 0x7D42, 0x7D43, 0x7D44, 0x7D45, 0x7D46, + 0x7D47, 0x7D48, 0x7D49, 0x7D4A, 0x7D4B, 0x7D4C, 0x7D4D, 0x7D4E, + 0x7D4F, 0x7D50, 0x7D51, 0x7D52, 0x7D53, 0x7D54, 0x7D55, 0x7D56, + 0x7D57, 0x7D58, 0x7D59, 0x7D5A, 0x7D5B, 0x7D5C, 0x7D5D, 0x7D5E, + 0x7D5F, 0x7D60, 0x7D61, 0x7D62, 0x7D63, 0x7D64, 0x7D65, 0x7D66, + 0x7D67, 0x7D68, 0x7D69, 0x7D6A, 0x7D6B, 0x7D6C, 0x7D6D, 0x7D6F, + 0x7D70, 0x7D71, 0x7D72, 0x7D73, 0x7D74, 0x7D75, 0x7D76, ALTCHR, + 0x7D78, 0x7D79, 0x7D7A, 0x7D7B, 0x7D7C, 0x7D7D, 0x7D7E, 0x7D7F, + 0x7D80, 0x7D81, 0x7D82, 0x7D83, 0x7D84, 0x7D85, 0x7D86, 0x7D87, + 0x7D88, 0x7D89, 0x7D8A, 0x7D8B, 0x7D8C, 0x7D8D, 0x7D8E, 0x7D8F, + 0x7D90, 0x7D91, 0x7D92, 0x7D93, 0x7D94, 0x7D95, 0x7D96, 0x7D97, + 0x7D98, 0x5065, 0x8230, 0x5251, 0x996F, 0x6E10, 0x6E85, 0x6DA7, + 0x5EFA, 0x50F5, 0x59DC, 0x5C06, 0x6D46, 0x6C5F, 0x7586, 0x848B, + 0x6868, 0x5956, 0x8BB2, 0x5320, 0x9171, 0x964D, 0x8549, 0x6912, + 0x7901, 0x7126, 0x80F6, 0x4EA4, 0x90CA, 0x6D47, 0x9A84, 0x5A07, + 0x56BC, 0x6405, 0x94F0, 0x77EB, 0x4FA5, 0x811A, 0x72E1, 0x89D2, + 0x997A, 0x7F34, 0x7EDE, 0x527F, 0x6559, 0x9175, 0x8F7F, 0x8F83, + 0x53EB, 0x7A96, 0x63ED, 0x63A5, 0x7686, 0x79F8, 0x8857, 0x9636, + 0x622A, 0x52AB, 0x8282, 0x6854, 0x6770, 0x6377, 0x776B, 0x7AED, + 0x6D01, 0x7ED3, 0x89E3, 0x59D0, 0x6212, 0x85C9, 0x82A5, 0x754C, + 0x501F, 0x4ECB, 0x75A5, 0x8BEB, 0x5C4A, 0x5DFE, 0x7B4B, 0x65A4, + 0x91D1, 0x4ECA, 0x6D25, 0x895F, 0x7D27, 0x9526, 0x4EC5, 0x8C28, + 0x8FDB, 0x9773, 0x664B, 0x7981, 0x8FD1, 0x70EC, 0x6D78, ALTCHR, +/* 0xBE40 - 0xBEFF */ + 0x7D99, 0x7D9A, 0x7D9B, 0x7D9C, 0x7D9D, 0x7D9E, 0x7D9F, 0x7DA0, + 0x7DA1, 0x7DA2, 0x7DA3, 0x7DA4, 0x7DA5, 0x7DA7, 0x7DA8, 0x7DA9, + 0x7DAA, 0x7DAB, 0x7DAC, 0x7DAD, 0x7DAF, 0x7DB0, 0x7DB1, 0x7DB2, + 0x7DB3, 0x7DB4, 0x7DB5, 0x7DB6, 0x7DB7, 0x7DB8, 0x7DB9, 0x7DBA, + 0x7DBB, 0x7DBC, 0x7DBD, 0x7DBE, 0x7DBF, 0x7DC0, 0x7DC1, 0x7DC2, + 0x7DC3, 0x7DC4, 0x7DC5, 0x7DC6, 0x7DC7, 0x7DC8, 0x7DC9, 0x7DCA, + 0x7DCB, 0x7DCC, 0x7DCD, 0x7DCE, 0x7DCF, 0x7DD0, 0x7DD1, 0x7DD2, + 0x7DD3, 0x7DD4, 0x7DD5, 0x7DD6, 0x7DD7, 0x7DD8, 0x7DD9, ALTCHR, + 0x7DDA, 0x7DDB, 0x7DDC, 0x7DDD, 0x7DDE, 0x7DDF, 0x7DE0, 0x7DE1, + 0x7DE2, 0x7DE3, 0x7DE4, 0x7DE5, 0x7DE6, 0x7DE7, 0x7DE8, 0x7DE9, + 0x7DEA, 0x7DEB, 0x7DEC, 0x7DED, 0x7DEE, 0x7DEF, 0x7DF0, 0x7DF1, + 0x7DF2, 0x7DF3, 0x7DF4, 0x7DF5, 0x7DF6, 0x7DF7, 0x7DF8, 0x7DF9, + 0x7DFA, 0x5C3D, 0x52B2, 0x8346, 0x5162, 0x830E, 0x775B, 0x6676, + 0x9CB8, 0x4EAC, 0x60CA, 0x7CBE, 0x7CB3, 0x7ECF, 0x4E95, 0x8B66, + 0x666F, 0x9888, 0x9759, 0x5883, 0x656C, 0x955C, 0x5F84, 0x75C9, + 0x9756, 0x7ADF, 0x7ADE, 0x51C0, 0x70AF, 0x7A98, 0x63EA, 0x7A76, + 0x7EA0, 0x7396, 0x97ED, 0x4E45, 0x7078, 0x4E5D, 0x9152, 0x53A9, + 0x6551, 0x65E7, 0x81FC, 0x8205, 0x548E, 0x5C31, 0x759A, 0x97A0, + 0x62D8, 0x72D9, 0x75BD, 0x5C45, 0x9A79, 0x83CA, 0x5C40, 0x5480, + 0x77E9, 0x4E3E, 0x6CAE, 0x805A, 0x62D2, 0x636E, 0x5DE8, 0x5177, + 0x8DDD, 0x8E1E, 0x952F, 0x4FF1, 0x53E5, 0x60E7, 0x70AC, 0x5267, + 0x6350, 0x9E43, 0x5A1F, 0x5026, 0x7737, 0x5377, 0x7EE2, 0x6485, + 0x652B, 0x6289, 0x6398, 0x5014, 0x7235, 0x89C9, 0x51B3, 0x8BC0, + 0x7EDD, 0x5747, 0x83CC, 0x94A7, 0x519B, 0x541B, 0x5CFB, ALTCHR, +/* 0xBF40 - 0xBFFF */ + 0x7DFB, 0x7DFC, 0x7DFD, 0x7DFE, 0x7DFF, 0x7E00, 0x7E01, 0x7E02, + 0x7E03, 0x7E04, 0x7E05, 0x7E06, 0x7E07, 0x7E08, 0x7E09, 0x7E0A, + 0x7E0B, 0x7E0C, 0x7E0D, 0x7E0E, 0x7E0F, 0x7E10, 0x7E11, 0x7E12, + 0x7E13, 0x7E14, 0x7E15, 0x7E16, 0x7E17, 0x7E18, 0x7E19, 0x7E1A, + 0x7E1B, 0x7E1C, 0x7E1D, 0x7E1E, 0x7E1F, 0x7E20, 0x7E21, 0x7E22, + 0x7E23, 0x7E24, 0x7E25, 0x7E26, 0x7E27, 0x7E28, 0x7E29, 0x7E2A, + 0x7E2B, 0x7E2C, 0x7E2D, 0x7E2E, 0x7E2F, 0x7E30, 0x7E31, 0x7E32, + 0x7E33, 0x7E34, 0x7E35, 0x7E36, 0x7E37, 0x7E38, 0x7E39, ALTCHR, + 0x7E3A, 0x7E3C, 0x7E3D, 0x7E3E, 0x7E3F, 0x7E40, 0x7E42, 0x7E43, + 0x7E44, 0x7E45, 0x7E46, 0x7E48, 0x7E49, 0x7E4A, 0x7E4B, 0x7E4C, + 0x7E4D, 0x7E4E, 0x7E4F, 0x7E50, 0x7E51, 0x7E52, 0x7E53, 0x7E54, + 0x7E55, 0x7E56, 0x7E57, 0x7E58, 0x7E59, 0x7E5A, 0x7E5B, 0x7E5C, + 0x7E5D, 0x4FCA, 0x7AE3, 0x6D5A, 0x90E1, 0x9A8F, 0x5580, 0x5496, + 0x5361, 0x54AF, 0x5F00, 0x63E9, 0x6977, 0x51EF, 0x6168, 0x520A, + 0x582A, 0x52D8, 0x574E, 0x780D, 0x770B, 0x5EB7, 0x6177, 0x7CE0, + 0x625B, 0x6297, 0x4EA2, 0x7095, 0x8003, 0x62F7, 0x70E4, 0x9760, + 0x5777, 0x82DB, 0x67EF, 0x68F5, 0x78D5, 0x9897, 0x79D1, 0x58F3, + 0x54B3, 0x53EF, 0x6E34, 0x514B, 0x523B, 0x5BA2, 0x8BFE, 0x80AF, + 0x5543, 0x57A6, 0x6073, 0x5751, 0x542D, 0x7A7A, 0x6050, 0x5B54, + 0x63A7, 0x62A0, 0x53E3, 0x6263, 0x5BC7, 0x67AF, 0x54ED, 0x7A9F, + 0x82E6, 0x9177, 0x5E93, 0x88E4, 0x5938, 0x57AE, 0x630E, 0x8DE8, + 0x80EF, 0x5757, 0x7B77, 0x4FA9, 0x5FEB, 0x5BBD, 0x6B3E, 0x5321, + 0x7B50, 0x72C2, 0x6846, 0x77FF, 0x7736, 0x65F7, 0x51B5, 0x4E8F, + 0x76D4, 0x5CBF, 0x7AA5, 0x8475, 0x594E, 0x9B41, 0x5080, ALTCHR, +/* 0xC040 - 0xC0FF */ + 0x7E5E, 0x7E5F, 0x7E60, 0x7E61, 0x7E62, 0x7E63, 0x7E64, 0x7E65, + 0x7E66, 0x7E67, 0x7E68, 0x7E69, 0x7E6A, 0x7E6B, 0x7E6C, 0x7E6D, + 0x7E6E, 0x7E6F, 0x7E70, 0x7E71, 0x7E72, 0x7E73, 0x7E74, 0x7E75, + 0x7E76, 0x7E77, 0x7E78, 0x7E79, 0x7E7A, 0x7E7B, 0x7E7C, 0x7E7D, + 0x7E7E, 0x7E7F, 0x7E80, 0x7E81, 0x7E83, 0x7E84, 0x7E85, 0x7E86, + 0x7E87, 0x7E88, 0x7E89, 0x7E8A, 0x7E8B, 0x7E8C, 0x7E8D, 0x7E8E, + 0x7E8F, 0x7E90, 0x7E91, 0x7E92, 0x7E93, 0x7E94, 0x7E95, 0x7E96, + 0x7E97, 0x7E98, 0x7E99, 0x7E9A, 0x7E9C, 0x7E9D, 0x7E9E, ALTCHR, + 0x7EAE, 0x7EB4, 0x7EBB, 0x7EBC, 0x7ED6, 0x7EE4, 0x7EEC, 0x7EF9, + 0x7F0A, 0x7F10, 0x7F1E, 0x7F37, 0x7F39, 0x7F3B, 0x7F3C, 0x7F3D, + 0x7F3E, 0x7F3F, 0x7F40, 0x7F41, 0x7F43, 0x7F46, 0x7F47, 0x7F48, + 0x7F49, 0x7F4A, 0x7F4B, 0x7F4C, 0x7F4D, 0x7F4E, 0x7F4F, 0x7F52, + 0x7F53, 0x9988, 0x6127, 0x6E83, 0x5764, 0x6606, 0x6346, 0x56F0, + 0x62EC, 0x6269, 0x5ED3, 0x9614, 0x5783, 0x62C9, 0x5587, 0x8721, + 0x814A, 0x8FA3, 0x5566, 0x83B1, 0x6765, 0x8D56, 0x84DD, 0x5A6A, + 0x680F, 0x62E6, 0x7BEE, 0x9611, 0x5170, 0x6F9C, 0x8C30, 0x63FD, + 0x89C8, 0x61D2, 0x7F06, 0x70C2, 0x6EE5, 0x7405, 0x6994, 0x72FC, + 0x5ECA, 0x90CE, 0x6717, 0x6D6A, 0x635E, 0x52B3, 0x7262, 0x8001, + 0x4F6C, 0x59E5, 0x916A, 0x70D9, 0x6D9D, 0x52D2, 0x4E50, 0x96F7, + 0x956D, 0x857E, 0x78CA, 0x7D2F, 0x5121, 0x5792, 0x64C2, 0x808B, + 0x7C7B, 0x6CEA, 0x68F1, 0x695E, 0x51B7, 0x5398, 0x68A8, 0x7281, + 0x9ECE, 0x7BF1, 0x72F8, 0x79BB, 0x6F13, 0x7406, 0x674E, 0x91CC, + 0x9CA4, 0x793C, 0x8389, 0x8354, 0x540F, 0x6817, 0x4E3D, 0x5389, + 0x52B1, 0x783E, 0x5386, 0x5229, 0x5088, 0x4F8B, 0x4FD0, ALTCHR, +/* 0xC140 - 0xC1FF */ + 0x7F56, 0x7F59, 0x7F5B, 0x7F5C, 0x7F5D, 0x7F5E, 0x7F60, 0x7F63, + 0x7F64, 0x7F65, 0x7F66, 0x7F67, 0x7F6B, 0x7F6C, 0x7F6D, 0x7F6F, + 0x7F70, 0x7F73, 0x7F75, 0x7F76, 0x7F77, 0x7F78, 0x7F7A, 0x7F7B, + 0x7F7C, 0x7F7D, 0x7F7F, 0x7F80, 0x7F82, 0x7F83, 0x7F84, 0x7F85, + 0x7F86, 0x7F87, 0x7F88, 0x7F89, 0x7F8B, 0x7F8D, 0x7F8F, 0x7F90, + 0x7F91, 0x7F92, 0x7F93, 0x7F95, 0x7F96, 0x7F97, 0x7F98, 0x7F99, + 0x7F9B, 0x7F9C, 0x7FA0, 0x7FA2, 0x7FA3, 0x7FA5, 0x7FA6, 0x7FA8, + 0x7FA9, 0x7FAA, 0x7FAB, 0x7FAC, 0x7FAD, 0x7FAE, 0x7FB1, ALTCHR, + 0x7FB3, 0x7FB4, 0x7FB5, 0x7FB6, 0x7FB7, 0x7FBA, 0x7FBB, 0x7FBE, + 0x7FC0, 0x7FC2, 0x7FC3, 0x7FC4, 0x7FC6, 0x7FC7, 0x7FC8, 0x7FC9, + 0x7FCB, 0x7FCD, 0x7FCF, 0x7FD0, 0x7FD1, 0x7FD2, 0x7FD3, 0x7FD6, + 0x7FD7, 0x7FD9, 0x7FDA, 0x7FDB, 0x7FDC, 0x7FDD, 0x7FDE, 0x7FE2, + 0x7FE3, 0x75E2, 0x7ACB, 0x7C92, 0x6CA5, 0x96B6, 0x529B, 0x7483, + 0x54E9, 0x4FE9, 0x8054, 0x83B2, 0x8FDE, 0x9570, 0x5EC9, 0x601C, + 0x6D9F, 0x5E18, 0x655B, 0x8138, 0x94FE, 0x604B, 0x70BC, 0x7EC3, + 0x7CAE, 0x51C9, 0x6881, 0x7CB1, 0x826F, 0x4E24, 0x8F86, 0x91CF, + 0x667E, 0x4EAE, 0x8C05, 0x64A9, 0x804A, 0x50DA, 0x7597, 0x71CE, + 0x5BE5, 0x8FBD, 0x6F66, 0x4E86, 0x6482, 0x9563, 0x5ED6, 0x6599, + 0x5217, 0x88C2, 0x70C8, 0x52A3, 0x730E, 0x7433, 0x6797, 0x78F7, + 0x9716, 0x4E34, 0x90BB, 0x9CDE, 0x6DCB, 0x51DB, 0x8D41, 0x541D, + 0x62CE, 0x73B2, 0x83F1, 0x96F6, 0x9F84, 0x94C3, 0x4F36, 0x7F9A, + 0x51CC, 0x7075, 0x9675, 0x5CAD, 0x9886, 0x53E6, 0x4EE4, 0x6E9C, + 0x7409, 0x69B4, 0x786B, 0x998F, 0x7559, 0x5218, 0x7624, 0x6D41, + 0x67F3, 0x516D, 0x9F99, 0x804B, 0x5499, 0x7B3C, 0x7ABF, ALTCHR, +/* 0xC240 - 0xC2FF */ + 0x7FE4, 0x7FE7, 0x7FE8, 0x7FEA, 0x7FEB, 0x7FEC, 0x7FED, 0x7FEF, + 0x7FF2, 0x7FF4, 0x7FF5, 0x7FF6, 0x7FF7, 0x7FF8, 0x7FF9, 0x7FFA, + 0x7FFD, 0x7FFE, 0x7FFF, 0x8002, 0x8007, 0x8008, 0x8009, 0x800A, + 0x800E, 0x800F, 0x8011, 0x8013, 0x801A, 0x801B, 0x801D, 0x801E, + 0x801F, 0x8021, 0x8023, 0x8024, 0x802B, 0x802C, 0x802D, 0x802E, + 0x802F, 0x8030, 0x8032, 0x8034, 0x8039, 0x803A, 0x803C, 0x803E, + 0x8040, 0x8041, 0x8044, 0x8045, 0x8047, 0x8048, 0x8049, 0x804E, + 0x804F, 0x8050, 0x8051, 0x8053, 0x8055, 0x8056, 0x8057, ALTCHR, + 0x8059, 0x805B, 0x805C, 0x805D, 0x805E, 0x805F, 0x8060, 0x8061, + 0x8062, 0x8063, 0x8064, 0x8065, 0x8066, 0x8067, 0x8068, 0x806B, + 0x806C, 0x806D, 0x806E, 0x806F, 0x8070, 0x8072, 0x8073, 0x8074, + 0x8075, 0x8076, 0x8077, 0x8078, 0x8079, 0x807A, 0x807B, 0x807C, + 0x807D, 0x9686, 0x5784, 0x62E2, 0x9647, 0x697C, 0x5A04, 0x6402, + 0x7BD3, 0x6F0F, 0x964B, 0x82A6, 0x5362, 0x9885, 0x5E90, 0x7089, + 0x63B3, 0x5364, 0x864F, 0x9C81, 0x9E93, 0x788C, 0x9732, 0x8DEF, + 0x8D42, 0x9E7F, 0x6F5E, 0x7984, 0x5F55, 0x9646, 0x622E, 0x9A74, + 0x5415, 0x94DD, 0x4FA3, 0x65C5, 0x5C65, 0x5C61, 0x7F15, 0x8651, + 0x6C2F, 0x5F8B, 0x7387, 0x6EE4, 0x7EFF, 0x5CE6, 0x631B, 0x5B6A, + 0x6EE6, 0x5375, 0x4E71, 0x63A0, 0x7565, 0x62A1, 0x8F6E, 0x4F26, + 0x4ED1, 0x6CA6, 0x7EB6, 0x8BBA, 0x841D, 0x87BA, 0x7F57, 0x903B, + 0x9523, 0x7BA9, 0x9AA1, 0x88F8, 0x843D, 0x6D1B, 0x9A86, 0x7EDC, + 0x5988, 0x9EBB, 0x739B, 0x7801, 0x8682, 0x9A6C, 0x9A82, 0x561B, + 0x5417, 0x57CB, 0x4E70, 0x9EA6, 0x5356, 0x8FC8, 0x8109, 0x7792, + 0x9992, 0x86EE, 0x6EE1, 0x8513, 0x66FC, 0x6162, 0x6F2B, ALTCHR, +/* 0xC340 - 0xC3FF */ + 0x807E, 0x8081, 0x8082, 0x8085, 0x8088, 0x808A, 0x808D, 0x808E, + 0x808F, 0x8090, 0x8091, 0x8092, 0x8094, 0x8095, 0x8097, 0x8099, + 0x809E, 0x80A3, 0x80A6, 0x80A7, 0x80A8, 0x80AC, 0x80B0, 0x80B3, + 0x80B5, 0x80B6, 0x80B8, 0x80B9, 0x80BB, 0x80C5, 0x80C7, 0x80C8, + 0x80C9, 0x80CA, 0x80CB, 0x80CF, 0x80D0, 0x80D1, 0x80D2, 0x80D3, + 0x80D4, 0x80D5, 0x80D8, 0x80DF, 0x80E0, 0x80E2, 0x80E3, 0x80E6, + 0x80EE, 0x80F5, 0x80F7, 0x80F9, 0x80FB, 0x80FE, 0x80FF, 0x8100, + 0x8101, 0x8103, 0x8104, 0x8105, 0x8107, 0x8108, 0x810B, ALTCHR, + 0x810C, 0x8115, 0x8117, 0x8119, 0x811B, 0x811C, 0x811D, 0x811F, + 0x8120, 0x8121, 0x8122, 0x8123, 0x8124, 0x8125, 0x8126, 0x8127, + 0x8128, 0x8129, 0x812A, 0x812B, 0x812D, 0x812E, 0x8130, 0x8133, + 0x8134, 0x8135, 0x8137, 0x8139, 0x813A, 0x813B, 0x813C, 0x813D, + 0x813F, 0x8C29, 0x8292, 0x832B, 0x76F2, 0x6C13, 0x5FD9, 0x83BD, + 0x732B, 0x8305, 0x951A, 0x6BDB, 0x77DB, 0x94C6, 0x536F, 0x8302, + 0x5192, 0x5E3D, 0x8C8C, 0x8D38, 0x4E48, 0x73AB, 0x679A, 0x6885, + 0x9176, 0x9709, 0x7164, 0x6CA1, 0x7709, 0x5A92, 0x9541, 0x6BCF, + 0x7F8E, 0x6627, 0x5BD0, 0x59B9, 0x5A9A, 0x95E8, 0x95F7, 0x4EEC, + 0x840C, 0x8499, 0x6AAC, 0x76DF, 0x9530, 0x731B, 0x68A6, 0x5B5F, + 0x772F, 0x919A, 0x9761, 0x7CDC, 0x8FF7, 0x8C1C, 0x5F25, 0x7C73, + 0x79D8, 0x89C5, 0x6CCC, 0x871C, 0x5BC6, 0x5E42, 0x68C9, 0x7720, + 0x7EF5, 0x5195, 0x514D, 0x52C9, 0x5A29, 0x7F05, 0x9762, 0x82D7, + 0x63CF, 0x7784, 0x85D0, 0x79D2, 0x6E3A, 0x5E99, 0x5999, 0x8511, + 0x706D, 0x6C11, 0x62BF, 0x76BF, 0x654F, 0x60AF, 0x95FD, 0x660E, + 0x879F, 0x9E23, 0x94ED, 0x540D, 0x547D, 0x8C2C, 0x6478, ALTCHR, +/* 0xC440 - 0xC4FF */ + 0x8140, 0x8141, 0x8142, 0x8143, 0x8144, 0x8145, 0x8147, 0x8149, + 0x814D, 0x814E, 0x814F, 0x8152, 0x8156, 0x8157, 0x8158, 0x815B, + 0x815C, 0x815D, 0x815E, 0x815F, 0x8161, 0x8162, 0x8163, 0x8164, + 0x8166, 0x8168, 0x816A, 0x816B, 0x816C, 0x816F, 0x8172, 0x8173, + 0x8175, 0x8176, 0x8177, 0x8178, 0x8181, 0x8183, 0x8184, 0x8185, + 0x8186, 0x8187, 0x8189, 0x818B, 0x818C, 0x818D, 0x818E, 0x8190, + 0x8192, 0x8193, 0x8194, 0x8195, 0x8196, 0x8197, 0x8199, 0x819A, + 0x819E, 0x819F, 0x81A0, 0x81A1, 0x81A2, 0x81A4, 0x81A5, ALTCHR, + 0x81A7, 0x81A9, 0x81AB, 0x81AC, 0x81AD, 0x81AE, 0x81AF, 0x81B0, + 0x81B1, 0x81B2, 0x81B4, 0x81B5, 0x81B6, 0x81B7, 0x81B8, 0x81B9, + 0x81BC, 0x81BD, 0x81BE, 0x81BF, 0x81C4, 0x81C5, 0x81C7, 0x81C8, + 0x81C9, 0x81CB, 0x81CD, 0x81CE, 0x81CF, 0x81D0, 0x81D1, 0x81D2, + 0x81D3, 0x6479, 0x8611, 0x6A21, 0x819C, 0x78E8, 0x6469, 0x9B54, + 0x62B9, 0x672B, 0x83AB, 0x58A8, 0x9ED8, 0x6CAB, 0x6F20, 0x5BDE, + 0x964C, 0x8C0B, 0x725F, 0x67D0, 0x62C7, 0x7261, 0x4EA9, 0x59C6, + 0x6BCD, 0x5893, 0x66AE, 0x5E55, 0x52DF, 0x6155, 0x6728, 0x76EE, + 0x7766, 0x7267, 0x7A46, 0x62FF, 0x54EA, 0x5450, 0x94A0, 0x90A3, + 0x5A1C, 0x7EB3, 0x6C16, 0x4E43, 0x5976, 0x8010, 0x5948, 0x5357, + 0x7537, 0x96BE, 0x56CA, 0x6320, 0x8111, 0x607C, 0x95F9, 0x6DD6, + 0x5462, 0x9981, 0x5185, 0x5AE9, 0x80FD, 0x59AE, 0x9713, 0x502A, + 0x6CE5, 0x5C3C, 0x62DF, 0x4F60, 0x533F, 0x817B, 0x9006, 0x6EBA, + 0x852B, 0x62C8, 0x5E74, 0x78BE, 0x64B5, 0x637B, 0x5FF5, 0x5A18, + 0x917F, 0x9E1F, 0x5C3F, 0x634F, 0x8042, 0x5B7D, 0x556E, 0x954A, + 0x954D, 0x6D85, 0x60A8, 0x67E0, 0x72DE, 0x51DD, 0x5B81, ALTCHR, +/* 0xC540 - 0xC5FF */ + 0x81D4, 0x81D5, 0x81D6, 0x81D7, 0x81D8, 0x81D9, 0x81DA, 0x81DB, + 0x81DC, 0x81DD, 0x81DE, 0x81DF, 0x81E0, 0x81E1, 0x81E2, 0x81E4, + 0x81E5, 0x81E6, 0x81E8, 0x81E9, 0x81EB, 0x81EE, 0x81EF, 0x81F0, + 0x81F1, 0x81F2, 0x81F5, 0x81F6, 0x81F7, 0x81F8, 0x81F9, 0x81FA, + 0x81FD, 0x81FF, 0x8203, 0x8207, 0x8208, 0x8209, 0x820A, 0x820B, + 0x820E, 0x820F, 0x8211, 0x8213, 0x8215, 0x8216, 0x8217, 0x8218, + 0x8219, 0x821A, 0x821D, 0x8220, 0x8224, 0x8225, 0x8226, 0x8227, + 0x8229, 0x822E, 0x8232, 0x823A, 0x823C, 0x823D, 0x823F, ALTCHR, + 0x8240, 0x8241, 0x8242, 0x8243, 0x8245, 0x8246, 0x8248, 0x824A, + 0x824C, 0x824D, 0x824E, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, + 0x8255, 0x8256, 0x8257, 0x8259, 0x825B, 0x825C, 0x825D, 0x825E, + 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, 0x8267, + 0x8269, 0x62E7, 0x6CDE, 0x725B, 0x626D, 0x94AE, 0x7EBD, 0x8113, + 0x6D53, 0x519C, 0x5F04, 0x5974, 0x52AA, 0x6012, 0x5973, 0x6696, + 0x8650, 0x759F, 0x632A, 0x61E6, 0x7CEF, 0x8BFA, 0x54E6, 0x6B27, + 0x9E25, 0x6BB4, 0x85D5, 0x5455, 0x5076, 0x6CA4, 0x556A, 0x8DB4, + 0x722C, 0x5E15, 0x6015, 0x7436, 0x62CD, 0x6392, 0x724C, 0x5F98, + 0x6E43, 0x6D3E, 0x6500, 0x6F58, 0x76D8, 0x78D0, 0x76FC, 0x7554, + 0x5224, 0x53DB, 0x4E53, 0x5E9E, 0x65C1, 0x802A, 0x80D6, 0x629B, + 0x5486, 0x5228, 0x70AE, 0x888D, 0x8DD1, 0x6CE1, 0x5478, 0x80DA, + 0x57F9, 0x88F4, 0x8D54, 0x966A, 0x914D, 0x4F69, 0x6C9B, 0x55B7, + 0x76C6, 0x7830, 0x62A8, 0x70F9, 0x6F8E, 0x5F6D, 0x84EC, 0x68DA, + 0x787C, 0x7BF7, 0x81A8, 0x670B, 0x9E4F, 0x6367, 0x78B0, 0x576F, + 0x7812, 0x9739, 0x6279, 0x62AB, 0x5288, 0x7435, 0x6BD7, ALTCHR, +/* 0xC640 - 0xC6FF */ + 0x826A, 0x826B, 0x826C, 0x826D, 0x8271, 0x8275, 0x8276, 0x8277, + 0x8278, 0x827B, 0x827C, 0x8280, 0x8281, 0x8283, 0x8285, 0x8286, + 0x8287, 0x8289, 0x828C, 0x8290, 0x8293, 0x8294, 0x8295, 0x8296, + 0x829A, 0x829B, 0x829E, 0x82A0, 0x82A2, 0x82A3, 0x82A7, 0x82B2, + 0x82B5, 0x82B6, 0x82BA, 0x82BB, 0x82BC, 0x82BF, 0x82C0, 0x82C2, + 0x82C3, 0x82C5, 0x82C6, 0x82C9, 0x82D0, 0x82D6, 0x82D9, 0x82DA, + 0x82DD, 0x82E2, 0x82E7, 0x82E8, 0x82E9, 0x82EA, 0x82EC, 0x82ED, + 0x82EE, 0x82F0, 0x82F2, 0x82F3, 0x82F5, 0x82F6, 0x82F8, ALTCHR, + 0x82FA, 0x82FC, 0x82FD, 0x82FE, 0x82FF, 0x8300, 0x830A, 0x830B, + 0x830D, 0x8310, 0x8312, 0x8313, 0x8316, 0x8318, 0x8319, 0x831D, + 0x831E, 0x831F, 0x8320, 0x8321, 0x8322, 0x8323, 0x8324, 0x8325, + 0x8326, 0x8329, 0x832A, 0x832E, 0x8330, 0x8332, 0x8337, 0x833B, + 0x833D, 0x5564, 0x813E, 0x75B2, 0x76AE, 0x5339, 0x75DE, 0x50FB, + 0x5C41, 0x8B6C, 0x7BC7, 0x504F, 0x7247, 0x9A97, 0x98D8, 0x6F02, + 0x74E2, 0x7968, 0x6487, 0x77A5, 0x62FC, 0x9891, 0x8D2B, 0x54C1, + 0x8058, 0x4E52, 0x576A, 0x82F9, 0x840D, 0x5E73, 0x51ED, 0x74F6, + 0x8BC4, 0x5C4F, 0x5761, 0x6CFC, 0x9887, 0x5A46, 0x7834, 0x9B44, + 0x8FEB, 0x7C95, 0x5256, 0x6251, 0x94FA, 0x4EC6, 0x8386, 0x8461, + 0x83E9, 0x84B2, 0x57D4, 0x6734, 0x5703, 0x666E, 0x6D66, 0x8C31, + 0x66DD, 0x7011, 0x671F, 0x6B3A, 0x6816, 0x621A, 0x59BB, 0x4E03, + 0x51C4, 0x6F06, 0x67D2, 0x6C8F, 0x5176, 0x68CB, 0x5947, 0x6B67, + 0x7566, 0x5D0E, 0x8110, 0x9F50, 0x65D7, 0x7948, 0x7941, 0x9A91, + 0x8D77, 0x5C82, 0x4E5E, 0x4F01, 0x542F, 0x5951, 0x780C, 0x5668, + 0x6C14, 0x8FC4, 0x5F03, 0x6C7D, 0x6CE3, 0x8BAB, 0x6390, ALTCHR, +/* 0xC740 - 0xC7FF */ + 0x833E, 0x833F, 0x8341, 0x8342, 0x8344, 0x8345, 0x8348, 0x834A, + 0x834B, 0x834C, 0x834D, 0x834E, 0x8353, 0x8355, 0x8356, 0x8357, + 0x8358, 0x8359, 0x835D, 0x8362, 0x8370, 0x8371, 0x8372, 0x8373, + 0x8374, 0x8375, 0x8376, 0x8379, 0x837A, 0x837E, 0x837F, 0x8380, + 0x8381, 0x8382, 0x8383, 0x8384, 0x8387, 0x8388, 0x838A, 0x838B, + 0x838C, 0x838D, 0x838F, 0x8390, 0x8391, 0x8394, 0x8395, 0x8396, + 0x8397, 0x8399, 0x839A, 0x839D, 0x839F, 0x83A1, 0x83A2, 0x83A3, + 0x83A4, 0x83A5, 0x83A6, 0x83A7, 0x83AC, 0x83AD, 0x83AE, ALTCHR, + 0x83AF, 0x83B5, 0x83BB, 0x83BE, 0x83BF, 0x83C2, 0x83C3, 0x83C4, + 0x83C6, 0x83C8, 0x83C9, 0x83CB, 0x83CD, 0x83CE, 0x83D0, 0x83D1, + 0x83D2, 0x83D3, 0x83D5, 0x83D7, 0x83D9, 0x83DA, 0x83DB, 0x83DE, + 0x83E2, 0x83E3, 0x83E4, 0x83E6, 0x83E7, 0x83E8, 0x83EB, 0x83EC, + 0x83ED, 0x6070, 0x6D3D, 0x7275, 0x6266, 0x948E, 0x94C5, 0x5343, + 0x8FC1, 0x7B7E, 0x4EDF, 0x8C26, 0x4E7E, 0x9ED4, 0x94B1, 0x94B3, + 0x524D, 0x6F5C, 0x9063, 0x6D45, 0x8C34, 0x5811, 0x5D4C, 0x6B20, + 0x6B49, 0x67AA, 0x545B, 0x8154, 0x7F8C, 0x5899, 0x8537, 0x5F3A, + 0x62A2, 0x6A47, 0x9539, 0x6572, 0x6084, 0x6865, 0x77A7, 0x4E54, + 0x4FA8, 0x5DE7, 0x9798, 0x64AC, 0x7FD8, 0x5CED, 0x4FCF, 0x7A8D, + 0x5207, 0x8304, 0x4E14, 0x602F, 0x7A83, 0x94A6, 0x4FB5, 0x4EB2, + 0x79E6, 0x7434, 0x52E4, 0x82B9, 0x64D2, 0x79BD, 0x5BDD, 0x6C81, + 0x9752, 0x8F7B, 0x6C22, 0x503E, 0x537F, 0x6E05, 0x64CE, 0x6674, + 0x6C30, 0x60C5, 0x9877, 0x8BF7, 0x5E86, 0x743C, 0x7A77, 0x79CB, + 0x4E18, 0x90B1, 0x7403, 0x6C42, 0x56DA, 0x914B, 0x6CC5, 0x8D8B, + 0x533A, 0x86C6, 0x66F2, 0x8EAF, 0x5C48, 0x9A71, 0x6E20, ALTCHR, +/* 0xC840 - 0xC8FF */ + 0x83EE, 0x83EF, 0x83F3, 0x83F4, 0x83F5, 0x83F6, 0x83F7, 0x83FA, + 0x83FB, 0x83FC, 0x83FE, 0x83FF, 0x8400, 0x8402, 0x8405, 0x8407, + 0x8408, 0x8409, 0x840A, 0x8410, 0x8412, 0x8413, 0x8414, 0x8415, + 0x8416, 0x8417, 0x8419, 0x841A, 0x841B, 0x841E, 0x841F, 0x8420, + 0x8421, 0x8422, 0x8423, 0x8429, 0x842A, 0x842B, 0x842C, 0x842D, + 0x842E, 0x842F, 0x8430, 0x8432, 0x8433, 0x8434, 0x8435, 0x8436, + 0x8437, 0x8439, 0x843A, 0x843B, 0x843E, 0x843F, 0x8440, 0x8441, + 0x8442, 0x8443, 0x8444, 0x8445, 0x8447, 0x8448, 0x8449, ALTCHR, + 0x844A, 0x844B, 0x844C, 0x844D, 0x844E, 0x844F, 0x8450, 0x8452, + 0x8453, 0x8454, 0x8455, 0x8456, 0x8458, 0x845D, 0x845E, 0x845F, + 0x8460, 0x8462, 0x8464, 0x8465, 0x8466, 0x8467, 0x8468, 0x846A, + 0x846E, 0x846F, 0x8470, 0x8472, 0x8474, 0x8477, 0x8479, 0x847B, + 0x847C, 0x53D6, 0x5A36, 0x9F8B, 0x8DA3, 0x53BB, 0x5708, 0x98A7, + 0x6743, 0x919B, 0x6CC9, 0x5168, 0x75CA, 0x62F3, 0x72AC, 0x5238, + 0x529D, 0x7F3A, 0x7094, 0x7638, 0x5374, 0x9E4A, 0x69B7, 0x786E, + 0x96C0, 0x88D9, 0x7FA4, 0x7136, 0x71C3, 0x5189, 0x67D3, 0x74E4, + 0x58E4, 0x6518, 0x56B7, 0x8BA9, 0x9976, 0x6270, 0x7ED5, 0x60F9, + 0x70ED, 0x58EC, 0x4EC1, 0x4EBA, 0x5FCD, 0x97E7, 0x4EFB, 0x8BA4, + 0x5203, 0x598A, 0x7EAB, 0x6254, 0x4ECD, 0x65E5, 0x620E, 0x8338, + 0x84C9, 0x8363, 0x878D, 0x7194, 0x6EB6, 0x5BB9, 0x7ED2, 0x5197, + 0x63C9, 0x67D4, 0x8089, 0x8339, 0x8815, 0x5112, 0x5B7A, 0x5982, + 0x8FB1, 0x4E73, 0x6C5D, 0x5165, 0x8925, 0x8F6F, 0x962E, 0x854A, + 0x745E, 0x9510, 0x95F0, 0x6DA6, 0x82E5, 0x5F31, 0x6492, 0x6D12, + 0x8428, 0x816E, 0x9CC3, 0x585E, 0x8D5B, 0x4E09, 0x53C1, ALTCHR, +/* 0xC940 - 0xC9FF */ + 0x847D, 0x847E, 0x847F, 0x8480, 0x8481, 0x8483, 0x8484, 0x8485, + 0x8486, 0x848A, 0x848D, 0x848F, 0x8490, 0x8491, 0x8492, 0x8493, + 0x8494, 0x8495, 0x8496, 0x8498, 0x849A, 0x849B, 0x849D, 0x849E, + 0x849F, 0x84A0, 0x84A2, 0x84A3, 0x84A4, 0x84A5, 0x84A6, 0x84A7, + 0x84A8, 0x84A9, 0x84AA, 0x84AB, 0x84AC, 0x84AD, 0x84AE, 0x84B0, + 0x84B1, 0x84B3, 0x84B5, 0x84B6, 0x84B7, 0x84BB, 0x84BC, 0x84BE, + 0x84C0, 0x84C2, 0x84C3, 0x84C5, 0x84C6, 0x84C7, 0x84C8, 0x84CB, + 0x84CC, 0x84CE, 0x84CF, 0x84D2, 0x84D4, 0x84D5, 0x84D7, ALTCHR, + 0x84D8, 0x84D9, 0x84DA, 0x84DB, 0x84DC, 0x84DE, 0x84E1, 0x84E2, + 0x84E4, 0x84E7, 0x84E8, 0x84E9, 0x84EA, 0x84EB, 0x84ED, 0x84EE, + 0x84EF, 0x84F1, 0x84F2, 0x84F3, 0x84F4, 0x84F5, 0x84F6, 0x84F7, + 0x84F8, 0x84F9, 0x84FA, 0x84FB, 0x84FD, 0x84FE, 0x8500, 0x8501, + 0x8502, 0x4F1E, 0x6563, 0x6851, 0x55D3, 0x4E27, 0x6414, 0x9A9A, + 0x626B, 0x5AC2, 0x745F, 0x8272, 0x6DA9, 0x68EE, 0x50E7, 0x838E, + 0x7802, 0x6740, 0x5239, 0x6C99, 0x7EB1, 0x50BB, 0x5565, 0x715E, + 0x7B5B, 0x6652, 0x73CA, 0x82EB, 0x6749, 0x5C71, 0x5220, 0x717D, + 0x886B, 0x95EA, 0x9655, 0x64C5, 0x8D61, 0x81B3, 0x5584, 0x6C55, + 0x6247, 0x7F2E, 0x5892, 0x4F24, 0x5546, 0x8D4F, 0x664C, 0x4E0A, + 0x5C1A, 0x88F3, 0x68A2, 0x634E, 0x7A0D, 0x70E7, 0x828D, 0x52FA, + 0x97F6, 0x5C11, 0x54E8, 0x90B5, 0x7ECD, 0x5962, 0x8D4A, 0x86C7, + 0x820C, 0x820D, 0x8D66, 0x6444, 0x5C04, 0x6151, 0x6D89, 0x793E, + 0x8BBE, 0x7837, 0x7533, 0x547B, 0x4F38, 0x8EAB, 0x6DF1, 0x5A20, + 0x7EC5, 0x795E, 0x6C88, 0x5BA1, 0x5A76, 0x751A, 0x80BE, 0x614E, + 0x6E17, 0x58F0, 0x751F, 0x7525, 0x7272, 0x5347, 0x7EF3, ALTCHR, +/* 0xCA40 - 0xCAFF */ + 0x8503, 0x8504, 0x8505, 0x8506, 0x8507, 0x8508, 0x8509, 0x850A, + 0x850B, 0x850D, 0x850E, 0x850F, 0x8510, 0x8512, 0x8514, 0x8515, + 0x8516, 0x8518, 0x8519, 0x851B, 0x851C, 0x851D, 0x851E, 0x8520, + 0x8522, 0x8523, 0x8524, 0x8525, 0x8526, 0x8527, 0x8528, 0x8529, + 0x852A, 0x852D, 0x852E, 0x852F, 0x8530, 0x8531, 0x8532, 0x8533, + 0x8534, 0x8535, 0x8536, 0x853E, 0x853F, 0x8540, 0x8541, 0x8542, + 0x8544, 0x8545, 0x8546, 0x8547, 0x854B, 0x854C, 0x854D, 0x854E, + 0x854F, 0x8550, 0x8551, 0x8552, 0x8553, 0x8554, 0x8555, ALTCHR, + 0x8557, 0x8558, 0x855A, 0x855B, 0x855C, 0x855D, 0x855F, 0x8560, + 0x8561, 0x8562, 0x8563, 0x8565, 0x8566, 0x8567, 0x8569, 0x856A, + 0x856B, 0x856C, 0x856D, 0x856E, 0x856F, 0x8570, 0x8571, 0x8573, + 0x8575, 0x8576, 0x8577, 0x8578, 0x857C, 0x857D, 0x857F, 0x8580, + 0x8581, 0x7701, 0x76DB, 0x5269, 0x80DC, 0x5723, 0x5E08, 0x5931, + 0x72EE, 0x65BD, 0x6E7F, 0x8BD7, 0x5C38, 0x8671, 0x5341, 0x77F3, + 0x62FE, 0x65F6, 0x4EC0, 0x98DF, 0x8680, 0x5B9E, 0x8BC6, 0x53F2, + 0x77E2, 0x4F7F, 0x5C4E, 0x9A76, 0x59CB, 0x5F0F, 0x793A, 0x58EB, + 0x4E16, 0x67FF, 0x4E8B, 0x62ED, 0x8A93, 0x901D, 0x52BF, 0x662F, + 0x55DC, 0x566C, 0x9002, 0x4ED5, 0x4F8D, 0x91CA, 0x9970, 0x6C0F, + 0x5E02, 0x6043, 0x5BA4, 0x89C6, 0x8BD5, 0x6536, 0x624B, 0x9996, + 0x5B88, 0x5BFF, 0x6388, 0x552E, 0x53D7, 0x7626, 0x517D, 0x852C, + 0x67A2, 0x68B3, 0x6B8A, 0x6292, 0x8F93, 0x53D4, 0x8212, 0x6DD1, + 0x758F, 0x4E66, 0x8D4E, 0x5B70, 0x719F, 0x85AF, 0x6691, 0x66D9, + 0x7F72, 0x8700, 0x9ECD, 0x9F20, 0x5C5E, 0x672F, 0x8FF0, 0x6811, + 0x675F, 0x620D, 0x7AD6, 0x5885, 0x5EB6, 0x6570, 0x6F31, ALTCHR, +/* 0xCB40 - 0xCBFF */ + 0x8582, 0x8583, 0x8586, 0x8588, 0x8589, 0x858A, 0x858B, 0x858C, + 0x858D, 0x858E, 0x8590, 0x8591, 0x8592, 0x8593, 0x8594, 0x8595, + 0x8596, 0x8597, 0x8598, 0x8599, 0x859A, 0x859D, 0x859E, 0x859F, + 0x85A0, 0x85A1, 0x85A2, 0x85A3, 0x85A5, 0x85A6, 0x85A7, 0x85A9, + 0x85AB, 0x85AC, 0x85AD, 0x85B1, 0x85B2, 0x85B3, 0x85B4, 0x85B5, + 0x85B6, 0x85B8, 0x85BA, 0x85BB, 0x85BC, 0x85BD, 0x85BE, 0x85BF, + 0x85C0, 0x85C2, 0x85C3, 0x85C4, 0x85C5, 0x85C6, 0x85C7, 0x85C8, + 0x85CA, 0x85CB, 0x85CC, 0x85CD, 0x85CE, 0x85D1, 0x85D2, ALTCHR, + 0x85D4, 0x85D6, 0x85D7, 0x85D8, 0x85D9, 0x85DA, 0x85DB, 0x85DD, + 0x85DE, 0x85DF, 0x85E0, 0x85E1, 0x85E2, 0x85E3, 0x85E5, 0x85E6, + 0x85E7, 0x85E8, 0x85EA, 0x85EB, 0x85EC, 0x85ED, 0x85EE, 0x85EF, + 0x85F0, 0x85F1, 0x85F2, 0x85F3, 0x85F4, 0x85F5, 0x85F6, 0x85F7, + 0x85F8, 0x6055, 0x5237, 0x800D, 0x6454, 0x8870, 0x7529, 0x5E05, + 0x6813, 0x62F4, 0x971C, 0x53CC, 0x723D, 0x8C01, 0x6C34, 0x7761, + 0x7A0E, 0x542E, 0x77AC, 0x987A, 0x821C, 0x8BF4, 0x7855, 0x6714, + 0x70C1, 0x65AF, 0x6495, 0x5636, 0x601D, 0x79C1, 0x53F8, 0x4E1D, + 0x6B7B, 0x8086, 0x5BFA, 0x55E3, 0x56DB, 0x4F3A, 0x4F3C, 0x9972, + 0x5DF3, 0x677E, 0x8038, 0x6002, 0x9882, 0x9001, 0x5B8B, 0x8BBC, + 0x8BF5, 0x641C, 0x8258, 0x64DE, 0x55FD, 0x82CF, 0x9165, 0x4FD7, + 0x7D20, 0x901F, 0x7C9F, 0x50F3, 0x5851, 0x6EAF, 0x5BBF, 0x8BC9, + 0x8083, 0x9178, 0x849C, 0x7B97, 0x867D, 0x968B, 0x968F, 0x7EE5, + 0x9AD3, 0x788E, 0x5C81, 0x7A57, 0x9042, 0x96A7, 0x795F, 0x5B59, + 0x635F, 0x7B0B, 0x84D1, 0x68AD, 0x5506, 0x7F29, 0x7410, 0x7D22, + 0x9501, 0x6240, 0x584C, 0x4ED6, 0x5B83, 0x5979, 0x5854, ALTCHR, +/* 0xCC40 - 0xCCFF */ + 0x85F9, 0x85FA, 0x85FC, 0x85FD, 0x85FE, 0x8600, 0x8601, 0x8602, + 0x8603, 0x8604, 0x8606, 0x8607, 0x8608, 0x8609, 0x860A, 0x860B, + 0x860C, 0x860D, 0x860E, 0x860F, 0x8610, 0x8612, 0x8613, 0x8614, + 0x8615, 0x8617, 0x8618, 0x8619, 0x861A, 0x861B, 0x861C, 0x861D, + 0x861E, 0x861F, 0x8620, 0x8621, 0x8622, 0x8623, 0x8624, 0x8625, + 0x8626, 0x8628, 0x862A, 0x862B, 0x862C, 0x862D, 0x862E, 0x862F, + 0x8630, 0x8631, 0x8632, 0x8633, 0x8634, 0x8635, 0x8636, 0x8637, + 0x8639, 0x863A, 0x863B, 0x863D, 0x863E, 0x863F, 0x8640, ALTCHR, + 0x8641, 0x8642, 0x8643, 0x8644, 0x8645, 0x8646, 0x8647, 0x8648, + 0x8649, 0x864A, 0x864B, 0x864C, 0x8652, 0x8653, 0x8655, 0x8656, + 0x8657, 0x8658, 0x8659, 0x865B, 0x865C, 0x865D, 0x865F, 0x8660, + 0x8661, 0x8663, 0x8664, 0x8665, 0x8666, 0x8667, 0x8668, 0x8669, + 0x866A, 0x736D, 0x631E, 0x8E4B, 0x8E0F, 0x80CE, 0x82D4, 0x62AC, + 0x53F0, 0x6CF0, 0x915E, 0x592A, 0x6001, 0x6C70, 0x574D, 0x644A, + 0x8D2A, 0x762B, 0x6EE9, 0x575B, 0x6A80, 0x75F0, 0x6F6D, 0x8C2D, + 0x8C08, 0x5766, 0x6BEF, 0x8892, 0x78B3, 0x63A2, 0x53F9, 0x70AD, + 0x6C64, 0x5858, 0x642A, 0x5802, 0x68E0, 0x819B, 0x5510, 0x7CD6, + 0x5018, 0x8EBA, 0x6DCC, 0x8D9F, 0x70EB, 0x638F, 0x6D9B, 0x6ED4, + 0x7EE6, 0x8404, 0x6843, 0x9003, 0x6DD8, 0x9676, 0x8BA8, 0x5957, + 0x7279, 0x85E4, 0x817E, 0x75BC, 0x8A8A, 0x68AF, 0x5254, 0x8E22, + 0x9511, 0x63D0, 0x9898, 0x8E44, 0x557C, 0x4F53, 0x66FF, 0x568F, + 0x60D5, 0x6D95, 0x5243, 0x5C49, 0x5929, 0x6DFB, 0x586B, 0x7530, + 0x751C, 0x606C, 0x8214, 0x8146, 0x6311, 0x6761, 0x8FE2, 0x773A, + 0x8DF3, 0x8D34, 0x94C1, 0x5E16, 0x5385, 0x542C, 0x70C3, ALTCHR, +/* 0xCD40 - 0xCDFF */ + 0x866D, 0x866F, 0x8670, 0x8672, 0x8673, 0x8674, 0x8675, 0x8676, + 0x8677, 0x8678, 0x8683, 0x8684, 0x8685, 0x8686, 0x8687, 0x8688, + 0x8689, 0x868E, 0x868F, 0x8690, 0x8691, 0x8692, 0x8694, 0x8696, + 0x8697, 0x8698, 0x8699, 0x869A, 0x869B, 0x869E, 0x869F, 0x86A0, + 0x86A1, 0x86A2, 0x86A5, 0x86A6, 0x86AB, 0x86AD, 0x86AE, 0x86B2, + 0x86B3, 0x86B7, 0x86B8, 0x86B9, 0x86BB, 0x86BC, 0x86BD, 0x86BE, + 0x86BF, 0x86C1, 0x86C2, 0x86C3, 0x86C5, 0x86C8, 0x86CC, 0x86CD, + 0x86D2, 0x86D3, 0x86D5, 0x86D6, 0x86D7, 0x86DA, 0x86DC, ALTCHR, + 0x86DD, 0x86E0, 0x86E1, 0x86E2, 0x86E3, 0x86E5, 0x86E6, 0x86E7, + 0x86E8, 0x86EA, 0x86EB, 0x86EC, 0x86EF, 0x86F5, 0x86F6, 0x86F7, + 0x86FA, 0x86FB, 0x86FC, 0x86FD, 0x86FF, 0x8701, 0x8704, 0x8705, + 0x8706, 0x870B, 0x870C, 0x870E, 0x870F, 0x8710, 0x8711, 0x8714, + 0x8716, 0x6C40, 0x5EF7, 0x505C, 0x4EAD, 0x5EAD, 0x633A, 0x8247, + 0x901A, 0x6850, 0x916E, 0x77B3, 0x540C, 0x94DC, 0x5F64, 0x7AE5, + 0x6876, 0x6345, 0x7B52, 0x7EDF, 0x75DB, 0x5077, 0x6295, 0x5934, + 0x900F, 0x51F8, 0x79C3, 0x7A81, 0x56FE, 0x5F92, 0x9014, 0x6D82, + 0x5C60, 0x571F, 0x5410, 0x5154, 0x6E4D, 0x56E2, 0x63A8, 0x9893, + 0x817F, 0x8715, 0x892A, 0x9000, 0x541E, 0x5C6F, 0x81C0, 0x62D6, + 0x6258, 0x8131, 0x9E35, 0x9640, 0x9A6E, 0x9A7C, 0x692D, 0x59A5, + 0x62D3, 0x553E, 0x6316, 0x54C7, 0x86D9, 0x6D3C, 0x5A03, 0x74E6, + 0x889C, 0x6B6A, 0x5916, 0x8C4C, 0x5F2F, 0x6E7E, 0x73A9, 0x987D, + 0x4E38, 0x70F7, 0x5B8C, 0x7897, 0x633D, 0x665A, 0x7696, 0x60CB, + 0x5B9B, 0x5A49, 0x4E07, 0x8155, 0x6C6A, 0x738B, 0x4EA1, 0x6789, + 0x7F51, 0x5F80, 0x65FA, 0x671B, 0x5FD8, 0x5984, 0x5A01, ALTCHR, +/* 0xCE40 - 0xCEFF */ + 0x8719, 0x871B, 0x871D, 0x871F, 0x8720, 0x8724, 0x8726, 0x8727, + 0x8728, 0x872A, 0x872B, 0x872C, 0x872D, 0x872F, 0x8730, 0x8732, + 0x8733, 0x8735, 0x8736, 0x8738, 0x8739, 0x873A, 0x873C, 0x873D, + 0x8740, 0x8741, 0x8742, 0x8743, 0x8744, 0x8745, 0x8746, 0x874A, + 0x874B, 0x874D, 0x874F, 0x8750, 0x8751, 0x8752, 0x8754, 0x8755, + 0x8756, 0x8758, 0x875A, 0x875B, 0x875C, 0x875D, 0x875E, 0x875F, + 0x8761, 0x8762, 0x8766, 0x8767, 0x8768, 0x8769, 0x876A, 0x876B, + 0x876C, 0x876D, 0x876F, 0x8771, 0x8772, 0x8773, 0x8775, ALTCHR, + 0x8777, 0x8778, 0x8779, 0x877A, 0x877F, 0x8780, 0x8781, 0x8784, + 0x8786, 0x8787, 0x8789, 0x878A, 0x878C, 0x878E, 0x878F, 0x8790, + 0x8791, 0x8792, 0x8794, 0x8795, 0x8796, 0x8798, 0x8799, 0x879A, + 0x879B, 0x879C, 0x879D, 0x879E, 0x87A0, 0x87A1, 0x87A2, 0x87A3, + 0x87A4, 0x5DCD, 0x5FAE, 0x5371, 0x97E6, 0x8FDD, 0x6845, 0x56F4, + 0x552F, 0x60DF, 0x4E3A, 0x6F4D, 0x7EF4, 0x82C7, 0x840E, 0x59D4, + 0x4F1F, 0x4F2A, 0x5C3E, 0x7EAC, 0x672A, 0x851A, 0x5473, 0x754F, + 0x80C3, 0x5582, 0x9B4F, 0x4F4D, 0x6E2D, 0x8C13, 0x5C09, 0x6170, + 0x536B, 0x761F, 0x6E29, 0x868A, 0x6587, 0x95FB, 0x7EB9, 0x543B, + 0x7A33, 0x7D0A, 0x95EE, 0x55E1, 0x7FC1, 0x74EE, 0x631D, 0x8717, + 0x6DA1, 0x7A9D, 0x6211, 0x65A1, 0x5367, 0x63E1, 0x6C83, 0x5DEB, + 0x545C, 0x94A8, 0x4E4C, 0x6C61, 0x8BEC, 0x5C4B, 0x65E0, 0x829C, + 0x68A7, 0x543E, 0x5434, 0x6BCB, 0x6B66, 0x4E94, 0x6342, 0x5348, + 0x821E, 0x4F0D, 0x4FAE, 0x575E, 0x620A, 0x96FE, 0x6664, 0x7269, + 0x52FF, 0x52A1, 0x609F, 0x8BEF, 0x6614, 0x7199, 0x6790, 0x897F, + 0x7852, 0x77FD, 0x6670, 0x563B, 0x5438, 0x9521, 0x727A, ALTCHR, +/* 0xCF40 - 0xCFFF */ + 0x87A5, 0x87A6, 0x87A7, 0x87A9, 0x87AA, 0x87AE, 0x87B0, 0x87B1, + 0x87B2, 0x87B4, 0x87B6, 0x87B7, 0x87B8, 0x87B9, 0x87BB, 0x87BC, + 0x87BE, 0x87BF, 0x87C1, 0x87C2, 0x87C3, 0x87C4, 0x87C5, 0x87C7, + 0x87C8, 0x87C9, 0x87CC, 0x87CD, 0x87CE, 0x87CF, 0x87D0, 0x87D4, + 0x87D5, 0x87D6, 0x87D7, 0x87D8, 0x87D9, 0x87DA, 0x87DC, 0x87DD, + 0x87DE, 0x87DF, 0x87E1, 0x87E2, 0x87E3, 0x87E4, 0x87E6, 0x87E7, + 0x87E8, 0x87E9, 0x87EB, 0x87EC, 0x87ED, 0x87EF, 0x87F0, 0x87F1, + 0x87F2, 0x87F3, 0x87F4, 0x87F5, 0x87F6, 0x87F7, 0x87F8, ALTCHR, + 0x87FA, 0x87FB, 0x87FC, 0x87FD, 0x87FF, 0x8800, 0x8801, 0x8802, + 0x8804, 0x8805, 0x8806, 0x8807, 0x8808, 0x8809, 0x880B, 0x880C, + 0x880D, 0x880E, 0x880F, 0x8810, 0x8811, 0x8812, 0x8814, 0x8817, + 0x8818, 0x8819, 0x881A, 0x881C, 0x881D, 0x881E, 0x881F, 0x8820, + 0x8823, 0x7A00, 0x606F, 0x5E0C, 0x6089, 0x819D, 0x5915, 0x60DC, + 0x7184, 0x70EF, 0x6EAA, 0x6C50, 0x7280, 0x6A84, 0x88AD, 0x5E2D, + 0x4E60, 0x5AB3, 0x559C, 0x94E3, 0x6D17, 0x7CFB, 0x9699, 0x620F, + 0x7EC6, 0x778E, 0x867E, 0x5323, 0x971E, 0x8F96, 0x6687, 0x5CE1, + 0x4FA0, 0x72ED, 0x4E0B, 0x53A6, 0x590F, 0x5413, 0x6380, 0x9528, + 0x5148, 0x4ED9, 0x9C9C, 0x7EA4, 0x54B8, 0x8D24, 0x8854, 0x8237, + 0x95F2, 0x6D8E, 0x5F26, 0x5ACC, 0x663E, 0x9669, 0x73B0, 0x732E, + 0x53BF, 0x817A, 0x9985, 0x7FA1, 0x5BAA, 0x9677, 0x9650, 0x7EBF, + 0x76F8, 0x53A2, 0x9576, 0x9999, 0x7BB1, 0x8944, 0x6E58, 0x4E61, + 0x7FD4, 0x7965, 0x8BE6, 0x60F3, 0x54CD, 0x4EAB, 0x9879, 0x5DF7, + 0x6A61, 0x50CF, 0x5411, 0x8C61, 0x8427, 0x785D, 0x9704, 0x524A, + 0x54EE, 0x56A3, 0x9500, 0x6D88, 0x5BB5, 0x6DC6, 0x6653, ALTCHR, +/* 0xD040 - 0xD0FF */ + 0x8824, 0x8825, 0x8826, 0x8827, 0x8828, 0x8829, 0x882A, 0x882B, + 0x882C, 0x882D, 0x882E, 0x882F, 0x8830, 0x8831, 0x8833, 0x8834, + 0x8835, 0x8836, 0x8837, 0x8838, 0x883A, 0x883B, 0x883D, 0x883E, + 0x883F, 0x8841, 0x8842, 0x8843, 0x8846, 0x8847, 0x8848, 0x8849, + 0x884A, 0x884B, 0x884E, 0x884F, 0x8850, 0x8851, 0x8852, 0x8853, + 0x8855, 0x8856, 0x8858, 0x885A, 0x885B, 0x885C, 0x885D, 0x885E, + 0x885F, 0x8860, 0x8866, 0x8867, 0x886A, 0x886D, 0x886F, 0x8871, + 0x8873, 0x8874, 0x8875, 0x8876, 0x8878, 0x8879, 0x887A, ALTCHR, + 0x887B, 0x887C, 0x8880, 0x8883, 0x8886, 0x8887, 0x8889, 0x888A, + 0x888C, 0x888E, 0x888F, 0x8890, 0x8891, 0x8893, 0x8894, 0x8895, + 0x8897, 0x8898, 0x8899, 0x889A, 0x889B, 0x889D, 0x889E, 0x889F, + 0x88A0, 0x88A1, 0x88A3, 0x88A5, 0x88A6, 0x88A7, 0x88A8, 0x88A9, + 0x88AA, 0x5C0F, 0x5B5D, 0x6821, 0x8096, 0x5578, 0x7B11, 0x6548, + 0x6954, 0x4E9B, 0x6B47, 0x874E, 0x978B, 0x534F, 0x631F, 0x643A, + 0x90AA, 0x659C, 0x80C1, 0x8C10, 0x5199, 0x68B0, 0x5378, 0x87F9, + 0x61C8, 0x6CC4, 0x6CFB, 0x8C22, 0x5C51, 0x85AA, 0x82AF, 0x950C, + 0x6B23, 0x8F9B, 0x65B0, 0x5FFB, 0x5FC3, 0x4FE1, 0x8845, 0x661F, + 0x8165, 0x7329, 0x60FA, 0x5174, 0x5211, 0x578B, 0x5F62, 0x90A2, + 0x884C, 0x9192, 0x5E78, 0x674F, 0x6027, 0x59D3, 0x5144, 0x51F6, + 0x80F8, 0x5308, 0x6C79, 0x96C4, 0x718A, 0x4F11, 0x4FEE, 0x7F9E, + 0x673D, 0x55C5, 0x9508, 0x79C0, 0x8896, 0x7EE3, 0x589F, 0x620C, + 0x9700, 0x865A, 0x5618, 0x987B, 0x5F90, 0x8BB8, 0x84C4, 0x9157, + 0x53D9, 0x65ED, 0x5E8F, 0x755C, 0x6064, 0x7D6E, 0x5A7F, 0x7EEA, + 0x7EED, 0x8F69, 0x55A7, 0x5BA3, 0x60AC, 0x65CB, 0x7384, ALTCHR, +/* 0xD140 - 0xD1FF */ + 0x88AC, 0x88AE, 0x88AF, 0x88B0, 0x88B2, 0x88B3, 0x88B4, 0x88B5, + 0x88B6, 0x88B8, 0x88B9, 0x88BA, 0x88BB, 0x88BD, 0x88BE, 0x88BF, + 0x88C0, 0x88C3, 0x88C4, 0x88C7, 0x88C8, 0x88CA, 0x88CB, 0x88CC, + 0x88CD, 0x88CF, 0x88D0, 0x88D1, 0x88D3, 0x88D6, 0x88D7, 0x88DA, + 0x88DB, 0x88DC, 0x88DD, 0x88DE, 0x88E0, 0x88E1, 0x88E6, 0x88E7, + 0x88E9, 0x88EA, 0x88EB, 0x88EC, 0x88ED, 0x88EE, 0x88EF, 0x88F2, + 0x88F5, 0x88F6, 0x88F7, 0x88FA, 0x88FB, 0x88FD, 0x88FF, 0x8900, + 0x8901, 0x8903, 0x8904, 0x8905, 0x8906, 0x8907, 0x8908, ALTCHR, + 0x8909, 0x890B, 0x890C, 0x890D, 0x890E, 0x890F, 0x8911, 0x8914, + 0x8915, 0x8916, 0x8917, 0x8918, 0x891C, 0x891D, 0x891E, 0x891F, + 0x8920, 0x8922, 0x8923, 0x8924, 0x8926, 0x8927, 0x8928, 0x8929, + 0x892C, 0x892D, 0x892E, 0x892F, 0x8931, 0x8932, 0x8933, 0x8935, + 0x8937, 0x9009, 0x7663, 0x7729, 0x7EDA, 0x9774, 0x859B, 0x5B66, + 0x7A74, 0x96EA, 0x8840, 0x52CB, 0x718F, 0x5FAA, 0x65EC, 0x8BE2, + 0x5BFB, 0x9A6F, 0x5DE1, 0x6B89, 0x6C5B, 0x8BAD, 0x8BAF, 0x900A, + 0x8FC5, 0x538B, 0x62BC, 0x9E26, 0x9E2D, 0x5440, 0x4E2B, 0x82BD, + 0x7259, 0x869C, 0x5D16, 0x8859, 0x6DAF, 0x96C5, 0x54D1, 0x4E9A, + 0x8BB6, 0x7109, 0x54BD, 0x9609, 0x70DF, 0x6DF9, 0x76D0, 0x4E25, + 0x7814, 0x8712, 0x5CA9, 0x5EF6, 0x8A00, 0x989C, 0x960E, 0x708E, + 0x6CBF, 0x5944, 0x63A9, 0x773C, 0x884D, 0x6F14, 0x8273, 0x5830, + 0x71D5, 0x538C, 0x781A, 0x96C1, 0x5501, 0x5F66, 0x7130, 0x5BB4, + 0x8C1A, 0x9A8C, 0x6B83, 0x592E, 0x9E2F, 0x79E7, 0x6768, 0x626C, + 0x4F6F, 0x75A1, 0x7F8A, 0x6D0B, 0x9633, 0x6C27, 0x4EF0, 0x75D2, + 0x517B, 0x6837, 0x6F3E, 0x9080, 0x8170, 0x5996, 0x7476, ALTCHR, +/* 0xD240 - 0xD2FF */ + 0x8938, 0x8939, 0x893A, 0x893B, 0x893C, 0x893D, 0x893E, 0x893F, + 0x8940, 0x8942, 0x8943, 0x8945, 0x8946, 0x8947, 0x8948, 0x8949, + 0x894A, 0x894B, 0x894C, 0x894D, 0x894E, 0x894F, 0x8950, 0x8951, + 0x8952, 0x8953, 0x8954, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, + 0x895A, 0x895B, 0x895C, 0x895D, 0x8960, 0x8961, 0x8962, 0x8963, + 0x8964, 0x8965, 0x8967, 0x8968, 0x8969, 0x896A, 0x896B, 0x896C, + 0x896D, 0x896E, 0x896F, 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, + 0x8975, 0x8976, 0x8977, 0x8978, 0x8979, 0x897A, 0x897C, ALTCHR, + 0x897D, 0x897E, 0x8980, 0x8982, 0x8984, 0x8985, 0x8987, 0x8988, + 0x8989, 0x898A, 0x898B, 0x898C, 0x898D, 0x898E, 0x898F, 0x8990, + 0x8991, 0x8992, 0x8993, 0x8994, 0x8995, 0x8996, 0x8997, 0x8998, + 0x8999, 0x899A, 0x899B, 0x899C, 0x899D, 0x899E, 0x899F, 0x89A0, + 0x89A1, 0x6447, 0x5C27, 0x9065, 0x7A91, 0x8C23, 0x59DA, 0x54AC, + 0x8200, 0x836F, 0x8981, 0x8000, 0x6930, 0x564E, 0x8036, 0x7237, + 0x91CE, 0x51B6, 0x4E5F, 0x9875, 0x6396, 0x4E1A, 0x53F6, 0x66F3, + 0x814B, 0x591C, 0x6DB2, 0x4E00, 0x58F9, 0x533B, 0x63D6, 0x94F1, + 0x4F9D, 0x4F0A, 0x8863, 0x9890, 0x5937, 0x9057, 0x79FB, 0x4EEA, + 0x80F0, 0x7591, 0x6C82, 0x5B9C, 0x59E8, 0x5F5D, 0x6905, 0x8681, + 0x501A, 0x5DF2, 0x4E59, 0x77E3, 0x4EE5, 0x827A, 0x6291, 0x6613, + 0x9091, 0x5C79, 0x4EBF, 0x5F79, 0x81C6, 0x9038, 0x8084, 0x75AB, + 0x4EA6, 0x88D4, 0x610F, 0x6BC5, 0x5FC6, 0x4E49, 0x76CA, 0x6EA2, + 0x8BE3, 0x8BAE, 0x8C0A, 0x8BD1, 0x5F02, 0x7FFC, 0x7FCC, 0x7ECE, + 0x8335, 0x836B, 0x56E0, 0x6BB7, 0x97F3, 0x9634, 0x59FB, 0x541F, + 0x94F6, 0x6DEB, 0x5BC5, 0x996E, 0x5C39, 0x5F15, 0x9690, ALTCHR, +/* 0xD340 - 0xD3FF */ + 0x89A2, 0x89A3, 0x89A4, 0x89A5, 0x89A6, 0x89A7, 0x89A8, 0x89A9, + 0x89AA, 0x89AB, 0x89AC, 0x89AD, 0x89AE, 0x89AF, 0x89B0, 0x89B1, + 0x89B2, 0x89B3, 0x89B4, 0x89B5, 0x89B6, 0x89B7, 0x89B8, 0x89B9, + 0x89BA, 0x89BB, 0x89BC, 0x89BD, 0x89BE, 0x89BF, 0x89C0, 0x89C3, + 0x89CD, 0x89D3, 0x89D4, 0x89D5, 0x89D7, 0x89D8, 0x89D9, 0x89DB, + 0x89DD, 0x89DF, 0x89E0, 0x89E1, 0x89E2, 0x89E4, 0x89E7, 0x89E8, + 0x89E9, 0x89EA, 0x89EC, 0x89ED, 0x89EE, 0x89F0, 0x89F1, 0x89F2, + 0x89F4, 0x89F5, 0x89F6, 0x89F7, 0x89F8, 0x89F9, 0x89FA, ALTCHR, + 0x89FB, 0x89FC, 0x89FD, 0x89FE, 0x89FF, 0x8A01, 0x8A02, 0x8A03, + 0x8A04, 0x8A05, 0x8A06, 0x8A08, 0x8A09, 0x8A0A, 0x8A0B, 0x8A0C, + 0x8A0D, 0x8A0E, 0x8A0F, 0x8A10, 0x8A11, 0x8A12, 0x8A13, 0x8A14, + 0x8A15, 0x8A16, 0x8A17, 0x8A18, 0x8A19, 0x8A1A, 0x8A1B, 0x8A1C, + 0x8A1D, 0x5370, 0x82F1, 0x6A31, 0x5A74, 0x9E70, 0x5E94, 0x7F28, + 0x83B9, 0x8424, 0x8425, 0x8367, 0x8747, 0x8FCE, 0x8D62, 0x76C8, + 0x5F71, 0x9896, 0x786C, 0x6620, 0x54DF, 0x62E5, 0x4F63, 0x81C3, + 0x75C8, 0x5EB8, 0x96CD, 0x8E0A, 0x86F9, 0x548F, 0x6CF3, 0x6D8C, + 0x6C38, 0x607F, 0x52C7, 0x7528, 0x5E7D, 0x4F18, 0x60A0, 0x5FE7, + 0x5C24, 0x7531, 0x90AE, 0x94C0, 0x72B9, 0x6CB9, 0x6E38, 0x9149, + 0x6709, 0x53CB, 0x53F3, 0x4F51, 0x91C9, 0x8BF1, 0x53C8, 0x5E7C, + 0x8FC2, 0x6DE4, 0x4E8E, 0x76C2, 0x6986, 0x865E, 0x611A, 0x8206, + 0x4F59, 0x4FDE, 0x903E, 0x9C7C, 0x6109, 0x6E1D, 0x6E14, 0x9685, + 0x4E88, 0x5A31, 0x96E8, 0x4E0E, 0x5C7F, 0x79B9, 0x5B87, 0x8BED, + 0x7FBD, 0x7389, 0x57DF, 0x828B, 0x90C1, 0x5401, 0x9047, 0x55BB, + 0x5CEA, 0x5FA1, 0x6108, 0x6B32, 0x72F1, 0x80B2, 0x8A89, ALTCHR, +/* 0xD440 - 0xD4FF */ + 0x8A1E, 0x8A1F, 0x8A20, 0x8A21, 0x8A22, 0x8A23, 0x8A24, 0x8A25, + 0x8A26, 0x8A27, 0x8A28, 0x8A29, 0x8A2A, 0x8A2B, 0x8A2C, 0x8A2D, + 0x8A2E, 0x8A2F, 0x8A30, 0x8A31, 0x8A32, 0x8A33, 0x8A34, 0x8A35, + 0x8A36, 0x8A37, 0x8A38, 0x8A39, 0x8A3A, 0x8A3B, 0x8A3C, 0x8A3D, + 0x8A3F, 0x8A40, 0x8A41, 0x8A42, 0x8A43, 0x8A44, 0x8A45, 0x8A46, + 0x8A47, 0x8A49, 0x8A4A, 0x8A4B, 0x8A4C, 0x8A4D, 0x8A4E, 0x8A4F, + 0x8A50, 0x8A51, 0x8A52, 0x8A53, 0x8A54, 0x8A55, 0x8A56, 0x8A57, + 0x8A58, 0x8A59, 0x8A5A, 0x8A5B, 0x8A5C, 0x8A5D, 0x8A5E, ALTCHR, + 0x8A5F, 0x8A60, 0x8A61, 0x8A62, 0x8A63, 0x8A64, 0x8A65, 0x8A66, + 0x8A67, 0x8A68, 0x8A69, 0x8A6A, 0x8A6B, 0x8A6C, 0x8A6D, 0x8A6E, + 0x8A6F, 0x8A70, 0x8A71, 0x8A72, 0x8A73, 0x8A74, 0x8A75, 0x8A76, + 0x8A77, 0x8A78, 0x8A7A, 0x8A7B, 0x8A7C, 0x8A7D, 0x8A7E, 0x8A7F, + 0x8A80, 0x6D74, 0x5BD3, 0x88D5, 0x9884, 0x8C6B, 0x9A6D, 0x9E33, + 0x6E0A, 0x51A4, 0x5143, 0x57A3, 0x8881, 0x539F, 0x63F4, 0x8F95, + 0x56ED, 0x5458, 0x5706, 0x733F, 0x6E90, 0x7F18, 0x8FDC, 0x82D1, + 0x613F, 0x6028, 0x9662, 0x66F0, 0x7EA6, 0x8D8A, 0x8DC3, 0x94A5, + 0x5CB3, 0x7CA4, 0x6708, 0x60A6, 0x9605, 0x8018, 0x4E91, 0x90E7, + 0x5300, 0x9668, 0x5141, 0x8FD0, 0x8574, 0x915D, 0x6655, 0x97F5, + 0x5B55, 0x531D, 0x7838, 0x6742, 0x683D, 0x54C9, 0x707E, 0x5BB0, + 0x8F7D, 0x518D, 0x5728, 0x54B1, 0x6512, 0x6682, 0x8D5E, 0x8D43, + 0x810F, 0x846C, 0x906D, 0x7CDF, 0x51FF, 0x85FB, 0x67A3, 0x65E9, + 0x6FA1, 0x86A4, 0x8E81, 0x566A, 0x9020, 0x7682, 0x7076, 0x71E5, + 0x8D23, 0x62E9, 0x5219, 0x6CFD, 0x8D3C, 0x600E, 0x589E, 0x618E, + 0x66FE, 0x8D60, 0x624E, 0x55B3, 0x6E23, 0x672D, 0x8F67, ALTCHR, +/* 0xD540 - 0xD5FF */ + 0x8A81, 0x8A82, 0x8A83, 0x8A84, 0x8A85, 0x8A86, 0x8A87, 0x8A88, + 0x8A8B, 0x8A8C, 0x8A8D, 0x8A8E, 0x8A8F, 0x8A90, 0x8A91, 0x8A92, + 0x8A94, 0x8A95, 0x8A96, 0x8A97, 0x8A98, 0x8A99, 0x8A9A, 0x8A9B, + 0x8A9C, 0x8A9D, 0x8A9E, 0x8A9F, 0x8AA0, 0x8AA1, 0x8AA2, 0x8AA3, + 0x8AA4, 0x8AA5, 0x8AA6, 0x8AA7, 0x8AA8, 0x8AA9, 0x8AAA, 0x8AAB, + 0x8AAC, 0x8AAD, 0x8AAE, 0x8AAF, 0x8AB0, 0x8AB1, 0x8AB2, 0x8AB3, + 0x8AB4, 0x8AB5, 0x8AB6, 0x8AB7, 0x8AB8, 0x8AB9, 0x8ABA, 0x8ABB, + 0x8ABC, 0x8ABD, 0x8ABE, 0x8ABF, 0x8AC0, 0x8AC1, 0x8AC2, ALTCHR, + 0x8AC3, 0x8AC4, 0x8AC5, 0x8AC6, 0x8AC7, 0x8AC8, 0x8AC9, 0x8ACA, + 0x8ACB, 0x8ACC, 0x8ACD, 0x8ACE, 0x8ACF, 0x8AD0, 0x8AD1, 0x8AD2, + 0x8AD3, 0x8AD4, 0x8AD5, 0x8AD6, 0x8AD7, 0x8AD8, 0x8AD9, 0x8ADA, + 0x8ADB, 0x8ADC, 0x8ADD, 0x8ADE, 0x8ADF, 0x8AE0, 0x8AE1, 0x8AE2, + 0x8AE3, 0x94E1, 0x95F8, 0x7728, 0x6805, 0x69A8, 0x548B, 0x4E4D, + 0x70B8, 0x8BC8, 0x6458, 0x658B, 0x5B85, 0x7A84, 0x503A, 0x5BE8, + 0x77BB, 0x6BE1, 0x8A79, 0x7C98, 0x6CBE, 0x76CF, 0x65A9, 0x8F97, + 0x5D2D, 0x5C55, 0x8638, 0x6808, 0x5360, 0x6218, 0x7AD9, 0x6E5B, + 0x7EFD, 0x6A1F, 0x7AE0, 0x5F70, 0x6F33, 0x5F20, 0x638C, 0x6DA8, + 0x6756, 0x4E08, 0x5E10, 0x8D26, 0x4ED7, 0x80C0, 0x7634, 0x969C, + 0x62DB, 0x662D, 0x627E, 0x6CBC, 0x8D75, 0x7167, 0x7F69, 0x5146, + 0x8087, 0x53EC, 0x906E, 0x6298, 0x54F2, 0x86F0, 0x8F99, 0x8005, + 0x9517, 0x8517, 0x8FD9, 0x6D59, 0x73CD, 0x659F, 0x771F, 0x7504, + 0x7827, 0x81FB, 0x8D1E, 0x9488, 0x4FA6, 0x6795, 0x75B9, 0x8BCA, + 0x9707, 0x632F, 0x9547, 0x9635, 0x84B8, 0x6323, 0x7741, 0x5F81, + 0x72F0, 0x4E89, 0x6014, 0x6574, 0x62EF, 0x6B63, 0x653F, ALTCHR, +/* 0xD640 - 0xD6FF */ + 0x8AE4, 0x8AE5, 0x8AE6, 0x8AE7, 0x8AE8, 0x8AE9, 0x8AEA, 0x8AEB, + 0x8AEC, 0x8AED, 0x8AEE, 0x8AEF, 0x8AF0, 0x8AF1, 0x8AF2, 0x8AF3, + 0x8AF4, 0x8AF5, 0x8AF6, 0x8AF7, 0x8AF8, 0x8AF9, 0x8AFA, 0x8AFB, + 0x8AFC, 0x8AFD, 0x8AFE, 0x8AFF, 0x8B00, 0x8B01, 0x8B02, 0x8B03, + 0x8B04, 0x8B05, 0x8B06, 0x8B08, 0x8B09, 0x8B0A, 0x8B0B, 0x8B0C, + 0x8B0D, 0x8B0E, 0x8B0F, 0x8B10, 0x8B11, 0x8B12, 0x8B13, 0x8B14, + 0x8B15, 0x8B16, 0x8B17, 0x8B18, 0x8B19, 0x8B1A, 0x8B1B, 0x8B1C, + 0x8B1D, 0x8B1E, 0x8B1F, 0x8B20, 0x8B21, 0x8B22, 0x8B23, ALTCHR, + 0x8B24, 0x8B25, 0x8B27, 0x8B28, 0x8B29, 0x8B2A, 0x8B2B, 0x8B2C, + 0x8B2D, 0x8B2E, 0x8B2F, 0x8B30, 0x8B31, 0x8B32, 0x8B33, 0x8B34, + 0x8B35, 0x8B36, 0x8B37, 0x8B38, 0x8B39, 0x8B3A, 0x8B3B, 0x8B3C, + 0x8B3D, 0x8B3E, 0x8B3F, 0x8B40, 0x8B41, 0x8B42, 0x8B43, 0x8B44, + 0x8B45, 0x5E27, 0x75C7, 0x90D1, 0x8BC1, 0x829D, 0x679D, 0x652F, + 0x5431, 0x8718, 0x77E5, 0x80A2, 0x8102, 0x6C41, 0x4E4B, 0x7EC7, + 0x804C, 0x76F4, 0x690D, 0x6B96, 0x6267, 0x503C, 0x4F84, 0x5740, + 0x6307, 0x6B62, 0x8DBE, 0x53EA, 0x65E8, 0x7EB8, 0x5FD7, 0x631A, + 0x63B7, 0x81F3, 0x81F4, 0x7F6E, 0x5E1C, 0x5CD9, 0x5236, 0x667A, + 0x79E9, 0x7A1A, 0x8D28, 0x7099, 0x75D4, 0x6EDE, 0x6CBB, 0x7A92, + 0x4E2D, 0x76C5, 0x5FE0, 0x949F, 0x8877, 0x7EC8, 0x79CD, 0x80BF, + 0x91CD, 0x4EF2, 0x4F17, 0x821F, 0x5468, 0x5DDE, 0x6D32, 0x8BCC, + 0x7CA5, 0x8F74, 0x8098, 0x5E1A, 0x5492, 0x76B1, 0x5B99, 0x663C, + 0x9AA4, 0x73E0, 0x682A, 0x86DB, 0x6731, 0x732A, 0x8BF8, 0x8BDB, + 0x9010, 0x7AF9, 0x70DB, 0x716E, 0x62C4, 0x77A9, 0x5631, 0x4E3B, + 0x8457, 0x67F1, 0x52A9, 0x86C0, 0x8D2E, 0x94F8, 0x7B51, ALTCHR, +/* 0xD740 - 0xD7FF */ + 0x8B46, 0x8B47, 0x8B48, 0x8B49, 0x8B4A, 0x8B4B, 0x8B4C, 0x8B4D, + 0x8B4E, 0x8B4F, 0x8B50, 0x8B51, 0x8B52, 0x8B53, 0x8B54, 0x8B55, + 0x8B56, 0x8B57, 0x8B58, 0x8B59, 0x8B5A, 0x8B5B, 0x8B5C, 0x8B5D, + 0x8B5E, 0x8B5F, 0x8B60, 0x8B61, 0x8B62, 0x8B63, 0x8B64, 0x8B65, + 0x8B67, 0x8B68, 0x8B69, 0x8B6A, 0x8B6B, 0x8B6D, 0x8B6E, 0x8B6F, + 0x8B70, 0x8B71, 0x8B72, 0x8B73, 0x8B74, 0x8B75, 0x8B76, 0x8B77, + 0x8B78, 0x8B79, 0x8B7A, 0x8B7B, 0x8B7C, 0x8B7D, 0x8B7E, 0x8B7F, + 0x8B80, 0x8B81, 0x8B82, 0x8B83, 0x8B84, 0x8B85, 0x8B86, ALTCHR, + 0x8B87, 0x8B88, 0x8B89, 0x8B8A, 0x8B8B, 0x8B8C, 0x8B8D, 0x8B8E, + 0x8B8F, 0x8B90, 0x8B91, 0x8B92, 0x8B93, 0x8B94, 0x8B95, 0x8B96, + 0x8B97, 0x8B98, 0x8B99, 0x8B9A, 0x8B9B, 0x8B9C, 0x8B9D, 0x8B9E, + 0x8B9F, 0x8BAC, 0x8BB1, 0x8BBB, 0x8BC7, 0x8BD0, 0x8BEA, 0x8C09, + 0x8C1E, 0x4F4F, 0x6CE8, 0x795D, 0x9A7B, 0x6293, 0x722A, 0x62FD, + 0x4E13, 0x7816, 0x8F6C, 0x64B0, 0x8D5A, 0x7BC6, 0x6869, 0x5E84, + 0x88C5, 0x5986, 0x649E, 0x58EE, 0x72B6, 0x690E, 0x9525, 0x8FFD, + 0x8D58, 0x5760, 0x7F00, 0x8C06, 0x51C6, 0x6349, 0x62D9, 0x5353, + 0x684C, 0x7422, 0x8301, 0x914C, 0x5544, 0x7740, 0x707C, 0x6D4A, + 0x5179, 0x54A8, 0x8D44, 0x59FF, 0x6ECB, 0x6DC4, 0x5B5C, 0x7D2B, + 0x4ED4, 0x7C7D, 0x6ED3, 0x5B50, 0x81EA, 0x6E0D, 0x5B57, 0x9B03, + 0x68D5, 0x8E2A, 0x5B97, 0x7EFC, 0x603B, 0x7EB5, 0x90B9, 0x8D70, + 0x594F, 0x63CD, 0x79DF, 0x8DB3, 0x5352, 0x65CF, 0x7956, 0x8BC5, + 0x963B, 0x7EC4, 0x94BB, 0x7E82, 0x5634, 0x9189, 0x6700, 0x7F6A, + 0x5C0A, 0x9075, 0x6628, 0x5DE6, 0x4F50, 0x67DE, 0x505A, 0x4F5C, + 0x5750, 0x5EA7, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xD840 - 0xD8FF */ + 0x8C38, 0x8C39, 0x8C3A, 0x8C3B, 0x8C3C, 0x8C3D, 0x8C3E, 0x8C3F, + 0x8C40, 0x8C42, 0x8C43, 0x8C44, 0x8C45, 0x8C48, 0x8C4A, 0x8C4B, + 0x8C4D, 0x8C4E, 0x8C4F, 0x8C50, 0x8C51, 0x8C52, 0x8C53, 0x8C54, + 0x8C56, 0x8C57, 0x8C58, 0x8C59, 0x8C5B, 0x8C5C, 0x8C5D, 0x8C5E, + 0x8C5F, 0x8C60, 0x8C63, 0x8C64, 0x8C65, 0x8C66, 0x8C67, 0x8C68, + 0x8C69, 0x8C6C, 0x8C6D, 0x8C6E, 0x8C6F, 0x8C70, 0x8C71, 0x8C72, + 0x8C74, 0x8C75, 0x8C76, 0x8C77, 0x8C7B, 0x8C7C, 0x8C7D, 0x8C7E, + 0x8C7F, 0x8C80, 0x8C81, 0x8C83, 0x8C84, 0x8C86, 0x8C87, ALTCHR, + 0x8C88, 0x8C8B, 0x8C8D, 0x8C8E, 0x8C8F, 0x8C90, 0x8C91, 0x8C92, + 0x8C93, 0x8C95, 0x8C96, 0x8C97, 0x8C99, 0x8C9A, 0x8C9B, 0x8C9C, + 0x8C9D, 0x8C9E, 0x8C9F, 0x8CA0, 0x8CA1, 0x8CA2, 0x8CA3, 0x8CA4, + 0x8CA5, 0x8CA6, 0x8CA7, 0x8CA8, 0x8CA9, 0x8CAA, 0x8CAB, 0x8CAC, + 0x8CAD, 0x4E8D, 0x4E0C, 0x5140, 0x4E10, 0x5EFF, 0x5345, 0x4E15, + 0x4E98, 0x4E1E, 0x9B32, 0x5B6C, 0x5669, 0x4E28, 0x79BA, 0x4E3F, + 0x5315, 0x4E47, 0x592D, 0x723B, 0x536E, 0x6C10, 0x56DF, 0x80E4, + 0x9997, 0x6BD3, 0x777E, 0x9F17, 0x4E36, 0x4E9F, 0x9F10, 0x4E5C, + 0x4E69, 0x4E93, 0x8288, 0x5B5B, 0x556C, 0x560F, 0x4EC4, 0x538D, + 0x539D, 0x53A3, 0x53A5, 0x53AE, 0x9765, 0x8D5D, 0x531A, 0x53F5, + 0x5326, 0x532E, 0x533E, 0x8D5C, 0x5366, 0x5363, 0x5202, 0x5208, + 0x520E, 0x522D, 0x5233, 0x523F, 0x5240, 0x524C, 0x525E, 0x5261, + 0x525C, 0x84AF, 0x527D, 0x5282, 0x5281, 0x5290, 0x5293, 0x5182, + 0x7F54, 0x4EBB, 0x4EC3, 0x4EC9, 0x4EC2, 0x4EE8, 0x4EE1, 0x4EEB, + 0x4EDE, 0x4F1B, 0x4EF3, 0x4F22, 0x4F64, 0x4EF5, 0x4F25, 0x4F27, + 0x4F09, 0x4F2B, 0x4F5E, 0x4F67, 0x6538, 0x4F5A, 0x4F5D, ALTCHR, +/* 0xD940 - 0xD9FF */ + 0x8CAE, 0x8CAF, 0x8CB0, 0x8CB1, 0x8CB2, 0x8CB3, 0x8CB4, 0x8CB5, + 0x8CB6, 0x8CB7, 0x8CB8, 0x8CB9, 0x8CBA, 0x8CBB, 0x8CBC, 0x8CBD, + 0x8CBE, 0x8CBF, 0x8CC0, 0x8CC1, 0x8CC2, 0x8CC3, 0x8CC4, 0x8CC5, + 0x8CC6, 0x8CC7, 0x8CC8, 0x8CC9, 0x8CCA, 0x8CCB, 0x8CCC, 0x8CCD, + 0x8CCE, 0x8CCF, 0x8CD0, 0x8CD1, 0x8CD2, 0x8CD3, 0x8CD4, 0x8CD5, + 0x8CD6, 0x8CD7, 0x8CD8, 0x8CD9, 0x8CDA, 0x8CDB, 0x8CDC, 0x8CDD, + 0x8CDE, 0x8CDF, 0x8CE0, 0x8CE1, 0x8CE2, 0x8CE3, 0x8CE4, 0x8CE5, + 0x8CE6, 0x8CE7, 0x8CE8, 0x8CE9, 0x8CEA, 0x8CEB, 0x8CEC, ALTCHR, + 0x8CED, 0x8CEE, 0x8CEF, 0x8CF0, 0x8CF1, 0x8CF2, 0x8CF3, 0x8CF4, + 0x8CF5, 0x8CF6, 0x8CF7, 0x8CF8, 0x8CF9, 0x8CFA, 0x8CFB, 0x8CFC, + 0x8CFD, 0x8CFE, 0x8CFF, 0x8D00, 0x8D01, 0x8D02, 0x8D03, 0x8D04, + 0x8D05, 0x8D06, 0x8D07, 0x8D08, 0x8D09, 0x8D0A, 0x8D0B, 0x8D0C, + 0x8D0D, 0x4F5F, 0x4F57, 0x4F32, 0x4F3D, 0x4F76, 0x4F74, 0x4F91, + 0x4F89, 0x4F83, 0x4F8F, 0x4F7E, 0x4F7B, 0x4FAA, 0x4F7C, 0x4FAC, + 0x4F94, 0x4FE6, 0x4FE8, 0x4FEA, 0x4FC5, 0x4FDA, 0x4FE3, 0x4FDC, + 0x4FD1, 0x4FDF, 0x4FF8, 0x5029, 0x504C, 0x4FF3, 0x502C, 0x500F, + 0x502E, 0x502D, 0x4FFE, 0x501C, 0x500C, 0x5025, 0x5028, 0x507E, + 0x5043, 0x5055, 0x5048, 0x504E, 0x506C, 0x507B, 0x50A5, 0x50A7, + 0x50A9, 0x50BA, 0x50D6, 0x5106, 0x50ED, 0x50EC, 0x50E6, 0x50EE, + 0x5107, 0x510B, 0x4EDD, 0x6C3D, 0x4F58, 0x4F65, 0x4FCE, 0x9FA0, + 0x6C46, 0x7C74, 0x516E, 0x5DFD, 0x9EC9, 0x9998, 0x5181, 0x5914, + 0x52F9, 0x530D, 0x8A07, 0x5310, 0x51EB, 0x5919, 0x5155, 0x4EA0, + 0x5156, 0x4EB3, 0x886E, 0x88A4, 0x4EB5, 0x8114, 0x88D2, 0x7980, + 0x5B34, 0x8803, 0x7FB8, 0x51AB, 0x51B1, 0x51BD, 0x51BC, ALTCHR, +/* 0xDA40 - 0xDAFF */ + 0x8D0E, 0x8D0F, 0x8D10, 0x8D11, 0x8D12, 0x8D13, 0x8D14, 0x8D15, + 0x8D16, 0x8D17, 0x8D18, 0x8D19, 0x8D1A, 0x8D1B, 0x8D1C, 0x8D20, + 0x8D51, 0x8D52, 0x8D57, 0x8D5F, 0x8D65, 0x8D68, 0x8D69, 0x8D6A, + 0x8D6C, 0x8D6E, 0x8D6F, 0x8D71, 0x8D72, 0x8D78, 0x8D79, 0x8D7A, + 0x8D7B, 0x8D7C, 0x8D7D, 0x8D7E, 0x8D7F, 0x8D80, 0x8D82, 0x8D83, + 0x8D86, 0x8D87, 0x8D88, 0x8D89, 0x8D8C, 0x8D8D, 0x8D8E, 0x8D8F, + 0x8D90, 0x8D92, 0x8D93, 0x8D95, 0x8D96, 0x8D97, 0x8D98, 0x8D99, + 0x8D9A, 0x8D9B, 0x8D9C, 0x8D9D, 0x8D9E, 0x8DA0, 0x8DA1, ALTCHR, + 0x8DA2, 0x8DA4, 0x8DA5, 0x8DA6, 0x8DA7, 0x8DA8, 0x8DA9, 0x8DAA, + 0x8DAB, 0x8DAC, 0x8DAD, 0x8DAE, 0x8DAF, 0x8DB0, 0x8DB2, 0x8DB6, + 0x8DB7, 0x8DB9, 0x8DBB, 0x8DBD, 0x8DC0, 0x8DC1, 0x8DC2, 0x8DC5, + 0x8DC7, 0x8DC8, 0x8DC9, 0x8DCA, 0x8DCD, 0x8DD0, 0x8DD2, 0x8DD3, + 0x8DD4, 0x51C7, 0x5196, 0x51A2, 0x51A5, 0x8BA0, 0x8BA6, 0x8BA7, + 0x8BAA, 0x8BB4, 0x8BB5, 0x8BB7, 0x8BC2, 0x8BC3, 0x8BCB, 0x8BCF, + 0x8BCE, 0x8BD2, 0x8BD3, 0x8BD4, 0x8BD6, 0x8BD8, 0x8BD9, 0x8BDC, + 0x8BDF, 0x8BE0, 0x8BE4, 0x8BE8, 0x8BE9, 0x8BEE, 0x8BF0, 0x8BF3, + 0x8BF6, 0x8BF9, 0x8BFC, 0x8BFF, 0x8C00, 0x8C02, 0x8C04, 0x8C07, + 0x8C0C, 0x8C0F, 0x8C11, 0x8C12, 0x8C14, 0x8C15, 0x8C16, 0x8C19, + 0x8C1B, 0x8C18, 0x8C1D, 0x8C1F, 0x8C20, 0x8C21, 0x8C25, 0x8C27, + 0x8C2A, 0x8C2B, 0x8C2E, 0x8C2F, 0x8C32, 0x8C33, 0x8C35, 0x8C36, + 0x5369, 0x537A, 0x961D, 0x9622, 0x9621, 0x9631, 0x962A, 0x963D, + 0x963C, 0x9642, 0x9649, 0x9654, 0x965F, 0x9667, 0x966C, 0x9672, + 0x9674, 0x9688, 0x968D, 0x9697, 0x96B0, 0x9097, 0x909B, 0x909D, + 0x9099, 0x90AC, 0x90A1, 0x90B4, 0x90B3, 0x90B6, 0x90BA, ALTCHR, +/* 0xDB40 - 0xDBFF */ + 0x8DD5, 0x8DD8, 0x8DD9, 0x8DDC, 0x8DE0, 0x8DE1, 0x8DE2, 0x8DE5, + 0x8DE6, 0x8DE7, 0x8DE9, 0x8DED, 0x8DEE, 0x8DF0, 0x8DF1, 0x8DF2, + 0x8DF4, 0x8DF6, 0x8DFC, 0x8DFE, 0x8DFF, 0x8E00, 0x8E01, 0x8E02, + 0x8E03, 0x8E04, 0x8E06, 0x8E07, 0x8E08, 0x8E0B, 0x8E0D, 0x8E0E, + 0x8E10, 0x8E11, 0x8E12, 0x8E13, 0x8E15, 0x8E16, 0x8E17, 0x8E18, + 0x8E19, 0x8E1A, 0x8E1B, 0x8E1C, 0x8E20, 0x8E21, 0x8E24, 0x8E25, + 0x8E26, 0x8E27, 0x8E28, 0x8E2B, 0x8E2D, 0x8E30, 0x8E32, 0x8E33, + 0x8E34, 0x8E36, 0x8E37, 0x8E38, 0x8E3B, 0x8E3C, 0x8E3E, ALTCHR, + 0x8E3F, 0x8E43, 0x8E45, 0x8E46, 0x8E4C, 0x8E4D, 0x8E4E, 0x8E4F, + 0x8E50, 0x8E53, 0x8E54, 0x8E55, 0x8E56, 0x8E57, 0x8E58, 0x8E5A, + 0x8E5B, 0x8E5C, 0x8E5D, 0x8E5E, 0x8E5F, 0x8E60, 0x8E61, 0x8E62, + 0x8E63, 0x8E64, 0x8E65, 0x8E67, 0x8E68, 0x8E6A, 0x8E6B, 0x8E6E, + 0x8E71, 0x90B8, 0x90B0, 0x90CF, 0x90C5, 0x90BE, 0x90D0, 0x90C4, + 0x90C7, 0x90D3, 0x90E6, 0x90E2, 0x90DC, 0x90D7, 0x90DB, 0x90EB, + 0x90EF, 0x90FE, 0x9104, 0x9122, 0x911E, 0x9123, 0x9131, 0x912F, + 0x9139, 0x9143, 0x9146, 0x520D, 0x5942, 0x52A2, 0x52AC, 0x52AD, + 0x52BE, 0x54FF, 0x52D0, 0x52D6, 0x52F0, 0x53DF, 0x71EE, 0x77CD, + 0x5EF4, 0x51F5, 0x51FC, 0x9B2F, 0x53B6, 0x5F01, 0x755A, 0x5DEF, + 0x574C, 0x57A9, 0x57A1, 0x587E, 0x58BC, 0x58C5, 0x58D1, 0x5729, + 0x572C, 0x572A, 0x5733, 0x5739, 0x572E, 0x572F, 0x575C, 0x573B, + 0x5742, 0x5769, 0x5785, 0x576B, 0x5786, 0x577C, 0x577B, 0x5768, + 0x576D, 0x5776, 0x5773, 0x57AD, 0x57A4, 0x578C, 0x57B2, 0x57CF, + 0x57A7, 0x57B4, 0x5793, 0x57A0, 0x57D5, 0x57D8, 0x57DA, 0x57D9, + 0x57D2, 0x57B8, 0x57F4, 0x57EF, 0x57F8, 0x57E4, 0x57DD, ALTCHR, +/* 0xDC40 - 0xDCFF */ + 0x8E73, 0x8E75, 0x8E77, 0x8E78, 0x8E79, 0x8E7A, 0x8E7B, 0x8E7D, + 0x8E7E, 0x8E80, 0x8E82, 0x8E83, 0x8E84, 0x8E86, 0x8E88, 0x8E89, + 0x8E8A, 0x8E8B, 0x8E8C, 0x8E8D, 0x8E8E, 0x8E91, 0x8E92, 0x8E93, + 0x8E95, 0x8E96, 0x8E97, 0x8E98, 0x8E99, 0x8E9A, 0x8E9B, 0x8E9D, + 0x8E9F, 0x8EA0, 0x8EA1, 0x8EA2, 0x8EA3, 0x8EA4, 0x8EA5, 0x8EA6, + 0x8EA7, 0x8EA8, 0x8EA9, 0x8EAA, 0x8EAD, 0x8EAE, 0x8EB0, 0x8EB1, + 0x8EB3, 0x8EB4, 0x8EB5, 0x8EB6, 0x8EB7, 0x8EB8, 0x8EB9, 0x8EBB, + 0x8EBC, 0x8EBD, 0x8EBE, 0x8EBF, 0x8EC0, 0x8EC1, 0x8EC2, ALTCHR, + 0x8EC3, 0x8EC4, 0x8EC5, 0x8EC6, 0x8EC7, 0x8EC8, 0x8EC9, 0x8ECA, + 0x8ECB, 0x8ECC, 0x8ECD, 0x8ECF, 0x8ED0, 0x8ED1, 0x8ED2, 0x8ED3, + 0x8ED4, 0x8ED5, 0x8ED6, 0x8ED7, 0x8ED8, 0x8ED9, 0x8EDA, 0x8EDB, + 0x8EDC, 0x8EDD, 0x8EDE, 0x8EDF, 0x8EE0, 0x8EE1, 0x8EE2, 0x8EE3, + 0x8EE4, 0x580B, 0x580D, 0x57FD, 0x57ED, 0x5800, 0x581E, 0x5819, + 0x5844, 0x5820, 0x5865, 0x586C, 0x5881, 0x5889, 0x589A, 0x5880, + 0x99A8, 0x9F19, 0x61FF, 0x8279, 0x827D, 0x827F, 0x828F, 0x828A, + 0x82A8, 0x8284, 0x828E, 0x8291, 0x8297, 0x8299, 0x82AB, 0x82B8, + 0x82BE, 0x82B0, 0x82C8, 0x82CA, 0x82E3, 0x8298, 0x82B7, 0x82AE, + 0x82CB, 0x82CC, 0x82C1, 0x82A9, 0x82B4, 0x82A1, 0x82AA, 0x829F, + 0x82C4, 0x82CE, 0x82A4, 0x82E1, 0x8309, 0x82F7, 0x82E4, 0x830F, + 0x8307, 0x82DC, 0x82F4, 0x82D2, 0x82D8, 0x830C, 0x82FB, 0x82D3, + 0x8311, 0x831A, 0x8306, 0x8314, 0x8315, 0x82E0, 0x82D5, 0x831C, + 0x8351, 0x835B, 0x835C, 0x8308, 0x8392, 0x833C, 0x8334, 0x8331, + 0x839B, 0x835E, 0x832F, 0x834F, 0x8347, 0x8343, 0x835F, 0x8340, + 0x8317, 0x8360, 0x832D, 0x833A, 0x8333, 0x8366, 0x8365, ALTCHR, +/* 0xDD40 - 0xDDFF */ + 0x8EE5, 0x8EE6, 0x8EE7, 0x8EE8, 0x8EE9, 0x8EEA, 0x8EEB, 0x8EEC, + 0x8EED, 0x8EEE, 0x8EEF, 0x8EF0, 0x8EF1, 0x8EF2, 0x8EF3, 0x8EF4, + 0x8EF5, 0x8EF6, 0x8EF7, 0x8EF8, 0x8EF9, 0x8EFA, 0x8EFB, 0x8EFC, + 0x8EFD, 0x8EFE, 0x8EFF, 0x8F00, 0x8F01, 0x8F02, 0x8F03, 0x8F04, + 0x8F05, 0x8F06, 0x8F07, 0x8F08, 0x8F09, 0x8F0A, 0x8F0B, 0x8F0C, + 0x8F0D, 0x8F0E, 0x8F0F, 0x8F10, 0x8F11, 0x8F12, 0x8F13, 0x8F14, + 0x8F15, 0x8F16, 0x8F17, 0x8F18, 0x8F19, 0x8F1A, 0x8F1B, 0x8F1C, + 0x8F1D, 0x8F1E, 0x8F1F, 0x8F20, 0x8F21, 0x8F22, 0x8F23, ALTCHR, + 0x8F24, 0x8F25, 0x8F26, 0x8F27, 0x8F28, 0x8F29, 0x8F2A, 0x8F2B, + 0x8F2C, 0x8F2D, 0x8F2E, 0x8F2F, 0x8F30, 0x8F31, 0x8F32, 0x8F33, + 0x8F34, 0x8F35, 0x8F36, 0x8F37, 0x8F38, 0x8F39, 0x8F3A, 0x8F3B, + 0x8F3C, 0x8F3D, 0x8F3E, 0x8F3F, 0x8F40, 0x8F41, 0x8F42, 0x8F43, + 0x8F44, 0x8368, 0x831B, 0x8369, 0x836C, 0x836A, 0x836D, 0x836E, + 0x83B0, 0x8378, 0x83B3, 0x83B4, 0x83A0, 0x83AA, 0x8393, 0x839C, + 0x8385, 0x837C, 0x83B6, 0x83A9, 0x837D, 0x83B8, 0x837B, 0x8398, + 0x839E, 0x83A8, 0x83BA, 0x83BC, 0x83C1, 0x8401, 0x83E5, 0x83D8, + 0x5807, 0x8418, 0x840B, 0x83DD, 0x83FD, 0x83D6, 0x841C, 0x8438, + 0x8411, 0x8406, 0x83D4, 0x83DF, 0x840F, 0x8403, 0x83F8, 0x83F9, + 0x83EA, 0x83C5, 0x83C0, 0x8426, 0x83F0, 0x83E1, 0x845C, 0x8451, + 0x845A, 0x8459, 0x8473, 0x8487, 0x8488, 0x847A, 0x8489, 0x8478, + 0x843C, 0x8446, 0x8469, 0x8476, 0x848C, 0x848E, 0x8431, 0x846D, + 0x84C1, 0x84CD, 0x84D0, 0x84E6, 0x84BD, 0x84D3, 0x84CA, 0x84BF, + 0x84BA, 0x84E0, 0x84A1, 0x84B9, 0x84B4, 0x8497, 0x84E5, 0x84E3, + 0x850C, 0x750D, 0x8538, 0x84F0, 0x8539, 0x851F, 0x853A, ALTCHR, +/* 0xDE40 - 0xDEFF */ + 0x8F45, 0x8F46, 0x8F47, 0x8F48, 0x8F49, 0x8F4A, 0x8F4B, 0x8F4C, + 0x8F4D, 0x8F4E, 0x8F4F, 0x8F50, 0x8F51, 0x8F52, 0x8F53, 0x8F54, + 0x8F55, 0x8F56, 0x8F57, 0x8F58, 0x8F59, 0x8F5A, 0x8F5B, 0x8F5C, + 0x8F5D, 0x8F5E, 0x8F5F, 0x8F60, 0x8F61, 0x8F62, 0x8F63, 0x8F64, + 0x8F65, 0x8F6A, 0x8F80, 0x8F8C, 0x8F92, 0x8F9D, 0x8FA0, 0x8FA1, + 0x8FA2, 0x8FA4, 0x8FA5, 0x8FA6, 0x8FA7, 0x8FAA, 0x8FAC, 0x8FAD, + 0x8FAE, 0x8FAF, 0x8FB2, 0x8FB3, 0x8FB4, 0x8FB5, 0x8FB7, 0x8FB8, + 0x8FBA, 0x8FBB, 0x8FBC, 0x8FBF, 0x8FC0, 0x8FC3, 0x8FC6, ALTCHR, + 0x8FC9, 0x8FCA, 0x8FCB, 0x8FCC, 0x8FCD, 0x8FCF, 0x8FD2, 0x8FD6, + 0x8FD7, 0x8FDA, 0x8FE0, 0x8FE1, 0x8FE3, 0x8FE7, 0x8FEC, 0x8FEF, + 0x8FF1, 0x8FF2, 0x8FF4, 0x8FF5, 0x8FF6, 0x8FFA, 0x8FFB, 0x8FFC, + 0x8FFE, 0x8FFF, 0x9007, 0x9008, 0x900C, 0x900E, 0x9013, 0x9015, + 0x9018, 0x8556, 0x853B, 0x84FF, 0x84FC, 0x8559, 0x8548, 0x8568, + 0x8564, 0x855E, 0x857A, 0x77A2, 0x8543, 0x8572, 0x857B, 0x85A4, + 0x85A8, 0x8587, 0x858F, 0x8579, 0x85AE, 0x859C, 0x8585, 0x85B9, + 0x85B7, 0x85B0, 0x85D3, 0x85C1, 0x85DC, 0x85FF, 0x8627, 0x8605, + 0x8629, 0x8616, 0x863C, 0x5EFE, 0x5F08, 0x593C, 0x5941, 0x8037, + 0x5955, 0x595A, 0x5958, 0x530F, 0x5C22, 0x5C25, 0x5C2C, 0x5C34, + 0x624C, 0x626A, 0x629F, 0x62BB, 0x62CA, 0x62DA, 0x62D7, 0x62EE, + 0x6322, 0x62F6, 0x6339, 0x634B, 0x6343, 0x63AD, 0x63F6, 0x6371, + 0x637A, 0x638E, 0x63B4, 0x636D, 0x63AC, 0x638A, 0x6369, 0x63AE, + 0x63BC, 0x63F2, 0x63F8, 0x63E0, 0x63FF, 0x63C4, 0x63DE, 0x63CE, + 0x6452, 0x63C6, 0x63BE, 0x6445, 0x6441, 0x640B, 0x641B, 0x6420, + 0x640C, 0x6426, 0x6421, 0x645E, 0x6484, 0x646D, 0x6496, ALTCHR, +/* 0xDF40 - 0xDFFF */ + 0x9019, 0x901C, 0x9023, 0x9024, 0x9025, 0x9027, 0x9028, 0x9029, + 0x902A, 0x902B, 0x902C, 0x9030, 0x9031, 0x9032, 0x9033, 0x9034, + 0x9037, 0x9039, 0x903A, 0x903D, 0x903F, 0x9040, 0x9043, 0x9045, + 0x9046, 0x9048, 0x9049, 0x904A, 0x904B, 0x904C, 0x904E, 0x9054, + 0x9055, 0x9056, 0x9059, 0x905A, 0x905C, 0x905D, 0x905E, 0x905F, + 0x9060, 0x9061, 0x9064, 0x9066, 0x9067, 0x9069, 0x906A, 0x906B, + 0x906C, 0x906F, 0x9070, 0x9071, 0x9072, 0x9073, 0x9076, 0x9077, + 0x9078, 0x9079, 0x907A, 0x907B, 0x907C, 0x907E, 0x9081, ALTCHR, + 0x9084, 0x9085, 0x9086, 0x9087, 0x9089, 0x908A, 0x908C, 0x908D, + 0x908E, 0x908F, 0x9090, 0x9092, 0x9094, 0x9096, 0x9098, 0x909A, + 0x909C, 0x909E, 0x909F, 0x90A0, 0x90A4, 0x90A5, 0x90A7, 0x90A8, + 0x90A9, 0x90AB, 0x90AD, 0x90B2, 0x90B7, 0x90BC, 0x90BD, 0x90BF, + 0x90C0, 0x647A, 0x64B7, 0x64B8, 0x6499, 0x64BA, 0x64C0, 0x64D0, + 0x64D7, 0x64E4, 0x64E2, 0x6509, 0x6525, 0x652E, 0x5F0B, 0x5FD2, + 0x7519, 0x5F11, 0x535F, 0x53F1, 0x53FD, 0x53E9, 0x53E8, 0x53FB, + 0x5412, 0x5416, 0x5406, 0x544B, 0x5452, 0x5453, 0x5454, 0x5456, + 0x5443, 0x5421, 0x5457, 0x5459, 0x5423, 0x5432, 0x5482, 0x5494, + 0x5477, 0x5471, 0x5464, 0x549A, 0x549B, 0x5484, 0x5476, 0x5466, + 0x549D, 0x54D0, 0x54AD, 0x54C2, 0x54B4, 0x54D2, 0x54A7, 0x54A6, + 0x54D3, 0x54D4, 0x5472, 0x54A3, 0x54D5, 0x54BB, 0x54BF, 0x54CC, + 0x54D9, 0x54DA, 0x54DC, 0x54A9, 0x54AA, 0x54A4, 0x54DD, 0x54CF, + 0x54DE, 0x551B, 0x54E7, 0x5520, 0x54FD, 0x5514, 0x54F3, 0x5522, + 0x5523, 0x550F, 0x5511, 0x5527, 0x552A, 0x5567, 0x558F, 0x55B5, + 0x5549, 0x556D, 0x5541, 0x5555, 0x553F, 0x5550, 0x553C, ALTCHR, +/* 0xE040 - 0xE0FF */ + 0x90C2, 0x90C3, 0x90C6, 0x90C8, 0x90C9, 0x90CB, 0x90CC, 0x90CD, + 0x90D2, 0x90D4, 0x90D5, 0x90D6, 0x90D8, 0x90D9, 0x90DA, 0x90DE, + 0x90DF, 0x90E0, 0x90E3, 0x90E4, 0x90E5, 0x90E9, 0x90EA, 0x90EC, + 0x90EE, 0x90F0, 0x90F1, 0x90F2, 0x90F3, 0x90F5, 0x90F6, 0x90F7, + 0x90F9, 0x90FA, 0x90FB, 0x90FC, 0x90FF, 0x9100, 0x9101, 0x9103, + 0x9105, 0x9106, 0x9107, 0x9108, 0x9109, 0x910A, 0x910B, 0x910C, + 0x910D, 0x910E, 0x910F, 0x9110, 0x9111, 0x9112, 0x9113, 0x9114, + 0x9115, 0x9116, 0x9117, 0x9118, 0x911A, 0x911B, 0x911C, ALTCHR, + 0x911D, 0x911F, 0x9120, 0x9121, 0x9124, 0x9125, 0x9126, 0x9127, + 0x9128, 0x9129, 0x912A, 0x912B, 0x912C, 0x912D, 0x912E, 0x9130, + 0x9132, 0x9133, 0x9134, 0x9135, 0x9136, 0x9137, 0x9138, 0x913A, + 0x913B, 0x913C, 0x913D, 0x913E, 0x913F, 0x9140, 0x9141, 0x9142, + 0x9144, 0x5537, 0x5556, 0x5575, 0x5576, 0x5577, 0x5533, 0x5530, + 0x555C, 0x558B, 0x55D2, 0x5583, 0x55B1, 0x55B9, 0x5588, 0x5581, + 0x559F, 0x557E, 0x55D6, 0x5591, 0x557B, 0x55DF, 0x55BD, 0x55BE, + 0x5594, 0x5599, 0x55EA, 0x55F7, 0x55C9, 0x561F, 0x55D1, 0x55EB, + 0x55EC, 0x55D4, 0x55E6, 0x55DD, 0x55C4, 0x55EF, 0x55E5, 0x55F2, + 0x55F3, 0x55CC, 0x55CD, 0x55E8, 0x55F5, 0x55E4, 0x8F94, 0x561E, + 0x5608, 0x560C, 0x5601, 0x5624, 0x5623, 0x55FE, 0x5600, 0x5627, + 0x562D, 0x5658, 0x5639, 0x5657, 0x562C, 0x564D, 0x5662, 0x5659, + 0x565C, 0x564C, 0x5654, 0x5686, 0x5664, 0x5671, 0x566B, 0x567B, + 0x567C, 0x5685, 0x5693, 0x56AF, 0x56D4, 0x56D7, 0x56DD, 0x56E1, + 0x56F5, 0x56EB, 0x56F9, 0x56FF, 0x5704, 0x570A, 0x5709, 0x571C, + 0x5E0F, 0x5E19, 0x5E14, 0x5E11, 0x5E31, 0x5E3B, 0x5E3C, ALTCHR, +/* 0xE140 - 0xE1FF */ + 0x9145, 0x9147, 0x9148, 0x9151, 0x9153, 0x9154, 0x9155, 0x9156, + 0x9158, 0x9159, 0x915B, 0x915C, 0x915F, 0x9160, 0x9166, 0x9167, + 0x9168, 0x916B, 0x916D, 0x9173, 0x917A, 0x917B, 0x917C, 0x9180, + 0x9181, 0x9182, 0x9183, 0x9184, 0x9186, 0x9188, 0x918A, 0x918E, + 0x918F, 0x9193, 0x9194, 0x9195, 0x9196, 0x9197, 0x9198, 0x9199, + 0x919C, 0x919D, 0x919E, 0x919F, 0x91A0, 0x91A1, 0x91A4, 0x91A5, + 0x91A6, 0x91A7, 0x91A8, 0x91A9, 0x91AB, 0x91AC, 0x91B0, 0x91B1, + 0x91B2, 0x91B3, 0x91B6, 0x91B7, 0x91B8, 0x91B9, 0x91BB, ALTCHR, + 0x91BC, 0x91BD, 0x91BE, 0x91BF, 0x91C0, 0x91C1, 0x91C2, 0x91C3, + 0x91C4, 0x91C5, 0x91C6, 0x91C8, 0x91CB, 0x91D0, 0x91D2, 0x91D3, + 0x91D4, 0x91D5, 0x91D6, 0x91D7, 0x91D8, 0x91D9, 0x91DA, 0x91DB, + 0x91DD, 0x91DE, 0x91DF, 0x91E0, 0x91E1, 0x91E2, 0x91E3, 0x91E4, + 0x91E5, 0x5E37, 0x5E44, 0x5E54, 0x5E5B, 0x5E5E, 0x5E61, 0x5C8C, + 0x5C7A, 0x5C8D, 0x5C90, 0x5C96, 0x5C88, 0x5C98, 0x5C99, 0x5C91, + 0x5C9A, 0x5C9C, 0x5CB5, 0x5CA2, 0x5CBD, 0x5CAC, 0x5CAB, 0x5CB1, + 0x5CA3, 0x5CC1, 0x5CB7, 0x5CC4, 0x5CD2, 0x5CE4, 0x5CCB, 0x5CE5, + 0x5D02, 0x5D03, 0x5D27, 0x5D26, 0x5D2E, 0x5D24, 0x5D1E, 0x5D06, + 0x5D1B, 0x5D58, 0x5D3E, 0x5D34, 0x5D3D, 0x5D6C, 0x5D5B, 0x5D6F, + 0x5D5D, 0x5D6B, 0x5D4B, 0x5D4A, 0x5D69, 0x5D74, 0x5D82, 0x5D99, + 0x5D9D, 0x8C73, 0x5DB7, 0x5DC5, 0x5F73, 0x5F77, 0x5F82, 0x5F87, + 0x5F89, 0x5F8C, 0x5F95, 0x5F99, 0x5F9C, 0x5FA8, 0x5FAD, 0x5FB5, + 0x5FBC, 0x8862, 0x5F61, 0x72AD, 0x72B0, 0x72B4, 0x72B7, 0x72B8, + 0x72C3, 0x72C1, 0x72CE, 0x72CD, 0x72D2, 0x72E8, 0x72EF, 0x72E9, + 0x72F2, 0x72F4, 0x72F7, 0x7301, 0x72F3, 0x7303, 0x72FA, ALTCHR, +/* 0xE240 - 0xE2FF */ + 0x91E6, 0x91E7, 0x91E8, 0x91E9, 0x91EA, 0x91EB, 0x91EC, 0x91ED, + 0x91EE, 0x91EF, 0x91F0, 0x91F1, 0x91F2, 0x91F3, 0x91F4, 0x91F5, + 0x91F6, 0x91F7, 0x91F8, 0x91F9, 0x91FA, 0x91FB, 0x91FC, 0x91FD, + 0x91FE, 0x91FF, 0x9200, 0x9201, 0x9202, 0x9203, 0x9204, 0x9205, + 0x9206, 0x9207, 0x9208, 0x9209, 0x920A, 0x920B, 0x920C, 0x920D, + 0x920E, 0x920F, 0x9210, 0x9211, 0x9212, 0x9213, 0x9214, 0x9215, + 0x9216, 0x9217, 0x9218, 0x9219, 0x921A, 0x921B, 0x921C, 0x921D, + 0x921E, 0x921F, 0x9220, 0x9221, 0x9222, 0x9223, 0x9224, ALTCHR, + 0x9225, 0x9226, 0x9227, 0x9228, 0x9229, 0x922A, 0x922B, 0x922C, + 0x922D, 0x922E, 0x922F, 0x9230, 0x9231, 0x9232, 0x9233, 0x9234, + 0x9235, 0x9236, 0x9237, 0x9238, 0x9239, 0x923A, 0x923B, 0x923C, + 0x923D, 0x923E, 0x923F, 0x9240, 0x9241, 0x9242, 0x9243, 0x9244, + 0x9245, 0x72FB, 0x7317, 0x7313, 0x7321, 0x730A, 0x731E, 0x731D, + 0x7315, 0x7322, 0x7339, 0x7325, 0x732C, 0x7338, 0x7331, 0x7350, + 0x734D, 0x7357, 0x7360, 0x736C, 0x736F, 0x737E, 0x821B, 0x5925, + 0x98E7, 0x5924, 0x5902, 0x9963, 0x9967, 0x9968, 0x9969, 0x996A, + 0x996B, 0x996C, 0x9974, 0x9977, 0x997D, 0x9980, 0x9984, 0x9987, + 0x998A, 0x998D, 0x9990, 0x9991, 0x9993, 0x9994, 0x9995, 0x5E80, + 0x5E91, 0x5E8B, 0x5E96, 0x5EA5, 0x5EA0, 0x5EB9, 0x5EB5, 0x5EBE, + 0x5EB3, 0x8D53, 0x5ED2, 0x5ED1, 0x5EDB, 0x5EE8, 0x5EEA, 0x81BA, + 0x5FC4, 0x5FC9, 0x5FD6, 0x5FCF, 0x6003, 0x5FEE, 0x6004, 0x5FE1, + 0x5FE4, 0x5FFE, 0x6005, 0x6006, 0x5FEA, 0x5FED, 0x5FF8, 0x6019, + 0x6035, 0x6026, 0x601B, 0x600F, 0x600D, 0x6029, 0x602B, 0x600A, + 0x603F, 0x6021, 0x6078, 0x6079, 0x607B, 0x607A, 0x6042, ALTCHR, +/* 0xE340 - 0xE3FF */ + 0x9246, 0x9247, 0x9248, 0x9249, 0x924A, 0x924B, 0x924C, 0x924D, + 0x924E, 0x924F, 0x9250, 0x9251, 0x9252, 0x9253, 0x9254, 0x9255, + 0x9256, 0x9257, 0x9258, 0x9259, 0x925A, 0x925B, 0x925C, 0x925D, + 0x925E, 0x925F, 0x9260, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, + 0x9266, 0x9267, 0x9268, 0x9269, 0x926A, 0x926B, 0x926C, 0x926D, + 0x926E, 0x926F, 0x9270, 0x9271, 0x9272, 0x9273, 0x9275, 0x9276, + 0x9277, 0x9278, 0x9279, 0x927A, 0x927B, 0x927C, 0x927D, 0x927E, + 0x927F, 0x9280, 0x9281, 0x9282, 0x9283, 0x9284, 0x9285, ALTCHR, + 0x9286, 0x9287, 0x9288, 0x9289, 0x928A, 0x928B, 0x928C, 0x928D, + 0x928F, 0x9290, 0x9291, 0x9292, 0x9293, 0x9294, 0x9295, 0x9296, + 0x9297, 0x9298, 0x9299, 0x929A, 0x929B, 0x929C, 0x929D, 0x929E, + 0x929F, 0x92A0, 0x92A1, 0x92A2, 0x92A3, 0x92A4, 0x92A5, 0x92A6, + 0x92A7, 0x606A, 0x607D, 0x6096, 0x609A, 0x60AD, 0x609D, 0x6083, + 0x6092, 0x608C, 0x609B, 0x60EC, 0x60BB, 0x60B1, 0x60DD, 0x60D8, + 0x60C6, 0x60DA, 0x60B4, 0x6120, 0x6126, 0x6115, 0x6123, 0x60F4, + 0x6100, 0x610E, 0x612B, 0x614A, 0x6175, 0x61AC, 0x6194, 0x61A7, + 0x61B7, 0x61D4, 0x61F5, 0x5FDD, 0x96B3, 0x95E9, 0x95EB, 0x95F1, + 0x95F3, 0x95F5, 0x95F6, 0x95FC, 0x95FE, 0x9603, 0x9604, 0x9606, + 0x9608, 0x960A, 0x960B, 0x960C, 0x960D, 0x960F, 0x9612, 0x9615, + 0x9616, 0x9617, 0x9619, 0x961A, 0x4E2C, 0x723F, 0x6215, 0x6C35, + 0x6C54, 0x6C5C, 0x6C4A, 0x6CA3, 0x6C85, 0x6C90, 0x6C94, 0x6C8C, + 0x6C68, 0x6C69, 0x6C74, 0x6C76, 0x6C86, 0x6CA9, 0x6CD0, 0x6CD4, + 0x6CAD, 0x6CF7, 0x6CF8, 0x6CF1, 0x6CD7, 0x6CB2, 0x6CE0, 0x6CD6, + 0x6CFA, 0x6CEB, 0x6CEE, 0x6CB1, 0x6CD3, 0x6CEF, 0x6CFE, ALTCHR, +/* 0xE440 - 0xE4FF */ + 0x92A8, 0x92A9, 0x92AA, 0x92AB, 0x92AC, 0x92AD, 0x92AF, 0x92B0, + 0x92B1, 0x92B2, 0x92B3, 0x92B4, 0x92B5, 0x92B6, 0x92B7, 0x92B8, + 0x92B9, 0x92BA, 0x92BB, 0x92BC, 0x92BD, 0x92BE, 0x92BF, 0x92C0, + 0x92C1, 0x92C2, 0x92C3, 0x92C4, 0x92C5, 0x92C6, 0x92C7, 0x92C9, + 0x92CA, 0x92CB, 0x92CC, 0x92CD, 0x92CE, 0x92CF, 0x92D0, 0x92D1, + 0x92D2, 0x92D3, 0x92D4, 0x92D5, 0x92D6, 0x92D7, 0x92D8, 0x92D9, + 0x92DA, 0x92DB, 0x92DC, 0x92DD, 0x92DE, 0x92DF, 0x92E0, 0x92E1, + 0x92E2, 0x92E3, 0x92E4, 0x92E5, 0x92E6, 0x92E7, 0x92E8, ALTCHR, + 0x92E9, 0x92EA, 0x92EB, 0x92EC, 0x92ED, 0x92EE, 0x92EF, 0x92F0, + 0x92F1, 0x92F2, 0x92F3, 0x92F4, 0x92F5, 0x92F6, 0x92F7, 0x92F8, + 0x92F9, 0x92FA, 0x92FB, 0x92FC, 0x92FD, 0x92FE, 0x92FF, 0x9300, + 0x9301, 0x9302, 0x9303, 0x9304, 0x9305, 0x9306, 0x9307, 0x9308, + 0x9309, 0x6D39, 0x6D27, 0x6D0C, 0x6D43, 0x6D48, 0x6D07, 0x6D04, + 0x6D19, 0x6D0E, 0x6D2B, 0x6D4D, 0x6D2E, 0x6D35, 0x6D1A, 0x6D4F, + 0x6D52, 0x6D54, 0x6D33, 0x6D91, 0x6D6F, 0x6D9E, 0x6DA0, 0x6D5E, + 0x6D93, 0x6D94, 0x6D5C, 0x6D60, 0x6D7C, 0x6D63, 0x6E1A, 0x6DC7, + 0x6DC5, 0x6DDE, 0x6E0E, 0x6DBF, 0x6DE0, 0x6E11, 0x6DE6, 0x6DDD, + 0x6DD9, 0x6E16, 0x6DAB, 0x6E0C, 0x6DAE, 0x6E2B, 0x6E6E, 0x6E4E, + 0x6E6B, 0x6EB2, 0x6E5F, 0x6E86, 0x6E53, 0x6E54, 0x6E32, 0x6E25, + 0x6E44, 0x6EDF, 0x6EB1, 0x6E98, 0x6EE0, 0x6F2D, 0x6EE2, 0x6EA5, + 0x6EA7, 0x6EBD, 0x6EBB, 0x6EB7, 0x6ED7, 0x6EB4, 0x6ECF, 0x6E8F, + 0x6EC2, 0x6E9F, 0x6F62, 0x6F46, 0x6F47, 0x6F24, 0x6F15, 0x6EF9, + 0x6F2F, 0x6F36, 0x6F4B, 0x6F74, 0x6F2A, 0x6F09, 0x6F29, 0x6F89, + 0x6F8D, 0x6F8C, 0x6F78, 0x6F72, 0x6F7C, 0x6F7A, 0x6FD1, ALTCHR, +/* 0xE540 - 0xE5FF */ + 0x930A, 0x930B, 0x930C, 0x930D, 0x930E, 0x930F, 0x9310, 0x9311, + 0x9312, 0x9313, 0x9314, 0x9315, 0x9316, 0x9317, 0x9318, 0x9319, + 0x931A, 0x931B, 0x931C, 0x931D, 0x931E, 0x931F, 0x9320, 0x9321, + 0x9322, 0x9323, 0x9324, 0x9325, 0x9326, 0x9327, 0x9328, 0x9329, + 0x932A, 0x932B, 0x932C, 0x932D, 0x932E, 0x932F, 0x9330, 0x9331, + 0x9332, 0x9333, 0x9334, 0x9335, 0x9336, 0x9337, 0x9338, 0x9339, + 0x933A, 0x933B, 0x933C, 0x933D, 0x933F, 0x9340, 0x9341, 0x9342, + 0x9343, 0x9344, 0x9345, 0x9346, 0x9347, 0x9348, 0x9349, ALTCHR, + 0x934A, 0x934B, 0x934C, 0x934D, 0x934E, 0x934F, 0x9350, 0x9351, + 0x9352, 0x9353, 0x9354, 0x9355, 0x9356, 0x9357, 0x9358, 0x9359, + 0x935A, 0x935B, 0x935C, 0x935D, 0x935E, 0x935F, 0x9360, 0x9361, + 0x9362, 0x9363, 0x9364, 0x9365, 0x9366, 0x9367, 0x9368, 0x9369, + 0x936B, 0x6FC9, 0x6FA7, 0x6FB9, 0x6FB6, 0x6FC2, 0x6FE1, 0x6FEE, + 0x6FDE, 0x6FE0, 0x6FEF, 0x701A, 0x7023, 0x701B, 0x7039, 0x7035, + 0x704F, 0x705E, 0x5B80, 0x5B84, 0x5B95, 0x5B93, 0x5BA5, 0x5BB8, + 0x752F, 0x9A9E, 0x6434, 0x5BE4, 0x5BEE, 0x8930, 0x5BF0, 0x8E47, + 0x8B07, 0x8FB6, 0x8FD3, 0x8FD5, 0x8FE5, 0x8FEE, 0x8FE4, 0x8FE9, + 0x8FE6, 0x8FF3, 0x8FE8, 0x9005, 0x9004, 0x900B, 0x9026, 0x9011, + 0x900D, 0x9016, 0x9021, 0x9035, 0x9036, 0x902D, 0x902F, 0x9044, + 0x9051, 0x9052, 0x9050, 0x9068, 0x9058, 0x9062, 0x905B, 0x66B9, + 0x9074, 0x907D, 0x9082, 0x9088, 0x9083, 0x908B, 0x5F50, 0x5F57, + 0x5F56, 0x5F58, 0x5C3B, 0x54AB, 0x5C50, 0x5C59, 0x5B71, 0x5C63, + 0x5C66, 0x7FBC, 0x5F2A, 0x5F29, 0x5F2D, 0x8274, 0x5F3C, 0x9B3B, + 0x5C6E, 0x5981, 0x5983, 0x598D, 0x59A9, 0x59AA, 0x59A3, ALTCHR, +/* 0xE640 - 0xE6FF */ + 0x936C, 0x936D, 0x936E, 0x936F, 0x9370, 0x9371, 0x9372, 0x9373, + 0x9374, 0x9375, 0x9376, 0x9377, 0x9378, 0x9379, 0x937A, 0x937B, + 0x937C, 0x937D, 0x937E, 0x937F, 0x9380, 0x9381, 0x9382, 0x9383, + 0x9384, 0x9385, 0x9386, 0x9387, 0x9388, 0x9389, 0x938A, 0x938B, + 0x938C, 0x938D, 0x938E, 0x9390, 0x9391, 0x9392, 0x9393, 0x9394, + 0x9395, 0x9396, 0x9397, 0x9398, 0x9399, 0x939A, 0x939B, 0x939C, + 0x939D, 0x939E, 0x939F, 0x93A0, 0x93A1, 0x93A2, 0x93A3, 0x93A4, + 0x93A5, 0x93A6, 0x93A7, 0x93A8, 0x93A9, 0x93AA, 0x93AB, ALTCHR, + 0x93AC, 0x93AD, 0x93AE, 0x93AF, 0x93B0, 0x93B1, 0x93B2, 0x93B3, + 0x93B4, 0x93B5, 0x93B6, 0x93B7, 0x93B8, 0x93B9, 0x93BA, 0x93BB, + 0x93BC, 0x93BD, 0x93BE, 0x93BF, 0x93C0, 0x93C1, 0x93C2, 0x93C3, + 0x93C4, 0x93C5, 0x93C6, 0x93C7, 0x93C8, 0x93C9, 0x93CB, 0x93CC, + 0x93CD, 0x5997, 0x59CA, 0x59AB, 0x599E, 0x59A4, 0x59D2, 0x59B2, + 0x59AF, 0x59D7, 0x59BE, 0x5A05, 0x5A06, 0x59DD, 0x5A08, 0x59E3, + 0x59D8, 0x59F9, 0x5A0C, 0x5A09, 0x5A32, 0x5A34, 0x5A11, 0x5A23, + 0x5A13, 0x5A40, 0x5A67, 0x5A4A, 0x5A55, 0x5A3C, 0x5A62, 0x5A75, + 0x80EC, 0x5AAA, 0x5A9B, 0x5A77, 0x5A7A, 0x5ABE, 0x5AEB, 0x5AB2, + 0x5AD2, 0x5AD4, 0x5AB8, 0x5AE0, 0x5AE3, 0x5AF1, 0x5AD6, 0x5AE6, + 0x5AD8, 0x5ADC, 0x5B09, 0x5B17, 0x5B16, 0x5B32, 0x5B37, 0x5B40, + 0x5C15, 0x5C1C, 0x5B5A, 0x5B65, 0x5B73, 0x5B51, 0x5B53, 0x5B62, + 0x9A75, 0x9A77, 0x9A78, 0x9A7A, 0x9A7F, 0x9A7D, 0x9A80, 0x9A81, + 0x9A85, 0x9A88, 0x9A8A, 0x9A90, 0x9A92, 0x9A93, 0x9A96, 0x9A98, + 0x9A9B, 0x9A9C, 0x9A9D, 0x9A9F, 0x9AA0, 0x9AA2, 0x9AA3, 0x9AA5, + 0x9AA7, 0x7E9F, 0x7EA1, 0x7EA3, 0x7EA5, 0x7EA8, 0x7EA9, ALTCHR, +/* 0xE740 - 0xE7FF */ + 0x93CE, 0x93CF, 0x93D0, 0x93D1, 0x93D2, 0x93D3, 0x93D4, 0x93D5, + 0x93D7, 0x93D8, 0x93D9, 0x93DA, 0x93DB, 0x93DC, 0x93DD, 0x93DE, + 0x93DF, 0x93E0, 0x93E1, 0x93E2, 0x93E3, 0x93E4, 0x93E5, 0x93E6, + 0x93E7, 0x93E8, 0x93E9, 0x93EA, 0x93EB, 0x93EC, 0x93ED, 0x93EE, + 0x93EF, 0x93F0, 0x93F1, 0x93F2, 0x93F3, 0x93F4, 0x93F5, 0x93F6, + 0x93F7, 0x93F8, 0x93F9, 0x93FA, 0x93FB, 0x93FC, 0x93FD, 0x93FE, + 0x93FF, 0x9400, 0x9401, 0x9402, 0x9403, 0x9404, 0x9405, 0x9406, + 0x9407, 0x9408, 0x9409, 0x940A, 0x940B, 0x940C, 0x940D, ALTCHR, + 0x940E, 0x940F, 0x9410, 0x9411, 0x9412, 0x9413, 0x9414, 0x9415, + 0x9416, 0x9417, 0x9418, 0x9419, 0x941A, 0x941B, 0x941C, 0x941D, + 0x941E, 0x941F, 0x9420, 0x9421, 0x9422, 0x9423, 0x9424, 0x9425, + 0x9426, 0x9427, 0x9428, 0x9429, 0x942A, 0x942B, 0x942C, 0x942D, + 0x942E, 0x7EAD, 0x7EB0, 0x7EBE, 0x7EC0, 0x7EC1, 0x7EC2, 0x7EC9, + 0x7ECB, 0x7ECC, 0x7ED0, 0x7ED4, 0x7ED7, 0x7EDB, 0x7EE0, 0x7EE1, + 0x7EE8, 0x7EEB, 0x7EEE, 0x7EEF, 0x7EF1, 0x7EF2, 0x7F0D, 0x7EF6, + 0x7EFA, 0x7EFB, 0x7EFE, 0x7F01, 0x7F02, 0x7F03, 0x7F07, 0x7F08, + 0x7F0B, 0x7F0C, 0x7F0F, 0x7F11, 0x7F12, 0x7F17, 0x7F19, 0x7F1C, + 0x7F1B, 0x7F1F, 0x7F21, 0x7F22, 0x7F23, 0x7F24, 0x7F25, 0x7F26, + 0x7F27, 0x7F2A, 0x7F2B, 0x7F2C, 0x7F2D, 0x7F2F, 0x7F30, 0x7F31, + 0x7F32, 0x7F33, 0x7F35, 0x5E7A, 0x757F, 0x5DDB, 0x753E, 0x9095, + 0x738E, 0x7391, 0x73AE, 0x73A2, 0x739F, 0x73CF, 0x73C2, 0x73D1, + 0x73B7, 0x73B3, 0x73C0, 0x73C9, 0x73C8, 0x73E5, 0x73D9, 0x987C, + 0x740A, 0x73E9, 0x73E7, 0x73DE, 0x73BA, 0x73F2, 0x740F, 0x742A, + 0x745B, 0x7426, 0x7425, 0x7428, 0x7430, 0x742E, 0x742C, ALTCHR, +/* 0xE840 - 0xE8FF */ + 0x942F, 0x9430, 0x9431, 0x9432, 0x9433, 0x9434, 0x9435, 0x9436, + 0x9437, 0x9438, 0x9439, 0x943A, 0x943B, 0x943C, 0x943D, 0x943F, + 0x9440, 0x9441, 0x9442, 0x9443, 0x9444, 0x9445, 0x9446, 0x9447, + 0x9448, 0x9449, 0x944A, 0x944B, 0x944C, 0x944D, 0x944E, 0x944F, + 0x9450, 0x9451, 0x9452, 0x9453, 0x9454, 0x9455, 0x9456, 0x9457, + 0x9458, 0x9459, 0x945A, 0x945B, 0x945C, 0x945D, 0x945E, 0x945F, + 0x9460, 0x9461, 0x9462, 0x9463, 0x9464, 0x9465, 0x9466, 0x9467, + 0x9468, 0x9469, 0x946A, 0x946C, 0x946D, 0x946E, 0x946F, ALTCHR, + 0x9470, 0x9471, 0x9472, 0x9473, 0x9474, 0x9475, 0x9476, 0x9477, + 0x9478, 0x9479, 0x947A, 0x947B, 0x947C, 0x947D, 0x947E, 0x947F, + 0x9480, 0x9481, 0x9482, 0x9483, 0x9484, 0x9491, 0x9496, 0x9498, + 0x94C7, 0x94CF, 0x94D3, 0x94D4, 0x94DA, 0x94E6, 0x94FB, 0x951C, + 0x9520, 0x741B, 0x741A, 0x7441, 0x745C, 0x7457, 0x7455, 0x7459, + 0x7477, 0x746D, 0x747E, 0x749C, 0x748E, 0x7480, 0x7481, 0x7487, + 0x748B, 0x749E, 0x74A8, 0x74A9, 0x7490, 0x74A7, 0x74D2, 0x74BA, + 0x97EA, 0x97EB, 0x97EC, 0x674C, 0x6753, 0x675E, 0x6748, 0x6769, + 0x67A5, 0x6787, 0x676A, 0x6773, 0x6798, 0x67A7, 0x6775, 0x67A8, + 0x679E, 0x67AD, 0x678B, 0x6777, 0x677C, 0x67F0, 0x6809, 0x67D8, + 0x680A, 0x67E9, 0x67B0, 0x680C, 0x67D9, 0x67B5, 0x67DA, 0x67B3, + 0x67DD, 0x6800, 0x67C3, 0x67B8, 0x67E2, 0x680E, 0x67C1, 0x67FD, + 0x6832, 0x6833, 0x6860, 0x6861, 0x684E, 0x6862, 0x6844, 0x6864, + 0x6883, 0x681D, 0x6855, 0x6866, 0x6841, 0x6867, 0x6840, 0x683E, + 0x684A, 0x6849, 0x6829, 0x68B5, 0x688F, 0x6874, 0x6877, 0x6893, + 0x686B, 0x68C2, 0x696E, 0x68FC, 0x691F, 0x6920, 0x68F9, ALTCHR, +/* 0xE940 - 0xE9FF */ + 0x9527, 0x9533, 0x953D, 0x9543, 0x9548, 0x954B, 0x9555, 0x955A, + 0x9560, 0x956E, 0x9574, 0x9575, 0x9577, 0x9578, 0x9579, 0x957A, + 0x957B, 0x957C, 0x957D, 0x957E, 0x9580, 0x9581, 0x9582, 0x9583, + 0x9584, 0x9585, 0x9586, 0x9587, 0x9588, 0x9589, 0x958A, 0x958B, + 0x958C, 0x958D, 0x958E, 0x958F, 0x9590, 0x9591, 0x9592, 0x9593, + 0x9594, 0x9595, 0x9596, 0x9597, 0x9598, 0x9599, 0x959A, 0x959B, + 0x959C, 0x959D, 0x959E, 0x959F, 0x95A0, 0x95A1, 0x95A2, 0x95A3, + 0x95A4, 0x95A5, 0x95A6, 0x95A7, 0x95A8, 0x95A9, 0x95AA, ALTCHR, + 0x95AB, 0x95AC, 0x95AD, 0x95AE, 0x95AF, 0x95B0, 0x95B1, 0x95B2, + 0x95B3, 0x95B4, 0x95B5, 0x95B6, 0x95B7, 0x95B8, 0x95B9, 0x95BA, + 0x95BB, 0x95BC, 0x95BD, 0x95BE, 0x95BF, 0x95C0, 0x95C1, 0x95C2, + 0x95C3, 0x95C4, 0x95C5, 0x95C6, 0x95C7, 0x95C8, 0x95C9, 0x95CA, + 0x95CB, 0x6924, 0x68F0, 0x690B, 0x6901, 0x6957, 0x68E3, 0x6910, + 0x6971, 0x6939, 0x6960, 0x6942, 0x695D, 0x6984, 0x696B, 0x6980, + 0x6998, 0x6978, 0x6934, 0x69CC, 0x6987, 0x6988, 0x69CE, 0x6989, + 0x6966, 0x6963, 0x6979, 0x699B, 0x69A7, 0x69BB, 0x69AB, 0x69AD, + 0x69D4, 0x69B1, 0x69C1, 0x69CA, 0x69DF, 0x6995, 0x69E0, 0x698D, + 0x69FF, 0x6A2F, 0x69ED, 0x6A17, 0x6A18, 0x6A65, 0x69F2, 0x6A44, + 0x6A3E, 0x6AA0, 0x6A50, 0x6A5B, 0x6A35, 0x6A8E, 0x6A79, 0x6A3D, + 0x6A28, 0x6A58, 0x6A7C, 0x6A91, 0x6A90, 0x6AA9, 0x6A97, 0x6AAB, + 0x7337, 0x7352, 0x6B81, 0x6B82, 0x6B87, 0x6B84, 0x6B92, 0x6B93, + 0x6B8D, 0x6B9A, 0x6B9B, 0x6BA1, 0x6BAA, 0x8F6B, 0x8F6D, 0x8F71, + 0x8F72, 0x8F73, 0x8F75, 0x8F76, 0x8F78, 0x8F77, 0x8F79, 0x8F7A, + 0x8F7C, 0x8F7E, 0x8F81, 0x8F82, 0x8F84, 0x8F87, 0x8F8B, ALTCHR, +/* 0xEA40 - 0xEAFF */ + 0x95CC, 0x95CD, 0x95CE, 0x95CF, 0x95D0, 0x95D1, 0x95D2, 0x95D3, + 0x95D4, 0x95D5, 0x95D6, 0x95D7, 0x95D8, 0x95D9, 0x95DA, 0x95DB, + 0x95DC, 0x95DD, 0x95DE, 0x95DF, 0x95E0, 0x95E1, 0x95E2, 0x95E3, + 0x95E4, 0x95E5, 0x95E6, 0x95E7, 0x95EC, 0x95FF, 0x9607, 0x9613, + 0x9618, 0x961B, 0x961E, 0x9620, 0x9623, 0x9624, 0x9625, 0x9626, + 0x9627, 0x9628, 0x9629, 0x962B, 0x962C, 0x962D, 0x962F, 0x9630, + 0x9637, 0x9638, 0x9639, 0x963A, 0x963E, 0x9641, 0x9643, 0x964A, + 0x964E, 0x964F, 0x9651, 0x9652, 0x9653, 0x9656, 0x9657, ALTCHR, + 0x9658, 0x9659, 0x965A, 0x965C, 0x965D, 0x965E, 0x9660, 0x9663, + 0x9665, 0x9666, 0x966B, 0x966D, 0x966E, 0x966F, 0x9670, 0x9671, + 0x9673, 0x9678, 0x9679, 0x967A, 0x967B, 0x967C, 0x967D, 0x967E, + 0x967F, 0x9680, 0x9681, 0x9682, 0x9683, 0x9684, 0x9687, 0x9689, + 0x968A, 0x8F8D, 0x8F8E, 0x8F8F, 0x8F98, 0x8F9A, 0x8ECE, 0x620B, + 0x6217, 0x621B, 0x621F, 0x6222, 0x6221, 0x6225, 0x6224, 0x622C, + 0x81E7, 0x74EF, 0x74F4, 0x74FF, 0x750F, 0x7511, 0x7513, 0x6534, + 0x65EE, 0x65EF, 0x65F0, 0x660A, 0x6619, 0x6772, 0x6603, 0x6615, + 0x6600, 0x7085, 0x66F7, 0x661D, 0x6634, 0x6631, 0x6636, 0x6635, + 0x8006, 0x665F, 0x6654, 0x6641, 0x664F, 0x6656, 0x6661, 0x6657, + 0x6677, 0x6684, 0x668C, 0x66A7, 0x669D, 0x66BE, 0x66DB, 0x66DC, + 0x66E6, 0x66E9, 0x8D32, 0x8D33, 0x8D36, 0x8D3B, 0x8D3D, 0x8D40, + 0x8D45, 0x8D46, 0x8D48, 0x8D49, 0x8D47, 0x8D4D, 0x8D55, 0x8D59, + 0x89C7, 0x89CA, 0x89CB, 0x89CC, 0x89CE, 0x89CF, 0x89D0, 0x89D1, + 0x726E, 0x729F, 0x725D, 0x7266, 0x726F, 0x727E, 0x727F, 0x7284, + 0x728B, 0x728D, 0x728F, 0x7292, 0x6308, 0x6332, 0x63B0, ALTCHR, +/* 0xEB40 - 0xEBFF */ + 0x968C, 0x968E, 0x9691, 0x9692, 0x9693, 0x9695, 0x9696, 0x969A, + 0x969B, 0x969D, 0x969E, 0x969F, 0x96A0, 0x96A1, 0x96A2, 0x96A3, + 0x96A4, 0x96A5, 0x96A6, 0x96A8, 0x96A9, 0x96AA, 0x96AB, 0x96AC, + 0x96AD, 0x96AE, 0x96AF, 0x96B1, 0x96B2, 0x96B4, 0x96B5, 0x96B7, + 0x96B8, 0x96BA, 0x96BB, 0x96BF, 0x96C2, 0x96C3, 0x96C8, 0x96CA, + 0x96CB, 0x96D0, 0x96D1, 0x96D3, 0x96D4, 0x96D6, 0x96D7, 0x96D8, + 0x96D9, 0x96DA, 0x96DB, 0x96DC, 0x96DD, 0x96DE, 0x96DF, 0x96E1, + 0x96E2, 0x96E3, 0x96E4, 0x96E5, 0x96E6, 0x96E7, 0x96EB, ALTCHR, + 0x96EC, 0x96ED, 0x96EE, 0x96F0, 0x96F1, 0x96F2, 0x96F4, 0x96F5, + 0x96F8, 0x96FA, 0x96FB, 0x96FC, 0x96FD, 0x96FF, 0x9702, 0x9703, + 0x9705, 0x970A, 0x970B, 0x970C, 0x9710, 0x9711, 0x9712, 0x9714, + 0x9715, 0x9717, 0x9718, 0x9719, 0x971A, 0x971B, 0x971D, 0x971F, + 0x9720, 0x643F, 0x64D8, 0x8004, 0x6BEA, 0x6BF3, 0x6BFD, 0x6BF5, + 0x6BF9, 0x6C05, 0x6C07, 0x6C06, 0x6C0D, 0x6C15, 0x6C18, 0x6C19, + 0x6C1A, 0x6C21, 0x6C29, 0x6C24, 0x6C2A, 0x6C32, 0x6535, 0x6555, + 0x656B, 0x724D, 0x7252, 0x7256, 0x7230, 0x8662, 0x5216, 0x809F, + 0x809C, 0x8093, 0x80BC, 0x670A, 0x80BD, 0x80B1, 0x80AB, 0x80AD, + 0x80B4, 0x80B7, 0x80E7, 0x80E8, 0x80E9, 0x80EA, 0x80DB, 0x80C2, + 0x80C4, 0x80D9, 0x80CD, 0x80D7, 0x6710, 0x80DD, 0x80EB, 0x80F1, + 0x80F4, 0x80ED, 0x810D, 0x810E, 0x80F2, 0x80FC, 0x6715, 0x8112, + 0x8C5A, 0x8136, 0x811E, 0x812C, 0x8118, 0x8132, 0x8148, 0x814C, + 0x8153, 0x8174, 0x8159, 0x815A, 0x8171, 0x8160, 0x8169, 0x817C, + 0x817D, 0x816D, 0x8167, 0x584D, 0x5AB5, 0x8188, 0x8182, 0x8191, + 0x6ED5, 0x81A3, 0x81AA, 0x81CC, 0x6726, 0x81CA, 0x81BB, ALTCHR, +/* 0xEC40 - 0xECFF */ + 0x9721, 0x9722, 0x9723, 0x9724, 0x9725, 0x9726, 0x9727, 0x9728, + 0x9729, 0x972B, 0x972C, 0x972E, 0x972F, 0x9731, 0x9733, 0x9734, + 0x9735, 0x9736, 0x9737, 0x973A, 0x973B, 0x973C, 0x973D, 0x973F, + 0x9740, 0x9741, 0x9742, 0x9743, 0x9744, 0x9745, 0x9746, 0x9747, + 0x9748, 0x9749, 0x974A, 0x974B, 0x974C, 0x974D, 0x974E, 0x974F, + 0x9750, 0x9751, 0x9754, 0x9755, 0x9757, 0x9758, 0x975A, 0x975C, + 0x975D, 0x975F, 0x9763, 0x9764, 0x9766, 0x9767, 0x9768, 0x976A, + 0x976B, 0x976C, 0x976D, 0x976E, 0x976F, 0x9770, 0x9771, ALTCHR, + 0x9772, 0x9775, 0x9777, 0x9778, 0x9779, 0x977A, 0x977B, 0x977D, + 0x977E, 0x977F, 0x9780, 0x9781, 0x9782, 0x9783, 0x9784, 0x9786, + 0x9787, 0x9788, 0x9789, 0x978A, 0x978C, 0x978E, 0x978F, 0x9790, + 0x9793, 0x9795, 0x9796, 0x9797, 0x9799, 0x979A, 0x979B, 0x979C, + 0x979D, 0x81C1, 0x81A6, 0x6B24, 0x6B37, 0x6B39, 0x6B43, 0x6B46, + 0x6B59, 0x98D1, 0x98D2, 0x98D3, 0x98D5, 0x98D9, 0x98DA, 0x6BB3, + 0x5F40, 0x6BC2, 0x89F3, 0x6590, 0x9F51, 0x6593, 0x65BC, 0x65C6, + 0x65C4, 0x65C3, 0x65CC, 0x65CE, 0x65D2, 0x65D6, 0x7080, 0x709C, + 0x7096, 0x709D, 0x70BB, 0x70C0, 0x70B7, 0x70AB, 0x70B1, 0x70E8, + 0x70CA, 0x7110, 0x7113, 0x7116, 0x712F, 0x7131, 0x7173, 0x715C, + 0x7168, 0x7145, 0x7172, 0x714A, 0x7178, 0x717A, 0x7198, 0x71B3, + 0x71B5, 0x71A8, 0x71A0, 0x71E0, 0x71D4, 0x71E7, 0x71F9, 0x721D, + 0x7228, 0x706C, 0x7118, 0x7166, 0x71B9, 0x623E, 0x623D, 0x6243, + 0x6248, 0x6249, 0x793B, 0x7940, 0x7946, 0x7949, 0x795B, 0x795C, + 0x7953, 0x795A, 0x7962, 0x7957, 0x7960, 0x796F, 0x7967, 0x797A, + 0x7985, 0x798A, 0x799A, 0x79A7, 0x79B3, 0x5FD1, 0x5FD0, ALTCHR, +/* 0xED40 - 0xEDFF */ + 0x979E, 0x979F, 0x97A1, 0x97A2, 0x97A4, 0x97A5, 0x97A6, 0x97A7, + 0x97A8, 0x97A9, 0x97AA, 0x97AC, 0x97AE, 0x97B0, 0x97B1, 0x97B3, + 0x97B5, 0x97B6, 0x97B7, 0x97B8, 0x97B9, 0x97BA, 0x97BB, 0x97BC, + 0x97BD, 0x97BE, 0x97BF, 0x97C0, 0x97C1, 0x97C2, 0x97C3, 0x97C4, + 0x97C5, 0x97C6, 0x97C7, 0x97C8, 0x97C9, 0x97CA, 0x97CB, 0x97CC, + 0x97CD, 0x97CE, 0x97CF, 0x97D0, 0x97D1, 0x97D2, 0x97D3, 0x97D4, + 0x97D5, 0x97D6, 0x97D7, 0x97D8, 0x97D9, 0x97DA, 0x97DB, 0x97DC, + 0x97DD, 0x97DE, 0x97DF, 0x97E0, 0x97E1, 0x97E2, 0x97E3, ALTCHR, + 0x97E4, 0x97E5, 0x97E8, 0x97EE, 0x97EF, 0x97F0, 0x97F1, 0x97F2, + 0x97F4, 0x97F7, 0x97F8, 0x97F9, 0x97FA, 0x97FB, 0x97FC, 0x97FD, + 0x97FE, 0x97FF, 0x9800, 0x9801, 0x9802, 0x9803, 0x9804, 0x9805, + 0x9806, 0x9807, 0x9808, 0x9809, 0x980A, 0x980B, 0x980C, 0x980D, + 0x980E, 0x603C, 0x605D, 0x605A, 0x6067, 0x6041, 0x6059, 0x6063, + 0x60AB, 0x6106, 0x610D, 0x615D, 0x61A9, 0x619D, 0x61CB, 0x61D1, + 0x6206, 0x8080, 0x807F, 0x6C93, 0x6CF6, 0x6DFC, 0x77F6, 0x77F8, + 0x7800, 0x7809, 0x7817, 0x7818, 0x7811, 0x65AB, 0x782D, 0x781C, + 0x781D, 0x7839, 0x783A, 0x783B, 0x781F, 0x783C, 0x7825, 0x782C, + 0x7823, 0x7829, 0x784E, 0x786D, 0x7856, 0x7857, 0x7826, 0x7850, + 0x7847, 0x784C, 0x786A, 0x789B, 0x7893, 0x789A, 0x7887, 0x789C, + 0x78A1, 0x78A3, 0x78B2, 0x78B9, 0x78A5, 0x78D4, 0x78D9, 0x78C9, + 0x78EC, 0x78F2, 0x7905, 0x78F4, 0x7913, 0x7924, 0x791E, 0x7934, + 0x9F9B, 0x9EF9, 0x9EFB, 0x9EFC, 0x76F1, 0x7704, 0x770D, 0x76F9, + 0x7707, 0x7708, 0x771A, 0x7722, 0x7719, 0x772D, 0x7726, 0x7735, + 0x7738, 0x7750, 0x7751, 0x7747, 0x7743, 0x775A, 0x7768, ALTCHR, +/* 0xEE40 - 0xEEFF */ + 0x980F, 0x9810, 0x9811, 0x9812, 0x9813, 0x9814, 0x9815, 0x9816, + 0x9817, 0x9818, 0x9819, 0x981A, 0x981B, 0x981C, 0x981D, 0x981E, + 0x981F, 0x9820, 0x9821, 0x9822, 0x9823, 0x9824, 0x9825, 0x9826, + 0x9827, 0x9828, 0x9829, 0x982A, 0x982B, 0x982C, 0x982D, 0x982E, + 0x982F, 0x9830, 0x9831, 0x9832, 0x9833, 0x9834, 0x9835, 0x9836, + 0x9837, 0x9838, 0x9839, 0x983A, 0x983B, 0x983C, 0x983D, 0x983E, + 0x983F, 0x9840, 0x9841, 0x9842, 0x9843, 0x9844, 0x9845, 0x9846, + 0x9847, 0x9848, 0x9849, 0x984A, 0x984B, 0x984C, 0x984D, ALTCHR, + 0x984E, 0x984F, 0x9850, 0x9851, 0x9852, 0x9853, 0x9854, 0x9855, + 0x9856, 0x9857, 0x9858, 0x9859, 0x985A, 0x985B, 0x985C, 0x985D, + 0x985E, 0x985F, 0x9860, 0x9861, 0x9862, 0x9863, 0x9864, 0x9865, + 0x9866, 0x9867, 0x9868, 0x9869, 0x986A, 0x986B, 0x986C, 0x986D, + 0x986E, 0x7762, 0x7765, 0x777F, 0x778D, 0x777D, 0x7780, 0x778C, + 0x7791, 0x779F, 0x77A0, 0x77B0, 0x77B5, 0x77BD, 0x753A, 0x7540, + 0x754E, 0x754B, 0x7548, 0x755B, 0x7572, 0x7579, 0x7583, 0x7F58, + 0x7F61, 0x7F5F, 0x8A48, 0x7F68, 0x7F74, 0x7F71, 0x7F79, 0x7F81, + 0x7F7E, 0x76CD, 0x76E5, 0x8832, 0x9485, 0x9486, 0x9487, 0x948B, + 0x948A, 0x948C, 0x948D, 0x948F, 0x9490, 0x9494, 0x9497, 0x9495, + 0x949A, 0x949B, 0x949C, 0x94A3, 0x94A4, 0x94AB, 0x94AA, 0x94AD, + 0x94AC, 0x94AF, 0x94B0, 0x94B2, 0x94B4, 0x94B6, 0x94B7, 0x94B8, + 0x94B9, 0x94BA, 0x94BC, 0x94BD, 0x94BF, 0x94C4, 0x94C8, 0x94C9, + 0x94CA, 0x94CB, 0x94CC, 0x94CD, 0x94CE, 0x94D0, 0x94D1, 0x94D2, + 0x94D5, 0x94D6, 0x94D7, 0x94D9, 0x94D8, 0x94DB, 0x94DE, 0x94DF, + 0x94E0, 0x94E2, 0x94E4, 0x94E5, 0x94E7, 0x94E8, 0x94EA, ALTCHR, +/* 0xEF40 - 0xEFFF */ + 0x986F, 0x9870, 0x9871, 0x9872, 0x9873, 0x9874, 0x988B, 0x988E, + 0x9892, 0x9895, 0x9899, 0x98A3, 0x98A8, 0x98A9, 0x98AA, 0x98AB, + 0x98AC, 0x98AD, 0x98AE, 0x98AF, 0x98B0, 0x98B1, 0x98B2, 0x98B3, + 0x98B4, 0x98B5, 0x98B6, 0x98B7, 0x98B8, 0x98B9, 0x98BA, 0x98BB, + 0x98BC, 0x98BD, 0x98BE, 0x98BF, 0x98C0, 0x98C1, 0x98C2, 0x98C3, + 0x98C4, 0x98C5, 0x98C6, 0x98C7, 0x98C8, 0x98C9, 0x98CA, 0x98CB, + 0x98CC, 0x98CD, 0x98CF, 0x98D0, 0x98D4, 0x98D6, 0x98D7, 0x98DB, + 0x98DC, 0x98DD, 0x98E0, 0x98E1, 0x98E2, 0x98E3, 0x98E4, ALTCHR, + 0x98E5, 0x98E6, 0x98E9, 0x98EA, 0x98EB, 0x98EC, 0x98ED, 0x98EE, + 0x98EF, 0x98F0, 0x98F1, 0x98F2, 0x98F3, 0x98F4, 0x98F5, 0x98F6, + 0x98F7, 0x98F8, 0x98F9, 0x98FA, 0x98FB, 0x98FC, 0x98FD, 0x98FE, + 0x98FF, 0x9900, 0x9901, 0x9902, 0x9903, 0x9904, 0x9905, 0x9906, + 0x9907, 0x94E9, 0x94EB, 0x94EE, 0x94EF, 0x94F3, 0x94F4, 0x94F5, + 0x94F7, 0x94F9, 0x94FC, 0x94FD, 0x94FF, 0x9503, 0x9502, 0x9506, + 0x9507, 0x9509, 0x950A, 0x950D, 0x950E, 0x950F, 0x9512, 0x9513, + 0x9514, 0x9515, 0x9516, 0x9518, 0x951B, 0x951D, 0x951E, 0x951F, + 0x9522, 0x952A, 0x952B, 0x9529, 0x952C, 0x9531, 0x9532, 0x9534, + 0x9536, 0x9537, 0x9538, 0x953C, 0x953E, 0x953F, 0x9542, 0x9535, + 0x9544, 0x9545, 0x9546, 0x9549, 0x954C, 0x954E, 0x954F, 0x9552, + 0x9553, 0x9554, 0x9556, 0x9557, 0x9558, 0x9559, 0x955B, 0x955E, + 0x955F, 0x955D, 0x9561, 0x9562, 0x9564, 0x9565, 0x9566, 0x9567, + 0x9568, 0x9569, 0x956A, 0x956B, 0x956C, 0x956F, 0x9571, 0x9572, + 0x9573, 0x953A, 0x77E7, 0x77EC, 0x96C9, 0x79D5, 0x79ED, 0x79E3, + 0x79EB, 0x7A06, 0x5D47, 0x7A03, 0x7A02, 0x7A1E, 0x7A14, ALTCHR, +/* 0xF040 - 0xF0FF */ + 0x9908, 0x9909, 0x990A, 0x990B, 0x990C, 0x990E, 0x990F, 0x9911, + 0x9912, 0x9913, 0x9914, 0x9915, 0x9916, 0x9917, 0x9918, 0x9919, + 0x991A, 0x991B, 0x991C, 0x991D, 0x991E, 0x991F, 0x9920, 0x9921, + 0x9922, 0x9923, 0x9924, 0x9925, 0x9926, 0x9927, 0x9928, 0x9929, + 0x992A, 0x992B, 0x992C, 0x992D, 0x992F, 0x9930, 0x9931, 0x9932, + 0x9933, 0x9934, 0x9935, 0x9936, 0x9937, 0x9938, 0x9939, 0x993A, + 0x993B, 0x993C, 0x993D, 0x993E, 0x993F, 0x9940, 0x9941, 0x9942, + 0x9943, 0x9944, 0x9945, 0x9946, 0x9947, 0x9948, 0x9949, ALTCHR, + 0x994A, 0x994B, 0x994C, 0x994D, 0x994E, 0x994F, 0x9950, 0x9951, + 0x9952, 0x9953, 0x9956, 0x9957, 0x9958, 0x9959, 0x995A, 0x995B, + 0x995C, 0x995D, 0x995E, 0x995F, 0x9960, 0x9961, 0x9962, 0x9964, + 0x9966, 0x9973, 0x9978, 0x9979, 0x997B, 0x997E, 0x9982, 0x9983, + 0x9989, 0x7A39, 0x7A37, 0x7A51, 0x9ECF, 0x99A5, 0x7A70, 0x7688, + 0x768E, 0x7693, 0x7699, 0x76A4, 0x74DE, 0x74E0, 0x752C, 0x9E20, + 0x9E22, 0x9E28, 0x9E29, 0x9E2A, 0x9E2B, 0x9E2C, 0x9E32, 0x9E31, + 0x9E36, 0x9E38, 0x9E37, 0x9E39, 0x9E3A, 0x9E3E, 0x9E41, 0x9E42, + 0x9E44, 0x9E46, 0x9E47, 0x9E48, 0x9E49, 0x9E4B, 0x9E4C, 0x9E4E, + 0x9E51, 0x9E55, 0x9E57, 0x9E5A, 0x9E5B, 0x9E5C, 0x9E5E, 0x9E63, + 0x9E66, 0x9E67, 0x9E68, 0x9E69, 0x9E6A, 0x9E6B, 0x9E6C, 0x9E71, + 0x9E6D, 0x9E73, 0x7592, 0x7594, 0x7596, 0x75A0, 0x759D, 0x75AC, + 0x75A3, 0x75B3, 0x75B4, 0x75B8, 0x75C4, 0x75B1, 0x75B0, 0x75C3, + 0x75C2, 0x75D6, 0x75CD, 0x75E3, 0x75E8, 0x75E6, 0x75E4, 0x75EB, + 0x75E7, 0x7603, 0x75F1, 0x75FC, 0x75FF, 0x7610, 0x7600, 0x7605, + 0x760C, 0x7617, 0x760A, 0x7625, 0x7618, 0x7615, 0x7619, ALTCHR, +/* 0xF140 - 0xF1FF */ + 0x998C, 0x998E, 0x999A, 0x999B, 0x999C, 0x999D, 0x999E, 0x999F, + 0x99A0, 0x99A1, 0x99A2, 0x99A3, 0x99A4, 0x99A6, 0x99A7, 0x99A9, + 0x99AA, 0x99AB, 0x99AC, 0x99AD, 0x99AE, 0x99AF, 0x99B0, 0x99B1, + 0x99B2, 0x99B3, 0x99B4, 0x99B5, 0x99B6, 0x99B7, 0x99B8, 0x99B9, + 0x99BA, 0x99BB, 0x99BC, 0x99BD, 0x99BE, 0x99BF, 0x99C0, 0x99C1, + 0x99C2, 0x99C3, 0x99C4, 0x99C5, 0x99C6, 0x99C7, 0x99C8, 0x99C9, + 0x99CA, 0x99CB, 0x99CC, 0x99CD, 0x99CE, 0x99CF, 0x99D0, 0x99D1, + 0x99D2, 0x99D3, 0x99D4, 0x99D5, 0x99D6, 0x99D7, 0x99D8, ALTCHR, + 0x99D9, 0x99DA, 0x99DB, 0x99DC, 0x99DD, 0x99DE, 0x99DF, 0x99E0, + 0x99E1, 0x99E2, 0x99E3, 0x99E4, 0x99E5, 0x99E6, 0x99E7, 0x99E8, + 0x99E9, 0x99EA, 0x99EB, 0x99EC, 0x99ED, 0x99EE, 0x99EF, 0x99F0, + 0x99F1, 0x99F2, 0x99F3, 0x99F4, 0x99F5, 0x99F6, 0x99F7, 0x99F8, + 0x99F9, 0x761B, 0x763C, 0x7622, 0x7620, 0x7640, 0x762D, 0x7630, + 0x763F, 0x7635, 0x7643, 0x763E, 0x7633, 0x764D, 0x765E, 0x7654, + 0x765C, 0x7656, 0x766B, 0x766F, 0x7FCA, 0x7AE6, 0x7A78, 0x7A79, + 0x7A80, 0x7A86, 0x7A88, 0x7A95, 0x7AA6, 0x7AA0, 0x7AAC, 0x7AA8, + 0x7AAD, 0x7AB3, 0x8864, 0x8869, 0x8872, 0x887D, 0x887F, 0x8882, + 0x88A2, 0x88C6, 0x88B7, 0x88BC, 0x88C9, 0x88E2, 0x88CE, 0x88E3, + 0x88E5, 0x88F1, 0x891A, 0x88FC, 0x88E8, 0x88FE, 0x88F0, 0x8921, + 0x8919, 0x8913, 0x891B, 0x890A, 0x8934, 0x892B, 0x8936, 0x8941, + 0x8966, 0x897B, 0x758B, 0x80E5, 0x76B2, 0x76B4, 0x77DC, 0x8012, + 0x8014, 0x8016, 0x801C, 0x8020, 0x8022, 0x8025, 0x8026, 0x8027, + 0x8029, 0x8028, 0x8031, 0x800B, 0x8035, 0x8043, 0x8046, 0x804D, + 0x8052, 0x8069, 0x8071, 0x8983, 0x9878, 0x9880, 0x9883, ALTCHR, +/* 0xF240 - 0xF2FF */ + 0x99FA, 0x99FB, 0x99FC, 0x99FD, 0x99FE, 0x99FF, 0x9A00, 0x9A01, + 0x9A02, 0x9A03, 0x9A04, 0x9A05, 0x9A06, 0x9A07, 0x9A08, 0x9A09, + 0x9A0A, 0x9A0B, 0x9A0C, 0x9A0D, 0x9A0E, 0x9A0F, 0x9A10, 0x9A11, + 0x9A12, 0x9A13, 0x9A14, 0x9A15, 0x9A16, 0x9A17, 0x9A18, 0x9A19, + 0x9A1A, 0x9A1B, 0x9A1C, 0x9A1D, 0x9A1E, 0x9A1F, 0x9A20, 0x9A21, + 0x9A22, 0x9A23, 0x9A24, 0x9A25, 0x9A26, 0x9A27, 0x9A28, 0x9A29, + 0x9A2A, 0x9A2B, 0x9A2C, 0x9A2D, 0x9A2E, 0x9A2F, 0x9A30, 0x9A31, + 0x9A32, 0x9A33, 0x9A34, 0x9A35, 0x9A36, 0x9A37, 0x9A38, ALTCHR, + 0x9A39, 0x9A3A, 0x9A3B, 0x9A3C, 0x9A3D, 0x9A3E, 0x9A3F, 0x9A40, + 0x9A41, 0x9A42, 0x9A43, 0x9A44, 0x9A45, 0x9A46, 0x9A47, 0x9A48, + 0x9A49, 0x9A4A, 0x9A4B, 0x9A4C, 0x9A4D, 0x9A4E, 0x9A4F, 0x9A50, + 0x9A51, 0x9A52, 0x9A53, 0x9A54, 0x9A55, 0x9A56, 0x9A57, 0x9A58, + 0x9A59, 0x9889, 0x988C, 0x988D, 0x988F, 0x9894, 0x989A, 0x989B, + 0x989E, 0x989F, 0x98A1, 0x98A2, 0x98A5, 0x98A6, 0x864D, 0x8654, + 0x866C, 0x866E, 0x867F, 0x867A, 0x867C, 0x867B, 0x86A8, 0x868D, + 0x868B, 0x86AC, 0x869D, 0x86A7, 0x86A3, 0x86AA, 0x8693, 0x86A9, + 0x86B6, 0x86C4, 0x86B5, 0x86CE, 0x86B0, 0x86BA, 0x86B1, 0x86AF, + 0x86C9, 0x86CF, 0x86B4, 0x86E9, 0x86F1, 0x86F2, 0x86ED, 0x86F3, + 0x86D0, 0x8713, 0x86DE, 0x86F4, 0x86DF, 0x86D8, 0x86D1, 0x8703, + 0x8707, 0x86F8, 0x8708, 0x870A, 0x870D, 0x8709, 0x8723, 0x873B, + 0x871E, 0x8725, 0x872E, 0x871A, 0x873E, 0x8748, 0x8734, 0x8731, + 0x8729, 0x8737, 0x873F, 0x8782, 0x8722, 0x877D, 0x877E, 0x877B, + 0x8760, 0x8770, 0x874C, 0x876E, 0x878B, 0x8753, 0x8763, 0x877C, + 0x8764, 0x8759, 0x8765, 0x8793, 0x87AF, 0x87A8, 0x87D2, ALTCHR, +/* 0xF340 - 0xF3FF */ + 0x9A5A, 0x9A5B, 0x9A5C, 0x9A5D, 0x9A5E, 0x9A5F, 0x9A60, 0x9A61, + 0x9A62, 0x9A63, 0x9A64, 0x9A65, 0x9A66, 0x9A67, 0x9A68, 0x9A69, + 0x9A6A, 0x9A6B, 0x9A72, 0x9A83, 0x9A89, 0x9A8D, 0x9A8E, 0x9A94, + 0x9A95, 0x9A99, 0x9AA6, 0x9AA9, 0x9AAA, 0x9AAB, 0x9AAC, 0x9AAD, + 0x9AAE, 0x9AAF, 0x9AB2, 0x9AB3, 0x9AB4, 0x9AB5, 0x9AB9, 0x9ABB, + 0x9ABD, 0x9ABE, 0x9ABF, 0x9AC3, 0x9AC4, 0x9AC6, 0x9AC7, 0x9AC8, + 0x9AC9, 0x9ACA, 0x9ACD, 0x9ACE, 0x9ACF, 0x9AD0, 0x9AD2, 0x9AD4, + 0x9AD5, 0x9AD6, 0x9AD7, 0x9AD9, 0x9ADA, 0x9ADB, 0x9ADC, ALTCHR, + 0x9ADD, 0x9ADE, 0x9AE0, 0x9AE2, 0x9AE3, 0x9AE4, 0x9AE5, 0x9AE7, + 0x9AE8, 0x9AE9, 0x9AEA, 0x9AEC, 0x9AEE, 0x9AF0, 0x9AF1, 0x9AF2, + 0x9AF3, 0x9AF4, 0x9AF5, 0x9AF6, 0x9AF7, 0x9AF8, 0x9AFA, 0x9AFC, + 0x9AFD, 0x9AFE, 0x9AFF, 0x9B00, 0x9B01, 0x9B02, 0x9B04, 0x9B05, + 0x9B06, 0x87C6, 0x8788, 0x8785, 0x87AD, 0x8797, 0x8783, 0x87AB, + 0x87E5, 0x87AC, 0x87B5, 0x87B3, 0x87CB, 0x87D3, 0x87BD, 0x87D1, + 0x87C0, 0x87CA, 0x87DB, 0x87EA, 0x87E0, 0x87EE, 0x8816, 0x8813, + 0x87FE, 0x880A, 0x881B, 0x8821, 0x8839, 0x883C, 0x7F36, 0x7F42, + 0x7F44, 0x7F45, 0x8210, 0x7AFA, 0x7AFD, 0x7B08, 0x7B03, 0x7B04, + 0x7B15, 0x7B0A, 0x7B2B, 0x7B0F, 0x7B47, 0x7B38, 0x7B2A, 0x7B19, + 0x7B2E, 0x7B31, 0x7B20, 0x7B25, 0x7B24, 0x7B33, 0x7B3E, 0x7B1E, + 0x7B58, 0x7B5A, 0x7B45, 0x7B75, 0x7B4C, 0x7B5D, 0x7B60, 0x7B6E, + 0x7B7B, 0x7B62, 0x7B72, 0x7B71, 0x7B90, 0x7BA6, 0x7BA7, 0x7BB8, + 0x7BAC, 0x7B9D, 0x7BA8, 0x7B85, 0x7BAA, 0x7B9C, 0x7BA2, 0x7BAB, + 0x7BB4, 0x7BD1, 0x7BC1, 0x7BCC, 0x7BDD, 0x7BDA, 0x7BE5, 0x7BE6, + 0x7BEA, 0x7C0C, 0x7BFE, 0x7BFC, 0x7C0F, 0x7C16, 0x7C0B, ALTCHR, +/* 0xF440 - 0xF4FF */ + 0x9B07, 0x9B09, 0x9B0A, 0x9B0B, 0x9B0C, 0x9B0D, 0x9B0E, 0x9B10, + 0x9B11, 0x9B12, 0x9B14, 0x9B15, 0x9B16, 0x9B17, 0x9B18, 0x9B19, + 0x9B1A, 0x9B1B, 0x9B1C, 0x9B1D, 0x9B1E, 0x9B20, 0x9B21, 0x9B22, + 0x9B24, 0x9B25, 0x9B26, 0x9B27, 0x9B28, 0x9B29, 0x9B2A, 0x9B2B, + 0x9B2C, 0x9B2D, 0x9B2E, 0x9B30, 0x9B31, 0x9B33, 0x9B34, 0x9B35, + 0x9B36, 0x9B37, 0x9B38, 0x9B39, 0x9B3A, 0x9B3D, 0x9B3E, 0x9B3F, + 0x9B40, 0x9B46, 0x9B4A, 0x9B4B, 0x9B4C, 0x9B4E, 0x9B50, 0x9B52, + 0x9B53, 0x9B55, 0x9B56, 0x9B57, 0x9B58, 0x9B59, 0x9B5A, ALTCHR, + 0x9B5B, 0x9B5C, 0x9B5D, 0x9B5E, 0x9B5F, 0x9B60, 0x9B61, 0x9B62, + 0x9B63, 0x9B64, 0x9B65, 0x9B66, 0x9B67, 0x9B68, 0x9B69, 0x9B6A, + 0x9B6B, 0x9B6C, 0x9B6D, 0x9B6E, 0x9B6F, 0x9B70, 0x9B71, 0x9B72, + 0x9B73, 0x9B74, 0x9B75, 0x9B76, 0x9B77, 0x9B78, 0x9B79, 0x9B7A, + 0x9B7B, 0x7C1F, 0x7C2A, 0x7C26, 0x7C38, 0x7C41, 0x7C40, 0x81FE, + 0x8201, 0x8202, 0x8204, 0x81EC, 0x8844, 0x8221, 0x8222, 0x8223, + 0x822D, 0x822F, 0x8228, 0x822B, 0x8238, 0x823B, 0x8233, 0x8234, + 0x823E, 0x8244, 0x8249, 0x824B, 0x824F, 0x825A, 0x825F, 0x8268, + 0x887E, 0x8885, 0x8888, 0x88D8, 0x88DF, 0x895E, 0x7F9D, 0x7F9F, + 0x7FA7, 0x7FAF, 0x7FB0, 0x7FB2, 0x7C7C, 0x6549, 0x7C91, 0x7C9D, + 0x7C9C, 0x7C9E, 0x7CA2, 0x7CB2, 0x7CBC, 0x7CBD, 0x7CC1, 0x7CC7, + 0x7CCC, 0x7CCD, 0x7CC8, 0x7CC5, 0x7CD7, 0x7CE8, 0x826E, 0x66A8, + 0x7FBF, 0x7FCE, 0x7FD5, 0x7FE5, 0x7FE1, 0x7FE6, 0x7FE9, 0x7FEE, + 0x7FF3, 0x7CF8, 0x7D77, 0x7DA6, 0x7DAE, 0x7E47, 0x7E9B, 0x9EB8, + 0x9EB4, 0x8D73, 0x8D84, 0x8D94, 0x8D91, 0x8DB1, 0x8D67, 0x8D6D, + 0x8C47, 0x8C49, 0x914A, 0x9150, 0x914E, 0x914F, 0x9164, ALTCHR, +/* 0xF540 - 0xF5FF */ + 0x9B7C, 0x9B7D, 0x9B7E, 0x9B7F, 0x9B80, 0x9B81, 0x9B82, 0x9B83, + 0x9B84, 0x9B85, 0x9B86, 0x9B87, 0x9B88, 0x9B89, 0x9B8A, 0x9B8B, + 0x9B8C, 0x9B8D, 0x9B8E, 0x9B8F, 0x9B90, 0x9B91, 0x9B92, 0x9B93, + 0x9B94, 0x9B95, 0x9B96, 0x9B97, 0x9B98, 0x9B99, 0x9B9A, 0x9B9B, + 0x9B9C, 0x9B9D, 0x9B9E, 0x9B9F, 0x9BA0, 0x9BA1, 0x9BA2, 0x9BA3, + 0x9BA4, 0x9BA5, 0x9BA6, 0x9BA7, 0x9BA8, 0x9BA9, 0x9BAA, 0x9BAB, + 0x9BAC, 0x9BAD, 0x9BAE, 0x9BAF, 0x9BB0, 0x9BB1, 0x9BB2, 0x9BB3, + 0x9BB4, 0x9BB5, 0x9BB6, 0x9BB7, 0x9BB8, 0x9BB9, 0x9BBA, ALTCHR, + 0x9BBB, 0x9BBC, 0x9BBD, 0x9BBE, 0x9BBF, 0x9BC0, 0x9BC1, 0x9BC2, + 0x9BC3, 0x9BC4, 0x9BC5, 0x9BC6, 0x9BC7, 0x9BC8, 0x9BC9, 0x9BCA, + 0x9BCB, 0x9BCC, 0x9BCD, 0x9BCE, 0x9BCF, 0x9BD0, 0x9BD1, 0x9BD2, + 0x9BD3, 0x9BD4, 0x9BD5, 0x9BD6, 0x9BD7, 0x9BD8, 0x9BD9, 0x9BDA, + 0x9BDB, 0x9162, 0x9161, 0x9170, 0x9169, 0x916F, 0x917D, 0x917E, + 0x9172, 0x9174, 0x9179, 0x918C, 0x9185, 0x9190, 0x918D, 0x9191, + 0x91A2, 0x91A3, 0x91AA, 0x91AD, 0x91AE, 0x91AF, 0x91B5, 0x91B4, + 0x91BA, 0x8C55, 0x9E7E, 0x8DB8, 0x8DEB, 0x8E05, 0x8E59, 0x8E69, + 0x8DB5, 0x8DBF, 0x8DBC, 0x8DBA, 0x8DC4, 0x8DD6, 0x8DD7, 0x8DDA, + 0x8DDE, 0x8DCE, 0x8DCF, 0x8DDB, 0x8DC6, 0x8DEC, 0x8DF7, 0x8DF8, + 0x8DE3, 0x8DF9, 0x8DFB, 0x8DE4, 0x8E09, 0x8DFD, 0x8E14, 0x8E1D, + 0x8E1F, 0x8E2C, 0x8E2E, 0x8E23, 0x8E2F, 0x8E3A, 0x8E40, 0x8E39, + 0x8E35, 0x8E3D, 0x8E31, 0x8E49, 0x8E41, 0x8E42, 0x8E51, 0x8E52, + 0x8E4A, 0x8E70, 0x8E76, 0x8E7C, 0x8E6F, 0x8E74, 0x8E85, 0x8E8F, + 0x8E94, 0x8E90, 0x8E9C, 0x8E9E, 0x8C78, 0x8C82, 0x8C8A, 0x8C85, + 0x8C98, 0x8C94, 0x659B, 0x89D6, 0x89DE, 0x89DA, 0x89DC, ALTCHR, +/* 0xF640 - 0xF6FF */ + 0x9BDC, 0x9BDD, 0x9BDE, 0x9BDF, 0x9BE0, 0x9BE1, 0x9BE2, 0x9BE3, + 0x9BE4, 0x9BE5, 0x9BE6, 0x9BE7, 0x9BE8, 0x9BE9, 0x9BEA, 0x9BEB, + 0x9BEC, 0x9BED, 0x9BEE, 0x9BEF, 0x9BF0, 0x9BF1, 0x9BF2, 0x9BF3, + 0x9BF4, 0x9BF5, 0x9BF6, 0x9BF7, 0x9BF8, 0x9BF9, 0x9BFA, 0x9BFB, + 0x9BFC, 0x9BFD, 0x9BFE, 0x9BFF, 0x9C00, 0x9C01, 0x9C02, 0x9C03, + 0x9C04, 0x9C05, 0x9C06, 0x9C07, 0x9C08, 0x9C09, 0x9C0A, 0x9C0B, + 0x9C0C, 0x9C0D, 0x9C0E, 0x9C0F, 0x9C10, 0x9C11, 0x9C12, 0x9C13, + 0x9C14, 0x9C15, 0x9C16, 0x9C17, 0x9C18, 0x9C19, 0x9C1A, ALTCHR, + 0x9C1B, 0x9C1C, 0x9C1D, 0x9C1E, 0x9C1F, 0x9C20, 0x9C21, 0x9C22, + 0x9C23, 0x9C24, 0x9C25, 0x9C26, 0x9C27, 0x9C28, 0x9C29, 0x9C2A, + 0x9C2B, 0x9C2C, 0x9C2D, 0x9C2E, 0x9C2F, 0x9C30, 0x9C31, 0x9C32, + 0x9C33, 0x9C34, 0x9C35, 0x9C36, 0x9C37, 0x9C38, 0x9C39, 0x9C3A, + 0x9C3B, 0x89E5, 0x89EB, 0x89EF, 0x8A3E, 0x8B26, 0x9753, 0x96E9, + 0x96F3, 0x96EF, 0x9706, 0x9701, 0x9708, 0x970F, 0x970E, 0x972A, + 0x972D, 0x9730, 0x973E, 0x9F80, 0x9F83, 0x9F85, 0x9F86, 0x9F87, + 0x9F88, 0x9F89, 0x9F8A, 0x9F8C, 0x9EFE, 0x9F0B, 0x9F0D, 0x96B9, + 0x96BC, 0x96BD, 0x96CE, 0x96D2, 0x77BF, 0x96E0, 0x928E, 0x92AE, + 0x92C8, 0x933E, 0x936A, 0x93CA, 0x938F, 0x943E, 0x946B, 0x9C7F, + 0x9C82, 0x9C85, 0x9C86, 0x9C87, 0x9C88, 0x7A23, 0x9C8B, 0x9C8E, + 0x9C90, 0x9C91, 0x9C92, 0x9C94, 0x9C95, 0x9C9A, 0x9C9B, 0x9C9E, + 0x9C9F, 0x9CA0, 0x9CA1, 0x9CA2, 0x9CA3, 0x9CA5, 0x9CA6, 0x9CA7, + 0x9CA8, 0x9CA9, 0x9CAB, 0x9CAD, 0x9CAE, 0x9CB0, 0x9CB1, 0x9CB2, + 0x9CB3, 0x9CB4, 0x9CB5, 0x9CB6, 0x9CB7, 0x9CBA, 0x9CBB, 0x9CBC, + 0x9CBD, 0x9CC4, 0x9CC5, 0x9CC6, 0x9CC7, 0x9CCA, 0x9CCB, ALTCHR, +/* 0xF740 - 0xF7FF */ + 0x9C3C, 0x9C3D, 0x9C3E, 0x9C3F, 0x9C40, 0x9C41, 0x9C42, 0x9C43, + 0x9C44, 0x9C45, 0x9C46, 0x9C47, 0x9C48, 0x9C49, 0x9C4A, 0x9C4B, + 0x9C4C, 0x9C4D, 0x9C4E, 0x9C4F, 0x9C50, 0x9C51, 0x9C52, 0x9C53, + 0x9C54, 0x9C55, 0x9C56, 0x9C57, 0x9C58, 0x9C59, 0x9C5A, 0x9C5B, + 0x9C5C, 0x9C5D, 0x9C5E, 0x9C5F, 0x9C60, 0x9C61, 0x9C62, 0x9C63, + 0x9C64, 0x9C65, 0x9C66, 0x9C67, 0x9C68, 0x9C69, 0x9C6A, 0x9C6B, + 0x9C6C, 0x9C6D, 0x9C6E, 0x9C6F, 0x9C70, 0x9C71, 0x9C72, 0x9C73, + 0x9C74, 0x9C75, 0x9C76, 0x9C77, 0x9C78, 0x9C79, 0x9C7A, ALTCHR, + 0x9C7B, 0x9C7D, 0x9C7E, 0x9C80, 0x9C83, 0x9C84, 0x9C89, 0x9C8A, + 0x9C8C, 0x9C8F, 0x9C93, 0x9C96, 0x9C97, 0x9C98, 0x9C99, 0x9C9D, + 0x9CAA, 0x9CAC, 0x9CAF, 0x9CB9, 0x9CBE, 0x9CBF, 0x9CC0, 0x9CC1, + 0x9CC2, 0x9CC8, 0x9CC9, 0x9CD1, 0x9CD2, 0x9CDA, 0x9CDB, 0x9CE0, + 0x9CE1, 0x9CCC, 0x9CCD, 0x9CCE, 0x9CCF, 0x9CD0, 0x9CD3, 0x9CD4, + 0x9CD5, 0x9CD7, 0x9CD8, 0x9CD9, 0x9CDC, 0x9CDD, 0x9CDF, 0x9CE2, + 0x977C, 0x9785, 0x9791, 0x9792, 0x9794, 0x97AF, 0x97AB, 0x97A3, + 0x97B2, 0x97B4, 0x9AB1, 0x9AB0, 0x9AB7, 0x9E58, 0x9AB6, 0x9ABA, + 0x9ABC, 0x9AC1, 0x9AC0, 0x9AC5, 0x9AC2, 0x9ACB, 0x9ACC, 0x9AD1, + 0x9B45, 0x9B43, 0x9B47, 0x9B49, 0x9B48, 0x9B4D, 0x9B51, 0x98E8, + 0x990D, 0x992E, 0x9955, 0x9954, 0x9ADF, 0x9AE1, 0x9AE6, 0x9AEF, + 0x9AEB, 0x9AFB, 0x9AED, 0x9AF9, 0x9B08, 0x9B0F, 0x9B13, 0x9B1F, + 0x9B23, 0x9EBD, 0x9EBE, 0x7E3B, 0x9E82, 0x9E87, 0x9E88, 0x9E8B, + 0x9E92, 0x93D6, 0x9E9D, 0x9E9F, 0x9EDB, 0x9EDC, 0x9EDD, 0x9EE0, + 0x9EDF, 0x9EE2, 0x9EE9, 0x9EE7, 0x9EE5, 0x9EEA, 0x9EEF, 0x9F22, + 0x9F2C, 0x9F2F, 0x9F39, 0x9F37, 0x9F3D, 0x9F3E, 0x9F44, ALTCHR, +/* 0xF840 - 0xF8FF */ + 0x9CE3, 0x9CE4, 0x9CE5, 0x9CE6, 0x9CE7, 0x9CE8, 0x9CE9, 0x9CEA, + 0x9CEB, 0x9CEC, 0x9CED, 0x9CEE, 0x9CEF, 0x9CF0, 0x9CF1, 0x9CF2, + 0x9CF3, 0x9CF4, 0x9CF5, 0x9CF6, 0x9CF7, 0x9CF8, 0x9CF9, 0x9CFA, + 0x9CFB, 0x9CFC, 0x9CFD, 0x9CFE, 0x9CFF, 0x9D00, 0x9D01, 0x9D02, + 0x9D03, 0x9D04, 0x9D05, 0x9D06, 0x9D07, 0x9D08, 0x9D09, 0x9D0A, + 0x9D0B, 0x9D0C, 0x9D0D, 0x9D0E, 0x9D0F, 0x9D10, 0x9D11, 0x9D12, + 0x9D13, 0x9D14, 0x9D15, 0x9D16, 0x9D17, 0x9D18, 0x9D19, 0x9D1A, + 0x9D1B, 0x9D1C, 0x9D1D, 0x9D1E, 0x9D1F, 0x9D20, 0x9D21, ALTCHR, + 0x9D22, 0x9D23, 0x9D24, 0x9D25, 0x9D26, 0x9D27, 0x9D28, 0x9D29, + 0x9D2A, 0x9D2B, 0x9D2C, 0x9D2D, 0x9D2E, 0x9D2F, 0x9D30, 0x9D31, + 0x9D32, 0x9D33, 0x9D34, 0x9D35, 0x9D36, 0x9D37, 0x9D38, 0x9D39, + 0x9D3A, 0x9D3B, 0x9D3C, 0x9D3D, 0x9D3E, 0x9D3F, 0x9D40, 0x9D41, + 0x9D42, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xF940 - 0xF9FF */ + 0x9D43, 0x9D44, 0x9D45, 0x9D46, 0x9D47, 0x9D48, 0x9D49, 0x9D4A, + 0x9D4B, 0x9D4C, 0x9D4D, 0x9D4E, 0x9D4F, 0x9D50, 0x9D51, 0x9D52, + 0x9D53, 0x9D54, 0x9D55, 0x9D56, 0x9D57, 0x9D58, 0x9D59, 0x9D5A, + 0x9D5B, 0x9D5C, 0x9D5D, 0x9D5E, 0x9D5F, 0x9D60, 0x9D61, 0x9D62, + 0x9D63, 0x9D64, 0x9D65, 0x9D66, 0x9D67, 0x9D68, 0x9D69, 0x9D6A, + 0x9D6B, 0x9D6C, 0x9D6D, 0x9D6E, 0x9D6F, 0x9D70, 0x9D71, 0x9D72, + 0x9D73, 0x9D74, 0x9D75, 0x9D76, 0x9D77, 0x9D78, 0x9D79, 0x9D7A, + 0x9D7B, 0x9D7C, 0x9D7D, 0x9D7E, 0x9D7F, 0x9D80, 0x9D81, ALTCHR, + 0x9D82, 0x9D83, 0x9D84, 0x9D85, 0x9D86, 0x9D87, 0x9D88, 0x9D89, + 0x9D8A, 0x9D8B, 0x9D8C, 0x9D8D, 0x9D8E, 0x9D8F, 0x9D90, 0x9D91, + 0x9D92, 0x9D93, 0x9D94, 0x9D95, 0x9D96, 0x9D97, 0x9D98, 0x9D99, + 0x9D9A, 0x9D9B, 0x9D9C, 0x9D9D, 0x9D9E, 0x9D9F, 0x9DA0, 0x9DA1, + 0x9DA2, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xFA40 - 0xFAFF */ + 0x9DA3, 0x9DA4, 0x9DA5, 0x9DA6, 0x9DA7, 0x9DA8, 0x9DA9, 0x9DAA, + 0x9DAB, 0x9DAC, 0x9DAD, 0x9DAE, 0x9DAF, 0x9DB0, 0x9DB1, 0x9DB2, + 0x9DB3, 0x9DB4, 0x9DB5, 0x9DB6, 0x9DB7, 0x9DB8, 0x9DB9, 0x9DBA, + 0x9DBB, 0x9DBC, 0x9DBD, 0x9DBE, 0x9DBF, 0x9DC0, 0x9DC1, 0x9DC2, + 0x9DC3, 0x9DC4, 0x9DC5, 0x9DC6, 0x9DC7, 0x9DC8, 0x9DC9, 0x9DCA, + 0x9DCB, 0x9DCC, 0x9DCD, 0x9DCE, 0x9DCF, 0x9DD0, 0x9DD1, 0x9DD2, + 0x9DD3, 0x9DD4, 0x9DD5, 0x9DD6, 0x9DD7, 0x9DD8, 0x9DD9, 0x9DDA, + 0x9DDB, 0x9DDC, 0x9DDD, 0x9DDE, 0x9DDF, 0x9DE0, 0x9DE1, ALTCHR, + 0x9DE2, 0x9DE3, 0x9DE4, 0x9DE5, 0x9DE6, 0x9DE7, 0x9DE8, 0x9DE9, + 0x9DEA, 0x9DEB, 0x9DEC, 0x9DED, 0x9DEE, 0x9DEF, 0x9DF0, 0x9DF1, + 0x9DF2, 0x9DF3, 0x9DF4, 0x9DF5, 0x9DF6, 0x9DF7, 0x9DF8, 0x9DF9, + 0x9DFA, 0x9DFB, 0x9DFC, 0x9DFD, 0x9DFE, 0x9DFF, 0x9E00, 0x9E01, + 0x9E02, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xFB40 - 0xFBFF */ + 0x9E03, 0x9E04, 0x9E05, 0x9E06, 0x9E07, 0x9E08, 0x9E09, 0x9E0A, + 0x9E0B, 0x9E0C, 0x9E0D, 0x9E0E, 0x9E0F, 0x9E10, 0x9E11, 0x9E12, + 0x9E13, 0x9E14, 0x9E15, 0x9E16, 0x9E17, 0x9E18, 0x9E19, 0x9E1A, + 0x9E1B, 0x9E1C, 0x9E1D, 0x9E1E, 0x9E24, 0x9E27, 0x9E2E, 0x9E30, + 0x9E34, 0x9E3B, 0x9E3C, 0x9E40, 0x9E4D, 0x9E50, 0x9E52, 0x9E53, + 0x9E54, 0x9E56, 0x9E59, 0x9E5D, 0x9E5F, 0x9E60, 0x9E61, 0x9E62, + 0x9E65, 0x9E6E, 0x9E6F, 0x9E72, 0x9E74, 0x9E75, 0x9E76, 0x9E77, + 0x9E78, 0x9E79, 0x9E7A, 0x9E7B, 0x9E7C, 0x9E7D, 0x9E80, ALTCHR, + 0x9E81, 0x9E83, 0x9E84, 0x9E85, 0x9E86, 0x9E89, 0x9E8A, 0x9E8C, + 0x9E8D, 0x9E8E, 0x9E8F, 0x9E90, 0x9E91, 0x9E94, 0x9E95, 0x9E96, + 0x9E97, 0x9E98, 0x9E99, 0x9E9A, 0x9E9B, 0x9E9C, 0x9E9E, 0x9EA0, + 0x9EA1, 0x9EA2, 0x9EA3, 0x9EA4, 0x9EA5, 0x9EA7, 0x9EA8, 0x9EA9, + 0x9EAA, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xFC40 - 0xFCFF */ + 0x9EAB, 0x9EAC, 0x9EAD, 0x9EAE, 0x9EAF, 0x9EB0, 0x9EB1, 0x9EB2, + 0x9EB3, 0x9EB5, 0x9EB6, 0x9EB7, 0x9EB9, 0x9EBA, 0x9EBC, 0x9EBF, + 0x9EC0, 0x9EC1, 0x9EC2, 0x9EC3, 0x9EC5, 0x9EC6, 0x9EC7, 0x9EC8, + 0x9ECA, 0x9ECB, 0x9ECC, 0x9ED0, 0x9ED2, 0x9ED3, 0x9ED5, 0x9ED6, + 0x9ED7, 0x9ED9, 0x9EDA, 0x9EDE, 0x9EE1, 0x9EE3, 0x9EE4, 0x9EE6, + 0x9EE8, 0x9EEB, 0x9EEC, 0x9EED, 0x9EEE, 0x9EF0, 0x9EF1, 0x9EF2, + 0x9EF3, 0x9EF4, 0x9EF5, 0x9EF6, 0x9EF7, 0x9EF8, 0x9EFA, 0x9EFD, + 0x9EFF, 0x9F00, 0x9F01, 0x9F02, 0x9F03, 0x9F04, 0x9F05, ALTCHR, + 0x9F06, 0x9F07, 0x9F08, 0x9F09, 0x9F0A, 0x9F0C, 0x9F0F, 0x9F11, + 0x9F12, 0x9F14, 0x9F15, 0x9F16, 0x9F18, 0x9F1A, 0x9F1B, 0x9F1C, + 0x9F1D, 0x9F1E, 0x9F1F, 0x9F21, 0x9F23, 0x9F24, 0x9F25, 0x9F26, + 0x9F27, 0x9F28, 0x9F29, 0x9F2A, 0x9F2B, 0x9F2D, 0x9F2E, 0x9F30, + 0x9F31, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xFD40 - 0xFDFF */ + 0x9F32, 0x9F33, 0x9F34, 0x9F35, 0x9F36, 0x9F38, 0x9F3A, 0x9F3C, + 0x9F3F, 0x9F40, 0x9F41, 0x9F42, 0x9F43, 0x9F45, 0x9F46, 0x9F47, + 0x9F48, 0x9F49, 0x9F4A, 0x9F4B, 0x9F4C, 0x9F4D, 0x9F4E, 0x9F4F, + 0x9F52, 0x9F53, 0x9F54, 0x9F55, 0x9F56, 0x9F57, 0x9F58, 0x9F59, + 0x9F5A, 0x9F5B, 0x9F5C, 0x9F5D, 0x9F5E, 0x9F5F, 0x9F60, 0x9F61, + 0x9F62, 0x9F63, 0x9F64, 0x9F65, 0x9F66, 0x9F67, 0x9F68, 0x9F69, + 0x9F6A, 0x9F6B, 0x9F6C, 0x9F6D, 0x9F6E, 0x9F6F, 0x9F70, 0x9F71, + 0x9F72, 0x9F73, 0x9F74, 0x9F75, 0x9F76, 0x9F77, 0x9F78, ALTCHR, + 0x9F79, 0x9F7A, 0x9F7B, 0x9F7C, 0x9F7D, 0x9F7E, 0x9F81, 0x9F82, + 0x9F8D, 0x9F8E, 0x9F8F, 0x9F90, 0x9F91, 0x9F92, 0x9F93, 0x9F94, + 0x9F95, 0x9F96, 0x9F97, 0x9F98, 0x9F9C, 0x9F9D, 0x9F9E, 0x9FA1, + 0x9FA2, 0x9FA3, 0x9FA4, 0x9FA5, 0xF92C, 0xF979, 0xF995, 0xF9E7, + 0xF9F1, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, +/* 0xFE40 - 0xFEFF */ + 0xFA0C, 0xFA0D, 0xFA0E, 0xFA0F, 0xFA11, 0xFA13, 0xFA14, 0xFA18, + 0xFA1F, 0xFA20, 0xFA21, 0xFA23, 0xFA24, 0xFA27, 0xFA28, 0xFA29, + 0xE815, 0xE816, 0xE817, 0xE818, 0xE819, 0xE81A, 0xE81B, 0xE81C, + 0xE81D, 0xE81E, 0xE81F, 0xE820, 0xE821, 0xE822, 0xE823, 0xE824, + 0xE825, 0xE826, 0xE827, 0xE828, 0xE829, 0xE82A, 0xE82B, 0xE82C, + 0xE82D, 0xE82E, 0xE82F, 0xE830, 0xE831, 0xE832, 0xE833, 0xE834, + 0xE835, 0xE836, 0xE837, 0xE838, 0xE839, 0xE83A, 0xE83B, 0xE83C, + 0xE83D, 0xE83E, 0xE83F, 0xE840, 0xE841, 0xE842, 0xE843, ALTCHR, + 0xE844, 0xE845, 0xE846, 0xE847, 0xE848, 0xE849, 0xE84A, 0xE84B, + 0xE84C, 0xE84D, 0xE84E, 0xE84F, 0xE850, 0xE851, 0xE852, 0xE853, + 0xE854, 0xE855, 0xE856, 0xE857, 0xE858, 0xE859, 0xE85A, 0xE85B, + 0xE85C, 0xE85D, 0xE85E, 0xE85F, 0xE860, 0xE861, 0xE862, 0xE863, + 0xE864, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, + ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR, ALTCHR +}; + +CODE_CONV_TWO_OCTET_TO_UCS2(cc_gbk_to_ucs2, /* function name */ + tblGbkToUcs2, /* table name */ + 0x0081, 0x00FE, /* code range (high byte) */ + 0x0040, 0x00FF, /* code range (low byte) */ + ALTCHR /* alt char code (on UCS2) */ + ) + +/* end of file */ diff --git a/xc/extras/X-TrueType/GBK/Imakefile b/xc/extras/X-TrueType/GBK/Imakefile new file mode 100644 index 000000000..d5c3f7568 --- /dev/null +++ b/xc/extras/X-TrueType/GBK/Imakefile @@ -0,0 +1,11 @@ +XCOMM $XFree86: xc/extras/X-TrueType/GBK/Imakefile,v 1.1 2001/03/06 18:03:14 dawes Exp $ + +/* code converter: GBK */ + +#define ModuleName GBK +SRCS = GBKtoUCS2.c main.c +OBJS = GBKtoUCS2.o main.o + +#include <xttMod.tmpl> + +/* end of file */ diff --git a/xc/extras/X-TrueType/GBK/main.c b/xc/extras/X-TrueType/GBK/main.c new file mode 100644 index 000000000..affbe38dd --- /dev/null +++ b/xc/extras/X-TrueType/GBK/main.c @@ -0,0 +1,70 @@ +/* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */ +/* ===FileName: === + Copyright (c) 1998,1999 Chen Xiangyang, All Rights reserved. + Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved. + Copyright (c) 1998 X-TrueType Server Project, All rights reserved. + +===Notice + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + Major Release ID: X-TrueType Server Version 1.2 [Aoi MATSUBARA Release 2] + +Notice=== + */ +/* $XFree86: xc/extras/X-TrueType/GBK/main.c,v 1.1 2001/03/06 18:03:14 dawes Exp $ */ + +#include "xttversion.h" + +static char const * const releaseID = + _XTT_RELEASE_NAME; + +#include "xttcommon.h" +#include "xttcap.h" +#include "xttcconv.h" +#include "xttcconvP.h" + + +typedef enum +{ + GBK +} CharSetMagic; + +static CharSetRelation const charSetRelations[] = { + { "gbk", NULL, NULL, GBK, { 0x40, 0xff, 0x81, 0xfe, 0x8140 } }, + { NULL, NULL, NULL, 0, { 0, 0, 0, 0, 0 } } +}; + + +CODECONV_TEMPLATE(cc_gbk_to_ucs2); +static MapIDRelation const mapIDRelations[] = { + { GBK, EPlfmISO, EEncISO10646, + cc_gbk_to_ucs2, NULL }, + { GBK, EPlfmUnicode, EEncAny, + cc_gbk_to_ucs2, NULL }, + { GBK, EPlfmMS, EEncMSUnicode, + cc_gbk_to_ucs2, NULL }, + { -1, 0, 0, NULL, NULL } +}; + +STD_ENTRYFUNC_TEMPLATE(GBK_entrypoint) + +/* end of file */ diff --git a/xc/extras/X-TrueType/Imakefile b/xc/extras/X-TrueType/Imakefile index 82b3f32ba..01caf936b 100644 --- a/xc/extras/X-TrueType/Imakefile +++ b/xc/extras/X-TrueType/Imakefile @@ -1,3 +1,5 @@ +XCOMM $XFree86: xc/extras/X-TrueType/Imakefile,v 1.4 2001/03/06 18:54:38 dawes Exp $ + /* * X-TrueType Server */ @@ -11,13 +13,13 @@ XTT_CCONV_DEFAULT_DONES = DONE ISO8859.1/DONE #if XTrueTypeUseOptEncodings XTT_USE_OPT_ENC_DEFINES = -DOPT_ENCODINGS XTT_CCONV_OPT_SUBDIRS = \ - BIG5 GB2312 JISX0201 JISX0208 JISX0212 KSC5601 KSCJOHAB \ + BIG5 BIG5HKSCS GB2312 GBK JISX0201 JISX0208 JISX0212 KSC5601 KSCJOHAB \ ISO8859.2 ISO8859.3 ISO8859.4 ISO8859.5 ISO8859.6 \ ISO8859.7 ISO8859.8 ISO8859.9 ISO8859.10 ISO8859.11 \ ISO8859.14 ISO8859.15 KOI8 VISCII TCVN ARMSCII8 \ ARABIC MULEENCODING DOSENCODING GEORGIAN XTT_CCONV_OPT_DONES = \ - BIG5/DONE GB2312/DONE JISX0201/DONE JISX0208/DONE \ + BIG5/DONE BIG5HKSCS/DONE GB2312/DONE GBK/DONE JISX0201/DONE JISX0208/DONE \ JISX0212/DONE KSC5601/DONE KSCJOHAB/DONE \ ISO8859.1/DONE ISO8859.2/DONE ISO8859.3/DONE ISO8859.4/DONE \ ISO8859.5/DONE ISO8859.6/DONE ISO8859.7/DONE ISO8859.8/DONE \ diff --git a/xc/extras/X-TrueType/xttcconv.c b/xc/extras/X-TrueType/xttcconv.c index 140284607..3b4b82633 100644 --- a/xc/extras/X-TrueType/xttcconv.c +++ b/xc/extras/X-TrueType/xttcconv.c @@ -30,7 +30,7 @@ Notice=== */ -/* $XFree86: xc/extras/X-TrueType/xttcconv.c,v 1.8 2000/05/18 23:46:10 dawes Exp $ */ +/* $XFree86: xc/extras/X-TrueType/xttcconv.c,v 1.10 2001/03/06 18:54:39 dawes Exp $ */ #include "xttversion.h" @@ -192,7 +192,9 @@ static const char* convModuleSubdir[] = { ENTRYFUNC_PROTO_TEMPLATE(ISO8859_1_entrypoint); #ifdef OPT_ENCODINGS ENTRYFUNC_PROTO_TEMPLATE(BIG5_entrypoint); +ENTRYFUNC_PROTO_TEMPLATE(BIG5HKSCS_entrypoint); ENTRYFUNC_PROTO_TEMPLATE(GB2312_entrypoint); +ENTRYFUNC_PROTO_TEMPLATE(GBK_entrypoint); ENTRYFUNC_PROTO_TEMPLATE(JISX0201_entrypoint); ENTRYFUNC_PROTO_TEMPLATE(JISX0208_entrypoint); ENTRYFUNC_PROTO_TEMPLATE(JISX0212_entrypoint); @@ -231,7 +233,9 @@ static mod_entrypoint_ptr_t preloadedCodeConverter[] = { ISO8859_1_entrypoint, #ifdef OPT_ENCODINGS BIG5_entrypoint, + BIG5HKSCS_entrypoint, GB2312_entrypoint, + GBK_entrypoint, JISX0201_entrypoint, JISX0208_entrypoint, JISX0212_entrypoint, diff --git a/xc/extras/X-TrueType/xttcconvP.h b/xc/extras/X-TrueType/xttcconvP.h index 0fa8ff3a5..514039e5e 100644 --- a/xc/extras/X-TrueType/xttcconvP.h +++ b/xc/extras/X-TrueType/xttcconvP.h @@ -32,7 +32,7 @@ Notice=== */ -/* $XFree86: xc/extras/X-TrueType/xttcconvP.h,v 1.6 2000/06/27 21:26:32 tsi Exp $ */ +/* $XFree86: xc/extras/X-TrueType/xttcconvP.h,v 1.7 2001/03/06 18:03:12 dawes Exp $ */ #ifndef _XTTCCONVP_H_ #define _XTTCCONVP_H_ 1 @@ -101,7 +101,8 @@ enum { EEncMSSymbol = 0, EEncMSUnicode = 1, EEncMSShiftJIS = 2, - EEncMSBig5WGL4 = 4, + EEncMSBig5WGL4 = 3, + EEncMSGB2312 = 4, EEncMSWansung = 5, EEncAny = -1 }; diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/include/gluos.h b/xc/extras/ogl-sample/main/gfx/lib/glu/include/gluos.h index 08f40f6c3..a8025a9e9 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/include/gluos.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/include/gluos.h @@ -1,10 +1,10 @@ /* ** gluos.h - operating system dependencies for GLU ** -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/include/Attic/gluos.h,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ */ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/include/gluos.h,v 1.3 2001/04/06 17:44:57 dawes Exp $ */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__CYGWIN__) #define WIN32_LEAN_AND_MEAN #define NOGDI diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/interface/glinterface.cc b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/interface/glinterface.cc index 87c17bfa8..7a9a5c850 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/interface/glinterface.cc +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/interface/glinterface.cc @@ -31,12 +31,8 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ */ -/* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/interface/Attic/glinterface.cc,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ -*/ -/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/interface/glinterface.cc,v 1.2 2001/01/21 21:19:07 tsi Exp $ */ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/interface/glinterface.cc,v 1.3 2001/04/03 02:18:40 dawes Exp $ */ #include "gluos.h" #include <GL/gl.h> @@ -430,7 +426,7 @@ gluGetNurbsProperty(GLUnurbs *r, GLenum property, GLfloat *value) } extern "C" void GLAPIENTRY -gluNurbsCallback(GLUnurbs *r, GLenum which, GLvoid (*fn)()) +gluNurbsCallback(GLUnurbs *r, GLenum which, GLvoid (*fn)(GLvoid)) { switch (which) { case GLU_NURBS_BEGIN: diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleCompTop.cc b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleCompTop.cc index 3f34909a5..aed0521be 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleCompTop.cc +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleCompTop.cc @@ -1,3 +1,4 @@ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleCompTop.cc,v 1.2 2001/04/01 13:59:57 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -31,10 +32,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ +** $Date: 2001/04/09 16:27:24 $ $Revision: 1.1.1.2 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/Attic/sampleCompTop.cc,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/Attic/sampleCompTop.cc,v 1.1.1.2 2001/04/09 16:27:24 dawes Exp $ */ #include <stdlib.h> @@ -826,7 +827,7 @@ static void sampleCompTopSimpleOpt(gridWrap* grid, //find l in [j, k-1] so that dec_chain[l][0] 0 is closest to // inc_chain[i] int l; - Real tempI = j; + int tempI = j; Real tempMin = fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]); for(l=j+1; l<= k-1; l++) { @@ -841,14 +842,14 @@ static void sampleCompTopSimpleOpt(gridWrap* grid, monoTriangulationRecGenOpt(dec_chain->getVertex(tempI), botVertex, inc_chain, i, inc_end, - dec_chain, (int)(tempI+1), dec_end, + dec_chain, tempI + 1, dec_end, pStream); //recursively do the rest sampleCompTopSimpleOpt(grid, gridV+1, topVertex, inc_chain->getVertex(i), inc_chain, inc_current, i-1, - dec_chain, dec_current, (int)tempI, + dec_chain, dec_current, tempI, pStream); } else diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleMonoPoly.cc b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleMonoPoly.cc index 8167336c2..cae2d2ddb 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleMonoPoly.cc +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleMonoPoly.cc @@ -1,3 +1,4 @@ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/sampleMonoPoly.cc,v 1.2 2001/04/01 13:59:58 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -31,10 +32,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ +** $Date: 2001/04/09 16:27:24 $ $Revision: 1.1.1.2 $ */ /* -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/Attic/sampleMonoPoly.cc,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/Attic/sampleMonoPoly.cc,v 1.1.1.2 2001/04/09 16:27:24 dawes Exp $ */ #include "gluos.h" @@ -517,7 +518,7 @@ rightChain->print(); *either this vertex or the botvertex can be used as the right corner */ - Real tempI; + int tempI; //skip those points which are equal to v. (avoid degeneratcy) for(tempI = index1; tempI <= leftChainEndIndex; tempI++) if(leftChain->getVertex(tempI)[1] < v) @@ -527,7 +528,7 @@ rightChain->print(); else { Real tempMax = leftChain->getVertex(tempI)[0]; - for(i=(int)tempI; i<= leftChainEndIndex; i++) + for(i=tempI; i<= leftChainEndIndex; i++) if(leftChain->getVertex(i)[0] > tempMax) { tempI = i; @@ -552,7 +553,7 @@ rightChain->print(); else { ret_rightCornerWhere = 0; - ret_rightCornerIndex = (int)tempI; + ret_rightCornerIndex = tempI; } } diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/memalloc.h b/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/memalloc.h index 1e4909740..543913209 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/memalloc.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/memalloc.h @@ -1,3 +1,4 @@ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libtess/memalloc.h,v 1.2 2001/03/02 03:42:45 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -35,14 +36,14 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/Attic/memalloc.h,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ +** $Date: 2001/04/09 16:27:24 $ $Revision: 1.1.1.2 $ +** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/Attic/memalloc.h,v 1.1.1.2 2001/04/09 16:27:24 dawes Exp $ */ #ifndef __memalloc_simple_h_ #define __memalloc_simple_h_ -#include <malloc.h> +#include <stdlib.h> #define memRealloc realloc #define memFree free diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tess.c b/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tess.c index 74cdb4e35..44a9b02cb 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tess.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tess.c @@ -35,9 +35,8 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/Attic/tess.c,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ */ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tess.c,v 1.2 2001/04/03 02:18:40 dawes Exp $ */ #include "gluos.h" #include <stddef.h> @@ -271,7 +270,8 @@ gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z ) } void GLAPIENTRY -gluTessCallback( GLUtesselator *tess, GLenum which, void (GLAPIENTRY *fn)()) +gluTessCallback( GLUtesselator *tess, GLenum which, + GLvoid (GLAPIENTRY *fn)(GLvoid)) { switch( which ) { case GLU_TESS_BEGIN: diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.c b/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.c index ba81a6eb6..b29f6027d 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.c @@ -35,9 +35,8 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/Attic/tessmono.c,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ */ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.c,v 1.2 2001/04/03 02:18:40 dawes Exp $ */ #include "gluos.h" #include <stdlib.h> @@ -50,7 +49,7 @@ eDst->Sym->winding += eSrc->Sym->winding) /* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region - * (what else would it do??) The region must consist of a single + * (what else would it do?) The region must consist of a single * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this * case means that any vertical line intersects the interior of the * region in a single interval. diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.h b/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.h index 579c28bdd..200d9c865 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.h +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.h @@ -35,15 +35,14 @@ /* ** Author: Eric Veach, July 1994. ** -** $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libtess/Attic/tessmono.h,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ */ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libtess/tessmono.h,v 1.2 2001/04/03 02:18:40 dawes Exp $ */ #ifndef __tessmono_h_ #define __tessmono_h_ /* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region - * (what else would it do??) The region must consist of a single + * (what else would it do?) The region must consist of a single * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this * case means that any vertical line intersects the interior of the * region in a single interval. diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libutil/quad.c b/xc/extras/ogl-sample/main/gfx/lib/glu/libutil/quad.c index b1307d440..30613cf62 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libutil/quad.c +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libutil/quad.c @@ -31,9 +31,8 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ -** $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libutil/Attic/quad.c,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ */ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libutil/quad.c,v 1.2 2001/04/03 02:18:41 dawes Exp $ */ #include "gluos.h" #include "gluint.h" @@ -89,7 +88,8 @@ static void gluQuadricError(GLUquadric *qobj, GLenum which) } void GLAPIENTRY -gluQuadricCallback(GLUquadric *qobj, GLenum which, void (GLAPIENTRY *fn)()) +gluQuadricCallback(GLUquadric *qobj, GLenum which, + GLvoid (GLAPIENTRY *fn)(GLvoid)) { switch (which) { case GLU_ERROR: diff --git a/xc/extras/x86emu/src/x86emu/x86emu/x86emui.h b/xc/extras/x86emu/src/x86emu/x86emu/x86emui.h index 8d22563ac..9cdb0a1b3 100644 --- a/xc/extras/x86emu/src/x86emu/x86emu/x86emui.h +++ b/xc/extras/x86emu/src/x86emu/x86emu/x86emui.h @@ -38,7 +38,7 @@ * ****************************************************************************/ -/* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/x86emui.h,v 1.3 2000/04/17 16:29:47 eich Exp $ */ +/* $XFree86: xc/extras/x86emu/src/x86emu/x86emu/x86emui.h,v 1.4 2001/04/01 13:59:58 tsi Exp $ */ #ifndef __X86EMU_X86EMUI_H #define __X86EMU_X86EMUI_H @@ -75,6 +75,7 @@ #include <xf86_ansic.h> #else #include <stdio.h> +#include <stdlib.h> #include <string.h> #endif /*--------------------------- Inline Functions ----------------------------*/ diff --git a/xc/include/GL/Imakefile b/xc/include/GL/Imakefile index 750b4953f..fc6458972 100644 --- a/xc/include/GL/Imakefile +++ b/xc/include/GL/Imakefile @@ -1,12 +1,13 @@ -XCOMM $XFree86: xc/include/GL/Imakefile,v 1.10 2000/08/04 03:51:40 tsi Exp $ +XCOMM $XFree86: xc/include/GL/Imakefile,v 1.12 2001/03/22 21:48:52 dawes 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 glxint.h glxtokens.h osmesa.h +GLXHEADERS = gl.h glext.h glu.h glx.h glxint.h glxmd.h glxproto.h \ + glxtokens.h osmesa.h #endif HEADERS = $(GLXHEADERS) diff --git a/xc/include/GL/glu.h b/xc/include/GL/glu.h index e2eaf5a15..bc5d8bba4 100644 --- a/xc/include/GL/glu.h +++ b/xc/include/GL/glu.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/include/GL/glu.h,v 1.1 2001/01/15 22:17:50 dawes Exp $ */ +/* $XFree86: xc/include/GL/glu.h,v 1.2 2001/04/03 02:18:39 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are @@ -256,7 +256,7 @@ typedef struct GLUtesselator GLUtriangulatorObj; #define GLU_TESS_MAX_COORD 1.0e150 /* Internal convenience typedefs */ -typedef void (*_GLUfuncptr)(); +typedef GLvoid (*_GLUfuncptr)(GLvoid); extern void gluBeginCurve (GLUnurbs* nurb); extern void gluBeginPolygon (GLUtesselator* tess); diff --git a/xc/include/GL/glx.h b/xc/include/GL/glx.h index ac7284edc..93b13d0f2 100644 --- a/xc/include/GL/glx.h +++ b/xc/include/GL/glx.h @@ -1,11 +1,11 @@ #ifndef __GLX_glx_h__ #define __GLX_glx_h__ -/* $XFree86: xc/include/GL/glx.h,v 1.7 2000/06/30 18:27:00 dawes Exp $ */ +/* $XFree86: xc/include/GL/glx.h,v 1.8 2001/03/21 15:51:38 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.0 (the "License"), the contents of this +** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 diff --git a/xc/include/GL/glxmd.h b/xc/include/GL/glxmd.h index 9b634840e..3c4dc6570 100644 --- a/xc/include/GL/glxmd.h +++ b/xc/include/GL/glxmd.h @@ -1,26 +1,39 @@ #ifndef _GLX_glxmd_h_ #define _GLX_glxmd_h_ -/* $XFree86: xc/include/GL/glxmd.h,v 1.2 1999/06/14 07:23:28 dawes Exp $ */ +/* $XFree86: xc/include/GL/glxmd.h,v 1.3 2001/03/21 15:51:38 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** -** $SGI$ +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. */ /* diff --git a/xc/include/GL/glxproto.h b/xc/include/GL/glxproto.h index a6659cde1..e63d98089 100644 --- a/xc/include/GL/glxproto.h +++ b/xc/include/GL/glxproto.h @@ -1,26 +1,39 @@ #ifndef _GLX_glxproto_h_ #define _GLX_glxproto_h_ -/* $XFree86: xc/include/GL/glxproto.h,v 1.2 1999/06/14 07:23:29 dawes Exp $ */ +/* $XFree86: xc/include/GL/glxproto.h,v 1.3 2001/03/21 15:51:38 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** -** $SGI$ +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. */ #include "GL/glxmd.h" @@ -29,19 +42,32 @@ /* ** Errrors. -*/ -#define GLXBadContext 0 +*/ +#define GLXBadContext 0 #define GLXBadContextState 1 #define GLXBadDrawable 2 #define GLXBadPixmap 3 #define GLXBadContextTag 4 #define GLXBadCurrentWindow 5 -#define GLXBadRenderRequest 6 +#define GLXBadRenderRequest 6 #define GLXBadLargeRequest 7 #define GLXUnsupportedPrivateRequest 8 +#define GLXBadFBConfig 9 +#define GLXBadPbuffer 10 +#define GLXBadCurrentDrawable 11 +#define GLXBadWindow 12 -#define __GLX_NUMBER_ERRORS 8 -#define __GLX_NUMBER_EVENTS 1 +#define __GLX_NUMBER_ERRORS 12 + +/* +** Events. +** __GLX_NUMBER_EVENTS is set to 17 to account for the BufferClobberSGIX +** event - this helps initialization if the server supports the pbuffer +** extension and the client doesn't. +*/ +#define GLX_PbufferClobber 0 + +#define __GLX_NUMBER_EVENTS 17 #define GLX_EXTENSION_NAME "GLX" #define GLX_EXTENSION_ALIAS "SGI-GLX" @@ -62,6 +88,11 @@ #define GLXContextID CARD32 #define GLXPixmap CARD32 #define GLXDrawable CARD32 +#define GLXPbuffer CARD32 +#define GLXWindow CARD32 +#define GLXFBConfigID CARD32 +#define GLXFBConfigIDSGIX CARD32 +#define GLXPbufferSGIX CARD32 /* ** ContextTag is not exposed to the API. @@ -106,7 +137,7 @@ typedef struct GLXRender { /* ** Large render command request. A single large rendering command -** is output in multiple X extension requests. The first packet +** is output in multiple X extension requests. The first packet ** contains an opcode dependent header (see below) that describes ** the data that follows. */ @@ -122,7 +153,7 @@ typedef struct GLXRenderLarge { #define sz_xGLXRenderLargeReq 16 /* -** GLX single request. Commands that go over as single GLX protocol +** GLX single request. Commands that go over as single GLX protocol ** requests use this structure. The glxCode will be one of the X_GLsop ** opcodes. */ @@ -192,7 +223,7 @@ typedef struct GLXMakeCurrent { CARD8 reqType; CARD8 glxCode; CARD16 length B16; - GLXDrawable drawable B32; + GLXDrawable drawable B32; GLXContextID context B32; GLXContextTag oldContextTag B32; } xGLXMakeCurrentReq; @@ -242,7 +273,7 @@ typedef struct GLXSwapBuffers { CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; - GLXDrawable drawable B32; + GLXDrawable drawable B32; } xGLXSwapBuffersReq; #define sz_xGLXSwapBuffersReq 12 @@ -331,10 +362,10 @@ typedef struct GLXVendorPrivateWithReply { ** glXQueryExtensionsString request */ typedef struct GLXQueryExtensionsString { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 screen B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; } xGLXQueryExtensionsStringReq; #define sz_xGLXQueryExtensionsStringReq 8 @@ -342,11 +373,11 @@ typedef struct GLXQueryExtensionsString { ** glXQueryServerString request */ typedef struct GLXQueryServerString { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 screen B32; - CARD32 name B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + CARD32 name B32; } xGLXQueryServerStringReq; #define sz_xGLXQueryServerStringReq 12 @@ -354,29 +385,174 @@ typedef struct GLXQueryServerString { ** glXClientInfo request */ typedef struct GLXClientInfo { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 major B32; - CARD32 minor B32; - CARD32 numbytes B32; + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 major B32; + CARD32 minor B32; + CARD32 numbytes B32; } xGLXClientInfoReq; #define sz_xGLXClientInfoReq 16 +/*** Start of GLX 1.3 requests */ + /* -** glXQueryContextInfoEXT request +** glXGetFBConfigs request */ -typedef struct GLXQueryContextInfoEXT { +typedef struct GLXGetFBConfigs { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; +} xGLXGetFBConfigsReq; +#define sz_xGLXGetFBConfigsReq 8 + +/* +** glXCreatePixmap request +*/ +typedef struct GLXCreatePixmap { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + CARD32 pixmap B32; + GLXPixmap glxpixmap B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreatePixmapReq; +#define sz_xGLXCreatePixmapReq 24 + +/* +** glXDestroyPixmap request +*/ +typedef struct GLXDestroyPixmap { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXPixmap glxpixmap B32; +} xGLXDestroyPixmapReq; +#define sz_xGLXDestroyPixmapReq 8 + +/* +** glXCreateNewContext request +*/ +typedef struct GLXCreateNewContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; - CARD32 vendorCode B32; /* vendor-specific opcode */ - CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXContextID context B32; -} xGLXQueryContextInfoEXTReq; -#define sz_xGLXQueryContextInfoEXTReq 16 + GLXFBConfigID fbconfig B32; + CARD32 screen B32; + CARD32 renderType; + GLXContextID shareList B32; + BOOL isDirect; + CARD8 reserved1; + CARD16 reserved2 B16; +} xGLXCreateNewContextReq; +#define sz_xGLXCreateNewContextReq 28 -/************************************************************************/ +/* +** glXQueryContext request +*/ +typedef struct GLXQueryContext { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXContextID context B32; +} xGLXQueryContextReq; +#define sz_xGLXQueryContextReq 8 + +/* +** glXMakeContextCurrent request +*/ +typedef struct GLXMakeContextCurrent { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXContextTag oldContextTag B32; + GLXDrawable drawable B32; + GLXDrawable readdrawable B32; + GLXContextID context B32; +} xGLXMakeContextCurrentReq; +#define sz_xGLXMakeContextCurrentReq 20 + +/* +** glXCreatePbuffer request +*/ +typedef struct GLXCreatePbuffer { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + GLXPbuffer pbuffer B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreatePbufferReq; +#define sz_xGLXCreatePbufferReq 20 + +/* +** glXDestroyPbuffer request +*/ +typedef struct GLXDestroyPbuffer { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXPbuffer pbuffer B32; +} xGLXDestroyPbufferReq; +#define sz_xGLXDestroyPbufferReq 8 + +/* +** glXGetDrawableAttributes request +*/ +typedef struct GLXGetDrawableAttributes { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXDrawable drawable B32; +} xGLXGetDrawableAttributesReq; +#define sz_xGLXGetDrawableAttributesReq 8 + +/* +** glXChangeDrawableAttributes request +*/ +typedef struct GLXChangeDrawableAttributes { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXDrawable drawable B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXChangeDrawableAttributesReq; +#define sz_xGLXChangeDrawableAttributesReq 12 + +/* +** glXCreateWindow request +*/ +typedef struct GLXCreateWindow { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 screen B32; + GLXFBConfigID fbconfig B32; + CARD32 window B32; + GLXWindow glxwindow B32; + CARD32 numAttribs B32; + /* followed by attribute list */ +} xGLXCreateWindowReq; +#define sz_xGLXCreateWindowReq 24 + +/* +** glXDestroyWindow request +*/ +typedef struct GLXDestroyWindow { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + GLXWindow glxwindow B32; +} xGLXDestroyWindowReq; +#define sz_xGLXDestroyWindowReq 8 /* Replies */ @@ -431,7 +607,7 @@ typedef struct { CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; - CARD32 pad5 B32; + CARD32 depth B32; CARD32 pad6 B32; } xGLXGetTexImageReply; #define sz_xGLXGetTexImageReply 32 @@ -441,6 +617,62 @@ typedef struct { CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 height B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetSeparableFilterReply; +#define sz_xGLXGetSeparableFilterReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 height B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetConvolutionFilterReply; +#define sz_xGLXGetConvolutionFilterReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetHistogramReply; +#define sz_xGLXGetHistogramReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetMinmaxReply; +#define sz_xGLXGetMinmaxReply 32 + +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 newMode B32; @@ -520,16 +752,16 @@ typedef struct { ** the number of words of data which follow the header. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 retval B32; - CARD32 size B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 retval B32; + CARD32 size B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXVendorPrivReply; #define sz_xGLXVendorPrivReply 32 @@ -538,16 +770,16 @@ typedef struct { ** n indicates the number of bytes to be returned. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad1 B32; - CARD32 n B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 n B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXQueryExtensionsStringReply; #define sz_xGLXQueryExtensionsStringReply 32 @@ -556,19 +788,142 @@ typedef struct { ** n indicates the number of bytes to be returned. */ typedef struct { - BYTE type; /* X_Reply */ - CARD8 unused; /* not used */ - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 pad1 B32; - CARD32 n B32; - CARD32 pad3 B32; /* NOTE: may hold a single value */ - CARD32 pad4 B32; /* NOTE: may hold half a double */ - CARD32 pad5 B32; - CARD32 pad6 B32; + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 n B32; + CARD32 pad3 B32; /* NOTE: may hold a single value */ + CARD32 pad4 B32; /* NOTE: may hold half a double */ + CARD32 pad5 B32; + CARD32 pad6 B32; } xGLXQueryServerStringReply; #define sz_xGLXQueryServerStringReply 32 +/*** Start of GLX 1.3 replies */ + +/* +** glXGetFBConfigs reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 numFBConfigs B32; + CARD32 numAttribs B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetFBConfigsReply; +#define sz_xGLXGetFBConfigsReply 32 + +/* +** glXQueryContext reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 n B32; /* number of attribute/value pairs */ + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXQueryContextReply; +#define sz_xGLXQueryContextReply 32 + +/* +** glXMakeContextCurrent reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + GLXContextTag contextTag B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXMakeContextCurrentReply; +#define sz_xGLXMakeContextCurrentReply 32 + +/* +** glXCreateGLXPbuffer reply +** This is used only in the direct rendering case on SGIs - otherwise +** CreateGLXPbuffer has no reply. It is not part of GLX 1.3. +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 success; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXCreateGLXPbufferReply; +#define sz_xGLXCreateGLXPbufferReply 32 + +/* +** glXGetDrawableAttributes reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 numAttribs B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetDrawableAttributesReply; +#define sz_xGLXGetDrawableAttributesReply 32 + +/* +** glXGetColorTable reply +*/ +typedef struct { + BYTE type; /* X_Reply */ + CARD8 unused; /* not used */ + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 width B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xGLXGetColorTableReply; +#define sz_xGLXGetColorTableReply 32 + +/************************************************************************/ + +/* GLX extension requests and replies */ + +/* +** glXQueryContextInfoEXT request +*/ +typedef struct GLXQueryContextInfoEXT { + CARD8 reqType; + CARD8 glxCode; + CARD16 length B16; + CARD32 vendorCode B32; /* vendor-specific opcode */ + CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ + GLXContextID context B32; +} xGLXQueryContextInfoEXTReq; +#define sz_xGLXQueryContextInfoEXTReq 16 + /* ** glXQueryContextInfoEXT reply */ @@ -577,7 +932,7 @@ typedef struct { CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; - CARD32 n B32; /* number of attribute/value pairs */ + CARD32 n B32; /* number of attribute/value pairs */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; @@ -589,6 +944,29 @@ typedef struct { /************************************************************************/ /* +** Events +*/ + +typedef struct { + BYTE type; + BYTE pad; + CARD16 sequenceNumber B16; + CARD16 event_type B16; /*** was clobber_class */ + CARD16 draw_type B16; + CARD32 drawable B32; + CARD32 buffer_mask B32; /*** was mask */ + CARD16 aux_buffer B16; + CARD16 x B16; + CARD16 y B16; + CARD16 width B16; + CARD16 height B16; + CARD16 count B16; + CARD32 unused2 B32; +} xGLXPbufferClobberEvent; + +/************************************************************************/ + +/* ** Size of the standard X request header. */ #define __GLX_SINGLE_HDR_SIZE sz_xGLXSingleReq @@ -617,7 +995,8 @@ typedef struct { /* ** The glBitmap, glPolygonStipple, glTexImage[12]D, glTexSubImage[12]D ** and glDrawPixels calls all have a pixel header transmitted after the -** Render or RenderLarge header and before their own opcode specific headers. +** Render or RenderLarge header and before their own opcode specific +** headers. */ #define __GLX_PIXEL_HDR \ BOOL swapBytes; \ @@ -626,7 +1005,7 @@ typedef struct { CARD8 reserved1; \ CARD32 rowLength B32; \ CARD32 skipRows B32; \ - CARD32 skipPixels B32; \ + CARD32 skipPixels B32; \ CARD32 alignment B32 #define __GLX_PIXEL_HDR_SIZE 20 @@ -636,6 +1015,27 @@ typedef struct { } __GLXpixelHeader; /* +** glTexImage[34]D and glTexSubImage[34]D calls +** all have a pixel header transmitted after the Render or RenderLarge +** header and before their own opcode specific headers. +*/ +#define __GLX_PIXEL_3D_HDR \ + BOOL swapBytes; \ + BOOL lsbFirst; \ + CARD8 reserved0; \ + CARD8 reserved1; \ + CARD32 rowLength B32; \ + CARD32 imageHeight B32; \ + CARD32 imageDepth B32; \ + CARD32 skipRows B32; \ + CARD32 skipImages B32; \ + CARD32 skipVolumes B32; \ + CARD32 skipPixels B32; \ + CARD32 alignment B32 + +#define __GLX_PIXEL_3D_HDR_SIZE 36 + +/* ** Data that is specific to a glBitmap call. The data is sent in the ** following order: ** Render or RenderLarge header @@ -683,19 +1083,18 @@ typedef struct { #define __GLX_POLYGONSTIPPLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE) - /* ** Data that is specific to a glTexImage1D or glTexImage2D call. The ** data is sent in the following order: -** Render or RenderLarge header -** Pixel header -** TexImage header +** Render or RenderLarge header +** Pixel header +** TexImage header ** When a glTexImage1D call the height field is unexamined by the server. */ #define __GLX_TEXIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ - CARD32 components B32; \ + CARD32 components B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 border B32; \ @@ -728,12 +1127,62 @@ typedef struct { } __GLXdispatchTexImageHeader; /* -** Data that is specific to a glTexSubImage1D or glTexSubImage2D call. The +** Data that is specific to a glTexImage3D or glTexImage4D call. The ** data is sent in the following order: -** Render or RenderLarge header -** Pixel header -** TexSubImage header -** When a glTexSubImage1D call is made, the yoffset and height fields +** Render or RenderLarge header +** Pixel 3D header +** TexImage 3D header +** When a glTexImage3D call the size4d and woffset fields are unexamined +** by the server. +** Could be used by all TexImage commands and perhaps should be in the +** future. +*/ +#define __GLX_TEXIMAGE_3D_HDR \ + CARD32 target B32; \ + CARD32 level B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 depth B32; \ + CARD32 size4d B32; \ + CARD32 border B32; \ + CARD32 format B32; \ + CARD32 type B32; \ + CARD32 nullimage B32 + +#define __GLX_TEXIMAGE_3D_HDR_SIZE 44 + +#define __GLX_TEXIMAGE_3D_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ + __GLX_TEXIMAGE_3D_HDR_SIZE) + +#define __GLX_TEXIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXIMAGE_3D_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXtexImage3DHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXtexImage3DLargeHeader; + +typedef struct { + __GLX_PIXEL_3D_HDR; + __GLX_TEXIMAGE_3D_HDR; +} __GLXdispatchTexImage3DHeader; + +/* +** Data that is specific to a glTexSubImage1D or glTexSubImage2D call. The +** data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** TexSubImage header +** When a glTexSubImage1D call is made, the yoffset and height fields ** are unexamined by the server and are considered to be padding. */ #define __GLX_TEXSUBIMAGE_HDR \ @@ -773,11 +1222,61 @@ typedef struct { } __GLXdispatchTexSubImageHeader; /* +** Data that is specific to a glTexSubImage3D and 4D calls. The +** data is sent in the following order: +** Render or RenderLarge header +** Pixel 3D header +** TexSubImage 3D header +** When a glTexSubImage3D call is made, the woffset and size4d fields +** are unexamined by the server and are considered to be padding. +*/ +#define __GLX_TEXSUBIMAGE_3D_HDR \ + CARD32 target B32; \ + CARD32 level B32; \ + CARD32 xoffset B32; \ + CARD32 yoffset B32; \ + CARD32 zoffset B32; \ + CARD32 woffset B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 depth B32; \ + CARD32 size4d B32; \ + CARD32 format B32; \ + CARD32 type B32; \ + CARD32 nullImage \ + +#define __GLX_TEXSUBIMAGE_3D_HDR_SIZE 52 + +#define __GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ + __GLX_TEXSUBIMAGE_3D_HDR_SIZE) + +#define __GLX_TEXSUBIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXSUBIMAGE_3D_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXtexSubImage3DHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXtexSubImage3DLargeHeader; + +typedef struct { + __GLX_PIXEL_3D_HDR; + __GLX_TEXSUBIMAGE_3D_HDR; +} __GLXdispatchTexSubImage3DHeader; + +/* ** Data that is specific to a glDrawPixels call. The data is sent in the ** following order: ** Render or RenderLarge header ** Pixel header -** Bitmap header +** DrawPixels header */ #define __GLX_DRAWPIXELS_HDR \ CARD32 width B32; \ @@ -811,6 +1310,46 @@ typedef struct { } __GLXdispatchDrawPixelsHeader; /* +** Data that is specific to a glConvolutionFilter1D or glConvolutionFilter2D +** call. The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ConvolutionFilter header +** When a glConvolutionFilter1D call the height field is unexamined by the server. +*/ +#define __GLX_CONV_FILT_HDR \ + CARD32 target B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 height B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_CONV_FILT_HDR_SIZE 24 + +#define __GLX_CONV_FILT_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) + +#define __GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE \ + (__GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXConvolutionFilterHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXConvolutionFilterLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_CONV_FILT_HDR; +} __GLXdispatchConvolutionFilterHeader; + +/* ** Data that is specific to a glDrawArraysEXT call. The data is sent in the ** following order: ** Render or RenderLarge header @@ -822,7 +1361,7 @@ typedef struct { #define __GLX_DRAWARRAYS_HDR \ CARD32 numVertexes B32; \ CARD32 numComponents B32; \ - CARD32 primType B32 + CARD32 primType B32 #define __GLX_DRAWARRAYS_HDR_SIZE 12 @@ -846,7 +1385,7 @@ typedef struct { #define __GLX_COMPONENT_HDR \ CARD32 datatype B32; \ INT32 numVals B32; \ - CARD32 component B32 + CARD32 component B32 typedef struct { __GLX_COMPONENT_HDR; @@ -854,6 +1393,81 @@ typedef struct { #define __GLX_COMPONENT_HDR_SIZE 12 +/* +** Data that is specific to a glColorTable call +** The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ColorTable header +*/ + +#define __GLX_COLOR_TABLE_HDR \ + CARD32 target B32; \ + CARD32 internalformat B32; \ + CARD32 width B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_COLOR_TABLE_HDR_SIZE 20 + +#define __GLX_COLOR_TABLE_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_COLOR_TABLE_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXColorTableHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXColorTableLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_COLOR_TABLE_HDR; +} __GLXdispatchColorTableHeader; + +/* +** Data that is specific to a glColorSubTable call +** The data is sent in the following order: +** Render or RenderLarge header +** Pixel header +** ColorTable header +*/ + +#define __GLX_COLOR_SUBTABLE_HDR \ + CARD32 target B32; \ + CARD32 start B32; \ + CARD32 count B32; \ + CARD32 format B32; \ + CARD32 type B32 + +#define __GLX_COLOR_SUBTABLE_HDR_SIZE 20 + +#define __GLX_COLOR_SUBTABLE_CMD_HDR_SIZE \ + (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + \ + __GLX_COLOR_SUBTABLE_HDR_SIZE) + +typedef struct { + __GLX_RENDER_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXColorSubTableHeader; + +typedef struct { + __GLX_RENDER_LARGE_HDR; + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXColorSubTableLargeHeader; + +typedef struct { + __GLX_PIXEL_HDR; + __GLX_COLOR_SUBTABLE_HDR; +} __GLXdispatchColorSubTableHeader; + /*****************************************************************************/ @@ -863,6 +1477,11 @@ typedef struct { #undef GLXContextID #undef GLXPixmap #undef GLXDrawable +#undef GLXPbuffer +#undef GLXWindow +#undef GLXFBConfigID +#undef GLXFBConfigIDSGIX +#undef GLXPbufferSGIX /* Opcodes for GLX commands */ @@ -933,6 +1552,23 @@ typedef struct { #define X_GLsop_GetTexLevelParameteriv 139 #define X_GLsop_IsEnabled 140 #define X_GLsop_IsList 141 +#define X_GLsop_AreTexturesResident 143 +#define X_GLsop_DeleteTextures 144 +#define X_GLsop_GenTextures 145 +#define X_GLsop_IsTexture 146 +#define X_GLsop_GetColorTable 147 +#define X_GLsop_GetColorTableParameterfv 148 +#define X_GLsop_GetColorTableParameteriv 149 +#define X_GLsop_GetConvolutionFilter 150 +#define X_GLsop_GetConvolutionParameterfv 151 +#define X_GLsop_GetConvolutionParameteriv 152 +#define X_GLsop_GetSeparableFilter 153 +#define X_GLsop_GetHistogram 154 +#define X_GLsop_GetHistogramParameterfv 155 +#define X_GLsop_GetHistogramParameteriv 156 +#define X_GLsop_GetMinmax 157 +#define X_GLsop_GetMinmaxParameterfv 158 +#define X_GLsop_GetMinmaxParameteriv 159 /* Opcodes for rendering commands */ @@ -1127,8 +1763,8 @@ typedef struct { #define X_GLrop_Translated 189 #define X_GLrop_Translatef 190 #define X_GLrop_Viewport 191 -#define X_GLrop_DrawArrays 4116 -#define X_GLrop_PolygonOffset 4098 +#define X_GLrop_DrawArrays 193 +#define X_GLrop_PolygonOffset 192 #define X_GLrop_CopyTexImage1D 4119 #define X_GLrop_CopyTexImage2D 4120 #define X_GLrop_CopyTexSubImage1D 4121 @@ -1138,14 +1774,56 @@ typedef struct { #define X_GLrop_BindTexture 4117 #define X_GLrop_PrioritizeTextures 4118 #define X_GLrop_Indexubv 194 +#define X_GLrop_BlendColor 4096 +#define X_GLrop_BlendEquation 4097 +#define X_GLrop_ColorTable 2053 +#define X_GLrop_ColorTableParameterfv 2054 +#define X_GLrop_ColorTableParameteriv 2055 +#define X_GLrop_CopyColorTable 2056 +#define X_GLrop_ColorSubTable 195 +#define X_GLrop_CopyColorSubTable 196 +#define X_GLrop_ConvolutionFilter1D 4101 +#define X_GLrop_ConvolutionFilter2D 4102 +#define X_GLrop_ConvolutionParameterf 4103 +#define X_GLrop_ConvolutionParameterfv 4104 +#define X_GLrop_ConvolutionParameteri 4105 +#define X_GLrop_ConvolutionParameteriv 4106 +#define X_GLrop_CopyConvolutionFilter1D 4107 +#define X_GLrop_CopyConvolutionFilter2D 4108 +#define X_GLrop_SeparableFilter2D 4109 +#define X_GLrop_Histogram 4110 +#define X_GLrop_Minmax 4111 +#define X_GLrop_ResetHistogram 4112 +#define X_GLrop_ResetMinmax 4113 +#define X_GLrop_TexImage3D 4114 +#define X_GLrop_TexSubImage3D 4115 +#define X_GLrop_CopyTexSubImage3D 4123 +#define X_GLrop_ActiveTextureARB 197 +#define X_GLrop_MultiTexCoord1dvARB 198 +#define X_GLrop_MultiTexCoord1fvARB 199 +#define X_GLrop_MultiTexCoord1ivARB 200 +#define X_GLrop_MultiTexCoord1svARB 201 +#define X_GLrop_MultiTexCoord2dvARB 202 +#define X_GLrop_MultiTexCoord2fvARB 203 +#define X_GLrop_MultiTexCoord2ivARB 204 +#define X_GLrop_MultiTexCoord2svARB 205 +#define X_GLrop_MultiTexCoord3dvARB 206 +#define X_GLrop_MultiTexCoord3fvARB 207 +#define X_GLrop_MultiTexCoord3ivARB 208 +#define X_GLrop_MultiTexCoord3svARB 209 +#define X_GLrop_MultiTexCoord4dvARB 210 +#define X_GLrop_MultiTexCoord4fvARB 211 +#define X_GLrop_MultiTexCoord4ivARB 212 +#define X_GLrop_MultiTexCoord4svARB 213 +#define X_GLrop_DrawArraysEXT 4116 /* Opcodes for Vendor Private commands */ -#define X_GLvop_AreTexturesResident 11 -#define X_GLvop_DeleteTextures 12 -#define X_GLvop_GenTextures 13 -#define X_GLvop_IsTexture 14 +#define X_GLvop_AreTexturesResidentEXT 11 +#define X_GLvop_DeleteTexturesEXT 12 +#define X_GLvop_GenTexturesEXT 13 +#define X_GLvop_IsTextureEXT 14 /* Opcodes for GLX vendor private commands */ diff --git a/xc/include/GL/glxtokens.h b/xc/include/GL/glxtokens.h index 8c4f2185a..661a5db5c 100644 --- a/xc/include/GL/glxtokens.h +++ b/xc/include/GL/glxtokens.h @@ -1,11 +1,11 @@ #ifndef __GLX_glxtokens_h__ #define __GLX_glxtokens_h__ -/* $XFree86: xc/include/GL/glxtokens.h,v 1.4 2000/06/17 00:02:46 martin Exp $ */ +/* $XFree86: xc/include/GL/glxtokens.h,v 1.5 2001/03/21 15:51:38 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.0 (the "License"), the contents of this +** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 @@ -223,7 +223,6 @@ extern "C" { #define GLX_EXT_visual_rating 1 #define GLX_ARB_get_proc_address 1 - #ifdef __cplusplus } #endif diff --git a/xc/include/XF86keysym.h b/xc/include/XF86keysym.h index 4e86e81f7..d372b5f0c 100644 --- a/xc/include/XF86keysym.h +++ b/xc/include/XF86keysym.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/include/XF86keysym.h,v 1.6 2000/11/02 02:51:09 dawes Exp $ */ +/* $XFree86: xc/include/XF86keysym.h,v 1.11 2001/04/06 02:16:21 dawes Exp $ */ /* * XFree86 vendor specific keysyms. @@ -57,12 +57,12 @@ #define XF86XK_Forward 0x1008FF27 #define XF86XK_Stop 0x1008FF28 #define XF86XK_Refresh 0x1008FF29 -#define XF86XK_PowerOff 0x1008FF1A -#define XF86XK_WakeUp 0x1008FF1B - -/* Note, 0x1008FF2C - 0x1008FF2F are free and should be used next */ - -/* Some more ... */ +#define XF86XK_PowerOff 0x1008FF2A +#define XF86XK_WakeUp 0x1008FF2B +#define XF86XK_Eject 0x1008FF2C +#define XF86XK_ScreenSaver 0x1008FF2D +#define XF86XK_WWW 0x1008FF2E +#define XF86XK_Sleep 0x1008FF2F #define XF86XK_Favorites 0x1008FF30 #define XF86XK_AudioPause 0x1008FF31 #define XF86XK_AudioMedia 0x1008FF32 @@ -70,5 +70,27 @@ #define XF86XK_VendorHome 0x1008FF34 #define XF86XK_LightBulb 0x1008FF35 #define XF86XK_Shop 0x1008FF36 +#define XF86XK_History 0x1008FF37 +#define XF86XK_OpenURL 0x1008FF38 +#define XF86XK_AddFavorite 0x1008FF39 +#define XF86XK_HotLinks 0x1008FF3A +#define XF86XK_BrightnessAdjust 0x1008FF3B +/* Allocate 0x1008FF3C-F next */ +#define XF86XK_Launch0 0x1008FF40 +#define XF86XK_Launch1 0x1008FF41 +#define XF86XK_Launch2 0x1008FF42 +#define XF86XK_Launch3 0x1008FF43 +#define XF86XK_Launch4 0x1008FF44 +#define XF86XK_Launch5 0x1008FF45 +#define XF86XK_Launch6 0x1008FF46 +#define XF86XK_Launch7 0x1008FF47 +#define XF86XK_Launch8 0x1008FF48 +#define XF86XK_Launch9 0x1008FF49 +#define XF86XK_LaunchA 0x1008FF4A +#define XF86XK_LaunchB 0x1008FF4B +#define XF86XK_LaunchC 0x1008FF4C +#define XF86XK_LaunchD 0x1008FF4D +#define XF86XK_LaunchE 0x1008FF4E +#define XF86XK_LaunchF 0x1008FF4F diff --git a/xc/include/Xos_r.h b/xc/include/Xos_r.h index be068c100..41bee4d00 100644 --- a/xc/include/Xos_r.h +++ b/xc/include/Xos_r.h @@ -18,7 +18,7 @@ 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/include/Xos_r.h,v 1.8 2001/01/17 17:53:11 dawes Exp $ */ +/* $XFree86: xc/include/Xos_r.h,v 1.10 2001/03/03 09:53:00 herrb Exp $ */ /* * Various and sundry Thread-Safe functions used by X11, Motif, and CDE. @@ -146,7 +146,7 @@ extern void (*_XUnlockMutex_fn)( # endif # endif # elif defined(XOS_USE_XT_LOCKING) -extern void (*_XtProcessLock)(); +extern void (*_XtProcessLock)(void); # ifndef _XtintrinsicP_h # include <X11/Xfuncproto.h> /* for NeedFunctionPrototypes */ extern void XtProcessLock( @@ -243,9 +243,12 @@ typedef struct { size_t len; } _Xgetpwparams; -/* NetBSD, at least, is missing several of the unixware passwd fields. */ +/* + * NetBSD and FreeBSD, at least, are missing several of the unixware passwd + * fields. + */ -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) __inline__ void _Xpw_copyPasswd(_Xgetpwparams p) { memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)); @@ -412,7 +415,7 @@ typedef int _Xgetservbynameparams; /* dummy */ /* UnixWare 2.0, or other systems with thread support but no _r API. */ /* WARNING: The h_addr_list and s_aliases values are *not* copied! */ -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) #include <sys/param.h> #endif diff --git a/xc/include/Xosdefs.h b/xc/include/Xosdefs.h index 84733d19a..1dfcd8794 100644 --- a/xc/include/Xosdefs.h +++ b/xc/include/Xosdefs.h @@ -21,7 +21,7 @@ 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/include/Xosdefs.h,v 3.16 2001/01/17 17:53:11 dawes Exp $ */ +/* $XFree86: xc/include/Xosdefs.h,v 3.17 2001/03/07 15:54:11 dawes Exp $ */ #ifndef _XOSDEFS_H_ #define _XOSDEFS_H_ @@ -120,8 +120,12 @@ in this Software without prior written authorization from The Open Group. #endif #ifdef __GNU__ +#ifndef PATH_MAX #define PATH_MAX 4096 +#endif +#ifndef MAXPATHLEN #define MAXPATHLEN 4096 #endif +#endif #endif /* _XOSDEFS_H_ */ diff --git a/xc/include/extensions/Imakefile b/xc/include/extensions/Imakefile index 496bb4f38..5f698cb90 100644 --- a/xc/include/extensions/Imakefile +++ b/xc/include/extensions/Imakefile @@ -3,31 +3,32 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/18 04:05:44 coskrey Exp $ -XCOMM $XFree86: xc/include/extensions/Imakefile,v 3.37 2001/01/17 17:53:15 dawes Exp $ +XCOMM $XFree86: xc/include/extensions/Imakefile,v 3.39 2001/03/25 05:31:58 tsi Exp $ -#if BuildScreenSaverLibrary +#if BuildScreenSaverExt SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h #endif -#if BuildXF86MiscLibrary +#if BuildXF86MiscExt XF86MISCHEADERS = xf86misc.h xf86mscstr.h #endif #if BuildXF86BigfontExt XF86BIGFONTHEADERS = xf86bigfont.h xf86bigfstr.h #endif -#if BuildXF86VidModeLibrary +#if BuildXF86VidModeExt XF86VIDMODEHEADERS = xf86vmode.h xf86vmstr.h #endif -#if BuildXF86DGALibrary +#if BuildXF86DGA XF86DGAHEADERS = xf86dga.h xf86dgastr.h xf86dga1.h xf86dga1str.h #endif #if BuildLBX LBXHEADERS = lbxbuf.h lbxbufstr.h lbxdeltastr.h lbximage.h lbxopts.h lbxstr.h lbxzlib.h #endif -#if BuildXvLibrary +#if BuildXvExt XVHEADERS = Xv.h Xvlib.h Xvproto.h +XVMCHEADERS = XvMC.h XvMClib.h XvMCproto.h #endif -#if BuildXF86RushLibrary +#if BuildXF86RushExt XF86RUSHHEADERS = xf86rush.h xf86rushstr.h #endif #if BuildFontCache @@ -36,13 +37,13 @@ FONTCACHEHEADERS = fontcache.h fontcacheP.h fontcachstr.h #if BuildXinerama XINERAMAHEADERS = panoramiXext.h panoramiXproto.h Xinerama.h #endif -#if BuildRenderLibrary +#if BuildRender RENDERHEADERS = render.h renderproto.h #endif EXTRAHEADERS = $(SCREENSAVERHEADERS) $(XF86MISCHEADERS) $(XF86BIGFONTHEADERS) \ $(XF86VIDMODEHEADERS) $(XF86DGAHEADERS) $(XINERAMAHEADERS) \ - $(LBXHEADERS) $(XVHEADERS) $(XF86RUSHHEADERS) \ + $(LBXHEADERS) $(XVHEADERS) $(XVMCHEADERS) $(XF86RUSHHEADERS) \ $(FONTCACHEHEADERS) $(RENDERHEADERS) diff --git a/xc/include/extensions/XKBsrv.h b/xc/include/extensions/XKBsrv.h index eb8cfcc0e..d070c26d2 100644 --- a/xc/include/extensions/XKBsrv.h +++ b/xc/include/extensions/XKBsrv.h @@ -24,7 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/include/extensions/XKBsrv.h,v 3.18 2001/01/17 17:53:18 dawes Exp $ */ +/* $XFree86: xc/include/extensions/XKBsrv.h,v 3.19 2001/03/25 05:31:59 tsi Exp $ */ #ifndef _XKBSRV_H_ #define _XKBSRV_H_ @@ -291,6 +291,7 @@ extern int DeviceButtonPress,DeviceButtonRelease; (c)->curKeySyms.minKeyCode+1) #define XConvertCase(s,l,u) XkbConvertCase(s,l,u) +#undef IsKeypadKey #define IsKeypadKey(s) XkbKSIsKeypad(s) #define Status int diff --git a/xc/include/extensions/Xext.h b/xc/include/extensions/Xext.h index e7dc8faf1..48c543328 100644 --- a/xc/include/extensions/Xext.h +++ b/xc/include/extensions/Xext.h @@ -19,6 +19,7 @@ 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/include/extensions/Xext.h,v 1.3 2001/04/01 13:59:59 tsi Exp $ */ #ifndef _XEXT_H_ #define _XEXT_H_ @@ -37,7 +38,13 @@ extern int (*XSetExtensionErrorHandler( #endif ) #endif -))(); +))( +#if NeedNestedPrototypes + Display *, + char *, + char * +#endif +); extern int XMissingExtension( #if NeedFunctionPrototypes diff --git a/xc/include/extensions/XvMC.h b/xc/include/extensions/XvMC.h new file mode 100644 index 000000000..2503ef11c --- /dev/null +++ b/xc/include/extensions/XvMC.h @@ -0,0 +1,117 @@ +/* $XFree86: xc/include/extensions/XvMC.h,v 1.3 2001/04/01 13:59:59 tsi Exp $ */ + +#ifndef _XVMC_H_ +#define _XVMC_H_ + +#include <X11/X.h> +#include <X11/extensions/Xv.h> + +#define XvMCName "XVideo-MotionCompensation" +#define XvMCNumEvents 0 +#define XvMCNumErrors 3 +#define XvMCVersion 0 +#define XvMCRevision 1 + +#define XvMCBadContext 0 +#define XvMCBadSurface 1 +#define XvMCBadSubpicture 2 + +/* Chroma formats */ +#define XVMC_CHROMA_FORMAT_420 0x00000001 +#define XVMC_CHROMA_FORMAT_422 0x00000002 +#define XVMC_CHROMA_FORMAT_444 0x00000003 + +/* XvMCSurfaceInfo Flags */ +#define XVMC_OVERLAID_SURFACE 0x00000001 +#define XVMC_BACKEND_SUBPICTURE 0x00000002 +#define XVMC_SUBPICTURE_INDEPENDENT_SCALING 0x00000004 + +/* Motion Compensation types */ +#define XVMC_IDCT 0x00010000 + +#define XVMC_MPEG_1 0x00000001 +#define XVMC_MPEG_2 0x00000002 +#define XVMC_H263 0x00000003 +#define XVMC_MPEG_4 0x00000004 + +#define XVMC_MB_TYPE_QUANT 0x01 +#define XVMC_MB_TYPE_MOTION_FORWARD 0x02 +#define XVMC_MB_TYPE_MOTION_BACKWARD 0x04 +#define XVMC_MB_TYPE_PATTERN 0x08 +#define XVMC_MB_TYPE_INTRA 0x10 + +#define XVMC_PREDICTION_FIELD 0x01 +#define XVMC_PREDICTION_FRAME 0x02 +#define XVMC_PREDICTION_DUAL_PRIME 0x03 +#define XVMC_PREDICTION_16x8 0x02 +#define XVMC_PREDICTION_4MV 0x04 + +#define XVMC_SELECT_FIRST_FORWARD 0x01 +#define XVMC_SELECT_FIRST_BACKWARD 0x02 +#define XVMC_SELECT_SECOND_FORWARD 0x04 +#define XVMC_SELECT_SECOND_BACKWARD 0x08 + +#define XVMC_DCT_TYPE_FRAME 0x00 +#define XVMC_DCT_TYPE_FIELD 0x01 + +#define XVMC_TOP_FIELD 0x00000001 +#define XVMC_BOTTOM_FIELD 0x00000002 +#define XVMC_FRAME_PICTURE (XVMC_TOP_FIELD | XVMC_BOTTOM_FIELD) +#define XVMC_TOP_FIELD_FIRST 0x00000001 +#define XVMC_PROGRESSIVE_FRAME 0x00000002 + +#define XVMC_DIRECT 0x00000001 + +#define XVMC_SCAN_ORDER_ZIG_ZAG 0x00000000 +#define XVMC_SCAN_ORDER_ALTERNATIVE_HORIZONTAL 0x00000001 +#define XVMC_SCAN_ORDER_ALTERNATIVE_VERTICAL 0x00000002 +#define XVMC_SCAN_ORDER_RASTER 0x00000003 + +#define XVMC_RENDERING 0x00000001 +#define XVMC_DISPLAYING 0x00000002 + + +typedef struct { + int surface_type_id; + int chroma_format; + int color_description; + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; +} XvMCSurfaceInfo; + +typedef struct { + XID context_id; + int surface_type_id; + unsigned short width; + unsigned short height; + XvPortID port; + int flags; + void * privData; /* private to the library */ +} XvMCContext; + +typedef struct { + XID surface_id; + XID context_id; + int surface_type_id; + unsigned short width; + unsigned short height; + void *privData; /* private to the library */ +} XvMCSurface; + +typedef struct { + XID subpicture_id; + XID context_id; + int xvimage_id; + unsigned short width; + unsigned short height; + int num_palette_entries; + int entry_bytes; + char component_order[4]; + void *privData; /* private to the library */ +} XvMCSubpicture; + +#endif diff --git a/xc/include/extensions/XvMClib.h b/xc/include/extensions/XvMClib.h new file mode 100644 index 000000000..4ac8ff43e --- /dev/null +++ b/xc/include/extensions/XvMClib.h @@ -0,0 +1,145 @@ +/* $XFree86: xc/include/extensions/XvMClib.h,v 1.3 2001/04/01 13:59:59 tsi Exp $ */ + +#ifndef _XVMCLIB_H_ +#define _XVMCLIB_H_ + +#include <X11/extensions/Xvlib.h> +#include <X11/extensions/XvMC.h> + +Bool XvMCQueryExtension (Display *display, int *eventBase, int *errBase); +Status XvMCQueryVersion (Display *display, int *major, int *minor); + +XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num); + +Status XvMCCreateContext ( + Display *display, + XvPortID port, + int surface_type_id, + int width, + int height, + int flags, + XvMCContext * context +); + +Status XvMCDestroyContext (Display *display, XvMCContext * context); + +Status +XvMCCreateSurface( + Display *display, + XvMCContext * context, + XvMCSurface * surface +); + +Status XvMCDestroySurface(Display *display, XvMCSurface *surface); + +XvImageFormatValues * XvMCListSubpictureTypes ( + Display * display, + XvPortID port, + int surface_type_id, + int *count_return +); + +Status +XvMCPutSurface( + Display *display, + XvMCSurface *surface, + Drawable draw, + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + int flags +); + +Status XvMCHideSurface(Display *display, XvMCSurface *surface); + +Status +XvMCCreateSubpicture ( + Display *display, + XvMCContext *context, + XvMCSubpicture *subpicture, + unsigned short width, + unsigned short height, + int xvimage_id +); + + +Status +XvMCClearSubpicture ( + Display *display, + XvMCSubpicture *subpicture, + short x, + short y, + unsigned short width, + unsigned short height, + unsigned int color +); + +Status +XvMCCompositeSubpicture ( + Display *display, + XvMCSubpicture *subpicture, + XvImage *image, + short srcx, + short srcy, + unsigned short width, + unsigned short height, + short dstx, + short dsty +); + +Status +XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture); + +Status +XvMCSetSubpicturePalette ( + Display *display, + XvMCSubpicture *subpicture, + unsigned char *palette +); + +Status +XvMCBlendSubpicture ( + Display *display, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh +); + +Status +XvMCBlendSubpicture2 ( + Display *display, + XvMCSurface *source_surface, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh +); + +Status XvMCSyncSurface (Display *display, XvMCSurface *surface); +Status XvMCFlushSurface (Display *display, XvMCSurface *surface); +Status XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat); + +Status XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture); +Status XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture); +Status +XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat); + +#endif diff --git a/xc/include/extensions/XvMCproto.h b/xc/include/extensions/XvMCproto.h new file mode 100644 index 000000000..34405f056 --- /dev/null +++ b/xc/include/extensions/XvMCproto.h @@ -0,0 +1,204 @@ +/* $XFree86: xc/include/extensions/XvMCproto.h,v 1.3 2001/04/01 13:59:59 tsi Exp $ */ + +#ifndef _XVMCPROTO_H_ +#define _XVMCPROTO_H_ + +#define xvmc_QueryVersion 0 +#define xvmc_ListSurfaceTypes 1 +#define xvmc_CreateContext 2 +#define xvmc_DestroyContext 3 +#define xvmc_CreateSurface 4 +#define xvmc_DestroySurface 5 +#define xvmc_CreateSubpicture 6 +#define xvmc_DestroySubpicture 7 +#define xvmc_ListSubpictureTypes 8 +#define xvmc_LastRequest xvmc_ListSubpictureTypes + +#define xvmcNumRequest (xvmc_LastRequest + 1) + + +typedef struct { + CARD32 surface_type_id B32; + CARD16 chroma_format B16; + CARD16 color_description B16; + CARD16 max_width B16; + CARD16 max_height B16; + CARD16 subpicture_max_width B16; + CARD16 subpicture_max_height B16; + CARD32 mc_type B32; + CARD32 flags B32; +} xvmcSurfaceInfo; +#define sz_xvmcSurfaceInfo 24; + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; +} xvmcQueryVersionReq; +#define sz_xvmcQueryVersionReq 4; + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 major B32; + CARD32 minor B32; + CARD32 padl4 B32; + CARD32 padl5 B32; + CARD32 padl6 B32; + CARD32 padl7 B32; +} xvmcQueryVersionReply; +#define sz_xvmcQueryVersionReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; + CARD32 port B32; +} xvmcListSurfaceTypesReq; +#define sz_xvmcListSurfaceTypesReq 8; + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 num B32; + CARD32 padl3 B32; + CARD32 padl4 B32; + CARD32 padl5 B32; + CARD32 padl6 B32; + CARD32 padl7 B32; +} xvmcListSurfaceTypesReply; +#define sz_xvmcListSurfaceTypesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; + CARD32 context_id B32; + CARD32 port B32; + CARD32 surface_type_id B32; + CARD16 width B16; + CARD16 height B16; + CARD32 flags B32; +} xvmcCreateContextReq; +#define sz_xvmcCreateContextReq 24; + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 width_actual B16; + CARD16 height_actual B16; + CARD32 flags_return B32; + CARD32 padl4 B32; + CARD32 padl5 B32; + CARD32 padl6 B32; + CARD32 padl7 B32; +} xvmcCreateContextReply; +#define sz_xvmcCreateContextReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; + CARD32 context_id B32; +} xvmcDestroyContextReq; +#define sz_xvmcDestroyContextReq 8; + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; + CARD32 surface_id B32; + CARD32 context_id B32; +} xvmcCreateSurfaceReq; +#define sz_xvmcCreateSurfaceReq 12; + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 padl2 B32; + CARD32 padl3 B32; + CARD32 padl4 B32; + CARD32 padl5 B32; + CARD32 padl6 B32; + CARD32 padl7 B32; +} xvmcCreateSurfaceReply; +#define sz_xvmcCreateSurfaceReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; + CARD32 surface_id B32; +} xvmcDestroySurfaceReq; +#define sz_xvmcDestroySurfaceReq 8; + + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; + CARD32 subpicture_id B32; + CARD32 context_id B32; + CARD32 xvimage_id B32; + CARD16 width B16; + CARD16 height B16; +} xvmcCreateSubpictureReq; +#define sz_xvmcCreateSubpictureReq 20; + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 width_actual B16; + CARD16 height_actual B16; + CARD16 num_palette_entries B16; + CARD16 entry_bytes B16; + CARD8 component_order[4]; + CARD32 padl5 B32; + CARD32 padl6 B32; + CARD32 padl7 B32; +} xvmcCreateSubpictureReply; +#define sz_xvmcCreateSubpictureReply 32 + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; + CARD32 subpicture_id B32; +} xvmcDestroySubpictureReq; +#define sz_xvmcDestroySubpictureReq 8; + +typedef struct { + CARD8 reqType; + CARD8 xvmcReqType; + CARD16 length B16; + CARD32 port B32; + CARD32 surface_type_id B32; +} xvmcListSubpictureTypesReq; +#define sz_xvmcListSubpictureTypesReq 12; + +typedef struct { + BYTE type; /* X_Reply */ + BYTE padb1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 num B32; + CARD32 padl2 B32; + CARD32 padl3 B32; + CARD32 padl4 B32; + CARD32 padl5 B32; + CARD32 padl6 B32; + CARD32 padl7 B32; +} xvmcListSubpictureTypesReply; +#define sz_xvmcListSubpictureTypesReply 32 + +#endif diff --git a/xc/include/fonts/fontproto.h b/xc/include/fonts/fontproto.h index 12f1e4503..e30cae18d 100644 --- a/xc/include/fonts/fontproto.h +++ b/xc/include/fonts/fontproto.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/include/fonts/fontproto.h,v 1.2 1999/09/04 09:14:08 dawes Exp $ */ +/* $XFree86: xc/include/fonts/fontproto.h,v 1.3 2001/04/05 17:42:26 dawes Exp $ */ /*********************************************************** @@ -25,7 +25,8 @@ authorization from The XFree86 Project Inc.. #ifndef _FONTPROTO_H #define _FONTPROTO_H -/* Functions defined by the server and used in lib/fonts */ +/* Externally provided functions required by libXfont */ + extern int RegisterFPEFunctions ( NameCheckFunc name_func, InitFpeFunc init_func, FreeFpeFunc free_func, @@ -60,9 +61,15 @@ extern Bool ClientSignal ( ClientPtr client ); extern void DeleteFontClientID ( Font id ); extern Font GetNewFontClientID ( void ); extern int StoreFontClientFont ( FontPtr pfont, Font id ); +extern void FontFileRegisterFpeFunctions ( void ); +extern void FontFileCheckRegisterFpeFunctions ( void ); extern Bool XpClientIsBitmapClient ( ClientPtr client ); extern Bool XpClientIsPrintClient( ClientPtr client, FontPathElementPtr fpe ); +extern void PrinterFontRegisterFpeFunctions ( void ); + +extern void fs_register_fpe_functions ( void ); +extern void check_fs_register_fpe_functions ( void ); /* util/private.c */ extern FontPtr CreateFontRec (void); diff --git a/xc/lib/FS/FSlib.h b/xc/lib/FS/FSlib.h index 5bd5c2c29..1d95263d0 100644 --- a/xc/lib/FS/FSlib.h +++ b/xc/lib/FS/FSlib.h @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSlib.h,v 1.4 2001/01/17 19:41:28 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSlib.h,v 1.5 2001/04/05 17:42:26 dawes Exp $ */ /* @@ -297,7 +297,6 @@ extern int FSQueryXInfo ( FSServer *svr, Font fid, FSXFontInfoHeader *info, FSPropInfo *props, FSPropOffset **offsets, unsigned char **prop_data ); extern int FSSetCatalogues ( FSServer *svr, int num, char **cats ); -extern int FSSync ( FSServer *svr, int discard ); extern int FSFree ( char *data ); extern unsigned char * FSMalloc ( unsigned size ); diff --git a/xc/lib/FS/FSlibInt.c b/xc/lib/FS/FSlibInt.c index 7ccdf8b0c..6712bdaa7 100644 --- a/xc/lib/FS/FSlibInt.c +++ b/xc/lib/FS/FSlibInt.c @@ -46,7 +46,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/FS/FSlibInt.c,v 3.8 2001/01/17 19:41:28 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSlibInt.c,v 3.9 2001/04/05 17:42:26 dawes Exp $ */ /* * FSlibInt.c - Internal support routines for the C subroutine @@ -946,6 +946,7 @@ _SysErrorMsg(n) * _FSDefaultIOError - Default fatal system error reporting routine. Called * when an X internal system error is encountered. */ +int _FSDefaultIOError(svr) FSServer *svr; { @@ -968,7 +969,7 @@ _FSDefaultIOError(svr) " The connection was probably broken by a server shutdown.\r\n"); } exit(1); - return 0; + /* NOTREACHED */ } /* diff --git a/xc/lib/GL/GL/GL-def.cpp b/xc/lib/GL/GL/GL-def.cpp new file mode 100644 index 000000000..92435a297 --- /dev/null +++ b/xc/lib/GL/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/GL-def.cpp,v 1.1 2001/03/22 21:47:56 dawes Exp $ */ diff --git a/xc/lib/GL/GL/GLos2.def b/xc/lib/GL/GL/GLos2.def new file mode 100644 index 000000000..95a4240ea --- /dev/null +++ b/xc/lib/GL/GL/GLos2.def @@ -0,0 +1,428 @@ +LIBRARY GL +DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/GL/GL/GLos2.def,v 1.1 2001/03/22 21:47:56 dawes Exp $" +CODE + PRELOAD +DATA + MULTIPLE NONSHARED +STACKSIZE 131072 +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 diff --git a/xc/lib/GL/GL/GLos2.rsp b/xc/lib/GL/GL/GLos2.rsp new file mode 100644 index 000000000..10b1b5486 --- /dev/null +++ b/xc/lib/GL/GL/GLos2.rsp @@ -0,0 +1,6 @@ +glx\clientattrib.obj glx\compsize.obj glx\eval.obj glx\g_render.obj+ +glx\g_single.obj glx\g_vendpriv.obj glx\glxcmds.obj glx\glxext.obj+ +glx\pixel.obj glx\pixelstore.obj glx\render2.obj glx\renderpix.obj+ +glx\single2.obj glx\singlepix.obj glx\vertarr.obj /NOI /NOL /NOD /BAT +GL.dll +GL.map diff --git a/xc/lib/GL/GL/Imakefile b/xc/lib/GL/GL/Imakefile new file mode 100644 index 000000000..81e211550 --- /dev/null +++ b/xc/lib/GL/GL/Imakefile @@ -0,0 +1,243 @@ +XCOMM $XFree86: xc/lib/GL/GL/Imakefile,v 1.7 2001/04/03 02:29:31 dawes Exp $ + +#include <Threads.tmpl> + +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx +#define DoExtraLib SharedLibGlx +#define DoDebugLib DebugLibGlx +#define DoProfileLib ProfileLibGlx + + LIBNAME = GL + SOREV = $(SOGLREV) + +#ifdef SharedGLReqs +BASEREQUIREDLIBS = SharedGLReqs +#endif + +#define MesaBuildDir $(GLXLIBSRC)/mesa/src/ +#include "../mesa/src/Imakefile.inc" +#define MesaX86BuildDir $(GLXLIBSRC)/mesa/src/X86/ +#ifdef i386Architecture +#include "../mesa/src/X86/Imakefile.inc" +#endif + +XCOMM +XCOMM Not related to ProfileLibGlx - I dont know how that works. KW. +XCOMM +#ifdef GlxSoProf + PROFSRC = lowpc.c highpc.c + PROFOBJ = lowpc.o highpc.o + +SubdirLibraryRule($(PROFOBJ)) +NormalLintTarget($(PROFSRC)) +#endif + +#if BuildXF86DRI && defined(i386Architecture) + GLAPI_OBJ = $(GLXLIBSRC)/glx/glapi_x86.o +#endif + + GLXOBJS = $(GLXLIBSRC)/glx/?*.o + GLXUOBJS = $(GLXLIBSRC)/glx/unshared/?*.o $(GLAPI_OBJ) + GLXDOBJS = $(GLXLIBSRC)/glx/debugger/?*.o $(GLAPI_OBJ) + GLXPOBJS = $(GLXLIBSRC)/glx/profiled/?*.o $(GLAPI_OBJ) + +#if BuildXF86DRI + DRIOBJS = $(GLXLIBSRC)/dri/XF86dri.o $(GLXLIBSRC)/dri/dri_glx.o + DRIUOBJS = $(GLXLIBSRC)/dri/unshared/XF86dri.o $(GLXLIBSRC)/dri/unshared/dri_glx.o + DRIDOBJS = $(GLXLIBSRC)/dri/debugger/XF86dri.o $(GLXLIBSRC)/dri/debugger/dri_glx.o + DRIPOBJS = $(GLXLIBSRC)/dri/profiled/XF86dri.o $(GLXLIBSRC)/dri/profiled/dri_glx.o + + DRMOBJS = $(GLXLIBSRC)/dri/drm/?*.o + DRMUOBJS = $(GLXLIBSRC)/dri/drm/unshared/?*.o + DRMDOBJS = $(GLXLIBSRC)/dri/drm/debugger/?*.o + DRMPOBJS = $(GLXLIBSRC)/dri/drm/profiled/?*.o + + MESAOBJS = $(COREMESAOBJS) $(MESA_ASM_OBJS) + MESAUOBJS = $(COREMESAUOBJS) $(MESA_ASM_UOBJS) + MESADOBJS = $(COREMESADOBJS) $(MESA_ASM_DOBJS) + MESAPOBJS = $(COREMESAPOBJS) $(MESA_ASM_POBJS) + + DRIMESAOBJS = $(GLXLIBSRC)/mesa/dri/?*.o +DRIMESAUOBJS = $(GLXLIBSRC)/mesa/dri/unshared/?*.o +DRIMESADOBJS = $(GLXLIBSRC)/mesa/dri/debugger/?*.o +DRIMESAPOBJS = $(GLXLIBSRC)/mesa/dri/profiled/?*.o + +#if GlxUseBuiltInDRIDriver +#include "../mesa/src/drv/common/Imakefile.inc" +#endif + + +#if GlxUseSGISI + +XCOMM nothing + +#elif GlxBuiltInGamma + +#define MesaDrvGammaBuildDir $(GLXLIBSRC)/mesa/src/drv/gamma/ +#include "../mesa/src/drv/gamma/Imakefile.inc" + + DRVOBJS = $(GAMMAOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVUOBJS = $(GAMMAUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) + DRVDOBJS = $(GAMMADOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) + DRVPOBJS = $(GAMMAPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) + +#elif GlxBuiltInTdfx + +#define MesaDrvTdfxBuildDir $(GLXLIBSRC)/mesa/src/drv/tdfx/ +#include "../mesa/src/drv/tdfx/Imakefile.inc" + + DRVOBJS = $(TDFXOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVUOBJS = $(TDFXUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) + DRVDOBJS = $(TDFXDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) + DRVPOBJS = $(TDFXPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) + +OTHERREQUIREDLIBS = -lglide3 -ldl + +#elif GlxBuiltInI810 + +#define MesaDrvI810BuildDir $(GLXLIBSRC)/mesa/src/drv/i810/ +#include "../mesa/src/drv/i810/Imakefile.inc" + + DRVOBJS = $(I810OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) \ + $(DRMOBJS) + DRVUOBJS = $(I810UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) \ + $(DRMUOBJS) + DRVDOBJS = $(I810DOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) \ + $(DRMDOBJS) + DRVPOBJS = $(I810POBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) \ + $(DRMPOBJS) + +#elif GlxBuiltInMga + +#define MesaDrvMgaBuildDir $(GLXLIBSRC)/mesa/src/drv/mga/ +#include "../mesa/src/drv/mga/Imakefile.inc" + + DRVOBJS = $(MGAOBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) \ + $(DRMOBJS) + DRVUOBJS = $(MGAUOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) \ + $(DRMUOBJS) + DRVDOBJS = $(MGADOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) \ + $(DRMDOBJS) + DRVPOBJS = $(MGAPOBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) \ + $(DRMPOBJS) + +#elif GlxBuiltInR128 + +#define MesaDrvR128BuildDir $(GLXLIBSRC)/mesa/src/drv/r128/ +#include "../mesa/src/drv/r128/Imakefile.inc" + + DRVOBJS = $(R128OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) \ + $(DRMOBJS) + DRVUOBJS = $(R128UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) \ + $(DRMUOBJS) + DRVDOBJS = $(R128DOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) \ + $(DRMDOBJS) + DRVPOBJS = $(R128POBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) \ + $(DRMPOBJS) + +#elif GlxBuiltInRadeon + +#define MesaDrvRadeonBuildDir $(GLXLIBSRC)/mesa/src/drv/radeon/ +#include "../mesa/src/drv/radeon/Imakefile.inc" + + DRVOBJS = $(RADEONOBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) \ + $(DRMOBJS) + DRVUOBJS = $(RADEONUOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) \ + $(DRMUOBJS) + DRVDOBJS = $(RADEONDOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) \ + $(DRMDOBJS) + DRVPOBJS = $(RADEONPOBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) \ + $(DRMPOBJS) + +#elif GlxBuiltInFfb + +#define MesaDrvFfbBuildDir $(GLXLIBSRC)/mesa/src/drv/ffb/ +#include "../mesa/src/drv/ffb/Imakefile.inc" + + DRVOBJS = $(FFBOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVUOBJS = $(FFBUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) + DRVDOBJS = $(FFBDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) + DRVPOBJS = $(FFBPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) + +#elif GlxBuiltInSIS + +#define MesaDrvSisBuildDir $(GLXLIBSRC)/mesa/src/drv/sis/ +#include "../mesa/src/drv/sis/Imakefile.inc" + + DRVOBJS = $(SISOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) + DRVUOBJS = $(SISUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) + DRVDOBJS = $(SISDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) + DRVPOBJS = $(SISPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) + +#elif GlxBuiltInMesa + +#ifndef GlxDriverUsesMesa + + DRVOBJS = $(MESAOBJS) + DRVUOBJS = $(MESAUOBJS) + DRVDOBJS = $(MESADOBJS) + DRVPOBJS = $(MESAPOBJS) + +#endif + +#else + +XCOMM No built-in drivers. This is the usual case. + +#endif + +#endif /* BuildXF86DRI */ + +/* + * Note: DRIDIRS is empty for !BuildXF86DRI, and DRVSUBDIRS is empty + * for no built-in drivers. + */ + +REQUIREDLIBS = $(BASEREQUIREDLIBS) $(OTHERREQUIREDLIBS) + + OBJS = $(GLXOBJS) $(DRIOBJS) $(DRVOBJS) +#if HasSharedLibraries && !SharedLibGlxWithoutPIC + UOBJS = $(GLXUOBJS) $(DRIUOBJS) $(DRVUOBJS) +#else + UOBJS = $(OBJS) +#endif + DOBJS = $(GLXDOBJS) $(DRIDOBJS) $(DRVDOBJS) + POBJS = $(GLXPOBJS) $(DRIPOBJS) $(DRVPOBJS) + +#if LocalThreads + THREADOBJS = $(THREADS_LIBS) +#endif + +#include <Library.tmpl> + +#undef _LinkBuildLibrary +#define _LinkBuildLibrary(lib) LinkBuildLibrary(lib) + + +#if NormalLibGlx +NormalLibraryTarget($(LIBNAME),$(UOBJS)) +InstallLibrary($(LIBNAME),$(USRLIBDIR)) +#endif +#if SharedLibGlx +SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(OBJS),$(OBJS) $(THREADOBJS),.,.) +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 || true + $(RM) $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so.1 + $(LN) $(SHLIBDIR)/lib$(LIBNAME).so.1 $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so.1 || true +#endif +#endif +#if DebugLibGlx +DebuggedLibraryTarget($(LIBNAME),$(DOBJS)) +InstallLibrary($(LIBNAME)_d,$(USRLIBDIR)) +#endif +#if ProfileLibGlx +ProfiledLibraryTarget($(LIBNAME),$(POBJS)) +InstallLibrary($(LIBNAME)_p,$(USRLIBDIR)) +#endif + + diff --git a/xc/lib/GL/Imakefile b/xc/lib/GL/Imakefile index 1dbb7b114..8266db923 100644 --- a/xc/lib/GL/Imakefile +++ b/xc/lib/GL/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.35 2001/01/08 01:07:16 martin Exp $ +XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.37 2001/03/23 20:56:28 dawes Exp $ #include <Threads.tmpl> @@ -6,378 +6,28 @@ XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.35 2001/01/08 01:07:16 martin Exp $ #define PassCDebugFlags -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx +LIBGLBUILDDIR = GL + GLXDIRS = glx - LIBNAME = GL - SOREV = $(SOGLREV) - -#ifdef SharedGLReqs -REQUIREDLIBS = SharedGLReqs -#endif - -XCOMM -XCOMM Not related to ProfileLibGlx - I dont know how that works. KW. -XCOMM -#ifdef GlxSoProf - PROFSRC = lowpc.c highpc.c - PROFOBJ = lowpc.o highpc.o - -SubdirLibraryRule($(PROFOBJ)) -NormalLintTarget($(PROFSRC)) +#if BuildXF86DRI && !GlxUseSGISI && \ + (!GlxBuiltInMesa || !defined(GlxDriverUsesMesa)) + MESADIRS = mesa/src + OSMESADIRS = mesa/src/OSmesa #endif -#if BuildXF86DRI && defined(i386Architecture) - GLAPI_OBJ = glx/glapi_x86.o -#endif - - GLXOBJS = glx/?*.o - GLXUOBJS = glx/unshared/?*.o $(GLAPI_OBJ) - GLXDOBJS = glx/debugger/?*.o $(GLAPI_OBJ) - GLXPOBJS = glx/profiled/?*.o $(GLAPI_OBJ) - GLXDONES = glx/DONE - #if BuildXF86DRI - DRIOBJS = dri/XF86dri.o dri/dri_glx.o - DRIUOBJS = dri/unshared/XF86dri.o dri/unshared/dri_glx.o - DRIDOBJS = dri/debugger/XF86dri.o dri/debugger/dri_glx.o - DRIPOBJS = dri/profiled/XF86dri.o dri/profiled/dri_glx.o - DRIDONES = dri/DONE - - DRMOBJS = dri/drm/?*.o - DRMUOBJS = dri/drm/unshared/?*.o - DRMDOBJS = dri/drm/debugger/?*.o - DRMPOBJS = dri/drm/profiled/?*.o - DRMDONES = dri/drm/DONE - - MESAOBJS = mesa/src/?*.o -#ifdef i386Architecture -ASM_BASE_OBJS = mesa/src/X86/common_x86_asm.o \ - mesa/src/X86/x86_cliptest.o \ - mesa/src/X86/x86_vertex.o \ - mesa/src/X86/x86_xform_masked2.o \ - mesa/src/X86/x86_xform_masked3.o \ - mesa/src/X86/x86_xform_masked4.o \ - mesa/src/X86/x86_xform_raw2.o \ - mesa/src/X86/x86_xform_raw3.o \ - mesa/src/X86/x86_xform_raw4.o - -#if MesaUseMMX - MMX_OBJS = mesa/src/X86/mmx_blend.o -#endif - -#if MesaUse3DNow - 3DNOW_OBJS = mesa/src/X86/3dnow_norm_raw.o \ - mesa/src/X86/3dnow_vertex.o \ - mesa/src/X86/3dnow_xform_masked1.o \ - mesa/src/X86/3dnow_xform_masked2.o \ - mesa/src/X86/3dnow_xform_masked3.o \ - mesa/src/X86/3dnow_xform_masked4.o \ - mesa/src/X86/3dnow_xform_raw1.o \ - mesa/src/X86/3dnow_xform_raw2.o \ - mesa/src/X86/3dnow_xform_raw3.o \ - mesa/src/X86/3dnow_xform_raw4.o -#endif -#if MesaUseKatmai - KATMAI_OBJS = mesa/src/X86/katmai_norm_raw.o \ - mesa/src/X86/katmai_vertex.o \ - mesa/src/X86/katmai_xform_masked1.o \ - mesa/src/X86/katmai_xform_masked2.o \ - mesa/src/X86/katmai_xform_masked3.o \ - mesa/src/X86/katmai_xform_masked4.o \ - mesa/src/X86/katmai_xform_raw1.o \ - mesa/src/X86/katmai_xform_raw2.o \ - mesa/src/X86/katmai_xform_raw3.o \ - mesa/src/X86/katmai_xform_raw4.o + DRIDIRS = dri mesa/dri + MESADIRS = mesa/src + DRIVERDIRS = mesa/src/drv #endif - ASM_OBJS = $(ASM_BASE_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) - - MESAOBJS = mesa/src/?*.o mesa/src/X86/?*.o -#endif - - MESAUOBJS = mesa/src/unshared/?*.o mesa/src/X86/unshared/?*.o $(ASM_OBJS) - MESADOBJS = mesa/src/debugger/?*.o mesa/src/X86/debugger/?*.o $(ASM_OBJS) - MESAPOBJS = mesa/src/profiled/?*.o mesa/src/X86/profiled/?*.o $(ASM_OBJS) - MESADONES = mesa/src/DONE mesa/src/X86/DONE - - DRIMESAOBJS = mesa/dri/?*.o -DRIMESAUOBJS = mesa/dri/unshared/?*.o -DRIMESADOBJS = mesa/dri/debugger/?*.o -DRIMESAPOBJS = mesa/dri/profiled/?*.o -DRIMESADONES = mesa/dri/DONE - - COMMONOBJS = mesa/src/drv/common/?*.o - COMMONUOBJS = mesa/src/drv/common/unshared/?*.o - COMMONDOBJS = mesa/src/drv/common/debugger/?*.o - COMMONPOBJS = mesa/src/drv/common/profiled/?*.o - COMMONDONES = mesa/src/drv/common/DONE - - -#if GlxUseSGISI - -XCOMM nothing - -#elif GlxBuiltInGamma - - GAMMAOBJS = mesa/src/drv/gamma/?*.o - GAMMAUOBJS = mesa/src/drv/gamma/unshared/?*.o - GAMMADOBJS = mesa/src/drv/gamma/debugger/?*.o - GAMMAPOBJS = mesa/src/drv/gamma/profiled/?*.o - GAMMADONES = mesa/src/drv/gamma/DONE - - DRVOBJS = $(GAMMAOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(GAMMAUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(GAMMADOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(GAMMAPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(GAMMADONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - - DRVSUBDIRS = mesa/src/drv/gamma - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) - -#elif GlxBuiltInTdfx - - TDFXOBJS = mesa/src/drv/tdfx/?*.o - TDFXUOBJS = mesa/src/drv/tdfx/unshared/?*.o - TDFXDOBJS = mesa/src/drv/tdfx/debugger/?*.o - TDFXPOBJS = mesa/src/drv/tdfx/profiled/?*.o - TDFXDONES = mesa/src/drv/tdfx/DONE - - DRVOBJS = $(TDFXOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(TDFXUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(TDFXDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(TDFXPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(TDFXDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - -REQUIREDLIBS += -lglide3 -ldl - - DRVSUBDIRS = mesa/src/drv/tdfx - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) - -#elif GlxBuiltInI810 - - I810OBJS = mesa/src/drv/i810/?*.o - I810UOBJS = mesa/src/drv/i810/unshared/?*.o - I810DOBJS = mesa/src/drv/i810/debugger/?*.o - I810POBJS = mesa/src/drv/i810/profiled/?*.o - I810DONES = mesa/src/drv/i810/DONE - - DRVOBJS = $(I810OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(I810UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(I810DOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(I810POBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(I810DONES) $(COMMONDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - - DRVSUBDIRS = mesa/src/drv/i810 - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) - -#elif GlxBuiltInMga - - MGAOBJS = mesa/src/drv/mga/?*.o - MGAUOBJS = mesa/src/drv/mga/unshared/?*.o - MGADOBJS = mesa/src/drv/mga/debugger/?*.o - MGAPOBJS = mesa/src/drv/mga/profiled/?*.o - MGADONES = mesa/src/drv/mga/DONE - - DRVOBJS = $(MGAOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(MGAUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(MGADOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(MGAPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(MGADONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - - DRVSUBDIRS = mesa/src/drv/mga - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) - -#elif GlxBuiltInR128 - - R128OBJS = mesa/src/drv/r128/?*.o - R128UOBJS = mesa/src/drv/r128/unshared/?*.o - R128DOBJS = mesa/src/drv/r128/debugger/?*.o - R128POBJS = mesa/src/drv/r128/profiled/?*.o - R128DONES = mesa/src/drv/r128/DONE - - DRVOBJS = $(R128OBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(R128UOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(R128DOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(R128POBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(R128DONES) $(COMMONDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - - DRVSUBDIRS = mesa/src/drv/common mesa/src/drv/r128 - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) - -#elif GlxBuiltInRadeon - - RADEONOBJS = mesa/src/drv/radeon/?*.o - RADEONUOBJS = mesa/src/drv/radeon/unshared/?*.o - RADEONDOBJS = mesa/src/drv/radeon/debugger/?*.o - RADEONPOBJS = mesa/src/drv/radeon/profiled/?*.o - RADEONDONES = mesa/src/drv/radeon/DONE - - DRVOBJS = $(RADEONOBJS) $(COMMONOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(RADEONUOBJS) $(COMMONUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(RADEONDOBJS) $(COMMONDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(RADEONPOBJS) $(COMMONPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(RADEONDONES) $(COMMONDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - - DRVSUBDIRS = mesa/src/drv/common mesa/src/drv/radeon - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) - -#elif GlxBuiltInFfb - - FFBOBJS = mesa/src/drv/ffb/?*.o - FFBUOBJS = mesa/src/drv/ffb/unshared/?*.o - FFBDOBJS = mesa/src/drv/ffb/debugger/?*.o - FFBPOBJS = mesa/src/drv/ffb/profiled/?*.o - FFBDONES = mesa/src/drv/ffb/DONE - - DRVOBJS = $(FFBOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(FFBUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(FFBDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(FFBPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(FFBDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - - DRVSUBDIRS = mesa/src/drv/ffb - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) - -#elif GlxBuiltInSIS - - SISOBJS = mesa/src/drv/sis/?*.o - SISUOBJS = mesa/src/drv/sis/unshared/?*.o - SISDOBJS = mesa/src/drv/sis/debugger/?*.o - SISPOBJS = mesa/src/drv/sis/profiled/?*.o - SISDONES = mesa/src/drv/sis/DONE - - DRVOBJS = $(SISOBJS) $(MESAOBJS) $(DRIMESAOBJS) $(DRMOBJS) - DRVUOBJS = $(SISUOBJS) $(MESAUOBJS) $(DRIMESAUOBJS) $(DRMUOBJS) - DRVDOBJS = $(SISDOBJS) $(MESADOBJS) $(DRIMESADOBJS) $(DRMDOBJS) - DRVPOBJS = $(SISPOBJS) $(MESAPOBJS) $(DRIMESAPOBJS) $(DRMPOBJS) - DRVDONES = $(SISDONES) $(MESADONES) $(DRIMESADONES) $(DRMDONES) - - DRVSUBDIRS = mesa/src/drv/sis - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src $(DRVSUBDIRS) - -#elif GlxBuiltInMesa - -#ifndef GlxDriverUsesMesa - DRVOBJS = mesa/src/?*.o - DRVUOBJS = mesa/src/unshared/?*.o - DRVDOBJS = mesa/src/debugger/?*.o - DRVPOBJS = mesa/src/profiled/?*.o - DRVDONES = mesa/src/DONE - - GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src -#endif - -#else - -XCOMM No built-in drivers. This is the usual case. -GLXSUBDIRS = glx dri mesa/dri mesa/include/GL mesa/src - -#endif - -#else - -XCOMM BuildXF86DRI was not defined. Just build an indirect-only libGL. -GLXSUBDIRS = glx - -#endif - - -#if !GlxUseSGISI && (!GlxBuiltInMesa || !defined(GlxDriverUsesMesa)) -MakeSubdirs($(GLXSUBDIRS)) -#endif - - -#ifdef OS2Architecture - OBJS = $(LIBNAME).a -#else - OBJS = $(GLXOBJS) $(DRIOBJS) $(DRVOBJS) -#endif - -#if HasSharedLibraries - UOBJS = $(GLXUOBJS) $(DRIUOBJS) $(DRVUOBJS) +#if GlxUseBuiltInDRIDriver +SUBDIRS = $(MESADIRS) $(DRIDIRS) $(DRIVERDIRS) $(GLXDIRS) $(LIBGLBUILDDIR) $(OSMESADIRS) #else - UOBJS = $(OBJS) +SUBDIRS = $(MESADIRS) $(GLXDIRS) $(DRIDIRS) $(LIBGLBUILDDIR) $(OSMESADIRS) $(DRIVERDIRS) #endif - DOBJS = $(GLXDOBJS) $(DRIDOBJS) $(DRVDOBJS) - POBJS = $(GLXPOBJS) $(DRIPOBJS) $(DRVPOBJS) - DONES = $(GLXDONES) $(DRIDONES) $(DRVDONES) - -#if LocalThreads - THREADOBJS = $(THREADS_LIBS) -#endif - -#if HasParallelMake -MakeMutex($(GLXSUBDIRS) $(DONES)) -#endif - -#if HasGnuMake || HasBsdMake -$(DONES): $(GLXSUBDIRS) -#endif - -#include <Library.tmpl> - -#undef _LinkBuildLibrary -#define _LinkBuildLibrary(lib) LinkBuildLibrary(lib) - - -#if NormalLibGlx -NormalDepLibraryTarget($(LIBNAME),$(GLXSUBDIRS) $(DONES),$(UOBJS)) -InstallLibrary($(LIBNAME),$(USRLIBDIR)) -#endif -#if SharedLibGlx -SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(GLXSUBDIRS) $(DONES),$(OBJS) $(THREADOBJS),.,.) -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 || true - $(RM) $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so.1 - $(LN) $(SHLIBDIR)/lib$(LIBNAME).so.1 $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so.1 || true -#endif -#endif -#if DebugLibGlx -DebuggedDepLibraryTarget($(LIBNAME),$(GLXSUBDIRS) $(DONES),$(DOBJS)) -InstallLibrary($(LIBNAME)_d,$(USRLIBDIR)) -#endif -#if ProfileLibGlx -ProfiledDepLibraryTarget($(LIBNAME),$(GLXSUBDIRS) $(DONES),$(POBJS)) -InstallLibrary($(LIBNAME)_p,$(USRLIBDIR)) -#endif - -XCOMM libOSmesa needs libGL, so build it now - -#if BuildXF86DRI && !GlxUseSGISI && (!GlxBuiltInMesa || !defined(GlxDriverUsesMesa)) -OSMESASUBDIRS = mesa/src/OSmesa -MakeSubdirs($(OSMESASUBDIRS)) -#endif - - -XCOMM libGL has now been made, continue with building the drivers. - -#if BuildXF86DRI && \ - !GlxUseSGISI && \ - !GlxBuiltInGamma && \ - !GlxBuiltInTdfx && \ - !GlxBuiltInI810 && \ - !GlxBuiltInMga && \ - !GlxBuiltInR128 && \ - !GlxBuiltInRadeon && \ - !GlxBuiltInFfb && \ - !GlxBuiltInSIS && \ - !GlxBuiltInMesa - -DRIVERSUBDIRS = mesa/src/drv - -MakeSubdirs($(DRIVERSUBDIRS)) - -#endif - -SUBDIRS = $(GLXSUBDIRS) $(OSMESASUBDIRS) $(DRIVERSUBDIRS) +MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) + diff --git a/xc/lib/GL/dri/Imakefile b/xc/lib/GL/dri/Imakefile index bd1e11042..e0b84743f 100644 --- a/xc/lib/GL/dri/Imakefile +++ b/xc/lib/GL/dri/Imakefile @@ -1,9 +1,9 @@ -XCOMM $XFree86: xc/lib/GL/dri/Imakefile,v 1.5 2000/02/15 07:13:25 martin Exp $ +XCOMM $XFree86: xc/lib/GL/dri/Imakefile,v 1.9 2001/04/03 02:29:32 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx @@ -15,9 +15,9 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #if !GlxUseSGISI DRI_SRCS = dri_glx.c DRI_OBJS = dri_glx.o - DRI_INCS = -I. -I../glx -I$(TOP)/include -I$(TOP)/include/GL \ - -I$(SERVERSRC)/GL/dri \ - -I../mesa/include -I../mesa/src -I../mesa/src/drv/gamma + DRI_INCS = -I. -I$(GLXLIBSRC)/glx -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ + -I$(XINCLUDESRC) -I$(SERVERSRC)/GL/dri \ + -I$(MESASRCDIR)/include -I$(MESASRCDIR)/src #endif #if GlxBuiltInTdfx @@ -51,3 +51,4 @@ MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) DependTarget() + diff --git a/xc/lib/GL/dri/drm/Imakefile b/xc/lib/GL/dri/drm/Imakefile index 7b60a2c23..769b08355 100644 --- a/xc/lib/GL/dri/drm/Imakefile +++ b/xc/lib/GL/dri/drm/Imakefile @@ -1,24 +1,33 @@ -XCOMM $XFree86: xc/lib/GL/dri/drm/Imakefile,v 1.11 2001/01/08 01:07:17 martin Exp $ +XCOMM $XFree86: xc/lib/GL/dri/drm/Imakefile,v 1.15 2001/04/03 02:29:32 dawes Exp $ -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtraLib NO +#define DoDebugLib NO +#define DoProfileLib NO +#endif #if Malloc0ReturnsNull ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #endif DEFINES = $(ALLOC_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) -I. \ + INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(XF86OSSRC)/$(OS_SUBDIR)/drm \ -I$(XF86OSSRC)/$(OS_SUBDIR)/drm/kernel \ + -I$(XF86OSSRC)/$(OS_SUBDIR2)/drm/kernel \ -I$(XF86OSSRC) SRCS = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c \ - xf86drmR128.c xf86drmRadeon.c + xf86drmMga.c xf86drmR128.c xf86drmRadeon.c OBJS = xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o \ - xf86drmR128.o xf86drmRadeon.o + xf86drmMga.o xf86drmR128.o xf86drmRadeon.o #if defined(LinuxArchitecture) OS_SUBDIR = linux @@ -38,13 +47,10 @@ LinkSourceFile(xf86drm.c,$(XF86OSSRC)/$(OS_SUBDIR)/drm) LinkSourceFile(xf86drmHash.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) LinkSourceFile(xf86drmRandom.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) LinkSourceFile(xf86drmSL.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) +LinkSourceFile(xf86drmMga.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) LinkSourceFile(xf86drmR128.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) LinkSourceFile(xf86drmRadeon.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) -LinkSourceFile(xf86drm.h,$(XF86OSSRC)) -LinkSourceFile(xf86drmR128.h,$(XF86OSSRC)) -LinkSourceFile(xf86drmRadeon.h,$(XF86OSSRC)) - LinkSourceFile(drm.h,$(XF86OSSRC)/$(OS_SUBDIR2)/drm/kernel) LinkSourceFile(i810_drm.h,$(XF86OSSRC)/$(OS_SUBDIR2)/drm/kernel) LinkSourceFile(mga_drm.h,$(XF86OSSRC)/$(OS_SUBDIR2)/drm/kernel) diff --git a/xc/lib/GL/dri/xf86dristr.h b/xc/lib/GL/dri/xf86dristr.h index d27860b35..44f58d5d8 100644 --- a/xc/lib/GL/dri/xf86dristr.h +++ b/xc/lib/GL/dri/xf86dristr.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.8 2000/12/21 12:22:55 alanh Exp $ */ +/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.9 2001/03/21 16:01:08 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -42,8 +42,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define XF86DRINAME "XFree86-DRI" -#define XF86DRI_MAJOR_VERSION 3 /* current version numbers */ -#define XF86DRI_MINOR_VERSION 1 +#define XF86DRI_MAJOR_VERSION 4 /* current version numbers */ +#define XF86DRI_MINOR_VERSION 0 #define XF86DRI_PATCH_VERSION 0 typedef struct _XF86DRIQueryVersion { diff --git a/xc/lib/GL/glx/Imakefile b/xc/lib/GL/glx/Imakefile index 8f3111bdb..21032942f 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.11 2000/08/01 20:28:38 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/glx/Imakefile,v 1.14 2001/04/03 02:29:32 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., @@ -18,8 +18,8 @@ XCOMM are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx @@ -31,18 +31,15 @@ XCOMM SUBDIRS = \ XCOMM glu \ XCOMM glw +# Files from Mesa + 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) + +# Maybe some of these could come from +# xc/extras/ogl-sample/main/glx/lib at some point. GLX_SRCS = \ clientattrib.c \ @@ -93,7 +90,7 @@ LinkSourceFile(assyntax.h, $(MESASRCDIR)/src/X86) GLX_DEFS = GlxDefines #if BuildXF86DRI - DRI_INCS = -I../dri + DRI_INCS = -I$(GLXLIBSRC)/dri #if defined(i386Architecture) ASM_SRCS = glapi_x86.S ASM_OBJS = glapi_x86.o @@ -105,11 +102,14 @@ LinkSourceFile(assyntax.h, $(MESASRCDIR)/src/X86) OBJS = $(GLX_OBJS) $(ASM_OBJS) DEFINES = $(GLX_DEFS) $(ASM_DEFS) - INCLUDES = -I$(TOP)/include \ - -I$(TOP)/include/extensions \ - -I$(TOP)/include/GL \ - -I$(INCLUDESRC) \ - -I../mesa/src \ + INCLUDES = -I$(INCLUDESRC) \ + -I$(XINCLUDESRC) \ + -I$(EXTINCSRC) \ + -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/glx \ + -I$(MESASRCDIR)/src \ + -I$(MESASRCDIR)/src/X86 \ + -I$(MESASRCDIR)/include \ $(DRI_INCS) #include <Library.tmpl> @@ -123,9 +123,4 @@ ObjectFromAsmSource(glapi_x86, NullParameter) SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) -#if 0 -XCOMM MakeSubdirs($(SUBDIRS)) -XCOMM DependSubdirs($(SUBDIRS)) -#endif - DependTarget() diff --git a/xc/lib/GL/glx/clientattrib.c b/xc/lib/GL/glx/clientattrib.c index 0e23c09ad..9b75c84f1 100644 --- a/xc/lib/GL/glx/clientattrib.c +++ b/xc/lib/GL/glx/clientattrib.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/lib/GL/glx/clientattrib.c,v 1.4 2000/02/18 16:23:09 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/clientattrib.c,v 1.5 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include <assert.h> @@ -32,22 +46,22 @@ void glEnableClientState(GLenum array) switch (array) { case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_TRUE; + gc->state.vertArray.color.enable = GL_TRUE; break; case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_TRUE; + gc->state.vertArray.edgeFlag.enable = GL_TRUE; break; case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_TRUE; + gc->state.vertArray.index.enable = GL_TRUE; break; case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_TRUE; + gc->state.vertArray.normal.enable = GL_TRUE; break; case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_TRUE; + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_TRUE; break; case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_TRUE; + gc->state.vertArray.vertex.enable = GL_TRUE; break; default: __glXSetError(gc, GL_INVALID_ENUM); @@ -60,22 +74,22 @@ void glDisableClientState(GLenum array) switch (array) { case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_FALSE; + gc->state.vertArray.color.enable = GL_FALSE; break; case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_FALSE; + gc->state.vertArray.edgeFlag.enable = GL_FALSE; break; case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_FALSE; + gc->state.vertArray.index.enable = GL_FALSE; break; case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_FALSE; + gc->state.vertArray.normal.enable = GL_FALSE; break; case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_FALSE; + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_FALSE; break; case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_FALSE; + gc->state.vertArray.vertex.enable = GL_FALSE; break; default: __glXSetError(gc, GL_INVALID_ENUM); diff --git a/xc/lib/GL/glx/compsize.c b/xc/lib/GL/glx/compsize.c index cf5de61bb..11ba23fe2 100644 --- a/xc/lib/GL/glx/compsize.c +++ b/xc/lib/GL/glx/compsize.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/lib/GL/glx/compsize.c,v 1.2 1999/06/14 07:23:34 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/compsize.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include <GL/gl.h> @@ -106,15 +120,36 @@ GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } @@ -154,11 +189,19 @@ GLint __glTexParameterfv_size(GLenum e) switch (e) { case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: return 1; case GL_TEXTURE_BORDER_COLOR: return 4; + case GL_TEXTURE_PRIORITY: + return 1; + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + return 1; default: return 0; } @@ -226,15 +269,36 @@ GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } @@ -282,21 +346,121 @@ GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return 0; } return (elements * esize * w * h); } +GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLsizei d) +{ + GLint elements, esize; + + if (w < 0) return 0; + if (h < 0) return 0; + if (d < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (d * (h * ((w+7)/8))); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return (elements * esize * w * h * d); +} + GLint __glLightfv_size(GLenum pname) { switch (pname) { @@ -326,6 +490,7 @@ GLint __glLightModelfv_size(GLenum pname) case GL_LIGHT_MODEL_AMBIENT: return 4; case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1; case GL_LIGHT_MODEL_TWO_SIDE: return 1; + case GL_LIGHT_MODEL_COLOR_CONTROL: return 1; default: return 0; } @@ -356,3 +521,46 @@ GLint __glMaterialiv_size(GLenum pname) return __glMaterialfv_size(pname); } +GLint __glColorTableParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + case GL_COLOR_TABLE_WIDTH: + case GL_COLOR_TABLE_RED_SIZE: + case GL_COLOR_TABLE_GREEN_SIZE: + case GL_COLOR_TABLE_BLUE_SIZE: + case GL_COLOR_TABLE_ALPHA_SIZE: + case GL_COLOR_TABLE_LUMINANCE_SIZE: + case GL_COLOR_TABLE_INTENSITY_SIZE: + return 1; + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return -1; + } +} + +GLint __glColorTableParameteriv_size(GLenum pname) +{ + return __glColorTableParameterfv_size(pname); +} + +GLint __glConvolutionParameterfv_size(GLenum pname) +{ + switch(pname) { + case GL_CONVOLUTION_BORDER_MODE: + return 1; + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + default: /* error: bad enum value */ + return -1; + } +} + +GLint __glConvolutionParameteriv_size(GLenum pname) +{ + return __glConvolutionParameterfv_size(pname); +} diff --git a/xc/lib/GL/glx/dispatch.c b/xc/lib/GL/glx/dispatch.c index 7cc76aea2..bc3288044 100644 --- a/xc/lib/GL/glx/dispatch.c +++ b/xc/lib/GL/glx/dispatch.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/lib/GL/glx/dispatch.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. diff --git a/xc/lib/GL/glx/eval.c b/xc/lib/GL/glx/eval.c index ca4f54ce5..4d8363e0a 100644 --- a/xc/lib/GL/glx/eval.c +++ b/xc/lib/GL/glx/eval.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/lib/GL/glx/eval.c,v 1.2 1999/06/14 07:23:35 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/eval.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "packrender.h" diff --git a/xc/lib/GL/glx/g_render.c b/xc/lib/GL/glx/g_render.c index b9f37c171..8d81f8d64 100644 --- a/xc/lib/GL/glx/g_render.c +++ b/xc/lib/GL/glx/g_render.c @@ -1,21 +1,31 @@ -/* $XFree86: xc/lib/GL/glx/g_render.c,v 1.2 1999/06/14 07:23:35 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/g_render.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packrender.h" @@ -2803,3 +2813,586 @@ void glIndexubv(const GLubyte *c) __GLX_END(8); } +void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_BlendColor,20); + __GLX_PUT_FLOAT(4,red); + __GLX_PUT_FLOAT(8,green); + __GLX_PUT_FLOAT(12,blue); + __GLX_PUT_FLOAT(16,alpha); + __GLX_END(20); +} + +void glBlendEquation(GLenum mode) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_BlendEquation,8); + __GLX_PUT_LONG(4,mode); + __GLX_END(8); +} + +void glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glColorTableParameterfv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ColorTableParameterfv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glColorTableParameteriv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ColorTableParameteriv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyColorTable,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyColorSubTable,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,start); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ConvolutionParameterf,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT(12,params); + __GLX_END(16); +} + +void glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glConvolutionParameterfv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ConvolutionParameterfv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_FLOAT_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glConvolutionParameteri(GLenum target, GLenum pname, GLint params) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ConvolutionParameteri,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG(12,params); + __GLX_END(16); +} + +void glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + __GLX_DECLARE_VARIABLES(); + compsize = __glConvolutionParameteriv_size(pname); + __GLX_LOAD_VARIABLES(); + cmdlen = 12+compsize*4; + __GLX_BEGIN(X_GLrop_ConvolutionParameteriv,cmdlen); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,pname); + __GLX_PUT_LONG_ARRAY(12,params,compsize); + __GLX_END(cmdlen); +} + +void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyConvolutionFilter1D,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_END(24); +} + +void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyConvolutionFilter2D,28); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,x); + __GLX_PUT_LONG(16,y); + __GLX_PUT_LONG(20,width); + __GLX_PUT_LONG(24,height); + __GLX_END(28); +} + +void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_Histogram,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,internalformat); + __GLX_PUT_CHAR(16,sink); + __GLX_END(20); +} + +void glMinmax(GLenum target, GLenum internalformat, GLboolean sink) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_Minmax,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_CHAR(12,sink); + __GLX_END(16); +} + +void glResetHistogram(GLenum target) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ResetHistogram,8); + __GLX_PUT_LONG(4,target); + __GLX_END(8); +} + +void glResetMinmax(GLenum target) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ResetMinmax,8); + __GLX_PUT_LONG(4,target); + __GLX_END(8); +} + +void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_CopyTexSubImage3D,40); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,level); + __GLX_PUT_LONG(12,xoffset); + __GLX_PUT_LONG(16,yoffset); + __GLX_PUT_LONG(20,zoffset); + __GLX_PUT_LONG(24,x); + __GLX_PUT_LONG(28,y); + __GLX_PUT_LONG(32,width); + __GLX_PUT_LONG(36,height); + __GLX_END(40); +} + +void glActiveTextureARB(GLenum texture) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_ActiveTextureARB,8); + __GLX_PUT_LONG(4,texture); + __GLX_END(8); +} + +void glMultiTexCoord1dARB(GLenum target, GLdouble s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1dvARB,16); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_LONG(12,target); + __GLX_END(16); +} + +void glMultiTexCoord1dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1dvARB,16); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_LONG(12,target); + __GLX_END(16); +} + +void glMultiTexCoord1fARB(GLenum target, GLfloat s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1fvARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1fvARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord1iARB(GLenum target, GLint s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1ivARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1ivARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord1sARB(GLenum target, GLshort s) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_END(12); +} + +void glMultiTexCoord1svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord1svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_END(12); +} + +void glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2dvARB,24); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_LONG(20,target); + __GLX_END(24); +} + +void glMultiTexCoord2dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2dvARB,24); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_LONG(20,target); + __GLX_END(24); +} + +void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2fvARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_END(16); +} + +void glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2fvARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_END(16); +} + +void glMultiTexCoord2iARB(GLenum target, GLint s, GLint t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2ivARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_END(16); +} + +void glMultiTexCoord2ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2ivARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_END(16); +} + +void glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_END(12); +} + +void glMultiTexCoord2svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord2svARB,12); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_END(12); +} + +void glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3dvARB,32); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_DOUBLE(20,r); + __GLX_PUT_LONG(28,target); + __GLX_END(32); +} + +void glMultiTexCoord3dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3dvARB,32); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_DOUBLE(20,v[2]); + __GLX_PUT_LONG(28,target); + __GLX_END(32); +} + +void glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3fvARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_PUT_FLOAT(16,r); + __GLX_END(20); +} + +void glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3fvARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_PUT_FLOAT(16,v[2]); + __GLX_END(20); +} + +void glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3ivARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_PUT_LONG(16,r); + __GLX_END(20); +} + +void glMultiTexCoord3ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3ivARB,20); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_PUT_LONG(16,v[2]); + __GLX_END(20); +} + +void glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_PUT_SHORT(12,r); + __GLX_END(16); +} + +void glMultiTexCoord3svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord3svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_PUT_SHORT(12,v[2]); + __GLX_END(16); +} + +void glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4dvARB,40); + __GLX_PUT_DOUBLE(4,s); + __GLX_PUT_DOUBLE(12,t); + __GLX_PUT_DOUBLE(20,r); + __GLX_PUT_DOUBLE(28,q); + __GLX_PUT_LONG(36,target); + __GLX_END(40); +} + +void glMultiTexCoord4dvARB(GLenum target, const GLdouble *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4dvARB,40); + __GLX_PUT_DOUBLE(4,v[0]); + __GLX_PUT_DOUBLE(12,v[1]); + __GLX_PUT_DOUBLE(20,v[2]); + __GLX_PUT_DOUBLE(28,v[3]); + __GLX_PUT_LONG(36,target); + __GLX_END(40); +} + +void glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4fvARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,s); + __GLX_PUT_FLOAT(12,t); + __GLX_PUT_FLOAT(16,r); + __GLX_PUT_FLOAT(20,q); + __GLX_END(24); +} + +void glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4fvARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_FLOAT(8,v[0]); + __GLX_PUT_FLOAT(12,v[1]); + __GLX_PUT_FLOAT(16,v[2]); + __GLX_PUT_FLOAT(20,v[3]); + __GLX_END(24); +} + +void glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4ivARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,s); + __GLX_PUT_LONG(12,t); + __GLX_PUT_LONG(16,r); + __GLX_PUT_LONG(20,q); + __GLX_END(24); +} + +void glMultiTexCoord4ivARB(GLenum target, const GLint *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4ivARB,24); + __GLX_PUT_LONG(4,target); + __GLX_PUT_LONG(8,v[0]); + __GLX_PUT_LONG(12,v[1]); + __GLX_PUT_LONG(16,v[2]); + __GLX_PUT_LONG(20,v[3]); + __GLX_END(24); +} + +void glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,s); + __GLX_PUT_SHORT(10,t); + __GLX_PUT_SHORT(12,r); + __GLX_PUT_SHORT(14,q); + __GLX_END(16); +} + +void glMultiTexCoord4svARB(GLenum target, const GLshort *v) +{ + __GLX_DECLARE_VARIABLES(); + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultiTexCoord4svARB,16); + __GLX_PUT_LONG(4,target); + __GLX_PUT_SHORT(8,v[0]); + __GLX_PUT_SHORT(10,v[1]); + __GLX_PUT_SHORT(12,v[2]); + __GLX_PUT_SHORT(14,v[3]); + __GLX_END(16); +} + diff --git a/xc/lib/GL/glx/g_single.c b/xc/lib/GL/glx/g_single.c index b41865ef0..6c85c217d 100644 --- a/xc/lib/GL/glx/g_single.c +++ b/xc/lib/GL/glx/g_single.c @@ -1,21 +1,31 @@ -/* $XFree86: xc/lib/GL/glx/g_single.c,v 1.2 1999/06/14 07:23:36 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/g_single.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packsingle.h" @@ -417,3 +427,237 @@ GLboolean glIsList(GLuint list) return retval; } +/* + * Somewhere between GLX 1.2 and 1.3 (in SGI's code anyway) the + * protocol for glAreTexturesResident, glDeleteTextures, glGenTextures, + * and glIsTexture() was changed. Before, calls to these functions + * generated protocol for the old GL_EXT_texture_object versions of those + * calls. In the newer code, this is actually corrected; calls to the + * 1.1 functions generate 1.1 protocol and calls to the EXT functions + * generate EXT protocol. + * Unfortunately, this correction causes an incompatibility. Specifically, + * an updated libGL.so will send protocol requests that the server won't + * be able to handle. For example, calling glGenTextures will generate a + * BadRequest error. + * For now, we'll keep generating EXT protocol from libGL. We'll update + * the server to understand both the 1.1 and EXT protocol ASAP. At some point + * in the future we'll correct libGL.so as well. That should be a smoother + * transition path. + */ + +GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + GLboolean retval = 0; + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + if (n < 0) return retval; + cmdlen = 4+n*4; + __GLX_SINGLE_BEGIN(X_GLsop_AreTexturesResident,cmdlen); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_PUT_LONG_ARRAY(4,textures,n); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_RETVAL(retval, GLboolean); + __GLX_SINGLE_GET_CHAR_ARRAY(residences,n); + __GLX_SINGLE_END(); + return retval; +#else + return glAreTexturesResidentEXT(n, textures, residences); +#endif +} + +void glDeleteTextures(GLsizei n, const GLuint *textures) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + __GLX_SINGLE_LOAD_VARIABLES(); + if (n < 0) return; + cmdlen = 4+n*4; + __GLX_SINGLE_BEGIN(X_GLsop_DeleteTextures,cmdlen); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_PUT_LONG_ARRAY(4,textures,n); + __GLX_SINGLE_END(); +#else + glDeleteTexturesEXT(n, textures); +#endif +} + +void glGenTextures(GLsizei n, GLuint *textures) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GenTextures,4); + __GLX_SINGLE_PUT_LONG(0,n); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_LONG_ARRAY(textures,n); + __GLX_SINGLE_END(); +#else + glGenTexturesEXT(n, textures); +#endif +} + +GLboolean glIsTexture(GLuint texture) +{ +#if 0 /* see comments above */ + __GLX_SINGLE_DECLARE_VARIABLES(); + GLboolean retval = 0; + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_IsTexture,4); + __GLX_SINGLE_PUT_LONG(0,texture); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_RETVAL(retval, GLboolean); + __GLX_SINGLE_END(); + return retval; +#else + return glIsTextureEXT(texture); +#endif +} + +void glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTableParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTableParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogramParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogramParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmaxParameterfv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_FLOAT(params); + } else { + __GLX_SINGLE_GET_FLOAT_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + +void glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXSingleReply reply; + __GLX_SINGLE_LOAD_VARIABLES(); + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmaxParameteriv,8); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,pname); + __GLX_SINGLE_READ_XREPLY(); + __GLX_SINGLE_GET_SIZE(compsize); + if (compsize == 1) { + __GLX_SINGLE_GET_LONG(params); + } else { + __GLX_SINGLE_GET_LONG_ARRAY(params,compsize); + } + __GLX_SINGLE_END(); +} + diff --git a/xc/lib/GL/glx/g_vendpriv.c b/xc/lib/GL/glx/g_vendpriv.c index b178ab811..99c0330a7 100644 --- a/xc/lib/GL/glx/g_vendpriv.c +++ b/xc/lib/GL/glx/g_vendpriv.c @@ -1,26 +1,36 @@ -/* $XFree86: xc/lib/GL/glx/g_vendpriv.c,v 1.2 1999/06/14 07:23:36 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/g_vendpriv.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "packvendpriv.h" -GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) +GLboolean glAreTexturesResidentEXT(GLsizei n, const GLuint *textures, GLboolean *residences) { __GLX_VENDPRIV_DECLARE_VARIABLES(); GLboolean retval = 0; @@ -28,7 +38,7 @@ GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *re __GLX_VENDPRIV_LOAD_VARIABLES(); if (n < 0) return retval; cmdlen = 4+n*4; - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_AreTexturesResident,cmdlen); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_AreTexturesResidentEXT,cmdlen); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_PUT_LONG_ARRAY(4,textures,n); __GLX_VENDPRIV_READ_XREPLY(); @@ -38,37 +48,37 @@ GLboolean glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *re return retval; } -void glDeleteTextures(GLsizei n, const GLuint *textures) +void glDeleteTexturesEXT(GLsizei n, const GLuint *textures) { __GLX_VENDPRIV_DECLARE_VARIABLES(); __GLX_VENDPRIV_LOAD_VARIABLES(); if (n < 0) return; cmdlen = 4+n*4; - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivate,X_GLvop_DeleteTextures,cmdlen); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivate,X_GLvop_DeleteTexturesEXT,cmdlen); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_PUT_LONG_ARRAY(4,textures,n); __GLX_VENDPRIV_END(); } -void glGenTextures(GLsizei n, GLuint *textures) +void glGenTexturesEXT(GLsizei n, GLuint *textures) { __GLX_VENDPRIV_DECLARE_VARIABLES(); xGLXVendorPrivReply reply; __GLX_VENDPRIV_LOAD_VARIABLES(); - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_GenTextures,4); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_GenTexturesEXT,4); __GLX_VENDPRIV_PUT_LONG(0,n); __GLX_VENDPRIV_READ_XREPLY(); __GLX_VENDPRIV_GET_LONG_ARRAY(textures,n); __GLX_VENDPRIV_END(); } -GLboolean glIsTexture(GLuint texture) +GLboolean glIsTextureEXT(GLuint texture) { __GLX_VENDPRIV_DECLARE_VARIABLES(); GLboolean retval = 0; xGLXVendorPrivReply reply; __GLX_VENDPRIV_LOAD_VARIABLES(); - __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_IsTexture,4); + __GLX_VENDPRIV_BEGIN(X_GLXVendorPrivateWithReply,X_GLvop_IsTextureEXT,4); __GLX_VENDPRIV_PUT_LONG(0,texture); __GLX_VENDPRIV_READ_XREPLY(); __GLX_VENDPRIV_GET_RETVAL(retval, GLboolean); diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h index f89c1b58a..7bbb35745 100644 --- a/xc/lib/GL/glx/glxclient.h +++ b/xc/lib/GL/glx/glxclient.h @@ -1,24 +1,38 @@ - /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ -/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.11 2000/12/07 20:26:03 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.12 2001/03/21 16:04:39 dawes Exp $ */ /* * Direct rendering support added by Precision Insight, Inc. @@ -32,12 +46,11 @@ #define _GLX_client_h_ #define NEED_REPLIES #define NEED_EVENTS -#include <string.h> -#include <stdlib.h> #include <X11/Xproto.h> #include <X11/Xlibint.h> -#include <GL/gl.h> #include <GL/glx.h> +#include <string.h> +#include <stdlib.h> #include "glxint.h" #include "glxproto.h" #include "glapitable.h" @@ -54,6 +67,8 @@ #define __GL_BOOLEAN_ARRAY (GL_BYTE - 1) +#define __GLX_MAX_TEXTURE_UNITS 32 + typedef struct __GLXcontextRec __GLXcontext; typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate; typedef struct _glapi_table __GLapi; @@ -211,55 +226,34 @@ typedef struct __GLXpixelStoreModeRec { GLboolean swapEndian; GLboolean lsbFirst; GLuint rowLength; + GLuint imageHeight; + GLuint imageDepth; GLuint skipRows; GLuint skipPixels; + GLuint skipImages; GLuint alignment; } __GLXpixelStoreMode; +typedef struct __GLXvertexArrayPointerStateRec { + GLboolean enable; + void (*proc)(const void *); + const GLubyte *ptr; + GLsizei skip; + GLint size; + GLenum type; + GLsizei stride; +} __GLXvertexArrayPointerState; + typedef struct __GLXvertArrayStateRec { - GLboolean vertexEnable; - void (*vertexCall)(const char *); - const char *vertexPtr; - GLsizei vertexSkip; - GLint vertexSize; - GLenum vertexType; - GLsizei vertexStride; - - GLboolean normalEnable; - void (*normalCall)(const char *); - const char *normalPtr; - GLsizei normalSkip; - GLenum normalType; - GLsizei normalStride; - - GLboolean colorEnable; - void (*colorCall)(const char *); - const char *colorPtr; - GLsizei colorSkip; - GLint colorSize; - GLenum colorType; - GLsizei colorStride; - - GLboolean indexEnable; - void (*indexCall)(const char *); - const char *indexPtr; - GLsizei indexSkip; - GLenum indexType; - GLsizei indexStride; - - GLboolean texCoordEnable; - void (*texCoordCall)(const char *); - const char *texCoordPtr; - GLsizei texCoordSkip; - GLint texCoordSize; - GLenum texCoordType; - GLsizei texCoordStride; - - GLboolean edgeFlagEnable; - void (*edgeFlagCall)(const GLboolean *); - GLsizei edgeFlagSkip; - const GLboolean *edgeFlagPtr; - GLsizei edgeFlagStride; + __GLXvertexArrayPointerState vertex; + __GLXvertexArrayPointerState normal; + __GLXvertexArrayPointerState color; + __GLXvertexArrayPointerState index; + __GLXvertexArrayPointerState texCoord[__GLX_MAX_TEXTURE_UNITS]; + __GLXvertexArrayPointerState edgeFlag; + GLint maxElementsVertices; + GLint maxElementsIndices; + GLint activeTexture; } __GLXvertArrayState; typedef struct __GLXattributeRec { @@ -370,8 +364,8 @@ struct __GLXcontextRec { ** Fill newImage with the unpacked form of oldImage getting it ** ready for transport to the server. */ - void (*fillImage)(__GLXcontext*, GLint, GLint, GLenum, GLenum, - const GLvoid*, GLubyte*, GLubyte*); + void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLvoid*, GLubyte*, GLubyte*); /* ** Client side attribs. @@ -587,7 +581,7 @@ extern CARD8 __glXSetupForCommand(Display *dpy); */ /* Return the size, in bytes, of some pixel data */ -extern GLint __glImageSize(GLint, GLint, GLenum, GLenum); +extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum); /* Return the k value for a given map target */ extern GLint __glEvalComputeK(GLenum); @@ -599,10 +593,8 @@ extern GLint __glEvalComputeK(GLenum); ** updated to contain the modes needed by the server to decode the ** sent data. */ -extern void __glFillImage(__GLXcontext*, GLint, GLint, - GLenum, GLenum, - const GLvoid*, GLubyte*, - GLubyte*); +extern void __glFillImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLvoid*, GLubyte*, GLubyte*); /* Copy map data with a stride into a packed buffer */ extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *); @@ -616,8 +608,8 @@ extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint, ** Empty an image out of the reply buffer into the clients memory applying ** the pack modes to pack back into the clients requested format. */ -extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLenum, - GLenum, const GLubyte *, GLvoid *); +extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, + GLenum, const GLubyte *, GLvoid *); /* @@ -637,6 +629,10 @@ extern void __glXClientInfo ( Display *dpy, int opcode ); ** is illegal these procedures return 0. */ extern GLint __glCallLists_size(GLint, GLenum); +extern GLint __glColorTableParameterfv_size(GLenum); +extern GLint __glColorTableParameteriv_size(GLenum); +extern GLint __glConvolutionParameterfv_size(GLenum); +extern GLint __glConvolutionParameteriv_size(GLenum); extern GLint __glDrawPixels_size(GLenum, GLenum, GLint, GLint); extern GLint __glReadPixels_size(GLenum, GLenum, GLint, GLint); extern GLint __glLightModelfv_size(GLenum); @@ -649,6 +645,7 @@ extern GLint __glFogfv_size(GLenum); extern GLint __glFogiv_size(GLenum); extern GLint __glTexImage1D_size(GLenum, GLenum, GLint); extern GLint __glTexImage2D_size(GLenum, GLenum, GLint, GLint); +extern GLint __glTexImage3D_size(GLenum, GLenum, GLint, GLint, GLint); extern GLint __glTexEnvfv_size(GLenum); extern GLint __glTexEnviv_size(GLenum); extern GLint __glTexGenfv_size(GLenum); diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c index d89bac9ee..3376c188c 100644 --- a/xc/lib/GL/glx/glxcmds.c +++ b/xc/lib/GL/glx/glxcmds.c @@ -1,56 +1,65 @@ -/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.13 2000/11/13 23:31:23 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.14 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ -/* - * Direct rendering support added by Precision Insight, Inc. - * - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Brian Paul <brian@precisioninsight.com> - */ - #include "packsingle.h" #include "glxclient.h" #include <extutil.h> #include <Xext.h> -#include <string.h> +#include <strings.h> #include "glapi.h" #ifdef GLX_DIRECT_RENDERING #include "indirect_init.h" #endif -static const char GL_ClientExtensions[] = - "GL_EXT_abgr " - "GL_EXT_blend_color " - "GL_EXT_blend_minmax " - "GL_EXT_blend_subtract " ; - -static const char GLXClientVendorName[] = "SGI"; -static const char GLXClientVersion[] = "1.2"; -static const char GLXClientExtensions[] = - "GLX_EXT_visual_info " - "GLX_EXT_visual_rating " - "GLX_EXT_import_context " - "GLX_ARB_get_proc_address "; +static const char __glXGLClientExtensions[] = + "GL_ARB_multitexture " + "GL_ARB_imaging " + "GL_EXT_abgr " + "GL_EXT_blend_color " + "GL_EXT_blend_minmax " + "GL_EXT_blend_subtract " + ; + +static const char __glXGLXClientVendorName[] = "SGI"; +static const char __glXGLXClientVersion[] = "1.2"; +static const char __glXGLXClientExtensions[] = + "GLX_EXT_visual_info " + "GLX_EXT_visual_rating " + "GLX_EXT_import_context " + ; /* ** Create a new context. @@ -1275,7 +1284,7 @@ const char *glXQueryExtensionsString( Display *dpy, int screen ) psc->serverGLXexts = QueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS); } - psc->effectiveGLXexts = combine_strings(GLXClientExtensions, + psc->effectiveGLXexts = combine_strings(__glXGLXClientExtensions, psc->serverGLXexts); } @@ -1286,11 +1295,11 @@ const char *glXGetClientString( Display *dpy, int name ) { switch(name) { case GLX_VENDOR: - return (GLXClientVendorName); + return (__glXGLXClientVendorName); case GLX_VERSION: - return (GLXClientVersion); + return (__glXGLXClientVersion); case GLX_EXTENSIONS: - return (GLXClientExtensions); + return (__glXGLXClientExtensions); default: return NULL; } @@ -1363,10 +1372,10 @@ void __glXClientInfo ( Display *dpy, int opcode ) req->major = GLX_MAJOR_VERSION; req->minor = GLX_MINOR_VERSION; - size = strlen(GL_ClientExtensions) + 1; + size = strlen(__glXGLClientExtensions) + 1; req->length += (size + 3) >> 2; req->numbytes = size; - Data(dpy, GL_ClientExtensions, size); + Data(dpy, __glXGLClientExtensions, size); UnlockDisplay(dpy); SyncHandle(); diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c index b1fcd38a6..233dce353 100644 --- a/xc/lib/GL/glx/glxext.c +++ b/xc/lib/GL/glx/glxext.c @@ -1,38 +1,53 @@ -/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.10 2001/01/16 05:10:55 martin Exp $ */ +/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.12 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. -** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ -/* - * Direct rendering support added by Precision Insight, Inc. - * - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * - */ +/* < + * Direct rendering support added by Precision Insight, Inc. < + * < + * Authors: < + * Kevin E. Martin <kevin@precisioninsight.com> < + * < + */ #include "packrender.h" +#include <stdio.h> #include <Xext.h> #include <extutil.h> #include <assert.h> -#include <stdio.h> #include "indirect_init.h" #include "glapi.h" #ifdef XTHREADS @@ -211,7 +226,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) psc->configs = 0; /* NOTE: just for paranoia */ } -#if GLX_DIRECT_RENDERING +#ifdef GLX_DIRECT_RENDERING /* Free the direct rendering per screen data */ if (psc->driScreen.private) (*psc->driScreen.destroyScreen)(priv->dpy, i, @@ -557,9 +572,7 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy) XAddToExtensionList(privList, private); if (dpyPriv->majorVersion == 1 && dpyPriv->minorVersion >= 1) { -#if 0 __glXClientInfo(dpy, dpyPriv->majorOpcode); -#endif } __glXUnlock(); diff --git a/xc/lib/GL/glx/indirect.h b/xc/lib/GL/glx/indirect.h index 4e18e0cde..76b72b6e8 100644 --- a/xc/lib/GL/glx/indirect.h +++ b/xc/lib/GL/glx/indirect.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/glx/indirect.h,v 1.2 2000/02/15 19:19:18 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/indirect.h,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -42,10 +42,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void __indirect_glAccum(GLenum op, GLfloat value); void __indirect_glAlphaFunc(GLenum func, GLclampf ref); GLboolean __indirect_glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences); +GLboolean __indirect_glAreTexturesResidentEXT(GLsizei n, const GLuint *textures, GLboolean *residences); void __indirect_glArrayElement(GLint i); void __indirect_glBegin(GLenum mode); void __indirect_glBindTexture(GLenum target, GLuint texture); void __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +void __indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +void __indirect_glBlendEquation(GLenum mode); void __indirect_glBlendFunc(GLenum sfactor, GLenum dfactor); void __indirect_glCallList(GLuint list); void __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid *lists); @@ -91,14 +94,30 @@ void __indirect_glColor4usv(const GLushort *v); void __indirect_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void __indirect_glColorMaterial(GLenum face, GLenum mode); void __indirect_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table); +void __indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +void __indirect_glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); +void __indirect_glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); +void __indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); +void __indirect_glConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params); +void __indirect_glConvolutionParameteri(GLenum target, GLenum pname, GLint params); +void __indirect_glConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); +void __indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +void __indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +void __indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +void __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); void __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); void __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); void __indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); void __indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); void __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +void __indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); void __indirect_glCullFace(GLenum mode); void __indirect_glDeleteLists(GLuint list, GLsizei range); void __indirect_glDeleteTextures(GLsizei n, const GLuint *textures); +void __indirect_glDeleteTexturesEXT(GLsizei n, const GLuint *textures); void __indirect_glDepthFunc(GLenum func); void __indirect_glDepthMask(GLboolean flag); void __indirect_glDepthRange(GLclampd zNear, GLclampd zFar); @@ -108,6 +127,7 @@ void __indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count); void __indirect_glDrawBuffer(GLenum mode); void __indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); void __indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); void __indirect_glEdgeFlag(GLboolean flag); void __indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer); void __indirect_glEdgeFlagv(const GLboolean *flag); @@ -138,11 +158,21 @@ void __indirect_glFrontFace(GLenum mode); void __indirect_glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); GLuint __indirect_glGenLists(GLsizei range); void __indirect_glGenTextures(GLsizei n, GLuint *textures); +void __indirect_glGenTexturesEXT(GLsizei n, GLuint *textures); void __indirect_glGetBooleanv(GLenum val, GLboolean *b); void __indirect_glGetClipPlane(GLenum plane, GLdouble *equation); +void __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table); +void __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname, GLint *params); +void __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image); +void __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetDoublev(GLenum val, GLdouble *d); GLenum __indirect_glGetError(void); void __indirect_glGetFloatv(GLenum val, GLfloat *f); +void __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +void __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetIntegerv(GLenum val, GLint *i); void __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat *params); void __indirect_glGetLightiv(GLenum light, GLenum pname, GLint *params); @@ -151,12 +181,16 @@ void __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat *v); void __indirect_glGetMapiv(GLenum target, GLenum query, GLint *v); void __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params); void __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint *params); +void __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +void __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); +void __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetPixelMapfv(GLenum map, GLfloat *values); void __indirect_glGetPixelMapuiv(GLenum map, GLuint *values); void __indirect_glGetPixelMapusv(GLenum map, GLushort *values); void __indirect_glGetPointerv(GLenum pname, void **params); void __indirect_glGetPolygonStipple(GLubyte *mask); const GLubyte *__indirect_glGetString(GLenum name); +void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); void __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params); void __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint *params); void __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params); @@ -168,6 +202,7 @@ void __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pnam void __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params); void __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint *params); void __indirect_glHint(GLenum target, GLenum mode); +void __indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); void __indirect_glIndexMask(GLuint mask); void __indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer); void __indirect_glIndexd(GLdouble c); @@ -185,6 +220,7 @@ void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid GLboolean __indirect_glIsEnabled(GLenum cap); GLboolean __indirect_glIsList(GLuint list); GLboolean __indirect_glIsTexture(GLuint texture); +GLboolean __indirect_glIsTextureEXT(GLuint texture); void __indirect_glLightModelf(GLenum pname, GLfloat param); void __indirect_glLightModelfv(GLenum pname, const GLfloat *params); void __indirect_glLightModeli(GLenum pname, GLint param); @@ -214,6 +250,7 @@ void __indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params); void __indirect_glMateriali(GLenum face, GLenum pname, GLint param); void __indirect_glMaterialiv(GLenum face, GLenum pname, const GLint *params); void __indirect_glMatrixMode(GLenum mode); +void __indirect_glMinmax(GLenum target, GLenum internalformat, GLboolean sink); void __indirect_glMultMatrixd(const GLdouble *m); void __indirect_glMultMatrixf(const GLfloat *m); void __indirect_glNewList(GLuint list, GLenum mode); @@ -286,12 +323,15 @@ void __indirect_glRectiv(const GLint *v1, const GLint *v2); void __indirect_glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2); void __indirect_glRectsv(const GLshort *v1, const GLshort *v2); GLint __indirect_glRenderMode(GLenum mode); +void __indirect_glResetHistogram(GLenum target); +void __indirect_glResetMinmax(GLenum target); void __indirect_glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); void __indirect_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); void __indirect_glScaled(GLdouble x, GLdouble y, GLdouble z); void __indirect_glScalef(GLfloat x, GLfloat y, GLfloat z); void __indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height); void __indirect_glSelectBuffer(GLsizei numnames, GLuint *buffer); +void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); void __indirect_glShadeModel(GLenum mode); void __indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask); void __indirect_glStencilMask(GLuint mask); @@ -341,12 +381,14 @@ void __indirect_glTexGeni(GLenum coord, GLenum pname, GLint param); void __indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint *params); void __indirect_glTexImage1D(GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexImage2D(GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param); void __indirect_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params); void __indirect_glTexParameteri(GLenum target, GLenum pname, GLint param); void __indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint *params); void __indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTranslated(GLdouble x, GLdouble y, GLdouble z); void __indirect_glTranslatef(GLfloat x, GLfloat y, GLfloat z); void __indirect_glVertex2d(GLdouble x, GLdouble y); @@ -376,4 +418,41 @@ void __indirect_glVertex4sv(const GLshort *v); void __indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); void __indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height); + +void __indirect_glActiveTextureARB(GLenum texture); +void __indirect_glClientActiveTextureARB(GLenum texture); +void __indirect_glMultiTexCoord1dARB(GLenum target, GLdouble s); +void __indirect_glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord1fARB(GLenum target, GLfloat s); +void __indirect_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord1iARB(GLenum target, GLint s); +void __indirect_glMultiTexCoord1ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord1sARB(GLenum target, GLshort s); +void __indirect_glMultiTexCoord1svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +void __indirect_glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +void __indirect_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +void __indirect_glMultiTexCoord2ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +void __indirect_glMultiTexCoord2svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +void __indirect_glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +void __indirect_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +void __indirect_glMultiTexCoord3ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +void __indirect_glMultiTexCoord3svARB(GLenum target, const GLshort *v); +void __indirect_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +void __indirect_glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +void __indirect_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +void __indirect_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +void __indirect_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +void __indirect_glMultiTexCoord4ivARB(GLenum target, const GLint *v); +void __indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +void __indirect_glMultiTexCoord4svARB(GLenum target, const GLshort *v); + + #endif /* _INDIRECT_H_ */ diff --git a/xc/lib/GL/glx/indirect_init.c b/xc/lib/GL/glx/indirect_init.c index 3d631bee6..1af30a6ef 100644 --- a/xc/lib/GL/glx/indirect_init.c +++ b/xc/lib/GL/glx/indirect_init.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/glx/indirect_init.c,v 1.5 2000/03/02 16:07:32 martin Exp $ */ +/* $XFree86: xc/lib/GL/glx/indirect_init.c,v 1.6 2001/03/21 16:04:39 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -140,6 +140,7 @@ __GLapi *__glXNewIndirectAPI(void) glAPI->DrawBuffer = __indirect_glDrawBuffer; glAPI->DrawElements = __indirect_glDrawElements; glAPI->DrawPixels = __indirect_glDrawPixels; + glAPI->DrawRangeElements = __indirect_glDrawRangeElements; glAPI->EdgeFlag = __indirect_glEdgeFlag; glAPI->EdgeFlagPointer = __indirect_glEdgeFlagPointer; glAPI->EdgeFlagv = __indirect_glEdgeFlagv; @@ -408,5 +409,83 @@ __GLapi *__glXNewIndirectAPI(void) glAPI->VertexPointer = __indirect_glVertexPointer; glAPI->Viewport = __indirect_glViewport; + /* 1.2 */ + glAPI->CopyTexSubImage3D = __indirect_glCopyTexSubImage3D; + glAPI->DrawRangeElements = __indirect_glDrawRangeElements; + glAPI->TexImage3D = __indirect_glTexImage3D; + glAPI->TexSubImage3D = __indirect_glTexSubImage3D; + + /* OpenGL 1.2 GL_ARB_imaging */ + glAPI->BlendColor = __indirect_glBlendColor; + glAPI->BlendEquation = __indirect_glBlendEquation; + glAPI->ColorSubTable = __indirect_glColorSubTable; + glAPI->ColorTable = __indirect_glColorTable; + glAPI->ColorTableParameterfv = __indirect_glColorTableParameterfv; + glAPI->ColorTableParameteriv = __indirect_glColorTableParameteriv; + glAPI->ConvolutionFilter1D = __indirect_glConvolutionFilter1D; + glAPI->ConvolutionFilter2D = __indirect_glConvolutionFilter2D; + glAPI->ConvolutionParameterf = __indirect_glConvolutionParameterf; + glAPI->ConvolutionParameterfv = __indirect_glConvolutionParameterfv; + glAPI->ConvolutionParameteri = __indirect_glConvolutionParameteri; + glAPI->ConvolutionParameteriv = __indirect_glConvolutionParameteriv; + glAPI->CopyColorSubTable = __indirect_glCopyColorSubTable; + glAPI->CopyColorTable = __indirect_glCopyColorTable; + glAPI->CopyConvolutionFilter1D = __indirect_glCopyConvolutionFilter1D; + glAPI->CopyConvolutionFilter2D = __indirect_glCopyConvolutionFilter2D; + glAPI->GetColorTable = __indirect_glGetColorTable; + glAPI->GetColorTableParameterfv = __indirect_glGetColorTableParameterfv; + glAPI->GetColorTableParameteriv = __indirect_glGetColorTableParameteriv; + glAPI->GetConvolutionFilter = __indirect_glGetConvolutionFilter; + glAPI->GetConvolutionParameterfv = __indirect_glGetConvolutionParameterfv; + glAPI->GetConvolutionParameteriv = __indirect_glGetConvolutionParameteriv; + glAPI->GetHistogram = __indirect_glGetHistogram; + glAPI->GetHistogramParameterfv = __indirect_glGetHistogramParameterfv; + glAPI->GetHistogramParameteriv = __indirect_glGetHistogramParameteriv; + glAPI->GetMinmax = __indirect_glGetMinmax; + glAPI->GetMinmaxParameterfv = __indirect_glGetMinmaxParameterfv; + glAPI->GetMinmaxParameteriv = __indirect_glGetMinmaxParameteriv; + glAPI->GetSeparableFilter = __indirect_glGetSeparableFilter; + glAPI->Histogram = __indirect_glHistogram; + glAPI->Minmax = __indirect_glMinmax; + glAPI->ResetHistogram = __indirect_glResetHistogram; + glAPI->ResetMinmax = __indirect_glResetMinmax; + glAPI->SeparableFilter2D = __indirect_glSeparableFilter2D; + + /* ARB 1. GL_ARB_multitexture */ + glAPI->ActiveTextureARB = __indirect_glActiveTextureARB; + glAPI->ClientActiveTextureARB = __indirect_glClientActiveTextureARB; + glAPI->MultiTexCoord1dARB = __indirect_glMultiTexCoord1dARB; + glAPI->MultiTexCoord1dvARB = __indirect_glMultiTexCoord1dvARB; + glAPI->MultiTexCoord1fARB = __indirect_glMultiTexCoord1fARB; + glAPI->MultiTexCoord1fvARB = __indirect_glMultiTexCoord1fvARB; + glAPI->MultiTexCoord1iARB = __indirect_glMultiTexCoord1iARB; + glAPI->MultiTexCoord1ivARB = __indirect_glMultiTexCoord1ivARB; + glAPI->MultiTexCoord1sARB = __indirect_glMultiTexCoord1sARB; + glAPI->MultiTexCoord1svARB = __indirect_glMultiTexCoord1svARB; + glAPI->MultiTexCoord2dARB = __indirect_glMultiTexCoord2dARB; + glAPI->MultiTexCoord2dvARB = __indirect_glMultiTexCoord2dvARB; + glAPI->MultiTexCoord2fARB = __indirect_glMultiTexCoord2fARB; + glAPI->MultiTexCoord2fvARB = __indirect_glMultiTexCoord2fvARB; + glAPI->MultiTexCoord2iARB = __indirect_glMultiTexCoord2iARB; + glAPI->MultiTexCoord2ivARB = __indirect_glMultiTexCoord2ivARB; + glAPI->MultiTexCoord2sARB = __indirect_glMultiTexCoord2sARB; + glAPI->MultiTexCoord2svARB = __indirect_glMultiTexCoord2svARB; + glAPI->MultiTexCoord3dARB = __indirect_glMultiTexCoord3dARB; + glAPI->MultiTexCoord3dvARB = __indirect_glMultiTexCoord3dvARB; + glAPI->MultiTexCoord3fARB = __indirect_glMultiTexCoord3fARB; + glAPI->MultiTexCoord3fvARB = __indirect_glMultiTexCoord3fvARB; + glAPI->MultiTexCoord3iARB = __indirect_glMultiTexCoord3iARB; + glAPI->MultiTexCoord3ivARB = __indirect_glMultiTexCoord3ivARB; + glAPI->MultiTexCoord3sARB = __indirect_glMultiTexCoord3sARB; + glAPI->MultiTexCoord3svARB = __indirect_glMultiTexCoord3svARB; + glAPI->MultiTexCoord4dARB = __indirect_glMultiTexCoord4dARB; + glAPI->MultiTexCoord4dvARB = __indirect_glMultiTexCoord4dvARB; + glAPI->MultiTexCoord4fARB = __indirect_glMultiTexCoord4fARB; + glAPI->MultiTexCoord4fvARB = __indirect_glMultiTexCoord4fvARB; + glAPI->MultiTexCoord4iARB = __indirect_glMultiTexCoord4iARB; + glAPI->MultiTexCoord4ivARB = __indirect_glMultiTexCoord4ivARB; + glAPI->MultiTexCoord4sARB = __indirect_glMultiTexCoord4sARB; + glAPI->MultiTexCoord4svARB = __indirect_glMultiTexCoord4svARB; + return glAPI; } diff --git a/xc/lib/GL/glx/packrender.h b/xc/lib/GL/glx/packrender.h index cc699ada5..0dc695742 100644 --- a/xc/lib/GL/glx/packrender.h +++ b/xc/lib/GL/glx/packrender.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/lib/GL/glx/packrender.h,v 1.6 2001/03/21 16:04:39 dawes Exp $ */ #ifndef __GLX_packrender_h__ #define __GLX_packrender_h__ -/* $XFree86: xc/lib/GL/glx/packrender.h,v 1.5 2000/02/18 16:23:10 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_GL_FUNCS_WRAPPED @@ -54,9 +68,9 @@ #define __GLX_LOAD_VARIABLES() \ gc = __glXGetCurrentContext(); \ pc = gc->pc; \ - (void) pixelHeaderPC; \ + (void) cmdlen; \ (void) compsize; \ - (void) cmdlen + (void) pixelHeaderPC /* ** Variable sized command support macro. This macro is used by calls @@ -95,6 +109,24 @@ pixelHeaderPC = pc; \ pc += __GLX_PIXEL_HDR_SIZE +#define __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(opcode,size) \ + if (pc + (size) > gc->bufEnd) { \ + pc = __glXFlushRenderBuffer(gc, pc); \ + } \ + __GLX_PUT_SHORT(0,size); \ + __GLX_PUT_SHORT(2,opcode); \ + pc += __GLX_RENDER_HDR_SIZE; \ + pixelHeaderPC = pc; \ + pc += __GLX_PIXEL_3D_HDR_SIZE + +#define __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(opcode,size) \ + pc = __glXFlushRenderBuffer(gc, pc); \ + __GLX_PUT_LONG(0,size); \ + __GLX_PUT_LONG(4,opcode); \ + pc += __GLX_RENDER_LARGE_HDR_SIZE; \ + pixelHeaderPC = pc; \ + pc += __GLX_PIXEL_3D_HDR_SIZE + /* ** Fixed size command support macro. This macro is used by calls that ** are never larger than __GLX_SMALL_RENDER_CMD_SIZE. Because they diff --git a/xc/lib/GL/glx/packsingle.h b/xc/lib/GL/glx/packsingle.h index f3195a274..db73d80bf 100644 --- a/xc/lib/GL/glx/packsingle.h +++ b/xc/lib/GL/glx/packsingle.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/lib/GL/glx/packsingle.h,v 1.5 2001/03/21 16:04:39 dawes Exp $ */ #ifndef __GLX_packsingle_h__ #define __GLX_packsingle_h__ -/* $XFree86: xc/lib/GL/glx/packsingle.h,v 1.4 2000/08/28 16:04:48 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "packrender.h" diff --git a/xc/lib/GL/glx/packvendpriv.h b/xc/lib/GL/glx/packvendpriv.h index aa3cf8146..208c324dd 100644 --- a/xc/lib/GL/glx/packvendpriv.h +++ b/xc/lib/GL/glx/packvendpriv.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/lib/GL/glx/packvendpriv.h,v 1.5 2001/04/01 13:59:59 tsi Exp $ */ #ifndef __GLX_packvendpriv_h__ #define __GLX_packvendpriv_h__ -/* $XFree86: xc/lib/GL/glx/packvendpriv.h,v 1.3 2000/02/08 17:18:34 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "packrender.h" @@ -86,7 +100,7 @@ *((FLOAT32 *) (pc + offset)) = a #else -#define __GLX_VENDPRIV_PUT_SHORT(offset,a) \ +#define __GLX_VENDPRIV_PUT_SHORT(offset,a) \ { GLubyte *cp = (pc+offset); \ int shift = (64-16) - ((int)(cp) >> (64-6)); \ *(int *)cp = (*(int *)cp & ~(0xffff << shift)) | ((a & 0xffff) << shift); } diff --git a/xc/lib/GL/glx/pixel.c b/xc/lib/GL/glx/pixel.c index a1dd3637c..8f771e306 100644 --- a/xc/lib/GL/glx/pixel.c +++ b/xc/lib/GL/glx/pixel.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/lib/GL/glx/pixel.c,v 1.3 2000/02/08 17:18:34 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/pixel.c,v 1.4 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "packrender.h" @@ -68,14 +82,38 @@ static GLubyte HighBitsMask[9] = { /* ** Return the number of elements per group of a specified format */ -static GLint ElementsPerGroup(GLenum format) +static GLint ElementsPerGroup(GLenum format, GLenum type) { + /* + ** To make row length computation valid for image extraction, + ** packed pixel types assume elements per group equals one. + */ + switch(type) { + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + return 1; + default: + break; + } + switch(format) { case GL_RGB: + case GL_BGR: return 3; case GL_LUMINANCE_ALPHA: return 2; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: return 4; case GL_COLOR_INDEX: @@ -101,13 +139,25 @@ static GLint BytesPerElement(GLenum type) switch(type) { case GL_UNSIGNED_SHORT: case GL_SHORT: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: return 2; case GL_UNSIGNED_BYTE: case GL_BYTE: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: return 1; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: return 4; default: return 0; @@ -118,24 +168,25 @@ static GLint BytesPerElement(GLenum type) ** Compute memory required for internal packed array of data of given type ** and format. */ -GLint __glImageSize(GLsizei width, GLsizei height, GLenum format, GLenum type) +GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type) { int bytes_per_row; int components; - if (width < 0 || height < 0) { + if (width < 0 || height < 0 || depth < 0) { return 0; } /* ** Zero is returned if either format or type are invalid. */ - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (type == GL_BITMAP) { bytes_per_row = (width + 7) >> 3; } else { bytes_per_row = BytesPerElement(type) * width; } - return bytes_per_row * height * components; + return bytes_per_row * height * depth * components; } /* @@ -148,6 +199,7 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, GLubyte *destImage) { GLint rowLength = gc->state.storeUnpack.rowLength; + GLint imageHeight = gc->state.storeUnpack.imageHeight; GLint alignment = gc->state.storeUnpack.alignment; GLint skipPixels = gc->state.storeUnpack.skipPixels; GLint skipRows = gc->state.storeUnpack.skipRows; @@ -162,7 +214,7 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, } else { groupsPerRow = width; } - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,GL_BITMAP); rowSize = (groupsPerRow * components + 7) >> 3; padding = (rowSize % alignment); if (padding) { @@ -213,35 +265,43 @@ static void FillBitmap(__GLXcontext *gc, GLint width, GLint height, start += rowSize; } } + /* ** Extract array from user's data applying all pixel store modes. ** The internal packed array format used has LSB_FIRST = FALSE and ** ALIGNMENT = 1. */ -void __glFillImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, - GLenum type, const GLvoid *userdata, GLubyte *newimage, - GLubyte *modes) +void __glFillImage(__GLXcontext *gc, GLint dim, GLint width, GLint height, + GLint depth, GLenum format, GLenum type, + const GLvoid *userdata, GLubyte *newimage, GLubyte *modes) { GLint rowLength = gc->state.storeUnpack.rowLength; + GLint imageHeight = gc->state.storeUnpack.imageHeight; + GLint imageDepth = gc->state.storeUnpack.imageDepth; GLint alignment = gc->state.storeUnpack.alignment; GLint skipPixels = gc->state.storeUnpack.skipPixels; GLint skipRows = gc->state.storeUnpack.skipRows; + GLint skipImages = gc->state.storeUnpack.skipImages; GLint swapBytes = gc->state.storeUnpack.swapEndian; GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize; - GLint elementsPerRow, i, j, k; - const GLubyte *start, *iter; + GLint elementsPerRow, imageSize, rowsPerImage, h, i, j, k; + const GLubyte *start, *iter, *itera, *iterb, *iterc; GLubyte *iter2; if (type == GL_BITMAP) { - /* All formats except GL_BITMAP fall out trivially */ FillBitmap(gc, width, height, format, userdata, newimage); } else { - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = width; } + if (imageHeight > 0) { + rowsPerImage = imageHeight; + } else { + rowsPerImage = height; + } elementSize = BytesPerElement(type); groupSize = elementSize * components; @@ -252,50 +312,77 @@ void __glFillImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, if (padding) { rowSize += alignment - padding; } - start = ((const GLubyte*) userdata) + skipRows * rowSize - + skipPixels * groupSize; + imageSize = rowSize * rowsPerImage; + start = ((const GLubyte*) userdata) + skipImages * imageSize + + skipRows * rowSize + skipPixels * groupSize; iter2 = newimage; elementsPerRow = width * components; if (swapBytes) { - for (i = 0; i < height; i++) { - iter = start; - for (j = 0; j < elementsPerRow; j++) { - for (k = 1; k <= elementSize; k++) { - iter2[k-1] = iter[elementSize - k]; + itera = start; + for (h = 0; h < depth; h++) { + iterb = itera; + for (i = 0; i < height; i++) { + iterc = iterb; + for (j = 0; j < elementsPerRow; j++) { + for (k = 1; k <= elementSize; k++) { + iter2[k-1] = iterc[elementSize - k]; + } + iter2 += elementSize; + iterc += elementSize; } - iter2 += elementSize; - iter += elementSize; + iterb += rowSize; } - start += rowSize; + itera += imageSize; } } else { - if (rowSize == elementsPerRow * elementSize) { - /* Ha! This is mondo easy! */ - __GLX_MEM_COPY(iter2, start, - elementsPerRow * elementSize * height); - } else { - iter = start; - for (i = 0; i < height; i++) { - __GLX_MEM_COPY(iter2, iter, elementsPerRow * elementSize); - iter2 += elementsPerRow * elementSize; - iter += rowSize; + itera = start; + for (h = 0; h < depth; h++) { + if (rowSize == elementsPerRow * elementSize) { + /* Ha! This is mondo easy! */ + __GLX_MEM_COPY(iter2, itera, + elementsPerRow * elementSize * height); + iter2 += elementsPerRow * elementSize * height; + } else { + iter = itera; + for (i = 0; i < height; i++) { + __GLX_MEM_COPY(iter2, iter, elementsPerRow*elementSize); + iter2 += elementsPerRow * elementSize; + iter += rowSize; + } } - } + itera += imageSize; + } } } /* Setup store modes that describe what we just did */ if (modes) { - GLubyte *pc = modes; - __GLX_PUT_CHAR(0,GL_FALSE); - __GLX_PUT_CHAR(1,GL_FALSE); - __GLX_PUT_CHAR(2,0); - __GLX_PUT_CHAR(3,0); - __GLX_PUT_LONG(4,0); - __GLX_PUT_LONG(8,0); - __GLX_PUT_LONG(12,0); - __GLX_PUT_LONG(16,1); + if (dim == 3) { + GLubyte *pc = modes; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } else { + GLubyte *pc = modes; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } } } @@ -319,7 +406,7 @@ static void EmptyBitmap(__GLXcontext *gc, GLint width, GLint height, GLint writeMask, i; GLubyte writeByte; - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,GL_BITMAP); if (rowLength > 0) { groupsPerRow = rowLength; } else { @@ -413,26 +500,37 @@ static void EmptyBitmap(__GLXcontext *gc, GLint width, GLint height, ** SWAP_BYTES = the current pixel storage pack mode, and ALIGNMENT = 4. ** Named __glEmptyImage() because it is the opposite of __glFillImage(). */ -void __glEmptyImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, - GLenum type, const GLubyte *sourceImage, GLvoid *userdata) +/* ARGSUSED */ +void __glEmptyImage(__GLXcontext *gc, GLint dim, GLint width, GLint height, + GLint depth, GLenum format, GLenum type, + const GLubyte *sourceImage, GLvoid *userdata) { GLint rowLength = gc->state.storePack.rowLength; + GLint imageHeight = gc->state.storePack.imageHeight; + GLint imageDepth = gc->state.storePack.imageDepth; GLint alignment = gc->state.storePack.alignment; GLint skipPixels = gc->state.storePack.skipPixels; GLint skipRows = gc->state.storePack.skipRows; + GLint skipImages = gc->state.storePack.skipImages; GLint components, elementSize, rowSize, padding, groupsPerRow, groupSize; - GLint elementsPerRow, sourceRowSize, sourcePadding, i; - GLubyte *start, *iter; + GLint elementsPerRow, sourceRowSize, sourcePadding, g, h, i; + GLint imageSize, rowsPerImage; + GLubyte *start, *iter, *itera; if (type == GL_BITMAP) { EmptyBitmap(gc, width, height, format, sourceImage, userdata); } else { - components = ElementsPerGroup(format); + components = ElementsPerGroup(format,type); if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = width; } + if (imageHeight > 0) { + rowsPerImage = imageHeight; + } else { + rowsPerImage = height; + } elementSize = BytesPerElement(type); groupSize = elementSize * components; rowSize = groupsPerRow * groupSize; @@ -445,22 +543,28 @@ void __glEmptyImage(__GLXcontext *gc, GLint width, GLint height, GLenum format, if (sourcePadding) { sourceRowSize += 4 - sourcePadding; } - start = ((GLubyte*) userdata) + skipRows * rowSize - + skipPixels * groupSize; + imageSize = sourceRowSize * rowsPerImage; + start = ((GLubyte*) userdata) + skipImages * imageSize + + skipRows * rowSize + skipPixels * groupSize; elementsPerRow = width * components; - if ((rowSize == sourceRowSize) && (sourcePadding == 0)) { - /* Ha! This is mondo easy! */ - __GLX_MEM_COPY(start, sourceImage, - elementsPerRow * elementSize * height); - } else { - iter = start; - for (i = 0; i < height; i++) { - __GLX_MEM_COPY(iter, sourceImage, - elementsPerRow * elementSize); - sourceImage += sourceRowSize; - iter += rowSize; + itera = start; + for (h = 0; h < depth; h++) { + if ((rowSize == sourceRowSize) && (sourcePadding == 0)) { + /* Ha! This is mondo easy! */ + __GLX_MEM_COPY(itera, sourceImage, + elementsPerRow * elementSize * height); + sourceImage += elementsPerRow * elementSize * height; + } else { + iter = itera; + for (i = 0; i < height; i++) { + __GLX_MEM_COPY(iter, sourceImage, + elementsPerRow * elementSize); + sourceImage += sourceRowSize; + iter += rowSize; + } } + itera += imageSize; } } } diff --git a/xc/lib/GL/glx/pixelstore.c b/xc/lib/GL/glx/pixelstore.c index 9dcef2057..ca62e1745 100644 --- a/xc/lib/GL/glx/pixelstore.c +++ b/xc/lib/GL/glx/pixelstore.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/lib/GL/glx/pixelstore.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/pixelstore.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "packsingle.h" @@ -42,6 +56,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storePack.rowLength = a; break; + case GL_PACK_IMAGE_HEIGHT: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.imageHeight = a; + break; case GL_PACK_SKIP_ROWS: a = (GLuint) (param + 0.5); if (((GLint) a) < 0) { @@ -58,6 +80,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storePack.skipPixels = a; break; + case GL_PACK_SKIP_IMAGES: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.skipImages = a; + break; case GL_PACK_ALIGNMENT: a = (GLint) (param + 0.5); switch (a) { @@ -84,6 +114,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storeUnpack.rowLength = a; break; + case GL_UNPACK_IMAGE_HEIGHT: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.imageHeight = a; + break; case GL_UNPACK_SKIP_ROWS: a = (GLuint) (param + 0.5); if (((GLint) a) < 0) { @@ -100,6 +138,14 @@ void glPixelStoref(GLenum pname, GLfloat param) } gc->state.storeUnpack.skipPixels = a; break; + case GL_UNPACK_SKIP_IMAGES: + a = (GLuint) (param + 0.5); + if (((GLint) a) < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.skipImages = a; + break; case GL_UNPACK_ALIGNMENT: a = (GLint) (param + 0.5); switch (a) { @@ -143,6 +189,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storePack.rowLength = param; break; + case GL_PACK_IMAGE_HEIGHT: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.imageHeight = param; + break; case GL_PACK_SKIP_ROWS: if (param < 0) { __glXSetError(gc, GL_INVALID_VALUE); @@ -157,6 +210,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storePack.skipPixels = param; break; + case GL_PACK_SKIP_IMAGES: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storePack.skipImages = param; + break; case GL_PACK_ALIGNMENT: switch (param) { case 1: case 2: case 4: case 8: @@ -181,6 +241,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storeUnpack.rowLength = param; break; + case GL_UNPACK_IMAGE_HEIGHT: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.imageHeight = param; + break; case GL_UNPACK_SKIP_ROWS: if (param < 0) { __glXSetError(gc, GL_INVALID_VALUE); @@ -195,6 +262,13 @@ void glPixelStorei(GLenum pname, GLint param) } gc->state.storeUnpack.skipPixels = param; break; + case GL_UNPACK_SKIP_IMAGES: + if (param < 0) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + gc->state.storeUnpack.skipImages = param; + break; case GL_UNPACK_ALIGNMENT: switch (param) { case 1: case 2: case 4: case 8: diff --git a/xc/lib/GL/glx/render2.c b/xc/lib/GL/glx/render2.c index 099bd9747..d19a1de4f 100644 --- a/xc/lib/GL/glx/render2.c +++ b/xc/lib/GL/glx/render2.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/lib/GL/glx/render2.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/render2.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "packrender.h" @@ -412,24 +426,26 @@ void glEnable(GLenum cap) if (!gc->currentDpy) return; switch (cap) { - case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_TRUE; +#if 0 + case GL_VERTEX_ARRAY_EXT: + gc->state.vertArray.vertex.enable = GL_TRUE; return; - case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_TRUE; + case GL_NORMAL_ARRAY_EXT: + gc->state.vertArray.normal.enable = GL_TRUE; return; - case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_TRUE; + case GL_COLOR_ARRAY_EXT: + gc->state.vertArray.color.enable = GL_TRUE; return; - case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_TRUE; + case GL_INDEX_ARRAY_EXT: + gc->state.vertArray.index.enable = GL_TRUE; return; - case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_TRUE; + case GL_TEXTURE_COORD_ARRAY_EXT: + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_TRUE; return; - case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_TRUE; + case GL_EDGE_FLAG_ARRAY_EXT: + gc->state.vertArray.edgeFlag.enable = GL_TRUE; return; +#endif } __GLX_BEGIN(X_GLrop_Enable,8); __GLX_PUT_LONG(4,cap); @@ -444,24 +460,26 @@ void glDisable(GLenum cap) if (!gc->currentDpy) return; switch (cap) { - case GL_VERTEX_ARRAY: - gc->state.vertArray.vertexEnable = GL_FALSE; +#if 0 + case GL_VERTEX_ARRAY_EXT: + gc->state.vertArray.vertex.enable = GL_FALSE; return; - case GL_NORMAL_ARRAY: - gc->state.vertArray.normalEnable = GL_FALSE; + case GL_NORMAL_ARRAY_EXT: + gc->state.vertArray.normal.enable = GL_FALSE; return; - case GL_COLOR_ARRAY: - gc->state.vertArray.colorEnable = GL_FALSE; + case GL_COLOR_ARRAY_EXT: + gc->state.vertArray.color.enable = GL_FALSE; return; - case GL_INDEX_ARRAY: - gc->state.vertArray.indexEnable = GL_FALSE; + case GL_INDEX_ARRAY_EXT: + gc->state.vertArray.index.enable = GL_FALSE; return; - case GL_TEXTURE_COORD_ARRAY: - gc->state.vertArray.texCoordEnable = GL_FALSE; + case GL_TEXTURE_COORD_ARRAY_EXT: + gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable = GL_FALSE; return; - case GL_EDGE_FLAG_ARRAY: - gc->state.vertArray.edgeFlagEnable = GL_FALSE; + case GL_EDGE_FLAG_ARRAY_EXT: + gc->state.vertArray.edgeFlag.enable = GL_FALSE; return; +#endif } __GLX_BEGIN(X_GLrop_Disable,8); __GLX_PUT_LONG(4,cap); diff --git a/xc/lib/GL/glx/renderpix.c b/xc/lib/GL/glx/renderpix.c index e6b34567d..a4eb61e8c 100644 --- a/xc/lib/GL/glx/renderpix.c +++ b/xc/lib/GL/glx/renderpix.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/lib/GL/glx/renderpix.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/renderpix.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "packrender.h" @@ -40,8 +54,8 @@ ** Send a large image to the server. If necessary, a buffer is allocated ** to hold the unpacked data that is copied from the clients memory. */ -static void SendLargeImage(__GLXcontext *gc, - GLint compsize, GLint width, GLint height, +static void SendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim, + GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *src, GLubyte *pc, GLubyte *modes) { @@ -54,7 +68,8 @@ static void SendLargeImage(__GLXcontext *gc, } /* Apply pixel store unpack modes to copy data into buf */ - (*gc->fillImage)(gc, width, height, format, type, src, buf, modes); + (*gc->fillImage)(gc, dim, width, height, depth, format, type, src, buf, + modes); /* Send large command */ __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize); @@ -70,10 +85,10 @@ static void SendLargeImage(__GLXcontext *gc, /* ** Send a large null image to the server. To be backwards compatible, ** data must be sent to the server even when the application has passed -** a null pointer into glTexImage1D or glTexImage2D. +** a null pointer into glTexImage1D, glTexImage2D or glTexImage3D. */ -static void SendLargeNULLImage(__GLXcontext *gc, - GLint compsize, GLint width, GLint height, +static void SendLargeNULLImage(__GLXcontext *gc, GLint compsize, + GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *src, GLubyte *pc, GLubyte *modes) { @@ -98,7 +113,7 @@ void glPolygonStipple(const GLubyte *mask) { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(32, 32, GL_COLOR_INDEX, GL_BITMAP); + compsize = __glImageSize(32, 32, 1, GL_COLOR_INDEX, GL_BITMAP); cmdlen = __GLX_PAD(__GLX_POLYGONSTIPPLE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -107,7 +122,7 @@ void glPolygonStipple(const GLubyte *mask) pc += __GLX_RENDER_HDR_SIZE; pixelHeaderPC = pc; pc += __GLX_PIXEL_HDR_SIZE; - (*gc->fillImage)(gc, 32, 32, GL_COLOR_INDEX, GL_BITMAP, + (*gc->fillImage)(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask, pc, pixelHeaderPC); __GLX_END(__GLX_PAD(compsize)); } @@ -117,7 +132,7 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(width, height, GL_COLOR_INDEX, GL_BITMAP); + compsize = __glImageSize(width, height, 1, GL_COLOR_INDEX, GL_BITMAP); cmdlen = __GLX_PAD(__GLX_BITMAP_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -133,8 +148,8 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, __GLX_PUT_FLOAT(20,ymove); pc += __GLX_BITMAP_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, GL_COLOR_INDEX, GL_BITMAP, - bitmap, pc, pixelHeaderPC); + (*gc->fillImage)(gc, 2, width, height, 1, GL_COLOR_INDEX, + GL_BITMAP, bitmap, pc, pixelHeaderPC); } else { /* Setup default store modes */ GLubyte *pc = pixelHeaderPC; @@ -158,7 +173,7 @@ void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, __GLX_PUT_FLOAT(16,xmove); __GLX_PUT_FLOAT(20,ymove); pc += __GLX_BITMAP_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, GL_COLOR_INDEX, + SendLargeImage(gc, compsize, 2, width, height, 1, GL_COLOR_INDEX, GL_BITMAP, bitmap, pc, pixelHeaderPC); } } @@ -172,7 +187,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, if (target == GL_PROXY_TEXTURE_1D) { compsize = 0; } else { - compsize = __glImageSize(width, 1, format, type); + compsize = __glImageSize(width, 1, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXIMAGE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); @@ -190,7 +205,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (compsize > 0 && image != NULL) { - (*gc->fillImage)(gc, width, 1, format, type, + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -218,7 +233,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (image != NULL) { - SendLargeImage(gc, compsize, width, 1, format, + SendLargeImage(gc, compsize, 1, width, 1, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -233,7 +248,7 @@ void glTexImage1D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(12,0); __GLX_PUT_LONG(16,1); } - SendLargeNULLImage(gc, compsize, width, 1, format, + SendLargeNULLImage(gc, compsize, width, 1, 1, format, type, image, pc, pixelHeaderPC); } } @@ -248,7 +263,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, if (target == GL_PROXY_TEXTURE_2D) { compsize = 0; } else { - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXIMAGE_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); @@ -267,7 +282,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (compsize > 0 && image != NULL) { - (*gc->fillImage)(gc, width, height, format, type, + (*gc->fillImage)(gc, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -295,7 +310,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(28,type); pc += __GLX_TEXIMAGE_HDR_SIZE; if (image != NULL) { - SendLargeImage(gc, compsize, width, height, format, + SendLargeImage(gc, compsize, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -310,7 +325,7 @@ void glTexImage2D(GLenum target, GLint level, GLint components, __GLX_PUT_LONG(12,0); __GLX_PUT_LONG(16,1); } - SendLargeNULLImage(gc, compsize, width, height, format, + SendLargeNULLImage(gc, compsize, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -321,7 +336,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, { __GLX_DECLARE_VARIABLES(); - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); cmdlen = __GLX_PAD(__GLX_DRAWPIXELS_CMD_HDR_SIZE + compsize); __GLX_LOAD_VARIABLES(); if (!gc->currentDpy) return; @@ -335,7 +350,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, __GLX_PUT_LONG(12,type); pc += __GLX_DRAWPIXELS_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, format, type, + (*gc->fillImage)(gc, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } else { /* Setup default store modes */ @@ -358,7 +373,7 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, __GLX_PUT_LONG(8,format); __GLX_PUT_LONG(12,type); pc += __GLX_DRAWPIXELS_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, format, + SendLargeImage(gc, compsize, 2, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -366,14 +381,14 @@ void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, - const GLvoid *image) + const GLvoid *image, GLint dim) { __GLX_DECLARE_VARIABLES(); if (image == NULL) { compsize = 0; } else { - compsize = __glImageSize(width, height, format, type); + compsize = __glImageSize(width, height, 1, format, type); } cmdlen = __GLX_PAD(__GLX_TEXSUBIMAGE_CMD_HDR_SIZE + compsize); @@ -398,8 +413,8 @@ static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, } pc += __GLX_TEXSUBIMAGE_HDR_SIZE; if (compsize > 0) { - (*gc->fillImage)(gc, width, height, format, type, image, - pc, pixelHeaderPC); + (*gc->fillImage)(gc, dim, width, height, 1, format, type, image, + pc, pixelHeaderPC); } else { /* Setup default store modes */ GLubyte *pc = pixelHeaderPC; @@ -430,7 +445,7 @@ static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level, __GLX_PUT_LONG(32,GL_FALSE); } pc += __GLX_TEXSUBIMAGE_HDR_SIZE; - SendLargeImage(gc, compsize, width, height, + SendLargeImage(gc, compsize, dim, width, height, 1, format, type, image, pc, pixelHeaderPC); } } @@ -440,7 +455,7 @@ void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, const GLvoid *image) { __glx_TexSubImage1D2D(X_GLrop_TexSubImage1D, target, level, xoffset, - 0, width, 1, format, type, image); + 0, width, 1, format, type, image, 1); } void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, @@ -448,6 +463,442 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLenum format, GLenum type, const GLvoid *image) { __glx_TexSubImage1D2D(X_GLrop_TexSubImage2D, target, level, xoffset, - yoffset, width, height, format, type, image); + yoffset, width, height, format, type, image, 2); +} + +void glColorTable(GLenum target, GLenum internalformat, GLsizei width, + GLenum format, GLenum type, const GLvoid *table) +{ + __GLX_DECLARE_VARIABLES(); + + switch (target) { + case GL_PROXY_TEXTURE_1D: + case GL_PROXY_TEXTURE_2D: + case GL_PROXY_TEXTURE_3D: + case GL_PROXY_COLOR_TABLE: + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + compsize = 0; + break; + default: + compsize = __glImageSize(width, 1, 1, format, type); + break; + } + cmdlen = __GLX_PAD(__GLX_COLOR_TABLE_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) { + return; + } + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_ColorTable, (short)cmdlen); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, (long)internalformat); + __GLX_PUT_LONG(8, width); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_TABLE_HDR_SIZE; + if (compsize > 0 && table != NULL) { + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, table, pc, + pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0, GL_FALSE); + __GLX_PUT_CHAR(1, GL_FALSE); + __GLX_PUT_CHAR(2, 0); + __GLX_PUT_CHAR(3, 0); + __GLX_PUT_LONG(4, 0); + __GLX_PUT_LONG(8, 0); + __GLX_PUT_LONG(12, 0); + __GLX_PUT_LONG(16, 1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_ColorTable, cmdlen+4); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, (long)internalformat); + __GLX_PUT_LONG(8, width); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_TABLE_HDR_SIZE; + SendLargeImage(gc, compsize, 1, width, 1, 1, format, + type, table, pc, pixelHeaderPC); + } +} + +void glColorSubTable(GLenum target, GLsizei start, GLsizei count, + GLenum format, GLenum type, const GLvoid *table) +{ + __GLX_DECLARE_VARIABLES(); + + compsize = __glImageSize(count, 1, 1, format, type); + cmdlen = __GLX_PAD(__GLX_COLOR_SUBTABLE_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) { + return; + } + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_ColorSubTable, (short)cmdlen); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, start); + __GLX_PUT_LONG(8, count); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_SUBTABLE_HDR_SIZE; + if (compsize > 0 && table != NULL) { + (*gc->fillImage)(gc, 1, start+count, 1, 1, format, type, table, pc, + pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0, GL_FALSE); + __GLX_PUT_CHAR(1, GL_FALSE); + __GLX_PUT_CHAR(2, 0); + __GLX_PUT_CHAR(3, 0); + __GLX_PUT_LONG(4, 0); + __GLX_PUT_LONG(8, 0); + __GLX_PUT_LONG(12, 0); + __GLX_PUT_LONG(16, 1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_ColorSubTable, cmdlen+4); + __GLX_PUT_LONG(0, (long)target); + __GLX_PUT_LONG(4, start); + __GLX_PUT_LONG(8, count); + __GLX_PUT_LONG(12, (long)format); + __GLX_PUT_LONG(16, (long)type); + pc += __GLX_COLOR_SUBTABLE_HDR_SIZE; + SendLargeImage(gc, compsize, 1, start+count, 1, 1, format, + type, table, pc, pixelHeaderPC); + } +} + +static void __glx_ConvolutionFilter1D2D(GLshort opcode, GLint dim, + GLenum target, + GLenum internalformat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + compsize = __glImageSize(width, height, 1, format, type); + cmdlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode, cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += __GLX_CONV_FILT_HDR_SIZE; + if (compsize > 0) { + (*gc->fillImage)(gc, dim, width, height, 1, format, type, + image, pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += __GLX_CONV_FILT_HDR_SIZE; + SendLargeImage(gc, compsize, dim, width, height, 1, format, + type, image, pc, pixelHeaderPC); + } +} + +void glConvolutionFilter1D(GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *image) +{ + __glx_ConvolutionFilter1D2D(X_GLrop_ConvolutionFilter1D, 1, target, + internalformat, width, 1, format, type, + image); +} + +void glConvolutionFilter2D(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image) +{ + __glx_ConvolutionFilter1D2D(X_GLrop_ConvolutionFilter2D, 2, target, + internalformat, width, height, format, type, + image); +} + +void glSeparableFilter2D(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, + const GLvoid *column) +{ + __GLX_DECLARE_VARIABLES(); + GLuint compsize2, hdrlen, totalhdrlen, image1len, image2len; + + compsize = __glImageSize(width, 1, 1, format, type); + compsize2 = __glImageSize(height, 1, 1, format, type); + totalhdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); + hdrlen = __GLX_PAD(__GLX_CONV_FILT_HDR_SIZE); + image1len = __GLX_PAD(compsize); + image2len = __GLX_PAD(compsize2); + cmdlen = totalhdrlen + image1len + image2len; + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_SeparableFilter2D, cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += hdrlen; + if (compsize > 0) { + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, + row, pc, pixelHeaderPC); + pc += image1len; + } + if (compsize2 > 0) { + (*gc->fillImage)(gc, 1, height, 1, 1, format, type, + column, pc, NULL); + pc += image2len; + } + if ((compsize == 0) && (compsize2 == 0)) { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,1); + } + __GLX_END(0); + } else { + GLint bufsize; + + bufsize = image1len + image2len; + + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_SeparableFilter2D,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,internalformat); + __GLX_PUT_LONG(8,width); + __GLX_PUT_LONG(12,height); + __GLX_PUT_LONG(16,format); + __GLX_PUT_LONG(20,type); + pc += hdrlen; + + if (!gc->fastImageUnpack) { + /* Allocate a temporary holding buffer */ + GLubyte *buf = (GLubyte *) Xmalloc(bufsize); + if (!buf) { + __glXSetError(gc, GL_OUT_OF_MEMORY); + return; + } + (*gc->fillImage)(gc, 1, width, 1, 1, format, type, row, buf, pixelHeaderPC); + + (*gc->fillImage)(gc, 1, height, 1, 1, format, type, column, + buf + image1len, pixelHeaderPC); + + /* Send large command */ + __glXSendLargeCommand(gc, gc->pc, (GLint)(pc - gc->pc), buf, bufsize); + /* Free buffer */ + Xfree((char*) buf); + } else { + /* Just send the data straight as is */ + __glXSendLargeCommand(gc, gc->pc, (GLint)(pc - gc->pc), pc, bufsize); + } + } +} + +void glTexImage3D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLsizei depth, GLint border, + GLenum format, GLenum type, const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + if ((target == GL_PROXY_TEXTURE_3D) || (image == NULL)) { + compsize = 0; + } else { + compsize = __glImageSize(width, height, depth, format, type); + } + cmdlen = __GLX_PAD(__GLX_TEXIMAGE_3D_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(X_GLrop_TexImage3D,cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,width); + __GLX_PUT_LONG(16,height); + __GLX_PUT_LONG(20,depth); + __GLX_PUT_LONG(24,0); /* size4d */ + __GLX_PUT_LONG(28,border); + __GLX_PUT_LONG(32,format); + __GLX_PUT_LONG(36,type); + if (image == NULL) { + __GLX_PUT_LONG(40,GL_TRUE); + } else { + __GLX_PUT_LONG(40,GL_FALSE); + } + pc += __GLX_TEXIMAGE_3D_HDR_SIZE; + if (compsize > 0 && image != NULL) { + (*gc->fillImage)(gc, 3, width, height, depth, format, type, + image, pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(X_GLrop_TexImage3D,cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,internalformat); + __GLX_PUT_LONG(12,width); + __GLX_PUT_LONG(16,height); + __GLX_PUT_LONG(20,depth); + __GLX_PUT_LONG(24,0); /* size4d */ + __GLX_PUT_LONG(28,border); + __GLX_PUT_LONG(32,format); + __GLX_PUT_LONG(36,type); + if (image == NULL) { + __GLX_PUT_LONG(40,GL_TRUE); + } else { + __GLX_PUT_LONG(40,GL_FALSE); + } + pc += __GLX_TEXIMAGE_3D_HDR_SIZE; + SendLargeImage(gc, compsize, 3, width, height, depth, format, + type, image, pc, pixelHeaderPC); + } } +void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, + GLsizei depth, GLenum format, GLenum type, + const GLvoid *image) +{ + __GLX_DECLARE_VARIABLES(); + + if (image == NULL) { + compsize = 0; + } else { + compsize = __glImageSize(width, height, depth, format, type); + } + cmdlen = __GLX_PAD(__GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE + compsize); + __GLX_LOAD_VARIABLES(); + if (!gc->currentDpy) return; + + if (cmdlen <= gc->maxSmallRenderCommandSize) { + /* Use GLXRender protocol to send small command */ + __GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(X_GLrop_TexSubImage3D,cmdlen); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,xoffset); + __GLX_PUT_LONG(12,yoffset); + __GLX_PUT_LONG(16,zoffset); + __GLX_PUT_LONG(20,0); /* woffset */ + __GLX_PUT_LONG(24,width); + __GLX_PUT_LONG(28,height); + __GLX_PUT_LONG(32,depth); + __GLX_PUT_LONG(36,0); /* size4d */ + __GLX_PUT_LONG(40,format); + __GLX_PUT_LONG(44,type); + if (image == NULL) { + __GLX_PUT_LONG(48,GL_TRUE); + } else { + __GLX_PUT_LONG(48,GL_FALSE); + } + pc += __GLX_TEXSUBIMAGE_3D_HDR_SIZE; + if (compsize > 0) { + (*gc->fillImage)(gc, 3, width, height, depth, format, type, image, + pc, pixelHeaderPC); + } else { + /* Setup default store modes */ + GLubyte *pc = pixelHeaderPC; + __GLX_PUT_CHAR(0,GL_FALSE); + __GLX_PUT_CHAR(1,GL_FALSE); + __GLX_PUT_CHAR(2,0); + __GLX_PUT_CHAR(3,0); + __GLX_PUT_LONG(4,0); + __GLX_PUT_LONG(8,0); + __GLX_PUT_LONG(12,0); + __GLX_PUT_LONG(16,0); + __GLX_PUT_LONG(20,0); + __GLX_PUT_LONG(24,0); + __GLX_PUT_LONG(28,0); + __GLX_PUT_LONG(32,1); + } + __GLX_END(__GLX_PAD(compsize)); + } else { + /* Use GLXRenderLarge protocol to send command */ + __GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(X_GLrop_TexSubImage3D, + cmdlen+4); + __GLX_PUT_LONG(0,target); + __GLX_PUT_LONG(4,level); + __GLX_PUT_LONG(8,xoffset); + __GLX_PUT_LONG(12,yoffset); + __GLX_PUT_LONG(16,zoffset); + __GLX_PUT_LONG(20,0); /* woffset */ + __GLX_PUT_LONG(24,width); + __GLX_PUT_LONG(28,height); + __GLX_PUT_LONG(32,depth); + __GLX_PUT_LONG(36,0); /* size4d */ + __GLX_PUT_LONG(40,format); + __GLX_PUT_LONG(44,type); + if (image == NULL) { + __GLX_PUT_LONG(48,GL_TRUE); + } else { + __GLX_PUT_LONG(48,GL_FALSE); + } + pc += __GLX_TEXSUBIMAGE_3D_HDR_SIZE; + SendLargeImage(gc, compsize, 3, width, height, depth, format, type, + image, pc, pixelHeaderPC); + } +} diff --git a/xc/lib/GL/glx/single2.c b/xc/lib/GL/glx/single2.c index 2d2998729..a027ff129 100644 --- a/xc/lib/GL/glx/single2.c +++ b/xc/lib/GL/glx/single2.c @@ -1,27 +1,42 @@ -/* $XFree86: xc/lib/GL/glx/single2.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/single2.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ -#include "packsingle.h" +#define NEED_GL_FUNCS_WRAPPED #include "glxclient.h" +#include "packsingle.h" GLenum glGetError(void) { @@ -86,12 +101,18 @@ void glGetBooleanv(GLenum val, GLboolean *b) case GL_PACK_ROW_LENGTH: *b = (GLboolean)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *b = (GLboolean)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *b = (GLboolean)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *b = (GLboolean)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *b = (GLboolean)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *b = (GLboolean)gc->state.storePack.alignment; break; @@ -104,12 +125,18 @@ void glGetBooleanv(GLenum val, GLboolean *b) case GL_UNPACK_ROW_LENGTH: *b = (GLboolean)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *b = (GLboolean)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *b = (GLboolean)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *b = (GLboolean)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *b = (GLboolean)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *b = (GLboolean)gc->state.storeUnpack.alignment; break; @@ -120,68 +147,77 @@ void glGetBooleanv(GLenum val, GLboolean *b) *b = (GLboolean)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *b = (GLboolean)gc->state.vertArray.vertexEnable; + *b = (GLboolean)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.vertexSize; + *b = (GLboolean)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.vertexType; + *b = (GLboolean)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.vertexStride; + *b = (GLboolean)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *b = (GLboolean)gc->state.vertArray.normalEnable; + *b = (GLboolean)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.normalType; + *b = (GLboolean)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.normalStride; + *b = (GLboolean)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *b = (GLboolean)gc->state.vertArray.colorEnable; + *b = (GLboolean)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.colorSize; + *b = (GLboolean)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.colorType; + *b = (GLboolean)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.colorStride; + *b = (GLboolean)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *b = (GLboolean)gc->state.vertArray.indexEnable; + *b = (GLboolean)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.indexType; + *b = (GLboolean)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.indexStride; + *b = (GLboolean)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *b = (GLboolean)gc->state.vertArray.texCoordEnable; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *b = (GLboolean)gc->state.vertArray.texCoordSize; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *b = (GLboolean)gc->state.vertArray.texCoordType; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.texCoordStride; + *b = (GLboolean)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *b = (GLboolean)gc->state.vertArray.edgeFlagEnable; + *b = (GLboolean)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *b = (GLboolean)gc->state.vertArray.edgeFlagStride; + *b = (GLboolean)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *b = (GLboolean)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *b = (GLboolean)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *b = (GLboolean)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *b = (GLboolean)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -223,12 +259,18 @@ void glGetDoublev(GLenum val, GLdouble *d) case GL_PACK_ROW_LENGTH: *d = (GLdouble)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *d = (GLdouble)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *d = (GLdouble)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *d = (GLdouble)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *d = (GLdouble)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *d = (GLdouble)gc->state.storePack.alignment; break; @@ -241,12 +283,18 @@ void glGetDoublev(GLenum val, GLdouble *d) case GL_UNPACK_ROW_LENGTH: *d = (GLdouble)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *d = (GLdouble)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *d = (GLdouble)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *d = (GLdouble)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *d = (GLdouble)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *d = (GLdouble)gc->state.storeUnpack.alignment; break; @@ -257,68 +305,77 @@ void glGetDoublev(GLenum val, GLdouble *d) *d = (GLdouble)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *d = (GLdouble)gc->state.vertArray.vertexEnable; + *d = (GLdouble)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.vertexSize; + *d = (GLdouble)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.vertexType; + *d = (GLdouble)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.vertexStride; + *d = (GLdouble)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *d = (GLdouble)gc->state.vertArray.normalEnable; + *d = (GLdouble)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.normalType; + *d = (GLdouble)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.normalStride; + *d = (GLdouble)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *d = (GLdouble)gc->state.vertArray.colorEnable; + *d = (GLdouble)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.colorSize; + *d = (GLdouble)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.colorType; + *d = (GLdouble)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.colorStride; + *d = (GLdouble)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *d = (GLdouble)gc->state.vertArray.indexEnable; + *d = (GLdouble)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.indexType; + *d = (GLdouble)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.indexStride; + *d = (GLdouble)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *d = (GLdouble)gc->state.vertArray.texCoordEnable; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *d = (GLdouble)gc->state.vertArray.texCoordSize; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *d = (GLdouble)gc->state.vertArray.texCoordType; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.texCoordStride; + *d = (GLdouble)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *d = (GLdouble)gc->state.vertArray.edgeFlagEnable; + *d = (GLdouble)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *d = (GLdouble)gc->state.vertArray.edgeFlagStride; + *d = (GLdouble)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *d = (GLdouble)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *d = (GLdouble)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *d = (GLdouble)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *d = (GLdouble)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -360,12 +417,18 @@ void glGetFloatv(GLenum val, GLfloat *f) case GL_PACK_ROW_LENGTH: *f = (GLfloat)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *f = (GLfloat)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *f = (GLfloat)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *f = (GLfloat)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *f = (GLfloat)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *f = (GLfloat)gc->state.storePack.alignment; break; @@ -378,12 +441,18 @@ void glGetFloatv(GLenum val, GLfloat *f) case GL_UNPACK_ROW_LENGTH: *f = (GLfloat)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *f = (GLfloat)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *f = (GLfloat)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *f = (GLfloat)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *f = (GLfloat)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *f = (GLfloat)gc->state.storeUnpack.alignment; break; @@ -394,68 +463,77 @@ void glGetFloatv(GLenum val, GLfloat *f) *f = (GLfloat)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *f = (GLfloat)gc->state.vertArray.vertexEnable; + *f = (GLfloat)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.vertexSize; + *f = (GLfloat)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.vertexType; + *f = (GLfloat)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.vertexStride; + *f = (GLfloat)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *f = (GLfloat)gc->state.vertArray.normalEnable; + *f = (GLfloat)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.normalType; + *f = (GLfloat)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.normalStride; + *f = (GLfloat)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *f = (GLfloat)gc->state.vertArray.colorEnable; + *f = (GLfloat)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.colorSize; + *f = (GLfloat)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.colorType; + *f = (GLfloat)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.colorStride; + *f = (GLfloat)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *f = (GLfloat)gc->state.vertArray.indexEnable; + *f = (GLfloat)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.indexType; + *f = (GLfloat)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.indexStride; + *f = (GLfloat)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *f = (GLfloat)gc->state.vertArray.texCoordEnable; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *f = (GLfloat)gc->state.vertArray.texCoordSize; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *f = (GLfloat)gc->state.vertArray.texCoordType; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.texCoordStride; + *f = (GLfloat)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *f = (GLfloat)gc->state.vertArray.edgeFlagEnable; + *f = (GLfloat)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *f = (GLfloat)gc->state.vertArray.edgeFlagStride; + *f = (GLfloat)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *f = (GLfloat)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *f = (GLfloat)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *f = (GLfloat)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *f = (GLfloat)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -480,7 +558,7 @@ void glGetIntegerv(GLenum val, GLint *i) __GLX_SINGLE_PUT_LONG(0,val); __GLX_SINGLE_READ_XREPLY(); __GLX_SINGLE_GET_SIZE(compsize); - + if (compsize == 0) { /* ** Error occured; don't modify user's buffer. @@ -497,12 +575,18 @@ void glGetIntegerv(GLenum val, GLint *i) case GL_PACK_ROW_LENGTH: *i = (GLint)gc->state.storePack.rowLength; break; + case GL_PACK_IMAGE_HEIGHT: + *i = (GLint)gc->state.storePack.imageHeight; + break; case GL_PACK_SKIP_ROWS: *i = (GLint)gc->state.storePack.skipRows; break; case GL_PACK_SKIP_PIXELS: *i = (GLint)gc->state.storePack.skipPixels; break; + case GL_PACK_SKIP_IMAGES: + *i = (GLint)gc->state.storePack.skipImages; + break; case GL_PACK_ALIGNMENT: *i = (GLint)gc->state.storePack.alignment; break; @@ -515,12 +599,18 @@ void glGetIntegerv(GLenum val, GLint *i) case GL_UNPACK_ROW_LENGTH: *i = (GLint)gc->state.storeUnpack.rowLength; break; + case GL_UNPACK_IMAGE_HEIGHT: + *i = (GLint)gc->state.storeUnpack.imageHeight; + break; case GL_UNPACK_SKIP_ROWS: *i = (GLint)gc->state.storeUnpack.skipRows; break; case GL_UNPACK_SKIP_PIXELS: *i = (GLint)gc->state.storeUnpack.skipPixels; break; + case GL_UNPACK_SKIP_IMAGES: + *i = (GLint)gc->state.storeUnpack.skipImages; + break; case GL_UNPACK_ALIGNMENT: *i = (GLint)gc->state.storeUnpack.alignment; break; @@ -531,68 +621,77 @@ void glGetIntegerv(GLenum val, GLint *i) *i = (GLint)gc->state.storeUnpack.lsbFirst; break; case GL_VERTEX_ARRAY: - *i = (GLint)gc->state.vertArray.vertexEnable; + *i = (GLint)gc->state.vertArray.vertex.enable; break; case GL_VERTEX_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.vertexSize; + *i = (GLint)gc->state.vertArray.vertex.size; break; case GL_VERTEX_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.vertexType; + *i = (GLint)gc->state.vertArray.vertex.type; break; case GL_VERTEX_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.vertexStride; + *i = (GLint)gc->state.vertArray.vertex.stride; break; case GL_NORMAL_ARRAY: - *i = (GLint)gc->state.vertArray.normalEnable; + *i = (GLint)gc->state.vertArray.normal.enable; break; case GL_NORMAL_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.normalType; + *i = (GLint)gc->state.vertArray.normal.type; break; case GL_NORMAL_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.normalStride; + *i = (GLint)gc->state.vertArray.normal.stride; break; case GL_COLOR_ARRAY: - *i = (GLint)gc->state.vertArray.colorEnable; + *i = (GLint)gc->state.vertArray.color.enable; break; case GL_COLOR_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.colorSize; + *i = (GLint)gc->state.vertArray.color.size; break; case GL_COLOR_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.colorType; + *i = (GLint)gc->state.vertArray.color.type; break; case GL_COLOR_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.colorStride; + *i = (GLint)gc->state.vertArray.color.stride; break; case GL_INDEX_ARRAY: - *i = (GLint)gc->state.vertArray.indexEnable; + *i = (GLint)gc->state.vertArray.index.enable; break; case GL_INDEX_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.indexType; + *i = (GLint)gc->state.vertArray.index.type; break; case GL_INDEX_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.indexStride; + *i = (GLint)gc->state.vertArray.index.stride; break; case GL_TEXTURE_COORD_ARRAY: - *i = (GLint)gc->state.vertArray.texCoordEnable; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; break; case GL_TEXTURE_COORD_ARRAY_SIZE: - *i = (GLint)gc->state.vertArray.texCoordSize; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: - *i = (GLint)gc->state.vertArray.texCoordType; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].type; break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.texCoordStride; + *i = (GLint)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].stride; break; case GL_EDGE_FLAG_ARRAY: - *i = (GLint)gc->state.vertArray.edgeFlagEnable; + *i = (GLint)gc->state.vertArray.edgeFlag.enable; break; case GL_EDGE_FLAG_ARRAY_STRIDE: - *i = (GLint)gc->state.vertArray.edgeFlagStride; + *i = (GLint)gc->state.vertArray.edgeFlag.stride; + break; + case GL_MAX_ELEMENTS_VERTICES: + *i = (GLint)gc->state.vertArray.maxElementsVertices; + break; + case GL_MAX_ELEMENTS_INDICES: + *i = (GLint)gc->state.vertArray.maxElementsIndices; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *i = (GLint)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + *i = (GLint)(gc->state.vertArray.activeTexture + GL_TEXTURE0_ARB); + break; default: /* ** Not a local value, so use what we got from the server. @@ -778,17 +877,17 @@ GLboolean glIsEnabled(GLenum cap) switch(cap) { case GL_VERTEX_ARRAY: - return gc->state.vertArray.vertexEnable; + return gc->state.vertArray.vertex.enable; case GL_NORMAL_ARRAY: - return gc->state.vertArray.normalEnable; + return gc->state.vertArray.normal.enable; case GL_COLOR_ARRAY: - return gc->state.vertArray.colorEnable; + return gc->state.vertArray.color.enable; case GL_INDEX_ARRAY: - return gc->state.vertArray.indexEnable; + return gc->state.vertArray.index.enable; case GL_TEXTURE_COORD_ARRAY: - return gc->state.vertArray.texCoordEnable; + return gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].enable; case GL_EDGE_FLAG_ARRAY: - return gc->state.vertArray.edgeFlagEnable; + return gc->state.vertArray.edgeFlag.enable; } __GLX_SINGLE_LOAD_VARIABLES(); @@ -809,32 +908,32 @@ void glGetPointerv(GLenum pname, void **params) switch(pname) { case GL_VERTEX_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.vertexPtr; + *params = (void *)gc->state.vertArray.vertex.ptr; return; case GL_NORMAL_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.normalPtr; + *params = (void *)gc->state.vertArray.normal.ptr; return; case GL_COLOR_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.colorPtr; + *params = (void *)gc->state.vertArray.color.ptr; return; case GL_INDEX_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.indexPtr; + *params = (void *)gc->state.vertArray.index.ptr; return; case GL_TEXTURE_COORD_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.texCoordPtr; + *params = (void *)gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture].ptr; return; case GL_EDGE_FLAG_ARRAY_POINTER: - *params = (void *)gc->state.vertArray.edgeFlagPtr; - return; + *params = (void *)gc->state.vertArray.edgeFlag.ptr; + return; case GL_FEEDBACK_BUFFER_POINTER: - *params = (void *)gc->feedbackBuf; - return; + *params = (void *)gc->feedbackBuf; + return; case GL_SELECTION_BUFFER_POINTER: - *params = (void *)gc->selectBuf; - return; + *params = (void *)gc->selectBuf; + return; default: __glXSetError(gc, GL_INVALID_ENUM); - return; + return; } } diff --git a/xc/lib/GL/glx/singlepix.c b/xc/lib/GL/glx/singlepix.c index 82edb3904..cba007ef6 100644 --- a/xc/lib/GL/glx/singlepix.c +++ b/xc/lib/GL/glx/singlepix.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/lib/GL/glx/singlepix.c,v 1.2 1999/06/14 07:23:39 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/singlepix.c,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "packsingle.h" @@ -58,7 +72,7 @@ void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, ** to put data back into client memory */ __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize); - __glEmptyImage(gc, width, height, format, type, buf, pixels); + __glEmptyImage(gc, 2, width, height, 1, format, type, buf, pixels); Xfree((char*) buf); } } else { @@ -97,7 +111,7 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, _XEatData(dpy, compsize); __glXSetError(gc, GL_OUT_OF_MEMORY); } else { - GLint width, height; + GLint width, height, depth; /* ** Fetch data into holding buffer. Apply pixel store pack modes @@ -105,8 +119,10 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, */ width = reply.width; height = reply.height; + depth = reply.depth; __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize); - __glEmptyImage(gc, width, height, format, type, buf, texels); + __glEmptyImage(gc, 2, width, height, depth, format, type, buf, + texels); Xfree((char*) buf); } } else { @@ -131,7 +147,255 @@ void glGetPolygonStipple(GLubyte *mask) __GLX_SINGLE_READ_XREPLY(); if (reply.length == 32) { __GLX_SINGLE_GET_CHAR_ARRAY(buf,128); - __glEmptyImage(gc, 32, 32, GL_COLOR_INDEX, GL_BITMAP, buf, mask); + __glEmptyImage(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, buf, mask); + } + __GLX_SINGLE_END(); +} + +void glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetColorTableReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetColorTable,__GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = (int)reply.width; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, table); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, + GLvoid *image) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetConvolutionFilterReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionFilter, __GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,format); + __GLX_SINGLE_PUT_LONG(8,type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*) Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width, height; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = reply.width; + height = reply.height; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),compsize); + __glEmptyImage(gc, 2, width, height, 1, format, type, buf, image); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetSeparableFilter(GLenum target, GLenum format, GLenum type, + GLvoid *row, GLvoid *column, GLvoid *span) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetSeparableFilterReply reply; + GLubyte *rowBuf, *colBuf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetSeparableFilter, __GLX_PAD(13)); + __GLX_SINGLE_PUT_LONG(0,target); + __GLX_SINGLE_PUT_LONG(4,format); + __GLX_SINGLE_PUT_LONG(8,type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_READ_XREPLY(); + compsize = reply.length << 2; + + if (compsize != 0) { + GLint width, height; + GLint widthsize, heightsize; + + width = reply.width; + height = reply.height; + + widthsize = __glImageSize(width,1,1,format, type); + heightsize = __glImageSize(height,1,1,format, type); + + /* Allocate a holding buffer to transform the data from */ + rowBuf = (GLubyte*) Xmalloc(widthsize); + if (!rowBuf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + UnlockDisplay(dpy); + SyncHandle(); + return; + } else { + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)rowBuf),widthsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, rowBuf, row); + Xfree((char*) rowBuf); + } + colBuf = (GLubyte*) Xmalloc(heightsize); + if (!colBuf) { + /* Throw data away */ + _XEatData(dpy, compsize - __GLX_PAD(widthsize)); + __glXSetError(gc, GL_OUT_OF_MEMORY); + UnlockDisplay(dpy); + SyncHandle(); + return; + } else { + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)colBuf),heightsize); + __glEmptyImage(gc, 1, height, 1, 1, format, type, colBuf, column); + Xfree((char*) colBuf); + } + } else { + /* + ** don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); + +} + +void glGetHistogram(GLenum target, GLboolean reset, GLenum format, + GLenum type, GLvoid *values) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetHistogramReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetHistogram,__GLX_PAD(14)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_PUT_CHAR(13,reset); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + GLint width; + + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + width = (int)reply.width; + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, values); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ + } + __GLX_SINGLE_END(); +} + +void glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, + GLvoid *values) +{ + __GLX_SINGLE_DECLARE_VARIABLES(); + xGLXGetMinmaxReply reply; + GLubyte *buf; + + if (!dpy) return; + __GLX_SINGLE_LOAD_VARIABLES(); + + /* Send request */ + __GLX_SINGLE_BEGIN(X_GLsop_GetMinmax,__GLX_PAD(14)); + __GLX_SINGLE_PUT_LONG(0,(long)target); + __GLX_SINGLE_PUT_LONG(4,(long)format); + __GLX_SINGLE_PUT_LONG(8,(long)type); + __GLX_SINGLE_PUT_CHAR(12,gc->state.storePack.swapEndian); + __GLX_SINGLE_PUT_CHAR(13,reset); + __GLX_SINGLE_READ_XREPLY(); + compsize = (long)reply.length << 2; + + if (compsize != 0) { + /* Allocate a holding buffer to transform the data from */ + buf = (GLubyte*)Xmalloc(compsize); + if (!buf) { + /* Throw data away */ + _XEatData(dpy, compsize); + __glXSetError(gc, GL_OUT_OF_MEMORY); + } else { + /* + ** Fetch data into holding buffer. Apply pixel store pack modes + ** to put data back into client memory + */ + __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize); + __glEmptyImage(gc, 1, 2, 1, 1, format, type, buf, values); + Xfree((char*) buf); + } + } else { + /* + ** GL error occured, don't modify user's buffer. + */ } __GLX_SINGLE_END(); } diff --git a/xc/lib/GL/glx/size.h b/xc/lib/GL/glx/size.h index 1005d298a..e436c07a4 100644 --- a/xc/lib/GL/glx/size.h +++ b/xc/lib/GL/glx/size.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/lib/GL/glx/size.h,v 1.3 2001/03/21 16:04:39 dawes Exp $ */ #ifndef _size_h_ #define _size_h_ -/* $XFree86: xc/lib/GL/glx/size.h,v 1.2 1999/06/14 07:23:40 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ /* @@ -29,6 +43,10 @@ */ extern GLint __glBitmap_size(GLsizei w, GLsizei h); extern GLint __glCallLists_size(GLsizei n, GLenum type); +extern GLint __glColorTableParameterfv_size(GLenum pname); +extern GLint __glColorTableParameteriv_size(GLenum pname); +extern GLint __glConvolutionParameterfv_size(GLenum pname); +extern GLint __glConvolutionParameteriv_size(GLenum pname); extern GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h); extern GLint __glFogfv_size(GLenum pname); extern GLint __glFogiv_size(GLenum pname); @@ -44,8 +62,8 @@ extern GLint __glTexGendv_size(GLenum e); extern GLint __glTexGenfv_size(GLenum e); extern GLint __glTexGeniv_size(GLenum pname); extern GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w); -extern GLint __glTexImage2D_size(GLenum format, GLenum type, - GLsizei w, GLsizei h); +extern GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h); +extern GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d); extern GLint __glTexParameterfv_size(GLenum e); extern GLint __glTexParameteriv_size(GLenum e); diff --git a/xc/lib/GL/glx/vertarr.c b/xc/lib/GL/glx/vertarr.c index e62e52663..f78b31bba 100644 --- a/xc/lib/GL/glx/vertarr.c +++ b/xc/lib/GL/glx/vertarr.c @@ -1,133 +1,161 @@ -/* $XFree86: xc/lib/GL/glx/vertarr.c,v 1.2 1999/06/14 07:23:40 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/vertarr.c,v 1.4 2001/03/25 05:32:00 tsi Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ -#include "packrender.h" +#define NEED_GL_FUNCS_WRAPPED #include "glxclient.h" +#include "packrender.h" #include <string.h> +#include <limits.h> /* INT_MAX */ /* macros for setting function pointers */ #define __GL_VERTEX_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 2) \ - va->vertexCall = (void (*)(const char *))glVertex2##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex2##let##v; \ else if (size == 3) \ - va->vertexCall = (void (*)(const char *))glVertex3##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex3##let##v; \ else if (size == 4) \ - va->vertexCall = (void (*)(const char *))glVertex4##let##v; \ + vertexPointer->proc = (void (*)(const void *))glVertex4##let##v; \ break #define __GL_NORMAL_FUNC(NAME, let) \ case GL_##NAME: \ - va->normalCall = (void (*)(const char *))glNormal3##let##v; \ + normalPointer->proc = (void (*)(const void *))glNormal3##let##v; \ break #define __GL_COLOR_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 3) \ - va->colorCall = (void (*)(const char *))glColor3##let##v; \ + colorPointer->proc = (void (*)(const void *))glColor3##let##v; \ else if (size == 4)\ - va->colorCall = (void (*)(const char *))glColor4##let##v; \ + colorPointer->proc = (void (*)(const void *))glColor4##let##v; \ break #define __GL_INDEX_FUNC(NAME, let) \ case GL_##NAME: \ - va->indexCall = (void (*)(const char *))glIndex##let##v; \ + indexPointer->proc = (void (*)(const void *))glIndex##let##v; \ break #define __GL_TEXTURE_FUNC(NAME, let) \ case GL_##NAME: \ if (size == 1) \ - va->texCoordCall = (void (*)(const char *))glTexCoord1##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord1##let##v; \ else if (size == 2) \ - va->texCoordCall = (void (*)(const char *))glTexCoord2##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord2##let##v; \ else if (size == 3) \ - va->texCoordCall = (void (*)(const char *))glTexCoord3##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord3##let##v; \ else if (size == 4) \ - va->texCoordCall = (void (*)(const char *))glTexCoord4##let##v; \ + texCoordPointer->proc = (void (*)(const void *))glTexCoord4##let##v; \ break static GLuint __glXTypeSize(GLenum enm) { - switch (enm) { - case __GL_BOOLEAN_ARRAY: return sizeof(GLboolean); - case GL_BYTE: return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: return sizeof(GLubyte); - case GL_SHORT: return sizeof(GLshort); - case GL_UNSIGNED_SHORT: return sizeof(GLushort); - case GL_INT: return sizeof(GLint); - case GL_UNSIGNED_INT: return sizeof(GLint); - case GL_FLOAT: return sizeof(GLfloat); - case GL_DOUBLE: return sizeof(GLdouble); - default: return 0; - } + switch (enm) { + case __GL_BOOLEAN_ARRAY: return sizeof(GLboolean); + case GL_BYTE: return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: return sizeof(GLubyte); + case GL_SHORT: return sizeof(GLshort); + case GL_UNSIGNED_SHORT: return sizeof(GLushort); + case GL_INT: return sizeof(GLint); + case GL_UNSIGNED_INT: return sizeof(GLint); + case GL_FLOAT: return sizeof(GLfloat); + case GL_DOUBLE: return sizeof(GLdouble); + default: return 0; + } } void __glXInitVertexArrayState(__GLXcontext *gc) { __GLXvertArrayState *va = &gc->state.vertArray; + GLint i; + + va->vertex.enable = GL_FALSE; + va->vertex.proc = NULL; + va->vertex.skip = 0; + va->vertex.ptr = 0; + va->vertex.size = 4; + va->vertex.type = GL_FLOAT; + va->vertex.stride = 0; + + va->normal.enable = GL_FALSE; + va->normal.proc = NULL; + va->normal.skip = 0; + va->normal.ptr = 0; + va->normal.size = 3; + va->normal.type = GL_FLOAT; + va->normal.stride = 0; + + va->color.enable = GL_FALSE; + va->color.proc = NULL; + va->color.skip = 0; + va->color.ptr = 0; + va->color.size = 4; + va->color.type = GL_FLOAT; + va->color.stride = 0; + + va->index.enable = GL_FALSE; + va->index.proc = NULL; + va->index.skip = 0; + va->index.ptr = 0; + va->index.size = 1; + va->index.type = GL_FLOAT; + va->index.stride = 0; + + for (i=0; i<__GLX_MAX_TEXTURE_UNITS; ++i) { + __GLXvertexArrayPointerState *texCoord = &va->texCoord[i]; + + texCoord->enable = GL_FALSE; + texCoord->proc = NULL; + texCoord->skip = 0; + texCoord->ptr = 0; + texCoord->size = 4; + texCoord->type = GL_FLOAT; + texCoord->stride = 0; + } - va->vertexEnable = GL_FALSE; - va->vertexCall = NULL; - va->vertexSkip = 0; - va->vertexPtr = 0; - va->vertexSize = 4; - va->vertexType = GL_FLOAT; - va->vertexStride = 0; - - va->normalEnable = GL_FALSE; - va->normalCall = NULL; - va->normalSkip = 0; - va->normalPtr = 0; - va->normalType = GL_FLOAT; - va->normalStride = 0; - - va->colorEnable = GL_FALSE; - va->colorCall = NULL; - va->colorSkip = 0; - va->colorPtr = 0; - va->colorSize = 4; - va->colorType = GL_FLOAT; - va->colorStride = 0; - - va->indexEnable = GL_FALSE; - va->indexCall = NULL; - va->indexSkip = 0; - va->indexPtr = 0; - va->indexType = GL_FLOAT; - va->indexStride = 0; - - va->texCoordEnable = GL_FALSE; - va->texCoordCall = NULL; - va->texCoordSkip = 0; - va->texCoordPtr = 0; - va->texCoordSize = 4; - va->texCoordType = GL_FLOAT; - va->texCoordStride = 0; - - va->edgeFlagEnable = GL_FALSE; - va->edgeFlagCall = NULL; - va->edgeFlagSkip = 0; - va->edgeFlagPtr = 0; - va->edgeFlagStride = 0; + va->edgeFlag.enable = GL_FALSE; + va->edgeFlag.proc = NULL; + va->edgeFlag.skip = 0; + va->edgeFlag.ptr = 0; + va->edgeFlag.size = 1; + va->edgeFlag.type = GL_UNSIGNED_BYTE; + va->edgeFlag.stride = 0; + + va->maxElementsVertices = INT_MAX; + va->maxElementsIndices = INT_MAX; } /*****************************************************************************/ @@ -136,7 +164,7 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *vertexPointer = &gc->state.vertArray.vertex; /* Check arguments */ if (size < 2 || size > 4 || stride < 0) { @@ -144,7 +172,7 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_VERTEX_FUNC(SHORT, s); __GL_VERTEX_FUNC(INT, i); @@ -155,23 +183,23 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, return; } - va->vertexSize = size; - va->vertexType = type; - va->vertexStride = stride; - va->vertexPtr = pointer; + vertexPointer->size = size; + vertexPointer->type = type; + vertexPointer->stride = stride; + vertexPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->vertexSkip = __glXTypeSize(type) * size; + vertexPointer->skip = __glXTypeSize(type) * size; } else { - va->vertexSkip = stride; + vertexPointer->skip = stride; } } void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *normalPointer = &gc->state.vertArray.normal; /* Check arguments */ if (stride < 0) { @@ -179,7 +207,7 @@ void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_NORMAL_FUNC(BYTE, b); __GL_NORMAL_FUNC(SHORT, s); @@ -191,15 +219,15 @@ void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - va->normalType = type; - va->normalStride = stride; - va->normalPtr = pointer; + normalPointer->type = type; + normalPointer->stride = stride; + normalPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->normalSkip = 3 * __glXTypeSize(type); + normalPointer->skip = 3 * __glXTypeSize(type); } else { - va->normalSkip = stride; + normalPointer->skip = stride; } } @@ -207,7 +235,7 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *colorPointer = &gc->state.vertArray.color; /* Check arguments */ if (stride < 0) { @@ -215,7 +243,7 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_COLOR_FUNC(BYTE, b); __GL_COLOR_FUNC(UNSIGNED_BYTE, ub); @@ -229,23 +257,24 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, __glXSetError(gc, GL_INVALID_ENUM); return; } - va->colorSize = size; - va->colorType = type; - va->colorStride = stride; - va->colorPtr = pointer; + + colorPointer->size = size; + colorPointer->type = type; + colorPointer->stride = stride; + colorPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->colorSkip = size * __glXTypeSize(type); + colorPointer->skip = size * __glXTypeSize(type); } else { - va->colorSkip = stride; + colorPointer->skip = stride; } } void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *indexPointer = &gc->state.vertArray.index; /* Check arguments */ if (stride < 0) { @@ -253,7 +282,7 @@ void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_INDEX_FUNC(UNSIGNED_BYTE, ub); __GL_INDEX_FUNC(SHORT, s); @@ -265,15 +294,15 @@ void glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) return; } - va->indexType = type; - va->indexStride = stride; - va->indexPtr = pointer; + indexPointer->type = type; + indexPointer->stride = stride; + indexPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->indexSkip = __glXTypeSize(type); + indexPointer->skip = __glXTypeSize(type); } else { - va->indexSkip = stride; + indexPointer->skip = stride; } } @@ -281,7 +310,8 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *texCoordPointer = + &gc->state.vertArray.texCoord[gc->state.vertArray.activeTexture]; /* Check arguments */ if (size < 1 || size > 4 || stride < 0) { @@ -289,7 +319,7 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - /* Choose appropriate api call */ + /* Choose appropriate api proc */ switch(type) { __GL_TEXTURE_FUNC(SHORT, s); __GL_TEXTURE_FUNC(INT, i); @@ -300,23 +330,23 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - va->texCoordSize = size; - va->texCoordType = type; - va->texCoordStride = stride; - va->texCoordPtr = pointer; + texCoordPointer->size = size; + texCoordPointer->type = type; + texCoordPointer->stride = stride; + texCoordPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->texCoordSkip = __glXTypeSize(type) * size; + texCoordPointer->skip = __glXTypeSize(type) * size; } else { - va->texCoordSkip = stride; + texCoordPointer->skip = stride; } } void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer) { __GLXcontext *gc = __glXGetCurrentContext(); - __GLXvertArrayState *va = &gc->state.vertArray; + __GLXvertexArrayPointerState *edgeFlagPointer = &gc->state.vertArray.edgeFlag; /* Check arguments */ if (stride < 0) { @@ -324,19 +354,19 @@ void glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer) return; } - va->edgeFlagStride = stride; - va->edgeFlagPtr = pointer; + /* Choose appropriate api proc */ + edgeFlagPointer->proc = (void (*)(const void *))glEdgeFlagv; + + edgeFlagPointer->stride = stride; + edgeFlagPointer->ptr = pointer; /* Set internal state */ if (stride == 0) { - va->edgeFlagSkip = sizeof(GLboolean); + edgeFlagPointer->skip = sizeof(GLboolean); } else { - va->edgeFlagSkip = stride; + edgeFlagPointer->skip = stride; } - /* Choose appropriate api call */ - va->edgeFlagCall = glEdgeFlagv; - } void glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) @@ -506,29 +536,32 @@ void glArrayElement(GLint i) { __GLXcontext *gc = __glXGetCurrentContext(); __GLXvertArrayState *va = &gc->state.vertArray; + GLint j; - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(va->edgeFlagPtr+i*va->edgeFlagSkip); + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(va->edgeFlag.ptr+i*va->edgeFlag.skip); } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(va->texCoordPtr+i*va->texCoordSkip); + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(va->texCoord[j].ptr+i*va->texCoord[j].skip); + } } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(va->colorPtr+i*va->colorSkip); + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(va->color.ptr+i*va->color.skip); } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(va->indexPtr+i*va->indexSkip); + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(va->index.ptr+i*va->index.skip); } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(va->normalPtr+i*va->normalSkip); + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(va->normal.ptr+i*va->normal.skip); } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(va->vertexPtr+i*va->vertexSkip); + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(va->vertex.ptr+i*va->vertex.skip); } } @@ -536,10 +569,10 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) { __GLXcontext *gc = __glXGetCurrentContext(); __GLXvertArrayState *va = &gc->state.vertArray; - const char *vaPtr = NULL, *naPtr = NULL, *caPtr = NULL, - *iaPtr = NULL, *tcaPtr = NULL; + const GLubyte *vaPtr = NULL, *naPtr = NULL, *caPtr = NULL, + *iaPtr = NULL, *tcaPtr[__GLX_MAX_TEXTURE_UNITS]; const GLboolean *efaPtr = NULL; - GLint i; + GLint i, j; switch(mode) { case GL_POINTS: @@ -566,44 +599,48 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) /* ** Set up pointers for quick array traversal. */ - if (va->normalEnable == GL_TRUE) - naPtr = va->normalPtr + first * va->normalSkip; - if (va->colorEnable == GL_TRUE) - caPtr = va->colorPtr + first * va->colorSkip; - if (va->indexEnable == GL_TRUE) - iaPtr = va->indexPtr + first * va->indexSkip; - if (va->texCoordEnable == GL_TRUE) - tcaPtr = va->texCoordPtr + first * va->texCoordSkip; - if (va->edgeFlagEnable == GL_TRUE) - efaPtr = va->edgeFlagPtr + first * va->edgeFlagSkip; - if (va->vertexEnable == GL_TRUE) - vaPtr = va->vertexPtr + first * va->vertexSkip; + if (va->normal.enable == GL_TRUE) + naPtr = va->normal.ptr + first * va->normal.skip; + if (va->color.enable == GL_TRUE) + caPtr = va->color.ptr + first * va->color.skip; + if (va->index.enable == GL_TRUE) + iaPtr = va->index.ptr + first * va->index.skip; + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) + tcaPtr[j] = va->texCoord[j].ptr + first * va->texCoord[j].skip; + } + if (va->edgeFlag.enable == GL_TRUE) + efaPtr = va->edgeFlag.ptr + first * va->edgeFlag.skip; + if (va->vertex.enable == GL_TRUE) + vaPtr = va->vertex.ptr + first * va->vertex.skip; glBegin(mode); for (i = 0; i < count; i++) { - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(efaPtr); - efaPtr += va->edgeFlagSkip; + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(efaPtr); + efaPtr += va->edgeFlag.skip; } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(tcaPtr); - tcaPtr += va->texCoordSkip; - } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(caPtr); - caPtr += va->colorSkip; + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(tcaPtr[j]); + tcaPtr[j] += va->texCoord[j].skip; + } + } + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(caPtr); + caPtr += va->color.skip; } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(iaPtr); - iaPtr += va->indexSkip; + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(iaPtr); + iaPtr += va->index.skip; } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(naPtr); - naPtr += va->normalSkip; + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(naPtr); + naPtr += va->normal.skip; } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(vaPtr); - vaPtr += va->vertexSkip; + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(vaPtr); + vaPtr += va->vertex.skip; } } glEnd(); @@ -617,7 +654,7 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLubyte *iPtr1 = NULL; const GLushort *iPtr2 = NULL; const GLuint *iPtr3 = NULL; - GLint i, offset = 0; + GLint i, j, offset = 0; switch (mode) { case GL_POINTS: @@ -669,24 +706,53 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, offset = (GLint)(*iPtr3++); break; } - if (va->edgeFlagEnable == GL_TRUE) { - (*va->edgeFlagCall)(va->edgeFlagPtr+(offset*va->edgeFlagSkip)); - } - if (va->texCoordEnable == GL_TRUE) { - (*va->texCoordCall)(va->texCoordPtr+(offset*va->texCoordSkip)); + if (va->edgeFlag.enable == GL_TRUE) { + (*va->edgeFlag.proc)(va->edgeFlag.ptr+(offset*va->edgeFlag.skip)); } - if (va->colorEnable == GL_TRUE) { - (*va->colorCall)(va->colorPtr+(offset*va->colorSkip)); + for (j=0; j<__GLX_MAX_TEXTURE_UNITS; ++j) { + if (va->texCoord[j].enable == GL_TRUE) { + (*va->texCoord[j].proc)(va->texCoord[j].ptr+ + (offset*va->texCoord[j].skip)); + } + } + if (va->color.enable == GL_TRUE) { + (*va->color.proc)(va->color.ptr+(offset*va->color.skip)); } - if (va->indexEnable == GL_TRUE) { - (*va->indexCall)(va->indexPtr+(offset*va->indexSkip)); + if (va->index.enable == GL_TRUE) { + (*va->index.proc)(va->index.ptr+(offset*va->index.skip)); } - if (va->normalEnable == GL_TRUE) { - (*va->normalCall)(va->normalPtr+(offset*va->normalSkip)); + if (va->normal.enable == GL_TRUE) { + (*va->normal.proc)(va->normal.ptr+(offset*va->normal.skip)); } - if (va->vertexEnable == GL_TRUE) { - (*va->vertexCall)(va->vertexPtr+(offset*va->vertexSkip)); + if (va->vertex.enable == GL_TRUE) { + (*va->vertex.proc)(va->vertex.ptr+(offset*va->vertex.skip)); } } glEnd(); } + +void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) +{ + __GLXcontext *gc = __glXGetCurrentContext(); + + if (end < start) { + __glXSetError(gc, GL_INVALID_VALUE); + return; + } + + glDrawElements(mode,count,type,indices); +} + +void glClientActiveTextureARB(GLenum texture) +{ + __GLXcontext *gc = __glXGetCurrentContext(); + GLint unit = (GLint) texture - GL_TEXTURE0_ARB; + + if (unit < 0 || __GLX_MAX_TEXTURE_UNITS <= unit) { + __glXSetError(gc, GL_INVALID_ENUM); + return; + } + gc->state.vertArray.activeTexture = unit; +} diff --git a/xc/lib/GL/glx/xfont.c b/xc/lib/GL/glx/xfont.c index 5da962f98..f07dee8db 100644 --- a/xc/lib/GL/glx/xfont.c +++ b/xc/lib/GL/glx/xfont.c @@ -1,3 +1,4 @@ +/* $XFree86: xc/lib/GL/glx/xfont.c,v 1.5 2001/03/21 16:04:39 dawes Exp $ */ /* * Mesa 3-D graphics library * Version: 3.1 diff --git a/xc/lib/GL/include/GL/internal/glcore.h b/xc/lib/GL/include/GL/internal/glcore.h index 08de67219..be124c20c 100644 --- a/xc/lib/GL/include/GL/internal/glcore.h +++ b/xc/lib/GL/include/GL/internal/glcore.h @@ -1,32 +1,51 @@ +/* $XFree86: xc/lib/GL/include/GL/internal/glcore.h,v 1.7 2001/03/25 05:32:00 tsi Exp $ */ #ifndef __gl_core_h_ #define __gl_core_h_ -/* $XFree86: xc/lib/GL/include/GL/internal/glcore.h,v 1.5 1999/06/14 07:23:42 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #ifndef XFree86LOADER #include <sys/types.h> #endif +#ifdef CAPI +#undef CAPI +#endif +#define CAPI + #define GL_CORE_SGI 1 #define GL_CORE_MESA 2 @@ -202,13 +221,13 @@ struct __GLdrawableBufferRec { void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLuint val, GLint x, GLint y, GLint w, GLint h); void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - void *other; /* exported */ void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); void *private; /* private */ + void *other; /* implementation private data */ __GLbufMainInitFn mainInit; __GLbufFallbackInitFn fallbackInit; }; @@ -295,12 +314,12 @@ struct __GLdrawablePrivateRec { void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc); void (*unlockDP)(__GLdrawablePrivate *glPriv); - - void *other; - /* exported */ - void (*freePrivate)(__GLdrawablePrivate *); void *private; + void (*freePrivate)(__GLdrawablePrivate *); + + /* client data */ + void *other; }; /* @@ -330,7 +349,7 @@ struct __GLdrawablePrivateRec { */ typedef struct __GLimportsRec { /* Memory management */ - void *(*malloc)(__GLcontext *gc, size_t size); + void * (*malloc)(__GLcontext *gc, size_t size); void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize); void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize); void (*free)(__GLcontext *gc, void *addr); @@ -340,11 +359,12 @@ typedef struct __GLimportsRec { void (*fatal)(__GLcontext *gc, char *fmt); /* other system calls */ - char *(*getenv)(__GLcontext *gc, const char *var); - int (*sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); - void *(*fopen)(__GLcontext *gc, const char *path, const char *mode); - int (*fclose)(__GLcontext *gc, void *stream); - int (*fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); + char *(CAPI *getenv)(__GLcontext *gc, const char *var); + int (CAPI *atoi)(__GLcontext *gc, const char *str); + int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); + void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode); + int (CAPI *fclose)(__GLcontext *gc, void *stream); + int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); /* Drawing surface management */ __GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc); diff --git a/xc/lib/GL/mesa/dri/Imakefile b/xc/lib/GL/mesa/dri/Imakefile index 23e4ea50e..cea1e1f63 100644 --- a/xc/lib/GL/mesa/dri/Imakefile +++ b/xc/lib/GL/mesa/dri/Imakefile @@ -1,10 +1,18 @@ -XCOMM $XFree86: xc/lib/GL/mesa/dri/Imakefile,v 1.2 2000/02/23 04:46:36 martin Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/dri/Imakefile,v 1.5 2001/04/03 02:29:33 dawes Exp $ -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtraLib NO +#define DoDebugLib NO +#define DoProfileLib NO +#endif #if Malloc0ReturnsNull ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL @@ -12,25 +20,18 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #if BuildXF86DRI DRI_DEFINES = GlxDefines - DRI_INCLUDES = -I../../glx -I../../dri \ - -I$(TOP)/include -I$(TOP)/include/GL \ + DRI_INCLUDES = -I$(GLXLIBSRC)/glx -I$(GLXLIBSRC)/dri \ + -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri #endif -MESA_INCLUDES = -I. -I.. -I../include +MESA_INCLUDES = -I. -I$(MESASRCDIR)/src -I$(MESASRCDIR)/include DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(DRI_INCLUDES) $(MESA_INCLUDES) + INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) $(DRI_INCLUDES) $(MESA_INCLUDES) SRCS = dri_mesa.c OBJS = dri_mesa.o -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif - #include <Library.tmpl> LibraryObjectRule() @@ -39,3 +40,4 @@ SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() + diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c index cfdbb2799..06846ac44 100644 --- a/xc/lib/GL/mesa/dri/dri_mesa.c +++ b/xc/lib/GL/mesa/dri/dri_mesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/dri/dri_mesa.c,v 1.14 2001/01/16 05:10:57 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/dri/dri_mesa.c,v 1.15 2001/03/21 16:14:19 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -32,6 +32,27 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Brian E. Paul <brian@precisioninsight.com> */ +/* + * This file gets compiled into each of the DRI 3D drivers. The + * functions defined here are called from the GL library via + * function pointers in the __DRIdisplayRec, __DRIscreenRec, + * __DRIcontextRec, __DRIdrawableRec structures defined in glxclient.h + * + * Those function pointers are initialized by code in this file. + * The process starts when libGL calls the __driCreateScreen() function + * at the end of this file. + * + * The above-mentioned DRI structures have no dependencies on Mesa. + * Each structure instead has a generic (void *) private pointer that + * points to a private structure. For Mesa drivers, these private + * structures are the __DRIdrawablePrivateRec, __DRIcontextPrivateRec, + * __DRIscreenPrivateRec, and __DRIvisualPrivateRec structures defined + * in dri_mesaint.h. We allocate and attach those structs here in + * this file. + */ + + + #ifdef GLX_DIRECT_RENDERING #include <unistd.h> @@ -58,19 +79,19 @@ static Bool driMesaUnbindContext(Display *dpy, int scrn, static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw, VisualID vid, __DRIdrawable *pdraw); static __DRIdrawable *driMesaGetDrawable(Display *dpy, GLXDrawable draw, - void *private); -static void driMesaSwapBuffers(Display *dpy, void *private); -static void driMesaDestroyDrawable(Display *dpy, void *private); + void *screenPrivate); +static void driMesaSwapBuffers(Display *dpy, void *drawPrivate); +static void driMesaDestroyDrawable(Display *dpy, void *drawPrivate); /* Context methods */ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, __DRIcontext *pctx); -static void driMesaDestroyContext(Display *dpy, int scrn, void *private); +static void driMesaDestroyContext(Display *dpy, int scrn, void *screenPrivate); /* Screen methods */ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config); -static void driMesaDestroyScreen(Display *dpy, int scrn, void *private); +static void driMesaDestroyScreen(Display *dpy, int scrn, void *screenPrivate); static Bool driFeatureOn(const char *name) { @@ -184,10 +205,15 @@ static void __driMesaGarbageCollectDrawables(void *drawHash) /*****************************************************************/ +/* + * XXX get rid of this level of indirection? + * Since the code in this file is compiled into each DRI 3D driver + * this layer of indirection serves no purpose. + */ static void driMesaInitAPI(__MesaAPI *MesaAPI) { - MesaAPI->InitDriver = XMesaInitDriver; - MesaAPI->ResetDriver = XMesaResetDriver; + MesaAPI->InitDriver = XMesaInitDriver; /* XXX rename as CreateScreen? */ + MesaAPI->ResetDriver = XMesaResetDriver; /* rename as DestroyScreen? */ MesaAPI->CreateVisual = XMesaCreateVisual; MesaAPI->CreateContext = XMesaCreateContext; MesaAPI->DestroyContext = XMesaDestroyContext; @@ -283,9 +309,15 @@ static Bool driMesaUnbindContext(Display *dpy, int scrn, #endif } + /* XXX this is disabled so that if we call SwapBuffers on an unbound + * window we can determine the last context bound to the window and + * use that context's lock. (BrianP, 2-Dec-2000) + */ +#if 0 /* Unbind the drawable */ pcp->driDrawablePriv = NULL; pdp->driContextPriv = &psp->dummyContextPriv; +#endif return GL_TRUE; } @@ -444,10 +476,11 @@ static Bool driMesaBindContext(Display *dpy, int scrn, /* * This function basically updates the __DRIdrawablePrivate struct's - * cliprect information by calling XF86DRIGetDrawableInfo(). - * This is usually called by a macro which compares the - * __DRIdrwablePrivate pStamp and lastStamp values. If the values - * are different that means we have to update the clipping info. + * cliprect information by calling XF86DRIGetDrawableInfo(). This is + * usually called by the DRI_MESA_VALIDATE_DRAWABLE_INFO macro which + * compares the __DRIdrwablePrivate pStamp and lastStamp values. If + * the values are different that means we have to update the clipping + * info. */ void driMesaUpdateDrawableInfo(Display *dpy, int scrn, __DRIdrawablePrivate *pdp) @@ -571,9 +604,9 @@ static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw, } static __DRIdrawable *driMesaGetDrawable(Display *dpy, GLXDrawable draw, - void *private) + void *screenPrivate) { - __DRIscreenPrivate *psp = (__DRIscreenPrivate *)private; + __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; /* ** Make sure this routine returns NULL if the drawable is not bound @@ -582,17 +615,22 @@ static __DRIdrawable *driMesaGetDrawable(Display *dpy, GLXDrawable draw, return __driMesaFindDrawable(psp->drawHash, draw); } -static void driMesaSwapBuffers(Display *dpy, void *private) +/* + * XXX if we get rid of the XMesa function table then we should probably + * get rid of this function and require each driver to implement a + * driMesaSwapBuffers function. + */ +static void driMesaSwapBuffers(Display *dpy, void *drawPrivate) { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)private; + __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawPrivate; __DRIscreenPrivate *psp = pdp->driScreenPriv; (*psp->MesaAPI.SwapBuffers)(pdp); } -static void driMesaDestroyDrawable(Display *dpy, void *private) +static void driMesaDestroyDrawable(Display *dpy, void *drawPrivate) { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)private; + __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)drawPrivate; __DRIscreenPrivate *psp = pdp->driScreenPriv; int scrn = psp->myNum; @@ -625,18 +663,6 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, return NULL; } - if (!psp->dummyContextPriv.driScreenPriv) { - if (!XF86DRICreateContext(dpy, vis->screen, vis->visual, - &psp->dummyContextPriv.contextID, - &psp->dummyContextPriv.hHWContext)) { - return NULL; - } - psp->dummyContextPriv.driScreenPriv = psp; - psp->dummyContextPriv.mesaContext = NULL; - psp->dummyContextPriv.driDrawablePriv = NULL; - /* No other fields should be used! */ - } - /* Create the hash table */ if (!psp->drawHash) psp->drawHash = drmHashCreate(); @@ -656,6 +682,29 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, return NULL; } + /* This is moved because the Xserver creates a global dummy context + * the first time XF86DRICreateContext is called. + */ + + if (!psp->dummyContextPriv.driScreenPriv) { +#if 0 + /* We no longer use this cause we have the shared dummyContext + * in the SAREA. + */ + if (!XF86DRICreateContext(dpy, vis->screen, vis->visual, + &psp->dummyContextPriv.contextID, + &psp->dummyContextPriv.hHWContext)) { + return NULL; + } +#endif + psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context; + psp->dummyContextPriv.driScreenPriv = psp; + psp->dummyContextPriv.mesaContext = NULL; + psp->dummyContextPriv.driDrawablePriv = NULL; + psp->dummyContextPriv.driverPrivate = NULL; + /* No other fields should be used! */ + } + for (i = 0; i < psp->numVisuals; i++) { if (psp->visuals[i].vid == vis->visualid) { GLvisual *mesaVis = psp->visuals[i].mesaVisual; @@ -672,6 +721,7 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, else { gl_destroy_context(pcp->mesaContext); pcp->mesaContext = NULL; + pcp->driverPrivate = NULL; } } } @@ -692,9 +742,9 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, return pcp; } -static void driMesaDestroyContext(Display *dpy, int scrn, void *private) +static void driMesaDestroyContext(Display *dpy, int scrn, void *contextPrivate) { - __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)private; + __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -708,9 +758,9 @@ static void driMesaDestroyContext(Display *dpy, int scrn, void *private) } } __driMesaGarbageCollectDrawables(pcp->driScreenPriv->drawHash); - (void)XF86DRIDestroyContext(dpy, scrn, pcp->contextID); (*pcp->driScreenPriv->MesaAPI.DestroyContext)(pcp); gl_destroy_context(pcp->mesaContext); + (void)XF86DRIDestroyContext(dpy, scrn, pcp->contextID); Xfree(pcp); } } @@ -757,6 +807,8 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, psp->fd = drmOpen(NULL,BusID); if (psp->fd < 0) { + fprintf(stderr, "libGL error: failed to open DRM: %s\n", strerror(-psp->fd)); + fprintf(stderr, "libGL error: reverting to (slow) indirect rendering\n"); Xfree(BusID); Xfree(psp); (void)XF86DRICloseConnection(dpy, scrn); @@ -793,6 +845,11 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + /* + * Get device name (like "tdfx") and the ddx version numbers. + * We'll check the version in each DRI driver's "createScreen" + * function. + */ if (!XF86DRIGetClientDriverName(dpy, scrn, &psp->ddxMajor, &psp->ddxMinor, @@ -804,8 +861,17 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + /* + * XXX this XMesa indirection may go away. + */ driMesaInitAPI(&psp->MesaAPI); + /* + * Get device-specific info. pDevPriv will point to a struct + * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h) + * that has information about the screen size, depth, pitch, + * ancilliary buffers, DRM mmap handles, etc. + */ if (!XF86DRIGetDeviceInfo(dpy, scrn, &hFB, &psp->fbOrigin, @@ -822,6 +888,9 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, psp->fbHeight = DisplayHeight(dpy, scrn); psp->fbBPP = 32; /* NOT_DONE: Get this from X server */ + /* + * Map the framebuffer region. + */ if (drmMap(psp->fd, hFB, psp->fbSize, (drmAddressPtr)&psp->pFB)) { Xfree(psp->pDevPriv); (void)drmClose(psp->fd); @@ -830,6 +899,10 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + /* + * Map the SAREA region. Further mmap regions may be setup in + * each DRI driver's "createScreen" function. + */ if (drmMap(psp->fd, hSAREA, SAREA_MAX, (drmAddressPtr)&psp->pSAREA)) { (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); Xfree(psp->pDevPriv); @@ -839,6 +912,9 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + /* + * Allocate space for an array of visual records and initialize them. + */ psp->numVisuals = numConfigs; psp->visuals = (__DRIvisualPrivate *)Xmalloc(numConfigs * sizeof(__DRIvisualPrivate)); @@ -922,9 +998,9 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return (void *)psp; } -static void driMesaDestroyScreen(Display *dpy, int scrn, void *private) +static void driMesaDestroyScreen(Display *dpy, int scrn, void *screenPrivate) { - __DRIscreenPrivate *psp = (__DRIscreenPrivate *)private; + __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; if (psp) { #if 0 @@ -965,13 +1041,14 @@ static void driMesaDestroyScreen(Display *dpy, int scrn, void *private) /* - * This is the entrypoint into the driver. - * The driCreateScreen name is the symbol that libGL.so fetches. + * This is the entrypoint into the DRI 3D driver. + * The driCreateScreen name is the symbol that libGL.so fetches via + * dlsym() in order to bootstrap the driver. */ void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) { - return driMesaCreateScreen(dpy, scrn, psc, numConfigs, config); + return driMesaCreateScreen(dpy, scrn, psc, numConfigs, config); } diff --git a/xc/lib/GL/mesa/src/Imakefile b/xc/lib/GL/mesa/src/Imakefile index cc88803f4..be3456e67 100644 --- a/xc/lib/GL/mesa/src/Imakefile +++ b/xc/lib/GL/mesa/src/Imakefile @@ -1,12 +1,26 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.21 2000/12/12 23:24:27 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.25 2001/04/03 02:29:33 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +/* + * Only need SharedLib build unless OSMesa lib is built, or driver is built + * in to libGL + */ +#if BuildXF86DRI && !GlxUseSGISI && \ + (GlxUseBuiltInDRIDriver || \ + !GlxBuiltInMesa || !defined(GlxDriverUsesMesa)) +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtraLib NO +#define DoDebugLib NO +#define DoProfileLib NO +#endif #if Malloc0ReturnsNull ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL @@ -16,367 +30,24 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL TDFX_DEFS = -DFX #endif -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 \ - alpha.c \ - alphabuf.c \ - attrib.c \ - bbox.c \ - bitmap.c \ - blend.c \ - buffers.c \ - clip.c \ - colortab.c \ - config.c \ - context.c \ - copypix.c \ - cva.c \ - debug_xform.c \ - depth.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - extensions.c \ - feedback.c \ - fog.c \ - get.c \ - glapi.c \ - glapinoop.c \ - glthread.c \ - hash.c \ - hint.c \ - image.c \ - imaging.c \ - light.c \ - lines.c \ - logic.c \ - masking.c \ - matrix.c \ - mem.c \ - mmath.c \ - pb.c \ - pipeline.c \ - pixel.c \ - pixeltex.c \ - points.c \ - polygon.c \ - quads.c \ - rastpos.c \ - readpix.c \ - rect.c \ - scissor.c \ - shade.c \ - span.c \ - stages.c \ - state.c \ - stencil.c \ - teximage.c \ - texobj.c \ - texstate.c \ - texture.c \ - texutil.c \ - translate.c \ - triangle.c \ - varray.c \ - vb.c \ - vbcull.c \ - vbfill.c \ - vbindirect.c \ - vbrender.c \ - vbxform.c \ - vector.c \ - vertices.c \ - winpos.c \ - xform.c \ - zoom.c - - CORE_OBJS = aatriangle.o \ - accum.o \ - alpha.o \ - alphabuf.o \ - attrib.o \ - bbox.o \ - bitmap.o \ - blend.o \ - buffers.o \ - clip.o \ - colortab.o \ - config.o \ - context.o \ - copypix.o \ - cva.o \ - debug_xform.o \ - depth.o \ - dlist.o \ - drawpix.o \ - enable.o \ - enums.o \ - eval.o \ - extensions.o \ - feedback.o \ - fog.o \ - get.o \ - hash.o \ - hint.o \ - image.o \ - imaging.o \ - light.o \ - lines.o \ - logic.o \ - masking.o \ - matrix.o \ - mem.o \ - mmath.o \ - pb.o \ - pipeline.o \ - pixel.o \ - pixeltex.o \ - points.o \ - polygon.o \ - quads.o \ - rastpos.o \ - readpix.o \ - rect.o \ - scissor.o \ - shade.o \ - span.o \ - stages.o \ - state.o \ - stencil.o \ - teximage.o \ - texobj.o \ - texstate.o \ - texture.o \ - texutil.o \ - translate.o \ - triangle.o \ - varray.o \ - vb.o \ - vbcull.o \ - vbfill.o \ - vbindirect.o \ - vbrender.o \ - vbxform.o \ - vector.o \ - vertices.o \ - winpos.o \ - xform.o \ - zoom.o - #ifdef i386Architecture - ASM_SRCS = - ASM_OBJS = -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif -#if MesaUseKatmai - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - ASM_DEFS = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) +#define MesaX86BuildDir /**/ +#include "X86/Imakefile.inc" #endif +#define MesaBuildDir /**/ +#define NeedToLinkMesaSrc +#include "Imakefile.inc" #ifdef UseCompaqMathLibrary MATHDEF = -DCCPML #endif - DEFINES = $(ALLOC_DEFINES) GlxDefines $(TDFX_DEFS) $(ASM_DEFS) $(MATHDEF) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) -I../include -I../../dri -I. -I../../../../include - SRCS = $(CORE_SRCS) $(ASM_SRCS) - OBJS = $(CORE_OBJS) $(ASM_OBJS) - -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif - -#if GlxBuiltInMesa || GlxDriverUsesMesa || !GlxUseBuiltInDRIDriver + DEFINES = $(ALLOC_DEFINES) GlxDefines $(TDFX_DEFS) \ + $(MESA_ASM_DEFS) $(MATHDEF) + INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ + -I$(MESASRCDIR)/src -I$(GLXLIBSRC)/dri + SRCS = $(COREMESASRCS) + OBJS = $(COREMESAOBJS) #include <Library.tmpl> @@ -397,10 +68,4 @@ DependSubdirs($(SUBDIRS)) #endif -#else - -AllTarget($(OBJS)) - -#endif - DependTarget() diff --git a/xc/lib/GL/mesa/src/Imakefile.inc b/xc/lib/GL/mesa/src/Imakefile.inc new file mode 100644 index 000000000..45d36b409 --- /dev/null +++ b/xc/lib/GL/mesa/src/Imakefile.inc @@ -0,0 +1,517 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile.inc,v 1.5 2001/04/02 22:15:47 dawes Exp $ + +#ifndef MesaBuildDir +#define MesaBuildDir $(GLXLIBSRC)/mesa/src/ +#endif + +MESABUILDDIR = MesaBuildDir + +#ifdef NeedAllMesaSrc + DISPATCHSRCS = $(MESABUILDDIR)dispatch.c + GLAPISRCS = $(MESABUILDDIR)glapi.c +GLAPINOOPSRCS = $(MESABUILDDIR)glapinoop.c + GLTHREADSRCS = $(MESABUILDDIR)glthread.c +#endif + +COREMESASRCS = $(MESABUILDDIR)aatriangle.c \ + $(MESABUILDDIR)accum.c \ + $(MESABUILDDIR)alpha.c \ + $(MESABUILDDIR)alphabuf.c \ + $(MESABUILDDIR)attrib.c \ + $(MESABUILDDIR)bbox.c \ + $(MESABUILDDIR)bitmap.c \ + $(MESABUILDDIR)blend.c \ + $(MESABUILDDIR)buffers.c \ + $(MESABUILDDIR)clip.c \ + $(MESABUILDDIR)colortab.c \ + $(MESABUILDDIR)config.c \ + $(MESABUILDDIR)context.c \ + $(MESABUILDDIR)copypix.c \ + $(MESABUILDDIR)cva.c \ + $(MESABUILDDIR)debug_xform.c \ + $(MESABUILDDIR)depth.c \ + $(DISPATCHSRCS) \ + $(MESABUILDDIR)dlist.c \ + $(MESABUILDDIR)drawpix.c \ + $(MESABUILDDIR)enable.c \ + $(MESABUILDDIR)enums.c \ + $(MESABUILDDIR)eval.c \ + $(MESABUILDDIR)extensions.c \ + $(MESABUILDDIR)feedback.c \ + $(MESABUILDDIR)fog.c \ + $(MESABUILDDIR)get.c \ + $(GLAPISRCS) \ + $(GLAPINOOPSRCS) \ + $(GLTHREADSRCS) \ + $(MESABUILDDIR)hash.c \ + $(MESABUILDDIR)hint.c \ + $(MESABUILDDIR)image.c \ + $(MESABUILDDIR)imaging.c \ + $(MESABUILDDIR)light.c \ + $(MESABUILDDIR)lines.c \ + $(MESABUILDDIR)logic.c \ + $(MESABUILDDIR)masking.c \ + $(MESABUILDDIR)matrix.c \ + $(MESABUILDDIR)mem.c \ + $(MESABUILDDIR)mmath.c \ + $(MESABUILDDIR)pb.c \ + $(MESABUILDDIR)pipeline.c \ + $(MESABUILDDIR)pixel.c \ + $(MESABUILDDIR)pixeltex.c \ + $(MESABUILDDIR)points.c \ + $(MESABUILDDIR)polygon.c \ + $(MESABUILDDIR)quads.c \ + $(MESABUILDDIR)rastpos.c \ + $(MESABUILDDIR)readpix.c \ + $(MESABUILDDIR)rect.c \ + $(MESABUILDDIR)scissor.c \ + $(MESABUILDDIR)shade.c \ + $(MESABUILDDIR)span.c \ + $(MESABUILDDIR)stages.c \ + $(MESABUILDDIR)state.c \ + $(MESABUILDDIR)stencil.c \ + $(MESABUILDDIR)texformat.c \ + $(MESABUILDDIR)teximage.c \ + $(MESABUILDDIR)texobj.c \ + $(MESABUILDDIR)texstate.c \ + $(MESABUILDDIR)texture.c \ + $(MESABUILDDIR)texutil.c \ + $(MESABUILDDIR)translate.c \ + $(MESABUILDDIR)triangle.c \ + $(MESABUILDDIR)varray.c \ + $(MESABUILDDIR)vb.c \ + $(MESABUILDDIR)vbcull.c \ + $(MESABUILDDIR)vbfill.c \ + $(MESABUILDDIR)vbindirect.c \ + $(MESABUILDDIR)vbrender.c \ + $(MESABUILDDIR)vbxform.c \ + $(MESABUILDDIR)vector.c \ + $(MESABUILDDIR)vertices.c \ + $(MESABUILDDIR)winpos.c \ + $(MESABUILDDIR)xform.c \ + $(MESABUILDDIR)zoom.c + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(aatriangle.c, $(MESASRCDIR)/src) +LinkSourceFile(accum.c, $(MESASRCDIR)/src) +LinkSourceFile(alpha.c, $(MESASRCDIR)/src) +LinkSourceFile(alphabuf.c, $(MESASRCDIR)/src) +LinkSourceFile(attrib.c, $(MESASRCDIR)/src) +LinkSourceFile(bbox.c, $(MESASRCDIR)/src) +LinkSourceFile(bitmap.c, $(MESASRCDIR)/src) +LinkSourceFile(blend.c, $(MESASRCDIR)/src) +LinkSourceFile(buffers.c, $(MESASRCDIR)/src) +LinkSourceFile(clip.c, $(MESASRCDIR)/src) +LinkSourceFile(colortab.c, $(MESASRCDIR)/src) +LinkSourceFile(config.c, $(MESASRCDIR)/src) +LinkSourceFile(context.c, $(MESASRCDIR)/src) +LinkSourceFile(copypix.c, $(MESASRCDIR)/src) +LinkSourceFile(cva.c, $(MESASRCDIR)/src) +LinkSourceFile(debug_xform.c, $(MESASRCDIR)/src) +LinkSourceFile(depth.c, $(MESASRCDIR)/src) +#ifdef NeedAllMesaSrc +LinkSourceFile(dispatch.c, $(MESASRCDIR)/src) +#endif +LinkSourceFile(dlist.c, $(MESASRCDIR)/src) +LinkSourceFile(drawpix.c, $(MESASRCDIR)/src) +LinkSourceFile(enable.c, $(MESASRCDIR)/src) +LinkSourceFile(enums.c, $(MESASRCDIR)/src) +LinkSourceFile(eval.c, $(MESASRCDIR)/src) +LinkSourceFile(extensions.c, $(MESASRCDIR)/src) +LinkSourceFile(feedback.c, $(MESASRCDIR)/src) +LinkSourceFile(fog.c, $(MESASRCDIR)/src) +LinkSourceFile(get.c, $(MESASRCDIR)/src) +#ifdef NeedAllMesaSrc +LinkSourceFile(glapi.c, $(MESASRCDIR)/src) +LinkSourceFile(glapinoop.c, $(MESASRCDIR)/src) +LinkSourceFile(glthread.c, $(MESASRCDIR)/src) +#endif +LinkSourceFile(hash.c, $(MESASRCDIR)/src) +LinkSourceFile(hint.c, $(MESASRCDIR)/src) +LinkSourceFile(image.c, $(MESASRCDIR)/src) +LinkSourceFile(imaging.c, $(MESASRCDIR)/src) +LinkSourceFile(light.c, $(MESASRCDIR)/src) +LinkSourceFile(lines.c, $(MESASRCDIR)/src) +LinkSourceFile(logic.c, $(MESASRCDIR)/src) +LinkSourceFile(masking.c, $(MESASRCDIR)/src) +LinkSourceFile(matrix.c, $(MESASRCDIR)/src) +LinkSourceFile(mem.c, $(MESASRCDIR)/src) +LinkSourceFile(mmath.c, $(MESASRCDIR)/src) +LinkSourceFile(pb.c, $(MESASRCDIR)/src) +LinkSourceFile(pipeline.c, $(MESASRCDIR)/src) +LinkSourceFile(pixel.c, $(MESASRCDIR)/src) +LinkSourceFile(pixeltex.c, $(MESASRCDIR)/src) +LinkSourceFile(points.c, $(MESASRCDIR)/src) +LinkSourceFile(polygon.c, $(MESASRCDIR)/src) +LinkSourceFile(quads.c, $(MESASRCDIR)/src) +LinkSourceFile(rastpos.c, $(MESASRCDIR)/src) +LinkSourceFile(readpix.c, $(MESASRCDIR)/src) +LinkSourceFile(rect.c, $(MESASRCDIR)/src) +LinkSourceFile(scissor.c, $(MESASRCDIR)/src) +LinkSourceFile(shade.c, $(MESASRCDIR)/src) +LinkSourceFile(span.c, $(MESASRCDIR)/src) +LinkSourceFile(stages.c, $(MESASRCDIR)/src) +LinkSourceFile(state.c, $(MESASRCDIR)/src) +LinkSourceFile(stencil.c, $(MESASRCDIR)/src) +LinkSourceFile(texformat.c, $(MESASRCDIR)/src) +LinkSourceFile(teximage.c, $(MESASRCDIR)/src) +LinkSourceFile(texobj.c, $(MESASRCDIR)/src) +LinkSourceFile(texstate.c, $(MESASRCDIR)/src) +LinkSourceFile(texture.c, $(MESASRCDIR)/src) +LinkSourceFile(texutil.c, $(MESASRCDIR)/src) +LinkSourceFile(translate.c, $(MESASRCDIR)/src) +LinkSourceFile(triangle.c, $(MESASRCDIR)/src) +LinkSourceFile(varray.c, $(MESASRCDIR)/src) +LinkSourceFile(vb.c, $(MESASRCDIR)/src) +LinkSourceFile(vbcull.c, $(MESASRCDIR)/src) +LinkSourceFile(vbfill.c, $(MESASRCDIR)/src) +LinkSourceFile(vbindirect.c, $(MESASRCDIR)/src) +LinkSourceFile(vbrender.c, $(MESASRCDIR)/src) +LinkSourceFile(vbxform.c, $(MESASRCDIR)/src) +LinkSourceFile(vector.c, $(MESASRCDIR)/src) +LinkSourceFile(vertices.c, $(MESASRCDIR)/src) +LinkSourceFile(winpos.c, $(MESASRCDIR)/src) +LinkSourceFile(xform.c, $(MESASRCDIR)/src) +LinkSourceFile(zoom.c, $(MESASRCDIR)/src) +#endif + +#ifdef NeedAllMesaSrc + DISPATCHOBJS = $(MESABUILDDIR)dispatch.o + GLAPIOBJS = $(MESABUILDDIR)glapi.o +GLAPINOOPOBJS = $(MESABUILDDIR)glapinoop.o + GLTHREADOBJS = $(MESABUILDDIR)glthread.o +#endif + +COREMESAOBJS = $(MESABUILDDIR)aatriangle.o \ + $(MESABUILDDIR)accum.o \ + $(MESABUILDDIR)alpha.o \ + $(MESABUILDDIR)alphabuf.o \ + $(MESABUILDDIR)attrib.o \ + $(MESABUILDDIR)bbox.o \ + $(MESABUILDDIR)bitmap.o \ + $(MESABUILDDIR)blend.o \ + $(MESABUILDDIR)buffers.o \ + $(MESABUILDDIR)clip.o \ + $(MESABUILDDIR)colortab.o \ + $(MESABUILDDIR)config.o \ + $(MESABUILDDIR)context.o \ + $(MESABUILDDIR)copypix.o \ + $(MESABUILDDIR)cva.o \ + $(MESABUILDDIR)debug_xform.o \ + $(MESABUILDDIR)depth.o \ + $(MESABUILDDIR)dlist.o \ + $(DISPATCHOBJS) \ + $(MESABUILDDIR)drawpix.o \ + $(MESABUILDDIR)enable.o \ + $(MESABUILDDIR)enums.o \ + $(MESABUILDDIR)eval.o \ + $(MESABUILDDIR)extensions.o \ + $(MESABUILDDIR)feedback.o \ + $(MESABUILDDIR)fog.o \ + $(MESABUILDDIR)get.o \ + $(GLAPIOBJS) \ + $(GLAPINOOPOBJS) \ + $(GLTHREADOBJS) \ + $(MESABUILDDIR)hash.o \ + $(MESABUILDDIR)hint.o \ + $(MESABUILDDIR)image.o \ + $(MESABUILDDIR)imaging.o \ + $(MESABUILDDIR)light.o \ + $(MESABUILDDIR)lines.o \ + $(MESABUILDDIR)logic.o \ + $(MESABUILDDIR)masking.o \ + $(MESABUILDDIR)matrix.o \ + $(MESABUILDDIR)mem.o \ + $(MESABUILDDIR)mmath.o \ + $(MESABUILDDIR)pb.o \ + $(MESABUILDDIR)pipeline.o \ + $(MESABUILDDIR)pixel.o \ + $(MESABUILDDIR)pixeltex.o \ + $(MESABUILDDIR)points.o \ + $(MESABUILDDIR)polygon.o \ + $(MESABUILDDIR)quads.o \ + $(MESABUILDDIR)rastpos.o \ + $(MESABUILDDIR)readpix.o \ + $(MESABUILDDIR)rect.o \ + $(MESABUILDDIR)scissor.o \ + $(MESABUILDDIR)shade.o \ + $(MESABUILDDIR)span.o \ + $(MESABUILDDIR)stages.o \ + $(MESABUILDDIR)state.o \ + $(MESABUILDDIR)stencil.o \ + $(MESABUILDDIR)texformat.o \ + $(MESABUILDDIR)teximage.o \ + $(MESABUILDDIR)texobj.o \ + $(MESABUILDDIR)texstate.o \ + $(MESABUILDDIR)texture.o \ + $(MESABUILDDIR)texutil.o \ + $(MESABUILDDIR)translate.o \ + $(MESABUILDDIR)triangle.o \ + $(MESABUILDDIR)varray.o \ + $(MESABUILDDIR)vb.o \ + $(MESABUILDDIR)vbcull.o \ + $(MESABUILDDIR)vbfill.o \ + $(MESABUILDDIR)vbindirect.o \ + $(MESABUILDDIR)vbrender.o \ + $(MESABUILDDIR)vbxform.o \ + $(MESABUILDDIR)vector.o \ + $(MESABUILDDIR)vertices.o \ + $(MESABUILDDIR)winpos.o \ + $(MESABUILDDIR)xform.o \ + $(MESABUILDDIR)zoom.o + +#ifdef NeedAllMesaSrc + DISPATCHUOBJS = $(MESABUILDDIR)unshared/dispatch.o + GLAPIUOBJS = $(MESABUILDDIR)unshared/glapi.o +GLAPINOOPUOBJS = $(MESABUILDDIR)unshared/glapinoop.o + GLTHREADUOBJS = $(MESABUILDDIR)unshared/glthread.o +#endif + +COREMESAUOBJS = $(MESABUILDDIR)unshared/aatriangle.o \ + $(MESABUILDDIR)unshared/accum.o \ + $(MESABUILDDIR)unshared/alpha.o \ + $(MESABUILDDIR)unshared/alphabuf.o \ + $(MESABUILDDIR)unshared/attrib.o \ + $(MESABUILDDIR)unshared/bbox.o \ + $(MESABUILDDIR)unshared/bitmap.o \ + $(MESABUILDDIR)unshared/blend.o \ + $(MESABUILDDIR)unshared/buffers.o \ + $(MESABUILDDIR)unshared/clip.o \ + $(MESABUILDDIR)unshared/colortab.o \ + $(MESABUILDDIR)unshared/config.o \ + $(MESABUILDDIR)unshared/context.o \ + $(MESABUILDDIR)unshared/copypix.o \ + $(MESABUILDDIR)unshared/cva.o \ + $(MESABUILDDIR)unshared/debug_xform.o \ + $(MESABUILDDIR)unshared/depth.o \ + $(DISPATCHUOBJS) \ + $(MESABUILDDIR)unshared/dlist.o \ + $(MESABUILDDIR)unshared/drawpix.o \ + $(MESABUILDDIR)unshared/enable.o \ + $(MESABUILDDIR)unshared/enums.o \ + $(MESABUILDDIR)unshared/eval.o \ + $(MESABUILDDIR)unshared/extensions.o \ + $(MESABUILDDIR)unshared/feedback.o \ + $(MESABUILDDIR)unshared/fog.o \ + $(MESABUILDDIR)unshared/get.o \ + $(GLAPIUOBJS) \ + $(GLAPINOOPUOBJS) \ + $(GLTHREADUOBJS) \ + $(MESABUILDDIR)unshared/hash.o \ + $(MESABUILDDIR)unshared/hint.o \ + $(MESABUILDDIR)unshared/image.o \ + $(MESABUILDDIR)unshared/imaging.o \ + $(MESABUILDDIR)unshared/light.o \ + $(MESABUILDDIR)unshared/lines.o \ + $(MESABUILDDIR)unshared/logic.o \ + $(MESABUILDDIR)unshared/masking.o \ + $(MESABUILDDIR)unshared/matrix.o \ + $(MESABUILDDIR)unshared/mem.o \ + $(MESABUILDDIR)unshared/mmath.o \ + $(MESABUILDDIR)unshared/pb.o \ + $(MESABUILDDIR)unshared/pipeline.o \ + $(MESABUILDDIR)unshared/pixel.o \ + $(MESABUILDDIR)unshared/pixeltex.o \ + $(MESABUILDDIR)unshared/points.o \ + $(MESABUILDDIR)unshared/polygon.o \ + $(MESABUILDDIR)unshared/quads.o \ + $(MESABUILDDIR)unshared/rastpos.o \ + $(MESABUILDDIR)unshared/readpix.o \ + $(MESABUILDDIR)unshared/rect.o \ + $(MESABUILDDIR)unshared/scissor.o \ + $(MESABUILDDIR)unshared/shade.o \ + $(MESABUILDDIR)unshared/span.o \ + $(MESABUILDDIR)unshared/stages.o \ + $(MESABUILDDIR)unshared/state.o \ + $(MESABUILDDIR)unshared/stencil.o \ + $(MESABUILDDIR)unshared/texformat.o \ + $(MESABUILDDIR)unshared/teximage.o \ + $(MESABUILDDIR)unshared/texobj.o \ + $(MESABUILDDIR)unshared/texstate.o \ + $(MESABUILDDIR)unshared/texture.o \ + $(MESABUILDDIR)unshared/texutil.o \ + $(MESABUILDDIR)unshared/translate.o \ + $(MESABUILDDIR)unshared/triangle.o \ + $(MESABUILDDIR)unshared/varray.o \ + $(MESABUILDDIR)unshared/vb.o \ + $(MESABUILDDIR)unshared/vbcull.o \ + $(MESABUILDDIR)unshared/vbfill.o \ + $(MESABUILDDIR)unshared/vbindirect.o \ + $(MESABUILDDIR)unshared/vbrender.o \ + $(MESABUILDDIR)unshared/vbxform.o \ + $(MESABUILDDIR)unshared/vector.o \ + $(MESABUILDDIR)unshared/vertices.o \ + $(MESABUILDDIR)unshared/winpos.o \ + $(MESABUILDDIR)unshared/xform.o \ + $(MESABUILDDIR)unshared/zoom.o + +#ifdef NeedAllMesaSrc + DISPATCHDOBJS = $(MESABUILDDIR)debugger/dispatch.o + GLAPIDOBJS = $(MESABUILDDIR)debugger/glapi.o +GLAPINOOPDOBJS = $(MESABUILDDIR)debugger/glapinoop.o + GLTHREADDOBJS = $(MESABUILDDIR)debugger/glthread.o +#endif + +COREMESADOBJS = $(MESABUILDDIR)debugger/aatriangle.o \ + $(MESABUILDDIR)debugger/unshared/accum.o \ + $(MESABUILDDIR)debugger/alpha.o \ + $(MESABUILDDIR)debugger/alphabuf.o \ + $(MESABUILDDIR)debugger/attrib.o \ + $(MESABUILDDIR)debugger/bbox.o \ + $(MESABUILDDIR)debugger/bitmap.o \ + $(MESABUILDDIR)debugger/blend.o \ + $(MESABUILDDIR)debugger/buffers.o \ + $(MESABUILDDIR)debugger/clip.o \ + $(MESABUILDDIR)debugger/colortab.o \ + $(MESABUILDDIR)debugger/config.o \ + $(MESABUILDDIR)debugger/context.o \ + $(MESABUILDDIR)debugger/copypix.o \ + $(MESABUILDDIR)debugger/cva.o \ + $(MESABUILDDIR)debugger/debug_xform.o \ + $(MESABUILDDIR)debugger/depth.o \ + $(DISPATCHDOBJS) \ + $(MESABUILDDIR)debugger/dlist.o \ + $(MESABUILDDIR)debugger/drawpix.o \ + $(MESABUILDDIR)debugger/enable.o \ + $(MESABUILDDIR)debugger/enums.o \ + $(MESABUILDDIR)debugger/eval.o \ + $(MESABUILDDIR)debugger/extensions.o \ + $(MESABUILDDIR)debugger/feedback.o \ + $(MESABUILDDIR)debugger/fog.o \ + $(MESABUILDDIR)debugger/get.o \ + $(GLAPIUOBJS) \ + $(GLAPINOOPUOBJS) \ + $(GLTHREADUOBJS) \ + $(MESABUILDDIR)debugger/hash.o \ + $(MESABUILDDIR)debugger/hint.o \ + $(MESABUILDDIR)debugger/image.o \ + $(MESABUILDDIR)debugger/imaging.o \ + $(MESABUILDDIR)debugger/light.o \ + $(MESABUILDDIR)debugger/lines.o \ + $(MESABUILDDIR)debugger/logic.o \ + $(MESABUILDDIR)debugger/masking.o \ + $(MESABUILDDIR)debugger/matrix.o \ + $(MESABUILDDIR)debugger/mem.o \ + $(MESABUILDDIR)debugger/mmath.o \ + $(MESABUILDDIR)debugger/pb.o \ + $(MESABUILDDIR)debugger/pipeline.o \ + $(MESABUILDDIR)debugger/pixel.o \ + $(MESABUILDDIR)debugger/pixeltex.o \ + $(MESABUILDDIR)debugger/points.o \ + $(MESABUILDDIR)debugger/polygon.o \ + $(MESABUILDDIR)debugger/quads.o \ + $(MESABUILDDIR)debugger/rastpos.o \ + $(MESABUILDDIR)debugger/readpix.o \ + $(MESABUILDDIR)debugger/rect.o \ + $(MESABUILDDIR)debugger/scissor.o \ + $(MESABUILDDIR)debugger/shade.o \ + $(MESABUILDDIR)debugger/span.o \ + $(MESABUILDDIR)debugger/stages.o \ + $(MESABUILDDIR)debugger/state.o \ + $(MESABUILDDIR)debugger/stencil.o \ + $(MESABUILDDIR)debugger/texformat.o \ + $(MESABUILDDIR)debugger/teximage.o \ + $(MESABUILDDIR)debugger/texobj.o \ + $(MESABUILDDIR)debugger/texstate.o \ + $(MESABUILDDIR)debugger/texture.o \ + $(MESABUILDDIR)debugger/texutil.o \ + $(MESABUILDDIR)debugger/translate.o \ + $(MESABUILDDIR)debugger/triangle.o \ + $(MESABUILDDIR)debugger/varray.o \ + $(MESABUILDDIR)debugger/vb.o \ + $(MESABUILDDIR)debugger/vbcull.o \ + $(MESABUILDDIR)debugger/vbfill.o \ + $(MESABUILDDIR)debugger/vbindirect.o \ + $(MESABUILDDIR)debugger/vbrender.o \ + $(MESABUILDDIR)debugger/vbxform.o \ + $(MESABUILDDIR)debugger/vector.o \ + $(MESABUILDDIR)debugger/vertices.o \ + $(MESABUILDDIR)debugger/winpos.o \ + $(MESABUILDDIR)debugger/xform.o \ + $(MESABUILDDIR)debugger/zoom.o + +#ifdef NeedAllMesaSrc + DISPATCHPOBJS = $(MESABUILDDIR)profiled/dispatch.o + GLAPIPOBJS = $(MESABUILDDIR)profiled/glapi.o +GLAPINOOPPOBJS = $(MESABUILDDIR)profiled/glapinoop.o + GLTHREADPOBJS = $(MESABUILDDIR)profiled/glthread.o +#endif + +COREMESAPOBJS = $(MESABUILDDIR)profiled/aatriangle.o \ + $(MESABUILDDIR)profiled/unshared/accum.o \ + $(MESABUILDDIR)profiled/alpha.o \ + $(MESABUILDDIR)profiled/alphabuf.o \ + $(MESABUILDDIR)profiled/attrib.o \ + $(MESABUILDDIR)profiled/bbox.o \ + $(MESABUILDDIR)profiled/bitmap.o \ + $(MESABUILDDIR)profiled/blend.o \ + $(MESABUILDDIR)profiled/buffers.o \ + $(MESABUILDDIR)profiled/clip.o \ + $(MESABUILDDIR)profiled/colortab.o \ + $(MESABUILDDIR)profiled/config.o \ + $(MESABUILDDIR)profiled/context.o \ + $(MESABUILDDIR)profiled/copypix.o \ + $(MESABUILDDIR)profiled/cva.o \ + $(MESABUILDDIR)profiled/debug_xform.o \ + $(MESABUILDDIR)profiled/depth.o \ + $(DISPATCHPOBJS) \ + $(MESABUILDDIR)profiled/dlist.o \ + $(MESABUILDDIR)profiled/drawpix.o \ + $(MESABUILDDIR)profiled/enable.o \ + $(MESABUILDDIR)profiled/enums.o \ + $(MESABUILDDIR)profiled/eval.o \ + $(MESABUILDDIR)profiled/extensions.o \ + $(MESABUILDDIR)profiled/feedback.o \ + $(MESABUILDDIR)profiled/fog.o \ + $(MESABUILDDIR)profiled/get.o \ + $(GLAPIPOBJS) \ + $(GLAPINOOPPOBJS) \ + $(GLTHREADPOBJS) \ + $(MESABUILDDIR)profiled/hash.o \ + $(MESABUILDDIR)profiled/hint.o \ + $(MESABUILDDIR)profiled/image.o \ + $(MESABUILDDIR)profiled/imaging.o \ + $(MESABUILDDIR)profiled/light.o \ + $(MESABUILDDIR)profiled/lines.o \ + $(MESABUILDDIR)profiled/logic.o \ + $(MESABUILDDIR)profiled/masking.o \ + $(MESABUILDDIR)profiled/matrix.o \ + $(MESABUILDDIR)profiled/mem.o \ + $(MESABUILDDIR)profiled/mmath.o \ + $(MESABUILDDIR)profiled/pb.o \ + $(MESABUILDDIR)profiled/pipeline.o \ + $(MESABUILDDIR)profiled/pixel.o \ + $(MESABUILDDIR)profiled/pixeltex.o \ + $(MESABUILDDIR)profiled/points.o \ + $(MESABUILDDIR)profiled/polygon.o \ + $(MESABUILDDIR)profiled/quads.o \ + $(MESABUILDDIR)profiled/rastpos.o \ + $(MESABUILDDIR)profiled/readpix.o \ + $(MESABUILDDIR)profiled/rect.o \ + $(MESABUILDDIR)profiled/scissor.o \ + $(MESABUILDDIR)profiled/shade.o \ + $(MESABUILDDIR)profiled/span.o \ + $(MESABUILDDIR)profiled/stages.o \ + $(MESABUILDDIR)profiled/state.o \ + $(MESABUILDDIR)profiled/stencil.o \ + $(MESABUILDDIR)profiled/texformat.o \ + $(MESABUILDDIR)profiled/teximage.o \ + $(MESABUILDDIR)profiled/texobj.o \ + $(MESABUILDDIR)profiled/texstate.o \ + $(MESABUILDDIR)profiled/texture.o \ + $(MESABUILDDIR)profiled/texutil.o \ + $(MESABUILDDIR)profiled/translate.o \ + $(MESABUILDDIR)profiled/triangle.o \ + $(MESABUILDDIR)profiled/varray.o \ + $(MESABUILDDIR)profiled/vb.o \ + $(MESABUILDDIR)profiled/vbcull.o \ + $(MESABUILDDIR)profiled/vbfill.o \ + $(MESABUILDDIR)profiled/vbindirect.o \ + $(MESABUILDDIR)profiled/vbrender.o \ + $(MESABUILDDIR)profiled/vbxform.o \ + $(MESABUILDDIR)profiled/vector.o \ + $(MESABUILDDIR)profiled/vertices.o \ + $(MESABUILDDIR)profiled/winpos.o \ + $(MESABUILDDIR)profiled/xform.o \ + $(MESABUILDDIR)profiled/zoom.o + diff --git a/xc/lib/GL/mesa/src/OSmesa/Imakefile b/xc/lib/GL/mesa/src/OSmesa/Imakefile index ee1b684ff..c15de3f30 100644 --- a/xc/lib/GL/mesa/src/OSmesa/Imakefile +++ b/xc/lib/GL/mesa/src/OSmesa/Imakefile @@ -1,269 +1,51 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.6 2000/12/12 23:24:27 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.10 2001/04/03 02:29:33 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx -LinkSourceFile(osmesa.c, $(MESASRCDIR)/src/OSmesa) +#include "../Imakefile.inc" +#ifdef i386Architecture +#include "../X86/Imakefile.inc" +#endif +LinkSourceFile(osmesa.c, $(MESASRCDIR)/src/OSmesa) #if Malloc0ReturnsNull ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #endif -MESA_INCLUDES = -I. -I.. -I../../include -I../../../../../include +MESA_INCLUDES = -I$(MESASRCDIR)/src/OSmesa -I$(MESASRCDIR)/src \ + -I$(MESASRCDIR)/include DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - - MESASRCS = ../aatriangle.c \ - ../accum.c \ - ../alpha.c \ - ../alphabuf.c \ - ../attrib.c \ - ../bbox.c \ - ../bitmap.c \ - ../blend.c \ - ../buffers.c \ - ../clip.c \ - ../colortab.c \ - ../config.c \ - ../context.c \ - ../copypix.c \ - ../cva.c \ - ../debug_xform.c \ - ../depth.c \ - ../dlist.c \ - ../drawpix.c \ - ../enable.c \ - ../enums.c \ - ../eval.c \ - ../extensions.c \ - ../feedback.c \ - ../fog.c \ - ../get.c \ - ../glapi.c \ - ../glapinoop.c \ - ../glthread.c \ - ../hash.c \ - ../image.c \ - ../imaging.c \ - ../light.c \ - ../lines.c \ - ../logic.c \ - ../masking.c \ - ../matrix.c \ - ../mem.c \ - ../mmath.c \ - ../pb.c \ - ../pipeline.c \ - ../pixel.c \ - ../pixeltex.c \ - ../points.c \ - ../polygon.c \ - ../quads.c \ - ../rastpos.c \ - ../readpix.c \ - ../rect.c \ - ../scissor.c \ - ../shade.c \ - ../span.c \ - ../stages.c \ - ../state.c \ - ../stencil.c \ - ../teximage.c \ - ../texobj.c \ - ../texstate.c \ - ../texture.c \ - ../texutil.c \ - ../translate.c \ - ../triangle.c \ - ../varray.c \ - ../vb.c \ - ../vbcull.c \ - ../vbfill.c \ - ../vbindirect.c \ - ../vbrender.c \ - ../vbxform.c \ - ../vector.c \ - ../vertices.c \ - ../winpos.c \ - ../xform.c \ - ../zoom.c \ - osmesa.c - - MESAOBJS = ../aatriangle.o \ - ../accum.o \ - ../alpha.o \ - ../alphabuf.o \ - ../attrib.o \ - ../bbox.o \ - ../bitmap.o \ - ../blend.o \ - ../buffers.o \ - ../clip.o \ - ../colortab.o \ - ../config.o \ - ../context.o \ - ../copypix.o \ - ../cva.o \ - ../debug_xform.o \ - ../depth.o \ - ../dlist.o \ - ../drawpix.o \ - ../enable.o \ - ../enums.o \ - ../eval.o \ - ../extensions.o \ - ../feedback.o \ - ../fog.o \ - ../get.o \ - ../hash.o \ - ../hint.o \ - ../image.o \ - ../imaging.o \ - ../light.o \ - ../lines.o \ - ../logic.o \ - ../masking.o \ - ../matrix.o \ - ../mem.o \ - ../mmath.o \ - ../pb.o \ - ../pipeline.o \ - ../pixel.o \ - ../pixeltex.o \ - ../points.o \ - ../polygon.o \ - ../quads.o \ - ../rastpos.o \ - ../readpix.o \ - ../rect.o \ - ../scissor.o \ - ../shade.o \ - ../span.o \ - ../stages.o \ - ../state.o \ - ../stencil.o \ - ../teximage.o \ - ../texobj.o \ - ../texstate.o \ - ../texture.o \ - ../texutil.o \ - ../translate.o \ - ../triangle.o \ - ../varray.o \ - ../vb.o \ - ../vbcull.o \ - ../vbfill.o \ - ../vbindirect.o \ - ../vbrender.o \ - ../vbxform.o \ - ../vector.o \ - ../vertices.o \ - ../winpos.o \ - ../xform.o \ - ../zoom.o \ - osmesa.o - -#ifdef i386Architecture - X86_SRCS = ../X86/common_x86.c \ - ../X86/common_x86_asm.S \ - ../X86/x86.c \ - ../X86/x86_cliptest.S \ - ../X86/x86_vertex.S \ - ../X86/x86_xform_masked2.S \ - ../X86/x86_xform_masked3.S \ - ../X86/x86_xform_masked4.S \ - ../X86/x86_xform_raw2.S \ - ../X86/x86_xform_raw3.S \ - ../X86/x86_xform_raw4.S - - X86_OBJS = ../X86/common_x86.o \ - ../X86/common_x86_asm.o \ - ../X86/x86.o \ - ../X86/x86_cliptest.o \ - ../X86/x86_vertex.o \ - ../X86/x86_xform_masked2.o \ - ../X86/x86_xform_masked3.o \ - ../X86/x86_xform_masked4.o \ - ../X86/x86_xform_raw2.o \ - ../X86/x86_xform_raw3.o \ - ../X86/x86_xform_raw4.o - -#if MesaUseMMX - MMX_SRCS = ../X86/mmx_blend.S - - MMX_OBJS = ../X86/mmx_blend.o -#endif - -#if MesaUse3DNow - 3DNOW_SRCS = ../X86/3dnow.c \ - ../X86/3dnow_norm_raw.S \ - ../X86/3dnow_vertex.S \ - ../X86/3dnow_xform_masked1.S \ - ../X86/3dnow_xform_masked2.S \ - ../X86/3dnow_xform_masked3.S \ - ../X86/3dnow_xform_masked4.S \ - ../X86/3dnow_xform_raw1.S \ - ../X86/3dnow_xform_raw2.S \ - ../X86/3dnow_xform_raw3.S \ - ../X86/3dnow_xform_raw4.S - - 3DNOW_OBJS = ../X86/3dnow.o \ - ../X86/3dnow_norm_raw.o \ - ../X86/3dnow_vertex.o \ - ../X86/3dnow_xform_masked1.o \ - ../X86/3dnow_xform_masked2.o \ - ../X86/3dnow_xform_masked3.o \ - ../X86/3dnow_xform_masked4.o \ - ../X86/3dnow_xform_raw1.o \ - ../X86/3dnow_xform_raw2.o \ - ../X86/3dnow_xform_raw3.o \ - ../X86/3dnow_xform_raw4.o + INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) + + MESAOBJS = $(COREMESAOBJS) $(MESA_ASM_OBJS) + MESAUOBJS = $(COREMESAUOBJS) $(MESA_ASM_UOBJS) + MESADOBJS = $(COREMESADOBJS) $(MESA_ASM_DOBJS) + MESAPOBJS = $(COREMESAPOBJS) $(MESA_ASM_POBJS) + + SRCS = osmesa.c + OBJS = osmesa.o $(MESAOBJS) +#if DoSharedLib + UOBJS = unshared/osmesa.o $(MESAUOBJS) +#else + UOBJS = $(OBJS) #endif + DOBJS = debugger/osmesa.o $(MESADOBJS) + POBJS = profiled/osmesa.o $(MESAPOBJS) -#if MesaUseKatmai - KATMAI_SRCS = ../X86/katmai.c \ - ../X86/katmai_norm_raw.S \ - ../X86/katmai_vertex.S \ - ../X86/katmai_xform_masked1.S \ - ../X86/katmai_xform_masked2.S \ - ../X86/katmai_xform_masked3.S \ - ../X86/katmai_xform_masked4.S \ - ../X86/katmai_xform_raw1.S \ - ../X86/katmai_xform_raw2.S \ - ../X86/katmai_xform_raw3.S \ - ../X86/katmai_xform_raw4.S - - KATMAI_OBJS = ../X86/katmai.o \ - ../X86/katmai_norm_raw.o \ - ../X86/katmai_vertex.o \ - ../X86/katmai_xform_masked1.o \ - ../X86/katmai_xform_masked2.o \ - ../X86/katmai_xform_masked3.o \ - ../X86/katmai_xform_masked4.o \ - ../X86/katmai_xform_raw1.o \ - ../X86/katmai_xform_raw2.o \ - ../X86/katmai_xform_raw3.o \ - ../X86/katmai_xform_raw4.o +#if LocalThreads + THREADOBJS = $(THREADS_LIBS) #endif -#endif - - ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) - - SRCS = $(MESASRCS) $(ASMSRCS) - OBJS = $(MESAOBJS) $(ASMOBJS) - UOBJS = $(MESAOBJS) $(ASMOBJS) - DONES = DONE #if !GlxUseBuiltInDRIDriver - REQUIREDLIBS += -L../../.. -lGL + REQUIREDLIBS = $(LDPRELIB) $(GLXLIB) #endif #include <Library.tmpl> @@ -277,11 +59,25 @@ LIBNAME = OSMesa SOREV = 3.3 -/*NormalDepLibraryTarget($(LIBNAME), $(DONES), $(UOBJS))*/ -/*InstallLibrary($(LIBNAME),$(USRLIBDIR))*/ +#if DoNormalLib +NormalLibraryTarget($(LIBNAME), $(UOBJS)) +InstallLibrary($(LIBNAME),$(USRLIBDIR)) +#endif -SharedDepLibraryTarget($(LIBNAME),$(SOREV), $(DONES), $(OBJS), ., .) +#if DoSharedLib +SharedLibraryTarget($(LIBNAME),$(SOREV), $(OBJS), ., .) InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR)) +#endif + +#if DoDebugLib +DebuggedLibraryTarget($(LIBNAME),$(DOBJS)) +InstallLibrary($(LIBNAME_d,$(USRLIBDIR)) +#endif +#if DoProfileLib +ProfiledLibraryTarget($(LIBNAME), $(POBJS)) +InstallLibrary($(LIBNAME)_p,$(USRLIBDIR)) +#endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/X86/Imakefile b/xc/lib/GL/mesa/src/X86/Imakefile index edca1c7ec..9c28d6b26 100644 --- a/xc/lib/GL/mesa/src/X86/Imakefile +++ b/xc/lib/GL/mesa/src/X86/Imakefile @@ -1,174 +1,39 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.14 2000/12/12 23:24:27 dawes Exp $ - -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.17 2001/04/03 02:29:34 dawes Exp $ + +/* + * Only need SharedLib build unless OSMesa lib is built, or driver is built + * in to libGL + */ +#if BuildXF86DRI && !GlxUseSGISI && \ + (GlxUseBuiltInDRIDriver || \ + !GlxBuiltInMesa || !defined(GlxDriverUsesMesa)) +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -LinkSourceFile(assyntax.h, $(MESASRCDIR)/src/X86) -LinkSourceFile(common_x86.c, $(MESASRCDIR)/src/X86) -LinkSourceFile(common_x86_asm.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(common_x86_asm.h, $(MESASRCDIR)/src/X86) -LinkSourceFile(common_x86_features.h, $(MESASRCDIR)/src/X86) -LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) - -LinkSourceFile(xform_args.h, $(MESASRCDIR)/src/X86) -LinkSourceFile(clip_args.h, $(MESASRCDIR)/src/X86) - -LinkSourceFile(x86.c, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86.h, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86_cliptest.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86_vertex.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86_xform_masked2.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86_xform_masked3.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86_xform_masked4.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86_xform_raw2.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86_xform_raw3.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(x86_xform_raw4.S, $(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_vertex.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(katmai.c, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai.h, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_norm_raw.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_vertex.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_xform_masked1.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_xform_masked2.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_xform_masked3.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_xform_masked4.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_xform_raw1.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_xform_raw2.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_xform_raw3.S, $(MESASRCDIR)/src/X86) -LinkSourceFile(katmai_xform_raw4.S, $(MESASRCDIR)/src/X86) - -LinkSourceFile(glapioffsets.h, $(MESASRCDIR)/src) +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtraLib NO +#define DoDebugLib NO +#define DoProfileLib NO +#endif #if Malloc0ReturnsNull ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #endif -#ifdef i386Architecture -XCOMM Determine at runtime whether 3DNow!, Katmai, MMX, etc are really present. - X86_SRCS = common_x86.c \ - common_x86_asm.S \ - glapi_x86.S \ - x86.c \ - x86_cliptest.S \ - x86_vertex.S \ - x86_xform_masked2.S \ - x86_xform_masked3.S \ - x86_xform_masked4.S \ - x86_xform_raw2.S \ - x86_xform_raw3.S \ - x86_xform_raw4.S - - X86_OBJS = common_x86.o \ - common_x86_asm.o \ - x86.o \ - x86_cliptest.o \ - x86_vertex.o \ - x86_xform_masked2.o \ - x86_xform_masked3.o \ - x86_xform_masked4.o \ - x86_xform_raw2.o \ - x86_xform_raw3.o \ - x86_xform_raw4.o - - X86_DEFS = -DUSE_X86_ASM - - -#if MesaUseMMX - MMX_SRCS = mmx_blend.S - - MMX_OBJS = mmx_blend.o +#define MesaX86BuildDir /**/ +#define NeedToLinkMesaSrc +#include "Imakefile.inc" - MMX_DEFS = -DUSE_MMX_ASM -#endif + DEFINES = $(ALLOC_DEFINES) GlxDefines /*-DFX*/ $(MESA_ASM_DEFS) + INCLUDES = -I$(INCLUDESRC) -I$(EXTINCSRC) -I$(MESASRCDIR)/src \ + -I$(MESASRCDIR)/src/X86 -#if MesaUse3DNow - 3DNOW_SRCS = 3dnow.c \ - 3dnow_norm_raw.S \ - 3dnow_vertex.S \ - 3dnow_xform_masked1.S \ - 3dnow_xform_masked2.S \ - 3dnow_xform_masked3.S \ - 3dnow_xform_masked4.S \ - 3dnow_xform_raw1.S \ - 3dnow_xform_raw2.S \ - 3dnow_xform_raw3.S \ - 3dnow_xform_raw4.S - - 3DNOW_OBJS = 3dnow.o \ - 3dnow_norm_raw.o \ - 3dnow_vertex.o \ - 3dnow_xform_masked1.o \ - 3dnow_xform_masked2.o \ - 3dnow_xform_masked3.o \ - 3dnow_xform_masked4.o \ - 3dnow_xform_raw1.o \ - 3dnow_xform_raw2.o \ - 3dnow_xform_raw3.o \ - 3dnow_xform_raw4.o - - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif - -#if MesaUseKatmai - KATMAI_SRCS = katmai.c \ - katmai_norm_raw.S \ - katmai_vertex.S \ - katmai_xform_masked1.S \ - katmai_xform_masked2.S \ - katmai_xform_masked3.S \ - katmai_xform_masked4.S \ - katmai_xform_raw1.S \ - katmai_xform_raw2.S \ - katmai_xform_raw3.S \ - katmai_xform_raw4.S - - KATMAI_OBJS = katmai.o \ - katmai_norm_raw.o \ - katmai_vertex.o \ - katmai_xform_masked1.o \ - katmai_xform_masked2.o \ - katmai_xform_masked3.o \ - katmai_xform_masked4.o \ - katmai_xform_raw1.o \ - katmai_xform_raw2.o \ - katmai_xform_raw3.o \ - katmai_xform_raw4.o - - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - -#endif - - DEFINES = $(ALLOC_DEFINES) GlxDefines -DFX $(X86_DEFS) $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) -I../include -I../../include -I../../dri -I.. - SRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - OBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) - -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif + SRCS = $(MESA_ASM_SRCS) + OBJS = $(MESA_ASM_OBJS) #include <Library.tmpl> @@ -221,3 +86,4 @@ ObjectFromAsmSource(katmai_xform_raw4, NullParameter) #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/X86/Imakefile.inc b/xc/lib/GL/mesa/src/X86/Imakefile.inc new file mode 100644 index 000000000..7f505e745 --- /dev/null +++ b/xc/lib/GL/mesa/src/X86/Imakefile.inc @@ -0,0 +1,288 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile.inc,v 1.1 2001/03/23 19:18:37 dawes Exp $ + +#ifndef MesaX86BuildDir +#define MesaX86BuildDir $(GLXLIBSRC)/mesa/src/X86/ +#endif + +MESAX86BUILDDIR = MesaX86BuildDir + +MESA_X86_SRCS = $(MESAX86BUILDDIR)common_x86.c \ + $(MESAX86BUILDDIR)common_x86_asm.S \ + $(MESAX86BUILDDIR)glapi_x86.S \ + $(MESAX86BUILDDIR)x86.c \ + $(MESAX86BUILDDIR)x86_cliptest.S \ + $(MESAX86BUILDDIR)x86_vertex.S \ + $(MESAX86BUILDDIR)x86_xform_masked2.S \ + $(MESAX86BUILDDIR)x86_xform_masked3.S \ + $(MESAX86BUILDDIR)x86_xform_masked4.S \ + $(MESAX86BUILDDIR)x86_xform_raw2.S \ + $(MESAX86BUILDDIR)x86_xform_raw3.S \ + $(MESAX86BUILDDIR)x86_xform_raw4.S + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(common_x86.c, $(MESASRCDIR)/src/X86) +LinkSourceFile(common_x86_asm.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86.c, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86_cliptest.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86_vertex.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86_xform_masked2.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86_xform_masked3.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86_xform_masked4.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86_xform_raw2.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86_xform_raw3.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(x86_xform_raw4.S, $(MESASRCDIR)/src/X86) +#endif + +MESA_X86_OBJS = $(MESAX86BUILDDIR)common_x86.o \ + $(MESAX86BUILDDIR)common_x86_asm.o \ + $(MESAX86BUILDDIR)x86.o \ + $(MESAX86BUILDDIR)x86_cliptest.o \ + $(MESAX86BUILDDIR)x86_vertex.o \ + $(MESAX86BUILDDIR)x86_xform_masked2.o \ + $(MESAX86BUILDDIR)x86_xform_masked3.o \ + $(MESAX86BUILDDIR)x86_xform_masked4.o \ + $(MESAX86BUILDDIR)x86_xform_raw2.o \ + $(MESAX86BUILDDIR)x86_xform_raw3.o \ + $(MESAX86BUILDDIR)x86_xform_raw4.o + +#if DoSharedLib +MESA_X86_UOBJS = $(MESAX86BUILDDIR)unshared/common_x86.o \ + $(MESAX86BUILDDIR)common_x86_asm.o \ + $(MESAX86BUILDDIR)unshared/x86.o \ + $(MESAX86BUILDDIR)x86_cliptest.o \ + $(MESAX86BUILDDIR)x86_vertex.o \ + $(MESAX86BUILDDIR)x86_xform_masked2.o \ + $(MESAX86BUILDDIR)x86_xform_masked3.o \ + $(MESAX86BUILDDIR)x86_xform_masked4.o \ + $(MESAX86BUILDDIR)x86_xform_raw2.o \ + $(MESAX86BUILDDIR)x86_xform_raw3.o \ + $(MESAX86BUILDDIR)x86_xform_raw4.o +#else +MESA_X86_UOBJS = $(MESA_X86_OBJS) +#endif + +MESA_X86_DOBJS = $(MESAX86BUILDDIR)debugger/common_x86.o \ + $(MESAX86BUILDDIR)common_x86_asm.o \ + $(MESAX86BUILDDIR)debugger/x86.o \ + $(MESAX86BUILDDIR)x86_cliptest.o \ + $(MESAX86BUILDDIR)x86_vertex.o \ + $(MESAX86BUILDDIR)x86_xform_masked2.o \ + $(MESAX86BUILDDIR)x86_xform_masked3.o \ + $(MESAX86BUILDDIR)x86_xform_masked4.o \ + $(MESAX86BUILDDIR)x86_xform_raw2.o \ + $(MESAX86BUILDDIR)x86_xform_raw3.o \ + $(MESAX86BUILDDIR)x86_xform_raw4.o + +MESA_X86_POBJS = $(MESAX86BUILDDIR)profiled/common_x86.o \ + $(MESAX86BUILDDIR)common_x86_asm.o \ + $(MESAX86BUILDDIR)profiled/x86.o \ + $(MESAX86BUILDDIR)x86_cliptest.o \ + $(MESAX86BUILDDIR)x86_vertex.o \ + $(MESAX86BUILDDIR)x86_xform_masked2.o \ + $(MESAX86BUILDDIR)x86_xform_masked3.o \ + $(MESAX86BUILDDIR)x86_xform_masked4.o \ + $(MESAX86BUILDDIR)x86_xform_raw2.o \ + $(MESAX86BUILDDIR)x86_xform_raw3.o \ + $(MESAX86BUILDDIR)x86_xform_raw4.o + +MESA_X86_DEFS = -DUSE_X86_ASM + + +#if MesaUseMMX +MESA_MMX_SRCS = $(MESAX86BUILDDIR)mmx_blend.S + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(mmx_blend.S, $(MESASRCDIR)/src/X86) +#endif + +MESA_MMX_OBJS = $(MESAX86BUILDDIR)mmx_blend.o + +MESA_MMX_UOBJS = $(MESA_MMX_OBJS) +MESA_MMX_DOBJS = $(MESA_MMX_OBJS) +MESA_MMX_POBJS = $(MESA_MMX_OBJS) + +MESA_MMX_DEFS = -DUSE_MMX_ASM +#endif + +#if MesaUse3DNow +MESA_3DNOW_SRCS = $(MESAX86BUILDDIR)3dnow.c \ + $(MESAX86BUILDDIR)3dnow_norm_raw.S \ + $(MESAX86BUILDDIR)3dnow_vertex.S \ + $(MESAX86BUILDDIR)3dnow_xform_masked1.S \ + $(MESAX86BUILDDIR)3dnow_xform_masked2.S \ + $(MESAX86BUILDDIR)3dnow_xform_masked3.S \ + $(MESAX86BUILDDIR)3dnow_xform_masked4.S \ + $(MESAX86BUILDDIR)3dnow_xform_raw1.S \ + $(MESAX86BUILDDIR)3dnow_xform_raw2.S \ + $(MESAX86BUILDDIR)3dnow_xform_raw3.S \ + $(MESAX86BUILDDIR)3dnow_xform_raw4.S + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(3dnow.c, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_norm_raw.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(3dnow_vertex.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) +#endif +MESA_3DNOW_OBJS = $(MESAX86BUILDDIR)3dnow.o \ + $(MESAX86BUILDDIR)3dnow_norm_raw.o \ + $(MESAX86BUILDDIR)3dnow_vertex.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked1.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked2.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked3.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked4.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw1.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw2.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw3.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw4.o + +#ifdef DoSharedLib +MESA_3DNOW_UOBJS = $(MESAX86BUILDDIR)unshared/3dnow.o \ + $(MESAX86BUILDDIR)3dnow_norm_raw.o \ + $(MESAX86BUILDDIR)3dnow_vertex.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked1.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked2.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked3.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked4.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw1.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw2.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw3.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw4.o +#else +MESA_3DNOW_UOBJS = $(MESA_3DNOW_OBJS) +#endif + +MESA_3DNOW_DOBJS = $(MESAX86BUILDDIR)debugger/3dnow.o \ + $(MESAX86BUILDDIR)3dnow_norm_raw.o \ + $(MESAX86BUILDDIR)3dnow_vertex.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked1.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked2.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked3.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked4.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw1.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw2.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw3.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw4.o + +MESA_3DNOW_POBJS = $(MESAX86BUILDDIR)profiled/3dnow.o \ + $(MESAX86BUILDDIR)3dnow_norm_raw.o \ + $(MESAX86BUILDDIR)3dnow_vertex.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked1.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked2.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked3.o \ + $(MESAX86BUILDDIR)3dnow_xform_masked4.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw1.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw2.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw3.o \ + $(MESAX86BUILDDIR)3dnow_xform_raw4.o + +MESA_3DNOW_DEFS = -DUSE_3DNOW_ASM +#endif + +#if MesaUseKatmai +MESA_KATMAI_SRCS = $(MESAX86BUILDDIR)katmai.c \ + $(MESAX86BUILDDIR)katmai_norm_raw.S \ + $(MESAX86BUILDDIR)katmai_vertex.S \ + $(MESAX86BUILDDIR)katmai_xform_masked1.S \ + $(MESAX86BUILDDIR)katmai_xform_masked2.S \ + $(MESAX86BUILDDIR)katmai_xform_masked3.S \ + $(MESAX86BUILDDIR)katmai_xform_masked4.S \ + $(MESAX86BUILDDIR)katmai_xform_raw1.S \ + $(MESAX86BUILDDIR)katmai_xform_raw2.S \ + $(MESAX86BUILDDIR)katmai_xform_raw3.S \ + $(MESAX86BUILDDIR)katmai_xform_raw4.S + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(katmai.c, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_norm_raw.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_vertex.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_xform_masked1.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_xform_masked2.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_xform_masked3.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_xform_masked4.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_xform_raw1.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_xform_raw2.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_xform_raw3.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(katmai_xform_raw4.S, $(MESASRCDIR)/src/X86) +#endif + +MESA_KATMAI_OBJS = $(MESAX86BUILDDIR)katmai.o \ + $(MESAX86BUILDDIR)katmai_norm_raw.o \ + $(MESAX86BUILDDIR)katmai_vertex.o \ + $(MESAX86BUILDDIR)katmai_xform_masked1.o \ + $(MESAX86BUILDDIR)katmai_xform_masked2.o \ + $(MESAX86BUILDDIR)katmai_xform_masked3.o \ + $(MESAX86BUILDDIR)katmai_xform_masked4.o \ + $(MESAX86BUILDDIR)katmai_xform_raw1.o \ + $(MESAX86BUILDDIR)katmai_xform_raw2.o \ + $(MESAX86BUILDDIR)katmai_xform_raw3.o \ + $(MESAX86BUILDDIR)katmai_xform_raw4.o + +#if DoSharedLib +MESA_KATMAI_UOBJS = $(MESAX86BUILDDIR)unshared/katmai.o \ + $(MESAX86BUILDDIR)katmai_norm_raw.o \ + $(MESAX86BUILDDIR)katmai_vertex.o \ + $(MESAX86BUILDDIR)katmai_xform_masked1.o \ + $(MESAX86BUILDDIR)katmai_xform_masked2.o \ + $(MESAX86BUILDDIR)katmai_xform_masked3.o \ + $(MESAX86BUILDDIR)katmai_xform_masked4.o \ + $(MESAX86BUILDDIR)katmai_xform_raw1.o \ + $(MESAX86BUILDDIR)katmai_xform_raw2.o \ + $(MESAX86BUILDDIR)katmai_xform_raw3.o \ + $(MESAX86BUILDDIR)katmai_xform_raw4.o +#else +MESA_KATMAI_UOBJS = $(MESA_KATMAI_OBJS) +#endif + +MESA_KATMAI_DOBJS = $(MESAX86BUILDDIR)debugger/katmai.o \ + $(MESAX86BUILDDIR)katmai_norm_raw.o \ + $(MESAX86BUILDDIR)katmai_vertex.o \ + $(MESAX86BUILDDIR)katmai_xform_masked1.o \ + $(MESAX86BUILDDIR)katmai_xform_masked2.o \ + $(MESAX86BUILDDIR)katmai_xform_masked3.o \ + $(MESAX86BUILDDIR)katmai_xform_masked4.o \ + $(MESAX86BUILDDIR)katmai_xform_raw1.o \ + $(MESAX86BUILDDIR)katmai_xform_raw2.o \ + $(MESAX86BUILDDIR)katmai_xform_raw3.o \ + $(MESAX86BUILDDIR)katmai_xform_raw4.o + +MESA_KATMAI_POBJS = $(MESAX86BUILDDIR)profiled/katmai.o \ + $(MESAX86BUILDDIR)katmai_norm_raw.o \ + $(MESAX86BUILDDIR)katmai_vertex.o \ + $(MESAX86BUILDDIR)katmai_xform_masked1.o \ + $(MESAX86BUILDDIR)katmai_xform_masked2.o \ + $(MESAX86BUILDDIR)katmai_xform_masked3.o \ + $(MESAX86BUILDDIR)katmai_xform_masked4.o \ + $(MESAX86BUILDDIR)katmai_xform_raw1.o \ + $(MESAX86BUILDDIR)katmai_xform_raw2.o \ + $(MESAX86BUILDDIR)katmai_xform_raw3.o \ + $(MESAX86BUILDDIR)katmai_xform_raw4.o + +MESA_KATMAI_DEFS = -DUSE_KATMAI_ASM +#endif + +MESA_ASM_SRCS = $(MESA_X86_SRCS) $(MESA_MMX_SRCS) $(MESA_3DNOW_SRCS) \ + $(MESA_KATMAI_SRCS) + +MESA_ASM_OBJS = $(MESA_X86_OBJS) $(MESA_MMX_OBJS) $(MESA_3DNOW_OBJS) \ + $(MESA_KATMAI_OBJS) + +MESA_ASM_UOBJS = $(MESA_X86_UOBJS) $(MESA_MMX_UOBJS) $(MESA_3DNOW_UOBJS) \ + $(MESA_KATMAI_UOBJS) + +MESA_ASM_DOBJS = $(MESA_X86_DOBJS) $(MESA_MMX_DOBJS) $(MESA_3DNOW_DOBJS) \ + $(MESA_KATMAI_DOBJS) + +MESA_ASM_POBJS = $(MESA_X86_POBJS) $(MESA_MMX_POBJS) $(MESA_3DNOW_POBJS) \ + $(MESA_KATMAI_POBJS) + +MESA_ASM_DEFS = -DUSE_X86_ASM $(MESA_MMX_DEFS) $(MESA_3DNOW_DEFS) \ + $(MESA_KATMAI_DEFS) + diff --git a/xc/lib/GL/mesa/src/drv/Imakefile b/xc/lib/GL/mesa/src/drv/Imakefile index 6639512c2..8c7068088 100644 --- a/xc/lib/GL/mesa/src/drv/Imakefile +++ b/xc/lib/GL/mesa/src/drv/Imakefile @@ -1,81 +1,15 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.17 2001/01/08 01:07:17 martin Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/Imakefile,v 1.19 2001/03/23 20:56:33 dawes Exp $ -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx -#define DoExtraLib SharedLibGlx -#define DoDebugLib DebugLibGlx -#define DoProfileLib ProfileLibGlx +#ifdef DriDrivers #define IHaveSubdirs #define PassCDebugFlags -#if GlxUseBuiltInDRIDriver -#if GlxBuiltInGamma -DRIVER += gamma -#endif -#if GlxBuiltInTdfx -DRIVER += tdfx -#endif -#if GlxBuiltInMga -DRIVER += common mga -#endif -#if GlxBuiltInI810 -DRIVER += common i810 -#endif -#if GlxBuiltInR128 -DRIVER += common r128 -#endif -#if GlxBuiltInRadeon -DRIVER += common radeon -#endif -#if GlxBuiltInFfb -DRIVER += ffb -#endif -#if GlxBuiltInSIS -DRIVER += sis -#endif - -SUBDIRS = $(DRIVER) - -#else /* GlxUseBuiltInDRIDriver */ - -#if defined(i386Architecture) || defined(ia64Architecture) - -SUBDIRS += common -SUBDIRS += gamma -SUBDIRS += mga -SUBDIRS += i810 -SUBDIRS += r128 -SUBDIRS += radeon -SUBDIRS += sis -#if HasGlide3 -SUBDIRS += tdfx -#endif - -#elif defined(AlphaArchitecture) - -SUBDIRS += common -SUBDIRS += gamma -SUBDIRS += mga -SUBDIRS += r128 -SUBDIRS += radeon -#if HasGlide3 -SUBDIRS += tdfx -#endif - -#elif defined(SparcArchitecture) - -SUBDIRS += ffb - -#else - -SUBDIRS = - -#endif /* architecture */ - -#endif /* GlxUseBuiltInDRIDriver */ +SUBDIRS = common DriDrivers MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) DependTarget() + +#endif diff --git a/xc/lib/GL/mesa/src/drv/common/Imakefile b/xc/lib/GL/mesa/src/drv/common/Imakefile index d47b662e8..4f1c19b5f 100644 --- a/xc/lib/GL/mesa/src/drv/common/Imakefile +++ b/xc/lib/GL/mesa/src/drv/common/Imakefile @@ -1,40 +1,27 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/common/Imakefile,v 1.6 2001/04/03 02:29:34 dawes Exp $ -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DDRIVERTS - DRI_INCLUDES = -I../../../../dri -I../../../../glx \ - -I$(TOP)/include -I$(TOP)/include/GL \ - -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \ - -I../../../include -I../.. -I../common -I../../X +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif -MESA_INCLUDES = -I. -I.. -I../../include - - +#define MesaDrvCommonBuildDir /**/ +#include "Imakefile.inc" DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - DRISRCS = hwlog.c mm.c - DRIOBJS = hwlog.o mm.o - - SRCS = $(DRISRCS) - OBJS = $(DRIOBJS) - -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) + + SRCS = $(COMMONSRCS) + OBJS = $(COMMONOBJS) #include <Library.tmpl> @@ -43,13 +30,4 @@ LibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) -XCOMM #if !GlxUseBuiltInDRIDriver -#if 0 -LIBNAME = i810_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) -InstallDynamicModule($(LIBNAME),$(MODULEDIR),.) -#endif - DependTarget() diff --git a/xc/lib/GL/mesa/src/drv/common/Imakefile.inc b/xc/lib/GL/mesa/src/drv/common/Imakefile.inc new file mode 100644 index 000000000..7fff046d8 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/common/Imakefile.inc @@ -0,0 +1,44 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/common/Imakefile.inc,v 1.1 2001/03/23 19:18:38 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvCommonBuildDir +#define MesaDrvCommonBuildDir $(MESADRVSRCDIR)/common/ +#endif +MESADRVCOMMONBUILDDIR = MesaDrvCommonBuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DDRIVERTS + DRI_INCLUDES = +#endif + +MESA_INCLUDES = -I$(MESADRVSRCDIR)/common + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + COMMONSRCS = $(MESADRVCOMMONBUILDDIR)hwlog.c \ + $(MESADRVCOMMONBUILDDIR)mm.c + + COMMONOBJS = $(MESADRVCOMMONBUILDDIR)hwlog.o \ + $(MESADRVCOMMONBUILDDIR)mm.o + + COMMONUOBJS = $(MESADRVCOMMONBUILDDIR)unshared/hwlog.o \ + $(MESADRVCOMMONBUILDDIR)unshared/mm.o + + COMMONDOBJS = $(MESADRVCOMMONBUILDDIR)debugger/hwlog.o \ + $(MESADRVCOMMONBUILDDIR)debugger/mm.o + + COMMONPOBJS = $(MESADRVCOMMONBUILDDIR)profiled/hwlog.o \ + $(MESADRVCOMMONBUILDDIR)profiled/mm.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(hwlog.c, $(MESADRVSRCDIR)/common) +LinkSourceFile(mm.c, $(MESADRVSRCDIR)/common) +#endif diff --git a/xc/lib/GL/mesa/src/drv/common/depthtmp.h b/xc/lib/GL/mesa/src/drv/common/depthtmp.h index 0c10eae19..f3da61e51 100644 --- a/xc/lib/GL/mesa/src/drv/common/depthtmp.h +++ b/xc/lib/GL/mesa/src/drv/common/depthtmp.h @@ -1,9 +1,10 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.4 2000/12/04 22:43:20 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.5 2001/03/21 16:14:20 dawes Exp $ */ #ifndef DBG #define DBG 0 #endif + #ifndef HAVE_HW_DEPTH_SPANS #define HAVE_HW_DEPTH_SPANS 0 #endif @@ -11,13 +12,19 @@ #define HAVE_HW_DEPTH_PIXELS 0 #endif +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif static void TAG(WriteDepthSpan)( GLcontext *ctx, - GLuint n, GLint x, GLint y, + GLuint n, GLint x, GLint y, const GLdepth *depth, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -54,7 +61,7 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteDepthPixels)( GLcontext *ctx, @@ -64,7 +71,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, const GLdepth depth[], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_DEPTH_VARS; @@ -89,7 +96,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -99,7 +106,7 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth depth[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint x1, n1; LOCAL_DEPTH_VARS; @@ -123,14 +130,14 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_READ_UNLOCK(); } static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLdepth depth[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_DEPTH_VARS; @@ -153,9 +160,10 @@ static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n, HW_ENDCLIPLOOP(); #endif } - HW_UNLOCK(); + HW_READ_UNLOCK(); } + #if HAVE_HW_DEPTH_SPANS #undef WRITE_DEPTH_SPAN #undef WRITE_DEPTH_PIXELS diff --git a/xc/lib/GL/mesa/src/drv/common/spantmp.h b/xc/lib/GL/mesa/src/drv/common/spantmp.h index 1e69d7b7f..4cac09bd0 100644 --- a/xc/lib/GL/mesa/src/drv/common/spantmp.h +++ b/xc/lib/GL/mesa/src/drv/common/spantmp.h @@ -2,21 +2,45 @@ #define DBG 0 #endif -static void TAG(WriteRGBASpan)( const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], +#ifndef HW_WRITE_LOCK +#define HW_WRITE_LOCK() HW_LOCK() +#endif + +#ifndef HW_WRITE_UNLOCK +#define HW_WRITE_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif + +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_CLIPLOOP +#define HW_READ_CLIPLOOP() HW_CLIPLOOP() +#endif + +#ifndef HW_WRITE_CLIPLOOP +#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP() +#endif + + +static void TAG(WriteRGBASpan)( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; LOCAL_VARS; - - y = Y_FLIP(y); + y = Y_FLIP(y); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); @@ -26,31 +50,31 @@ static void TAG(WriteRGBASpan)( const GLcontext *ctx, if (mask) { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) - WRITE_RGBA( x1, y, - rgba[i][0], rgba[i][1], + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } else { - for (;i<n1;i++,x1++) - WRITE_RGBA( x1, y, - rgba[i][0], rgba[i][1], + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteRGBSpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], + const GLubyte rgb[][3], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -58,7 +82,7 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx, y = Y_FLIP(y); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); @@ -68,59 +92,59 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx, if (mask) { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); } else { - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteRGBAPixels)( const GLcontext *ctx, - GLuint n, - const GLint x[], + GLuint n, + const GLint x[], const GLint y[], - const GLubyte rgba[][4], + const GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_VARS; if (DBG) fprintf(stderr, "WriteRGBAPixels\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { for (i=0;i<n;i++) { if (mask[i]) { const int fy = Y_FLIP(y[i]); if (CLIPPIXEL(x[i],fy)) - WRITE_RGBA( x[i], fy, - rgba[i][0], rgba[i][1], + WRITE_RGBA( x[i], fy, + rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3] ); } } } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } -static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, - GLuint n, GLint x, GLint y, +static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, + GLuint n, GLint x, GLint y, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -131,26 +155,26 @@ static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx, if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); - for (;i<n1;i++,x1++) + for (;n1>0;i++,x1++,n1--) if (mask[i]) WRITE_PIXEL( x1, y, p ); } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, - GLuint n, + GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_VARS; @@ -158,7 +182,7 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n"); - HW_CLIPLOOP() + HW_WRITE_CLIPLOOP() { for (i=0;i<n;i++) if (mask[i]) { @@ -168,20 +192,16 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx, } } HW_ENDCLIPLOOP(); - } - HW_UNLOCK(); + } + HW_WRITE_UNLOCK(); } - -/* - * Read a horizontal span of color pixels. - */ static void TAG(ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4]) { - HW_LOCK() + HW_READ_LOCK() { GLint x1,n1; LOCAL_VARS; @@ -190,30 +210,31 @@ static void TAG(ReadRGBASpan)( const GLcontext *ctx, if (DBG) fprintf(stderr, "ReadRGBASpan\n"); - HW_CLIPLOOP() + HW_READ_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); - for (;i<n1;i++) - READ_RGBA( rgba[i], (x1+i), y ); + for (;n1>0;i++,x1++,n1--) + READ_RGBA( rgba[i], x1, y ); } - HW_ENDCLIPLOOP(); + HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } + static void TAG(ReadRGBAPixels)( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_VARS; if (DBG) fprintf(stderr, "ReadRGBAPixels\n"); - - HW_CLIPLOOP() + + HW_READ_CLIPLOOP() { for (i=0;i<n;i++) if (mask[i]) { @@ -224,7 +245,7 @@ static void TAG(ReadRGBAPixels)( const GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } diff --git a/xc/lib/GL/mesa/src/drv/common/stenciltmp.h b/xc/lib/GL/mesa/src/drv/common/stenciltmp.h index d22f6867c..365e9811a 100644 --- a/xc/lib/GL/mesa/src/drv/common/stenciltmp.h +++ b/xc/lib/GL/mesa/src/drv/common/stenciltmp.h @@ -1,16 +1,29 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/common/stenciltmp.h,v 1.2 2000/09/26 15:56:46 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/common/stenciltmp.h,v 1.3 2001/03/21 16:14:20 dawes Exp $ */ #ifndef DBG #define DBG 0 #endif +#ifndef HW_WRITE_LOCK +#define HW_WRITE_LOCK() HW_LOCK() +#endif +#ifndef HW_WRITE_UNLOCK +#define HW_WRITE_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif static void TAG(WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, const GLstencil *stencil, const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint x1; GLint n1; @@ -40,7 +53,7 @@ static void TAG(WriteStencilSpan)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -51,7 +64,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx, const GLstencil stencil[], const GLubyte mask[] ) { - HW_LOCK() + HW_WRITE_LOCK() { GLint i; LOCAL_STENCIL_VARS; @@ -71,7 +84,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_WRITE_UNLOCK(); } @@ -81,7 +94,7 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, GLstencil stencil[]) { - HW_LOCK() + HW_READ_LOCK() { GLint x1,n1; LOCAL_STENCIL_VARS; @@ -99,14 +112,14 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLstencil stencil[] ) { - HW_LOCK() + HW_READ_LOCK() { GLint i; LOCAL_STENCIL_VARS; @@ -123,7 +136,7 @@ static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n, } HW_ENDCLIPLOOP(); } - HW_UNLOCK(); + HW_READ_UNLOCK(); } diff --git a/xc/lib/GL/mesa/src/drv/ffb/Imakefile b/xc/lib/GL/mesa/src/drv/ffb/Imakefile index fdb762ec8..60f89bb43 100644 --- a/xc/lib/GL/mesa/src/drv/ffb/Imakefile +++ b/xc/lib/GL/mesa/src/drv/ffb/Imakefile @@ -1,234 +1,55 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile,v 1.7 2001/02/16 01:26:09 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile,v 1.11 2001/04/03 02:29:34 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx + +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DDRIVERTS - DRI_INCLUDES = -I../../../../dri -I../../../../glx \ - -I$(TOP)/include -I$(TOP)/include/GL \ - -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \ - -I$(XF86DRIVERSRC)/sunffb \ - -I../../../include -I../.. -I../../X -I../common \ - -I../../../dri +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../Imakefile.inc" +#ifdef i386Architecture +#include "../../X86/Imakefile.inc" #endif -MESA_INCLUDES = -I. -I.. -I../../include \ - -I../../../../dri/drm - - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRISRCS = ../../../dri/dri_mesa.c \ - ../../../../dri/dri_tmm.c - - DRIOBJS = ../../../dri/dri_mesa.o \ - ../../../../dri/dri_tmm.o - - DRMSRCS = ../../../../dri/drm/xf86drm.c \ - ../../../../dri/drm/xf86drmHash.c \ - ../../../../dri/drm/xf86drmRandom.c \ - ../../../../dri/drm/xf86drmSL.c - - DRMOBJS = ../../../../dri/drm/xf86drm.o \ - ../../../../dri/drm/xf86drmHash.o \ - ../../../../dri/drm/xf86drmRandom.o \ - ../../../../dri/drm/xf86drmSL.o + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - MESASRCS = ../../aatriangle.c \ - ../../accum.c \ - ../../alpha.c \ - ../../alphabuf.c \ - ../../attrib.c \ - ../../bbox.c \ - ../../bitmap.c \ - ../../blend.c \ - ../../buffers.c \ - ../../clip.c \ - ../../colortab.c \ - ../../config.c \ - ../../context.c \ - ../../copypix.c \ - ../../cva.c \ - ../../debug_xform.c \ - ../../depth.c \ - ../../dlist.c \ - ../../drawpix.c \ - ../../enable.c \ - ../../enums.c \ - ../../eval.c \ - ../../extensions.c \ - ../../feedback.c \ - ../../fog.c \ - ../../get.c \ - ../../glapi.c \ - ../../glapinoop.c \ - ../../glthread.c \ - ../../hash.c \ - ../../image.c \ - ../../imaging.c \ - ../../light.c \ - ../../lines.c \ - ../../logic.c \ - ../../masking.c \ - ../../matrix.c \ - ../../mem.c \ - ../../mmath.c \ - ../../pb.c \ - ../../pipeline.c \ - ../../pixel.c \ - ../../pixeltex.c \ - ../../points.c \ - ../../polygon.c \ - ../../quads.c \ - ../../rastpos.c \ - ../../readpix.c \ - ../../rect.c \ - ../../scissor.c \ - ../../shade.c \ - ../../span.c \ - ../../stages.c \ - ../../state.c \ - ../../stencil.c \ - ../../teximage.c \ - ../../texobj.c \ - ../../texstate.c \ - ../../texture.c \ - ../../texutil.c \ - ../../translate.c \ - ../../triangle.c \ - ../../varray.c \ - ../../vb.c \ - ../../vbcull.c \ - ../../vbfill.c \ - ../../vbindirect.c \ - ../../vbrender.c \ - ../../vbxform.c \ - ../../vector.c \ - ../../vertices.c \ - ../../winpos.c \ - ../../xform.c \ - ../../zoom.c + DRIOBJS = $(GLXLIBSRC)/mesa/dri/dri_mesa.o \ + $(GLXLIBSRC)/dri/dri_tmm.o - MESAOBJS = ../../aatriangle.o \ - ../../accum.o \ - ../../alpha.o \ - ../../alphabuf.o \ - ../../attrib.o \ - ../../bbox.o \ - ../../bitmap.o \ - ../../blend.o \ - ../../buffers.o \ - ../../clip.o \ - ../../colortab.o \ - ../../config.o \ - ../../context.o \ - ../../copypix.o \ - ../../cva.o \ - ../../debug_xform.o \ - ../../depth.o \ - ../../dlist.o \ - ../../drawpix.o \ - ../../enable.o \ - ../../enums.o \ - ../../eval.o \ - ../../extensions.o \ - ../../feedback.o \ - ../../fog.o \ - ../../get.o \ - ../../hash.o \ - ../../hint.o \ - ../../image.o \ - ../../imaging.o \ - ../../light.o \ - ../../lines.o \ - ../../logic.o \ - ../../masking.o \ - ../../matrix.o \ - ../../mem.o \ - ../../mmath.o \ - ../../pb.o \ - ../../pipeline.o \ - ../../pixel.o \ - ../../pixeltex.o \ - ../../points.o \ - ../../polygon.o \ - ../../quads.o \ - ../../rastpos.o \ - ../../readpix.o \ - ../../rect.o \ - ../../scissor.o \ - ../../shade.o \ - ../../span.o \ - ../../stages.o \ - ../../state.o \ - ../../stencil.o \ - ../../teximage.o \ - ../../texobj.o \ - ../../texstate.o \ - ../../texture.o \ - ../../texutil.o \ - ../../translate.o \ - ../../triangle.o \ - ../../varray.o \ - ../../vb.o \ - ../../vbcull.o \ - ../../vbfill.o \ - ../../vbindirect.o \ - ../../vbrender.o \ - ../../vbxform.o \ - ../../vector.o \ - ../../vertices.o \ - ../../winpos.o \ - ../../xform.o \ - ../../zoom.o + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o - FFBSRCS = ffb_dd.c ffb_span.c ffb_depth.c ffb_state.c ffb_clear.c ffb_vb.c \ - ffb_lines.c ffb_points.c ffb_tris.c ffb_pipeline.c \ - ffb_stencil.c ffb_xmesa.c + SRCS = $(FFBSRCS) + OBJS = $(FFBOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) - FFBOBJS = ffb_dd.o ffb_span.o ffb_depth.o ffb_state.o ffb_clear.o ffb_vb.o \ - ffb_lines.o ffb_points.o ffb_tris.o ffb_pipeline.o \ - ffb_stencil.o ffb_xmesa.o - - SRCS = $(FFBSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) - OBJS = $(FFBOBJS) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) - -REQUIREDLIBS += MathLibrary -#if !GlxBuiltInFfb -REQUIREDLIBS += -L../../../.. -lGL -#endif - -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif +REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) #include <Library.tmpl> -LibraryObjectRule() - SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = ffb_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDriModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +SharedDriModuleTarget($(LIBNAME),DONE,$(OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc b/xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc new file mode 100644 index 000000000..c7608f765 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc @@ -0,0 +1,113 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/ffb/Imakefile.inc,v 1.1 2001/03/23 19:18:39 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvFfbBuildDir +#define MesaDrvFfbBuildDir /**/ +#endif +MESADRVFFBBUILDDIR = MesaDrvFfbBuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DDRIVERTS + DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/mesa/dri \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86OSSRC) \ + -I$(XF86DRIVERSRC)/sunffb \ + -I$(GLXLIBSRC)/dri/drm +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \ + -I$(MESADRVSRCDIR)/ffb + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + + FFBSRCS = $(MESADRVFFBBUILDDIR)ffb_dd.c \ + $(MESADRVFFBBUILDDIR)ffb_span.c \ + $(MESADRVFFBBUILDDIR)ffb_depth.c \ + $(MESADRVFFBBUILDDIR)ffb_state.c \ + $(MESADRVFFBBUILDDIR)ffb_clear.c \ + $(MESADRVFFBBUILDDIR)ffb_vb.c \ + $(MESADRVFFBBUILDDIR)ffb_lines.c \ + $(MESADRVFFBBUILDDIR)ffb_points.c \ + $(MESADRVFFBBUILDDIR)ffb_tris.c \ + $(MESADRVFFBBUILDDIR)ffb_pipeline.c \ + $(MESADRVFFBBUILDDIR)ffb_stencil.c \ + $(MESADRVFFBBUILDDIR)ffb_xmesa.c + + FFBOBJS = $(MESADRVFFBBUILDDIR)ffb_dd.o \ + $(MESADRVFFBBUILDDIR)ffb_span.o \ + $(MESADRVFFBBUILDDIR)ffb_depth.o \ + $(MESADRVFFBBUILDDIR)ffb_state.o \ + $(MESADRVFFBBUILDDIR)ffb_clear.o \ + $(MESADRVFFBBUILDDIR)ffb_vb.o \ + $(MESADRVFFBBUILDDIR)ffb_lines.o \ + $(MESADRVFFBBUILDDIR)ffb_points.o \ + $(MESADRVFFBBUILDDIR)ffb_tris.o \ + $(MESADRVFFBBUILDDIR)ffb_pipeline.o \ + $(MESADRVFFBBUILDDIR)ffb_stencil.o \ + $(MESADRVFFBBUILDDIR)ffb_xmesa.o + + FFBUOBJS = $(MESADRVFFBBUILDDIR)unshared/ffb_dd.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_span.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_depth.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_state.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_clear.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_vb.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_lines.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_points.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_tris.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_pipeline.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_stencil.o \ + $(MESADRVFFBBUILDDIR)unshared/ffb_xmesa.o + + FFBDOBJS = $(MESADRVFFBBUILDDIR)debugger/ffb_dd.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_span.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_depth.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_state.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_clear.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_vb.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_lines.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_points.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_tris.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_pipeline.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_stencil.o \ + $(MESADRVFFBBUILDDIR)debugger/ffb_xmesa.o + + FFBPOBJS = $(MESADRVFFBBUILDDIR)profiled/ffb_dd.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_span.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_depth.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_state.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_clear.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_vb.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_lines.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_points.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_tris.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_pipeline.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_stencil.o \ + $(MESADRVFFBBUILDDIR)profiled/ffb_xmesa.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(ffb_dd.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_span.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_depth.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_state.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_clear.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_vb.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_lines.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_points.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_tris.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_pipeline.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_stencil.c, $(MESADRVSRCDIR)/ffb) +LinkSourceFile(ffb_xmesa.c, $(MESADRVSRCDIR)/ffb) +#endif + diff --git a/xc/lib/GL/mesa/src/drv/gamma/Imakefile b/xc/lib/GL/mesa/src/drv/gamma/Imakefile index cfe2f0af3..c9a2fb6bf 100644 --- a/xc/lib/GL/mesa/src/drv/gamma/Imakefile +++ b/xc/lib/GL/mesa/src/drv/gamma/Imakefile @@ -1,310 +1,38 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.18 2001/02/16 01:26:10 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.22 2001/04/03 02:29:35 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#ifdef i386Architecture -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif -#if MesaUseKatmai - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DDRIVERTS - DRI_INCLUDES = -I../../../../dri -I../../../../glx \ - -I../../../dri \ - -I$(TOP)/include -I$(TOP)/include/GL \ - -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \ - -I$(XF86DRIVERSRC)/glint \ - -I../../../include -I../.. -I../../X -I../common +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif -MESA_INCLUDES = -I. -I.. -I../../include \ - -I../../../../dri/drm - - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRISRCS = ../../../dri/dri_mesa.c \ - ../../../../dri/dri_tmm.c - - DRIOBJS = ../../../dri/dri_mesa.o \ - ../../../../dri/dri_tmm.o - - DRMSRCS = ../../../../dri/drm/xf86drm.c \ - ../../../../dri/drm/xf86drmHash.c \ - ../../../../dri/drm/xf86drmRandom.c \ - ../../../../dri/drm/xf86drmSL.c - - DRMOBJS = ../../../../dri/drm/xf86drm.o \ - ../../../../dri/drm/xf86drmHash.o \ - ../../../../dri/drm/xf86drmRandom.o \ - ../../../../dri/drm/xf86drmSL.o - - GAMMASRCS = gamma_gl.c \ - gamma_xmesa.c \ - gamma_init.c \ - gamma_matrix.c \ - gamma_inithw.c \ - gamma_texture.c \ - gamma_dlist.c - - GAMMAOBJS = gamma_gl.o \ - gamma_xmesa.o \ - gamma_init.o \ - gamma_matrix.o \ - gamma_inithw.o \ - gamma_texture.o \ - gamma_dlist.o - - MESASRCS = ../../aatriangle.c \ - ../../accum.c \ - ../../alpha.c \ - ../../alphabuf.c \ - ../../attrib.c \ - ../../bbox.c \ - ../../bitmap.c \ - ../../blend.c \ - ../../buffers.c \ - ../../clip.c \ - ../../colortab.c \ - ../../config.c \ - ../../context.c \ - ../../copypix.c \ - ../../cva.c \ - ../../debug_xform.c \ - ../../depth.c \ - ../../dlist.c \ - ../../drawpix.c \ - ../../enable.c \ - ../../enums.c \ - ../../eval.c \ - ../../extensions.c \ - ../../feedback.c \ - ../../fog.c \ - ../../get.c \ - ../../glapi.c \ - ../../glapinoop.c \ - ../../glthread.c \ - ../../hash.c \ - ../../image.c \ - ../../imaging.c \ - ../../light.c \ - ../../lines.c \ - ../../logic.c \ - ../../masking.c \ - ../../matrix.c \ - ../../mem.c \ - ../../mmath.c \ - ../../pb.c \ - ../../pipeline.c \ - ../../pixel.c \ - ../../pixeltex.c \ - ../../points.c \ - ../../polygon.c \ - ../../quads.c \ - ../../rastpos.c \ - ../../readpix.c \ - ../../rect.c \ - ../../scissor.c \ - ../../shade.c \ - ../../span.c \ - ../../stages.c \ - ../../state.c \ - ../../stencil.c \ - ../../teximage.c \ - ../../texobj.c \ - ../../texstate.c \ - ../../texture.c \ - ../../texutil.c \ - ../../translate.c \ - ../../triangle.c \ - ../../varray.c \ - ../../vb.c \ - ../../vbcull.c \ - ../../vbfill.c \ - ../../vbindirect.c \ - ../../vbrender.c \ - ../../vbxform.c \ - ../../vector.c \ - ../../vertices.c \ - ../../winpos.c \ - ../../xform.c \ - ../../zoom.c - - MESAOBJS = ../../aatriangle.o \ - ../../accum.o \ - ../../alpha.o \ - ../../alphabuf.o \ - ../../attrib.o \ - ../../bbox.o \ - ../../bitmap.o \ - ../../blend.o \ - ../../buffers.o \ - ../../clip.o \ - ../../colortab.o \ - ../../config.o \ - ../../context.o \ - ../../copypix.o \ - ../../cva.o \ - ../../debug_xform.o \ - ../../depth.o \ - ../../dlist.o \ - ../../drawpix.o \ - ../../enable.o \ - ../../enums.o \ - ../../eval.o \ - ../../extensions.o \ - ../../feedback.o \ - ../../fog.o \ - ../../get.o \ - ../../hash.o \ - ../../hint.o \ - ../../image.o \ - ../../imaging.o \ - ../../light.o \ - ../../lines.o \ - ../../logic.o \ - ../../masking.o \ - ../../matrix.o \ - ../../mem.o \ - ../../mmath.o \ - ../../pb.o \ - ../../pipeline.o \ - ../../pixel.o \ - ../../pixeltex.o \ - ../../points.o \ - ../../polygon.o \ - ../../quads.o \ - ../../rastpos.o \ - ../../readpix.o \ - ../../rect.o \ - ../../scissor.o \ - ../../shade.o \ - ../../span.o \ - ../../stages.o \ - ../../state.o \ - ../../stencil.o \ - ../../teximage.o \ - ../../texobj.o \ - ../../texstate.o \ - ../../texture.o \ - ../../texutil.o \ - ../../translate.o \ - ../../triangle.o \ - ../../varray.o \ - ../../vb.o \ - ../../vbcull.o \ - ../../vbfill.o \ - ../../vbindirect.o \ - ../../vbrender.o \ - ../../vbxform.o \ - ../../vector.o \ - ../../vertices.o \ - ../../winpos.o \ - ../../xform.o \ - ../../zoom.o - +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../Imakefile.inc" #ifdef i386Architecture - X86_SRCS = ../../X86/common_x86.c \ - ../../X86/common_x86_asm.S \ - ../../X86/x86.c \ - ../../X86/x86_cliptest.S \ - ../../X86/x86_vertex.S \ - ../../X86/x86_xform_masked2.S \ - ../../X86/x86_xform_masked3.S \ - ../../X86/x86_xform_masked4.S \ - ../../X86/x86_xform_raw2.S \ - ../../X86/x86_xform_raw3.S \ - ../../X86/x86_xform_raw4.S - - X86_OBJS = ../../X86/common_x86.o \ - ../../X86/common_x86_asm.o \ - ../../X86/x86.o \ - ../../X86/x86_cliptest.o \ - ../../X86/x86_vertex.o \ - ../../X86/x86_xform_masked2.o \ - ../../X86/x86_xform_masked3.o \ - ../../X86/x86_xform_masked4.o \ - ../../X86/x86_xform_raw2.o \ - ../../X86/x86_xform_raw3.o \ - ../../X86/x86_xform_raw4.o - -#if MesaUseMMX - MMX_SRCS = ../../X86/mmx_blend.S - - MMX_OBJS = ../../X86/mmx_blend.o +#include "../../X86/Imakefile.inc" #endif -#if MesaUse3DNow - 3DNOW_SRCS = ../../X86/3dnow.c \ - ../../X86/3dnow_norm_raw.S \ - ../../X86/3dnow_vertex.S \ - ../../X86/3dnow_xform_masked1.S \ - ../../X86/3dnow_xform_masked2.S \ - ../../X86/3dnow_xform_masked3.S \ - ../../X86/3dnow_xform_masked4.S \ - ../../X86/3dnow_xform_raw1.S \ - ../../X86/3dnow_xform_raw2.S \ - ../../X86/3dnow_xform_raw3.S \ - ../../X86/3dnow_xform_raw4.S + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - 3DNOW_OBJS = ../../X86/3dnow.o \ - ../../X86/3dnow_norm_raw.o \ - ../../X86/3dnow_vertex.o \ - ../../X86/3dnow_xform_masked1.o \ - ../../X86/3dnow_xform_masked2.o \ - ../../X86/3dnow_xform_masked3.o \ - ../../X86/3dnow_xform_masked4.o \ - ../../X86/3dnow_xform_raw1.o \ - ../../X86/3dnow_xform_raw2.o \ - ../../X86/3dnow_xform_raw3.o \ - ../../X86/3dnow_xform_raw4.o -#endif + DRIOBJS = $(GLXLIBSRC)/mesa/dri/dri_mesa.o \ + $(GLXLIBSRC)/dri/dri_tmm.o -#if MesaUseKatmai - KATMAI_SRCS = ../../X86/katmai.c \ - ../../X86/katmai_norm_raw.S \ - ../../X86/katmai_vertex.S \ - ../../X86/katmai_xform_masked1.S \ - ../../X86/katmai_xform_masked2.S \ - ../../X86/katmai_xform_masked3.S \ - ../../X86/katmai_xform_masked4.S \ - ../../X86/katmai_xform_raw1.S \ - ../../X86/katmai_xform_raw2.S \ - ../../X86/katmai_xform_raw3.S \ - ../../X86/katmai_xform_raw4.S - - KATMAI_OBJS = ../../X86/katmai.o \ - ../../X86/katmai_norm_raw.o \ - ../../X86/katmai_vertex.o \ - ../../X86/katmai_xform_masked1.o \ - ../../X86/katmai_xform_masked2.o \ - ../../X86/katmai_xform_masked3.o \ - ../../X86/katmai_xform_masked4.o \ - ../../X86/katmai_xform_raw1.o \ - ../../X86/katmai_xform_raw2.o \ - ../../X86/katmai_xform_raw3.o \ - ../../X86/katmai_xform_raw4.o -#endif -#endif + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o #ifdef GlxSoProf LOSRCS = ../../../../lowpc.c @@ -314,46 +42,30 @@ MESA_INCLUDES = -I. -I.. -I../../include \ HIOBJS = ../../../../highpc.o #endif - ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) - - SRCS = $(LOWSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) \ - $(ASMSRCS) $(GAMMASRCS) $(HISRCS) - OBJS = $(LOWOBJS) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) \ - $(ASMOBJS) $(GAMMAOBJS) $(HIOBJS) - -REQUIREDLIBS += MathLibrary -#if !GlxBuiltInGamma -REQUIREDLIBS += -L../../../.. -lGL -#endif - + SRCS = $(GAMMASRCS) + OBJS = $(LOWOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \ + $(MESA_ASM_OBJS) $(GAMMAOBJS) $(HIOBJS) -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif +REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) #include <Library.tmpl> LibraryObjectRule() -SubdirLibraryRule($(OBJS)) +SubdirLibraryRule($(GAMMAOBJS)) NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = gamma_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDriModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +SharedDriModuleTarget($(LIBNAME),DONE,$(OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #ifdef GlxSoProf SOPROF_LIBNAME = _gamma_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE,$(OBJS)) InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) #endif #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc b/xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc new file mode 100644 index 000000000..a20bc7b55 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc @@ -0,0 +1,80 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile.inc,v 1.1 2001/03/23 19:18:39 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvGammaBuildDir +#define MesaDrvGammaBuildDir /**/ +#endif +MESADRVGAMMABUILDDIR = MesaDrvGammaBuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DDRIVERTS + DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/mesa/dri \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86DRIVERSRC)/glint \ + -I$(XF86OSSRC) +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/gamma + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + + GAMMASRCS = $(MESADRVGAMMABUILDDIR)gamma_gl.c \ + $(MESADRVGAMMABUILDDIR)gamma_xmesa.c \ + $(MESADRVGAMMABUILDDIR)gamma_init.c \ + $(MESADRVGAMMABUILDDIR)gamma_matrix.c \ + $(MESADRVGAMMABUILDDIR)gamma_inithw.c \ + $(MESADRVGAMMABUILDDIR)gamma_texture.c \ + $(MESADRVGAMMABUILDDIR)gamma_dlist.c + + GAMMAOBJS = $(MESADRVGAMMABUILDDIR)gamma_gl.o \ + $(MESADRVGAMMABUILDDIR)gamma_xmesa.o \ + $(MESADRVGAMMABUILDDIR)gamma_init.o \ + $(MESADRVGAMMABUILDDIR)gamma_matrix.o \ + $(MESADRVGAMMABUILDDIR)gamma_inithw.o \ + $(MESADRVGAMMABUILDDIR)gamma_texture.o \ + $(MESADRVGAMMABUILDDIR)gamma_dlist.o + + GAMMAUOBJS = $(MESADRVGAMMABUILDDIR)unshared/gamma_gl.o \ + $(MESADRVGAMMABUILDDIR)unshared/gamma_xmesa.o \ + $(MESADRVGAMMABUILDDIR)unshared/gamma_init.o \ + $(MESADRVGAMMABUILDDIR)unshared/gamma_matrix.o \ + $(MESADRVGAMMABUILDDIR)unshared/gamma_inithw.o \ + $(MESADRVGAMMABUILDDIR)unshared/gamma_texture.o \ + $(MESADRVGAMMABUILDDIR)unshared/gamma_dlist.o + + GAMMADOBJS = $(MESADRVGAMMABUILDDIR)debugger/gamma_gl.o \ + $(MESADRVGAMMABUILDDIR)debugger/gamma_xmesa.o \ + $(MESADRVGAMMABUILDDIR)debugger/gamma_init.o \ + $(MESADRVGAMMABUILDDIR)debugger/gamma_matrix.o \ + $(MESADRVGAMMABUILDDIR)debugger/gamma_inithw.o \ + $(MESADRVGAMMABUILDDIR)debugger/gamma_texture.o \ + $(MESADRVGAMMABUILDDIR)debugger/gamma_dlist.o + + GAMMAPOBJS = $(MESADRVGAMMABUILDDIR)profiled/gamma_gl.o \ + $(MESADRVGAMMABUILDDIR)profiled/gamma_xmesa.o \ + $(MESADRVGAMMABUILDDIR)profiled/gamma_init.o \ + $(MESADRVGAMMABUILDDIR)profiled/gamma_matrix.o \ + $(MESADRVGAMMABUILDDIR)profiled/gamma_inithw.o \ + $(MESADRVGAMMABUILDDIR)profiled/gamma_texture.o \ + $(MESADRVGAMMABUILDDIR)profiled/gamma_dlist.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(gamma_gl.c, $(MESADRVSRCDIR)/gamma) +LinkSourceFile(gamma_xmesa.c, $(MESADRVSRCDIR)/gamma) +LinkSourceFile(gamma_init.c, $(MESADRVSRCDIR)/gamma) +LinkSourceFile(gamma_matrix.c, $(MESADRVSRCDIR)/gamma) +LinkSourceFile(gamma_inithw.c, $(MESADRVSRCDIR)/gamma) +LinkSourceFile(gamma_texture.c, $(MESADRVSRCDIR)/gamma) +LinkSourceFile(gamma_dlist.c, $(MESADRVSRCDIR)/gamma) +#endif diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c index 3a1fa9ae7..94f6c8417 100644 --- a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c,v 1.11 2001/02/07 13:26:17 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c,v 1.12 2001/03/21 16:14:20 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -59,9 +59,9 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { int major, minor, patch; if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { char msg[1000]; - sprintf(msg, "gamma DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch); + sprintf(msg, "gamma DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch); __driMesaMessage(msg); return GL_FALSE; } @@ -70,8 +70,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) /* Check that the DDX driver version is compatible */ if (sPriv->ddxMajor != 1 || - sPriv->ddxMinor != 0 || - sPriv->ddxPatch < 0) { + sPriv->ddxMinor < 0) { char msg[1000]; sprintf(msg, "gamma DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); __driMesaMessage(msg); @@ -80,8 +79,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) /* Check that the DRM driver version is compatible */ if (sPriv->drmMajor != 1 || - sPriv->drmMinor != 0 || - sPriv->drmPatch < 0) { + sPriv->drmMinor < 0) { char msg[1000]; sprintf(msg, "gamm DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); __driMesaMessage(msg); diff --git a/xc/lib/GL/mesa/src/drv/i810/Imakefile b/xc/lib/GL/mesa/src/drv/i810/Imakefile index 1ef237343..e5220dce8 100644 --- a/xc/lib/GL/mesa/src/drv/i810/Imakefile +++ b/xc/lib/GL/mesa/src/drv/i810/Imakefile @@ -1,315 +1,38 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.14 2001/02/16 01:26:10 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.18 2001/04/03 02:29:35 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#ifdef i386Architecture -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif -#if MesaUseKatmai - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DDRIVERTS - DRI_INCLUDES = -I../../../../dri -I../../../../glx \ - -I../../../dri \ - -I$(TOP)/include -I$(TOP)/include/GL \ - -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \ - -I$(XF86DRIVERSRC)/i810 \ - -I../../../include -I../.. -I../common -I../../X +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif -MESA_INCLUDES = -I. -I.. -I../../include \ - -I../../../../dri/drm - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRISRCS = ../../../dri/dri_mesa.c \ - ../../../../dri/dri_tmm.c - - DRIOBJS = ../../../dri/dri_mesa.o \ - ../../../../dri/dri_tmm.o - - DRMSRCS = ../../../../dri/drm/xf86drm.c \ - ../../../../dri/drm/xf86drmHash.c \ - ../../../../dri/drm/xf86drmRandom.c \ - ../../../../dri/drm/xf86drmSL.c - - DRMOBJS = ../../../../dri/drm/xf86drm.o \ - ../../../../dri/drm/xf86drmHash.o \ - ../../../../dri/drm/xf86drmRandom.o \ - ../../../../dri/drm/xf86drmSL.o - - I810SRCS = i810_xmesa.c \ - i810dd.c \ - i810pipeline.c \ - i810span.c \ - i810state.c \ - i810tex.c \ - i810tris.c \ - i810vb.c \ - i810fastpath.c \ - i810ioctl.c - - I810OBJS = i810_xmesa.o \ - i810dd.o \ - i810pipeline.o \ - i810span.o \ - i810state.o \ - i810tex.o \ - i810tris.o \ - i810vb.o \ - i810fastpath.o \ - i810ioctl.o - - MESASRCS = ../../aatriangle.c \ - ../../accum.c \ - ../../alpha.c \ - ../../alphabuf.c \ - ../../attrib.c \ - ../../bbox.c \ - ../../bitmap.c \ - ../../blend.c \ - ../../buffers.c \ - ../../clip.c \ - ../../colortab.c \ - ../../config.c \ - ../../context.c \ - ../../copypix.c \ - ../../cva.c \ - ../../debug_xform.c \ - ../../depth.c \ - ../../dlist.c \ - ../../drawpix.c \ - ../../enable.c \ - ../../enums.c \ - ../../eval.c \ - ../../extensions.c \ - ../../feedback.c \ - ../../fog.c \ - ../../get.c \ - ../../glapi.c \ - ../../glapinoop.c \ - ../../glthread.c \ - ../../hash.c \ - ../../image.c \ - ../../imaging.c \ - ../../light.c \ - ../../lines.c \ - ../../logic.c \ - ../../masking.c \ - ../../matrix.c \ - ../../mem.c \ - ../../mmath.c \ - ../../pb.c \ - ../../pipeline.c \ - ../../pixel.c \ - ../../pixeltex.c \ - ../../points.c \ - ../../polygon.c \ - ../../quads.c \ - ../../rastpos.c \ - ../../readpix.c \ - ../../rect.c \ - ../../scissor.c \ - ../../shade.c \ - ../../span.c \ - ../../stages.c \ - ../../state.c \ - ../../stencil.c \ - ../../teximage.c \ - ../../texobj.c \ - ../../texstate.c \ - ../../texture.c \ - ../../texutil.c \ - ../../translate.c \ - ../../triangle.c \ - ../../varray.c \ - ../../vb.c \ - ../../vbcull.c \ - ../../vbfill.c \ - ../../vbindirect.c \ - ../../vbrender.c \ - ../../vbxform.c \ - ../../vector.c \ - ../../vertices.c \ - ../../winpos.c \ - ../../xform.c \ - ../../zoom.c - - MESAOBJS = ../../aatriangle.o \ - ../../accum.o \ - ../../alpha.o \ - ../../alphabuf.o \ - ../../attrib.o \ - ../../bbox.o \ - ../../bitmap.o \ - ../../blend.o \ - ../../buffers.o \ - ../../clip.o \ - ../../colortab.o \ - ../../config.o \ - ../../context.o \ - ../../copypix.o \ - ../../cva.o \ - ../../debug_xform.o \ - ../../depth.o \ - ../../dlist.o \ - ../../drawpix.o \ - ../../enable.o \ - ../../enums.o \ - ../../eval.o \ - ../../extensions.o \ - ../../feedback.o \ - ../../fog.o \ - ../../get.o \ - ../../hash.o \ - ../../hint.o \ - ../../image.o \ - ../../imaging.o \ - ../../light.o \ - ../../lines.o \ - ../../logic.o \ - ../../masking.o \ - ../../matrix.o \ - ../../mem.o \ - ../../mmath.o \ - ../../pb.o \ - ../../pipeline.o \ - ../../pixel.o \ - ../../pixeltex.o \ - ../../points.o \ - ../../polygon.o \ - ../../quads.o \ - ../../rastpos.o \ - ../../readpix.o \ - ../../rect.o \ - ../../scissor.o \ - ../../shade.o \ - ../../span.o \ - ../../stages.o \ - ../../state.o \ - ../../stencil.o \ - ../../teximage.o \ - ../../texobj.o \ - ../../texstate.o \ - ../../texture.o \ - ../../texutil.o \ - ../../translate.o \ - ../../triangle.o \ - ../../varray.o \ - ../../vb.o \ - ../../vbcull.o \ - ../../vbfill.o \ - ../../vbindirect.o \ - ../../vbrender.o \ - ../../vbxform.o \ - ../../vector.o \ - ../../vertices.o \ - ../../winpos.o \ - ../../xform.o \ - ../../zoom.o - +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../Imakefile.inc" #ifdef i386Architecture - X86_SRCS = ../../X86/common_x86.c \ - ../../X86/common_x86_asm.S \ - ../../X86/x86.c \ - ../../X86/x86_cliptest.S \ - ../../X86/x86_vertex.S \ - ../../X86/x86_xform_masked2.S \ - ../../X86/x86_xform_masked3.S \ - ../../X86/x86_xform_masked4.S \ - ../../X86/x86_xform_raw2.S \ - ../../X86/x86_xform_raw3.S \ - ../../X86/x86_xform_raw4.S - - X86_OBJS = ../../X86/common_x86.o \ - ../../X86/common_x86_asm.o \ - ../../X86/x86.o \ - ../../X86/x86_cliptest.o \ - ../../X86/x86_vertex.o \ - ../../X86/x86_xform_masked2.o \ - ../../X86/x86_xform_masked3.o \ - ../../X86/x86_xform_masked4.o \ - ../../X86/x86_xform_raw2.o \ - ../../X86/x86_xform_raw3.o \ - ../../X86/x86_xform_raw4.o - -#if MesaUseMMX - MMX_SRCS = ../../X86/mmx_blend.S - - MMX_OBJS = ../../X86/mmx_blend.o +#include "../../X86/Imakefile.inc" #endif -#if MesaUse3DNow - 3DNOW_SRCS = ../../X86/3dnow.c \ - ../../X86/3dnow_norm_raw.S \ - ../../X86/3dnow_vertex.S \ - ../../X86/3dnow_xform_masked1.S \ - ../../X86/3dnow_xform_masked2.S \ - ../../X86/3dnow_xform_masked3.S \ - ../../X86/3dnow_xform_masked4.S \ - ../../X86/3dnow_xform_raw1.S \ - ../../X86/3dnow_xform_raw2.S \ - ../../X86/3dnow_xform_raw3.S \ - ../../X86/3dnow_xform_raw4.S + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - 3DNOW_OBJS = ../../X86/3dnow.o \ - ../../X86/3dnow_norm_raw.o \ - ../../X86/3dnow_vertex.o \ - ../../X86/3dnow_xform_masked1.o \ - ../../X86/3dnow_xform_masked2.o \ - ../../X86/3dnow_xform_masked3.o \ - ../../X86/3dnow_xform_masked4.o \ - ../../X86/3dnow_xform_raw1.o \ - ../../X86/3dnow_xform_raw2.o \ - ../../X86/3dnow_xform_raw3.o \ - ../../X86/3dnow_xform_raw4.o -#endif - -#if MesaUseKatmai - KATMAI_SRCS = ../../X86/katmai.c \ - ../../X86/katmai_norm_raw.S \ - ../../X86/katmai_vertex.S \ - ../../X86/katmai_xform_masked1.S \ - ../../X86/katmai_xform_masked2.S \ - ../../X86/katmai_xform_masked3.S \ - ../../X86/katmai_xform_masked4.S \ - ../../X86/katmai_xform_raw1.S \ - ../../X86/katmai_xform_raw2.S \ - ../../X86/katmai_xform_raw3.S \ - ../../X86/katmai_xform_raw4.S + DRIOBJS = $(GLXLIBSRC)/mesa/dri/dri_mesa.o \ + $(GLXLIBSRC)/dri/dri_tmm.o - KATMAI_OBJS = ../../X86/katmai.o \ - ../../X86/katmai_norm_raw.o \ - ../../X86/katmai_vertex.o \ - ../../X86/katmai_xform_masked1.o \ - ../../X86/katmai_xform_masked2.o \ - ../../X86/katmai_xform_masked3.o \ - ../../X86/katmai_xform_masked4.o \ - ../../X86/katmai_xform_raw1.o \ - ../../X86/katmai_xform_raw2.o \ - ../../X86/katmai_xform_raw3.o \ - ../../X86/katmai_xform_raw4.o -#endif -#endif + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o #ifdef GlxSoProf LOSRCS = ../../../../lowpc.c @@ -319,49 +42,30 @@ MESA_INCLUDES = -I. -I.. -I../../include \ HIOBJS = ../../../../highpc.o #endif - ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) + SRCS = $(I810SRCS) + OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \ + $(MESA_ASM_OBJS) $(COMMONOBJS) $(I810OBJS) $(HIOBJS) - COMMONSRCS = ../common/mm.c ../common/hwlog.c - COMMONOBJS = ../common/mm.o ../common/hwlog.o - - SRCS = $(LOSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) \ - $(ASMSRCS) $(COMMONSRCS) $(I810SRCS) $(HISRCS) - OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) \ - $(ASMOBJS) $(COMMONOBJS) $(I810OBJS) $(HIOBJS) - -REQUIREDLIBS += MathLibrary -#if !GlxBuiltInI810 -REQUIREDLIBS += -L../../../.. -lGL -#endif - - -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif +REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) #include <Library.tmpl> LibraryObjectRule() -SubdirLibraryRule($(OBJS)) +SubdirLibraryRule($(I810OBJS)) NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = i810_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDriModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +SharedDriModuleTarget($(LIBNAME),DONE,$(OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #ifdef GlxSoProf SOPROF_LIBNAME = _i810_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE,$(ALL_OBJS)) InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) #endif #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/i810/Imakefile.inc b/xc/lib/GL/mesa/src/drv/i810/Imakefile.inc new file mode 100644 index 000000000..b6b0aa65b --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/i810/Imakefile.inc @@ -0,0 +1,100 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile.inc,v 1.1 2001/03/23 19:18:40 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvI810BuildDir +#define MesaDrvI810BuildDir /**/ +#endif +MESADRVI810BUILDDIR = MesaDrvI810BuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DDRIVERTS + DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/mesa/dri \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86OSSRC) \ + -I$(XF86DRIVERSRC)/i810 \ + -I$(GLXLIBSRC)/dri/drm +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \ + -I$(MESADRVSRCDIR)/i810 + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + I810SRCS = $(MESADRVI810BUILDDIR)i810_xmesa.c \ + $(MESADRVI810BUILDDIR)i810dd.c \ + $(MESADRVI810BUILDDIR)i810pipeline.c \ + $(MESADRVI810BUILDDIR)i810span.c \ + $(MESADRVI810BUILDDIR)i810state.c \ + $(MESADRVI810BUILDDIR)i810tex.c \ + $(MESADRVI810BUILDDIR)i810tris.c \ + $(MESADRVI810BUILDDIR)i810vb.c \ + $(MESADRVI810BUILDDIR)i810fastpath.c \ + $(MESADRVI810BUILDDIR)i810ioctl.c + + I810OBJS = $(MESADRVI810BUILDDIR)i810_xmesa.o \ + $(MESADRVI810BUILDDIR)i810dd.o \ + $(MESADRVI810BUILDDIR)i810pipeline.o \ + $(MESADRVI810BUILDDIR)i810span.o \ + $(MESADRVI810BUILDDIR)i810state.o \ + $(MESADRVI810BUILDDIR)i810tex.o \ + $(MESADRVI810BUILDDIR)i810tris.o \ + $(MESADRVI810BUILDDIR)i810vb.o \ + $(MESADRVI810BUILDDIR)i810fastpath.o \ + $(MESADRVI810BUILDDIR)i810ioctl.o + + I810UOBJS = $(MESADRVI810BUILDDIR)unshared/i810_xmesa.o \ + $(MESADRVI810BUILDDIR)unshared/i810dd.o \ + $(MESADRVI810BUILDDIR)unshared/i810pipeline.o \ + $(MESADRVI810BUILDDIR)unshared/i810span.o \ + $(MESADRVI810BUILDDIR)unshared/i810state.o \ + $(MESADRVI810BUILDDIR)unshared/i810tex.o \ + $(MESADRVI810BUILDDIR)unshared/i810tris.o \ + $(MESADRVI810BUILDDIR)unshared/i810vb.o \ + $(MESADRVI810BUILDDIR)unshared/i810fastpath.o \ + $(MESADRVI810BUILDDIR)unshared/i810ioctl.o + + I810DOBJS = $(MESADRVI810BUILDDIR)debugger/i810_xmesa.o \ + $(MESADRVI810BUILDDIR)debugger/i810dd.o \ + $(MESADRVI810BUILDDIR)debugger/i810pipeline.o \ + $(MESADRVI810BUILDDIR)debugger/i810span.o \ + $(MESADRVI810BUILDDIR)debugger/i810state.o \ + $(MESADRVI810BUILDDIR)debugger/i810tex.o \ + $(MESADRVI810BUILDDIR)debugger/i810tris.o \ + $(MESADRVI810BUILDDIR)debugger/i810vb.o \ + $(MESADRVI810BUILDDIR)debugger/i810fastpath.o \ + $(MESADRVI810BUILDDIR)debugger/i810ioctl.o + + I810POBJS = $(MESADRVI810BUILDDIR)profiled/i810_xmesa.o \ + $(MESADRVI810BUILDDIR)profiled/i810dd.o \ + $(MESADRVI810BUILDDIR)profiled/i810pipeline.o \ + $(MESADRVI810BUILDDIR)profiled/i810span.o \ + $(MESADRVI810BUILDDIR)profiled/i810state.o \ + $(MESADRVI810BUILDDIR)profiled/i810tex.o \ + $(MESADRVI810BUILDDIR)profiled/i810tris.o \ + $(MESADRVI810BUILDDIR)profiled/i810vb.o \ + $(MESADRVI810BUILDDIR)profiled/i810fastpath.o \ + $(MESADRVI810BUILDDIR)profiled/i810ioctl.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(i810_xmesa.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810dd.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810pipeline.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810span.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810state.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810tex.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810tris.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810vb.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810fastpath.c, $(MESADRVSRCDIR)/i810) +LinkSourceFile(i810ioctl.c, $(MESADRVSRCDIR)/i810) +#endif + diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h b/xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h index a7200f1b8..bb7c80809 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h +++ b/xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h,v 1.5 2000/08/28 02:43:11 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h,v 1.6 2001/03/21 16:14:21 dawes Exp $ */ #ifndef I810_3D_REG_H #define I810_3D_REG_H @@ -113,8 +113,8 @@ #define LCS_LINEWIDTH_2_0 (0x4<<12) #define LCS_LINEWIDTH_3_0 (0x6<<12) #define LCS_UPDATE_ALPHA_INTERP (0x1<<11) -#define LCS_ALPHA_FLAT (0x0<<10) -#define LCS_ALPHA_INTERP (0x1<<10) +#define LCS_ALPHA_FLAT (0x1<<10) +#define LCS_ALPHA_INTERP (0x0<<10) #define LCS_UPDATE_FOG_INTERP (0x1<<9) #define LCS_FOG_INTERP (0x0<<8) #define LCS_FOG_FLAT (0x1<<8) 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 cdcdfd1b6..21c4f78d5 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810_init.h +++ b/xc/lib/GL/mesa/src/drv/i810/i810_init.h @@ -79,6 +79,7 @@ typedef struct { __DRIscreenPrivate *driScrnPriv; drmBufMapPtr bufs; int use_copy_buf; + unsigned int sarea_priv_offset; } 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 f5aecb98e..3d50bd2f9 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.11 2000/12/21 14:06:56 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c,v 1.12 2001/03/21 16:14:21 dawes Exp $ */ /* * Authors: @@ -135,9 +135,9 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { int major, minor, patch; if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { char msg[1000]; - sprintf(msg, "i810 DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch); + sprintf(msg, "i810 DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch); __driMesaMessage(msg); return GL_FALSE; } @@ -146,8 +146,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) /* Check that the DDX driver version is compatible */ if (sPriv->ddxMajor != 1 || - sPriv->ddxMinor != 0 || - sPriv->ddxPatch < 0) { + sPriv->ddxMinor < 0) { char msg[1000]; sprintf(msg, "i810 DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); __driMesaMessage(msg); @@ -156,8 +155,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) /* Check that the DRM driver version is compatible */ if (sPriv->drmMajor != 1 || - sPriv->drmMinor != 1 || - sPriv->drmPatch < 0) { + sPriv->drmMinor < 1) { char msg[1000]; sprintf(msg, "i810 DRI driver expected DRM driver version 1.1.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); __driMesaMessage(msg); @@ -244,6 +242,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) i810Screen->tex.handle = gDRIPriv->textures; i810Screen->tex.size = gDRIPriv->textureSize; + i810Screen->sarea_priv_offset = gDRIPriv->sarea_priv_offset; if (drmMap(sPriv->fd, i810Screen->tex.handle, @@ -316,7 +315,7 @@ GLboolean XMesaCreateContext( Display *dpy, GLvisual *mesaVis, __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private; drm_i810_sarea_t *saPriv=(drm_i810_sarea_t *)(((char*)sPriv->pSAREA)+ - sizeof(XF86DRISAREARec)); + i810Screen->sarea_priv_offset); imesa = (i810ContextPtr)Xcalloc(sizeof(i810Context), 1); if (!imesa) { diff --git a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c index 2f16e33d7..eb2d9a4df 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810ioctl.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810ioctl.c,v 1.4 2000/08/28 02:43:11 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810ioctl.c,v 1.5 2001/03/21 16:14:21 dawes Exp $ */ #include <stdio.h> #include <unistd.h> @@ -200,7 +200,6 @@ void i810DmaFinish( i810ContextPtr imesa ) FLUSH_BATCH( imesa ); if (imesa->sarea->last_quiescent != imesa->sarea->last_enqueue) { - if (I810_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "i810DmaFinish\n"); @@ -214,14 +213,22 @@ void i810DmaFinish( i810ContextPtr imesa ) void i810RegetLockQuiescent( i810ContextPtr imesa ) { + /* XXX I disabled this conditional. Doing so fixes all the readpixels + * problems. The problem was that we'd sometimes read from the frame + * buffer (via the span functions) before rendering was completed. + * Taking out this conditional solves that problem. (BrianP) + * if (imesa->sarea->last_quiescent != imesa->sarea->last_enqueue) { + */ if (I810_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "i810RegetLockQuiescent\n"); drmUnlock(imesa->driFd, imesa->hHWContext); i810GetLock( imesa, DRM_LOCK_QUIESCENT ); imesa->sarea->last_quiescent = imesa->sarea->last_enqueue; + /* } + */ } void i810WaitAgeLocked( i810ContextPtr imesa, int age ) diff --git a/xc/lib/GL/mesa/src/drv/i810/i810span.c b/xc/lib/GL/mesa/src/drv/i810/i810span.c index aa4f22d0c..4bf02ad13 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810span.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810span.c @@ -30,26 +30,28 @@ dPriv->x * 2 + \ dPriv->y * pitch) -#define INIT_MONO_PIXEL(p) +#define INIT_MONO_PIXEL(p) #define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ _y >= miny && _y < maxy) -#define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ - if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ - else { \ - _n1 = _n; \ - _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ - } +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } #define Y_FLIP(_y) (height - _y - 1) - #define HW_LOCK() \ i810ContextPtr imesa = I810_CONTEXT(ctx); \ + FLUSH_BATCH(imesa); \ + i810DmaFinish(imesa); \ LOCK_HARDWARE_QUIESCENT(imesa); #define HW_CLIPLOOP() \ @@ -85,9 +87,9 @@ #define READ_RGBA( rgba, _x, _y ) \ do { \ GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 8) & 0xf8; \ - rgba[1] = (p >> 3) & 0xfc; \ - rgba[2] = (p << 3) & 0xf8; \ + rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \ + rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \ + rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \ rgba[3] = 255; \ } while(0) @@ -128,7 +130,7 @@ do { \ *(GLushort *)(buf + _x*2 + _y*pitch) = d; #define READ_DEPTH( d, _x, _y ) \ - d = *(GLushort *)(buf + _x*2 + _y*pitch); + d = *(GLushort *)(buf + _x*2 + _y*pitch); /* d = 0xffff; */ @@ -144,7 +146,7 @@ void i810DDInitSpanFuncs( GLcontext *ctx ) ctx->Driver.WriteRGBSpan = i810WriteRGBSpan_565; ctx->Driver.WriteMonoRGBASpan = i810WriteMonoRGBASpan_565; ctx->Driver.WriteRGBAPixels = i810WriteRGBAPixels_565; - ctx->Driver.WriteMonoRGBAPixels = i810WriteMonoRGBAPixels_565; + ctx->Driver.WriteMonoRGBAPixels = i810WriteMonoRGBAPixels_565; ctx->Driver.ReadRGBASpan = i810ReadRGBASpan_565; ctx->Driver.ReadRGBAPixels = i810ReadRGBAPixels_565; } else { diff --git a/xc/lib/GL/mesa/src/drv/i810/i810state.c b/xc/lib/GL/mesa/src/drv/i810/i810state.c index 55f63db2e..dba30cc69 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810state.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810state.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810state.c,v 1.5 2000/08/25 13:42:21 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810state.c,v 1.6 2001/03/21 16:14:21 dawes Exp $ */ #include <stdio.h> @@ -63,11 +63,18 @@ static void i810DDAlphaFunc(GLcontext *ctx, GLenum func, GLclampf ref) static void i810DDBlendEquation(GLcontext *ctx, GLenum mode) { + i810ContextPtr imesa = I810_CONTEXT(ctx); + if (mode != GL_FUNC_ADD_EXT) { ctx->Color.BlendEquation = GL_FUNC_ADD_EXT; if (0) fprintf(stderr, "Unsupported blend equation: %s\n", gl_lookup_enum_by_nr(mode)); } + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + imesa->Fallback |= I810_FALLBACK_LOGICOP; + else + imesa->Fallback &= ~I810_FALLBACK_LOGICOP; } static void i810DDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) @@ -175,6 +182,7 @@ static void i810DDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) GLubyte p[4]; int i,j,k; int active = (ctx->Polygon.StippleFlag && ctx->PB->primitive == GL_POLYGON); + GLuint newMask; FLUSH_BATCH(imesa); ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; @@ -184,10 +192,10 @@ static void i810DDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) imesa->Setup[I810_CTXREG_ST1] &= ~ST1_ENABLE; } - p[0] = mask[0] & 0xf; p[0] |= p[0] << 4; - p[1] = mask[4] & 0xf; p[1] |= p[1] << 4; - p[2] = mask[8] & 0xf; p[2] |= p[2] << 4; - p[3] = mask[12] & 0xf; p[3] |= p[3] << 4; + p[0] = mask[12] & 0xf; p[0] |= p[0] << 4; + p[1] = mask[8] & 0xf; p[1] |= p[1] << 4; + p[2] = mask[4] & 0xf; p[2] |= p[2] << 4; + p[3] = mask[0] & 0xf; p[3] |= p[3] << 4; for (k = 0 ; k < 8 ; k++) for (j = 0 ; j < 4; j++) @@ -196,12 +204,19 @@ static void i810DDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; return; } - + + newMask = ((p[0] & 0xf) << 0) | + ((p[1] & 0xf) << 4) | + ((p[2] & 0xf) << 8) | + ((p[3] & 0xf) << 12); + if (newMask == 0xffff) { + /* do opaque stipple in software for conformance */ + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; + return; + } + imesa->Setup[I810_CTXREG_ST1] &= ~0xffff; - imesa->Setup[I810_CTXREG_ST1] |= ( ((p[0] & 0xf) << 0) | - ((p[1] & 0xf) << 4) | - ((p[2] & 0xf) << 8) | - ((p[3] & 0xf) << 12) ); + imesa->Setup[I810_CTXREG_ST1] |= newMask; if (active) imesa->Setup[I810_CTXREG_ST1] |= ST1_ENABLE; @@ -244,10 +259,10 @@ static void i810DDDither(GLcontext *ctx, GLboolean enable) static void i810DDLogicOp( GLcontext *ctx, GLenum opcode ) { + i810ContextPtr imesa = I810_CONTEXT(ctx); + if (ctx->Color.ColorLogicOpEnabled) { - i810ContextPtr imesa = I810_CONTEXT(ctx); - FLUSH_BATCH( imesa ); if (opcode == GL_COPY) @@ -255,6 +270,8 @@ static void i810DDLogicOp( GLcontext *ctx, GLenum opcode ) else imesa->Fallback |= I810_FALLBACK_LOGICOP; } + else + imesa->Fallback &= ~I810_FALLBACK_LOGICOP; } static GLboolean i810DDSetDrawBuffer(GLcontext *ctx, GLenum mode ) @@ -430,26 +447,23 @@ static GLboolean i810DDColorMask(GLcontext *ctx, GLboolean b, GLboolean a ) { i810ContextPtr imesa = I810_CONTEXT( ctx ); - GLuint tmp = 0; - GLuint rv = 1; - - imesa->Fallback &= ~I810_FALLBACK_COLORMASK; + GLuint tmp; - if (r && g && b) { - tmp = imesa->Setup[I810_CTXREG_B2] | B2_FB_WRITE_ENABLE; - } else if (!r && !g && !b) { - tmp = imesa->Setup[I810_CTXREG_B2] & ~B2_FB_WRITE_ENABLE; - } else { - rv = 0; + if (r && g && b) + imesa->Fallback &= ~I810_FALLBACK_COLORMASK; + else imesa->Fallback |= I810_FALLBACK_COLORMASK; - } - + + tmp = imesa->Setup[I810_CTXREG_B2] | + (B2_FB_WRITE_ENABLE | B2_UPDATE_FB_WRITE_ENABLE); + if (tmp != imesa->Setup[I810_CTXREG_B2]) { FLUSH_BATCH(imesa); imesa->Setup[I810_CTXREG_B2] = tmp; + imesa->dirty |= I810_UPLOAD_CTX; } - return rv; + return GL_FALSE; /* makes s/w path always do s/w masking */ } /* Seperate specular not fully implemented in hardware... Needs @@ -529,6 +543,13 @@ static void i810DDEnable(GLcontext *ctx, GLenum cap, GLboolean state) imesa->Setup[I810_CTXREG_B1] &= ~B1_BLEND_ENABLE; if (state) imesa->Setup[I810_CTXREG_B1] |= B1_BLEND_ENABLE; + + /* For some reason enable(GL_BLEND) affects ColorLogicOpEnabled. + */ + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + imesa->Fallback |= I810_FALLBACK_LOGICOP; + else + imesa->Fallback &= ~I810_FALLBACK_LOGICOP; break; case GL_DEPTH_TEST: FLUSH_BATCH(imesa); @@ -609,19 +630,8 @@ static void i810DDEnable(GLcontext *ctx, GLenum cap, GLboolean state) case GL_TEXTURE_2D: FLUSH_BATCH(imesa); imesa->new_state |= I810_NEW_TEXTURE; - imesa->dirty |= I810_UPLOAD_CTX; - if (ctx->Texture.CurrentUnit == 0) { - imesa->Setup[I810_CTXREG_MT] &= ~MT_TEXEL0_ENABLE; - if (state) - imesa->Setup[I810_CTXREG_MT] |= MT_TEXEL0_ENABLE; - } else { - imesa->Setup[I810_CTXREG_MT] &= ~MT_TEXEL1_ENABLE; - if (state) - imesa->Setup[I810_CTXREG_MT] |= MT_TEXEL1_ENABLE; - } break; case GL_COLOR_LOGIC_OP: - case GL_INDEX_LOGIC_OP: FLUSH_BATCH( imesa ); imesa->Fallback &= ~I810_FALLBACK_LOGICOP; if (state && ctx->Color.LogicOp != GL_COPY) @@ -980,8 +990,8 @@ void i810DDInitState( i810ContextPtr imesa ) #define INTERESTED (~(NEW_MODELVIEW|NEW_PROJECTION|\ NEW_TEXTURE_MATRIX|\ - NEW_USER_CLIP|NEW_CLIENT_STATE|\ - NEW_TEXTURE_ENABLE)) + NEW_USER_CLIP|NEW_CLIENT_STATE)) + void i810DDUpdateState( GLcontext *ctx ) { diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tex.c b/xc/lib/GL/mesa/src/drv/i810/i810tex.c index 5c1615128..ff537aece 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810tex.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810tex.c @@ -705,44 +705,50 @@ static void i810UpdateTex0State( GLcontext *ctx ) struct gl_texture_object *tObj; i810TextureObjectPtr t; int ma_modulate_op; + int format; - - tObj = ctx->Texture.Unit[0].Current; - - if ( tObj != ctx->Texture.Unit[0].CurrentD[2] ) - tObj = 0; - - + /* disable */ + imesa->Setup[I810_CTXREG_MT] &= ~MT_TEXEL0_ENABLE; imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES | - MC_STAGE_0 | - MC_UPDATE_DEST | - MC_DEST_CURRENT | - MC_UPDATE_ARG1 | - MC_ARG1_ITERATED_COLOR | - MC_UPDATE_ARG2 | - MC_ARG2_ONE | - MC_UPDATE_OP | - MC_OP_ARG1 ); - + MC_STAGE_0 | + MC_UPDATE_DEST | + MC_DEST_CURRENT | + MC_UPDATE_ARG1 | + MC_ARG1_ITERATED_COLOR | + MC_UPDATE_ARG2 | + MC_ARG2_ONE | + MC_UPDATE_OP | + MC_OP_ARG1 ); imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | - MA_STAGE_0 | - MA_UPDATE_ARG1 | - MA_ARG1_ITERATED_ALPHA | - MA_UPDATE_ARG2 | - MA_ARG2_TEX0_ALPHA | - MA_UPDATE_OP | - MA_OP_ARG1 ); - + MA_STAGE_0 | + MA_UPDATE_ARG1 | + MA_ARG1_ITERATED_ALPHA | + MA_UPDATE_ARG2 | + MA_ARG2_TEX0_ALPHA | + MA_UPDATE_OP | + MA_OP_ARG1 ); + + if (ctx->Texture.Unit[0].ReallyEnabled == 0) { + return; + } - if (!(ctx->Texture.ReallyEnabled & 0xf) || !tObj || !tObj->Complete) { + tObj = ctx->Texture.Unit[0].Current; + if (ctx->Texture.Unit[0].ReallyEnabled != TEXTURE0_2D || + tObj->Image[tObj->BaseLevel]->Border > 0) { + /* 1D or 3D texturing enabled, or texture border - fallback */ + imesa->Fallback |= I810_FALLBACK_TEXTURE; return; } + /* Do 2D texture setup */ + + imesa->Setup[I810_CTXREG_MT] |= MT_TEXEL0_ENABLE; + t = tObj->DriverData; - if (!t) { t = i810CreateTexObj( imesa, tObj ); - if (!t) return; + if (!t) + return; } if (t->current_unit != 0) @@ -757,9 +763,11 @@ static void i810UpdateTex0State( GLcontext *ctx ) if (t->MemBlock) i810UpdateTexLRU( imesa, t ); + format = t->image[0].internalFormat; + switch (ctx->Texture.Unit[0].EnvMode) { case GL_REPLACE: - if (t->image[0].internalFormat == GL_ALPHA) + if (format == GL_ALPHA) imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES | MC_STAGE_0 | MC_UPDATE_DEST | @@ -782,7 +790,7 @@ static void i810UpdateTex0State( GLcontext *ctx ) MC_UPDATE_OP | MC_OP_ARG1 ); - if (t->image[0].internalFormat == GL_RGB) { + if (format == GL_RGB) { ma_modulate_op = MA_OP_ARG1; } else { ma_modulate_op = MA_OP_ARG2; @@ -809,7 +817,7 @@ static void i810UpdateTex0State( GLcontext *ctx ) MC_UPDATE_OP | MC_OP_MODULATE ); - if (t->image[0].internalFormat == GL_RGB) { + if (format == GL_RGB) { ma_modulate_op = MA_OP_ARG1; } else { ma_modulate_op = MA_OP_MODULATE; @@ -826,30 +834,74 @@ static void i810UpdateTex0State( GLcontext *ctx ) break; case GL_ADD: - imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES | - MC_STAGE_0 | - MC_UPDATE_DEST | - MC_DEST_CURRENT | - MC_UPDATE_ARG1 | - MC_ARG1_TEX0_COLOR | - MC_UPDATE_ARG2 | - MC_ARG2_ITERATED_COLOR | - MC_UPDATE_OP | - MC_OP_ADD ); + if (format == GL_ALPHA) { + /* Cv = Cf */ + imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES | + MC_STAGE_0 | + MC_UPDATE_DEST | + MC_DEST_CURRENT | + MC_UPDATE_ARG1 | + MC_ARG1_TEX0_COLOR | + MC_UPDATE_ARG2 | + MC_ARG2_ITERATED_COLOR | + MC_UPDATE_OP | + MC_OP_ARG2 ); + } + else { + /* Cv = Cf + Ct */ + imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES | + MC_STAGE_0 | + MC_UPDATE_DEST | + MC_DEST_CURRENT | + MC_UPDATE_ARG1 | + MC_ARG1_TEX0_COLOR | + MC_UPDATE_ARG2 | + MC_ARG2_ITERATED_COLOR | + MC_UPDATE_OP | + MC_OP_ADD ); + } - imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | - MA_STAGE_0 | - MA_UPDATE_ARG1 | - MA_ARG1_ITERATED_ALPHA | - MA_UPDATE_ARG2 | - MA_ARG2_TEX0_ALPHA | - MA_UPDATE_OP | - MA_OP_ADD ); + /* alpha */ + if (format == GL_ALPHA || + format == GL_LUMINANCE_ALPHA || + format == GL_RGBA) { + /* Av = Af * At */ + imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | + MA_STAGE_0 | + MA_UPDATE_ARG1 | + MA_ARG1_ITERATED_ALPHA | + MA_UPDATE_ARG2 | + MA_ARG2_TEX0_ALPHA | + MA_UPDATE_OP | + MA_OP_MODULATE ); + } + else if (format == GL_LUMINANCE || format == GL_RGB) { + /* Av = Af */ + imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | + MA_STAGE_0 | + MA_UPDATE_ARG1 | + MA_ARG1_ITERATED_ALPHA | + MA_UPDATE_ARG2 | + MA_ARG2_ITERATED_ALPHA | + MA_UPDATE_OP | + MA_OP_ARG1 ); + } + else { + /* Av = Af + At */ + imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | + MA_STAGE_0 | + MA_UPDATE_ARG1 | + MA_ARG1_ITERATED_ALPHA | + MA_UPDATE_ARG2 | + MA_ARG2_TEX0_ALPHA | + MA_UPDATE_OP | + MA_OP_ADD ); + } break; case GL_DECAL: - - if (t->image[0].internalFormat == GL_RGB) { + if (format == GL_RGB) { + /* C = Ct */ imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES | MC_STAGE_0 | MC_UPDATE_DEST | @@ -862,29 +914,32 @@ static void i810UpdateTex0State( GLcontext *ctx ) MC_OP_ARG2 ); } else { + /* RGBA or undefined result */ + /* C = Cf*(1-At)+Ct*At */ imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES | MC_STAGE_0 | MC_UPDATE_DEST | MC_DEST_CURRENT | MC_UPDATE_ARG1 | - MC_ARG1_COLOR_FACTOR | + MC_ARG1_TEX0_COLOR | MC_UPDATE_ARG2 | - MC_ARG2_TEX0_COLOR | + MC_ARG2_ITERATED_COLOR | MC_UPDATE_OP | MC_OP_LIN_BLEND_TEX0_ALPHA ); } + /* Av = Af */ imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | MA_STAGE_0 | MA_UPDATE_ARG1 | - MA_ARG1_ALPHA_FACTOR | + MA_ARG1_ITERATED_ALPHA | MA_UPDATE_ARG2 | - MA_ARG2_ALPHA_FACTOR | + MA_ARG2_ITERATED_ALPHA | MA_UPDATE_OP | MA_OP_ARG1 ); break; case GL_BLEND: - if (t->image[0].internalFormat == GL_ALPHA) + if (format == GL_ALPHA) imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES | MC_STAGE_0 | MC_UPDATE_DEST | @@ -907,7 +962,20 @@ static void i810UpdateTex0State( GLcontext *ctx ) MC_UPDATE_OP | MC_OP_LIN_BLEND_TEX0_COLOR ); - if (t->image[0].internalFormat == GL_RGB) { + /* alpha */ + if (format == GL_LUMINANCE || format == GL_RGB) { + /* Av = Af */ + imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | + MA_STAGE_0 | + MA_UPDATE_ARG1 | + MA_ARG1_ITERATED_ALPHA | + MA_UPDATE_ARG2 | + MA_ARG2_ITERATED_ALPHA | + MA_UPDATE_OP | + MA_OP_ARG1 ); + } + else if (format == GL_INTENSITY) { + /* Av = Af(1-It)+AcIt */ imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | MA_STAGE_0 | MA_UPDATE_ARG1 | @@ -915,16 +983,17 @@ static void i810UpdateTex0State( GLcontext *ctx ) MA_UPDATE_ARG2 | MA_ARG2_ITERATED_ALPHA | MA_UPDATE_OP | - MA_OP_ARG1 ); + MA_OP_LIN_BLEND_TEX0_ALPHA ); } else { + /* Av = AfAt */ imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES | MA_STAGE_0 | MA_UPDATE_ARG1 | - MA_ARG1_ALPHA_FACTOR | + MA_ARG1_TEX0_ALPHA | MA_UPDATE_ARG2 | MA_ARG2_ITERATED_ALPHA | MA_UPDATE_OP | - MA_OP_LIN_BLEND_TEX0_ALPHA ); + MA_OP_MODULATE ); } break; @@ -942,50 +1011,56 @@ static void i810UpdateTex1State( GLcontext *ctx ) i810ContextPtr imesa = I810_CONTEXT(ctx); struct gl_texture_object *tObj; i810TextureObjectPtr t; - int ma_modulate_op; - - - tObj = ctx->Texture.Unit[1].Current; - - if ( tObj != ctx->Texture.Unit[1].CurrentD[2] ) - tObj = 0; - + int ma_modulate_op, format; + /* disable */ + imesa->Setup[I810_CTXREG_MT] &= ~MT_TEXEL1_ENABLE; imesa->Setup[I810_CTXREG_MC1] = ( GFX_OP_MAP_COLOR_STAGES | - MC_STAGE_1 | - MC_UPDATE_DEST | - MC_DEST_CURRENT | - MC_UPDATE_ARG1 | - MC_ARG1_ONE | - MC_ARG1_DONT_REPLICATE_ALPHA | - MC_ARG1_DONT_INVERT | - MC_UPDATE_ARG2 | - MC_ARG2_ONE | - MC_ARG2_DONT_REPLICATE_ALPHA | - MC_ARG2_DONT_INVERT | - MC_UPDATE_OP | - MC_OP_DISABLE ); - + MC_STAGE_1 | + MC_UPDATE_DEST | + MC_DEST_CURRENT | + MC_UPDATE_ARG1 | + MC_ARG1_ONE | + MC_ARG1_DONT_REPLICATE_ALPHA | + MC_ARG1_DONT_INVERT | + MC_UPDATE_ARG2 | + MC_ARG2_ONE | + MC_ARG2_DONT_REPLICATE_ALPHA | + MC_ARG2_DONT_INVERT | + MC_UPDATE_OP | + MC_OP_DISABLE ); imesa->Setup[I810_CTXREG_MA1] = ( GFX_OP_MAP_ALPHA_STAGES | - MA_STAGE_1 | - MA_UPDATE_ARG1 | - MA_ARG1_CURRENT_ALPHA | - MA_ARG1_DONT_INVERT | - MA_UPDATE_ARG2 | - MA_ARG2_CURRENT_ALPHA | - MA_ARG2_DONT_INVERT | - MA_UPDATE_OP | - MA_OP_ARG1 ); - - if (!(ctx->Texture.ReallyEnabled & 0xf0) || !tObj || !tObj->Complete) { + MA_STAGE_1 | + MA_UPDATE_ARG1 | + MA_ARG1_CURRENT_ALPHA | + MA_ARG1_DONT_INVERT | + MA_UPDATE_ARG2 | + MA_ARG2_CURRENT_ALPHA | + MA_ARG2_DONT_INVERT | + MA_UPDATE_OP | + MA_OP_ARG1 ); + + if (ctx->Texture.Unit[1].ReallyEnabled == 0) { + return; + } + + tObj = ctx->Texture.Unit[1].Current; + if (ctx->Texture.Unit[1].ReallyEnabled != TEXTURE0_2D || + tObj->Image[tObj->BaseLevel]->Border > 0) { + /* 1D or 3D texturing enabled, or texture border - fallback */ + imesa->Fallback |= I810_FALLBACK_TEXTURE; return; } + /* Do 2D texture setup */ + + imesa->Setup[I810_CTXREG_MT] |= MT_TEXEL1_ENABLE; + t = tObj->DriverData; - if (!t) { t = i810CreateTexObj( imesa, tObj ); - if (!t) return; + if (!t) + return; } if (t->current_unit != 1) @@ -1000,6 +1075,8 @@ static void i810UpdateTex1State( GLcontext *ctx ) if (t->MemBlock) i810UpdateTexLRU( imesa, t ); + format = t->image[0].internalFormat; + switch (ctx->Texture.Unit[1].EnvMode) { case GL_REPLACE: imesa->Setup[I810_CTXREG_MC1] = ( GFX_OP_MAP_COLOR_STAGES | @@ -1013,7 +1090,7 @@ static void i810UpdateTex1State( GLcontext *ctx ) MC_UPDATE_OP | MC_OP_ARG1 ); - if (t->image[0].internalFormat == GL_RGB) { + if (format == GL_RGB) { ma_modulate_op = MA_OP_ARG1; } else { ma_modulate_op = MA_OP_ARG2; @@ -1040,7 +1117,7 @@ static void i810UpdateTex1State( GLcontext *ctx ) MC_UPDATE_OP | MC_OP_MODULATE ); - if (t->image[0].internalFormat == GL_RGB) { + if (format == GL_RGB) { ma_modulate_op = MA_OP_ARG1; } else { ma_modulate_op = MA_OP_MODULATE; @@ -1068,7 +1145,7 @@ static void i810UpdateTex1State( GLcontext *ctx ) MC_UPDATE_OP | MC_OP_ADD ); - if (t->image[0].internalFormat == GL_RGB) { + if (format == GL_RGB) { ma_modulate_op = MA_OP_ARG1; } else { ma_modulate_op = MA_OP_ADD; @@ -1086,7 +1163,7 @@ static void i810UpdateTex1State( GLcontext *ctx ) case GL_DECAL: - if (t->image[0].internalFormat == GL_RGB) { + if (format == GL_RGB) { imesa->Setup[I810_CTXREG_MC1] = ( GFX_OP_MAP_COLOR_STAGES | MC_STAGE_1 | MC_UPDATE_DEST | @@ -1133,7 +1210,7 @@ static void i810UpdateTex1State( GLcontext *ctx ) MC_UPDATE_OP | MC_OP_LIN_BLEND_TEX1_COLOR ); - if (t->image[0].internalFormat == GL_RGB) { + if (format == GL_RGB) { imesa->Setup[I810_CTXREG_MA1] = ( GFX_OP_MAP_ALPHA_STAGES | MA_STAGE_1 | MA_UPDATE_ARG1 | @@ -1169,11 +1246,12 @@ void i810UpdateTextureState( GLcontext *ctx ) if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->bound = 0; imesa->CurrentTexObj[0] = 0; imesa->CurrentTexObj[1] = 0; + imesa->Fallback &= ~I810_FALLBACK_TEXTURE; i810UpdateTex0State( ctx ); i810UpdateTex1State( ctx ); I810_CONTEXT( ctx )->dirty |= (I810_UPLOAD_CTX | - I810_UPLOAD_TEX0 | - I810_UPLOAD_TEX1); + I810_UPLOAD_TEX0 | + I810_UPLOAD_TEX1); } @@ -1196,13 +1274,17 @@ static void i810TexEnv( GLcontext *ctx, GLenum target, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - GLfloat *fc = texUnit->EnvColor; - GLuint col; - - col = ((((GLubyte)fc[3])<<24) | - (((GLubyte)fc[0])<<16) | - (((GLubyte)fc[1])<<8) | - (((GLubyte)fc[2])<<0)); + const GLfloat *fc = texUnit->EnvColor; + GLuint r, g, b, a, col; + FLOAT_COLOR_TO_UBYTE_COLOR(r, fc[0]); + FLOAT_COLOR_TO_UBYTE_COLOR(g, fc[1]); + FLOAT_COLOR_TO_UBYTE_COLOR(b, fc[2]); + FLOAT_COLOR_TO_UBYTE_COLOR(a, fc[3]); + + col = ((a << 24) | + (r << 16) | + (g << 8) | + (b << 0)); if (imesa->Setup[I810_CTXREG_CF1] != col) { FLUSH_BATCH(imesa); diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tris.h b/xc/lib/GL/mesa/src/drv/i810/i810tris.h index a83adad95..335566bba 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810tris.h +++ b/xc/lib/GL/mesa/src/drv/i810/i810tris.h @@ -22,7 +22,7 @@ * * */ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.h,v 1.8 2000/12/04 19:21:43 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.h,v 1.9 2001/03/21 16:14:21 dawes Exp $ */ #ifndef I810TRIS_INC #define I810TRIS_INC @@ -87,40 +87,42 @@ static __inline__ void i810_draw_point( i810ContextPtr imesa, { int vertsize = imesa->vertsize; GLuint *vb = i810AllocDwordsInline( imesa, 6 * vertsize ); + const GLfloat x = tmp->v.x + 0.125; + const GLfloat y = tmp->v.y - 0.5F; int j; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; } @@ -143,13 +145,33 @@ static __inline__ void i810_draw_line( i810ContextPtr imesa, : "=%c" (j) : "0" (vertsize), "S" ((long)v1) : "memory" ); +#elif 0 + for (j = 0 ; j < vertsize ; j++) + vb[j] = v0->ui[j]; + + vb += vertsize; + for (j = 0 ; j < vertsize ; j++) + vb[j] = v1->ui[j]; #else + const GLfloat dx = -0.5; + const GLfloat dy = -0.5; + + v0->v.x += dx; + v0->v.y += dy; + v1->v.x += dx; + v1->v.y += dy; + for (j = 0 ; j < vertsize ; j++) vb[j] = v0->ui[j]; vb += vertsize; for (j = 0 ; j < vertsize ; j++) vb[j] = v1->ui[j]; + + v0->v.x -= dx; + v0->v.y -= dy; + v1->v.x -= dx; + v1->v.y -= dy; #endif } diff --git a/xc/lib/GL/mesa/src/drv/i810/i810vb.c b/xc/lib/GL/mesa/src/drv/i810/i810vb.c index a6ad760a6..802c56dc2 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810vb.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810vb.c @@ -22,7 +22,7 @@ * * */ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810vb.c,v 1.7 2000/11/08 05:02:43 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810vb.c,v 1.8 2001/03/21 16:14:21 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -87,15 +87,18 @@ #define COORD \ GLfloat *win = VB->Win.data[i]; \ - v->v.x = win[0]; \ - v->v.y = i810height - win[1]; \ - v->v.z = (1.0/0x10000) * win[2]; \ + v->v.x = xoffset + win[0]; \ + v->v.y = yoffset - win[1]; \ + v->v.z = (1.0/0x10000) * win[2]; \ v->v.oow = win[3]; #define NOP +#define SUBPIXEL_X -0.5 +#define SUBPIXEL_Y -0.375 + #define SETUPFUNC(name,win,col,tex0,tex1,tex0_4,spec,fog) \ static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \ @@ -105,9 +108,12 @@ static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \ i810VertexPtr v; \ GLfloat (*tc0)[4]; \ GLfloat (*tc1)[4]; \ - GLfloat i810height = dPriv->h; \ + const GLfloat xoffset = SUBPIXEL_X; \ + const GLfloat yoffset = dPriv->h + SUBPIXEL_Y; \ int i; \ - (void) i810height; (void) imesa; \ + (void) xoffset; \ + (void) yoffset; \ + (void) imesa; \ \ \ gl_import_client_data( VB, VB->ctx->RenderFlags, \ @@ -269,7 +275,7 @@ void i810ChooseRasterSetupFunc(GLcontext *ctx) funcindex |= I810_TEX0_BIT; if (ctx->Texture.ReallyEnabled & 0xf0) { - funcindex |= I810_TEX1_BIT; + funcindex |= (I810_TEX0_BIT | I810_TEX1_BIT); imesa->vertsize = 10; imesa->Setup[I810_CTXREG_VF] = I810_VFMT_T0T1; } diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile b/xc/lib/GL/mesa/src/drv/mga/Imakefile index fa7af7f93..961fd205e 100644 --- a/xc/lib/GL/mesa/src/drv/mga/Imakefile +++ b/xc/lib/GL/mesa/src/drv/mga/Imakefile @@ -1,325 +1,39 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.15 2001/02/16 01:26:11 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.19 2001/04/03 02:29:35 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#ifdef i386Architecture -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif -#if MesaUseKatmai - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DDRIVERTS - DRI_INCLUDES = -I../../../../dri -I../../../../glx \ - -I../../../dri \ - -I$(TOP)/include -I$(TOP)/include/GL \ - -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \ - -I$(XF86DRIVERSRC)/mga \ - -I../../../include -I../.. -I../../X -I../common +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif -MESA_INCLUDES = -I. -I.. -I../../include \ - -I../../../../dri/drm - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - - DRISRCS = ../../../dri/dri_mesa.c \ - ../../../../dri/dri_tmm.c - - DRIOBJS = ../../../dri/dri_mesa.o \ - ../../../../dri/dri_tmm.o - - DRMSRCS = ../../../../dri/drm/xf86drm.c \ - ../../../../dri/drm/xf86drmHash.c \ - ../../../../dri/drm/xf86drmRandom.c \ - ../../../../dri/drm/xf86drmSL.c - - DRMOBJS = ../../../../dri/drm/xf86drm.o \ - ../../../../dri/drm/xf86drmHash.o \ - ../../../../dri/drm/xf86drmRandom.o \ - ../../../../dri/drm/xf86drmSL.o - - MGASRCS = mgabuffers.c \ - mgadd.c \ - mgaeltpath.c \ - mgafastpath.c \ - mgaioctl.c \ - mgapipeline.c \ - mgapixel.c \ - mgaspan.c \ - mgastate.c \ - mgatex.c \ - mgatexcnv.c \ - mgatexmem.c \ - mgatris.c \ - mgavb.c \ - mga_xmesa.c \ - - MGAOBJS = mgabuffers.o \ - mgadd.o \ - mgaeltpath.o \ - mgafastpath.o \ - mgaioctl.o \ - mgapipeline.o \ - mgapixel.o \ - mgaspan.o \ - mgastate.o \ - mgatex.o \ - mgatexcnv.o \ - mgatexmem.o \ - mgatris.o \ - mgavb.o \ - mga_xmesa.o - - MESASRCS = ../../aatriangle.c \ - ../../accum.c \ - ../../alpha.c \ - ../../alphabuf.c \ - ../../attrib.c \ - ../../bbox.c \ - ../../bitmap.c \ - ../../blend.c \ - ../../buffers.c \ - ../../clip.c \ - ../../colortab.c \ - ../../config.c \ - ../../context.c \ - ../../copypix.c \ - ../../cva.c \ - ../../debug_xform.c \ - ../../depth.c \ - ../../dlist.c \ - ../../drawpix.c \ - ../../enable.c \ - ../../enums.c \ - ../../eval.c \ - ../../extensions.c \ - ../../feedback.c \ - ../../fog.c \ - ../../get.c \ - ../../glapi.c \ - ../../glapinoop.c \ - ../../glthread.c \ - ../../hash.c \ - ../../image.c \ - ../../imaging.c \ - ../../light.c \ - ../../lines.c \ - ../../logic.c \ - ../../masking.c \ - ../../matrix.c \ - ../../mem.c \ - ../../mmath.c \ - ../../pb.c \ - ../../pipeline.c \ - ../../pixel.c \ - ../../pixeltex.c \ - ../../points.c \ - ../../polygon.c \ - ../../quads.c \ - ../../rastpos.c \ - ../../readpix.c \ - ../../rect.c \ - ../../scissor.c \ - ../../shade.c \ - ../../span.c \ - ../../stages.c \ - ../../state.c \ - ../../stencil.c \ - ../../teximage.c \ - ../../texobj.c \ - ../../texstate.c \ - ../../texture.c \ - ../../texutil.c \ - ../../translate.c \ - ../../triangle.c \ - ../../varray.c \ - ../../vb.c \ - ../../vbcull.c \ - ../../vbfill.c \ - ../../vbindirect.c \ - ../../vbrender.c \ - ../../vbxform.c \ - ../../vector.c \ - ../../vertices.c \ - ../../winpos.c \ - ../../xform.c \ - ../../zoom.c - - MESAOBJS = ../../aatriangle.o \ - ../../accum.o \ - ../../alpha.o \ - ../../alphabuf.o \ - ../../attrib.o \ - ../../bbox.o \ - ../../bitmap.o \ - ../../blend.o \ - ../../buffers.o \ - ../../clip.o \ - ../../colortab.o \ - ../../config.o \ - ../../context.o \ - ../../copypix.o \ - ../../cva.o \ - ../../debug_xform.o \ - ../../depth.o \ - ../../dlist.o \ - ../../drawpix.o \ - ../../enable.o \ - ../../enums.o \ - ../../eval.o \ - ../../extensions.o \ - ../../feedback.o \ - ../../fog.o \ - ../../get.o \ - ../../hash.o \ - ../../hint.o \ - ../../image.o \ - ../../imaging.o \ - ../../light.o \ - ../../lines.o \ - ../../logic.o \ - ../../masking.o \ - ../../matrix.o \ - ../../mem.o \ - ../../mmath.o \ - ../../pb.o \ - ../../pipeline.o \ - ../../pixel.o \ - ../../pixeltex.o \ - ../../points.o \ - ../../polygon.o \ - ../../quads.o \ - ../../rastpos.o \ - ../../readpix.o \ - ../../rect.o \ - ../../scissor.o \ - ../../shade.o \ - ../../span.o \ - ../../stages.o \ - ../../state.o \ - ../../stencil.o \ - ../../teximage.o \ - ../../texobj.o \ - ../../texstate.o \ - ../../texture.o \ - ../../texutil.o \ - ../../translate.o \ - ../../triangle.o \ - ../../varray.o \ - ../../vb.o \ - ../../vbcull.o \ - ../../vbfill.o \ - ../../vbindirect.o \ - ../../vbrender.o \ - ../../vbxform.o \ - ../../vector.o \ - ../../vertices.o \ - ../../winpos.o \ - ../../xform.o \ - ../../zoom.o - +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../Imakefile.inc" #ifdef i386Architecture - X86_SRCS = ../../X86/common_x86.c \ - ../../X86/common_x86_asm.S \ - ../../X86/x86.c \ - ../../X86/x86_cliptest.S \ - ../../X86/x86_vertex.S \ - ../../X86/x86_xform_masked2.S \ - ../../X86/x86_xform_masked3.S \ - ../../X86/x86_xform_masked4.S \ - ../../X86/x86_xform_raw2.S \ - ../../X86/x86_xform_raw3.S \ - ../../X86/x86_xform_raw4.S - - X86_OBJS = ../../X86/common_x86.o \ - ../../X86/common_x86_asm.o \ - ../../X86/x86.o \ - ../../X86/x86_cliptest.o \ - ../../X86/x86_vertex.o \ - ../../X86/x86_xform_masked2.o \ - ../../X86/x86_xform_masked3.o \ - ../../X86/x86_xform_masked4.o \ - ../../X86/x86_xform_raw2.o \ - ../../X86/x86_xform_raw3.o \ - ../../X86/x86_xform_raw4.o - -#if MesaUseMMX - MMX_SRCS = ../../X86/mmx_blend.S - - MMX_OBJS = ../../X86/mmx_blend.o +#include "../../X86/Imakefile.inc" #endif -#if MesaUse3DNow - 3DNOW_SRCS = ../../X86/3dnow.c \ - ../../X86/3dnow_norm_raw.S \ - ../../X86/3dnow_vertex.S \ - ../../X86/3dnow_xform_masked1.S \ - ../../X86/3dnow_xform_masked2.S \ - ../../X86/3dnow_xform_masked3.S \ - ../../X86/3dnow_xform_masked4.S \ - ../../X86/3dnow_xform_raw1.S \ - ../../X86/3dnow_xform_raw2.S \ - ../../X86/3dnow_xform_raw3.S \ - ../../X86/3dnow_xform_raw4.S + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - 3DNOW_OBJS = ../../X86/3dnow.o \ - ../../X86/3dnow_norm_raw.o \ - ../../X86/3dnow_vertex.o \ - ../../X86/3dnow_xform_masked1.o \ - ../../X86/3dnow_xform_masked2.o \ - ../../X86/3dnow_xform_masked3.o \ - ../../X86/3dnow_xform_masked4.o \ - ../../X86/3dnow_xform_raw1.o \ - ../../X86/3dnow_xform_raw2.o \ - ../../X86/3dnow_xform_raw3.o \ - ../../X86/3dnow_xform_raw4.o -#endif - -#if MesaUseKatmai - KATMAI_SRCS = ../../X86/katmai.c \ - ../../X86/katmai_norm_raw.S \ - ../../X86/katmai_vertex.S \ - ../../X86/katmai_xform_masked1.S \ - ../../X86/katmai_xform_masked2.S \ - ../../X86/katmai_xform_masked3.S \ - ../../X86/katmai_xform_masked4.S \ - ../../X86/katmai_xform_raw1.S \ - ../../X86/katmai_xform_raw2.S \ - ../../X86/katmai_xform_raw3.S \ - ../../X86/katmai_xform_raw4.S + DRIOBJS = $(GLXLIBSRC)/mesa/dri/dri_mesa.o \ + $(GLXLIBSRC)/dri/dri_tmm.o - KATMAI_OBJS = ../../X86/katmai.o \ - ../../X86/katmai_norm_raw.o \ - ../../X86/katmai_vertex.o \ - ../../X86/katmai_xform_masked1.o \ - ../../X86/katmai_xform_masked2.o \ - ../../X86/katmai_xform_masked3.o \ - ../../X86/katmai_xform_masked4.o \ - ../../X86/katmai_xform_raw1.o \ - ../../X86/katmai_xform_raw2.o \ - ../../X86/katmai_xform_raw3.o \ - ../../X86/katmai_xform_raw4.o -#endif -#endif + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o \ + $(GLXLIBSRC)/dri/drm/xf86drmMga.o #ifdef GlxSoProf LOSRCS = ../../../../lowpc.c @@ -329,49 +43,30 @@ MESA_INCLUDES = -I. -I.. -I../../include \ HIOBJS = ../../../../highpc.o #endif - ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) + SRCS = $(MGASRCS) + OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \ + $(MESA_ASM_OBJS) $(COMMONOBJS) $(MGAOBJS) $(HIOBJS) - COMMONSRCS = ../common/mm.c ../common/hwlog.c - COMMONOBJS = ../common/mm.o ../common/hwlog.o - - SRCS = $(LOSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) \ - $(ASMSRCS) $(COMMONSRCS) $(MGASRCS) $(HISRCS) - OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) \ - $(ASMOBJS) $(COMMONOBJS) $(MGAOBJS) $(HIOBJS) - -REQUIREDLIBS += MathLibrary -#if !GlxBuiltInMga -REQUIREDLIBS += -L../../../.. -lGL -L../../../../../X11 -lX11 -#endif - - -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif +REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) #include <Library.tmpl> LibraryObjectRule() -SubdirLibraryRule($(OBJS)) +SubdirLibraryRule($(MGAOBJS)) NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = mga_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDriModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +SharedDriModuleTarget($(LIBNAME),DONE,$(OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #ifdef GlxSoProf SOPROF_LIBNAME = _mga_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE,$(OBJS)) InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) #endif #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile.inc b/xc/lib/GL/mesa/src/drv/mga/Imakefile.inc new file mode 100644 index 000000000..e923fc041 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/mga/Imakefile.inc @@ -0,0 +1,127 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile.inc,v 1.1 2001/03/23 19:18:41 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvMgaBuildDir +#define MesaDrvMgaBuildDir /**/ +#endif +MESADRVMGABUILDDIR = MesaDrvMgaBuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DDRIVERTS + DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ + -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) \ + -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/mesa/dri \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86OSSRC) \ + -I$(XF86DRIVERSRC)/mga \ + -I$(GLXLIBSRC)/dri/drm +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src \ + -I$(MESADRVSRCDIR)/common \ + -I$(MESADRVSRCDIR)/mga + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + MGASRCS = $(MESADRVMGABUILDDIR)mgabuffers.c \ + $(MESADRVMGABUILDDIR)mgadd.c \ + $(MESADRVMGABUILDDIR)mgaeltpath.c \ + $(MESADRVMGABUILDDIR)mgafastpath.c \ + $(MESADRVMGABUILDDIR)mgaioctl.c \ + $(MESADRVMGABUILDDIR)mgapipeline.c \ + $(MESADRVMGABUILDDIR)mgaspan.c \ + $(MESADRVMGABUILDDIR)mgastate.c \ + $(MESADRVMGABUILDDIR)mgatex.c \ + $(MESADRVMGABUILDDIR)mgatexcnv.c \ + $(MESADRVMGABUILDDIR)mgatexmem.c \ + $(MESADRVMGABUILDDIR)mgatris.c \ + $(MESADRVMGABUILDDIR)mgavb.c \ + $(MESADRVMGABUILDDIR)mga_xmesa.c \ + + MGAOBJS = $(MESADRVMGABUILDDIR)mgabuffers.o \ + $(MESADRVMGABUILDDIR)mgadd.o \ + $(MESADRVMGABUILDDIR)mgaeltpath.o \ + $(MESADRVMGABUILDDIR)mgafastpath.o \ + $(MESADRVMGABUILDDIR)mgaioctl.o \ + $(MESADRVMGABUILDDIR)mgapipeline.o \ + $(MESADRVMGABUILDDIR)mgaspan.o \ + $(MESADRVMGABUILDDIR)mgastate.o \ + $(MESADRVMGABUILDDIR)mgatex.o \ + $(MESADRVMGABUILDDIR)mgatexcnv.o \ + $(MESADRVMGABUILDDIR)mgatexmem.o \ + $(MESADRVMGABUILDDIR)mgatris.o \ + $(MESADRVMGABUILDDIR)mgavb.o \ + $(MESADRVMGABUILDDIR)mga_xmesa.o + + MGAUOBJS = $(MESADRVMGABUILDDIR)unshared/mgabuffers.o \ + $(MESADRVMGABUILDDIR)unshared/mgadd.o \ + $(MESADRVMGABUILDDIR)unshared/mgaeltpath.o \ + $(MESADRVMGABUILDDIR)unshared/mgafastpath.o \ + $(MESADRVMGABUILDDIR)unshared/mgaioctl.o \ + $(MESADRVMGABUILDDIR)unshared/mgapipeline.o \ + $(MESADRVMGABUILDDIR)unshared/mgaspan.o \ + $(MESADRVMGABUILDDIR)unshared/mgastate.o \ + $(MESADRVMGABUILDDIR)unshared/mgatex.o \ + $(MESADRVMGABUILDDIR)unshared/mgatexcnv.o \ + $(MESADRVMGABUILDDIR)unshared/mgatexmem.o \ + $(MESADRVMGABUILDDIR)unshared/mgatris.o \ + $(MESADRVMGABUILDDIR)unshared/mgavb.o \ + $(MESADRVMGABUILDDIR)unshared/mga_xmesa.o + + MGADOBJS = $(MESADRVMGABUILDDIR)debugger/mgabuffers.o \ + $(MESADRVMGABUILDDIR)debugger/mgadd.o \ + $(MESADRVMGABUILDDIR)debugger/mgaeltpath.o \ + $(MESADRVMGABUILDDIR)debugger/mgafastpath.o \ + $(MESADRVMGABUILDDIR)debugger/mgaioctl.o \ + $(MESADRVMGABUILDDIR)debugger/mgapipeline.o \ + $(MESADRVMGABUILDDIR)debugger/mgaspan.o \ + $(MESADRVMGABUILDDIR)debugger/mgastate.o \ + $(MESADRVMGABUILDDIR)debugger/mgatex.o \ + $(MESADRVMGABUILDDIR)debugger/mgatexcnv.o \ + $(MESADRVMGABUILDDIR)debugger/mgatexmem.o \ + $(MESADRVMGABUILDDIR)debugger/mgatris.o \ + $(MESADRVMGABUILDDIR)debugger/mgavb.o \ + $(MESADRVMGABUILDDIR)debugger/mga_xmesa.o + + MGAPOBJS = $(MESADRVMGABUILDDIR)profiled/mgabuffers.o \ + $(MESADRVMGABUILDDIR)profiled/mgadd.o \ + $(MESADRVMGABUILDDIR)profiled/mgaeltpath.o \ + $(MESADRVMGABUILDDIR)profiled/mgafastpath.o \ + $(MESADRVMGABUILDDIR)profiled/mgaioctl.o \ + $(MESADRVMGABUILDDIR)profiled/mgapipeline.o \ + $(MESADRVMGABUILDDIR)profiled/mgaspan.o \ + $(MESADRVMGABUILDDIR)profiled/mgastate.o \ + $(MESADRVMGABUILDDIR)profiled/mgatex.o \ + $(MESADRVMGABUILDDIR)profiled/mgatexcnv.o \ + $(MESADRVMGABUILDDIR)profiled/mgatexmem.o \ + $(MESADRVMGABUILDDIR)profiled/mgatris.o \ + $(MESADRVMGABUILDDIR)profiled/mgavb.o \ + $(MESADRVMGABUILDDIR)profiled/mga_xmesa.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(mgabuffers.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgadd.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgaeltpath.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgafastpath.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgaioctl.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgapipeline.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgaspan.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgastate.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgatex.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgatexcnv.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgatexmem.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgatris.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mgavb.c, $(MESADRVSRCDIR)/mga) +LinkSourceFile(mga_xmesa.c, $(MESADRVSRCDIR)/mga) +#endif + diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c index ddbba0eea..b12a6eb40 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.10 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.11 2001/03/21 16:14:21 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -67,10 +67,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef MGA_DEBUG int MGA_DEBUG = (0 /* | DEBUG_ALWAYS_SYNC */ -/* | DEBUG_VERBOSE_MSG */ + | DEBUG_VERBOSE_MSG /* | DEBUG_VERBOSE_LRU */ -/* | DEBUG_VERBOSE_DRI */ -/* | DEBUG_VERBOSE_IOCTL */ + | DEBUG_VERBOSE_DRI + | DEBUG_VERBOSE_IOCTL /* | DEBUG_VERBOSE_2D */ ); #endif @@ -85,7 +85,7 @@ static mgaContextPtr mgaCtx = 0; * XMesaResetDriver * XMesaCreateVisual * XMesaDestroyVisual - * XMesaCreateContext + * XMesaCreateContext * XMesaDestroyContext * XMesaCreateWindowBuffer * XMesaCreatePixmapBuffer @@ -107,9 +107,9 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { int major, minor, patch; if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { char msg[1000]; - sprintf(msg, "MGA DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch); + sprintf(msg, "MGA DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch); __driMesaMessage(msg); return GL_FALSE; } @@ -118,8 +118,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) /* Check that the DDX driver version is compatible */ if (sPriv->ddxMajor != 1 || - sPriv->ddxMinor != 0 || - sPriv->ddxPatch < 0) { + sPriv->ddxMinor < 0) { char msg[1000]; sprintf(msg, "MGA DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); __driMesaMessage(msg); @@ -127,11 +126,10 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) } /* Check that the DRM driver version is compatible */ - if (sPriv->drmMajor != 2 || - sPriv->drmMinor != 1 || - sPriv->drmPatch < 0) { + if (sPriv->drmMajor != 3 || + sPriv->drmMinor < 0) { char msg[1000]; - sprintf(msg, "MGA DRI driver expected DRM driver version 2.{0,1}.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + sprintf(msg, "MGA DRI driver expected DRM driver version 3.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); __driMesaMessage(msg); return GL_FALSE; } @@ -155,33 +153,67 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) return GL_FALSE; } - + mgaScreen->chipset = serverInfo->chipset; mgaScreen->width = serverInfo->width; mgaScreen->height = serverInfo->height; mgaScreen->mem = serverInfo->mem; mgaScreen->cpp = serverInfo->cpp; + + mgaScreen->agpMode = serverInfo->agpMode; + mgaScreen->frontPitch = serverInfo->frontPitch; mgaScreen->frontOffset = serverInfo->frontOffset; - mgaScreen->backOffset = serverInfo->backOffset; + mgaScreen->backOffset = serverInfo->backOffset; mgaScreen->backPitch = serverInfo->backPitch; mgaScreen->depthOffset = serverInfo->depthOffset; mgaScreen->depthPitch = serverInfo->depthPitch; + mgaScreen->mmio.handle = serverInfo->registers.handle; + mgaScreen->mmio.size = serverInfo->registers.size; + if ( drmMap( sPriv->fd, + mgaScreen->mmio.handle, mgaScreen->mmio.size, + &mgaScreen->mmio.map ) < 0 ) { + FREE( mgaScreen ); + sPriv->private = NULL; + __driMesaMessage( "Couldn't map MMIO registers" ); + return GL_FALSE; + } + +#if 0 + mgaScreen->status.handle = serverInfo->status.handle; + mgaScreen->status.size = serverInfo->status.size; + if ( drmMap( sPriv->fd, + mgaScreen->status.handle, mgaScreen->status.size, + &mgaScreen->status.map ) < 0 ) { + drmUnmap( mgaScreen->mmio.map, mgaScreen->mmio.size ); + FREE( mgaScreen ); + sPriv->private = NULL; + __driMesaMessage( "Couldn't map status page" ); + return GL_FALSE; + } +#endif + + mgaScreen->primary.handle = serverInfo->primary.handle; + mgaScreen->primary.size = serverInfo->primary.size; + mgaScreen->buffers.handle = serverInfo->buffers.handle; + mgaScreen->buffers.size = serverInfo->buffers.size; +#if 0 mgaScreen->agp.handle = serverInfo->agp; mgaScreen->agp.size = serverInfo->agpSize; - if (drmMap(sPriv->fd, - mgaScreen->agp.handle, - mgaScreen->agp.size, - (drmAddress *)&mgaScreen->agp.map) != 0) + if (drmMap(sPriv->fd, + mgaScreen->agp.handle, + mgaScreen->agp.size, + (drmAddress *)&mgaScreen->agp.map) != 0) { Xfree(mgaScreen); sPriv->private = NULL; __driMesaMessage("Couldn't map agp region"); return GL_FALSE; } +#endif mgaScreen->textureOffset[MGA_CARD_HEAP] = serverInfo->textureOffset; mgaScreen->textureOffset[MGA_AGP_HEAP] = (serverInfo->agpTextureOffset | @@ -190,23 +222,24 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->textureSize[MGA_CARD_HEAP] = serverInfo->textureSize; mgaScreen->textureSize[MGA_AGP_HEAP] = serverInfo->agpTextureSize; - mgaScreen->logTextureGranularity[MGA_CARD_HEAP] = + mgaScreen->logTextureGranularity[MGA_CARD_HEAP] = serverInfo->logTextureGranularity; - mgaScreen->logTextureGranularity[MGA_AGP_HEAP] = + mgaScreen->logTextureGranularity[MGA_AGP_HEAP] = serverInfo->logAgpTextureGranularity; - mgaScreen->texVirtual[MGA_CARD_HEAP] = (char *)(mgaScreen->sPriv->pFB + + mgaScreen->texVirtual[MGA_CARD_HEAP] = (char *)(mgaScreen->sPriv->pFB + serverInfo->textureOffset); - mgaScreen->texVirtual[MGA_AGP_HEAP] = (mgaScreen->agp.map + +#if 0 + mgaScreen->texVirtual[MGA_AGP_HEAP] = (mgaScreen->agp.map + serverInfo->agpTextureOffset); +#endif mgaScreen->mAccess = serverInfo->mAccess; - /* For calculating setupdma addresses. */ - mgaScreen->dmaOffset = serverInfo->agpBufferOffset; - + mgaScreen->dmaOffset = serverInfo->buffers.handle; + mgaScreen->bufs = drmMapBufs(sPriv->fd); if (!mgaScreen->bufs) { /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/ @@ -215,6 +248,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) __driMesaMessage("Couldn't map dma buffers"); return GL_FALSE; } + mgaScreen->sarea_priv_offset = serverInfo->sarea_priv_offset; mgaDDFastPathInit(); mgaDDEltPathInit(); @@ -277,8 +311,8 @@ GLboolean XMesaCreateContext( Display *dpy, GLvisual *mesaVis, mgaContextPtr mmesa; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; - drm_mga_sarea_t *saPriv=(drm_mga_sarea_t*)(((char*)sPriv->pSAREA)+ - sizeof(XF86DRISAREARec)); + MGASAREAPrivPtr saPriv = (MGASAREAPrivPtr)(((char*)sPriv->pSAREA)+ + mgaScreen->sarea_priv_offset); if (MGA_DEBUG&DEBUG_VERBOSE_DRI) fprintf(stderr, "XMesaCreateContext\n"); @@ -313,10 +347,10 @@ GLboolean XMesaCreateContext( Display *dpy, GLvisual *mesaVis, * that both texture units can bind a maximal texture and have them * on the card at once. */ - { + { int nr = 2; - if (mgaScreen->chipset == MGA_CARD_TYPE_G200) + if (mgaScreen->chipset == MGA_CARD_TYPE_G200) nr = 1; if (mgaScreen->textureSize[0] < nr*1024*1024) { @@ -328,44 +362,49 @@ GLboolean XMesaCreateContext( Display *dpy, GLvisual *mesaVis, } else { ctx->Const.MaxTextureLevels = 11; ctx->Const.MaxTextureSize = 1<<10; - } + } } mmesa->hw_stencil = mesaVis->StencilBits && mesaVis->DepthBits == 24; switch (mesaVis->DepthBits) { - case 16: - mmesa->depth_scale = 1.0/(GLdouble)0xffff; + case 16: + mmesa->depth_scale = 1.0/(GLdouble)0xffff; mmesa->depth_clear_mask = ~0; mmesa->ClearDepth = 0xffff; break; - case 24: - mmesa->depth_scale = 1.0/(GLdouble)0xffffff; + case 24: + mmesa->depth_scale = 1.0/(GLdouble)0xffffff; if (mmesa->hw_stencil) { mmesa->depth_clear_mask = 0xffffff00; mmesa->stencil_clear_mask = 0x000000ff; } else mmesa->depth_clear_mask = ~0; mmesa->ClearDepth = 0xffffff00; - break; - case 32: - mmesa->depth_scale = 1.0/(GLdouble)0xffffffff; + break; + case 32: + mmesa->depth_scale = 1.0/(GLdouble)0xffffffff; mmesa->depth_clear_mask = ~0; mmesa->ClearDepth = 0xffffffff; break; }; - + mmesa->canDoStipple = GL_FALSE; mmesa->renderindex = -1; /* impossible value */ mmesa->new_state = ~0; mmesa->dirty = ~0; - mmesa->warp_pipe = 0; + mmesa->warp_pipe = 0; mmesa->CurrentTexObj[0] = 0; mmesa->CurrentTexObj[1] = 0; - + mmesa->texAge[0] = 0; mmesa->texAge[1] = 0; - + +#if 0 + mmesa->status = (GLuint *)mmesa->mgaScreen->status.map; +#endif + mmesa->primary_offset = mmesa->mgaScreen->primary.handle; + ctx->DriverCtx = (void *) mmesa; mmesa->glCtx = ctx; @@ -376,8 +415,7 @@ GLboolean XMesaCreateContext( Display *dpy, GLvisual *mesaVis, mgaDDInitSpanFuncs( ctx ); mgaDDInitDriverFuncs( ctx ); mgaDDInitIoctlFuncs( ctx ); - mgaDDInitPixelFuncs( ctx ); - +/* mgaDDInitPixelFuncs( ctx );*/ ctx->Driver.TriangleCaps = (DD_TRI_CULL| DD_TRI_LIGHT_TWOSIDE| @@ -388,7 +426,7 @@ GLboolean XMesaCreateContext( Display *dpy, GLvisual *mesaVis, */ ctx->TriangleCaps |= DD_CLIP_FOG_COORD; - if (ctx->VB) + if (ctx->VB) mgaDDRegisterVB( ctx->VB ); if (ctx->NrPipelineStages) @@ -423,14 +461,16 @@ GLframebuffer *XMesaCreateWindowBuffer( Display *dpy, __DRIdrawablePrivate *driDrawPriv, GLvisual *mesaVis) { + GLboolean swStencil = mesaVis->StencilBits > 0 && mesaVis->DepthBits != 24; + if (MGA_DEBUG&DEBUG_VERBOSE_DRI) fprintf(stderr, "XMesaCreateWindowBuffer\n"); return gl_create_framebuffer(mesaVis, GL_FALSE, /* software depth buffer? */ - mesaVis->StencilBits > 0, + swStencil, mesaVis->AccumRedBits > 0, - mesaVis->AlphaBits > 0 + GL_FALSE /* software alpha buffer/ */ ); } @@ -459,7 +499,7 @@ GLframebuffer *XMesaCreatePixmapBuffer( Display *dpy, void XMesaSwapBuffers(__DRIdrawablePrivate *driDrawPriv) { /* XXX should do swap according to the buffer, not the context! */ - mgaContextPtr mmesa = mgaCtx; + mgaContextPtr mmesa = mgaCtx; FLUSH_VB( mmesa->glCtx, "swap buffers" ); mgaSwapBuffers(mmesa); } @@ -489,7 +529,7 @@ XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) /* This looks buggy to me - the 'b' variable isn't used anywhere... * Hmm - It seems that the drawable is already hooked in to - * driDrawablePriv. + * driDrawablePriv. * * But why are we doing context initialization here??? */ @@ -504,8 +544,8 @@ GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv, if (mgaCtx->driDrawable != driDrawPriv) { mgaCtx->driDrawable = driDrawPriv; - mgaCtx->dirty = ~0; - mgaCtx->dirty_cliprects = (MGA_FRONT|MGA_BACK); + mgaCtx->dirty = ~0; + mgaCtx->dirty_cliprects = (MGA_FRONT|MGA_BACK); } if (!mgaCtx->glCtx->Viewport.Width) @@ -521,28 +561,28 @@ GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv, } -void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) +void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) { __DRIdrawablePrivate *dPriv = mmesa->driDrawable; - drm_mga_sarea_t *sarea = mmesa->sarea; + MGASAREAPrivPtr sarea = mmesa->sarea; int me = mmesa->hHWContext; int i; - drmGetLock(mmesa->driFd, mmesa->hHWContext, flags); + drmGetLock(mmesa->driFd, mmesa->hHWContext, flags); - if (*(dPriv->pStamp) != mmesa->lastStamp) { + if (*(dPriv->pStamp) != mmesa->lastStamp) { mmesa->lastStamp = *(dPriv->pStamp); mmesa->setupdone = 0; mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK); mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK) ); } - mmesa->dirty |= MGA_UPLOAD_CTX | MGA_UPLOAD_CLIPRECTS; + mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS; - mmesa->sarea->dirty |= MGA_UPLOAD_CTX; + mmesa->sarea->dirty |= MGA_UPLOAD_CONTEXT; if (sarea->ctxOwner != me) { - mmesa->dirty |= (MGA_UPLOAD_CTX | MGA_UPLOAD_TEX0 | + mmesa->dirty |= (MGA_UPLOAD_CONTEXT | MGA_UPLOAD_TEX0 | MGA_UPLOAD_TEX1 | MGA_UPLOAD_PIPE); sarea->ctxOwner=me; } diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h index f562ad094..a785d83af 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h @@ -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/mga/mga_xmesa.h,v 1.6 2000/09/24 13:51:05 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h,v 1.8 2001/04/01 13:59:59 tsi Exp $ */ /* * Authors: @@ -44,12 +44,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "types.h" #include "mgaregs.h" -typedef struct { - drmHandle handle; - drmSize size; - char *map; -} mgaRegion, *mgaRegionPtr; - typedef struct mga_screen_private_s { int chipset; @@ -58,6 +52,7 @@ typedef struct mga_screen_private_s { int mem; int cpp; /* for front and back buffers */ + GLint agpMode; unsigned int mAccess; @@ -70,7 +65,7 @@ typedef struct mga_screen_private_s { unsigned int depthPitch; int depthCpp; - unsigned int dmaOffset; + unsigned int dmaOffset; unsigned int textureOffset[MGA_NR_TEX_HEAPS]; unsigned int textureSize[MGA_NR_TEX_HEAPS]; @@ -81,10 +76,11 @@ typedef struct mga_screen_private_s { __DRIscreenPrivate *sPriv; drmBufMapPtr bufs; - /* Maps the dma buffers as well as textures ? - */ - mgaRegion agp; - + drmRegion mmio; + drmRegion status; + drmRegion primary; + drmRegion buffers; + unsigned int sarea_priv_offset; } mgaScreenPrivate; @@ -99,7 +95,7 @@ extern void mgaEmitScissorValues( mgaContextPtr mmesa, int box_nr, int emit ); -/* Lock the hardware and validate our state. +/* Lock the hardware and validate our state. */ #define LOCK_HARDWARE( mmesa ) \ do { \ @@ -111,18 +107,18 @@ extern void mgaEmitScissorValues( mgaContextPtr mmesa, int box_nr, int emit ); } while (0) -/* +/* */ #define LOCK_HARDWARE_QUIESCENT( mmesa ) do { \ LOCK_HARDWARE( mmesa ); \ - mgaUpdateLock( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); \ + UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); \ } while (0) -/* Unlock the hardware using the global current context +/* Unlock the hardware using the global current context */ #define UNLOCK_HARDWARE(mmesa) \ - DRM_UNLOCK(mmesa->driFd, mmesa->driHwLock, mmesa->hHWContext); + DRM_UNLOCK(mmesa->driFd, mmesa->driHwLock, mmesa->hHWContext); /* Freshen our snapshot of the drawables @@ -139,5 +135,17 @@ do { \ #define GET_DRAWABLE_LOCK( mmesa ) while(0) #define RELEASE_DRAWABLE_LOCK( mmesa ) while(0) + +/* The 2D driver macros are busted -- we can't use them here as they + * rely on the 2D driver data structures rather than taking an explicit + * base address. + */ +#define MGA_BASE( reg ) ((unsigned long)(mmesa->mgaScreen->mmio.map)) +#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) + +#define MGA_DEREF( reg ) *(volatile CARD32 *)MGA_ADDR( reg ) +#define MGA_READ( reg ) MGA_DEREF( reg ) +#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0) + #endif #endif diff --git a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c index 5568024d8..0e53b2f41 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.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/mga/mgabuffers.c,v 1.5 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgabuffers.c,v 1.6 2001/03/21 16:14:22 dawes Exp $ */ /* * Authors: @@ -43,14 +43,19 @@ static void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa ) { __DRIdrawablePrivate *driDrawable = mmesa->driDrawable; - mmesa->numClipRects = driDrawable->numClipRects; - mmesa->pClipRects = driDrawable->pClipRects; + if (driDrawable->numClipRects == 0) { + static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0}; + mmesa->numClipRects = 1; + mmesa->pClipRects = &zeroareacliprect; + } else { + mmesa->numClipRects = driDrawable->numClipRects; + mmesa->pClipRects = driDrawable->pClipRects; + } mmesa->drawX = driDrawable->x; mmesa->drawY = driDrawable->y; - mmesa->Setup[MGA_CTXREG_DSTORG] = mmesa->drawOffset; - mmesa->dirty |= MGA_UPLOAD_CTX; - mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; + mmesa->setup.dstorg = mmesa->drawOffset; + mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS; } @@ -58,10 +63,16 @@ static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa ) { __DRIdrawablePrivate *driDrawable = mmesa->driDrawable; - if (driDrawable->numBackClipRects == 0) + if (driDrawable->numBackClipRects == 0) { - mmesa->numClipRects = driDrawable->numClipRects; - mmesa->pClipRects = driDrawable->pClipRects; + if (driDrawable->numClipRects == 0) { + static XF86DRIClipRectRec zeroareacliprect = {0,0,0,0}; + mmesa->numClipRects = 1; + mmesa->pClipRects = &zeroareacliprect; + } else { + mmesa->numClipRects = driDrawable->numClipRects; + mmesa->pClipRects = driDrawable->pClipRects; + } mmesa->drawX = driDrawable->x; mmesa->drawY = driDrawable->y; } else { @@ -71,19 +82,18 @@ static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa ) mmesa->drawY = driDrawable->backY; } - mmesa->Setup[MGA_CTXREG_DSTORG] = mmesa->drawOffset; - - mmesa->dirty |= MGA_UPLOAD_CTX; - mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; + mmesa->setup.dstorg = mmesa->drawOffset; + mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS; } + #if 0 static void mgaUpdateRectsFromSarea( mgaContextPtr mmesa ) { __DRIdrawablePrivate *driDrawable = mmesa->driDrawable; __DRIscreenPrivate *driScreen = mmesa->driScreen; - drm_mga_sarea_t *sarea = mmesa->sarea; + MGASAREAPrivPtr sarea = mmesa->sarea; int i = 0, top = 0; @@ -94,12 +104,12 @@ static void mgaUpdateRectsFromSarea( mgaContextPtr mmesa ) top = sarea->exported_nback; for (i = 0 ; i < top ; i++) - driDrawable->pBackClipRects[i] = + driDrawable->pBackClipRects[i] = *(XF86DRIClipRectPtr)&(sarea->exported_boxes[i]); } - if (sarea->exported_buffers & MGA_FRONT) + if (sarea->exported_buffers & MGA_FRONT) { int start = top; @@ -108,10 +118,10 @@ static void mgaUpdateRectsFromSarea( mgaContextPtr mmesa ) top += sarea->exported_nfront; for ( ; i < top ; i++) - driDrawable->pClipRects[i-start] = + driDrawable->pClipRects[i-start] = *(XF86DRIClipRectPtr)&(sarea->exported_boxes[i]); - - } + + } @@ -123,7 +133,7 @@ static void mgaUpdateRectsFromSarea( mgaContextPtr mmesa ) driDrawable->backY = sarea->exported_back_y; driDrawable->w = sarea->exported_w; driDrawable->h = sarea->exported_h; - driDrawable->pStamp = + driDrawable->pStamp = &(driScreen->pSAREA->drawableTable[driDrawable->index].stamp); mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK) & ~(sarea->exported_buffers); @@ -134,7 +144,7 @@ static void mgaUpdateRectsFromSarea( mgaContextPtr mmesa ) static void printSareaRects( mgaContextPtr mmesa ) { __DRIscreenPrivate *driScreen = mmesa->driScreen; - drm_mga_sarea_t *sarea = mmesa->sarea; + MGASAREAPrivPtr sarea = mmesa->sarea; int i; fprintf(stderr, "sarea->exported: %d\n", sarea->exported_drawable); @@ -152,7 +162,7 @@ static void printSareaRects( mgaContextPtr mmesa ) i = 0; if (sarea->exported_buffers & MGA_BACK) - for ( ; i < sarea->exported_nback ; i++) + for ( ; i < sarea->exported_nback ; i++) fprintf(stderr, "back %d: %d,%d-%d,%d\n", i, sarea->exported_boxes[i].x1, sarea->exported_boxes[i].y1, sarea->exported_boxes[i].x2, sarea->exported_boxes[i].y2); @@ -160,14 +170,14 @@ static void printSareaRects( mgaContextPtr mmesa ) if (sarea->exported_buffers & MGA_FRONT) { int start = i; int top = i + sarea->exported_nfront; - for ( ; i < top ; i++) - fprintf(stderr, "front %d: %d,%d-%d,%d\n", + for ( ; i < top ; i++) + fprintf(stderr, "front %d: %d,%d-%d,%d\n", i - start, sarea->exported_boxes[i].x1, sarea->exported_boxes[i].y1, sarea->exported_boxes[i].x2, sarea->exported_boxes[i].y2); } - fprintf(stderr, "drawableTable[%d].stamp: %d\n", + fprintf(stderr, "drawableTable[%d].stamp: %d\n", sarea->exported_index, driScreen->pSAREA->drawableTable[sarea->exported_index].stamp); } @@ -187,13 +197,13 @@ static void printMmesaRects( mgaContextPtr mmesa ) fprintf(stderr, "driDrawable->w: %d\n", driDrawable->w); fprintf(stderr, "driDrawable->h: %d\n", driDrawable->h); - for (i = 0 ; i < nr ; i++) + for (i = 0 ; i < nr ; i++) fprintf(stderr, "box %d: %d,%d-%d,%d\n", i, mmesa->pClipRects[i].x1, mmesa->pClipRects[i].y1, mmesa->pClipRects[i].x2, mmesa->pClipRects[i].y2); fprintf(stderr, "mmesa->draw_buffer: %d\n", mmesa->draw_buffer); - fprintf(stderr, "drawableTable[%d].stamp: %d\n", + fprintf(stderr, "drawableTable[%d].stamp: %d\n", driDrawable->index, driScreen->pSAREA->drawableTable[driDrawable->index].stamp); } @@ -203,14 +213,14 @@ static void printMmesaRects( mgaContextPtr mmesa ) void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) { __DRIdrawablePrivate *driDrawable = mmesa->driDrawable; - drm_mga_sarea_t *sarea = mmesa->sarea; + MGASAREAPrivPtr sarea = mmesa->sarea; /* fprintf(stderr, "%s\n", __FUNCTION__); */ - XMESA_VALIDATE_DRAWABLE_INFO(mmesa->display, - mmesa->driScreen, - driDrawable); - mmesa->dirty_cliprects = 0; + XMESA_VALIDATE_DRAWABLE_INFO(mmesa->display, + mmesa->driScreen, + driDrawable); + mmesa->dirty_cliprects = 0; if (mmesa->draw_buffer == MGA_FRONT) mgaXMesaSetFrontClipRects( mmesa ); @@ -221,9 +231,9 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) sarea->req_drawable = driDrawable->draw; sarea->req_draw_buffer = mmesa->draw_buffer; - + mgaUpdateClipping( mmesa->glCtx ); - + mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; } @@ -237,27 +247,27 @@ GLboolean mgaDDSetDrawBuffer(GLcontext *ctx, GLenum mode ) mmesa->Fallback &= ~MGA_FALLBACK_BUFFER; - if (mode == GL_FRONT_LEFT) + if (mode == GL_FRONT_LEFT) { mmesa->drawOffset = mmesa->mgaScreen->frontOffset; mmesa->readOffset = mmesa->mgaScreen->frontOffset; - mmesa->Setup[MGA_CTXREG_DSTORG] = mmesa->mgaScreen->frontOffset; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; mmesa->draw_buffer = MGA_FRONT; mgaXMesaSetFrontClipRects( mmesa ); return GL_TRUE; - } - else if (mode == GL_BACK_LEFT) + } + else if (mode == GL_BACK_LEFT) { mmesa->drawOffset = mmesa->mgaScreen->backOffset; mmesa->readOffset = mmesa->mgaScreen->backOffset; - mmesa->Setup[MGA_CTXREG_DSTORG] = mmesa->mgaScreen->backOffset; + mmesa->setup.dstorg = mmesa->mgaScreen->backOffset; mmesa->draw_buffer = MGA_BACK; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; mgaXMesaSetBackClipRects( mmesa ); return GL_TRUE; } - else + else { mmesa->Fallback |= MGA_FALLBACK_BUFFER; return GL_FALSE; @@ -269,12 +279,12 @@ void mgaDDSetReadBuffer(GLcontext *ctx, GLframebuffer *buffer, { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - if (mode == GL_FRONT_LEFT) + if (mode == GL_FRONT_LEFT) { mmesa->readOffset = mmesa->mgaScreen->frontOffset; mmesa->read_buffer = MGA_FRONT; - } - else + } + else { mmesa->readOffset = mmesa->mgaScreen->backOffset; mmesa->read_buffer = MGA_BACK; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h index 46ccae02f..124da2f26 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgacontext.h,v 1.2 2001/01/08 01:07:18 martin Exp $*/ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgacontext.h,v 1.3 2001/03/21 16:14:22 dawes Exp $*/ /* * GLX Hardware Device Driver for Matrox Millenium G200 * Copyright (C) 1999 Wittawat Yamwong @@ -16,9 +16,9 @@ * 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 - * WITTAWAT YAMWONG, 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 + * WITTAWAT YAMWONG, 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. * * @@ -34,13 +34,16 @@ #include "dri_mesaint.h" #include "dri_mesa.h" +#include "xf86drm.h" +#include "xf86drmMga.h" + #include "types.h" -#include "drm.h" #include "mm.h" -#include "mgavb.h" #include "mem.h" +#include "mgavb.h" +#include "mga_sarea.h" #define MGA_SET_FIELD(reg,mask,val) reg = ((reg) & (mask)) | ((val) & ~(mask)) #define MGA_FIELD(field,val) (((val) << (field ## _SHIFT)) & ~(field ## _MASK)) @@ -50,15 +53,17 @@ #define MGA_IS_G400(mmesa) (mmesa->mgaScreen->chipset == MGA_CARD_TYPE_G400) -/* SoftwareFallback - * - texture env GL_BLEND -- can be fixed +/* SoftwareFallback + * - texture env GL_BLEND -- can be fixed * - 1D and 3D textures * - incomplete textures + * - GL_DEPTH_FUNC == GL_NEVER not in h/w */ #define MGA_FALLBACK_TEXTURE 0x1 #define MGA_FALLBACK_BUFFER 0x2 #define MGA_FALLBACK_LOGICOP 0x4 #define MGA_FALLBACK_STENCIL 0x8 +#define MGA_FALLBACK_DEPTH 0x10 /* For mgaCtx->new_state. @@ -75,11 +80,11 @@ #define MGA_NEW_CONTEXT 0x200 -typedef void (*mga_interp_func)( GLfloat t, +typedef void (*mga_interp_func)( GLfloat t, GLfloat *result, const GLfloat *in, const GLfloat *out ); - + @@ -96,31 +101,32 @@ struct mga_screen_private_s; #define MGA_TEX_MAXLEVELS 5 -typedef struct mga_texture_object_s +typedef struct mga_texture_object_s { - struct mga_texture_object_s *next; - struct mga_texture_object_s *prev; - struct gl_texture_object *tObj; - struct mga_context_t *ctx; - PMemBlock MemBlock; - GLuint offsets[MGA_TEX_MAXLEVELS]; - int lastLevel; - GLuint dirty_images; - GLuint totalSize; - int texelBytes; - GLuint age; - int bound; - int heap; /* agp or card */ - int Setup[MGA_TEX_SETUP_SIZE]; + struct mga_texture_object_s *next; + struct mga_texture_object_s *prev; + struct gl_texture_object *tObj; + struct mga_context_t *ctx; + PMemBlock MemBlock; + GLuint offsets[MGA_TEX_MAXLEVELS]; + int lastLevel; + GLuint dirty_images; + GLuint totalSize; + int texelBytes; + GLuint age; + int bound; + int heap; /* agp or card */ + + mga_texture_regs_t setup; } mgaTextureObject_t; struct mga_context_t { GLcontext *glCtx; - GLuint lastStamp; /* fullscreen breaks dpriv->laststamp, + GLuint lastStamp; /* fullscreen breaks dpriv->laststamp, * need to shadow it here. */ - /* Bookkeeping for texturing + /* Bookkeeping for texturing */ int lastTexHeap; struct mga_texture_object_s TexObjList[MGA_NR_TEX_HEAPS]; @@ -137,16 +143,16 @@ struct mga_context_t { GLuint multitex; GLuint tmu_source[2]; GLuint tex_dest[2]; - + GLboolean default32BitTextures; - /* Manage fallbacks + /* Manage fallbacks */ GLuint IndirectTriangles; - int Fallback; + int Fallback; - /* Support for CVA and the fastpath + /* Support for CVA and the fastpath */ unsigned int setupdone; unsigned int setupindex; @@ -161,7 +167,7 @@ struct mga_context_t { unsigned int envcolor; - /* Shortcircuit some state changes + /* Shortcircuit some state changes */ points_func PointsFunc; line_func LineFunc; @@ -169,11 +175,13 @@ struct mga_context_t { quad_func QuadFunc; - /* Manage driver and hardware state + /* Manage driver and hardware state */ - GLuint new_state; + GLuint new_state; GLuint dirty; - GLuint Setup[MGA_CTX_SETUP_SIZE]; + + mga_context_regs_t setup; + GLuint warp_pipe; GLuint vertsize; GLuint MonoColor; @@ -181,32 +189,33 @@ struct mga_context_t { GLuint ClearDepth; GLuint poly_stipple; GLfloat depth_scale; - + GLuint depth_clear_mask; GLuint stencil_clear_mask; GLuint hw_stencil; + GLboolean canDoStipple; /* Dma buffers */ drmBufPtr vertex_dma_buffer; drmBufPtr iload_buffer; - + /* Drawable, cliprect and scissor information */ int dirty_cliprects; /* which sets of cliprects are uptodate? */ int draw_buffer; /* which buffer are we rendering to */ unsigned int drawOffset; /* draw buffer address in space */ - int read_buffer; - int readOffset; + int read_buffer; + int readOffset; int drawX, drawY; /* origin of drawable in draw buffer */ int lastX, lastY; /* detect DSTORG bug */ GLuint numClipRects; /* cliprects for the draw buffer */ XF86DRIClipRectPtr pClipRects; XF86DRIClipRectRec draw_rect; - drm_clip_rect_t scissor_rect; + XF86DRIClipRectRec scissor_rect; int scissor; - + XF86DRIClipRectRec tmp_boxes[2][MGA_NR_SAREA_CLIPRECTS]; @@ -214,9 +223,8 @@ struct mga_context_t { */ unsigned int texAge[MGA_NR_TEX_HEAPS];/* texture LRU age */ unsigned int dirtyAge; /* buffer age for synchronization */ - unsigned int lastSwap; /* throttling runaway apps */ - + GLuint primary_offset; /* Mirrors of some DRI state. */ @@ -227,8 +235,8 @@ struct mga_context_t { Display *display; __DRIdrawablePrivate *driDrawable; __DRIscreenPrivate *driScreen; - struct mga_screen_private_s *mgaScreen; - drm_mga_sarea_t *sarea; + struct mga_screen_private_s *mgaScreen; + MGASAREAPrivPtr sarea; /* New setupdma path @@ -264,7 +272,7 @@ struct mga_context_t { ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) -#define MGA_DEBUG 0 +#define MGA_DEBUG 0 #ifndef MGA_DEBUG extern int MGA_DEBUG; #endif @@ -277,7 +285,7 @@ extern int MGA_DEBUG; #define DEBUG_VERBOSE_2D 0x20 static __inline__ GLuint mgaPackColor(GLuint cpp, - GLubyte r, GLubyte g, + GLubyte r, GLubyte g, GLubyte b, GLubyte a) { switch (cpp) { @@ -304,11 +312,11 @@ typedef struct mga_context_t *mgaContextPtr; struct mga_elt_tab { void (*emit_unclipped_verts)( struct vertex_buffer *VB ); - void (*build_tri_verts)( mgaContextPtr mmesa, - struct vertex_buffer *VB, + void (*build_tri_verts)( mgaContextPtr mmesa, + struct vertex_buffer *VB, GLfloat *O, GLuint *elt ); - void (*interp)( GLfloat t, GLfloat *O, + void (*interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J ); void (*project_and_emit_verts)( mgaContextPtr mmesa, diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c index 93ecfdf28..8c4efa77d 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c @@ -15,15 +15,15 @@ * 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 - * WITTAWAT YAMWONG, 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 + * WITTAWAT YAMWONG, 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. * * * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.7 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.9 2001/04/01 13:59:59 tsi Exp $ */ @@ -47,6 +47,12 @@ #include "vb.h" #include "dd.h" +#if defined(USE_X86_ASM) || defined(USE_3DNOW_ASM) || defined(USE_KATMAI_ASM) +#include "X86/common_x86_asm.h" +#endif + +#define MGA_DATE "20010316" + /*************************************** @@ -57,15 +63,57 @@ static const GLubyte *mgaDDGetString( GLcontext *ctx, GLenum name ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); - switch (name) { + static char buffer[128]; + + switch ( name ) { case GL_VENDOR: - return (GLubyte *) "Precision Insight, Inc."; + return (GLubyte *) "VA Linux Systems Inc."; + case GL_RENDERER: - if (MGA_IS_G200(mmesa)) return (GLubyte *) "Mesa DRI G200 20000510"; - if (MGA_IS_G400(mmesa)) return (GLubyte *) "Mesa DRI G400 20000510"; - return (GLubyte *) "Mesa DRI MGA 20000510"; + sprintf( buffer, "Mesa DRI %s " MGA_DATE, + MGA_IS_G400(mmesa) ? "G400" : + MGA_IS_G200(mmesa) ? "G200" : "MGA" ); + + /* Append any AGP-specific information. + */ + switch ( mmesa->mgaScreen->agpMode ) { + case 1: + strncat( buffer, " AGP 1x", 7 ); + break; + case 2: + strncat( buffer, " AGP 2x", 7 ); + break; + case 4: + strncat( buffer, " AGP 4x", 7 ); + break; + } + + /* Append any CPU-specific information. + */ +#ifdef USE_X86_ASM + if ( gl_x86_cpu_features ) { + strncat( buffer, " x86", 4 ); + } +#endif +#ifdef USE_MMX_ASM + if ( cpu_has_mmx ) { + strncat( buffer, "/MMX", 4 ); + } +#endif +#ifdef USE_3DNOW_ASM + if ( cpu_has_3dnow ) { + strncat( buffer, "/3DNow!", 7 ); + } +#endif +#ifdef USE_KATMAI_ASM + if ( cpu_has_xmm ) { + strncat( buffer, "/SSE", 4 ); + } +#endif + return (GLubyte *)buffer; + default: - return 0; + return NULL; } } @@ -73,8 +121,8 @@ static const GLubyte *mgaDDGetString( GLcontext *ctx, GLenum name ) static GLint mgaGetParameteri(const GLcontext *ctx, GLint param) { switch (param) { - case DD_HAVE_HARDWARE_FOG: - return 1; + case DD_HAVE_HARDWARE_FOG: + return 1; default: fprintf(stderr, "mgaGetParameteri(): unknown parameter!\n"); return 0; @@ -84,16 +132,16 @@ static GLint mgaGetParameteri(const GLcontext *ctx, GLint param) static void mgaBufferSize(GLcontext *ctx, GLuint *width, GLuint *height) { - mgaContextPtr mmesa = MGA_CONTEXT(ctx); + mgaContextPtr mmesa = MGA_CONTEXT(ctx); /* Need to lock to make sure the driDrawable is uptodate. This * information is used to resize Mesa's software buffers, so it has * to be correct. */ - LOCK_HARDWARE( mmesa ); + LOCK_HARDWARE( mmesa ); *width = mmesa->driDrawable->w; *height = mmesa->driDrawable->h; - UNLOCK_HARDWARE( mmesa ); + UNLOCK_HARDWARE( mmesa ); } void mgaDDExtensionsInit( GLcontext *ctx ) @@ -104,7 +152,7 @@ void mgaDDExtensionsInit( GLcontext *ctx ) /* Support multitexture only on the g400. */ - if (!MGA_IS_G400(MGA_CONTEXT(ctx))) + if (!MGA_IS_G400(MGA_CONTEXT(ctx))) { gl_extensions_disable( ctx, "GL_ARB_multitexture" ); } @@ -114,10 +162,13 @@ void mgaDDExtensionsInit( GLcontext *ctx ) if (MGA_IS_G400(MGA_CONTEXT(ctx))) { gl_extensions_enable( ctx, "GL_EXT_texture_env_add" ); + +#if defined (MESA_packed_depth_stencil) gl_extensions_enable( ctx, "GL_MESA_packed_depth_stencil" ); +#endif #if defined (MESA_experimetal_agp_allocator) - if (!getenv("MGA_DISABLE_AGP_ALLOCATOR")) + if (!getenv("MGA_DISABLE_AGP_ALLOCATOR")) gl_extensions_enable( ctx, "GL_MESA_experimental_agp_allocator" ); #endif } @@ -125,7 +176,7 @@ void mgaDDExtensionsInit( GLcontext *ctx ) /* we don't support point parameters in hardware yet */ gl_extensions_disable( ctx, "GL_EXT_point_parameters" ); - /* No support for fancy imaging stuff. This should kill off + /* No support for fancy imaging stuff. This should kill off * a few rogue fallbacks. */ gl_extensions_disable( ctx, "ARB_imaging" ); @@ -133,16 +184,16 @@ void mgaDDExtensionsInit( GLcontext *ctx ) gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); - gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); - gl_extensions_disable( ctx, "GL_EXT_texture_lod_bias" ); - gl_extensions_disable( ctx, "GL_MESA_resize_buffers" ); - - gl_extensions_disable( ctx, "GL_SGI_color_matrix" ); - gl_extensions_disable( ctx, "GL_SGI_color_table" ); - gl_extensions_disable( ctx, "GL_SGIX_pixel_texture" ); - gl_extensions_disable( ctx, "GL_ARB_texture_cube_map" ); - gl_extensions_disable( ctx, "GL_ARB_texture_compression" ); - gl_extensions_disable( ctx, "GL_EXT_convolution" ); + gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); + gl_extensions_disable( ctx, "GL_EXT_texture_lod_bias" ); + gl_extensions_disable( ctx, "GL_MESA_resize_buffers" ); + + gl_extensions_disable( ctx, "GL_SGI_color_matrix" ); + gl_extensions_disable( ctx, "GL_SGI_color_table" ); + gl_extensions_disable( ctx, "GL_SGIX_pixel_texture" ); + gl_extensions_disable( ctx, "GL_ARB_texture_cube_map" ); + gl_extensions_disable( ctx, "GL_ARB_texture_compression" ); + gl_extensions_disable( ctx, "GL_EXT_convolution" ); } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c b/xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c index 8d09236d6..50eb1a64e 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c @@ -15,13 +15,13 @@ * 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 + * 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/lib/GL/mesa/src/drv/mga/mgaeltpath.c,v 1.5 2000/09/26 15:56:47 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c,v 1.6 2001/03/21 16:14:22 dawes Exp $ */ #include <stdio.h> @@ -42,8 +42,8 @@ /* Always use a full-sized stride for vertices. [FIXME] * Stride in the buffers must be a quadword multiple. */ -#define BUFFER_STRIDE 12 -#define CLIP_STRIDE 10 +#define BUFFER_STRIDE 12 +#define CLIP_STRIDE 10 static void fire_elts( mgaContextPtr mmesa ) @@ -57,32 +57,32 @@ static void fire_elts( mgaContextPtr mmesa ) GLuint retain = (mmesa->elt_buf == mmesa->retained_buf); if (mmesa->first_elt != mmesa->next_elt) { - mgaFireEltsLocked( mmesa, - ((char *)mmesa->first_elt - + mgaFireEltsLocked( mmesa, + ((char *)mmesa->first_elt - (char *)mmesa->elt_buf->address), - ((char *)mmesa->next_elt - + ((char *)mmesa->next_elt - (char *)mmesa->elt_buf->address), !retain ); - } else if (!retain) + } else if (!retain) mgaReleaseBufLocked( mmesa, mmesa->elt_buf ); - + mmesa->elt_buf = 0; - } - else if (mmesa->vertex_dma_buffer) + } + else if (mmesa->vertex_dma_buffer) { mgaFlushVerticesLocked( mmesa ); } mgaGetEltBufLocked( mmesa ); - + UNLOCK_HARDWARE( mmesa ); - mmesa->next_vert = (GLfloat *)((char *)mmesa->elt_buf->address + - mmesa->elt_buf->total - + mmesa->next_vert = (GLfloat *)((char *)mmesa->elt_buf->address + + mmesa->elt_buf->total - BUFFER_STRIDE * sizeof(GLfloat)); - mmesa->next_vert_phys = (mmesa->mgaScreen->dmaOffset + - mmesa->elt_buf->idx * MGA_DMA_BUF_SZ + + mmesa->next_vert_phys = (mmesa->mgaScreen->dmaOffset + + mmesa->elt_buf->idx * MGA_BUFFER_SIZE + mmesa->elt_buf->total - BUFFER_STRIDE * sizeof(GLfloat)); @@ -94,14 +94,14 @@ static void fire_elts( mgaContextPtr mmesa ) static void release_bufs( mgaContextPtr mmesa ) { - if (mmesa->retained_buf && mmesa->retained_buf != mmesa->elt_buf) + if (mmesa->retained_buf && mmesa->retained_buf != mmesa->elt_buf) { LOCK_HARDWARE( mmesa ); if (mmesa->first_elt != mmesa->next_elt) { - mgaFireEltsLocked( mmesa, - ((char *)mmesa->first_elt - + mgaFireEltsLocked( mmesa, + ((char *)mmesa->first_elt - (char *)mmesa->elt_buf->address), - ((char *)mmesa->next_elt - + ((char *)mmesa->next_elt - (char *)mmesa->elt_buf->address), 0 ); @@ -200,7 +200,7 @@ static void mga_tri_clip( mgaContextPtr mmesa, CLIP(-,1,CLIP_TOP_BIT); CLIP(+,1,CLIP_BOTTOM_BIT); CLIP(-,2,CLIP_FAR_BIT); - CLIP(+,2,CLIP_NEAR_BIT); + CLIP(+,2,CLIP_NEAR_BIT); { @@ -208,15 +208,15 @@ static void mga_tri_clip( mgaContextPtr mmesa, GLuint space = (char *)mmesa->next_vert - (char *)mmesa->next_elt; if (space < n * (BUFFER_STRIDE + 3) * sizeof(GLuint)) - fire_elts(mmesa); + fire_elts(mmesa); /* Project the new vertices and emit to dma buffers. Translate - * out values to physical addresses for setup dma. + * out values to physical addresses for setup dma. */ tab->project_and_emit_verts( mmesa, (GLfloat *)verts, out, n ); - + /* Convert the planar polygon to a list of triangles and emit to - * elt buffers. + * elt buffers. */ for (i = 2 ; i < n ; i++) { mmesa->next_elt[0] = out[0]; @@ -275,8 +275,8 @@ do { \ -#define RENDER_POINTS(start, count) -#define RENDER_LINE(i1, i0) +#define RENDER_POINTS(start, count) +#define RENDER_LINE(i1, i0) #define RENDER_TRI(i2, i1, i0, pv, parity) \ do { \ GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ @@ -298,8 +298,8 @@ do { \ GLuint *elt = VB->EltPtr->data; \ (void) elt; (void) mmesa; -#define RENDER_POINTS(start, count) -#define RENDER_LINE(i1, i0) +#define RENDER_POINTS(start, count) +#define RENDER_LINE(i1, i0) #define RENDER_TRI(i2, i1, i0, pv, parity) \ do { \ GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ @@ -333,10 +333,10 @@ static void refresh_projection_matrix( GLcontext *ctx ) m[MAT_TZ] = mat->m[MAT_TZ] * mmesa->depth_scale; } -#define CLIP_UBYTE_B 0 -#define CLIP_UBYTE_G 1 +#define CLIP_UBYTE_B 0 +#define CLIP_UBYTE_G 1 #define CLIP_UBYTE_R 2 -#define CLIP_UBYTE_A 3 +#define CLIP_UBYTE_A 3 #define TYPE (0) @@ -389,26 +389,26 @@ void mgaDDEltPathInit( void ) /* Use a temporary array for device coordinates, so that we can easily * tap into existing mesa assembly. Otherwise consider emitting * device coordinates to dma buffers directly from the project/cliptest - * routine. (requires output stride, potential loss of writecombining - * efficiency?) + * routine. (requires output stride, potential loss of writecombining + * efficiency?) * * This path is a lot closer to the standard vertex path in the * initial stages than the original fastpath. A slightly more optimal * path could be constructed, but would require us to write new - * assembly. + * assembly. */ void mgaDDEltPath( struct vertex_buffer *VB ) { GLcontext *ctx = VB->ctx; GLenum prim = ctx->CVA.elt_mode; - mgaContextPtr mmesa = MGA_CONTEXT( ctx ); + mgaContextPtr mmesa = MGA_CONTEXT( ctx ); struct mga_elt_tab *tab = &mgaEltTab[mmesa->setupindex & VALID_SETUP]; VB->ClipPtr = TransformRaw(&VB->Clip, &ctx->ModelProjectMatrix, VB->ObjPtr ); refresh_projection_matrix( ctx ); - VB->ClipAndMask = ~0; + VB->ClipAndMask = ~0; VB->ClipOrMask = 0; VB->Projected = gl_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, &VB->Win, @@ -416,33 +416,33 @@ void mgaDDEltPath( struct vertex_buffer *VB ) &VB->ClipOrMask, &VB->ClipAndMask ); - if (VB->ClipAndMask) + if (VB->ClipAndMask) return; - if (mmesa->vertex_dma_buffer) + if (mmesa->vertex_dma_buffer) mgaFlushVertices( mmesa ); if (mmesa->new_state) mgaDDUpdateHwState( ctx ); /* Allocate a single buffer to hold unclipped vertices. All - * unclipped vertices must be contiguous. + * unclipped vertices must be contiguous. */ - if ((char *)mmesa->next_vert - (char *)mmesa->next_elt < - VB->Count * BUFFER_STRIDE * sizeof(GLuint)) + if ((char *)mmesa->next_vert - (char *)mmesa->next_elt < + VB->Count * BUFFER_STRIDE * sizeof(GLuint)) fire_elts( mmesa ); mmesa->retained_buf = mmesa->elt_buf; - + /* Emit unclipped vertices to the buffer. */ - tab->emit_unclipped_verts( VB ); - + tab->emit_unclipped_verts( VB ); + /* Emit indices and clipped vertices to one or more buffers. */ if (VB->ClipOrMask) { mmesa->elt_tab = tab; - mga_render_tab_elt[prim]( VB, 0, VB->EltPtr->count, 0 ); + mga_render_tab_elt[prim]( VB, 0, VB->EltPtr->count, 0 ); } else mga_render_tab_elt_unclipped[prim]( VB, 0, VB->EltPtr->count, 0 ); @@ -450,9 +450,8 @@ void mgaDDEltPath( struct vertex_buffer *VB ) */ release_bufs( mmesa ); - /* This indicates that there is no cached data to reuse. + /* This indicates that there is no cached data to reuse. */ VB->pipeline->data_valid = 0; VB->pipeline->new_state = 0; } - diff --git a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c index e953a739c..a1e9b04ce 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c @@ -15,13 +15,13 @@ * 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 + * 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/lib/GL/mesa/src/drv/mga/mgafastpath.c,v 1.6 2000/11/13 23:31:28 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgafastpath.c,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ #include <stdio.h> @@ -41,7 +41,7 @@ extern void mgaDDResizeVB( struct vertex_buffer *VB, GLuint size ); extern void gl_fast_copy_vb( struct vertex_buffer *VB ); - + struct mga_fast_tab { void (*build_vertices)( struct vertex_buffer *VB, GLuint do_cliptest ); void (*interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J ); @@ -112,7 +112,7 @@ static void mga_render_elements_direct( struct vertex_buffer *VB ) GLuint nr = VB->EltPtr->count; render_func func = render_tab_mga_smooth_indirect[prim]; GLuint p = 0; - + if (mmesa->new_state) mgaDDUpdateHwState( ctx ); @@ -247,7 +247,7 @@ static __inline void mga_tri_clip( GLuint **p_elts, /* Convert the planar polygon to a list of triangles. */ out = inlist[in]; - + for (i = 2 ; i < n ; i++) { elts[0] = out[0]; elts[1] = out[i-1]; @@ -287,7 +287,7 @@ static __inline void mga_line_clip( GLuint **p_elts, #define CLIP_POINT( e ) \ if (mask[e]) \ - *out++ = e + *out++ = e #define CLIP_LINE( e1, e0 ) \ do { \ @@ -342,7 +342,7 @@ do { \ #define POSTFIX \ MGA_DRIVER_DATA(VB)->clipped_elements.count = \ out - MGA_DRIVER_DATA(VB)->clipped_elements.data; \ - MGA_DRIVER_DATA(VB)->last_vert = next_vert; + MGA_DRIVER_DATA(VB)->last_vert = next_vert; #define INIT(x) @@ -424,10 +424,10 @@ static void mga_project_clipped_vertices( struct vertex_buffer *VB ) /* Pack rgba and/or texture into the remaining half of a 32 byte vertex. */ #define CLIP_UBYTE_COLOR 4 -#define CLIP_UBYTE_B 0 -#define CLIP_UBYTE_G 1 +#define CLIP_UBYTE_B 0 +#define CLIP_UBYTE_G 1 #define CLIP_UBYTE_R 2 -#define CLIP_UBYTE_A 3 +#define CLIP_UBYTE_A 3 #define CLIP_S0 6 #define CLIP_T0 7 #define CLIP_S1 8 @@ -478,12 +478,11 @@ void mgaDDFastPathInit( void ) #define VALID_SETUP (MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT) - void mgaDDFastPath( struct vertex_buffer *VB ) { GLcontext *ctx = VB->ctx; GLenum prim = ctx->CVA.elt_mode; - mgaContextPtr mmesa = MGA_CONTEXT( ctx ); + mgaContextPtr mmesa = MGA_CONTEXT( ctx ); struct mga_fast_tab *tab = &mgaFastTab[mmesa->setupindex & VALID_SETUP]; GLuint do_cliptest = 1; @@ -491,11 +490,11 @@ void mgaDDFastPath( struct vertex_buffer *VB ) gl_prepare_arrays_cva( VB ); /* still need this */ #if 1 - if (gl_reduce_prim[prim] == GL_TRIANGLES && - VB->Count < (MGA_DMA_BUF_SZ / 48) && + if (gl_reduce_prim[prim] == GL_TRIANGLES && + VB->Count < (MGA_BUFFER_SIZE / 48) && (ctx->ModelProjectMatrix.flags & (MAT_FLAG_GENERAL| MAT_FLAG_PERSPECTIVE)) && - mmesa->mgaScreen->chipset == MGA_CARD_TYPE_G400) + mmesa->mgaScreen->chipset == MGA_CARD_TYPE_G400) { mgaDDEltPath( VB ); return; @@ -517,9 +516,9 @@ void mgaDDFastPath( struct vertex_buffer *VB ) if (VB->ClipOrMask) { if (!VB->ClipAndMask) { render_func *clip = mga_clip_render_tab_elt; - + mmesa->interp = tab->interp; - + clip[prim]( VB, 0, VB->EltPtr->count, 0 ); /* build new elts */ ctx->CVA.elt_mode = gl_reduce_prim[prim]; @@ -533,9 +532,8 @@ void mgaDDFastPath( struct vertex_buffer *VB ) mga_render_elements_direct( VB ); /* render using orig list */ } - /* This indicates that there is no cached data to reuse. + /* This indicates that there is no cached data to reuse. */ VB->pipeline->data_valid = 0; VB->pipeline->new_state = 0; } - diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c index 46ff452b1..719595449 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.c,v 1.9 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.c,v 1.10 2001/03/21 16:14:22 dawes Exp $ */ #include <stdio.h> @@ -20,67 +20,29 @@ #include <sys/ioctl.h> static void mga_iload_dma_ioctl(mgaContextPtr mmesa, - unsigned long dest, + unsigned long dest, int length) { - int retcode; - drm_mga_iload_t iload; drmBufPtr buf = mmesa->iload_buffer; - - iload.idx = buf->idx; - iload.destOrg = dest; - iload.length = length; + int ret; - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) + if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "DRM_IOCTL_MGA_ILOAD idx %d dst %x length %d\n", - iload.idx, iload.destOrg, iload.length); - - - if ((retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_ILOAD, &iload))) { - printf("send iload retcode = %d\n", retcode); + buf->idx, (int) dest, length); + + ret = drmMGATextureLoad( mmesa->driFd, buf->idx, dest, length ); + if ( ret < 0 ) { + printf("send iload retcode = %d\n", ret); exit(1); } mmesa->iload_buffer = 0; - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) + if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "finished iload dma put\n"); } -int mgaUpdateLock( mgaContextPtr mmesa, drmLockFlags flags ) -{ - drm_lock_t lock; - int retcode; - - lock.flags = 0; - - if (mmesa->sarea->last_quiescent != mmesa->sarea->last_enqueue && - flags & DRM_LOCK_QUIESCENT) { - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) - fprintf(stderr, "mgaLockQuiescent\n"); - lock.flags |= _DRM_LOCK_QUIESCENT; - } - - if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH; - if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL; - - if (!lock.flags) - return 0; - - retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_FLUSH, &lock); - if(retcode != 0) { - fprintf(stderr, "Lockupdate failed\n"); - if(retcode == EACCES) exit(1); - else return -1; - } - - if(flags & DRM_LOCK_QUIESCENT) - mmesa->sarea->last_quiescent = mmesa->sarea->last_enqueue; - - return 0; -} - drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) { int idx = 0; @@ -88,17 +50,17 @@ drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) drmDMAReq dma; int retcode; drmBufPtr buf; - + if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "Getting dma buffer\n"); - + dma.context = mmesa->hHWContext; dma.send_count = 0; dma.send_list = NULL; dma.send_sizes = NULL; dma.flags = 0; dma.request_count = 1; - dma.request_size = MGA_DMA_BUF_SZ; + dma.request_size = MGA_BUFFER_SIZE; dma.request_list = &idx; dma.request_sizes = &size; dma.granted_count = 0; @@ -106,34 +68,35 @@ drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "drmDMA (get) ctx %d count %d size 0x%x\n", - dma.context, dma.request_count, + dma.context, dma.request_count, dma.request_size); while (1) { retcode = drmDMA(mmesa->driFd, &dma); if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) - fprintf(stderr, "retcode %d sz %d idx %d count %d\n", + fprintf(stderr, "retcode %d sz %d idx %d count %d\n", retcode, dma.request_sizes[0], dma.request_list[0], dma.granted_count); - if (retcode == 0 && + if (retcode == 0 && dma.request_sizes[0] && - dma.granted_count) + dma.granted_count) break; - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) + if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "\n\nflush"); - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH ); + + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); } buf = &(mmesa->mgaScreen->bufs->list[idx]); buf->used = 0; if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) - fprintf(stderr, + fprintf(stderr, "drmDMA (get) returns size[0] 0x%x idx[0] %d\n" "dma_buffer now: buf idx: %d size: %d used: %d addr %p\n", dma.request_sizes[0], dma.request_list[0], @@ -149,73 +112,71 @@ drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) -GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all, - GLint cx, GLint cy, GLint cw, GLint ch ) +static GLbitfield +mgaDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all, + GLint cx, GLint cy, GLint cw, GLint ch ) { - mgaContextPtr mmesa = MGA_CONTEXT( ctx ); + mgaContextPtr mmesa = MGA_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = mmesa->driDrawable; - drm_mga_clear_t clear; - int retcode; + GLuint flags = 0; + GLuint clear_color = mmesa->ClearColor; + GLuint clear_depth = 0; + GLuint color_mask = 0; + GLuint depth_mask = 0; + int ret; int i; static int nrclears; - clear.flags = 0; - clear.clear_color = mmesa->ClearColor; - clear.clear_depth = 0; - clear.clear_depth_mask = 0; - FLUSH_BATCH( mmesa ); - - if (mask & DD_FRONT_LEFT_BIT) { - clear.flags |= MGA_FRONT; - clear.clear_color_mask = mmesa->Setup[MGA_CTXREG_PLNWT]; + + if ( mask & DD_FRONT_LEFT_BIT ) { + flags |= MGA_FRONT; + color_mask = mmesa->setup.plnwt; mask &= ~DD_FRONT_LEFT_BIT; } - if (mask & DD_BACK_LEFT_BIT) { - clear.flags |= MGA_BACK; - clear.clear_color_mask = mmesa->Setup[MGA_CTXREG_PLNWT]; + if ( mask & DD_BACK_LEFT_BIT ) { + flags |= MGA_BACK; + color_mask = mmesa->setup.plnwt; mask &= ~DD_BACK_LEFT_BIT; } - if ((mask & DD_DEPTH_BIT) && ctx->Depth.Mask) { - clear.flags |= MGA_DEPTH; - clear.clear_depth_mask |= mmesa->depth_clear_mask; - clear.clear_depth = (mmesa->ClearDepth & - mmesa->depth_clear_mask); + if ( (mask & DD_DEPTH_BIT) && ctx->Depth.Mask ) { + flags |= MGA_DEPTH; + clear_depth = (mmesa->ClearDepth & mmesa->depth_clear_mask); + depth_mask |= mmesa->depth_clear_mask; mask &= ~DD_DEPTH_BIT; } - if ((mask & DD_STENCIL_BIT) && mmesa->hw_stencil) { - clear.flags |= MGA_DEPTH; - clear.clear_depth_mask |= mmesa->stencil_clear_mask; - clear.clear_depth |= (ctx->Stencil.Clear & - mmesa->stencil_clear_mask); + if ( (mask & DD_STENCIL_BIT) && mmesa->hw_stencil ) { + flags |= MGA_DEPTH; + clear_depth |= (ctx->Stencil.Clear & mmesa->stencil_clear_mask); + depth_mask |= mmesa->stencil_clear_mask; mask &= ~DD_STENCIL_BIT; } - if (!clear.flags) + if ( !flags ) return mask; LOCK_HARDWARE( mmesa ); - if (mmesa->dirty_cliprects) - mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK)); + if ( mmesa->dirty_cliprects ) + mgaUpdateRects( mmesa, (MGA_FRONT | MGA_BACK) ); /* flip top to bottom */ cy = dPriv->h-cy-ch; cx += mmesa->drawX; cy += mmesa->drawY; - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) - fprintf(stderr, "Clear, bufs %x nbox %d\n", - (int)clear.flags, (int)mmesa->numClipRects); + if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL ) + fprintf( stderr, "Clear, bufs %x nbox %d\n", + (int)flags, (int)mmesa->numClipRects ); - for (i = 0 ; i < mmesa->numClipRects ; ) - { + for (i = 0 ; i < mmesa->numClipRects ; ) + { int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, mmesa->numClipRects); - XF86DRIClipRectRec *box = mmesa->pClipRects; - drm_clip_rect_t *b = mmesa->sarea->boxes; + XF86DRIClipRectPtr box = mmesa->pClipRects; + XF86DRIClipRectPtr b = mmesa->sarea->boxes; int n = 0; if (!all) { @@ -225,7 +186,7 @@ GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint w = box[i].x2 - x; GLint h = box[i].y2 - y; - if (x < cx) w -= cx - x, x = cx; + if (x < cx) w -= cx - x, x = cx; if (y < cy) h -= cy - y, y = cy; if (x + w > cx + cw) w = cx + cw - x; if (y + h > cy + ch) h = cy + ch - y; @@ -241,28 +202,28 @@ GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all, } } else { for ( ; i < nr ; i++) { - *b++ = *(drm_clip_rect_t *)&box[i]; + *b++ = *(XF86DRIClipRectPtr)&box[i]; n++; } } - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) - fprintf(stderr, - "DRM_IOCTL_MGA_CLEAR flag 0x%x color %x depth %x nbox %d\n", - clear.flags, clear.clear_color, - clear.clear_depth, mmesa->sarea->nbox); - + if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL ) + fprintf( stderr, + "DRM_IOCTL_MGA_CLEAR flag 0x%x color %x depth %x nbox %d\n", + flags, clear_color, clear_depth, mmesa->sarea->nbox ); mmesa->sarea->nbox = n; - retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_CLEAR, &clear); - if (retcode) { - printf("send clear retcode = %d\n", retcode); - exit(1); + ret = drmMGAClear( mmesa->driFd, flags, + clear_color, clear_depth, + color_mask, depth_mask ); + if ( ret ) { + fprintf( stderr, "send clear retcode = %d\n", ret ); + exit( 1 ); } - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) - fprintf(stderr, "finished clear %d\n", ++nrclears); + if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL ) + fprintf( stderr, "finished clear %d\n", ++nrclears ); } UNLOCK_HARDWARE( mmesa ); @@ -277,28 +238,54 @@ int nrswaps; /* - * Copy the back buffer to the front buffer. + * Copy the back buffer to the front buffer. */ -void mgaSwapBuffers( mgaContextPtr mmesa ) +void mgaSwapBuffers( mgaContextPtr mmesa ) { __DRIdrawablePrivate *dPriv = mmesa->driDrawable; XF86DRIClipRectPtr pbox; - int nbox; - drm_mga_swap_t swap; - int retcode; - int i; - int tmp; - + GLint nbox; + GLint ret, wait = 0; + GLint i; + GLuint last_frame, last_wrap; FLUSH_BATCH( mmesa ); LOCK_HARDWARE( mmesa ); - + + last_frame = mmesa->sarea->last_frame.head; + last_wrap = mmesa->sarea->last_frame.wrap; + + /* FIXME: Add a timeout to this loop... + */ + while ( 1 ) { + if ( last_wrap < mmesa->sarea->last_wrap || + ( last_wrap == mmesa->sarea->last_wrap && + last_frame <= (MGA_READ( MGAREG_PRIMADDRESS ) - + mmesa->primary_offset) ) ) { + break; + } + if ( 0 ) { + wait++; + fprintf( stderr, " last: head=0x%06x wrap=%d\n", + last_frame, last_wrap ); + fprintf( stderr, " head: head=0x%06x wrap=%d\n", + MGA_READ( MGAREG_PRIMADDRESS ) - mmesa->primary_offset, + mmesa->sarea->last_wrap ); + } + + for ( i = 0 ; i < 1024 ; i++ ) { + /* Don't just hammer the register... */ + } + } + if ( wait ) + fprintf( stderr, "\n" ); + /* Use the frontbuffer cliprects */ - if (mmesa->dirty_cliprects & MGA_FRONT) + if (mmesa->dirty_cliprects & MGA_FRONT) mgaUpdateRects( mmesa, MGA_FRONT ); - + pbox = dPriv->pClipRects; nbox = dPriv->numClipRects; @@ -306,83 +293,80 @@ void mgaSwapBuffers( mgaContextPtr mmesa ) for (i = 0 ; i < nbox ; ) { int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects); - XF86DRIClipRectRec *b = (XF86DRIClipRectRec *)mmesa->sarea->boxes; + XF86DRIClipRectPtr b = mmesa->sarea->boxes; mmesa->sarea->nbox = nr - i; - - for ( ; i < nr ; i++) + + for ( ; i < nr ; i++) *b++ = pbox[i]; - - if((retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_SWAP, &swap))) { - printf("send swap retcode = %d\n", retcode); - UNLOCK_HARDWARE( mmesa ); + + if (0) + fprintf(stderr, "DRM_IOCTL_MGA_SWAP\n"); + + ret = drmMGASwapBuffers( mmesa->driFd ); + if ( ret ) { + printf("send swap retcode = %d\n", ret); exit(1); } } - tmp = GET_ENQUEUE_AGE(mmesa); - UNLOCK_HARDWARE( mmesa ); - if (GET_DISPATCH_AGE(mmesa) < mmesa->lastSwap) - mgaWaitAge(mmesa, mmesa->lastSwap); - - mmesa->lastSwap = tmp; mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; } /* This is overkill */ -void mgaDDFinish( GLcontext *ctx ) +void mgaDDFinish( GLcontext *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); FLUSH_BATCH( mmesa ); - if (mmesa->sarea->last_quiescent != mmesa->sarea->last_enqueue) { + if (1/*mmesa->sarea->last_quiescent != mmesa->sarea->last_enqueue*/) { if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "mgaRegetLockQuiescent\n"); LOCK_HARDWARE( mmesa ); - mgaUpdateLock( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH); + UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); UNLOCK_HARDWARE( mmesa ); mmesa->sarea->last_quiescent = mmesa->sarea->last_enqueue; } } -void mgaWaitAgeLocked( mgaContextPtr mmesa, int age ) +void mgaWaitAgeLocked( mgaContextPtr mmesa, int age ) { if (GET_DISPATCH_AGE(mmesa) < age) { - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH ); } } -void mgaWaitAge( mgaContextPtr mmesa, int age ) +void mgaWaitAge( mgaContextPtr mmesa, int age ) { if (GET_DISPATCH_AGE(mmesa) < age) { LOCK_HARDWARE(mmesa); if (GET_DISPATCH_AGE(mmesa) < age) { - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH ); } UNLOCK_HARDWARE(mmesa); } } -static int intersect_rect( drm_clip_rect_t *out, - drm_clip_rect_t *a, - drm_clip_rect_t *b ) +static int intersect_rect( XF86DRIClipRectPtr out, + XF86DRIClipRectPtr a, + XF86DRIClipRectPtr b ) { *out = *a; if (b->x1 > out->x1) out->x1 = b->x1; if (b->y1 > out->y1) out->y1 = b->y1; if (b->x2 < out->x2) out->x2 = b->x2; if (b->y2 < out->y2) out->y2 = b->y2; - if (out->x1 >= out->x2) return 0; - if (out->y1 >= out->y2) return 0; + if (out->x1 > out->x2) return 0; + if (out->y1 > out->y2) return 0; return 1; } @@ -397,10 +381,9 @@ static void age_mmesa( mgaContextPtr mmesa, int age ) void mgaFlushVerticesLocked( mgaContextPtr mmesa ) { - drm_clip_rect_t *pbox = (drm_clip_rect_t *)mmesa->pClipRects; + XF86DRIClipRectPtr pbox = mmesa->pClipRects; int nbox = mmesa->numClipRects; drmBufPtr buffer = mmesa->vertex_dma_buffer; - drm_mga_vertex_t vertex; int i; mmesa->vertex_dma_buffer = 0; @@ -411,76 +394,73 @@ void mgaFlushVerticesLocked( mgaContextPtr mmesa ) if (mmesa->dirty_cliprects & mmesa->draw_buffer) mgaUpdateRects( mmesa, mmesa->draw_buffer ); - if (mmesa->dirty & ~MGA_UPLOAD_CLIPRECTS) + if (mmesa->dirty & ~MGA_UPLOAD_CLIPRECTS) mgaEmitHwStateLocked( mmesa ); /* FIXME: Workaround bug in kernel module. */ - mmesa->sarea->dirty |= MGA_UPLOAD_CTX; - - vertex.idx = buffer->idx; - vertex.used = buffer->used; - vertex.discard = 0; + mmesa->sarea->dirty |= MGA_UPLOAD_CONTEXT; if (!nbox) - vertex.used = 0; + buffer->used = 0; if (nbox >= MGA_NR_SAREA_CLIPRECTS) mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; #if 0 - if (!vertex.used || !(mmesa->dirty & MGA_UPLOAD_CLIPRECTS)) + if (!buffer->used || !(mmesa->dirty & MGA_UPLOAD_CLIPRECTS)) { - if (nbox == 1) + if (nbox == 1) mmesa->sarea->nbox = 0; else mmesa->sarea->nbox = nbox; - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) + if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "Firing vertex -- case a nbox %d\n", nbox); - vertex.discard = 1; - ioctl(mmesa->driFd, DRM_IOCTL_MGA_VERTEX, &vertex); + drmMGAFlushVertexBuffer( mmesa->driFd, buffer->idx, buffer->used, 1 ); age_mmesa(mmesa, mmesa->sarea->last_enqueue); - } - else + } + else #endif - { + { for (i = 0 ; i < nbox ; ) { int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, nbox); - drm_clip_rect_t *b = mmesa->sarea->boxes; + XF86DRIClipRectPtr b = mmesa->sarea->boxes; + int discard = 0; if (mmesa->scissor) { - mmesa->sarea->nbox = 0; + mmesa->sarea->nbox = 0; - for ( ; i < nr ; i++) { + for ( ; i < nr ; i++) { *b = pbox[i]; if (intersect_rect(b, b, &mmesa->scissor_rect)) { mmesa->sarea->nbox++; b++; - } + } } /* Culled? */ if (!mmesa->sarea->nbox) { if (nr < nbox) continue; - vertex.used = 0; + buffer->used = 0; } } else { mmesa->sarea->nbox = nr - i; - for ( ; i < nr ; i++) + for ( ; i < nr ; i++) *b++ = pbox[i]; } /* Finished with the buffer? */ - if (nr == nbox) - vertex.discard = 1; + if (nr == nbox) + discard = 1; mmesa->sarea->dirty |= MGA_UPLOAD_CLIPRECTS; - ioctl(mmesa->driFd, DRM_IOCTL_MGA_VERTEX, &vertex); + drmMGAFlushVertexBuffer( mmesa->driFd, buffer->idx, + buffer->used, discard ); age_mmesa(mmesa, mmesa->sarea->last_enqueue); } } @@ -488,27 +468,27 @@ void mgaFlushVerticesLocked( mgaContextPtr mmesa ) mmesa->dirty &= ~MGA_UPLOAD_CLIPRECTS; } -void mgaFlushVertices( mgaContextPtr mmesa ) +void mgaFlushVertices( mgaContextPtr mmesa ) { LOCK_HARDWARE( mmesa ); mgaFlushVerticesLocked( mmesa ); UNLOCK_HARDWARE( mmesa ); } -void mgaFlushEltsLocked( mgaContextPtr mmesa ) +void mgaFlushEltsLocked( mgaContextPtr mmesa ) { if (mmesa->first_elt != mmesa->next_elt) { - mgaFireEltsLocked( mmesa, - ((char *)mmesa->first_elt - + mgaFireEltsLocked( mmesa, + ((char *)mmesa->first_elt - (char *)mmesa->elt_buf->address), - ((char *)mmesa->next_elt - + ((char *)mmesa->next_elt - (char *)mmesa->elt_buf->address), 0 ); mmesa->first_elt = mmesa->next_elt; } } -void mgaFlushElts( mgaContextPtr mmesa ) +void mgaFlushElts( mgaContextPtr mmesa ) { LOCK_HARDWARE( mmesa ); mgaFlushEltsLocked( mmesa ); @@ -524,12 +504,12 @@ GLuint *mgaAllocVertexDwords( mgaContextPtr mmesa, int dwords ) if (!mmesa->vertex_dma_buffer) { LOCK_HARDWARE( mmesa ); - if (mmesa->first_elt != mmesa->next_elt) + if (mmesa->first_elt != mmesa->next_elt) mgaFlushEltsLocked(mmesa); mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa ); UNLOCK_HARDWARE( mmesa ); - } else if (mmesa->vertex_dma_buffer->used + bytes > + } else if (mmesa->vertex_dma_buffer->used + bytes > mmesa->vertex_dma_buffer->total) { LOCK_HARDWARE( mmesa ); mgaFlushVerticesLocked( mmesa ); @@ -537,7 +517,7 @@ GLuint *mgaAllocVertexDwords( mgaContextPtr mmesa, int dwords ) UNLOCK_HARDWARE( mmesa ); } - head = (GLuint *)((char *)mmesa->vertex_dma_buffer->address + + head = (GLuint *)((char *)mmesa->vertex_dma_buffer->address + mmesa->vertex_dma_buffer->used); mmesa->vertex_dma_buffer->used += bytes; @@ -545,7 +525,7 @@ GLuint *mgaAllocVertexDwords( mgaContextPtr mmesa, int dwords ) } -void mgaFireILoadLocked( mgaContextPtr mmesa, +void mgaFireILoadLocked( mgaContextPtr mmesa, GLuint offset, GLuint length ) { if (!mmesa->iload_buffer) { @@ -556,10 +536,7 @@ void mgaFireILoadLocked( mgaContextPtr mmesa, if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "mgaFireILoad idx %d ofs 0x%x length %d\n", mmesa->iload_buffer->idx, (int)offset, (int)length ); - - /* HACK - */ - mgaUpdateLock( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH); + mga_iload_dma_ioctl( mmesa, offset, length ); } @@ -597,22 +574,21 @@ void mgaDDFlush( GLcontext *ctx ) */ if (1 || GET_DISPATCH_AGE( mmesa ) < mmesa->sarea->last_enqueue) { LOCK_HARDWARE( mmesa ); - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH ); UNLOCK_HARDWARE( mmesa ); } } -void mgaFireEltsLocked( mgaContextPtr mmesa, - GLuint start, +void mgaFireEltsLocked( mgaContextPtr mmesa, + GLuint start, GLuint end, GLuint discard ) { - drm_clip_rect_t *pbox = (drm_clip_rect_t *)mmesa->pClipRects; + XF86DRIClipRectPtr pbox = mmesa->pClipRects; int nbox = mmesa->numClipRects; drmBufPtr buffer = mmesa->elt_buf; - drm_mga_indices_t elts; int i; if (!buffer) @@ -621,74 +597,69 @@ void mgaFireEltsLocked( mgaContextPtr mmesa, if (mmesa->dirty_cliprects & mmesa->draw_buffer) mgaUpdateRects( mmesa, mmesa->draw_buffer ); - if (mmesa->dirty & ~MGA_UPLOAD_CLIPRECTS) + if (mmesa->dirty & ~MGA_UPLOAD_CLIPRECTS) mgaEmitHwStateLocked( mmesa ); /* FIXME: Workaround bug in kernel module. */ - mmesa->sarea->dirty |= MGA_UPLOAD_CTX; - - elts.idx = buffer->idx; - elts.start = start; - elts.end = end; - elts.discard = 0; + mmesa->sarea->dirty |= MGA_UPLOAD_CONTEXT; if (!nbox) - elts.end = start; + end = start; if (nbox >= MGA_NR_SAREA_CLIPRECTS) mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; - if (elts.end == start || !(mmesa->dirty & MGA_UPLOAD_CLIPRECTS)) + if ( end == start || !(mmesa->dirty & MGA_UPLOAD_CLIPRECTS)) { - if (nbox == 1) + if (nbox == 1) mmesa->sarea->nbox = 0; else mmesa->sarea->nbox = nbox; - elts.discard = discard; - ioctl(mmesa->driFd, DRM_IOCTL_MGA_INDICES, &elts); + drmMGAFlushIndices( mmesa->driFd, buffer->idx, start, end, discard ); age_mmesa(mmesa, mmesa->sarea->last_enqueue); - } - else - { + } + else + { for (i = 0 ; i < nbox ; ) { int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, nbox); - drm_clip_rect_t *b = mmesa->sarea->boxes; + XF86DRIClipRectPtr b = mmesa->sarea->boxes; + int d = 0; if (mmesa->scissor) { - mmesa->sarea->nbox = 0; + mmesa->sarea->nbox = 0; - for ( ; i < nr ; i++) { + for ( ; i < nr ; i++) { *b = pbox[i]; if (intersect_rect(b, b, &mmesa->scissor_rect)) { mmesa->sarea->nbox++; b++; - } + } } /* Culled? */ if (!mmesa->sarea->nbox) { if (nr < nbox) continue; - elts.end = start; + end = start; } } else { mmesa->sarea->nbox = nr - i; - for ( ; i < nr ; i++) + for ( ; i < nr ; i++) *b++ = pbox[i]; } /* Potentially finished with the buffer? */ - if (nr == nbox) - elts.discard = discard; + if (nr == nbox) + d = discard; mmesa->sarea->dirty |= MGA_UPLOAD_CLIPRECTS; - ioctl(mmesa->driFd, DRM_IOCTL_MGA_INDICES, &elts); + drmMGAFlushIndices( mmesa->driFd, buffer->idx, start, end, d ); age_mmesa(mmesa, mmesa->sarea->last_enqueue); } } @@ -699,20 +670,15 @@ void mgaFireEltsLocked( mgaContextPtr mmesa, void mgaReleaseBufLocked( mgaContextPtr mmesa, drmBufPtr buffer ) { - drm_mga_vertex_t vertex; - if (!buffer) return; - - vertex.idx = buffer->idx; - vertex.used = 0; - vertex.discard = 1; - ioctl(mmesa->driFd, DRM_IOCTL_MGA_VERTEX, &vertex); + + drmMGAFlushVertexBuffer( mmesa->driFd, buffer->idx, 0, 1 ); } void mgaDDInitIoctlFuncs( GLcontext *ctx ) { - ctx->Driver.Clear = mgaClear; - ctx->Driver.Flush = mgaDDFlush; - ctx->Driver.Finish = mgaDDFinish; + ctx->Driver.Clear = mgaDDClear; + ctx->Driver.Flush = mgaDDFlush; + ctx->Driver.Finish = mgaDDFinish; } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h index 72e1fe29b..bb3f4f45f 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.h,v 1.6 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.h,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ #ifndef MGA_IOCTL_H #define MGA_IOCTL_H @@ -7,10 +7,10 @@ #include "mga_xmesa.h" GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all, - GLint cx, GLint cy, GLint cw, GLint ch ); + GLint cx, GLint cy, GLint cw, GLint ch ); -void mgaSwapBuffers( mgaContextPtr mmesa ); +void mgaSwapBuffers( mgaContextPtr mmesa ); @@ -21,19 +21,18 @@ void mgaGetILoadBufferLocked( mgaContextPtr mmesa ); drmBufPtr mgaGetBufferLocked( mgaContextPtr mmesa ); -void mgaFireILoadLocked( mgaContextPtr mmesa, +void mgaFireILoadLocked( mgaContextPtr mmesa, GLuint offset, GLuint length ); void mgaWaitAgeLocked( mgaContextPtr mmesa, int age ); void mgaWaitAge( mgaContextPtr mmesa, int age ); -int mgaUpdateLock( mgaContextPtr mmesa, drmLockFlags flags ); -void mgaFlushVertices( mgaContextPtr mmesa ); +void mgaFlushVertices( mgaContextPtr mmesa ); void mgaFlushVerticesLocked( mgaContextPtr mmesa ); -void mgaFireEltsLocked( mgaContextPtr mmesa, - GLuint start, +void mgaFireEltsLocked( mgaContextPtr mmesa, + GLuint start, GLuint end, GLuint discard ); @@ -51,7 +50,7 @@ void mgaDDFlush( GLcontext *ctx ); void mgaDDFinish( GLcontext *ctx ); void mgaDDInitIoctlFuncs( GLcontext *ctx ); - + #define FLUSH_BATCH(mmesa) do { \ if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) \ fprintf(stderr, "FLUSH_BATCH in %s\n", __FUNCTION__); \ @@ -70,12 +69,12 @@ GLuint *mgaAllocVertexDwordsInline( mgaContextPtr mmesa, int dwords ) if (!mmesa->vertex_dma_buffer) { LOCK_HARDWARE( mmesa ); - if (mmesa->first_elt != mmesa->next_elt) + if (mmesa->first_elt != mmesa->next_elt) mgaFlushEltsLocked(mmesa); mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa ); UNLOCK_HARDWARE( mmesa ); - } else if (mmesa->vertex_dma_buffer->used + bytes > + } else if (mmesa->vertex_dma_buffer->used + bytes > mmesa->vertex_dma_buffer->total) { LOCK_HARDWARE( mmesa ); mgaFlushVerticesLocked( mmesa ); @@ -83,11 +82,24 @@ GLuint *mgaAllocVertexDwordsInline( mgaContextPtr mmesa, int dwords ) UNLOCK_HARDWARE( mmesa ); } - head = (GLuint *)((char *)mmesa->vertex_dma_buffer->address + + head = (GLuint *)((char *)mmesa->vertex_dma_buffer->address + mmesa->vertex_dma_buffer->used); mmesa->vertex_dma_buffer->used += bytes; return head; } + +#define UPDATE_LOCK( mmesa, flags ) \ +do { \ + GLint ret = drmMGAFlushDMA( mmesa->driFd, flags ); \ + if ( ret < 0 ) { \ + drmMGAEngineReset( mmesa->driFd ); \ + UNLOCK_HARDWARE( mmesa ); \ + fprintf( stderr, __FUNCTION__ ": flush ret=%d\n", ret ); \ + /*fprintf( stderr, "drmMGAFlushDMA: return = %d\n", ret );*/ \ + exit( 1 ); \ + } \ +} while (0) + #endif diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c index e28ead85b..d4732831c 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.c,v 1.1 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.c,v 1.2 2001/03/21 16:14:22 dawes Exp $ */ /************************************************************************** Copyright 2000 Compaq Computer Inc. and VA Linux, Inc. @@ -46,7 +46,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #if defined(MESA_packed_depth_stencil) -static GLboolean +static GLboolean check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, @@ -59,10 +59,10 @@ check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, ctx->Visual->StencilBits == 8 && mmesa->mgaScreen->cpp == 4 && mmesa->hw_stencil && - !ctx->Pixel.IndexShift && + !ctx->Pixel.IndexShift && !ctx->Pixel.IndexOffset && !ctx->Pixel.MapStencilFlag && - ctx->Pixel.DepthBias == 0.0 && + ctx->Pixel.DepthBias == 0.0 && ctx->Pixel.DepthScale == 1.0 && !packing->SwapBytes && pitch % 32 == 0 && @@ -72,19 +72,19 @@ check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, #endif -static GLboolean +static GLboolean check_depth( const GLcontext *ctx, GLenum type, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, GLint pitch ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - if (IS_AGP_MEM(mmesa, pixels) && + if (IS_AGP_MEM(mmesa, pixels) && !((type == GL_UNSIGNED_INT && mmesa->mgaScreen->cpp == 4) || (type == GL_UNSIGNED_SHORT && mmesa->mgaScreen->cpp == 2))) return GL_FALSE; - return (ctx->Pixel.DepthBias == 0.0 && + return (ctx->Pixel.DepthBias == 0.0 && ctx->Pixel.DepthScale == 1.0 && !packing->SwapBytes && pitch % 32 == 0 && @@ -93,7 +93,7 @@ check_depth( const GLcontext *ctx, GLenum type, static GLboolean -check_color( const GLcontext *ctx, GLenum type, GLenum format, +check_color( const GLcontext *ctx, GLenum type, GLenum format, const struct gl_pixelstore_attrib *packing, const void *pixels, GLint sz, GLint pitch ) { @@ -102,7 +102,7 @@ check_color( const GLcontext *ctx, GLenum type, GLenum format, /* Can't do conversions on agp reads/draws. */ - if (IS_AGP_MEM(mmesa, pixels) && + if (IS_AGP_MEM(mmesa, pixels) && !(pitch % 32 == 0 && pitch < 4096 && ((type == GL_UNSIGNED_BYTE && cpp == 4 && format == GL_BGRA) || @@ -110,25 +110,25 @@ check_color( const GLcontext *ctx, GLenum type, GLenum format, (type == GL_UNSIGNED_SHORT_5_6_5_REV && cpp==2 && format == GL_RGB)))) return GL_FALSE; - return - (ctx->ColorMatrix.type == MATRIX_IDENTITY && - !ctx->Pixel.ScaleOrBiasRGBA && - !ctx->Pixel.ScaleOrBiasRGBApcm && - !ctx->Pixel.MapColorFlag && - !ctx->Pixel.ColorTableEnabled && - !ctx->Pixel.PostColorMatrixColorTableEnabled && - !ctx->Pixel.MinMaxEnabled && - !ctx->Pixel.HistogramEnabled && - !packing->SwapBytes && + return + (ctx->ColorMatrix.type == MATRIX_IDENTITY && + !ctx->Pixel.ScaleOrBiasRGBA && + !ctx->Pixel.ScaleOrBiasRGBApcm && + !ctx->Pixel.MapColorFlag && + !ctx->Pixel.ColorTableEnabled && + !ctx->Pixel.PostColorMatrixColorTableEnabled && + !ctx->Pixel.MinMaxEnabled && + !ctx->Pixel.HistogramEnabled && + !packing->SwapBytes && !packing->LsbFirst); } static GLboolean check_color_per_fragment_ops( const GLcontext *ctx ) { - return (!(ctx->RasterMask & ~(SCISSOR_BIT|WINCLIP_BIT|MULTI_DRAW_BIT)) && + return (!(ctx->RasterMask & ~(SCISSOR_BIT|WINCLIP_BIT|MULTI_DRAW_BIT)) && ctx->Current.RasterPosValid && - ctx->Pixel.ZoomX == 1.0F && + ctx->Pixel.ZoomX == 1.0F && (ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F)); } @@ -140,7 +140,7 @@ check_depth_per_fragment_ops( const GLcontext *ctx ) ctx->Color.ColorMask[BCOMP] == 0 && ctx->Color.ColorMask[GCOMP] == 0 && ctx->Color.ColorMask[ACOMP] == 0 && - ctx->Pixel.ZoomX == 1.0F && + ctx->Pixel.ZoomX == 1.0F && (ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F)); } @@ -150,7 +150,7 @@ check_depth_per_fragment_ops( const GLcontext *ctx ) static GLboolean check_stencil_per_fragment_ops( const GLcontext *ctx ) { - return (!ctx->Pixel.IndexShift && + return (!ctx->Pixel.IndexShift && !ctx->Pixel.IndexOffset); } #endif @@ -198,14 +198,14 @@ clip_pixelrect( const GLcontext *ctx, *size = ((*y + *height - 1) * mmesa->mgaScreen->frontPitch + (*x + *width - 1) * mmesa->mgaScreen->cpp); - + return GL_TRUE; } -static GLboolean -mgaDDReadPixels( GLcontext *ctx, +static GLboolean +mgaDDReadPixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, + GLenum format, GLenum type, const struct gl_pixelstore_attrib *pack, GLvoid *pixels ) { @@ -215,7 +215,15 @@ mgaDDReadPixels( GLcontext *ctx, GLint pitch = pack->RowLength ? pack->RowLength : width; GLboolean ok; - if (!clip_pixelrect(ctx, ctx->ReadBuffer, + GLuint planemask; + GLuint source, dest; + GLint source_pitch, dest_pitch; + GLint delta_sx, delta_sy; + GLint delta_dx, delta_dy; + GLint blit_height, ydir; + + + if (!clip_pixelrect(ctx, ctx->ReadBuffer, &x, &y, &width, &height, &skipPixels, &skipRows, &size)) { return GL_TRUE; @@ -231,8 +239,8 @@ mgaDDReadPixels( GLcontext *ctx, #if defined(MESA_packed_depth_stencil) case GL_DEPTH_STENCIL_MESA: ok = check_depth_stencil_24_8(ctx, type, pack, pixels, size, pitch); - blit.planemask = ~0; - blit.source = mmesa->mgaScreen->depthOffset; + planemask = ~0; + source = mmesa->mgaScreen->depthOffset; break; #endif @@ -241,25 +249,25 @@ mgaDDReadPixels( GLcontext *ctx, /* Can't accelerate at this depth -- planemask does the wrong * thing; it doesn't clear the low order bits in the - * destination, instead it leaves them untouched. + * destination, instead it leaves them untouched. * * Could get the acclerator to solid fill the destination with * zeros first... Or get the cpu to do it... */ - if (ctx->Visual->DepthBits == 24) + if (ctx->Visual->DepthBits == 24) return GL_FALSE; - blit.planemask = ~0; - blit.source = mmesa->mgaScreen->depthOffset; + planemask = ~0; + source = mmesa->mgaScreen->depthOffset; break; case GL_RGB: case GL_BGRA: ok = check_color(ctx, type, format, pack, pixels, size, pitch); - blit.planemask = ~0; - blit.source = (mmesa->draw_buffer == MGA_FRONT ? - mmesa->mgaScreen->frontOffset : - mmesa->mgaScreen->backOffset); + planemask = ~0; + source = (mmesa->draw_buffer == MGA_FRONT ? + mmesa->mgaScreen->frontOffset : + mmesa->mgaScreen->backOffset); break; default: @@ -277,37 +285,37 @@ mgaDDReadPixels( GLcontext *ctx, __DRIdrawablePrivate *dPriv = mmesa->driDrawable; int nbox, retcode, i; - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); - if (mmesa->dirty_cliprects & MGA_FRONT) + if (mmesa->dirty_cliprects & MGA_FRONT) mgaUpdateRects( mmesa, MGA_FRONT ); - + nbox = dPriv->numClipRects; y = dPriv->h - y - height; x += mmesa->drawX; y += mmesa->drawY; - blit.dest = ((mmesa->mgaScreen->agp.handle + AGP_OFFSET(mmesa, pixels)) | - DO_dstmap_sys | DO_dstacc_agp); - blit.source_pitch = mmesa->mgaScreen->frontPitch / mmesa->mgaScreen->cpp; - blit.dest_pitch = pitch; - blit.delta_sx = 0; - blit.delta_sy = 0; - blit.delta_dx = -x; - blit.delta_dy = -y; - blit.height = 2*y + height; - blit.ydir = -1; - - if (0) fprintf(stderr, "XX doing readpixel blit src_pitch %d dst_pitch %d\n", - blit.source_pitch, blit.dest_pitch); + dest = ((mmesa->mgaScreen->agp.handle + AGP_OFFSET(mmesa, pixels)) | + DO_dstmap_sys | DO_dstacc_agp); + source_pitch = mmesa->mgaScreen->frontPitch / mmesa->mgaScreen->cpp; + dest_pitch = pitch; + delta_sx = 0; + delta_sy = 0; + delta_dx = -x; + delta_dy = -y; + blit_height = 2*y + height; + ydir = -1; + + if (0) fprintf(stderr, "XX doing readpixel blit src_pitch %d dst_pitch %d\n", + source_pitch, dest_pitch); for (i = 0 ; i < nbox ; ) { int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects); - XF86DRIClipRectRec *box = dPriv->pClipRects; + XF86DRIClipRectRec *box = dPriv->pClipRects; drm_clip_rect_t *b = mmesa->sarea->boxes; int n = 0; @@ -317,7 +325,7 @@ mgaDDReadPixels( GLcontext *ctx, GLint bw = box[i].x2 - bx; GLint bh = box[i].y2 - by; - if (bx < x) bw -= x - bx, bx = x; + if (bx < x) bw -= x - bx, bx = x; if (by < y) bh -= y - by, by = y; if (bx + bw > x + width) bw = x + width - bx; if (by + bh > y + height) bh = y + height - by; @@ -333,7 +341,7 @@ mgaDDReadPixels( GLcontext *ctx, } mmesa->sarea->nbox = n; - + if (n && (retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_BLIT, &blit))) { fprintf(stderr, "blit ioctl failed, retcode = %d\n", retcode); UNLOCK_HARDWARE( mmesa ); @@ -341,7 +349,7 @@ mgaDDReadPixels( GLcontext *ctx, } } - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); } UNLOCK_HARDWARE( mmesa ); @@ -358,7 +366,7 @@ static void do_draw_pix( GLcontext *ctx, GLuint dest, GLuint planemask) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - drm_mga_blit_t blit; + drm_mga_blit_t blit; __DRIdrawablePrivate *dPriv = mmesa->driDrawable; XF86DRIClipRectPtr pbox = dPriv->pClipRects; int nbox = dPriv->numClipRects; @@ -386,14 +394,14 @@ static void do_draw_pix( GLcontext *ctx, blit.ydir = -1; } - if (0) fprintf(stderr, - "doing drawpixel blit src_pitch %d dst_pitch %d\n", + if (0) fprintf(stderr, + "doing drawpixel blit src_pitch %d dst_pitch %d\n", blit.source_pitch, blit.dest_pitch); for (i = 0 ; i < nbox ; ) { int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects); - XF86DRIClipRectRec *box = mmesa->pClipRects; + XF86DRIClipRectRec *box = mmesa->pClipRects; drm_clip_rect_t *b = mmesa->sarea->boxes; int n = 0; @@ -403,7 +411,7 @@ static void do_draw_pix( GLcontext *ctx, GLint bw = box[i].x2 - bx; GLint bh = box[i].y2 - by; - if (bx < x) bw -= x - bx, bx = x; + if (bx < x) bw -= x - bx, bx = x; if (by < y) bh -= y - by, by = y; if (bx + bw > x + width) bw = x + width - bx; if (by + bh > y + height) bh = y + height - by; @@ -419,7 +427,7 @@ static void do_draw_pix( GLcontext *ctx, } mmesa->sarea->nbox = n; - + if (n && (retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_BLIT, &blit))) { fprintf(stderr, "blit ioctl failed, retcode = %d\n", retcode); UNLOCK_HARDWARE( mmesa ); @@ -432,7 +440,7 @@ static void do_draw_pix( GLcontext *ctx, static GLboolean -mgaDDDrawPixels( GLcontext *ctx, +mgaDDDrawPixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, @@ -444,13 +452,13 @@ mgaDDDrawPixels( GLcontext *ctx, GLuint dest, planemask; GLuint cpp = mmesa->mgaScreen->cpp; - if (!clip_pixelrect(ctx, ctx->DrawBuffer, + if (!clip_pixelrect(ctx, ctx->DrawBuffer, &x, &y, &width, &height, &skipPixels, &skipRows, &size)) { return GL_TRUE; } - + switch (format) { #if defined(MESA_packed_depth_stencil) case GL_DEPTH_STENCIL_MESA: @@ -503,23 +511,22 @@ mgaDDDrawPixels( GLcontext *ctx, return GL_FALSE; } - LOCK_HARDWARE( mmesa ); - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + LOCK_HARDWARE_QUIESCENT( mmesa ); - if (mmesa->dirty_cliprects & MGA_FRONT) + if (mmesa->dirty_cliprects & MGA_FRONT) mgaUpdateRects( mmesa, MGA_FRONT ); - + if ( IS_AGP_MEM(mmesa, (char *)pixels) && IS_AGP_MEM(mmesa, (char *)pixels + size) ) { - do_draw_pix( ctx, x, y, width, height, pitch, pixels, + do_draw_pix( ctx, x, y, width, height, pitch, pixels, dest, planemask ); - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); - } - else + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + } + else { /* Pixels is in regular memory -- get dma buffers and perform - * upload through them. + * upload through them. */ /* drmBufPtr buf = mgaGetBufferLocked(mmesa); */ GLuint bufferpitch = (width*cpp+31)&~31; @@ -528,21 +535,21 @@ mgaDDDrawPixels( GLcontext *ctx, do { /* GLuint rows = MIN2( height, MGA_DMA_BUF_SZ / bufferpitch ); */ GLuint rows = height; - - + + if (0) fprintf(stderr, "trying to upload %d rows (pitch %d)\n", rows, bufferpitch); - + /* The texture conversion code is so slow that there is only * negligble speedup when the buffers/images don't exactly * match: */ -#if 1 +#if 0 if (cpp == 2) { - if (!_mesa_convert_teximage( MESA_R5_G6_B5, - width, rows, + if (!_mesa_convert_teximage( MESA_FORMAT_RGB565, + width, rows, address, bufferpitch, - width, rows, + width, rows, format, type, pixels, unpack )) { /* mgaReleaseBufLocked( mmesa, buf ); */ @@ -550,10 +557,10 @@ mgaDDDrawPixels( GLcontext *ctx, return GL_FALSE; } } else { - if (!_mesa_convert_teximage( MESA_A8_R8_G8_B8, - width, rows, + if (!_mesa_convert_teximage( MESA_FORMAT_ARGB8888, + width, rows, address, bufferpitch, - width, rows, + width, rows, format, type, pixels, unpack )) { /* mgaReleaseBufLocked( mmesa, buf ); */ @@ -565,12 +572,12 @@ mgaDDDrawPixels( GLcontext *ctx, MEMCPY( address, pixels, rows*bufferpitch ); #endif - do_draw_pix( ctx, x, y, width, rows, + do_draw_pix( ctx, x, y, width, rows, bufferpitch/cpp, address, dest, planemask ); /* Fix me -- use multiple buffers to avoid flush. */ - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); pixels = (void *)((char *) pixels + rows * pitch); height -= rows; @@ -591,7 +598,7 @@ mgaDDDrawPixels( GLcontext *ctx, /* Stub functions - not a real allocator, always returns pointer to * the same block of agp space which isn't used for anything else at - * present. + * present. */ #if defined(MESA_hacked_agp_allocator) static void mgaDDFreeAgpMemory( GLcontext *ctx, void *ptr ) @@ -613,7 +620,7 @@ static GLint mgaDDGetAgpOffset( GLcontext *ctx, const void *ptr ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - if (!IS_AGP_MEM(mmesa, ptr)) + if (!IS_AGP_MEM(mmesa, ptr)) return -1; return AGP_OFFSET(mmesa, ptr); @@ -623,7 +630,7 @@ static GLint mgaDDGetAgpOffset( GLcontext *ctx, const void *ptr ) void mgaDDInitPixelFuncs( GLcontext *ctx ) { -#if defined (MESA_hacked_agp_allocator) +#if defined (MESA_experimetal_agp_allocator) ctx->Driver.AllocateAgpMemory = mgaDDAllocateAgpMemory; ctx->Driver.GetAgpOffset = mgaDDGetAgpOffset; ctx->Driver.FreeAgpMemory = mgaDDFreeAgpMemory; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapixel.h b/xc/lib/GL/mesa/src/drv/mga/mgapixel.h index a413467e4..4766c1409 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgapixel.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgapixel.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.h,v 1.1 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.h,v 1.2 2001/03/21 16:14:22 dawes Exp $ */ /************************************************************************** Copyright 2000 Compaq Computer Inc. and VA Linux, Inc. diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c index 0b9893175..0f53c6fda 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.c,v 1.6 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.c,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ #include "types.h" #include "mgadd.h" @@ -9,59 +9,59 @@ #define DBG 0 -#define LOCAL_VARS \ - __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \ - mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ - __DRIscreenPrivate *sPriv = mmesa->driScreen; \ - GLuint pitch = mgaScreen->frontPitch; \ - GLuint height = dPriv->h; \ - char *read_buf = (char *)(sPriv->pFB + \ - mmesa->readOffset + \ - dPriv->x * mgaScreen->cpp + \ - dPriv->y * pitch); \ - char *buf = (char *)(sPriv->pFB + \ - mmesa->drawOffset + \ - dPriv->x * mgaScreen->cpp + \ - dPriv->y * pitch); \ - GLuint p = MGA_CONTEXT( ctx )->MonoColor; \ +#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \ + mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ + __DRIscreenPrivate *sPriv = mmesa->driScreen; \ + GLuint pitch = mgaScreen->frontPitch; \ + GLuint height = dPriv->h; \ + char *read_buf = (char *)(sPriv->pFB + \ + mmesa->readOffset + \ + dPriv->x * mgaScreen->cpp + \ + dPriv->y * pitch); \ + char *buf = (char *)(sPriv->pFB + \ + mmesa->drawOffset + \ + dPriv->x * mgaScreen->cpp + \ + dPriv->y * pitch); \ + GLuint p = MGA_CONTEXT( ctx )->MonoColor; \ (void) read_buf; (void) buf; (void) p - - - -#define LOCAL_DEPTH_VARS \ - __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \ - mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ - __DRIscreenPrivate *sPriv = mmesa->driScreen; \ - GLuint pitch = mgaScreen->frontPitch; \ - GLuint height = dPriv->h; \ - char *buf = (char *)(sPriv->pFB + \ - mgaScreen->depthOffset + \ - dPriv->x * mgaScreen->cpp + \ + + +#define LOCAL_DEPTH_VARS \ + __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \ + mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ + __DRIscreenPrivate *sPriv = mmesa->driScreen; \ + GLuint pitch = mgaScreen->frontPitch; \ + GLuint height = dPriv->h; \ + char *buf = (char *)(sPriv->pFB + \ + mgaScreen->depthOffset + \ + dPriv->x * mgaScreen->cpp + \ dPriv->y * pitch) -#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS +#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS -#define INIT_MONO_PIXEL(p) +#define INIT_MONO_PIXEL(p) #define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ _y >= miny && _y < maxy) - -#define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ - if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ - else { \ - _n1 = _n; \ - _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ - } - +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } #define HW_LOCK() \ mgaContextPtr mmesa = MGA_CONTEXT(ctx); \ + FLUSH_BATCH(mmesa); \ LOCK_HARDWARE_QUIESCENT(mmesa); + #define HW_CLIPLOOP() \ do { \ int _nc = mmesa->numClipRects; \ @@ -98,9 +98,9 @@ #define READ_RGBA( rgba, _x, _y ) \ do { \ GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 8) & 0xf8; \ - rgba[1] = (p >> 3) & 0xfc; \ - rgba[2] = (p << 3) & 0xf8; \ + rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \ + rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \ + rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \ rgba[3] = 255; \ } while(0) @@ -128,7 +128,7 @@ do { \ rgba[0] = (p >> 16) & 0xff; \ rgba[1] = (p >> 8) & 0xff; \ rgba[2] = (p >> 0) & 0xff; \ - rgba[3] = (p >> 24) & 0xff; \ + rgba[3] = 0xff; \ } while (0) #define TAG(x) mga##x##_8888 @@ -143,7 +143,7 @@ do { \ *(GLushort *)(buf + _x*2 + _y*pitch) = d; #define READ_DEPTH( d, _x, _y ) \ - d = *(GLushort *)(buf + _x*2 + _y*pitch); + d = *(GLushort *)(buf + _x*2 + _y*pitch); #define TAG(x) mga##x##_16 #include "depthtmp.h" @@ -157,7 +157,7 @@ do { \ *(GLuint *)(buf + _x*4 + _y*pitch) = d; #define READ_DEPTH( d, _x, _y ) \ - d = *(GLuint *)(buf + _x*4 + _y*pitch); + d = *(GLuint *)(buf + _x*4 + _y*pitch); #define TAG(x) mga##x##_32 #include "depthtmp.h" @@ -169,13 +169,13 @@ do { \ #define WRITE_DEPTH( _x, _y, d ) { \ GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \ tmp &= 0xff; \ - tmp |= (d) & 0xffffff00; \ + tmp |= (d) << 8; \ *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \ } -#define READ_DEPTH( d, _x, _y ) \ - d = *(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff; - +#define READ_DEPTH( d, _x, _y ) { \ + d = (*(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff) >> 8; \ +} #define TAG(x) mga##x##_24_8 #include "depthtmp.h" @@ -188,7 +188,7 @@ do { \ } #define READ_STENCIL( d, _x, _y ) \ - d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xff; + d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xff; #define TAG(x) mga##x##_24_8 #include "stenciltmp.h" @@ -224,7 +224,7 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) ctx->Driver.WriteMonoRGBAPixels = mgaWriteMonoRGBAPixels_8888; ctx->Driver.ReadRGBASpan = mgaReadRGBASpan_8888; ctx->Driver.ReadRGBAPixels = mgaReadRGBAPixels_8888; - + if (!mmesa->hw_stencil) { ctx->Driver.ReadDepthSpan = mgaReadDepthSpan_32; ctx->Driver.WriteDepthSpan = mgaWriteDepthSpan_32; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.c b/xc/lib/GL/mesa/src/drv/mga/mgastate.c index f790adc9a..6d2adb5ea 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgastate.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgastate.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.7 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.8 2001/03/21 16:14:22 dawes Exp $ */ #include <stdio.h> @@ -20,13 +20,13 @@ */ #if defined(ACCEL_ROP) static GLuint mgarop_NoBLK[16] = { - DC_atype_rpl | 0x00000000, DC_atype_rstr | 0x00080000, + DC_atype_rpl | 0x00000000, DC_atype_rstr | 0x00080000, DC_atype_rstr | 0x00040000, DC_atype_rpl | 0x000c0000, - DC_atype_rstr | 0x00020000, DC_atype_rstr | 0x000a0000, + DC_atype_rstr | 0x00020000, DC_atype_rstr | 0x000a0000, DC_atype_rstr | 0x00060000, DC_atype_rstr | 0x000e0000, - DC_atype_rstr | 0x00010000, DC_atype_rstr | 0x00090000, + DC_atype_rstr | 0x00010000, DC_atype_rstr | 0x00090000, DC_atype_rstr | 0x00050000, DC_atype_rstr | 0x000d0000, - DC_atype_rpl | 0x00030000, DC_atype_rstr | 0x000b0000, + DC_atype_rpl | 0x00030000, DC_atype_rstr | 0x000b0000, DC_atype_rstr | 0x00070000, DC_atype_rpl | 0x000f0000 }; #endif @@ -39,10 +39,10 @@ static void mgaUpdateStencil(const GLcontext *ctx) if (ctx->Stencil.Enabled) { - stencil = ctx->Stencil.Ref | + stencil = ctx->Stencil.Ref | ( ctx->Stencil.ValueMask << 8 ) | ( ctx->Stencil.WriteMask << 16 ); - + switch (ctx->Stencil.Function) { case GL_NEVER: @@ -71,9 +71,9 @@ static void mgaUpdateStencil(const GLcontext *ctx) default: break; } - + switch (ctx->Stencil.FailFunc) - { + { case GL_KEEP: MGA_SET_FIELD(stencilctl, SC_sfailop_MASK, SC_sfailop_keep); break; @@ -95,9 +95,9 @@ static void mgaUpdateStencil(const GLcontext *ctx) default: break; } - + switch (ctx->Stencil.ZFailFunc) - { + { case GL_KEEP: MGA_SET_FIELD(stencilctl, SC_szfailop_MASK, SC_szfailop_keep); break; @@ -119,9 +119,9 @@ static void mgaUpdateStencil(const GLcontext *ctx) default: break; } - + switch (ctx->Stencil.ZPassFunc) - { + { case GL_KEEP: MGA_SET_FIELD(stencilctl, SC_szpassop_MASK, SC_szpassop_keep); break; @@ -145,26 +145,26 @@ static void mgaUpdateStencil(const GLcontext *ctx) } } - mmesa->Setup[MGA_CTXREG_STENCIL] = stencil; - mmesa->Setup[MGA_CTXREG_STENCILCTL] = stencilctl; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->setup.stencil = stencil; + mmesa->setup.stencilctl = stencilctl; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; } -static void mgaDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref, - GLuint mask) +static void mgaDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref, + GLuint mask) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); MGA_CONTEXT(ctx)->new_state |= MGA_NEW_STENCIL; } -static void mgaDDStencilMask(GLcontext *ctx, GLuint mask) +static void mgaDDStencilMask(GLcontext *ctx, GLuint mask) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); MGA_CONTEXT(ctx)->new_state |= MGA_NEW_STENCIL; } -static void mgaDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail, - GLenum zpass) +static void mgaDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail, + GLenum zpass) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); MGA_CONTEXT(ctx)->new_state |= MGA_NEW_STENCIL; @@ -172,14 +172,14 @@ static void mgaDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail, static void mgaDDClearDepth(GLcontext *ctx, GLclampd d) { - mgaContextPtr mmesa = MGA_CONTEXT(ctx); - - switch (mmesa->Setup[MGA_CTXREG_MACCESS] & MA_zwidth_MASK) { - case MA_zwidth_16: mmesa->ClearDepth = d * 0x0000ffff; break; - case MA_zwidth_24: mmesa->ClearDepth = d * 0xffffff00; break; - case MA_zwidth_32: mmesa->ClearDepth = d * 0xffffffff; break; - default: return; - } + mgaContextPtr mmesa = MGA_CONTEXT(ctx); + + switch (mmesa->setup.maccess & ~MA_zwidth_MASK) { + case MA_zwidth_16: mmesa->ClearDepth = d * 0x0000ffff; break; + case MA_zwidth_24: mmesa->ClearDepth = d * 0xffffff00; break; + case MA_zwidth_32: mmesa->ClearDepth = d * 0xffffffff; break; + default: return; + } } static void mgaUpdateZMode(const GLcontext *ctx) @@ -188,13 +188,15 @@ static void mgaUpdateZMode(const GLcontext *ctx) int zmode = 0; if (ctx->Depth.Test) { - switch(ctx->Depth.Func) { + switch(ctx->Depth.Func) { case GL_NEVER: - zmode = DC_zmode_nozcmp; break; - case GL_ALWAYS: + /* can't do this in h/w, we'll use a s/w fallback */ + zmode = DC_zmode_nozcmp; + break; + case GL_ALWAYS: zmode = DC_zmode_nozcmp; break; case GL_LESS: - zmode = DC_zmode_zlt; break; + zmode = DC_zmode_zlt; break; case GL_LEQUAL: zmode = DC_zmode_zlte; break; case GL_EQUAL: @@ -208,25 +210,28 @@ static void mgaUpdateZMode(const GLcontext *ctx) default: break; } + if (ctx->Depth.Mask) - zmode |= DC_atype_zi; + zmode |= DC_atype_zi; else - zmode |= DC_atype_i; - } else { - zmode |= DC_zmode_nozcmp | DC_atype_i; + zmode |= DC_atype_i; + } + else { + zmode |= DC_zmode_nozcmp; + zmode |= DC_atype_i; /* don't write to zbuffer */ } #if defined(ACCEL_ROP) - mmesa->Setup[MGA_CTXREG_DWGCTL] &= DC_bop_MASK; - if (ctx->Color.ColorLogicOpEnabled) + mmesa->setup.dwgctl &= DC_bop_MASK; + if (ctx->Color.ColorLogicOpEnabled) zmode |= mgarop_NoBLK[(ctx->Color.LogicOp)&0xf]; - else + else zmode |= mgarop_NoBLK[GL_COPY & 0xf]; #endif - mmesa->Setup[MGA_CTXREG_DWGCTL] &= DC_zmode_MASK & DC_atype_MASK; - mmesa->Setup[MGA_CTXREG_DWGCTL] |= zmode; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->setup.dwgctl &= DC_zmode_MASK & DC_atype_MASK; + mmesa->setup.dwgctl |= zmode; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; } @@ -237,10 +242,16 @@ static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLclampf ref) } -static void mgaDDBlendEquation(GLcontext *ctx, GLenum mode) +static void mgaDDBlendEquation(GLcontext *ctx, GLenum mode) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA; + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + MGA_CONTEXT(ctx)->Fallback |= MGA_FALLBACK_LOGICOP; + else + MGA_CONTEXT(ctx)->Fallback &= ~MGA_FALLBACK_LOGICOP; + } static void mgaDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) @@ -249,7 +260,7 @@ static void mgaDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) MGA_CONTEXT(ctx)->new_state |= MGA_NEW_ALPHA; } -static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, +static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { @@ -259,7 +270,7 @@ static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, -static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname, +static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname, const GLfloat *param) { if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { @@ -272,7 +283,7 @@ static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname, static void mgaDDShadeModel(GLcontext *ctx, GLenum mode) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); - MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE; + MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE; } @@ -280,6 +291,10 @@ static void mgaDDDepthFunc(GLcontext *ctx, GLenum func) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); MGA_CONTEXT(ctx)->new_state |= MGA_NEW_DEPTH; + if (func == GL_NEVER && ctx->Depth.Test) + MGA_CONTEXT(ctx)->Fallback |= MGA_FALLBACK_DEPTH; + else + MGA_CONTEXT(ctx)->Fallback &= ~MGA_FALLBACK_DEPTH; } static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag) @@ -299,12 +314,14 @@ static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode ) { if (ctx->Color.ColorLogicOpEnabled) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); - + if (opcode == GL_COPY) MGA_CONTEXT(ctx)->Fallback &= ~MGA_FALLBACK_LOGICOP; else MGA_CONTEXT(ctx)->Fallback |= MGA_FALLBACK_LOGICOP; } + else + MGA_CONTEXT(ctx)->Fallback &= ~MGA_FALLBACK_LOGICOP; } #endif @@ -313,18 +330,18 @@ static void mgaUpdateFogAttrib( GLcontext *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - GLuint color = MGAPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F), - (GLubyte)(ctx->Fog.Color[1]*255.0F), - (GLubyte)(ctx->Fog.Color[2]*255.0F)); + GLuint color = MGAPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F), + (GLubyte)(ctx->Fog.Color[1]*255.0F), + (GLubyte)(ctx->Fog.Color[2]*255.0F)); - if (color != mmesa->Setup[MGA_CTXREG_FOGCOLOR]) - mmesa->Setup[MGA_CTXREG_FOGCOLOR] = color; + if (color != mmesa->setup.fogcolor) + mmesa->setup.fogcolor = color; - mmesa->Setup[MGA_CTXREG_MACCESS] &= ~MA_fogen_enable; - if (ctx->FogMode == FOG_FRAGMENT) - mmesa->Setup[MGA_CTXREG_MACCESS] |= MA_fogen_enable; + mmesa->setup.maccess &= ~MA_fogen_enable; + if (ctx->FogMode == FOG_FRAGMENT) + mmesa->setup.maccess |= MA_fogen_enable; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; } static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param) @@ -348,7 +365,7 @@ static void mgaUpdateAlphaMode(GLcontext *ctx) int a = 0; /* determine source of alpha for blending and testing */ - if ( !ctx->Texture.ReallyEnabled ) + if ( !ctx->Texture.ReallyEnabled ) a |= AC_alphasel_diffused; else { switch (ctx->Texture.Unit[0].EnvMode) { @@ -371,30 +388,30 @@ static void mgaUpdateAlphaMode(GLcontext *ctx) if (ctx->Color.AlphaEnabled) { GLubyte ref = ctx->Color.AlphaRef; switch (ctx->Color.AlphaFunc) { - case GL_NEVER: + case GL_NEVER: a |= AC_atmode_alt; ref = 0; break; case GL_LESS: - a |= AC_atmode_alt; + a |= AC_atmode_alt; break; case GL_GEQUAL: - a |= AC_atmode_agte; + a |= AC_atmode_agte; break; - case GL_LEQUAL: - a |= AC_atmode_alte; + case GL_LEQUAL: + a |= AC_atmode_alte; break; - case GL_GREATER: - a |= AC_atmode_agt; + case GL_GREATER: + a |= AC_atmode_agt; break; - case GL_NOTEQUAL: - a |= AC_atmode_ane; + case GL_NOTEQUAL: + a |= AC_atmode_ane; break; - case GL_EQUAL: - a |= AC_atmode_ae; + case GL_EQUAL: + a |= AC_atmode_ae; break; case GL_ALWAYS: - a |= AC_atmode_noacmp; + a |= AC_atmode_noacmp; break; default: break; @@ -425,12 +442,15 @@ static void mgaUpdateAlphaMode(GLcontext *ctx) break; case GL_ONE_MINUS_DST_ALPHA: if (mgaScreen->cpp == 4) - a |= AC_src_om_dst_alpha; - else + a |= AC_src_om_dst_alpha; + else a |= AC_src_zero; break; case GL_SRC_ALPHA_SATURATE: - a |= AC_src_src_alpha_sat; + if (ctx->Visual->AlphaBits > 0) + a |= AC_src_src_alpha_sat; + else + a |= AC_src_zero; break; default: /* never happens */ break; @@ -468,13 +488,13 @@ static void mgaUpdateAlphaMode(GLcontext *ctx) a |= AC_src_one|AC_dst_zero; } - mmesa->Setup[MGA_CTXREG_ALPHACTRL] = (AC_amode_alpha_channel | - AC_astipple_disable | - AC_aten_disable | - AC_atmode_noacmp | - a); - - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->setup.alphactrl = (AC_amode_alpha_channel | + AC_astipple_disable | + AC_aten_disable | + AC_atmode_noacmp | + a); + + mmesa->dirty |= MGA_UPLOAD_CONTEXT; } @@ -490,10 +510,10 @@ void mgaUpdateClipping(const GLcontext *ctx) if (mmesa->driDrawable) { int x1 = mmesa->driDrawable->x + ctx->Scissor.X; - int y1 = mmesa->driDrawable->y + mmesa->driDrawable->h - (ctx->Scissor.Y+ - ctx->Scissor.Height); - int x2 = mmesa->driDrawable->x + ctx->Scissor.X+ctx->Scissor.Width; - int y2 = mmesa->driDrawable->y + mmesa->driDrawable->h - ctx->Scissor.Y; + int y1 = mmesa->driDrawable->y + mmesa->driDrawable->h + - (ctx->Scissor.Y + ctx->Scissor.Height); + int x2 = x1 + ctx->Scissor.Width - 1; + int y2 = y1 + ctx->Scissor.Height - 1; if (x1 < 0) x1 = 0; if (y1 < 0) y1 = 0; @@ -506,7 +526,7 @@ void mgaUpdateClipping(const GLcontext *ctx) mmesa->scissor_rect.y2 = y2; if (MGA_DEBUG&DEBUG_VERBOSE_2D) - fprintf(stderr, "SET SCISSOR %d,%d-%d,%d\n", + fprintf(stderr, "SET SCISSOR %d,%d-%d,%d\n", mmesa->scissor_rect.x1, mmesa->scissor_rect.y1, mmesa->scissor_rect.x2, @@ -517,7 +537,7 @@ void mgaUpdateClipping(const GLcontext *ctx) } -static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y, +static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); @@ -536,9 +556,9 @@ static void mgaDDDither(GLcontext *ctx, GLboolean enable) -static void mgaDDSetColor(GLcontext *ctx, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) +static void mgaDDSetColor(GLcontext *ctx, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -546,9 +566,9 @@ static void mgaDDSetColor(GLcontext *ctx, } -static void mgaDDClearColor(GLcontext *ctx, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) +static void mgaDDClearColor(GLcontext *ctx, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -569,22 +589,22 @@ static void mgaUpdateCull( GLcontext *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint mode = _CULL_DISABLE; - - if (ctx->Polygon.CullFlag && - ctx->PB->primitive == GL_POLYGON && - ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) + + if (ctx->Polygon.CullFlag && + ctx->PB->primitive == GL_POLYGON && + ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) { mode = _CULL_NEGATIVE; if (ctx->Polygon.CullFaceMode == GL_FRONT) mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE); if (ctx->Polygon.FrontFace != GL_CCW) mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE); - if (mmesa->warp_pipe & MGA_TEX1_BIT) + if (mmesa->warp_pipe & MGA_TEX1_BIT) mode ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE); /* why??? */ } - mmesa->Setup[MGA_CTXREG_WFLAG] = mode; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->setup.wflag = mode; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; } @@ -603,12 +623,12 @@ static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum mode) /* Mesa calls this from the wrong place: */ -static GLboolean mgaDDColorMask(GLcontext *ctx, - GLboolean r, GLboolean g, +static GLboolean mgaDDColorMask(GLcontext *ctx, + GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); - mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; + mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; GLuint mask = mgaPackColor(mgaScreen->cpp, @@ -616,28 +636,31 @@ static GLboolean mgaDDColorMask(GLcontext *ctx, ctx->Color.ColorMask[GCOMP], ctx->Color.ColorMask[BCOMP], ctx->Color.ColorMask[ACOMP]); - + if (mgaScreen->cpp == 2) mask = mask | (mask << 16); - if (mmesa->Setup[MGA_CTXREG_PLNWT] != mask) { + if (mmesa->setup.plnwt != mask) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); - mmesa->Setup[MGA_CTXREG_PLNWT] = mask; - MGA_CONTEXT(ctx)->new_state |= MGA_NEW_MASK; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->setup.plnwt = mask; + MGA_CONTEXT(ctx)->new_state |= MGA_NEW_MASK; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; } - return 1; + return 0; /* Kind of a hack */ } /* ============================================================= - * Polygon stipple - * + * Polygon stipple + * * The mga supports a subset of possible 4x4 stipples natively, GL * wants 32x32. Fortunately stipple is usually a repeating pattern. + * + * Note: the fully opaque pattern (0xffff) has been disabled in order + * to work around a conformance issue. */ static int mgaStipples[16] = { - 0xffff, + 0xffff1, /* See above note */ 0xa5a5, 0x5a5a, 0xa0a0, @@ -665,11 +688,16 @@ static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) GLuint stipple; FLUSH_BATCH(mmesa); - ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; + + /* Turn off flags. We'll turn them on below if this stipple pattern + * works in h/w. + */ + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; + mmesa->canDoStipple = GL_FALSE; if (active) { - mmesa->dirty |= MGA_UPLOAD_CTX; - mmesa->Setup[MGA_CTXREG_DWGCTL] &= ~(0xf<<20); + mmesa->dirty |= MGA_UPLOAD_CONTEXT; + mmesa->setup.dwgctl &= ~(0xf<<20); } p[0] = mask[0] & 0xf; p[0] |= p[0] << 4; @@ -678,17 +706,16 @@ static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) p[3] = mask[12] & 0xf; p[3] |= p[3] << 4; for (k = 0 ; k < 8 ; k++) - for (j = 0 ; j < 4; j++) - for (i = 0 ; i < 4 ; i++) + for (j = 0 ; j < 4; j++) + for (i = 0 ; i < 4 ; i++) if (*m++ != p[j]) { - ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; return; } stipple = ( ((p[0] & 0xf) << 0) | ((p[1] & 0xf) << 4) | ((p[2] & 0xf) << 8) | - ((p[3] & 0xf) << 12) ); + ((p[3] & 0xf) << 12) ); for (i = 0 ; i < 16 ; i++) if (mgaStipples[i] == stipple) { @@ -697,13 +724,15 @@ static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) } if (i == 16) { - ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; return; } - + + mmesa->canDoStipple = GL_TRUE; + if (active) { - mmesa->Setup[MGA_CTXREG_DWGCTL] &= ~(0xf<<20); - mmesa->Setup[MGA_CTXREG_DWGCTL] |= mmesa->poly_stipple; + mmesa->setup.dwgctl &= ~(0xf<<20); + mmesa->setup.dwgctl |= mmesa->poly_stipple; + ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; } } @@ -718,125 +747,67 @@ static void mgaDDPrintDirty( const char *msg, GLuint state ) (state & MGA_WAIT_AGE) ? "wait-age, " : "", (state & MGA_UPLOAD_TEX0IMAGE) ? "upload-tex0-img, " : "", (state & MGA_UPLOAD_TEX1IMAGE) ? "upload-tex1-img, " : "", - (state & MGA_UPLOAD_CTX) ? "upload-ctx, " : "", + (state & MGA_UPLOAD_CONTEXT) ? "upload-ctx, " : "", (state & MGA_UPLOAD_TEX0) ? "upload-tex0, " : "", (state & MGA_UPLOAD_TEX1) ? "upload-tex1, " : "", (state & MGA_UPLOAD_PIPE) ? "upload-pipe, " : "" - ); + ); } -/* static int tex0[11] = { */ -/* 0x2050003, */ -/* 0x90, */ -/* 0x82100000, */ -/* 0x0, */ -/* 0xc6d000, */ -/* 0xc7d000, */ -/* 0xc81000, */ -/* 0xc82000, */ -/* 0xc82400, */ -/* 0x3fc7413, */ -/* 0x1fc7612 */ -/* }; */ - -/* static int tex1[11] = { */ -/* 0x2040003, */ -/* 0x90, */ -/* 0x82100000, */ -/* 0x0, */ -/* 0xc82500, */ -/* 0xc8a500, */ -/* 0xc8c500, */ -/* 0xc8cd00, */ -/* 0xc8cf00, */ -/* 0x1fc7612, */ -/* 0x1fc7612 */ -/* }; */ - -/* static int tex0_single[11] = { */ -/* 0x2040003, */ -/* 0x10, */ -/* 0x82100000, */ -/* 0x0, */ -/* 0x196d000, */ -/* 0x1975000, */ -/* 0x1977000, */ -/* 0x1977800, */ -/* 0x1977a00, */ -/* 0x1fc7612, */ -/* 0x1fc7612, */ -/* }; */ - -/* static int ctx_single[] = { */ -/* 0x727000, */ -/* 0x1, */ -/* 0xffffffff, */ -/* 0xc4436, */ -/* 0x101, */ -/* 0x7fff7f, */ -/* 0x0, */ -/* 0x0, */ -/* 0x0, */ -/* 0x0 */ -/* }; */ - -/* static int ctx_multi[] = { */ -/* 0x727000, */ -/* 0x1, */ -/* 0xffffffff, */ -/* 0xc4076, */ -/* 0x2000101, */ -/* 0x0, */ -/* 0x0, */ -/* 0xc0600000, */ -/* 0xc3600013, */ -/* 0x0 */ -/* }; */ - /* Push the state into the sarea and/or texture memory. */ void mgaEmitHwStateLocked( mgaContextPtr mmesa ) { - drm_mga_sarea_t *sarea = mmesa->sarea; + MGASAREAPrivPtr sarea = mmesa->sarea; if (MGA_DEBUG & DEBUG_VERBOSE_MSG) mgaDDPrintDirty( "mgaEmitHwStateLocked", mmesa->dirty ); if ((mmesa->dirty & MGA_UPLOAD_TEX0IMAGE) && mmesa->CurrentTexObj[0]) mgaUploadTexImages(mmesa, mmesa->CurrentTexObj[0]); - + if ((mmesa->dirty & MGA_UPLOAD_TEX1IMAGE) && mmesa->CurrentTexObj[1]) mgaUploadTexImages(mmesa, mmesa->CurrentTexObj[1]); - - if (mmesa->dirty & MGA_UPLOAD_CTX) { - memcpy( sarea->ContextState, mmesa->Setup, sizeof(mmesa->Setup)); + + if (mmesa->dirty & MGA_UPLOAD_CONTEXT) { + memcpy( &sarea->ContextState, &mmesa->setup, sizeof(mmesa->setup)); } if ((mmesa->dirty & MGA_UPLOAD_TEX0) && mmesa->CurrentTexObj[0]) { - memcpy(sarea->TexState[0], - mmesa->CurrentTexObj[0]->Setup, + memcpy(&sarea->TexState[0], + &mmesa->CurrentTexObj[0]->setup, sizeof(sarea->TexState[0])); } if ((mmesa->dirty & MGA_UPLOAD_TEX1) && mmesa->CurrentTexObj[1]) { - memcpy(sarea->TexState[1], - mmesa->CurrentTexObj[1]->Setup, + memcpy(&sarea->TexState[1], + &mmesa->CurrentTexObj[1]->setup, sizeof(sarea->TexState[1])); } - if (sarea->TexState[0][MGA_TEXREG_CTL2] != - sarea->TexState[1][MGA_TEXREG_CTL2]) { - memcpy(sarea->TexState[1], - sarea->TexState[0], - sizeof(sarea->TexState[0])); + if (sarea->TexState[0].texctl2 != + sarea->TexState[1].texctl2) { + memcpy(&sarea->TexState[1], + &sarea->TexState[0], + sizeof(sarea->TexState[0])); mmesa->dirty |= MGA_UPLOAD_TEX1|MGA_UPLOAD_TEX0; } mmesa->sarea->WarpPipe = mmesa->warp_pipe; - mmesa->sarea->vertexsize = mmesa->vertsize; + mmesa->sarea->vertsize = mmesa->vertsize; mmesa->sarea->dirty |= mmesa->dirty; mmesa->dirty &= (MGA_UPLOAD_CLIPRECTS|MGA_WAIT_AGE); + + /* This is a bit of a hack but seems to be the best place to ensure + * that separate specular is disabled when not needed. + */ + if (mmesa->glCtx->Texture.ReallyEnabled == 0 || + !mmesa->glCtx->Light.Enabled || + mmesa->glCtx->Light.Model.ColorControl == GL_SINGLE_COLOR) { + sarea->TexState[0].texctl2 &= ~TMC_specen_enable; + sarea->TexState[1].texctl2 &= ~TMC_specen_enable; + } } @@ -856,10 +827,21 @@ static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) case GL_BLEND: FLUSH_BATCH( mmesa ); mmesa->new_state |= MGA_NEW_ALPHA; + + /* For some reason enable(GL_BLEND) affects ColorLogicOpEnabled. + */ + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + mmesa->Fallback |= MGA_FALLBACK_LOGICOP; + else + mmesa->Fallback &= ~MGA_FALLBACK_LOGICOP; break; case GL_DEPTH_TEST: FLUSH_BATCH( mmesa ); mmesa->new_state |= MGA_NEW_DEPTH; + if (ctx->Depth.Func == GL_NEVER && ctx->Depth.Test) + mmesa->Fallback |= MGA_FALLBACK_DEPTH; + else + mmesa->Fallback &= ~MGA_FALLBACK_DEPTH; break; case GL_SCISSOR_TEST: FLUSH_BATCH( mmesa ); @@ -881,18 +863,23 @@ static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) mmesa->new_state |= (MGA_NEW_TEXTURE|MGA_NEW_ALPHA); break; case GL_POLYGON_STIPPLE: - if ((ctx->Driver.TriangleCaps & DD_TRI_STIPPLE) && - ctx->PB->primitive == GL_POLYGON) - { - FLUSH_BATCH(mmesa); - mmesa->dirty |= MGA_UPLOAD_CTX; - mmesa->Setup[MGA_CTXREG_DWGCTL] &= ~(0xf<<20); - if (state) - mmesa->Setup[MGA_CTXREG_DWGCTL] |= mmesa->poly_stipple; + FLUSH_BATCH(mmesa); + mmesa->dirty |= MGA_UPLOAD_CONTEXT; + mmesa->setup.dwgctl &= ~(0xf<<20); + if (state) { + if (mmesa->canDoStipple && ctx->PB->primitive == GL_POLYGON) { + mmesa->setup.dwgctl |= mmesa->poly_stipple; + ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; + } + else { + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; + } + } + else { + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; } break; case GL_COLOR_LOGIC_OP: - case GL_INDEX_LOGIC_OP: FLUSH_BATCH( mmesa ); #if !defined(ACCEL_ROP) mmesa->Fallback &= ~MGA_FALLBACK_LOGICOP; @@ -904,15 +891,15 @@ static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) break; case GL_STENCIL_TEST: FLUSH_BATCH( mmesa ); - if (mmesa->hw_stencil) + if (mmesa->hw_stencil) mmesa->new_state |= MGA_NEW_STENCIL; else if (state) mmesa->Fallback |= MGA_FALLBACK_STENCIL; else mmesa->Fallback &= ~MGA_FALLBACK_STENCIL; default: - break; - } + break; + } } @@ -926,17 +913,17 @@ static void mgaWarpUpdateState( GLcontext *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); int index = mmesa->setupindex; - + index &= ~(MGA_WIN_BIT|MGA_TEX0_BIT|MGA_RGBA_BIT); - index |= (MGA_ALPHA_BIT | - MGA_SPEC_BIT | - MGA_FOG_BIT | + index |= (MGA_ALPHA_BIT | + MGA_SPEC_BIT | + MGA_FOG_BIT | /* MGA_TEX1_BIT | */ 0); if (index != mmesa->warp_pipe) { - FLUSH_BATCH(mmesa); + FLUSH_BATCH(mmesa); mmesa->warp_pipe = index; mmesa->new_state |= MGA_NEW_WARP; mmesa->dirty |= MGA_UPLOAD_PIPE; @@ -968,7 +955,7 @@ void mgaDDUpdateHwState( GLcontext *ctx ) mgaContextPtr mmesa = MGA_CONTEXT( ctx ); int new_state = mmesa->new_state; - if (new_state) + if (new_state) { FLUSH_BATCH( mmesa ); @@ -989,8 +976,8 @@ void mgaDDUpdateHwState( GLcontext *ctx ) if (new_state & MGA_NEW_CLIP) mgaUpdateClipping(ctx); - if (new_state & MGA_NEW_STENCIL) - mgaUpdateStencil(ctx); + if (new_state & MGA_NEW_STENCIL) + mgaUpdateStencil(ctx); if (new_state & (MGA_NEW_WARP|MGA_NEW_CULL)) mgaUpdateCull(ctx); @@ -1001,42 +988,41 @@ void mgaDDUpdateHwState( GLcontext *ctx ) } - - - - - void mgaDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); FLUSH_BATCH( mmesa ); - mgaUpdateCull(ctx); + mgaUpdateCull(ctx); - if (ctx->Polygon.StippleFlag && (ctx->Driver.TriangleCaps & DD_TRI_STIPPLE)) - { - mmesa->dirty |= MGA_UPLOAD_CTX; - mmesa->Setup[MGA_CTXREG_DWGCTL] &= ~(0xf<<20); - if (ctx->PB->primitive == GL_POLYGON) - mmesa->Setup[MGA_CTXREG_DWGCTL] |= mmesa->poly_stipple; + if (ctx->Polygon.StippleFlag) { + mmesa->dirty |= MGA_UPLOAD_CONTEXT; + mmesa->setup.dwgctl &= ~(0xf<<20); + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; + if (ctx->PB->primitive == GL_POLYGON && mmesa->canDoStipple) { + mmesa->setup.dwgctl |= mmesa->poly_stipple; + ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; + } + } + else { + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; } } #define INTERESTED (~(NEW_MODELVIEW|NEW_PROJECTION|\ NEW_TEXTURE_MATRIX|\ - NEW_USER_CLIP|NEW_CLIENT_STATE|\ - NEW_TEXTURE_ENABLE)) + NEW_USER_CLIP|NEW_CLIENT_STATE)) void mgaDDUpdateState( GLcontext *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); - + if (ctx->NewState & INTERESTED) { - mgaDDChooseRenderState(ctx); + mgaDDChooseRenderState(ctx); mgaChooseRasterSetupFunc(ctx); mgaWarpUpdateState(ctx); - } + } /* Have to do this here to detect texture fallbacks in time: */ @@ -1052,6 +1038,9 @@ void mgaDDUpdateState( GLcontext *ctx ) ctx->Driver.TriangleFunc=mmesa->TriangleFunc; ctx->Driver.QuadFunc=mmesa->QuadFunc; } + else { + ctx->IndirectTriangles |= mmesa->IndirectTriangles; + } } @@ -1066,79 +1055,80 @@ void mgaInitState( mgaContextPtr mmesa ) mmesa->read_buffer = MGA_BACK; mmesa->drawOffset = mmesa->mgaScreen->backOffset; mmesa->readOffset = mmesa->mgaScreen->backOffset; - mmesa->Setup[MGA_CTXREG_DSTORG] = mgaScreen->backOffset; + mmesa->setup.dstorg = mgaScreen->backOffset; } else { - mmesa->drawOffset = mmesa->mgaScreen->frontOffset; - mmesa->readOffset = mmesa->mgaScreen->frontOffset; mmesa->draw_buffer = MGA_FRONT; mmesa->read_buffer = MGA_FRONT; - mmesa->Setup[MGA_CTXREG_DSTORG] = mgaScreen->frontOffset; + mmesa->drawOffset = mmesa->mgaScreen->frontOffset; + mmesa->readOffset = mmesa->mgaScreen->frontOffset; + mmesa->setup.dstorg = mgaScreen->frontOffset; + } + + mmesa->setup.maccess = (MA_memreset_disable | + MA_fogen_disable | + MA_tlutload_disable | + MA_nodither_disable | + MA_dit555_disable); + + switch (mmesa->mgaScreen->cpp) { + case 2: + mmesa->setup.maccess |= MA_pwidth_16; + break; + case 4: + mmesa->setup.maccess |= MA_pwidth_32; + break; + default: + fprintf( stderr, "Error: unknown cpp %d, exiting...\n", + mmesa->mgaScreen->cpp ); + exit( 1 ); } switch (mmesa->glCtx->Visual->DepthBits) { case 16: - mmesa->Setup[MGA_CTXREG_MACCESS] = (MA_pwidth_16 | - MA_zwidth_16 | /* 1bit stencil? */ - MA_memreset_disable | - MA_fogen_disable | - MA_tlutload_disable | - MA_nodither_disable | - MA_dit555_disable); + mmesa->setup.maccess |= MA_zwidth_16; break; case 24: - mmesa->Setup[MGA_CTXREG_MACCESS] = (MA_pwidth_32 | - MA_zwidth_24 | - MA_memreset_disable | - MA_fogen_disable | - MA_tlutload_disable | - MA_nodither_enable | - MA_dit555_disable); + mmesa->setup.maccess |= MA_zwidth_24; break; case 32: - mmesa->Setup[MGA_CTXREG_MACCESS] = (MA_pwidth_32 | - MA_zwidth_32 | - MA_memreset_disable | - MA_fogen_disable | - MA_tlutload_disable | - MA_nodither_enable | - MA_dit555_disable); + mmesa->setup.maccess |= MA_pwidth_32; break; } - mmesa->Setup[MGA_CTXREG_DWGCTL] = (DC_opcod_trap | - DC_atype_i | - DC_linear_xy | - DC_zmode_nozcmp | - DC_solid_disable | - DC_arzero_disable | - DC_sgnzero_disable | - DC_shftzero_enable | - (0xC << DC_bop_SHIFT) | - (0x0 << DC_trans_SHIFT) | - DC_bltmod_bmonolef | - DC_pattern_disable | - DC_transc_disable | - DC_clipdis_disable); - - - mmesa->Setup[MGA_CTXREG_PLNWT] = ~0; - mmesa->Setup[MGA_CTXREG_ALPHACTRL] = ( AC_src_one | - AC_dst_zero | - AC_amode_FCOL | - AC_astipple_disable | - AC_aten_disable | - AC_atmode_noacmp | - AC_alphasel_fromtex ); - - mmesa->Setup[MGA_CTXREG_FOGCOLOR] = - MGAPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F), - (GLubyte)(ctx->Fog.Color[1]*255.0F), + mmesa->setup.dwgctl = (DC_opcod_trap | + DC_atype_i | + DC_linear_xy | + DC_zmode_nozcmp | + DC_solid_disable | + DC_arzero_disable | + DC_sgnzero_disable | + DC_shftzero_enable | + (0xC << DC_bop_SHIFT) | + (0x0 << DC_trans_SHIFT) | + DC_bltmod_bmonolef | + DC_pattern_disable | + DC_transc_disable | + DC_clipdis_disable); + + + mmesa->setup.plnwt = ~0; + mmesa->setup.alphactrl = ( AC_src_one | + AC_dst_zero | + AC_amode_FCOL | + AC_astipple_disable | + AC_aten_disable | + AC_atmode_noacmp | + AC_alphasel_fromtex ); + + mmesa->setup.fogcolor = + MGAPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F), + (GLubyte)(ctx->Fog.Color[1]*255.0F), (GLubyte)(ctx->Fog.Color[2]*255.0F)); - mmesa->Setup[MGA_CTXREG_WFLAG] = 0; - mmesa->Setup[MGA_CTXREG_TDUAL0] = 0; - mmesa->Setup[MGA_CTXREG_TDUAL1] = 0; - mmesa->Setup[MGA_CTXREG_FCOL] = 0; + mmesa->setup.wflag = 0; + mmesa->setup.tdualstage0 = 0; + mmesa->setup.tdualstage1 = 0; + mmesa->setup.fcol = 0; mmesa->new_state = ~0; } @@ -1161,8 +1151,8 @@ void mgaDDInitStateFuncs( GLcontext *ctx ) ctx->Driver.FrontFace = mgaDDCullFaceFrontFace; ctx->Driver.ColorMask = mgaDDColorMask; ctx->Driver.ReducedPrimitiveChange = mgaDDReducedPrimitiveChange; - ctx->Driver.RenderStart = mgaDDUpdateHwState; - ctx->Driver.RenderFinish = 0; + ctx->Driver.RenderStart = mgaDDUpdateHwState; + ctx->Driver.RenderFinish = 0; ctx->Driver.SetDrawBuffer = mgaDDSetDrawBuffer; ctx->Driver.SetReadBuffer = mgaDDSetReadBuffer; @@ -1182,4 +1172,3 @@ void mgaDDInitStateFuncs( GLcontext *ctx ) ctx->Driver.ClearIndex = 0; ctx->Driver.IndexMask = 0; } - diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c index 629dbfed1..e057dc50c 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatex.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.c @@ -15,9 +15,9 @@ * 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 - * WITTAWAT YAMWONG, 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 + * WITTAWAT YAMWONG, 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. * * @@ -25,7 +25,7 @@ * 9/20/99 rewrite by John Carmack <johnc@idsoftware.com> * 13/1/00 port to DRI by Keith Whitwell <keithw@precisioninsight.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.8 2001/01/08 01:07:18 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.9 2001/03/21 16:14:22 dawes Exp $ */ #include <stdlib.h> #include <stdio.h> @@ -37,9 +37,11 @@ #include "mgaregs.h" #include "mgaioctl.h" +#include "context.h" #include "enums.h" #include "simple_list.h" #include "mem.h" +#include "texutil.h" #define TEX_0 1 #define TEX_1 2 @@ -49,11 +51,11 @@ * Free all memory associated with a texture and NULL any pointers * to it. */ -void -mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t ) +void +mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t ) { if ( !t ) return; - + /* free the texture memory */ if (t->MemBlock) { mmFreeMem( t->MemBlock ); @@ -62,15 +64,15 @@ mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t ) if (t->age > mmesa->dirtyAge) mmesa->dirtyAge = t->age; } - - /* free mesa's link */ - if (t->tObj) + + /* free mesa's link */ + if (t->tObj) t->tObj->DriverData = NULL; /* see if it was the driver's current object */ - if (t->bound & TEX_0) mmesa->CurrentTexObj[0] = 0; - if (t->bound & TEX_1) mmesa->CurrentTexObj[1] = 0; - + if (t->bound & TEX_0) mmesa->CurrentTexObj[0] = 0; + if (t->bound & TEX_1) mmesa->CurrentTexObj[1] = 0; + remove_from_list(t); FREE( t ); } @@ -80,26 +82,26 @@ mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t ) * mgaSetTexWrappings */ static void mgaSetTexWrapping( mgaTextureObjectPtr t, - GLenum sWrap, - GLenum tWrap ) + GLenum sWrap, + GLenum tWrap ) { GLuint val = 0; - if (sWrap != GL_REPEAT) + if (sWrap != GL_REPEAT) val |= TMC_clampu_enable; - - if (tWrap != GL_REPEAT) + + if (tWrap != GL_REPEAT) val |= TMC_clampv_enable; - t->Setup[MGA_TEXREG_CTL] &= ~(TMC_clampu_enable|TMC_clampv_enable); - t->Setup[MGA_TEXREG_CTL] |= val; + t->setup.texctl &= ~(TMC_clampu_enable|TMC_clampv_enable); + t->setup.texctl |= val; } /* * mgaSetTexFilter */ -static void mgaSetTexFilter(mgaTextureObjectPtr t, GLenum minf, GLenum magf) +static void mgaSetTexFilter(mgaTextureObjectPtr t, GLenum minf, GLenum magf) { GLuint val = 0; @@ -118,9 +120,9 @@ static void mgaSetTexFilter(mgaTextureObjectPtr t, GLenum minf, GLenum magf) case GL_LINEAR: val |= TF_magfilter_bilin; break; default: val |= TF_magfilter_nrst; break; } - + /* See OpenGL 1.2 specification */ - if (magf == GL_LINEAR && (minf == GL_NEAREST_MIPMAP_NEAREST || + if (magf == GL_LINEAR && (minf == GL_NEAREST_MIPMAP_NEAREST || minf == GL_NEAREST_MIPMAP_LINEAR)) { val |= (0x20 << TF_fthres_SHIFT); /* c = 0.5 */ } else { @@ -128,27 +130,182 @@ static void mgaSetTexFilter(mgaTextureObjectPtr t, GLenum minf, GLenum magf) } - t->Setup[MGA_TEXREG_FILTER] &= (TF_minfilter_MASK | - TF_magfilter_MASK | - TF_fthres_MASK); - t->Setup[MGA_TEXREG_FILTER] |= val; + t->setup.texfilter &= (TF_minfilter_MASK | + TF_magfilter_MASK | + TF_fthres_MASK); + t->setup.texfilter |= val; } /* * mgaSetTexBorderColor */ -static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4]) +static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4]) { - t->Setup[MGA_TEXREG_BORDERCOL] = MGAPACKCOLOR8888(color[0],color[1], - color[2],color[3]); + t->setup.texbordercol = MGAPACKCOLOR8888(color[0],color[1], + color[2],color[3]); } +static GLint mgaChooseTexFormat( mgaContextPtr mmesa, + struct gl_texture_image *texImage, + GLenum format, GLenum type ) +{ + const GLboolean do32bpt = mmesa->default32BitTextures; + const struct gl_texture_format *texFormat; + GLint ret; + + if ( 0 ) + fprintf( stderr, "internal=%s format=%s type=%s\n", + texImage->IntFormat == 3 ? "GL_RGB (3)" : + texImage->IntFormat == 4 ? "GL_RGBA (4)" : + gl_lookup_enum_by_nr( texImage->IntFormat ), + gl_lookup_enum_by_nr( format ), + gl_lookup_enum_by_nr( type ) ); + +#define SET_FORMAT( r, gl ) \ + do { \ + ret = (r); \ + texFormat = &(gl); \ + } while (0) + +#define SET_FORMAT_32BPT( r32, gl32, r16, gl16 ) \ + do { \ + if ( do32bpt ) { \ + ret = (r32); \ + texFormat = &(gl32); \ + } else { \ + ret = (r16); \ + texFormat = &(gl16); \ + } \ + } while (0) + + switch ( texImage->IntFormat ) { + /* GH: Bias towards GL_RGB, GL_RGBA texture formats. This has + * got to be better than sticking them way down the end of this + * huge list. + */ + case GL_RGBA: + case 4: + if ( format == GL_BGRA ) { + if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) { + SET_FORMAT( TMC_tformat_tw32, _mesa_texformat_argb8888 ); + break; + } else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { + SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 ); + break; + } else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { + SET_FORMAT( TMC_tformat_tw15, _mesa_texformat_argb1555 ); + break; + } + } + SET_FORMAT_32BPT( TMC_tformat_tw32, _mesa_texformat_argb8888, + TMC_tformat_tw12, _mesa_texformat_argb4444 ); + break; + + case GL_RGB: + case 3: + if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) { + SET_FORMAT( TMC_tformat_tw16, _mesa_texformat_rgb565 ); + break; + } + SET_FORMAT_32BPT( TMC_tformat_tw32, _mesa_texformat_argb8888, + TMC_tformat_tw16, _mesa_texformat_rgb565 ); + break; + + /* GH: Okay, keep checking as normal. Still test for GL_RGB, + * GL_RGBA formats first. + */ + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + SET_FORMAT_32BPT( TMC_tformat_tw32, _mesa_texformat_argb8888, + TMC_tformat_tw12, _mesa_texformat_argb4444 ); + break; + + case GL_RGBA4: + case GL_RGBA2: + SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 ); + break; + + case GL_RGB5_A1: + SET_FORMAT( TMC_tformat_tw15, _mesa_texformat_argb1555 ); + break; + + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + SET_FORMAT_32BPT( TMC_tformat_tw32, _mesa_texformat_argb8888, + TMC_tformat_tw16, _mesa_texformat_rgb565 ); + break; + + case GL_RGB5: + case GL_RGB4: + case GL_R3_G3_B2: + SET_FORMAT( TMC_tformat_tw16, _mesa_texformat_rgb565 ); + break; + + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + /* FIXME: This will report incorrect component sizes... */ + SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 ); + break; + + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + /* FIXME: This will report incorrect component sizes... */ + SET_FORMAT( TMC_tformat_tw16, _mesa_texformat_rgb565 ); + break; + + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + /* FIXME: This will report incorrect component sizes... */ + SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 ); + break; + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + /* FIXME: This will report incorrect component sizes... */ + SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 ); + break; + case GL_COLOR_INDEX: + case GL_COLOR_INDEX1_EXT: + case GL_COLOR_INDEX2_EXT: + case GL_COLOR_INDEX4_EXT: + case GL_COLOR_INDEX8_EXT: + case GL_COLOR_INDEX12_EXT: + case GL_COLOR_INDEX16_EXT: + SET_FORMAT( TMC_tformat_tw8, _mesa_texformat_ci8 ); + break; + default: + fprintf( stderr, "bad texture format in mgaChooseTexFormat() %d", + texImage->IntFormat ); + return -1; + } + texImage->TexFormat = texFormat; + return ret; +} /* @@ -157,64 +314,31 @@ static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4]) * This will happen before drawing with a new texture, or drawing with a * texture after it was swapped out or teximaged again. */ -static void mgaCreateTexObj(mgaContextPtr mmesa, - struct gl_texture_object *tObj) +static void mgaCreateTexObj(mgaContextPtr mmesa, + struct gl_texture_object *tObj) { - const struct gl_texture_image *image = tObj->Image[ 0 ]; + const GLint baseLevel = tObj->BaseLevel; + struct gl_texture_image *image = tObj->Image[baseLevel]; mgaTextureObjectPtr t; int i, ofs; int LastLevel; int s, s2; - int textureFormat; - + int tformat; if (!image) return; - tObj->DriverData = t = CALLOC( sizeof( *t ) ); if (!t) { fprintf(stderr, "mgaCreateTexObj: Failed to malloc mgaTextureObject\n" ); return; } - switch( image->Format ) { - case GL_RGB: - case GL_LUMINANCE: - if ( image->IntFormat != GL_RGB5 && ( image->IntFormat == GL_RGB8 || - mmesa->default32BitTextures ) ) { - t->texelBytes = 4; - textureFormat = TMC_tformat_tw32; - } else { - t->texelBytes = 2; - textureFormat = TMC_tformat_tw16; - } - break; - case GL_ALPHA: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - case GL_RGBA: - if ( image->IntFormat != GL_RGBA4 && ( image->IntFormat == GL_RGBA8 || - mmesa->default32BitTextures ) ) { - t->texelBytes = 4; - textureFormat = TMC_tformat_tw32; - } else { - t->texelBytes = 2; - textureFormat = TMC_tformat_tw12; - } - break; - case GL_COLOR_INDEX: - textureFormat = TMC_tformat_tw8; - t->texelBytes = 1; - break; - default: - fprintf(stderr, "mgaCreateTexObj: bad image->Format %x/%s\n", - image->Format, - gl_lookup_enum_by_nr(image->Format)); - FREE( t ); - tObj->DriverData = 0; - return; - } - + /* FIXME: Use the real DD interface... + */ + tformat = mgaChooseTexFormat( mmesa, image, image->Format, + GL_UNSIGNED_BYTE ); + t->texelBytes = image->TexFormat->TexelBytes; + /* We are going to upload all levels that are present, even if * later levels wouldn't be used by the current filtering mode. This * allows the filtering mode to change without forcing another upload @@ -223,7 +347,7 @@ static void mgaCreateTexObj(mgaContextPtr mmesa, LastLevel = MGA_TEX_MAXLEVELS-1; ofs = 0; - for ( i = 0 ; i <= LastLevel ; i++ ) { + for ( i = 0 ; i <= LastLevel ; i++ ) { if ( !tObj->Image[i] ) { LastLevel = i - 1; break; @@ -232,11 +356,10 @@ static void mgaCreateTexObj(mgaContextPtr mmesa, t->offsets[i] = ofs; t->dirty_images |= (1<<i); - ofs += ((MAX2( tObj->Image[i]->Width, 8 ) * - MAX2( tObj->Image[i]->Height, 8 ) * + ofs += ((MAX2( tObj->Image[i]->Width, 8 ) * + MAX2( tObj->Image[i]->Height, 8 ) * t->texelBytes) + 31) & ~31; } - t->totalSize = ofs; t->lastLevel = LastLevel; t->tObj = tObj; @@ -246,49 +369,47 @@ static void mgaCreateTexObj(mgaContextPtr mmesa, t->MemBlock = 0; insert_at_tail(&(mmesa->SwappedOut), t); - - /* setup hardware register values */ - t->Setup[MGA_TEXREG_CTL] = (TMC_takey_1 | - TMC_tamask_0 | - textureFormat ); - if (image->WidthLog2 >= 3) - t->Setup[MGA_TEXREG_CTL] |= ((image->WidthLog2 - 3) << TMC_tpitch_SHIFT); - else - t->Setup[MGA_TEXREG_CTL] |= (TMC_tpitchlin_enable | - (image->Width << TMC_tpitchext_SHIFT)); + /* setup hardware register values */ + t->setup.texctl = TMC_takey_1 | TMC_tamask_0 | tformat; + if (image->WidthLog2 >= 3) + t->setup.texctl |= ((image->WidthLog2 - 3) << TMC_tpitch_SHIFT); + else + t->setup.texctl |= (TMC_tpitchlin_enable | + (image->Width << TMC_tpitchext_SHIFT)); - t->Setup[MGA_TEXREG_CTL2] = TMC_ckstransdis_enable; - if ( mmesa->glCtx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ) - t->Setup[MGA_TEXREG_CTL2] |= TMC_specen_enable; + t->setup.texctl2 = TMC_ckstransdis_enable; + + if ( mmesa->glCtx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ) + t->setup.texctl2 |= TMC_specen_enable; + + + t->setup.texfilter = (TF_minfilter_nrst | + TF_magfilter_nrst | + TF_filteralpha_enable | + (0x10 << TF_fthres_SHIFT) | + (LastLevel << TF_mapnb_SHIFT)); - - t->Setup[MGA_TEXREG_FILTER] = (TF_minfilter_nrst | - TF_magfilter_nrst | - TF_filteralpha_enable | - (0x10 << TF_fthres_SHIFT) | - (LastLevel << TF_mapnb_SHIFT)); - /* warp texture registers */ ofs = MGA_IS_G200(mmesa) ? 28 : 11; s = image->Width; s2 = image->WidthLog2; - t->Setup[MGA_TEXREG_WIDTH] = (MGA_FIELD(TW_twmask, s - 1) | - MGA_FIELD(TW_rfw, (10 - s2 - 8) & 63 ) | - MGA_FIELD(TW_tw, (s2 + ofs ) | 0x40 )); + t->setup.texwidth = (MGA_FIELD(TW_twmask, s - 1) | + MGA_FIELD(TW_rfw, (10 - s2 - 8) & 63 ) | + MGA_FIELD(TW_tw, (s2 + ofs ) | 0x40 )); + - s = image->Height; s2 = image->HeightLog2; - t->Setup[MGA_TEXREG_HEIGHT] = (MGA_FIELD(TH_thmask, s - 1) | - MGA_FIELD(TH_rfh, (10 - s2 - 8) & 63 ) | - MGA_FIELD(TH_th, (s2 + ofs ) | 0x40 )); + t->setup.texheight = (MGA_FIELD(TH_thmask, s - 1) | + MGA_FIELD(TH_rfh, (10 - s2 - 8) & 63 ) | + MGA_FIELD(TH_th, (s2 + ofs ) | 0x40 )); - /* set all the register values for filtering, border, etc */ + /* set all the register values for filtering, border, etc */ mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT ); mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); mgaSetTexBorderColor( t, tObj->BorderColor ); @@ -309,13 +430,13 @@ static void mgaUpdateTextureEnvG200( GLcontext *ctx ) switch (ctx->Texture.Unit[0].EnvMode) { case GL_REPLACE: - t->Setup[MGA_TEXREG_CTL] &= ~TMC_tmodulate_enable; + t->setup.texctl &= ~TMC_tmodulate_enable; break; case GL_MODULATE: - t->Setup[MGA_TEXREG_CTL] |= TMC_tmodulate_enable; + t->setup.texctl |= TMC_tmodulate_enable; break; case GL_DECAL: - t->Setup[MGA_TEXREG_CTL] &= ~TMC_tmodulate_enable; + t->setup.texctl &= ~TMC_tmodulate_enable; break; case GL_BLEND: t->ctx->Fallback |= MGA_FALLBACK_TEXTURE; @@ -328,106 +449,195 @@ static void mgaUpdateTextureEnvG200( GLcontext *ctx ) static void mgaUpdateTextureEnvG400( GLcontext *ctx, int unit ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); - GLuint *reg = &mmesa->Setup[MGA_CTXREG_TDUAL0 + unit]; + GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit); GLuint source = mmesa->tmu_source[unit]; struct gl_texture_object *tObj = ctx->Texture.Unit[source].Current; + GLenum format; - if ( tObj != ctx->Texture.Unit[source].CurrentD[2] || - !tObj || - !tObj->Complete || - ((ctx->Enabled>>(source*4))&TEXTURE0_ANY) != TEXTURE0_2D ) + if ( tObj != ctx->Texture.Unit[source].CurrentD[2] || + !tObj || + !tObj->Complete || + ((ctx->Enabled>>(source*4))&TEXTURE0_ANY) != TEXTURE0_2D ) return; - + + format = tObj->Image[tObj->BaseLevel]->Format; switch (ctx->Texture.Unit[source].EnvMode) { case GL_REPLACE: - *reg = (TD0_color_sel_arg1 | - TD0_alpha_sel_arg1 ); + if (format == GL_RGB || format == GL_LUMINANCE) { + *reg = (TD0_color_sel_arg1 | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg2 ); + } + else if (format == GL_ALPHA) { + *reg = (TD0_color_sel_arg2 | + TD0_color_arg2_diffuse | + TD0_alpha_sel_arg1 ); + } + else { + *reg = (TD0_color_sel_arg1 | + TD0_alpha_sel_arg1 ); + } break; case GL_MODULATE: - if (unit == 0) + if (unit == 0) { *reg = ( TD0_color_arg2_diffuse | - TD0_color_sel_mul | + TD0_color_sel_mul | TD0_alpha_arg2_diffuse | TD0_alpha_sel_mul); - else + } + else { *reg = ( TD0_color_arg2_prevstage | TD0_color_alpha_prevstage | - TD0_color_sel_mul | + TD0_color_sel_mul | TD0_alpha_arg2_prevstage | TD0_alpha_sel_mul); + } break; case GL_DECAL: - if (tObj->Image[0]->Format == GL_RGB) - *reg = (TD0_color_sel_arg1 | - TD0_alpha_sel_arg1 ); - else if (unit == 0) - *reg = (TD0_color_arg2_diffuse | - TD0_color_alpha_currtex | - TD0_color_alpha2inv_enable | - TD0_color_arg2mul_alpha2 | - TD0_color_arg1mul_alpha1 | - TD0_color_add_add | - TD0_color_sel_add | - TD0_alpha_arg2_diffuse | - TD0_alpha_sel_arg2 ); - else - *reg = (TD0_color_arg2_prevstage | - TD0_color_alpha_currtex | - TD0_color_alpha2inv_enable | - TD0_color_arg2mul_alpha2 | - TD0_color_arg1mul_alpha1 | - TD0_color_add_add | - TD0_color_sel_add | - TD0_alpha_arg2_prevstage | - TD0_alpha_sel_arg2 ); - + if (format == GL_RGB) { + if (unit == 0) { + *reg = (TD0_color_sel_arg1 | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg2 ); + } + else { + *reg = (TD0_color_sel_arg1 | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2 ); + } + } + else if ( format == GL_RGBA ) { +#if 0 + if (unit == 0) { + /* this doesn't work */ + *reg = (TD0_color_arg2_diffuse | + TD0_color_alpha_currtex | + TD0_color_alpha2inv_enable | + TD0_color_arg2mul_alpha2 | + TD0_color_arg1mul_alpha1 | + TD0_color_blend_enable | + TD0_color_arg1add_mulout | + TD0_color_arg2add_mulout | + TD0_color_add_add | + TD0_color_sel_mul | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg2 ); + } + else { + *reg = (TD0_color_arg2_prevstage | + TD0_color_alpha_currtex | + TD0_color_alpha2inv_enable | + TD0_color_arg2mul_alpha2 | + TD0_color_arg1mul_alpha1 | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2 ); + } +#else + /* s/w fallback, pretty sure we can't do in h/w */ + mmesa->Fallback |= MGA_FALLBACK_TEXTURE; +#endif + } + else { + if (unit == 0) { + *reg = ( TD0_color_arg2_diffuse | + TD0_color_sel_arg2 | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg2); + } + else { + *reg = ( TD0_color_arg2_prevstage | + TD0_color_sel_arg2 | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2); + } + } break; case GL_ADD: - if (unit == 0) - *reg = ( TD0_color_arg2_diffuse | - TD0_color_add_add | - TD0_color_sel_add | - TD0_alpha_arg2_diffuse | - TD0_alpha_sel_add); - else - *reg = ( TD0_color_arg2_prevstage | - TD0_color_alpha_prevstage | - TD0_color_add_add | - TD0_color_sel_add | - TD0_alpha_arg2_prevstage | - TD0_alpha_sel_add); + if (unit == 0) { + if (format == GL_INTENSITY) + *reg = ( TD0_color_arg2_diffuse | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_diffuse | + TD0_alpha_add_enable | + TD0_alpha_sel_add); + else if (format == GL_ALPHA) + *reg = ( TD0_color_arg2_diffuse | + TD0_color_sel_mul | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul); + else + *reg = ( TD0_color_arg2_diffuse | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_mul); + } + else { + if (format == GL_INTENSITY) { + *reg = ( TD0_color_arg2_prevstage | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_add_enable | + TD0_alpha_sel_add); + } + else if (format == GL_ALPHA) { + *reg = ( TD0_color_arg2_prevstage | + TD0_color_sel_mul | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_mul); + } + else { + *reg = ( TD0_color_arg2_prevstage | + TD0_color_alpha_prevstage | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_mul); + } + } break; case GL_BLEND: - if (mmesa->blend_flags) - mmesa->Fallback |= MGA_FALLBACK_TEXTURE; - - /* Do singletexture GL_BLEND with 'all ones' env-color - * by using both texture units. Multitexture gl_blend - * is a fallback. - */ - if (unit == 0) { - /* Part 1: R1 = Rf ( 1 - Rt ) - * A1 = Af At - */ + if (format == GL_ALPHA) { *reg = ( TD0_color_arg2_diffuse | - TD0_color_arg1_inv_enable | - TD0_color_sel_mul | + TD0_color_sel_mul | TD0_alpha_arg2_diffuse | - TD0_alpha_sel_arg1); - } else { - /* Part 2: R2 = R1 + Rt - * A2 = A1 - */ - *reg = ( TD0_color_arg2_prevstage | - TD0_color_add_add | - TD0_color_sel_add | - TD0_alpha_arg2_prevstage | - TD0_alpha_sel_arg2); - } + TD0_alpha_sel_mul); + } + else { + mmesa->Fallback |= MGA_FALLBACK_TEXTURE; + + /* Do singletexture GL_BLEND with 'all ones' env-color + * by using both texture units. Multitexture gl_blend + * is a fallback. + */ + if (unit == 0) { + /* Part 1: R1 = Rf ( 1 - Rt ) + * A1 = Af At + */ + *reg = ( TD0_color_arg2_diffuse | + TD0_color_arg1_inv_enable | + TD0_color_sel_mul | + TD0_alpha_arg2_diffuse | + TD0_alpha_sel_arg1); + } else { + /* Part 2: R2 = R1 + Rt + * A2 = A1 + */ + *reg = ( TD0_color_arg2_prevstage | + TD0_color_add_add | + TD0_color_sel_add | + TD0_alpha_arg2_prevstage | + TD0_alpha_sel_arg2); + } + } break; default: break; @@ -436,7 +646,7 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, int unit ) -static void mgaUpdateTextureObject( GLcontext *ctx, int unit ) +static void mgaUpdateTextureObject( GLcontext *ctx, int unit ) { mgaTextureObjectPtr t; struct gl_texture_object *tObj; @@ -459,6 +669,11 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int unit ) return; } + if (tObj->Image[tObj->BaseLevel]->Border > 0) { + mmesa->Fallback |= MGA_FALLBACK_TEXTURE; + return; + } + /* if (!tObj) tObj = ctx->Texture.Unit[0].Current; */ /* if (!tObj) return; */ @@ -466,13 +681,13 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int unit ) mgaCreateTexObj( mmesa, tObj ); if ( !tObj->DriverData ) { mmesa->Fallback |= MGA_FALLBACK_TEXTURE; - return; + return; } } t = (mgaTextureObjectPtr)tObj->DriverData; - if (t->dirty_images) + if (t->dirty_images) mmesa->dirty |= (MGA_UPLOAD_TEX0IMAGE << unit); mmesa->CurrentTexObj[unit] = t; @@ -481,13 +696,13 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int unit ) /* if (t->MemBlock) */ /* mgaUpdateTexLRU( mmesa, t ); */ - t->Setup[MGA_TEXREG_CTL2] &= ~TMC_dualtex_enable; - if (mmesa->multitex) - t->Setup[MGA_TEXREG_CTL2] |= TMC_dualtex_enable; + t->setup.texctl2 &= ~TMC_dualtex_enable; + if (mmesa->multitex) + t->setup.texctl2 |= TMC_dualtex_enable; - t->Setup[MGA_TEXREG_CTL2] &= ~TMC_specen_enable; + t->setup.texctl2 &= ~TMC_specen_enable; if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) - t->Setup[MGA_TEXREG_CTL2] |= TMC_specen_enable; + t->setup.texctl2 |= TMC_specen_enable; } @@ -509,45 +724,45 @@ void mgaUpdateTextureState( GLcontext *ctx ) if (mmesa->CurrentTexObj[1]) { mmesa->CurrentTexObj[1]->bound = 0; - mmesa->CurrentTexObj[1] = 0; + mmesa->CurrentTexObj[1] = 0; } if (MGA_IS_G400(mmesa)) { - mgaUpdateTextureObject( ctx, 0 ); + mgaUpdateTextureObject( ctx, 0 ); mgaUpdateTextureEnvG400( ctx, 0 ); - mmesa->Setup[MGA_CTXREG_TDUAL1] = mmesa->Setup[MGA_CTXREG_TDUAL0]; + mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0; if (mmesa->multitex || 1) { - mgaUpdateTextureObject( ctx, 1 ); + mgaUpdateTextureObject( ctx, 1 ); mgaUpdateTextureEnvG400( ctx, 1 ); - } + } /* else */ /* mmesa->Setup[MGA_CTXREG_TDUAL1] = ( TD0_color_arg2_prevstage | */ /* TD0_color_sel_arg2 | */ /* TD0_alpha_arg2_prevstage | */ /* TD0_alpha_sel_arg2); */ - + mmesa->dirty |= MGA_UPLOAD_TEX1; } else { mgaUpdateTextureObject( ctx, 0 ); - mgaUpdateTextureEnvG200( ctx ); + mgaUpdateTextureEnvG200( ctx ); } - mmesa->dirty |= MGA_UPLOAD_CTX | MGA_UPLOAD_TEX0; + mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_TEX0; - mmesa->Setup[MGA_CTXREG_DWGCTL] &= DC_opcod_MASK; - mmesa->Setup[MGA_CTXREG_DWGCTL] |= (ctx->Texture.ReallyEnabled - ? DC_opcod_texture_trap - : DC_opcod_trap); + mmesa->setup.dwgctl &= DC_opcod_MASK; + mmesa->setup.dwgctl |= (ctx->Texture.ReallyEnabled + ? DC_opcod_texture_trap + : DC_opcod_trap); } -static void mgaDDTexEnv( GLcontext *ctx, GLenum target, - GLenum pname, const GLfloat *param ) +static void mgaDDTexEnv( GLcontext *ctx, GLenum target, + GLenum pname, const GLfloat *param ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -555,31 +770,31 @@ static void mgaDDTexEnv( GLcontext *ctx, GLenum target, if (pname == GL_TEXTURE_ENV_MODE) { /* force the texture state to be updated */ FLUSH_BATCH( MGA_CONTEXT(ctx) ); - MGA_CONTEXT(ctx)->new_state |= (MGA_NEW_TEXTURE | + MGA_CONTEXT(ctx)->new_state |= (MGA_NEW_TEXTURE | MGA_NEW_ALPHA); } else if (pname == GL_TEXTURE_ENV_COLOR) { - struct gl_texture_unit *texUnit = + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; GLfloat *fc = texUnit->EnvColor; GLubyte c[4]; GLuint col; - + COPY_4V(c, fc); col = mgaPackColor( mmesa->mgaScreen->cpp, c[0], c[1], c[2], c[3] ); - mmesa->envcolor = (c[3]<<24) | (c[0]<<16) | (c[1]<<8) | (c[2]); - - if (mmesa->Setup[MGA_CTXREG_FCOL] != col) { - FLUSH_BATCH(mmesa); - mmesa->Setup[MGA_CTXREG_FCOL] = col; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->envcolor = (c[3]<<24) | (c[0]<<16) | (c[1]<<8) | (c[2]); + + if (mmesa->setup.fcol != col) { + FLUSH_BATCH(mmesa); + mmesa->setup.fcol = col; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; mmesa->blend_flags &= ~MGA_BLEND_ENV_COLOR; /* Actually just require all four components to be * equal. This permits a single-pass GL_BLEND. - * + * * More complex multitexture/multipass fallbacks * for blend can be done later. */ @@ -593,13 +808,16 @@ static void mgaDDTexEnv( GLcontext *ctx, GLenum target, static void mgaDDTexImage( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, - const struct gl_texture_image *image ) + const struct gl_texture_image *image ) { - mgaContextPtr mmesa = MGA_CONTEXT( ctx ); + mgaContextPtr mmesa = MGA_CONTEXT( ctx ); mgaTextureObjectPtr t; + GLint tformat; + /* hack: cast-away const */ + struct gl_texture_image *img = (struct gl_texture_image *) image; /* just free the mga texture if it exists, it will be recreated at - mgaUpdateTextureState time. */ + mgaUpdateTextureState time. */ t = (mgaTextureObjectPtr) tObj->DriverData; if ( t ) { if (t->bound) FLUSH_BATCH(mmesa); @@ -608,10 +826,13 @@ static void mgaDDTexImage( GLcontext *ctx, GLenum target, mmesa->new_state |= MGA_NEW_TEXTURE; } + tformat = mgaChooseTexFormat( mmesa, img, img->Format, + GL_UNSIGNED_BYTE ); + if (0) fprintf(stderr, "mgaDDTexImage tObj %p, level %d, image %p\n", tObj, level, image); - + } static void mgaDDTexSubImage( GLcontext *ctx, GLenum target, @@ -619,20 +840,30 @@ static void mgaDDTexSubImage( GLcontext *ctx, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLint internalFormat, - const struct gl_texture_image *image ) + const struct gl_texture_image *image ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); mgaTextureObjectPtr t; t = (mgaTextureObjectPtr) tObj->DriverData; - if (t) { + + + /* just free the mga texture if it exists, it will be recreated at + mgaUpdateTextureState time. */ + t = (mgaTextureObjectPtr) tObj->DriverData; + if ( t ) { if (t->bound) FLUSH_BATCH(mmesa); - LOCK_HARDWARE( mmesa ); - /* the texture currently exists, so directly update it */ - mgaUploadSubImageLocked( mmesa, t, level, - xoffset, yoffset, width, height ); - UNLOCK_HARDWARE( mmesa ); + /* if this is the current object, it will force an update */ + mgaDestroyTexObj( mmesa, t ); + mmesa->new_state |= MGA_NEW_TEXTURE; } + + + +#if 0 + /* the texture currently exists, so directly update it */ + mgaUploadSubImage( t, level, xoffset, yoffset, width, height ); +#endif } @@ -642,7 +873,7 @@ static void mgaDDTexSubImage( GLcontext *ctx, GLenum target, * This just changes variables and flags for a state update, which * will happen at the next mgaUpdateTextureState */ -static void +static void mgaDDTexParameter( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) @@ -671,7 +902,7 @@ mgaDDTexParameter( GLcontext *ctx, GLenum target, FLUSH_BATCH(mmesa); mgaSetTexWrapping(t,tObj->WrapS,tObj->WrapT); break; - + case GL_TEXTURE_BORDER_COLOR: FLUSH_BATCH(mmesa); mgaSetTexBorderColor(t,tObj->BorderColor); @@ -685,9 +916,9 @@ mgaDDTexParameter( GLcontext *ctx, GLenum target, } -static void +static void mgaDDBindTexture( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj ) + struct gl_texture_object *tObj ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); int unit = ctx->Texture.CurrentUnit; @@ -696,17 +927,17 @@ mgaDDBindTexture( GLcontext *ctx, GLenum target, if (mmesa->CurrentTexObj[unit]) { mmesa->CurrentTexObj[unit]->bound &= ~(unit+1); - mmesa->CurrentTexObj[unit] = 0; + mmesa->CurrentTexObj[unit] = 0; } - /* force the texture state to be updated + /* force the texture state to be updated */ MGA_CONTEXT(ctx)->new_state |= MGA_NEW_TEXTURE; } -static void -mgaDDDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) +static void +mgaDDDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) { mgaContextPtr mmesa = MGA_CONTEXT( ctx ); mgaTextureObjectPtr t = (mgaTextureObjectPtr)tObj->DriverData; @@ -725,15 +956,15 @@ mgaDDDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) } -static GLboolean -mgaDDIsTextureResident( GLcontext *ctx, struct gl_texture_object *t ) +static GLboolean +mgaDDIsTextureResident( GLcontext *ctx, struct gl_texture_object *t ) { mgaTextureObjectPtr mt = (mgaTextureObjectPtr)t->DriverData; return mt && mt->MemBlock; } -void +void mgaDDInitTextureFuncs( GLcontext *ctx ) { ctx->Driver.TexEnv = mgaDDTexEnv; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c index 2390429d0..04f1cb10d 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexmem.c,v 1.2 2001/01/08 01:07:19 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexmem.c,v 1.3 2001/03/21 16:14:22 dawes Exp $ */ #include <stdlib.h> #include <stdio.h> @@ -13,12 +13,12 @@ #include "mem.h" #include "simple_list.h" -static void +static void mgaSwapOutTexObj(mgaContextPtr mmesa, mgaTextureObjectPtr t) { if (t->MemBlock) { mmFreeMem(t->MemBlock); - t->MemBlock = 0; + t->MemBlock = 0; if (t->age > mmesa->dirtyAge) mmesa->dirtyAge = t->age; @@ -28,8 +28,8 @@ mgaSwapOutTexObj(mgaContextPtr mmesa, mgaTextureObjectPtr t) move_to_tail(&(mmesa->SwappedOut), t); } -static void -mgaPrintLocalLRU( mgaContextPtr mmesa, int heap ) +static void +mgaPrintLocalLRU( mgaContextPtr mmesa, int heap ) { mgaTextureObjectPtr t; int sz = 1 << (mmesa->mgaScreen->logTextureGranularity[heap]); @@ -38,12 +38,12 @@ mgaPrintLocalLRU( mgaContextPtr mmesa, int heap ) foreach( t, &(mmesa->TexObjList[heap]) ) { if (!t->tObj) - fprintf(stderr, "Placeholder %d at %x sz %x\n", + fprintf(stderr, "Placeholder %d at %x sz %x\n", t->MemBlock->ofs / sz, t->MemBlock->ofs, - t->MemBlock->size); + t->MemBlock->size); else - fprintf(stderr, "Texture (bound %d) at %x sz %x\n", + fprintf(stderr, "Texture (bound %d) at %x sz %x\n", t->bound, t->MemBlock->ofs, t->MemBlock->size); @@ -52,11 +52,11 @@ mgaPrintLocalLRU( mgaContextPtr mmesa, int heap ) fprintf(stderr, "\n\n"); } -static void +static void mgaPrintGlobalLRU( mgaContextPtr mmesa, int heap ) { int i, j; - drm_mga_tex_region_t *list = mmesa->sarea->texList[heap]; + drmTextureRegion *list = mmesa->sarea->texList[heap]; fprintf(stderr, "\nGlobal LRU, heap %d list %p:\n", heap, list); @@ -66,7 +66,7 @@ mgaPrintGlobalLRU( mgaContextPtr mmesa, int heap ) j = list[j].next; if (j == MGA_NR_TEX_REGIONS) break; } - + if (j != MGA_NR_TEX_REGIONS) { fprintf(stderr, "Loop detected in global LRU\n\n\n"); for (i = 0 ; i < MGA_NR_TEX_REGIONS ; i++) { @@ -74,14 +74,14 @@ mgaPrintGlobalLRU( mgaContextPtr mmesa, int heap ) i, list[i].age, list[i].next, list[i].prev); } } - + fprintf(stderr, "\n\n"); } static void mgaResetGlobalLRU( mgaContextPtr mmesa, GLuint heap ) { - drm_mga_tex_region_t *list = mmesa->sarea->texList[heap]; + drmTextureRegion *list = mmesa->sarea->texList[heap]; int sz = 1 << mmesa->mgaScreen->logTextureGranularity[heap]; int i; @@ -93,12 +93,12 @@ static void mgaResetGlobalLRU( mgaContextPtr mmesa, GLuint heap ) * in the array (MGA_NR_TEX_REGIONS) is the sentinal. Keeping it * at the end of the array allows it to be addressed rationally * when looking up objects at a particular location in texture - * memory. + * memory. */ for (i = 0 ; (i+1) * sz <= mmesa->mgaScreen->textureSize[heap] ; i++) { list[i].prev = i-1; list[i].next = i+1; - list[i].age = mmesa->sarea->texAge[heap]; + list[i].age = mmesa->sarea->texAge[heap]; } i--; @@ -111,15 +111,15 @@ static void mgaResetGlobalLRU( mgaContextPtr mmesa, GLuint heap ) } -static void mgaUpdateTexLRU( mgaContextPtr mmesa, mgaTextureObjectPtr t ) +static void mgaUpdateTexLRU( mgaContextPtr mmesa, mgaTextureObjectPtr t ) { int i; int heap = t->heap; int logsz = mmesa->mgaScreen->logTextureGranularity[heap]; int start = t->MemBlock->ofs >> logsz; int end = (t->MemBlock->ofs + t->MemBlock->size - 1) >> logsz; - drm_mga_tex_region_t *list = mmesa->sarea->texList[heap]; - + drmTextureRegion *list = mmesa->sarea->texList[heap]; + mmesa->texAge[heap] = ++mmesa->sarea->texAge[heap]; if (!t->MemBlock) { @@ -147,7 +147,7 @@ static void mgaUpdateTexLRU( mgaContextPtr mmesa, mgaTextureObjectPtr t ) */ list[(unsigned)list[i].next].prev = list[i].prev; list[(unsigned)list[i].prev].next = list[i].next; - + /* insert_at_head(list, i) */ list[i].prev = MGA_NR_TEX_REGIONS; @@ -166,14 +166,14 @@ static void mgaUpdateTexLRU( mgaContextPtr mmesa, mgaTextureObjectPtr t ) * since we last held the lock. * * Figures out which of our textures have been ejected by other clients, - * and pushes a placeholder texture onto the LRU list to represent - * the other client's textures. + * and pushes a placeholder texture onto the LRU list to represent + * the other client's textures. */ static void mgaTexturesGone( mgaContextPtr mmesa, GLuint heap, - GLuint offset, + GLuint offset, GLuint size, - GLuint in_use ) + GLuint in_use ) { mgaTextureObjectPtr t, tmp; @@ -191,19 +191,19 @@ static void mgaTexturesGone( mgaContextPtr mmesa, /* It overlaps - kick it off. Need to hold onto the currently bound * objects, however. */ - if (t->bound) + if (t->bound) mgaSwapOutTexObj( mmesa, t ); else mgaDestroyTexObj( mmesa, t ); } - + if (in_use) { t = (mgaTextureObjectPtr) CALLOC(sizeof(*t)); if (!t) return; t->heap = heap; - t->MemBlock = mmAllocMem( mmesa->texHeap[heap], size, 0, offset); + t->MemBlock = mmAllocMem( mmesa->texHeap[heap], size, 0, offset); if (!t->MemBlock) { fprintf(stderr, "Couldn't alloc placeholder sz %x ofs %x\n", (int)size, (int)offset); @@ -217,15 +217,15 @@ static void mgaTexturesGone( mgaContextPtr mmesa, void mgaAgeTextures( mgaContextPtr mmesa, int heap ) { - drm_mga_sarea_t *sarea = mmesa->sarea; + MGASAREAPrivPtr sarea = mmesa->sarea; int sz = 1 << (mmesa->mgaScreen->logTextureGranularity[heap]); int idx, nr = 0; /* Have to go right round from the back to ensure stuff ends up * LRU in our local list... Fix with a cursor pointer. */ - for (idx = sarea->texList[heap][MGA_NR_TEX_REGIONS].prev ; - idx != MGA_NR_TEX_REGIONS && nr < MGA_NR_TEX_REGIONS ; + for (idx = sarea->texList[heap][MGA_NR_TEX_REGIONS].prev ; + idx != MGA_NR_TEX_REGIONS && nr < MGA_NR_TEX_REGIONS ; idx = sarea->texList[heap][idx].prev, nr++) { if (sarea->texList[heap][idx].age > mmesa->texAge[heap]) { @@ -239,7 +239,7 @@ void mgaAgeTextures( mgaContextPtr mmesa, int heap ) mgaResetGlobalLRU( mmesa, heap ); } - + if (0) { mgaPrintGlobalLRU( mmesa, heap ); mgaPrintLocalLRU( mmesa, heap ); @@ -259,8 +259,8 @@ void mgaAgeTextures( mgaContextPtr mmesa, int heap ) */ void mgaUploadSubImageLocked( mgaContextPtr mmesa, mgaTextureObjectPtr t, - int level, - int x, int y, int width, int height ) + int level, + int x, int y, int width, int height ) { int x2; int dwords; @@ -268,7 +268,7 @@ void mgaUploadSubImageLocked( mgaContextPtr mmesa, struct gl_texture_image *image; int texelBytes, texelsPerDword, texelMaccess, length; - if ( level < 0 || level >= MGA_TEX_MAXLEVELS ) + if ( level < 0 || level >= MGA_TEX_MAXLEVELS ) return; image = t->tObj->Image[level]; @@ -280,14 +280,14 @@ void mgaUploadSubImageLocked( mgaContextPtr mmesa, t->tObj, level); return; } - - + + /* find the proper destination offset for this level */ - offset = (t->MemBlock->ofs + + offset = (t->MemBlock->ofs + t->offsets[level]); - texelBytes = t->texelBytes; + texelBytes = t->texelBytes; switch( texelBytes ) { case 1: texelsPerDword = 4; @@ -304,8 +304,8 @@ void mgaUploadSubImageLocked( mgaContextPtr mmesa, default: return; } - - + + /* We can't do a subimage update if pitch is < 32 texels due * to hardware XY addressing limits, so we will need to * linearly upload all modified rows. @@ -317,7 +317,7 @@ void mgaUploadSubImageLocked( mgaContextPtr mmesa, /* Assume that 1x1 textures aren't going to cause a * bus error if we read up to four texels from that - * location: + * location: */ /* if ( width < texelsPerDword ) { */ /* width = texelsPerDword; */ @@ -327,7 +327,7 @@ void mgaUploadSubImageLocked( mgaContextPtr mmesa, to the entire image, so we can safely reference outside the x,y,width,height bounds if we need to */ x2 = x + width; - x2 = (x2 + (texelsPerDword-1)) & ~(texelsPerDword-1); + x2 = (x2 + (texelsPerDword-1)) & ~(texelsPerDword-1); x = (x + (texelsPerDword-1)) & ~(texelsPerDword-1); width = x2 - x; } @@ -337,37 +337,37 @@ void mgaUploadSubImageLocked( mgaContextPtr mmesa, Recursively split it up. */ while ( 1 ) { dwords = height * width / texelsPerDword; - if ( dwords * 4 <= MGA_DMA_BUF_SZ ) { + if ( dwords * 4 <= MGA_BUFFER_SIZE ) { break; } - mgaUploadSubImageLocked( mmesa, t, level, x, y, + mgaUploadSubImageLocked( mmesa, t, level, x, y, width, height >> 1 ); y += ( height >> 1 ); height -= ( height >> 1 ); } - + length = dwords * 4; /* Fill in the secondary buffer with properly converted texels * from the mesa buffer. */ if(t->heap == MGA_CARD_HEAP) { mgaGetILoadBufferLocked( mmesa ); - mgaConvertTexture( (GLuint *)mmesa->iload_buffer->address, - texelBytes, image, x, y, width, height ); + mgaConvertTexture( (GLuint *)mmesa->iload_buffer->address, + texelBytes, image, x, y, width, height ); if(length < 64) length = 64; if (0) fprintf(stderr, "TexelBytes : %d, offset: %d, length : %d\n", texelBytes, mmesa->mgaScreen->textureOffset[t->heap] + - offset + + offset + y * width * 4/texelsPerDword, length); - - mgaFireILoadLocked( mmesa, + + mgaFireILoadLocked( mmesa, mmesa->mgaScreen->textureOffset[t->heap] + - offset + + offset + y * width * 4/texelsPerDword, length); } else { @@ -375,15 +375,15 @@ void mgaUploadSubImageLocked( mgaContextPtr mmesa, * additional synchronization with the dma stream. */ mgaConvertTexture( (GLuint *) - (mmesa->mgaScreen->texVirtual[t->heap] + - offset + - y * width * 4/texelsPerDword), - texelBytes, image, x, y, width, height ); + (mmesa->mgaScreen->texVirtual[t->heap] + + offset + + y * width * 4/texelsPerDword), + texelBytes, image, x, y, width, height ); } } -static void mgaUploadTexLevel( mgaContextPtr mmesa, +static void mgaUploadTexLevel( mgaContextPtr mmesa, mgaTextureObjectPtr t, int l ) { @@ -427,51 +427,51 @@ int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t ) { mgaTextureObjectPtr tmp = mmesa->TexObjList[heap].prev; - t->MemBlock = mmAllocMem( mmesa->texHeap[heap], + t->MemBlock = mmAllocMem( mmesa->texHeap[heap], t->totalSize, - 6, 0 ); + 6, 0 ); if (t->MemBlock) break; if (mmesa->TexObjList[heap].prev->bound) { - fprintf(stderr, "Hit bound texture in upload\n"); + fprintf(stderr, "Hit bound texture in upload\n"); return -1; } - if (mmesa->TexObjList[heap].prev == - &(mmesa->TexObjList[heap])) + if (mmesa->TexObjList[heap].prev == + &(mmesa->TexObjList[heap])) { fprintf(stderr, "Failed to upload texture, sz %d\n", t->totalSize); mmDumpMemInfo( mmesa->texHeap[heap] ); return -1; } - + mgaDestroyTexObj( mmesa, tmp ); } - - ofs = t->MemBlock->ofs + + ofs = t->MemBlock->ofs + mmesa->mgaScreen->textureOffset[heap] ; - t->Setup[MGA_TEXREG_ORG] = ofs; - t->Setup[MGA_TEXREG_ORG1] = ofs + t->offsets[1]; - t->Setup[MGA_TEXREG_ORG2] = ofs + t->offsets[2]; - t->Setup[MGA_TEXREG_ORG3] = ofs + t->offsets[3]; - t->Setup[MGA_TEXREG_ORG4] = ofs + t->offsets[4]; + t->setup.texorg = ofs; + t->setup.texorg1 = ofs + t->offsets[1]; + t->setup.texorg2 = ofs + t->offsets[2]; + t->setup.texorg3 = ofs + t->offsets[3]; + t->setup.texorg4 = ofs + t->offsets[4]; - mmesa->dirty |= MGA_UPLOAD_CTX; + mmesa->dirty |= MGA_UPLOAD_CONTEXT; } /* Let the world know we've used this memory recently. */ mgaUpdateTexLRU( mmesa, t ); - + if (MGA_DEBUG&DEBUG_VERBOSE_LRU) fprintf(stderr, "dispatch age: %d age freed memory: %d\n", GET_DISPATCH_AGE(mmesa), mmesa->dirtyAge); - if (mmesa->dirtyAge >= GET_DISPATCH_AGE(mmesa)) + if (mmesa->dirtyAge >= GET_DISPATCH_AGE(mmesa)) mgaWaitAgeLocked( mmesa, mmesa->dirtyAge ); if (t->dirty_images) { @@ -479,7 +479,7 @@ int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t ) fprintf(stderr, "*"); for (i = 0 ; i <= t->lastLevel ; i++) - if (t->dirty_images & (1<<i)) + if (t->dirty_images & (1<<i)) mgaUploadTexLevel( mmesa, t, i ); } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.c b/xc/lib/GL/mesa/src/drv/mga/mgatris.c index 4344003af..cd10daddd 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatris.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.c @@ -23,7 +23,7 @@ * * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.c,v 1.6 2001/01/08 01:07:19 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.c,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ #include <stdio.h> #include <math.h> @@ -38,25 +38,6 @@ #include "mgavb.h" -static void mga_null_quad( GLcontext *ctx, GLuint v0, - GLuint v1, GLuint v2, GLuint v3, GLuint pv ) -{ -} - -static void mga_null_triangle( GLcontext *ctx, GLuint v0, - GLuint v1, GLuint v2, GLuint pv ) -{ -} - -static void mga_null_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ) -{ -} - -static void mga_null_points( GLcontext *ctx, GLuint first, GLuint last ) -{ -} - - #define MGA_COLOR(to, from) { \ (to)[0] = (from)[2]; \ (to)[1] = (from)[1]; \ @@ -64,6 +45,12 @@ static void mga_null_points( GLcontext *ctx, GLuint first, GLuint last ) (to)[3] = (from)[3]; \ } +#define MGA_COLOR3(to, from) { \ + (to)[0] = (from)[2]; \ + (to)[1] = (from)[1]; \ + (to)[2] = (from)[0]; \ +} + static triangle_func tri_tab[0x10]; @@ -106,9 +93,6 @@ static points_func points_tab[0x10]; void mgaDDTrifuncInit() { - int i; - - init(); init_flat(); init_offset(); @@ -117,14 +101,6 @@ void mgaDDTrifuncInit() init_twoside_flat(); init_twoside_offset(); init_twoside_offset_flat(); - - for (i = 0 ; i < 0x20 ; i++) - if (i & MGA_NODRAW_BIT) { - quad_tab[i] = mga_null_quad; - tri_tab[i] = mga_null_triangle; - line_tab[i] = mga_null_line; - points_tab[i] = mga_null_points; - } } @@ -134,7 +110,7 @@ void mgaDDTrifuncInit() #define LINE_FALLBACK (ALL_FALLBACK | DD_LINE_SMOOTH | DD_LINE_STIPPLE) #define TRI_FALLBACK (ALL_FALLBACK | DD_TRI_SMOOTH | DD_TRI_UNFILLED) #define ANY_FALLBACK (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|DD_TRI_STIPPLE) -#define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_Z_NEVER) +#define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET) /* Setup the Point, Line, Triangle and Quad functions based on the current rendering state. Wherever possible, use the hardware to @@ -147,6 +123,9 @@ void mgaDDChooseRenderState(GLcontext *ctx) if (mmesa->Fallback) { mmesa->renderindex = MGA_FALLBACK_BIT; + if (flags & DD_TRI_LIGHT_TWOSIDE) { + mmesa->IndirectTriangles = DD_TRI_LIGHT_TWOSIDE; + } return; } @@ -154,7 +133,6 @@ void mgaDDChooseRenderState(GLcontext *ctx) if (flags & DD_FLATSHADE) index |= MGA_FLAT_BIT; if (flags & DD_TRI_LIGHT_TWOSIDE) index |= MGA_TWOSIDE_BIT; if (flags & DD_TRI_OFFSET) index |= MGA_OFFSET_BIT; - if (flags & DD_Z_NEVER) index |= MGA_NODRAW_BIT; } mmesa->PointsFunc = points_tab[index]; @@ -194,6 +172,9 @@ void mgaDDChooseRenderState(GLcontext *ctx) mmesa->QuadFunc = 0; mmesa->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE); + if (flags & DD_TRI_LIGHT_TWOSIDE) { + mmesa->IndirectTriangles |= DD_TRI_LIGHT_TWOSIDE; + } } } } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.h b/xc/lib/GL/mesa/src/drv/mga/mgatris.h index 03f95ddf3..1015c6fdd 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatris.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.h @@ -23,7 +23,7 @@ * * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.h,v 1.6 2001/01/08 01:07:19 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.h,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ #ifndef MGATIS_INC #define MGATIS_INC @@ -38,8 +38,7 @@ extern void mgaDDTrifuncInit( void ); #define MGA_FLAT_BIT 0x1 #define MGA_OFFSET_BIT 0x2 #define MGA_TWOSIDE_BIT 0x4 -#define MGA_NODRAW_BIT 0x8 -#define MGA_FALLBACK_BIT 0x10 +#define MGA_FALLBACK_BIT 0x8 static __inline void mga_draw_triangle( mgaContextPtr mmesa, mgaVertex *v0, @@ -90,40 +89,42 @@ static __inline void mga_draw_point( mgaContextPtr mmesa, { GLuint vertsize = mmesa->vertsize; GLuint *wv = mgaAllocVertexDwords( mmesa, 6*vertsize); - int j; + GLuint j; + const GLfloat x = tmp->v.x + 0.125; + const GLfloat y = tmp->v.y - 0.125; - *(float *)&wv[0] = tmp->v.x - sz; - *(float *)&wv[1] = tmp->v.y - sz; + *(float *)&wv[0] = x - sz; + *(float *)&wv[1] = y - sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->v.x + sz; - *(float *)&wv[1] = tmp->v.y - sz; + *(float *)&wv[0] = x + sz; + *(float *)&wv[1] = y - sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->v.x + sz; - *(float *)&wv[1] = tmp->v.y + sz; + *(float *)&wv[0] = x + sz; + *(float *)&wv[1] = y + sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->v.x + sz; - *(float *)&wv[1] = tmp->v.y + sz; + *(float *)&wv[0] = x + sz; + *(float *)&wv[1] = y + sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->v.x - sz; - *(float *)&wv[1] = tmp->v.y + sz; + *(float *)&wv[0] = x - sz; + *(float *)&wv[1] = y + sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->v.x - sz; - *(float *)&wv[1] = tmp->v.y - sz; + *(float *)&wv[0] = x - sz; + *(float *)&wv[1] = y - sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; } @@ -134,55 +135,79 @@ static __inline void mga_draw_line( mgaContextPtr mmesa, const mgaVertex *tmp1, float width ) { - GLuint vertsize = mmesa->vertsize; + const GLuint vertsize = mmesa->vertsize; GLuint *wv = mgaAllocVertexDwords( mmesa, 6 * vertsize ); - float dx, dy, ix, iy; - int j; + GLuint j; + GLfloat x0 = tmp0->v.x; + GLfloat y0 = tmp0->v.y; + GLfloat x1 = tmp1->v.x; + GLfloat y1 = tmp1->v.y; + GLfloat dx, dy, ix, iy; + GLfloat hw; + + hw = 0.5F * width; + if (hw > 0.1F && hw < 0.5F) { + hw = 0.5F; + } + /* adjust vertices depending on line direction */ dx = tmp0->v.x - tmp1->v.x; dy = tmp0->v.y - tmp1->v.y; - - ix = width * .5; iy = 0; - - if ((ix<.5) && (ix>0.1)) ix = .5; /* I want to see lines with width - 0.5 also */ - if (dx * dx > dy * dy) { - iy = ix; ix = 0; + /* X-major line */ + ix = 0.0F; + iy = hw; + if (x1 < x0) { + x0 += 0.5F; + x1 += 0.5F; + } + y0 -= 0.5F; + y1 -= 0.5F; + } + else { + /* Y-major line */ + ix = hw; + iy = 0.0F; + if (y1 > y0) { + y0 -= 0.5F; + y1 -= 0.5F; + } + x0 += 0.5F; + x1 += 0.5F; } - - *(float *)&wv[0] = tmp0->v.x - ix; - *(float *)&wv[1] = tmp0->v.y - iy; + + *(float *)&wv[0] = x0 - ix; + *(float *)&wv[1] = y0 - iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp1->v.x + ix; - *(float *)&wv[1] = tmp1->v.y + iy; + *(float *)&wv[0] = x1 + ix; + *(float *)&wv[1] = y1 + iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp0->v.x + ix; - *(float *)&wv[1] = tmp0->v.y + iy; + *(float *)&wv[0] = x0 + ix; + *(float *)&wv[1] = y0 + iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp0->v.x - ix; - *(float *)&wv[1] = tmp0->v.y - iy; + *(float *)&wv[0] = x0 - ix; + *(float *)&wv[1] = y0 - iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp1->v.x - ix; - *(float *)&wv[1] = tmp1->v.y - iy; + *(float *)&wv[0] = x1 - ix; + *(float *)&wv[1] = y1 - iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp1->v.x + ix; - *(float *)&wv[1] = tmp1->v.y + iy; + *(float *)&wv[0] = x1 + ix; + *(float *)&wv[1] = y1 + iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h b/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h index f578871ce..50c9f4852 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatritmp.h,v 1.5 2000/12/05 21:18:34 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatritmp.h,v 1.6 2001/03/21 16:14:22 dawes Exp $ */ static __inline void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2, @@ -16,6 +16,7 @@ static __inline void TAG(triangle)(GLcontext *ctx, #if (IND & (MGA_TWOSIDE_BIT | MGA_FLAT_BIT)) GLuint c[3]; + GLuint s[3]; #endif v[0] = &mgaverts[e0]; @@ -26,6 +27,9 @@ static __inline void TAG(triangle)(GLcontext *ctx, c[0] = v[0]->ui[4]; c[1] = v[1]->ui[4]; c[2] = v[2]->ui[4]; + s[0] = v[0]->ui[5]; + s[1] = v[1]->ui[5]; + s[2] = v[2]->ui[5]; #endif @@ -41,13 +45,19 @@ static __inline void TAG(triangle)(GLcontext *ctx, { GLuint facing = (cc > 0.0) ^ ctx->Polygon.FrontBit; GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + GLubyte (*vbspec)[4] = VB->Spec[facing]; if (IND & MGA_FLAT_BIT) { MGA_COLOR((char *)&v[0]->ui[4], vbcolor[pv]); v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + MGA_COLOR3((char *)&v[0]->ui[5], vbspec[pv]); + v[2]->ui[5] = v[1]->ui[5] = v[0]->ui[5]; } else { MGA_COLOR((char *)&v[0]->ui[4], vbcolor[e0]); MGA_COLOR((char *)&v[1]->ui[4], vbcolor[e1]); MGA_COLOR((char *)&v[2]->ui[4], vbcolor[e2]); + MGA_COLOR3((char *)&v[0]->ui[5], vbspec[e0]); + MGA_COLOR3((char *)&v[1]->ui[5], vbspec[e1]); + MGA_COLOR3((char *)&v[2]->ui[5], vbspec[e2]); } } #endif @@ -79,9 +89,13 @@ static __inline void TAG(triangle)(GLcontext *ctx, #elif (IND & MGA_FLAT_BIT) { GLuint color = mgaverts[pv].ui[4]; + GLuint spec = mgaverts[pv].ui[5]; v[0]->ui[4] = color; v[1]->ui[4] = color; v[2]->ui[4] = color; + v[0]->ui[5] = spec; + v[1]->ui[5] = spec; + v[2]->ui[5] = spec; } #endif @@ -97,6 +111,9 @@ static __inline void TAG(triangle)(GLcontext *ctx, v[0]->ui[4] = c[0]; v[1]->ui[4] = c[1]; v[2]->ui[4] = c[2]; + v[0]->ui[5] = s[0]; + v[1]->ui[5] = s[1]; + v[2]->ui[5] = s[2]; #endif } @@ -120,25 +137,34 @@ static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) float width = ctx->Line.Width; GLfloat z0, z1; GLuint c0, c1; + GLuint s0, s1; mgaVertex *vert0 = &mgaVB[v0]; mgaVertex *vert1 = &mgaVB[v1]; - if (IND & MGA_TWOSIDE_BIT) { GLubyte (*vbcolor)[4] = ctx->VB->ColorPtr->data; + GLubyte (*vbspec)[4] = ctx->VB->Specular; if (IND & MGA_FLAT_BIT) { MGA_COLOR((char *)&vert0->v.color,vbcolor[pv]); *(int *)&vert1->v.color = *(int *)&vert0->v.color; + MGA_COLOR3((char *)&vert0->v.specular, vbspec[pv]); + *(int *)&vert1->v.specular = *(int *)&vert0->v.specular; } else { MGA_COLOR((char *)&vert0->v.color,vbcolor[v0]); MGA_COLOR((char *)&vert1->v.color,vbcolor[v1]); + MGA_COLOR3((char *)&vert0->v.specular, vbspec[v0]); + MGA_COLOR3((char *)&vert1->v.specular, vbspec[v1]); } } else if (IND & MGA_FLAT_BIT) { c0 = *(GLuint *) &(vert0->v.color); c1 = *(GLuint *) &(vert1->v.color); *(int *)&vert0->v.color = *(int *)&vert1->v.color = *(int *)&mgaVB[pv].v.color; + s0 = *(GLuint *) &(vert0->v.specular); + s1 = *(GLuint *) &(vert1->v.specular); + *(int *)&vert0->v.specular = + *(int *)&vert1->v.specular = *(int *)&mgaVB[pv].v.specular; } if (IND & MGA_OFFSET_BIT) { @@ -159,6 +185,8 @@ static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) if ((IND & MGA_FLAT_BIT) && !(IND & MGA_TWOSIDE_BIT)) { *(GLuint *) &(vert0->v.color) = c0; *(GLuint *) &(vert1->v.color) = c1; + *(GLuint *) &(vert0->v.specular) = s0; + *(GLuint *) &(vert1->v.specular) = s1; } } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.c b/xc/lib/GL/mesa/src/drv/mga/mgavb.c index d804814e0..d8f597fcf 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgavb.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.c @@ -23,7 +23,7 @@ * * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.c,v 1.8 2001/01/08 01:07:19 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.c,v 1.9 2001/03/21 16:14:22 dawes Exp $ */ #include "mgacontext.h" #include "mgavb.h" @@ -35,34 +35,34 @@ #include <stdio.h> #include <stdlib.h> -#define TEX0 { \ +#define TEX0 { \ v->v.tu0 = tc0[i][0]; \ v->v.tv0 = tc0[i][1]; \ } -#define TEX1 { \ +#define TEX1 { \ v->v.tu1 = tc1[i][0]; \ v->v.tv1 = tc1[i][1]; \ } -#define SPC { \ - GLubyte *spec = &(VB->Spec[0][i][0]); \ +#define SPC { \ + GLubyte *spec = &(VB->Spec[0][i][0]); \ v->v.specular.red = spec[0]; \ - v->v.specular.green = spec[1]; \ + v->v.specular.green = spec[1]; \ v->v.specular.blue = spec[2]; \ } -#define FOG { \ - GLubyte *spec = &(VB->Spec[0][i][0]); \ - v->v.specular.alpha = spec[3]; \ +#define FOG { \ + GLubyte *spec = &(VB->Spec[0][i][0]); \ + v->v.specular.alpha = spec[3]; \ } #define COL { \ GLubyte *col = &(VB->Color[0]->data[i][0]); \ - v->v.color.blue = col[2]; \ - v->v.color.green = col[1]; \ - v->v.color.red = col[0]; \ - v->v.color.alpha = col[3]; \ + v->v.color.blue = col[2]; \ + v->v.color.green = col[1]; \ + v->v.color.red = col[0]; \ + v->v.color.alpha = col[3]; \ } /* The v code we have doesn't seem to support projective texturing @@ -70,14 +70,13 @@ * second set of texcoords). This may be a problem for the g400. */ #define TEX0_4 \ - if (VB->TexCoordPtr[0]->size == 4) \ - { \ + if (VB->TexCoordPtr[0]->size == 4) { \ GLfloat (*tc)[4] = VB->TexCoordPtr[0]->data; \ v = &(MGA_DRIVER_DATA(VB)->verts[start]); \ mmesa->setupdone &= ~MGA_WIN_BIT; \ - for (i=start; i < end; i++, v++) { \ - float oow = 1.0 / tc[i][3]; \ - v->v.rhw *= tc[i][3]; \ + for (i = start; i < end; i++, v++) { \ + GLfloat oow = 1.0 / tc[i][3]; \ + v->v.rhw *= tc[i][3]; \ v->v.tu0 *= oow; \ v->v.tv0 *= oow; \ } \ @@ -138,7 +137,7 @@ static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \ spec; \ fog; \ } \ - col; \ + col; \ } \ tex0_4; \ } diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile b/xc/lib/GL/mesa/src/drv/r128/Imakefile index 9832bc2c3..aaa972958 100644 --- a/xc/lib/GL/mesa/src/drv/r128/Imakefile +++ b/xc/lib/GL/mesa/src/drv/r128/Imakefile @@ -1,334 +1,39 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.12 2001/02/16 01:26:11 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.16 2001/04/03 02:29:35 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#ifdef i386Architecture -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif -#if MesaUseKatmai - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DDRIVERTS - DRI_INCLUDES = -I../../../../dri \ - -I../../../../glx \ - -I../../../dri \ - -I$(TOP)/include \ - -I$(TOP)/include/GL \ - -I$(XF86OSSRC) \ - -I$(XF86COMSRC) \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86DRIVERSRC)/ati \ - -I../../../include \ - -I../.. \ - -I../../X \ - -I../common +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif -MESA_INCLUDES = -I. -I.. -I../../include \ - -I../../../../dri/drm - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - - R128SRCS = r128_context.c \ - r128_dd.c \ - r128_fastpath.c \ - r128_eltpath.c \ - r128_ioctl.c \ - r128_lock.c \ - r128_pipeline.c \ - r128_screen.c \ - r128_span.c \ - r128_state.c \ - r128_tex.c \ - r128_tris.c \ - r128_vb.c \ - r128_xmesa.c - - R128OBJS = r128_context.o \ - r128_dd.o \ - r128_fastpath.o \ - r128_eltpath.o \ - r128_ioctl.o \ - r128_lock.o \ - r128_pipeline.o \ - r128_screen.o \ - r128_span.o \ - r128_state.o \ - r128_tex.o \ - r128_tris.o \ - r128_vb.o \ - r128_xmesa.o - -#if !GlxUseBuiltInDRIDriver - DRISRCS = ../../../dri/dri_mesa.c \ - ../../../../dri/dri_tmm.c - - DRIOBJS = ../../../dri/dri_mesa.o \ - ../../../../dri/dri_tmm.o - - DRMSRCS = ../../../../dri/drm/xf86drm.c \ - ../../../../dri/drm/xf86drmHash.c \ - ../../../../dri/drm/xf86drmRandom.c \ - ../../../../dri/drm/xf86drmSL.c \ - ../../../../dri/drm/xf86drmR128.c - - DRMOBJS = ../../../../dri/drm/xf86drm.o \ - ../../../../dri/drm/xf86drmHash.o \ - ../../../../dri/drm/xf86drmRandom.o \ - ../../../../dri/drm/xf86drmSL.o \ - ../../../../dri/drm/xf86drmR128.o - - MESASRCS = ../../aatriangle.c \ - ../../accum.c \ - ../../alpha.c \ - ../../alphabuf.c \ - ../../attrib.c \ - ../../bbox.c \ - ../../bitmap.c \ - ../../blend.c \ - ../../buffers.c \ - ../../clip.c \ - ../../colortab.c \ - ../../config.c \ - ../../context.c \ - ../../copypix.c \ - ../../cva.c \ - ../../debug_xform.c \ - ../../depth.c \ - ../../dlist.c \ - ../../drawpix.c \ - ../../enable.c \ - ../../enums.c \ - ../../eval.c \ - ../../extensions.c \ - ../../feedback.c \ - ../../fog.c \ - ../../get.c \ - ../../glapi.c \ - ../../glapinoop.c \ - ../../glthread.c \ - ../../hash.c \ - ../../image.c \ - ../../imaging.c \ - ../../light.c \ - ../../lines.c \ - ../../logic.c \ - ../../masking.c \ - ../../matrix.c \ - ../../mem.c \ - ../../mmath.c \ - ../../pb.c \ - ../../pipeline.c \ - ../../pixel.c \ - ../../pixeltex.c \ - ../../points.c \ - ../../polygon.c \ - ../../quads.c \ - ../../rastpos.c \ - ../../readpix.c \ - ../../rect.c \ - ../../scissor.c \ - ../../shade.c \ - ../../span.c \ - ../../stages.c \ - ../../state.c \ - ../../stencil.c \ - ../../teximage.c \ - ../../texobj.c \ - ../../texstate.c \ - ../../texture.c \ - ../../texutil.c \ - ../../translate.c \ - ../../triangle.c \ - ../../varray.c \ - ../../vb.c \ - ../../vbcull.c \ - ../../vbfill.c \ - ../../vbindirect.c \ - ../../vbrender.c \ - ../../vbxform.c \ - ../../vector.c \ - ../../vertices.c \ - ../../winpos.c \ - ../../xform.c \ - ../../zoom.c - - MESAOBJS = ../../aatriangle.o \ - ../../accum.o \ - ../../alpha.o \ - ../../alphabuf.o \ - ../../attrib.o \ - ../../bbox.o \ - ../../bitmap.o \ - ../../blend.o \ - ../../buffers.o \ - ../../clip.o \ - ../../colortab.o \ - ../../config.o \ - ../../context.o \ - ../../copypix.o \ - ../../cva.o \ - ../../debug_xform.o \ - ../../depth.o \ - ../../dlist.o \ - ../../drawpix.o \ - ../../enable.o \ - ../../enums.o \ - ../../eval.o \ - ../../extensions.o \ - ../../feedback.o \ - ../../fog.o \ - ../../get.o \ - ../../hash.o \ - ../../hint.o \ - ../../image.o \ - ../../imaging.o \ - ../../light.o \ - ../../lines.o \ - ../../logic.o \ - ../../masking.o \ - ../../matrix.o \ - ../../mem.o \ - ../../mmath.o \ - ../../pb.o \ - ../../pipeline.o \ - ../../pixel.o \ - ../../pixeltex.o \ - ../../points.o \ - ../../polygon.o \ - ../../quads.o \ - ../../rastpos.o \ - ../../readpix.o \ - ../../rect.o \ - ../../scissor.o \ - ../../shade.o \ - ../../span.o \ - ../../stages.o \ - ../../state.o \ - ../../stencil.o \ - ../../teximage.o \ - ../../texobj.o \ - ../../texstate.o \ - ../../texture.o \ - ../../texutil.o \ - ../../translate.o \ - ../../triangle.o \ - ../../varray.o \ - ../../vb.o \ - ../../vbcull.o \ - ../../vbfill.o \ - ../../vbindirect.o \ - ../../vbrender.o \ - ../../vbxform.o \ - ../../vector.o \ - ../../vertices.o \ - ../../winpos.o \ - ../../xform.o \ - ../../zoom.o - +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../Imakefile.inc" #ifdef i386Architecture - X86_SRCS = ../../X86/common_x86.c \ - ../../X86/common_x86_asm.S \ - ../../X86/x86.c \ - ../../X86/x86_cliptest.S \ - ../../X86/x86_vertex.S \ - ../../X86/x86_xform_masked2.S \ - ../../X86/x86_xform_masked3.S \ - ../../X86/x86_xform_masked4.S \ - ../../X86/x86_xform_raw2.S \ - ../../X86/x86_xform_raw3.S \ - ../../X86/x86_xform_raw4.S - - X86_OBJS = ../../X86/common_x86.o \ - ../../X86/common_x86_asm.o \ - ../../X86/x86.o \ - ../../X86/x86_cliptest.o \ - ../../X86/x86_vertex.o \ - ../../X86/x86_xform_masked2.o \ - ../../X86/x86_xform_masked3.o \ - ../../X86/x86_xform_masked4.o \ - ../../X86/x86_xform_raw2.o \ - ../../X86/x86_xform_raw3.o \ - ../../X86/x86_xform_raw4.o - -#if MesaUseMMX - MMX_SRCS = ../../X86/mmx_blend.S - - MMX_OBJS = ../../X86/mmx_blend.o +#include "../../X86/Imakefile.inc" #endif -#if MesaUse3DNow - 3DNOW_SRCS = ../../X86/3dnow.c \ - ../../X86/3dnow_norm_raw.S \ - ../../X86/3dnow_vertex.S \ - ../../X86/3dnow_xform_masked1.S \ - ../../X86/3dnow_xform_masked2.S \ - ../../X86/3dnow_xform_masked3.S \ - ../../X86/3dnow_xform_masked4.S \ - ../../X86/3dnow_xform_raw1.S \ - ../../X86/3dnow_xform_raw2.S \ - ../../X86/3dnow_xform_raw3.S \ - ../../X86/3dnow_xform_raw4.S + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - 3DNOW_OBJS = ../../X86/3dnow.o \ - ../../X86/3dnow_norm_raw.o \ - ../../X86/3dnow_vertex.o \ - ../../X86/3dnow_xform_masked1.o \ - ../../X86/3dnow_xform_masked2.o \ - ../../X86/3dnow_xform_masked3.o \ - ../../X86/3dnow_xform_masked4.o \ - ../../X86/3dnow_xform_raw1.o \ - ../../X86/3dnow_xform_raw2.o \ - ../../X86/3dnow_xform_raw3.o \ - ../../X86/3dnow_xform_raw4.o -#endif - -#if MesaUseKatmai - KATMAI_SRCS = ../../X86/katmai.c \ - ../../X86/katmai_norm_raw.S \ - ../../X86/katmai_vertex.S \ - ../../X86/katmai_xform_masked1.S \ - ../../X86/katmai_xform_masked2.S \ - ../../X86/katmai_xform_masked3.S \ - ../../X86/katmai_xform_masked4.S \ - ../../X86/katmai_xform_raw1.S \ - ../../X86/katmai_xform_raw2.S \ - ../../X86/katmai_xform_raw3.S \ - ../../X86/katmai_xform_raw4.S + DRIOBJS = $(GLXLIBSRC)/mesa/dri/dri_mesa.o \ + $(GLXLIBSRC)/dri/dri_tmm.o - KATMAI_OBJS = ../../X86/katmai.o \ - ../../X86/katmai_norm_raw.o \ - ../../X86/katmai_vertex.o \ - ../../X86/katmai_xform_masked1.o \ - ../../X86/katmai_xform_masked2.o \ - ../../X86/katmai_xform_masked3.o \ - ../../X86/katmai_xform_masked4.o \ - ../../X86/katmai_xform_raw1.o \ - ../../X86/katmai_xform_raw2.o \ - ../../X86/katmai_xform_raw3.o \ - ../../X86/katmai_xform_raw4.o -#endif -#endif -#endif + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o \ + $(GLXLIBSRC)/dri/drm/xf86drmR128.o #ifdef GlxSoProf LOSRCS = ../../../../lowpc.c @@ -338,49 +43,30 @@ MESA_INCLUDES = -I. -I.. -I../../include \ HIOBJS = ../../../../highpc.o #endif - ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) - - COMMONSRCS = ../common/mm.c ../common/hwlog.c - COMMONOBJS = ../common/mm.o ../common/hwlog.o - - SRCS = $(LOSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) \ - $(ASMSRCS) $(COMMONSRCS) $(R128SRCS) $(HISRCS) - OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) \ - $(ASMOBJS) $(COMMONOBJS) $(R128OBJS) $(HIOBJS) - -REQUIREDLIBS += MathLibrary -#if !GlxBuiltInR128 -REQUIREDLIBS += -L../../../.. -lGL -#endif + SRCS = $(R128SRCS) + OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \ + $(MESA_ASM_OBJS) $(COMMONOBJS) $(R128OBJS) $(HIOBJS) - -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif +REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) #include <Library.tmpl> LibraryObjectRule() -SubdirLibraryRule($(OBJS)) +SubdirLibraryRule($(R128OBJS)) NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = r128_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDriModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +SharedDriModuleTarget($(LIBNAME),DONE,$(OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #ifdef GlxSoProf SOPROF_LIBNAME = _r128_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE,$(ALL_OBJS)) InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) #endif #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc b/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc new file mode 100644 index 000000000..826a27e44 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc @@ -0,0 +1,125 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile.inc,v 1.1 2001/03/23 19:18:41 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvR128BuildDir +#define MesaDrvR128BuildDir /**/ +#endif +MESADRVR128BUILDDIR = MesaDrvR128BuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DDRIVERTS + DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/mesa/dri \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86OSSRC) \ + -I$(XF86DRIVERSRC)/ati \ + -I$(XF86COMSRC) \ + -I$(GLXLIBSRC)/dri/drm +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \ + -I$(MESADRVSRCDIR)/r128 + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + R128SRCS = $(MESADRVR128BUILDDIR)r128_context.c \ + $(MESADRVR128BUILDDIR)r128_dd.c \ + $(MESADRVR128BUILDDIR)r128_fastpath.c \ + $(MESADRVR128BUILDDIR)r128_eltpath.c \ + $(MESADRVR128BUILDDIR)r128_ioctl.c \ + $(MESADRVR128BUILDDIR)r128_lock.c \ + $(MESADRVR128BUILDDIR)r128_pipeline.c \ + $(MESADRVR128BUILDDIR)r128_screen.c \ + $(MESADRVR128BUILDDIR)r128_span.c \ + $(MESADRVR128BUILDDIR)r128_state.c \ + $(MESADRVR128BUILDDIR)r128_tex.c \ + $(MESADRVR128BUILDDIR)r128_tris.c \ + $(MESADRVR128BUILDDIR)r128_vb.c \ + $(MESADRVR128BUILDDIR)r128_xmesa.c + + R128OBJS = $(MESADRVR128BUILDDIR)r128_context.o \ + $(MESADRVR128BUILDDIR)r128_dd.o \ + $(MESADRVR128BUILDDIR)r128_fastpath.o \ + $(MESADRVR128BUILDDIR)r128_eltpath.o \ + $(MESADRVR128BUILDDIR)r128_ioctl.o \ + $(MESADRVR128BUILDDIR)r128_lock.o \ + $(MESADRVR128BUILDDIR)r128_pipeline.o \ + $(MESADRVR128BUILDDIR)r128_screen.o \ + $(MESADRVR128BUILDDIR)r128_span.o \ + $(MESADRVR128BUILDDIR)r128_state.o \ + $(MESADRVR128BUILDDIR)r128_tex.o \ + $(MESADRVR128BUILDDIR)r128_tris.o \ + $(MESADRVR128BUILDDIR)r128_vb.o \ + $(MESADRVR128BUILDDIR)r128_xmesa.o + + R128UOBJS = $(MESADRVR128BUILDDIR)unshared/r128_context.o \ + $(MESADRVR128BUILDDIR)unshared/r128_dd.o \ + $(MESADRVR128BUILDDIR)unshared/r128_fastpath.o \ + $(MESADRVR128BUILDDIR)unshared/r128_eltpath.o \ + $(MESADRVR128BUILDDIR)unshared/r128_ioctl.o \ + $(MESADRVR128BUILDDIR)unshared/r128_lock.o \ + $(MESADRVR128BUILDDIR)unshared/r128_pipeline.o \ + $(MESADRVR128BUILDDIR)unshared/r128_screen.o \ + $(MESADRVR128BUILDDIR)unshared/r128_span.o \ + $(MESADRVR128BUILDDIR)unshared/r128_state.o \ + $(MESADRVR128BUILDDIR)unshared/r128_tex.o \ + $(MESADRVR128BUILDDIR)unshared/r128_tris.o \ + $(MESADRVR128BUILDDIR)unshared/r128_vb.o \ + $(MESADRVR128BUILDDIR)unshared/r128_xmesa.o + + R128DOBJS = $(MESADRVR128BUILDDIR)debugger/r128_context.o \ + $(MESADRVR128BUILDDIR)debugger/r128_dd.o \ + $(MESADRVR128BUILDDIR)debugger/r128_fastpath.o \ + $(MESADRVR128BUILDDIR)debugger/r128_eltpath.o \ + $(MESADRVR128BUILDDIR)debugger/r128_ioctl.o \ + $(MESADRVR128BUILDDIR)debugger/r128_lock.o \ + $(MESADRVR128BUILDDIR)debugger/r128_pipeline.o \ + $(MESADRVR128BUILDDIR)debugger/r128_screen.o \ + $(MESADRVR128BUILDDIR)debugger/r128_span.o \ + $(MESADRVR128BUILDDIR)debugger/r128_state.o \ + $(MESADRVR128BUILDDIR)debugger/r128_tex.o \ + $(MESADRVR128BUILDDIR)debugger/r128_tris.o \ + $(MESADRVR128BUILDDIR)debugger/r128_vb.o \ + $(MESADRVR128BUILDDIR)debugger/r128_xmesa.o + + R128POBJS = $(MESADRVR128BUILDDIR)profiled/r128_context.o \ + $(MESADRVR128BUILDDIR)profiled/r128_dd.o \ + $(MESADRVR128BUILDDIR)profiled/r128_fastpath.o \ + $(MESADRVR128BUILDDIR)profiled/r128_eltpath.o \ + $(MESADRVR128BUILDDIR)profiled/r128_ioctl.o \ + $(MESADRVR128BUILDDIR)profiled/r128_lock.o \ + $(MESADRVR128BUILDDIR)profiled/r128_pipeline.o \ + $(MESADRVR128BUILDDIR)profiled/r128_screen.o \ + $(MESADRVR128BUILDDIR)profiled/r128_span.o \ + $(MESADRVR128BUILDDIR)profiled/r128_state.o \ + $(MESADRVR128BUILDDIR)profiled/r128_tex.o \ + $(MESADRVR128BUILDDIR)profiled/r128_tris.o \ + $(MESADRVR128BUILDDIR)profiled/r128_vb.o \ + $(MESADRVR128BUILDDIR)profiled/r128_xmesa.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(r128_context.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_dd.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_fastpath.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_eltpath.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_ioctl.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_lock.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_pipeline.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_screen.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_span.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_state.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_tex.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_tris.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_vb.c, $(MESADRVSRCDIR)/r128) +LinkSourceFile(r128_xmesa.c, $(MESADRVSRCDIR)/r128) +#endif + diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.c b/xc/lib/GL/mesa/src/drv/r128/r128_context.c index f0749ff10..4e6c13e60 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_context.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.c,v 1.5 2001/01/08 01:07:20 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.c,v 1.6 2001/03/21 16:14:23 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -88,7 +88,7 @@ GLboolean r128CreateContext( Display *dpy, GLvisual *glVisual, r128scrn = rmesa->r128Screen = (r128ScreenPtr)(sPriv->private); rmesa->sarea = (R128SAREAPrivPtr)((char *)sPriv->pSAREA + - sizeof(XF86DRISAREARec)); + r128scrn->sarea_priv_offset); rmesa->tmp_matrix = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); if ( !rmesa->tmp_matrix ) { diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.h b/xc/lib/GL/mesa/src/drv/r128/r128_context.h index 8c5e2fdfc..462b8b812 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_context.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.5 2001/01/08 01:07:20 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.6 2001/03/21 16:14:23 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -88,10 +88,16 @@ typedef struct r128_context *r128ContextPtr; #define R128_BLEND_ENV_COLOR 0x1 #define R128_BLEND_MULTITEX 0x2 -/* Subpixel offsets for window coordinates: +/* Subpixel offsets for window coordinates (triangles): */ -#define SUBPIXEL_X (-0.125F) -#define SUBPIXEL_Y ( 0.375F) +#define SUBPIXEL_X (0.0F) +#define SUBPIXEL_Y (0.125F) + +/* Offset for points: + */ +#define PNT_X_OFFSET ( 0.125F) +#define PNT_Y_OFFSET (-0.125F) + typedef void (*r128_interp_func)( GLfloat t, GLfloat *result, @@ -127,10 +133,12 @@ struct r128_context { GLuint vc_format; GLfloat depth_scale; - CARD32 Color; /* Current draw color */ - CARD32 ClearColor; /* Color used to clear color buffer */ - CARD32 ClearDepth; /* Value used to clear depth buffer */ - CARD32 ClearStencil; /* Value used to clear stencil */ + GLuint Color; /* Current draw color */ + GLuint ClearColor; /* Color used to clear color buffer */ + GLuint ClearDepth; /* Value used to clear depth buffer */ + GLuint ClearStencil; /* Value used to clear stencil */ + GLuint DepthMask; + GLuint StencilMask; /* Map GL texture units onto hardware */ @@ -210,6 +218,8 @@ struct r128_context { __DRIscreenPrivate *driScreen; /* DRI screen */ __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */ + int lastStamp; /* mirror driDrawable->lastStamp */ + drmContext hHWContext; drmLock *driHwLock; int driFd; @@ -249,10 +259,10 @@ extern r128ContextPtr r128MakeCurrent( r128ContextPtr oldCtx, /* ================================================================ * Debugging: */ -#define DEBUG 0 +#define DO_DEBUG 0 #define ENABLE_PERF_BOXES 0 -#if DEBUG +#if DO_DEBUG extern int R128_DEBUG; #else #define R128_DEBUG 0 diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c index 8d9473093..af5fb66ff 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.9 2001/01/11 03:36:54 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.11 2001/03/25 05:32:00 tsi Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "X86/common_x86_asm.h" #endif -#define R128_DATE "20010101" +#define R128_DATE "20010130" /* Return the width and height of the current color buffer. @@ -66,35 +66,35 @@ static void r128DDGetBufferSize( GLcontext *ctx, static const GLubyte *r128DDGetString( GLcontext *ctx, GLenum name ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - static GLubyte buffer[128]; + static char buffer[128]; switch ( name ) { case GL_VENDOR: return (GLubyte *)"VA Linux Systems, Inc."; case GL_RENDERER: - sprintf((void *)buffer, "Mesa DRI Rage128 " R128_DATE ); + sprintf( buffer, "Mesa DRI Rage128 " R128_DATE ); /* Append any chipset-specific information. */ if ( R128_IS_PRO( rmesa ) ) { - strncat( (pointer)buffer, " Pro", 4 ); + strncat( buffer, " Pro", 4 ); } if ( R128_IS_MOBILITY( rmesa ) ) { - strncat( (pointer)buffer, " M3", 3 ); + strncat( buffer, " M3", 3 ); } /* Append any AGP-specific information. */ switch ( rmesa->r128Screen->AGPMode ) { case 1: - strncat( (pointer)buffer, " AGP 1x", 7 ); + strncat( buffer, " AGP 1x", 7 ); break; case 2: - strncat( (pointer)buffer, " AGP 2x", 7 ); + strncat( buffer, " AGP 2x", 7 ); break; case 4: - strncat( (pointer)buffer, " AGP 4x", 7 ); + strncat( buffer, " AGP 4x", 7 ); break; } @@ -102,20 +102,25 @@ static const GLubyte *r128DDGetString( GLcontext *ctx, GLenum name ) */ #ifdef USE_X86_ASM if ( gl_x86_cpu_features ) { - strncat( (pointer)buffer, " x86", 4 ); + strncat( buffer, " x86", 4 ); + } +#endif +#ifdef USE_MMX_ASM + if ( cpu_has_mmx ) { + strncat( buffer, "/MMX", 4 ); } #endif #ifdef USE_3DNOW_ASM if ( cpu_has_3dnow ) { - strncat( (pointer)buffer, "/3DNow!", 7 ); + strncat( buffer, "/3DNow!", 7 ); } #endif #ifdef USE_KATMAI_ASM if ( cpu_has_xmm ) { - strncat( (pointer)buffer, "/SSE", 4 ); + strncat( buffer, "/SSE", 4 ); } #endif - return buffer; + return (GLubyte *)buffer; default: return NULL; @@ -182,6 +187,7 @@ void r128DDInitExtensions( GLcontext *ctx ) gl_extensions_disable( ctx, "GL_ARB_texture_cube_map" ); gl_extensions_disable( ctx, "GL_EXT_blend_color" ); + gl_extensions_disable( ctx, "GL_EXT_blend_func_separate" ); gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c b/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c index 25548c649..b3b592222 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c,v 1.3 2001/01/08 01:07:20 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c,v 1.4 2001/04/01 14:00:00 tsi Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -70,10 +70,10 @@ static void fire_elts( r128ContextPtr rmesa ) if ( rmesa->first_elt != rmesa->next_elt ) { r128FireEltsLocked( rmesa, - ((GLuint)rmesa->first_elt - - (GLuint)rmesa->elt_buf->address), - ((GLuint)rmesa->next_elt - - (GLuint)rmesa->elt_buf->address), + ((char *)rmesa->first_elt - + (char *)rmesa->elt_buf->address), + ((char *)rmesa->next_elt - + (char *)rmesa->elt_buf->address), !retain ); } else if ( !retain ) { r128ReleaseBufLocked( rmesa, rmesa->elt_buf ); @@ -98,7 +98,7 @@ static void fire_elts( r128ContextPtr rmesa ) (((rmesa->elt_buf->idx + 1) * R128_BUFFER_SIZE / (8 * sizeof(GLuint))) - 1); rmesa->next_vert = (GLfloat *) - ((GLuint)rmesa->vert_heap + + ((char *)rmesa->vert_heap + rmesa->next_vert_index * 8 * sizeof(GLfloat)); break; @@ -107,7 +107,7 @@ static void fire_elts( r128ContextPtr rmesa ) (((rmesa->elt_buf->idx + 1) * R128_BUFFER_SIZE / (10 * sizeof(GLuint))) - 1); rmesa->next_vert = (GLfloat *) - ((GLuint)rmesa->vert_heap + + ((char *)rmesa->vert_heap + rmesa->next_vert_index * 10 * sizeof(GLfloat)); break; } @@ -126,10 +126,10 @@ static void release_bufs( r128ContextPtr rmesa ) LOCK_HARDWARE( rmesa ); if ( rmesa->first_elt != rmesa->next_elt ) { r128FireEltsLocked( rmesa, - ((GLuint)rmesa->first_elt - - (GLuint)rmesa->elt_buf->address), - ((GLuint)rmesa->next_elt - - (GLuint)rmesa->elt_buf->address), + ((char *)rmesa->first_elt - + (char *)rmesa->elt_buf->address), + ((char *)rmesa->next_elt - + (char *)rmesa->elt_buf->address), 0 ); ALIGN_NEXT_ELT( rmesa ); @@ -236,8 +236,8 @@ static void r128_tri_clip( r128ContextPtr rmesa, { GLuint *out = inlist[in]; - GLint space = (GLint)((GLuint)rmesa->next_vert - - (GLuint)rmesa->next_elt); + GLint space = (GLint)((char *)rmesa->next_vert - + (char *)rmesa->next_elt); if ( space < (GLint)(n * (vertsize + 2) * sizeof(GLuint)) ) { fire_elts( rmesa ); @@ -277,8 +277,8 @@ static void r128_tri_clip( r128ContextPtr rmesa, #define TRIANGLE( e2, e1, e0 ) \ do { \ - if ( (GLint)((GLuint)rmesa->next_vert - \ - (GLuint)rmesa->next_elt) < TRI_THRESHOLD ) { \ + if ( (GLint)((char *)rmesa->next_vert - \ + (char *)rmesa->next_elt) < TRI_THRESHOLD ) { \ fire_elts( rmesa ); \ } \ rmesa->next_elt[0] = UNCLIPPED_VERT( e2 ); \ @@ -462,8 +462,8 @@ void r128DDEltPath( struct vertex_buffer *VB ) if ( rmesa->new_state ) r128DDUpdateHWState( ctx ); - space = (GLint)((GLuint)rmesa->next_vert - - (GLuint)rmesa->next_elt); + space = (GLint)((char *)rmesa->next_vert - + (char *)rmesa->next_elt); /* Allocate a single buffer to hold unclipped vertices. All * unclipped vertices must be contiguous. diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c index 7b0fecedd..76b87775d 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.3 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.5 2001/04/01 14:00:00 tsi Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -216,7 +216,7 @@ void r128FireEltsLocked( r128ContextPtr rmesa, } rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS; - drmR128FlushIndices( fd, prim, buffer->idx, start, end, discard ); + drmR128FlushIndices( fd, prim, buffer->idx, start, end, d ); } } @@ -231,10 +231,10 @@ void r128FlushEltsLocked( r128ContextPtr rmesa ) { if ( rmesa->first_elt != rmesa->next_elt ) { r128FireEltsLocked( rmesa, - ((GLuint)rmesa->first_elt - - (GLuint)rmesa->elt_buf->address), - ((GLuint)rmesa->next_elt - - (GLuint)rmesa->elt_buf->address), + ((char *)rmesa->first_elt - + (char *)rmesa->elt_buf->address), + ((char *)rmesa->next_elt - + (char *)rmesa->elt_buf->address), 0 ); ALIGN_NEXT_ELT( rmesa ); @@ -460,6 +460,8 @@ static GLbitfield r128DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all, r128ContextPtr rmesa = R128_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = rmesa->driDrawable; GLuint flags = 0; + GLuint color_mask = 0; + GLuint depth_mask = 0; GLint i; GLint ret; @@ -478,22 +480,26 @@ static GLbitfield r128DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all, if ( mask & DD_FRONT_LEFT_BIT ) { flags |= DRM_R128_FRONT; + color_mask = rmesa->setup.plane_3d_mask_c; mask &= ~DD_FRONT_LEFT_BIT; } if ( mask & DD_BACK_LEFT_BIT ) { flags |= DRM_R128_BACK; + color_mask = rmesa->setup.plane_3d_mask_c; mask &= ~DD_BACK_LEFT_BIT; } if ( ( mask & DD_DEPTH_BIT ) && ctx->Depth.Mask ) { flags |= DRM_R128_DEPTH; + depth_mask |= rmesa->DepthMask; mask &= ~DD_DEPTH_BIT; } #if 0 /* FIXME: Add stencil support */ if ( mask & DD_STENCIL_BIT ) { flags |= DRM_R128_DEPTH; + depth_mask |= rmesa->StencilMask; mask &= ~DD_STENCIL_BIT; } #endif @@ -507,10 +513,6 @@ static GLbitfield r128DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all, LOCK_HARDWARE( rmesa ); - if ( rmesa->dirty & ~R128_UPLOAD_CLIPRECTS ) { - r128EmitHwStateLocked( rmesa ); - } - for ( i = 0 ; i < rmesa->numClipRects ; ) { GLint nr = MIN2( i + R128_NR_SAREA_CLIPRECTS , rmesa->numClipRects ); XF86DRIClipRectPtr box = rmesa->pClipRects; @@ -557,8 +559,8 @@ static GLbitfield r128DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all, } ret = drmR128Clear( rmesa->driFd, flags, - cx, cy, cw, ch, - rmesa->ClearColor, rmesa->ClearDepth ); + rmesa->ClearColor, rmesa->ClearDepth, + color_mask, depth_mask ); if ( ret ) { UNLOCK_HARDWARE( rmesa ); diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h index 76f777912..23f002175 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h,v 1.2 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h,v 1.3 2001/04/01 14:00:00 tsi Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -141,7 +141,7 @@ do { \ #define ALIGN_NEXT_ELT( rmesa ) \ do { \ rmesa->next_elt = (GLushort *) \ - (((GLuint)rmesa->next_elt + 7) & ~0x7); \ + (((unsigned long)rmesa->next_elt + 7) & ~0x7); \ rmesa->next_elt = (GLushort *) \ ((GLubyte *)rmesa->next_elt + R128_INDEX_PRIM_OFFSET); \ } while (0) diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_lock.c b/xc/lib/GL/mesa/src/drv/r128/r128_lock.c index 90ca2d7e1..5b50fc2e8 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_lock.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_lock.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.c,v 1.2 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.c,v 1.3 2001/03/21 16:14:23 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -55,7 +55,6 @@ void r128GetLock( r128ContextPtr rmesa, GLuint flags ) __DRIdrawablePrivate *dPriv = rmesa->driDrawable; __DRIscreenPrivate *sPriv = rmesa->driScreen; R128SAREAPrivPtr sarea = rmesa->sarea; - int stamp = dPriv->lastStamp; int i; drmGetLock( rmesa->driFd, rmesa->hHWContext, flags ); @@ -70,7 +69,8 @@ void r128GetLock( r128ContextPtr rmesa, GLuint flags ) */ XMESA_VALIDATE_DRAWABLE_INFO( rmesa->display, sPriv, dPriv ); - if ( stamp != dPriv->lastStamp ) { + if ( rmesa->lastStamp != dPriv->lastStamp ) { + rmesa->lastStamp = dPriv->lastStamp; rmesa->new_state |= R128_NEW_WINDOW | R128_NEW_CLIP; rmesa->SetupDone = 0; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c index e6aff7f00..57d5c4f63 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.4 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.5 2001/03/21 16:14:23 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -64,39 +64,6 @@ r128ScreenPtr r128CreateScreen( __DRIscreenPrivate *sPriv ) r128ScreenPtr r128Screen; R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; - /* Check the DRI version */ - { - int major, minor, patch; - if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) { - if ( major != 3 || minor != 1 || patch < 0 ) { - char msg[128]; - sprintf( msg, "r128 DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch ); - __driMesaMessage( msg ); - return GL_FALSE; - } - } - } - - /* Check that the DDX driver version is compatible */ - if ( sPriv->ddxMajor != 4 || - sPriv->ddxMinor != 0 || - sPriv->ddxPatch < 0 ) { - char msg[128]; - sprintf( msg, "r128 DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch ); - __driMesaMessage( msg ); - return GL_FALSE; - } - - /* Check that the DRM driver version is compatible */ - if ( sPriv->drmMajor != 2 || - sPriv->drmMinor != 1 || - sPriv->drmPatch < 0 ) { - char msg[128]; - sprintf( msg, "r128 DRI driver expected DRM driver version 2.1.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); - __driMesaMessage( msg ); - return GL_FALSE; - } - /* Allocate the private area */ r128Screen = (r128ScreenPtr) CALLOC( sizeof(*r128Screen) ); if ( !r128Screen ) return NULL; @@ -105,6 +72,7 @@ r128ScreenPtr r128CreateScreen( __DRIscreenPrivate *sPriv ) * not we are using a PCI card. */ r128Screen->IsPCI = r128DRIPriv->IsPCI; + r128Screen->sarea_priv_offset = r128DRIPriv->sarea_priv_offset; r128Screen->mmio.handle = r128DRIPriv->registerHandle; r128Screen->mmio.size = r128DRIPriv->registerSize; diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.h b/xc/lib/GL/mesa/src/drv/r128/r128_screen.h index 82e8dda81..7dea050ac 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_screen.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.h,v 1.4 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.h,v 1.5 2001/03/21 16:14:23 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -74,6 +74,7 @@ typedef struct { drmBufMapPtr buffers; __DRIscreenPrivate *driScreen; + unsigned int sarea_priv_offset; } r128ScreenRec, *r128ScreenPtr; diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_span.c b/xc/lib/GL/mesa/src/drv/r128/r128_span.c index 6f71c2c78..521ffcf24 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_span.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_span.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.c,v 1.5 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.c,v 1.6 2001/03/21 16:14:23 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -61,7 +61,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. rmesa->readOffset + \ (dPriv->x * r128scrn->cpp) + \ (dPriv->y * pitch)); \ - GLushort p; \ + GLuint p; \ (void) read_buf; (void) buf; (void) p #define LOCAL_DEPTH_VARS \ @@ -81,13 +81,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ - if (( _y < miny) || (_y >= maxy)) { \ + if ( _y < miny || _y >= maxy ) { \ _n1 = 0, _x1 = x; \ } else { \ _n1 = _n; \ _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ } #define Y_FLIP( _y ) (height - _y - 1) @@ -148,6 +148,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define TAG(x) r128##x##_RGB565 #include "spantmp.h" +#define READ_DEPTH(d, _x, _y) \ + d = *(GLushort *)(buf + _x*2 + _y*pitch) /* 32 bit, ARGB8888 color spanline and pixel functions */ @@ -173,6 +175,23 @@ do { \ #include "spantmp.h" +/* 24 bit, RGB888 color spanline and pixel functions */ +#define WRITE_RGBA(_x, _y, r, g, b, a) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = ((r << 16) | \ + (g << 8) | \ + (b << 0)) + +#define WRITE_PIXEL(_x, _y, p) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = p + +#define READ_RGBA(rgba, _x, _y) \ + do { \ + GLuint p = *(GLuint *)(read_buf + _x*3 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = 0xff; \ + } while (0) /* ================================================================ * Depth buffer @@ -341,6 +360,9 @@ do { \ */ +/* 32 bit depthbuffer functions */ +#define WRITE_DEPTH(_x, _y, d) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = d void r128DDInitSpanFuncs( GLcontext *ctx ) { diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_state.c b/xc/lib/GL/mesa/src/drv/r128/r128_state.c index 598d2c6bc..8244696aa 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_state.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_state.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.c,v 1.7 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.c,v 1.8 2001/03/21 16:14:23 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -41,6 +41,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_vb.h" #include "r128_tex.h" +#include "context.h" #include "mmath.h" #include "pb.h" #include "enums.h" @@ -53,8 +54,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. static void r128UpdateAlphaMode( GLcontext *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - CARD32 a = rmesa->setup.misc_3d_state_cntl_reg; - CARD32 t = rmesa->setup.tex_cntl_c; + GLuint a = rmesa->setup.misc_3d_state_cntl_reg; + GLuint t = rmesa->setup.tex_cntl_c; if ( ctx->Color.AlphaEnabled ) { GLubyte ref = ctx->Color.AlphaRef; @@ -183,6 +184,12 @@ static void r128DDBlendEquation( GLcontext *ctx, GLenum mode ) FLUSH_BATCH( rmesa ); rmesa->new_state |= R128_NEW_ALPHA; + + if ( ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY ) { + rmesa->Fallback |= R128_FALLBACK_LOGICOP; + } else { + rmesa->Fallback &= ~R128_FALLBACK_LOGICOP; + } } static void r128DDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor ) @@ -211,8 +218,8 @@ static void r128DDBlendFuncSeparate( GLcontext *ctx, static void r128UpdateZMode( GLcontext *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - CARD32 z = rmesa->setup.z_sten_cntl_c; - CARD32 t = rmesa->setup.tex_cntl_c; + GLuint z = rmesa->setup.z_sten_cntl_c; + GLuint t = rmesa->setup.tex_cntl_c; if ( ctx->Depth.Test ) { z &= ~R128_Z_TEST_MASK; @@ -306,9 +313,9 @@ static void r128DDClearDepth( GLcontext *ctx, GLclampd d ) static void r128UpdateFogAttrib( GLcontext *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - CARD32 t = rmesa->setup.tex_cntl_c; + GLuint t = rmesa->setup.tex_cntl_c; GLubyte c[4]; - CARD32 col; + GLuint col; if ( ctx->FogMode == FOG_FRAGMENT ) { t |= R128_FOG_ENABLE; @@ -397,7 +404,7 @@ static void r128DDScissor( GLcontext *ctx, static void r128UpdateCull( GLcontext *ctx ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - CARD32 f = rmesa->setup.pm4_vc_fpu_setup; + GLuint f = rmesa->setup.pm4_vc_fpu_setup; f &= ~R128_FRONT_DIR_MASK; @@ -479,7 +486,8 @@ static GLboolean r128DDColorMask( GLcontext *ctx, FLUSH_BATCH( rmesa ); rmesa->new_state |= R128_NEW_MASKS; - return GL_TRUE; + return GL_FALSE; /* This forces the software paths to do colormasking. */ + /* This function will return void when we use Mesa 3.5 */ } @@ -497,7 +505,7 @@ static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, r128ContextPtr rmesa = R128_CONTEXT(ctx); if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) { - CARD32 t = rmesa->setup.tex_cntl_c; + GLuint t = rmesa->setup.tex_cntl_c; FLUSH_BATCH( rmesa ); @@ -517,7 +525,7 @@ static void r128DDLightModelfv( GLcontext *ctx, GLenum pname, static void r128DDShadeModel( GLcontext *ctx, GLenum mode ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - CARD32 s = rmesa->setup.pm4_vc_fpu_setup; + GLuint s = rmesa->setup.pm4_vc_fpu_setup; s &= ~R128_FPU_COLOR_MASK; @@ -583,9 +591,9 @@ static void r128DDColor( GLcontext *ctx, static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode ) { - if ( ctx->Color.ColorLogicOpEnabled ) { - r128ContextPtr rmesa = R128_CONTEXT(ctx); + r128ContextPtr rmesa = R128_CONTEXT(ctx); + if ( ctx->Color.ColorLogicOpEnabled ) { FLUSH_BATCH( rmesa ); if ( opcode == GL_COPY ) { @@ -593,6 +601,8 @@ static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode ) } else { rmesa->Fallback |= R128_FALLBACK_LOGICOP; } + } else { + rmesa->Fallback &= ~R128_FALLBACK_LOGICOP; } } @@ -700,9 +710,19 @@ static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) switch ( cap ) { case GL_ALPHA_TEST: + FLUSH_BATCH( rmesa ); + rmesa->new_state |= R128_NEW_ALPHA; + break; + case GL_BLEND: FLUSH_BATCH( rmesa ); rmesa->new_state |= R128_NEW_ALPHA; + + if ( ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY ) { + rmesa->Fallback |= R128_FALLBACK_LOGICOP; + } else { + rmesa->Fallback &= ~R128_FALLBACK_LOGICOP; + } break; case GL_CULL_FACE: @@ -717,7 +737,7 @@ static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_DITHER: do { - CARD32 t = rmesa->setup.tex_cntl_c; + GLuint t = rmesa->setup.tex_cntl_c; FLUSH_BATCH( rmesa ); if ( ctx->Color.DitherFlag ) { @@ -738,7 +758,6 @@ static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) rmesa->new_state |= R128_NEW_FOG; break; - case GL_INDEX_LOGIC_OP: case GL_COLOR_LOGIC_OP: FLUSH_BATCH( rmesa ); if ( state && ctx->Color.LogicOp != GL_COPY ) { @@ -950,7 +969,7 @@ void r128DDUpdateHWState( GLcontext *ctx ) static void r128DDReducedPrimitiveChange( GLcontext *ctx, GLenum prim ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); - CARD32 f = rmesa->setup.pm4_vc_fpu_setup; + GLuint f = rmesa->setup.pm4_vc_fpu_setup; f |= R128_BACKFACE_SOLID | R128_FRONTFACE_SOLID; @@ -1038,11 +1057,13 @@ void r128DDInitState( r128ContextPtr rmesa ) switch ( rmesa->glCtx->Visual->DepthBits ) { case 16: rmesa->ClearDepth = 0x0000ffff; + rmesa->DepthMask = 0xffffffff; depth_bpp = R128_Z_PIX_WIDTH_16; rmesa->depth_scale = 1.0 / (GLfloat)0xffff; break; case 24: rmesa->ClearDepth = 0x00ffffff; + rmesa->DepthMask = 0x00ffffff; depth_bpp = R128_Z_PIX_WIDTH_24; rmesa->depth_scale = 1.0 / (GLfloat)0xffffff; break; diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c index f518720f5..ee3ba607d 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.7 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.8 2001/03/21 16:14:24 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -1572,6 +1572,9 @@ static void r128DDTexSubImage( GLcontext *ctx, GLenum target, if ( t ) { if ( t->bound ) FLUSH_BATCH( rmesa ); +#if 0 + /* FIXME: Only upload textures if we already have space in the heap. + */ LOCK_HARDWARE( rmesa ); r128UploadSubImage( rmesa, t, level, xoffset, yoffset, width, height ); @@ -1579,6 +1582,9 @@ static void r128DDTexSubImage( GLcontext *ctx, GLenum target, /* Update the context state */ rmesa->setup.tex_cntl_c |= R128_TEX_CACHE_FLUSH; +#else + r128DestroyTexObj( rmesa, t ); +#endif rmesa->new_state |= R128_NEW_TEXTURE; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tris.h b/xc/lib/GL/mesa/src/drv/r128/r128_tris.h index 79b3fb69e..108c85075 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tris.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tris.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.4 2001/01/08 01:07:24 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.5 2001/03/21 16:14:24 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -166,53 +166,76 @@ static __inline void r128_draw_line( r128ContextPtr rmesa, #if 1 int vertsize = rmesa->vertsize; CARD32 *vb = r128AllocVerticesInline( rmesa, 6 ); - float dx, dy, ix, iy; - int j; + GLfloat hw, dx, dy, ix, iy; + GLuint j; + GLfloat x0 = tmp0->v.x; + GLfloat y0 = tmp0->v.y; + GLfloat x1 = tmp1->v.x; + GLfloat y1 = tmp1->v.y; + + hw = 0.5F * width; + if (hw > 0.1F && hw < 0.5F) { + hw = 0.5F; + } + /* adjust vertices depending on line direction */ dx = tmp0->v.x - tmp1->v.x; dy = tmp0->v.y - tmp1->v.y; - - ix = width * .5; iy = 0; - - if ((ix<.5) && (ix>0.1)) ix = .5; /* I want to see lines with width - 0.5 also */ - if (dx * dx > dy * dy) { - iy = ix; ix = 0; + /* X-major line */ + ix = 0.0F; + iy = hw; + if (x1 < x0) { + x0 += 0.5F; + x1 += 0.5F; + } + y0 -= 0.5F; + y1 -= 0.5F; + } + else { + /* Y-major line */ + ix = hw; + iy = 0.0F; + if (y1 > y0) { + y0 -= 0.5F; + y1 -= 0.5F; + } + x0 += 0.5F; + x1 += 0.5F; } - *(float *)&vb[0] = tmp0->v.x - ix; - *(float *)&vb[1] = tmp0->v.y - iy; + *(float *)&vb[0] = x0 - ix; + *(float *)&vb[1] = y0 - iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp0->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp1->v.x + ix; - *(float *)&vb[1] = tmp1->v.y + iy; + *(float *)&vb[0] = x1 + ix; + *(float *)&vb[1] = y1 + iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp1->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp0->v.x + ix; - *(float *)&vb[1] = tmp0->v.y + iy; + *(float *)&vb[0] = x0 + ix; + *(float *)&vb[1] = y0 + iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp0->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp0->v.x - ix; - *(float *)&vb[1] = tmp0->v.y - iy; + *(float *)&vb[0] = x0 - ix; + *(float *)&vb[1] = y0 - iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp0->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp1->v.x - ix; - *(float *)&vb[1] = tmp1->v.y - iy; + *(float *)&vb[0] = x1 - ix; + *(float *)&vb[1] = y1 - iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp1->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp1->v.x + ix; - *(float *)&vb[1] = tmp1->v.y + iy; + *(float *)&vb[0] = x1 + ix; + *(float *)&vb[1] = y1 + iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp1->ui[j]; @@ -254,39 +277,41 @@ static __inline void r128_draw_point( r128ContextPtr rmesa, int vertsize = rmesa->vertsize; CARD32 *vb = r128AllocVerticesInline( rmesa, 6 ); int j; + const float x = tmp->v.x + PNT_X_OFFSET; + const float y = tmp->v.y + PNT_Y_OFFSET; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; #else diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c index 53908e3bf..8b876a45c 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c,v 1.7 2001/01/23 18:14:38 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c,v 1.8 2001/03/21 16:14:24 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -60,33 +60,31 @@ GLboolean XMesaInitDriver( __DRIscreenPrivate *sPriv ) /* Check the DRI version */ { int major, minor, patch; - if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { - if (major != 3 || minor != 1 || patch < 0) { + if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) { + if ( major != 4 || minor < 0 ) { char msg[1000]; - sprintf(msg, "R128 DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch); - __driMesaMessage(msg); + sprintf( msg, "R128 DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch ); + __driMesaMessage( msg ); return GL_FALSE; } } } /* Check that the DDX driver version is compatible */ - if (sPriv->ddxMajor != 4 || - sPriv->ddxMinor != 0 || - sPriv->ddxPatch < 0) { + if ( sPriv->ddxMajor != 4 || + sPriv->ddxMinor < 0 ) { char msg[1000]; - sprintf(msg, "R128 DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); - __driMesaMessage(msg); + sprintf( msg, "R128 DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch ); + __driMesaMessage( msg ); return GL_FALSE; } /* Check that the DRM driver version is compatible */ - if (sPriv->drmMajor != 2 || - sPriv->drmMinor != 1 || - sPriv->drmPatch < 4) { + if ( sPriv->drmMajor != 2 || + sPriv->drmMinor < 1 ) { char msg[1000]; - sprintf(msg, "R128 DRI driver expected DRM driver version 2.1.x (x>=4) but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); - __driMesaMessage(msg); + sprintf( msg, "R128 DRI driver expected DRM driver version 2.1.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); + __driMesaMessage( msg ); return GL_FALSE; } @@ -158,11 +156,13 @@ GLframebuffer *XMesaCreateWindowBuffer( Display *dpy, __DRIdrawablePrivate *driDrawPriv, GLvisual *mesaVis ) { + GLboolean swStencil; + swStencil = (mesaVis->StencilBits > 0) /* && (mesaVis->RedBits < 8) */ ; return gl_create_framebuffer( mesaVis, GL_FALSE, /* software depth buffer? */ - mesaVis->StencilBits > 0, + swStencil, mesaVis->AccumRedBits > 0, - mesaVis->AlphaBits > 0 ); + GL_FALSE /* software alpha buffer? */ ); } /* Create and initialize the Mesa and driver specific pixmap buffer @@ -267,6 +267,7 @@ void __driRegisterExtensions( void ) GLboolean XMesaOpenFullScreen( __DRIcontextPrivate *driContextPriv ) { +#if 0 r128ContextPtr rmesa = (r128ContextPtr)driContextPriv->driverPrivate; GLint ret; @@ -285,6 +286,7 @@ XMesaOpenFullScreen( __DRIcontextPrivate *driContextPriv ) UNLOCK_HARDWARE( rmesa ); rmesa->doPageFlip = ( ret == 0 ); +#endif return GL_TRUE; } @@ -296,6 +298,7 @@ XMesaCloseFullScreen( __DRIcontextPrivate *driContextPriv ) { r128ContextPtr rmesa = (r128ContextPtr)driContextPriv->driverPrivate; +#if 0 LOCK_HARDWARE( rmesa ); r128WaitForIdleLocked( rmesa ); @@ -307,6 +310,7 @@ XMesaCloseFullScreen( __DRIcontextPrivate *driContextPriv ) rmesa->doPageFlip = GL_FALSE; rmesa->currentPage = 0; +#endif return GL_TRUE; } diff --git a/xc/lib/GL/mesa/src/drv/radeon/Imakefile b/xc/lib/GL/mesa/src/drv/radeon/Imakefile index 52787a5fc..d22567f14 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/Imakefile +++ b/xc/lib/GL/mesa/src/drv/radeon/Imakefile @@ -1,334 +1,39 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile,v 1.1 2001/01/08 01:07:26 martin Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile,v 1.5 2001/04/03 02:29:36 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - -#ifdef i386Architecture -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif -#if MesaUseKatmai - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DDRIVERTS - DRI_INCLUDES = -I../../../../dri \ - -I../../../../glx \ - -I../../../dri \ - -I$(TOP)/include \ - -I$(TOP)/include/GL \ - -I$(XF86OSSRC) \ - -I$(XF86COMSRC) \ - -I$(SERVERSRC)/GL/dri \ - -I$(XF86DRIVERSRC)/ati \ - -I../../../include \ - -I../.. \ - -I../../X \ - -I../common +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif -MESA_INCLUDES = -I. -I.. -I../../include \ - -I../../../../dri/drm - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) - - RADEONSRCS = radeon_context.c \ - radeon_dd.c \ - radeon_fastpath.c \ - radeon_eltpath.c \ - radeon_ioctl.c \ - radeon_lock.c \ - radeon_pipeline.c \ - radeon_screen.c \ - radeon_span.c \ - radeon_state.c \ - radeon_tex.c \ - radeon_tris.c \ - radeon_vb.c \ - radeon_xmesa.c - - RADEONOBJS = radeon_context.o \ - radeon_dd.o \ - radeon_fastpath.o \ - radeon_eltpath.o \ - radeon_ioctl.o \ - radeon_lock.o \ - radeon_pipeline.o \ - radeon_screen.o \ - radeon_span.o \ - radeon_state.o \ - radeon_tex.o \ - radeon_tris.o \ - radeon_vb.o \ - radeon_xmesa.o - -#if !GlxUseBuiltInDRIDriver - DRISRCS = ../../../dri/dri_mesa.c \ - ../../../../dri/dri_tmm.c - - DRIOBJS = ../../../dri/dri_mesa.o \ - ../../../../dri/dri_tmm.o - - DRMSRCS = ../../../../dri/drm/xf86drm.c \ - ../../../../dri/drm/xf86drmHash.c \ - ../../../../dri/drm/xf86drmRandom.c \ - ../../../../dri/drm/xf86drmSL.c \ - ../../../../dri/drm/xf86drmRadeon.c - - DRMOBJS = ../../../../dri/drm/xf86drm.o \ - ../../../../dri/drm/xf86drmHash.o \ - ../../../../dri/drm/xf86drmRandom.o \ - ../../../../dri/drm/xf86drmSL.o \ - ../../../../dri/drm/xf86drmRadeon.o - - MESASRCS = ../../aatriangle.c \ - ../../accum.c \ - ../../alpha.c \ - ../../alphabuf.c \ - ../../attrib.c \ - ../../bbox.c \ - ../../bitmap.c \ - ../../blend.c \ - ../../buffers.c \ - ../../clip.c \ - ../../colortab.c \ - ../../config.c \ - ../../context.c \ - ../../copypix.c \ - ../../cva.c \ - ../../debug_xform.c \ - ../../depth.c \ - ../../dlist.c \ - ../../drawpix.c \ - ../../enable.c \ - ../../enums.c \ - ../../eval.c \ - ../../extensions.c \ - ../../feedback.c \ - ../../fog.c \ - ../../get.c \ - ../../glapi.c \ - ../../glapinoop.c \ - ../../glthread.c \ - ../../hash.c \ - ../../image.c \ - ../../imaging.c \ - ../../light.c \ - ../../lines.c \ - ../../logic.c \ - ../../masking.c \ - ../../matrix.c \ - ../../mem.c \ - ../../mmath.c \ - ../../pb.c \ - ../../pipeline.c \ - ../../pixel.c \ - ../../pixeltex.c \ - ../../points.c \ - ../../polygon.c \ - ../../quads.c \ - ../../rastpos.c \ - ../../readpix.c \ - ../../rect.c \ - ../../scissor.c \ - ../../shade.c \ - ../../span.c \ - ../../stages.c \ - ../../state.c \ - ../../stencil.c \ - ../../teximage.c \ - ../../texobj.c \ - ../../texstate.c \ - ../../texture.c \ - ../../texutil.c \ - ../../translate.c \ - ../../triangle.c \ - ../../varray.c \ - ../../vb.c \ - ../../vbcull.c \ - ../../vbfill.c \ - ../../vbindirect.c \ - ../../vbrender.c \ - ../../vbxform.c \ - ../../vector.c \ - ../../vertices.c \ - ../../winpos.c \ - ../../xform.c \ - ../../zoom.c - - MESAOBJS = ../../aatriangle.o \ - ../../accum.o \ - ../../alpha.o \ - ../../alphabuf.o \ - ../../attrib.o \ - ../../bbox.o \ - ../../bitmap.o \ - ../../blend.o \ - ../../buffers.o \ - ../../clip.o \ - ../../colortab.o \ - ../../config.o \ - ../../context.o \ - ../../copypix.o \ - ../../cva.o \ - ../../debug_xform.o \ - ../../depth.o \ - ../../dlist.o \ - ../../drawpix.o \ - ../../enable.o \ - ../../enums.o \ - ../../eval.o \ - ../../extensions.o \ - ../../feedback.o \ - ../../fog.o \ - ../../get.o \ - ../../hash.o \ - ../../hint.o \ - ../../image.o \ - ../../imaging.o \ - ../../light.o \ - ../../lines.o \ - ../../logic.o \ - ../../masking.o \ - ../../matrix.o \ - ../../mem.o \ - ../../mmath.o \ - ../../pb.o \ - ../../pipeline.o \ - ../../pixel.o \ - ../../pixeltex.o \ - ../../points.o \ - ../../polygon.o \ - ../../quads.o \ - ../../rastpos.o \ - ../../readpix.o \ - ../../rect.o \ - ../../scissor.o \ - ../../shade.o \ - ../../span.o \ - ../../stages.o \ - ../../state.o \ - ../../stencil.o \ - ../../teximage.o \ - ../../texobj.o \ - ../../texstate.o \ - ../../texture.o \ - ../../texutil.o \ - ../../translate.o \ - ../../triangle.o \ - ../../varray.o \ - ../../vb.o \ - ../../vbcull.o \ - ../../vbfill.o \ - ../../vbindirect.o \ - ../../vbrender.o \ - ../../vbxform.o \ - ../../vector.o \ - ../../vertices.o \ - ../../winpos.o \ - ../../xform.o \ - ../../zoom.o - +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../Imakefile.inc" #ifdef i386Architecture - X86_SRCS = ../../X86/common_x86.c \ - ../../X86/common_x86_asm.S \ - ../../X86/x86.c \ - ../../X86/x86_cliptest.S \ - ../../X86/x86_vertex.S \ - ../../X86/x86_xform_masked2.S \ - ../../X86/x86_xform_masked3.S \ - ../../X86/x86_xform_masked4.S \ - ../../X86/x86_xform_raw2.S \ - ../../X86/x86_xform_raw3.S \ - ../../X86/x86_xform_raw4.S - - X86_OBJS = ../../X86/common_x86.o \ - ../../X86/common_x86_asm.o \ - ../../X86/x86.o \ - ../../X86/x86_cliptest.o \ - ../../X86/x86_vertex.o \ - ../../X86/x86_xform_masked2.o \ - ../../X86/x86_xform_masked3.o \ - ../../X86/x86_xform_masked4.o \ - ../../X86/x86_xform_raw2.o \ - ../../X86/x86_xform_raw3.o \ - ../../X86/x86_xform_raw4.o - -#if MesaUseMMX - MMX_SRCS = ../../X86/mmx_blend.S - - MMX_OBJS = ../../X86/mmx_blend.o +#include "../../X86/Imakefile.inc" #endif -#if MesaUse3DNow - 3DNOW_SRCS = ../../X86/3dnow.c \ - ../../X86/3dnow_norm_raw.S \ - ../../X86/3dnow_vertex.S \ - ../../X86/3dnow_xform_masked1.S \ - ../../X86/3dnow_xform_masked2.S \ - ../../X86/3dnow_xform_masked3.S \ - ../../X86/3dnow_xform_masked4.S \ - ../../X86/3dnow_xform_raw1.S \ - ../../X86/3dnow_xform_raw2.S \ - ../../X86/3dnow_xform_raw3.S \ - ../../X86/3dnow_xform_raw4.S + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - 3DNOW_OBJS = ../../X86/3dnow.o \ - ../../X86/3dnow_norm_raw.o \ - ../../X86/3dnow_vertex.o \ - ../../X86/3dnow_xform_masked1.o \ - ../../X86/3dnow_xform_masked2.o \ - ../../X86/3dnow_xform_masked3.o \ - ../../X86/3dnow_xform_masked4.o \ - ../../X86/3dnow_xform_raw1.o \ - ../../X86/3dnow_xform_raw2.o \ - ../../X86/3dnow_xform_raw3.o \ - ../../X86/3dnow_xform_raw4.o -#endif - -#if MesaUseKatmai - KATMAI_SRCS = ../../X86/katmai.c \ - ../../X86/katmai_norm_raw.S \ - ../../X86/katmai_vertex.S \ - ../../X86/katmai_xform_masked1.S \ - ../../X86/katmai_xform_masked2.S \ - ../../X86/katmai_xform_masked3.S \ - ../../X86/katmai_xform_masked4.S \ - ../../X86/katmai_xform_raw1.S \ - ../../X86/katmai_xform_raw2.S \ - ../../X86/katmai_xform_raw3.S \ - ../../X86/katmai_xform_raw4.S + DRIOBJS = $(GLXLIBSRC)/mesa/dri/dri_mesa.o \ + $(GLXLIBSRC)/dri/dri_tmm.o - KATMAI_OBJS = ../../X86/katmai.o \ - ../../X86/katmai_norm_raw.o \ - ../../X86/katmai_vertex.o \ - ../../X86/katmai_xform_masked1.o \ - ../../X86/katmai_xform_masked2.o \ - ../../X86/katmai_xform_masked3.o \ - ../../X86/katmai_xform_masked4.o \ - ../../X86/katmai_xform_raw1.o \ - ../../X86/katmai_xform_raw2.o \ - ../../X86/katmai_xform_raw3.o \ - ../../X86/katmai_xform_raw4.o -#endif -#endif -#endif + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRadeon.o #ifdef GlxSoProf LOSRCS = ../../../../lowpc.c @@ -338,49 +43,30 @@ MESA_INCLUDES = -I. -I.. -I../../include \ HIOBJS = ../../../../highpc.o #endif - ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) - - COMMONSRCS = ../common/mm.c ../common/hwlog.c - COMMONOBJS = ../common/mm.o ../common/hwlog.o - - SRCS = $(LOSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) \ - $(ASMSRCS) $(COMMONSRCS) $(RADEONSRCS) $(HISRCS) - OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) \ - $(ASMOBJS) $(COMMONOBJS) $(RADEONOBJS) $(HIOBJS) - -REQUIREDLIBS += MathLibrary -#if !GlxBuiltInRadeon -REQUIREDLIBS += -L../../../.. -lGL -#endif + SRCS = $(RADEONSRCS) + OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \ + $(MESA_ASM_OBJS) $(COMMONOBJS) $(RADEONOBJS) $(HIOBJS) - -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif +REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) #include <Library.tmpl> LibraryObjectRule() -SubdirLibraryRule($(OBJS)) +SubdirLibraryRule($(RADEONOBJS)) NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = radeon_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +SharedDepModuleTarget($(LIBNAME),DONE,$(OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #ifdef GlxSoProf SOPROF_LIBNAME = _radeon_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE,$(OBJS)) InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) #endif #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc b/xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc new file mode 100644 index 000000000..22559bead --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc @@ -0,0 +1,140 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/radeon/Imakefile.inc,v 1.1 2001/03/23 19:18:42 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvRadeonBuildDir +#define MesaDrvRadeonBuildDir /**/ +#endif +MESADRVRADEONBUILDDIR = MesaDrvRadeonBuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DDRIVERTS + DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ + -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) \ + -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/mesa/dri \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86OSSRC) \ + -I$(XF86DRIVERSRC)/ati \ + -I$(XF86COMSRC) \ + -I$(GLXLIBSRC)/dri/drm +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src \ + -I$(MESADRVSRCDIR)/common \ + -I$(MESADRVSRCDIR)/radeon + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + RADEONSRCS = $(MESADRVRADEONBUILDDIR)radeon_context.c \ + $(MESADRVRADEONBUILDDIR)radeon_dd.c \ + $(MESADRVRADEONBUILDDIR)radeon_fastpath.c \ + $(MESADRVRADEONBUILDDIR)radeon_eltpath.c \ + $(MESADRVRADEONBUILDDIR)radeon_ioctl.c \ + $(MESADRVRADEONBUILDDIR)radeon_lock.c \ + $(MESADRVRADEONBUILDDIR)radeon_pipeline.c \ + $(MESADRVRADEONBUILDDIR)radeon_screen.c \ + $(MESADRVRADEONBUILDDIR)radeon_span.c \ + $(MESADRVRADEONBUILDDIR)radeon_state.c \ + $(MESADRVRADEONBUILDDIR)radeon_tex.c \ + $(MESADRVRADEONBUILDDIR)radeon_texmem.c \ + $(MESADRVRADEONBUILDDIR)radeon_texstate.c \ + $(MESADRVRADEONBUILDDIR)radeon_tris.c \ + $(MESADRVRADEONBUILDDIR)radeon_vb.c \ + $(MESADRVRADEONBUILDDIR)radeon_xmesa.c + + RADEONOBJS = $(MESADRVRADEONBUILDDIR)radeon_context.o \ + $(MESADRVRADEONBUILDDIR)radeon_dd.o \ + $(MESADRVRADEONBUILDDIR)radeon_fastpath.o \ + $(MESADRVRADEONBUILDDIR)radeon_eltpath.o \ + $(MESADRVRADEONBUILDDIR)radeon_ioctl.o \ + $(MESADRVRADEONBUILDDIR)radeon_lock.o \ + $(MESADRVRADEONBUILDDIR)radeon_pipeline.o \ + $(MESADRVRADEONBUILDDIR)radeon_screen.o \ + $(MESADRVRADEONBUILDDIR)radeon_span.o \ + $(MESADRVRADEONBUILDDIR)radeon_state.o \ + $(MESADRVRADEONBUILDDIR)radeon_tex.o \ + $(MESADRVRADEONBUILDDIR)radeon_texmem.o \ + $(MESADRVRADEONBUILDDIR)radeon_texstate.o \ + $(MESADRVRADEONBUILDDIR)radeon_tris.o \ + $(MESADRVRADEONBUILDDIR)radeon_vb.o \ + $(MESADRVRADEONBUILDDIR)radeon_xmesa.o + + RADEONUOBJS = $(MESADRVRADEONBUILDDIR)unshared/radeon_context.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_dd.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_fastpath.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_eltpath.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_ioctl.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_lock.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_pipeline.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_screen.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_span.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_state.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_tex.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_texmem.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_texstate.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_tris.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_vb.o \ + $(MESADRVRADEONBUILDDIR)unshared/radeon_xmesa.o + + RADEONDOBJS = $(MESADRVRADEONBUILDDIR)debugger/radeon_context.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_dd.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_fastpath.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_eltpath.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_ioctl.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_lock.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_pipeline.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_screen.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_span.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_state.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_tex.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_texmem.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_texstate.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_tris.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_vb.o \ + $(MESADRVRADEONBUILDDIR)debugger/radeon_xmesa.o + + RADEONPOBJS = $(MESADRVRADEONBUILDDIR)profiled/radeon_context.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_dd.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_fastpath.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_eltpath.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_ioctl.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_lock.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_pipeline.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_screen.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_span.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_state.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_tex.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_texmem.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_texstate.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_tris.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_vb.o \ + $(MESADRVRADEONBUILDDIR)profiled/radeon_xmesa.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(radeon_context.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_dd.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_fastpath.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_eltpath.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_ioctl.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_lock.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_pipeline.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_screen.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_span.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_state.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_tex.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_texmem.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_texstate.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_tris.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_vb.c, $(MESADRVSRCDIR)/radeon) +LinkSourceFile(radeon_xmesa.c, $(MESADRVSRCDIR)/radeon) +#endif + diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c index 9af8b5691..55ac23d0b 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.c,v 1.1 2001/01/08 01:07:26 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.c,v 1.2 2001/03/21 16:14:24 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -58,9 +58,29 @@ int RADEON_DEBUG = (0 /* | DEBUG_VERBOSE_DRI */ /* | DEBUG_VERBOSE_IOCTL */ /* | DEBUG_VERBOSE_2D */ +/* | DEBUG_VERBOSE_TEXTURE */ ); #endif +#ifdef PER_CONTEXT_SAREA +char *radeonGetPerContextSAREA(int fd, + drmContext hHWContext, + drmSize size) +{ + drmHandle handle; + drmAddress address; + + if(drmGetContextPrivateMapping(fd, hHWContext, &handle) < 0) { + return NULL; + } + if(drmMap(fd, handle, size, &address) < 0) { + return NULL; + } + + return address; +} +#endif + /* Create the device specific context. */ GLboolean radeonCreateContext( Display *dpy, GLvisual *glVisual, @@ -89,7 +109,18 @@ GLboolean radeonCreateContext( Display *dpy, GLvisual *glVisual, radeonScreen = rmesa->radeonScreen = (radeonScreenPtr)(sPriv->private); rmesa->sarea = (RADEONSAREAPrivPtr)((char *)sPriv->pSAREA + - sizeof(XF86DRISAREARec)); + radeonScreen->sarea_priv_offset); + +#ifdef PER_CONTEXT_SAREA + rmesa->private_sarea = radeonGetPerContextSAREA(rmesa->driFd, + rmesa->hHWContext, + radeonScreen->private_sarea_size); + if(!rmesa->private_sarea) { + fprintf(stderr, "Can't map private SAREA\n"); + FREE( rmesa ); + return GL_FALSE; + } +#endif rmesa->tmp_matrix = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); if ( !rmesa->tmp_matrix ) { @@ -133,16 +164,8 @@ GLboolean radeonCreateContext( Display *dpy, GLvisual *glVisual, ctx->Const.MaxTextureSize = (1 << 10); } - /* FIXME: Support all available texture units... */ ctx->Const.MaxTextureUnits = 2; -#if ENABLE_PERF_BOXES - if (getenv("LIBGL_PERFORMANCE_BOXES")) - rmesa->boxes = 1; - else - rmesa->boxes = 0; -#endif - ctx->DriverCtx = (void *)rmesa; radeonDDInitExtensions( ctx ); @@ -184,10 +207,19 @@ GLboolean radeonCreateContext( Display *dpy, GLvisual *glVisual, void radeonDestroyContext( radeonContextPtr rmesa ) { if ( rmesa ) { + radeonScreenPtr radeonScreen = rmesa->radeonScreen; radeonTexObjPtr t, next_t; int i; - for ( i = 0 ; i < rmesa->radeonScreen->numTexHeaps ; i++ ) { +#ifdef PER_CONTEXT_SAREA + if ( rmesa->private_sarea ) { + drmUnmap( (drmAddress)rmesa->private_sarea, + radeonScreen->private_sarea_size ); + rmesa->private_sarea = NULL; + } +#endif + + for ( i = 0 ; i < radeonScreen->numTexHeaps ; i++ ) { foreach_s ( t, next_t, &rmesa->TexObjList[i] ) { radeonDestroyTexObj( rmesa, t ); } diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h index cae9d5b30..0184a5b82 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.h,v 1.1 2001/01/08 01:07:26 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.h,v 1.2 2001/03/21 16:14:24 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -81,6 +81,16 @@ typedef struct radeon_context *radeonContextPtr; #define RADEON_FALLBACK_MULTIDRAW 0x0020 #define RADEON_FALLBACK_LOGICOP 0x0040 +/* Subpixel offsets for window coordinates (triangles): + */ +#define SUBPIXEL_X (0.0625) +#define SUBPIXEL_Y (0.125) + +/* Offset for points: + */ +#define PNT_X_OFFSET ( 0.125F) +#define PNT_Y_OFFSET (-0.125F) + typedef void (*radeon_interp_func)( GLfloat t, GLfloat *result, const GLfloat *in, @@ -115,10 +125,12 @@ struct radeon_context { GLuint vc_format; GLfloat depth_scale; - CARD32 Color; /* Current draw color */ - CARD32 ClearColor; /* Color used to clear color buffer */ - CARD32 ClearDepth; /* Value used to clear depth buffer */ - CARD32 ClearStencil; /* Value used to clear stencil */ + GLuint Color; /* Current draw color */ + GLuint ClearColor; /* Color used to clear color buffer */ + GLuint ClearDepth; /* Value used to clear depth buffer */ + GLuint ClearStencil; /* Value used to clear stencil */ + GLuint DepthMask; + GLuint StencilMask; /* Map GL texture units onto hardware */ @@ -200,6 +212,8 @@ struct radeon_context { __DRIscreenPrivate *driScreen; /* DRI screen */ __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */ + int lastStamp; /* mirror driDrawable->lastStamp */ + drmContext hHWContext; drmLock *driHwLock; int driFd; @@ -207,6 +221,10 @@ struct radeon_context { radeonScreenPtr radeonScreen; /* Screen private DRI data */ RADEONSAREAPrivPtr sarea; /* Private SAREA data */ +#ifdef PER_CONTEXT_SAREA + char *private_sarea; /* Per-context private SAREA */ +#endif + /* Performance counters */ GLuint boxes; /* Draw performance boxes */ @@ -248,6 +266,7 @@ extern int RADEON_DEBUG; #define DEBUG_VERBOSE_DRI 0x10 #define DEBUG_VERBOSE_IOCTL 0x20 #define DEBUG_VERBOSE_2D 0x40 +#define DEBUG_VERBOSE_TEXTURE 0x80 #endif #endif /* __RADEON_CONTEXT_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c index 52cf810cc..d55809fb8 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c,v 1.3 2001/01/21 21:19:09 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c,v 1.5 2001/03/25 05:32:00 tsi Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -46,7 +46,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "X86/common_x86_asm.h" #endif -#define RADEON_DATE "20010105" +#define RADEON_DATE "20010319" /* Return the width and height of the current color buffer. @@ -100,6 +100,11 @@ static const GLubyte *radeonDDGetString( GLcontext *ctx, GLenum name ) strncat( buffer, " x86", 4 ); } #endif +#ifdef USE_MMX_ASM + if ( cpu_has_mmx ) { + strncat( buffer, "/MMX", 4 ); + } +#endif #ifdef USE_3DNOW_ASM if ( cpu_has_3dnow ) { strncat( buffer, "/3DNow!", 7 ); diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_eltpath.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_eltpath.c index 6b2f36614..48947399c 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_eltpath.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_eltpath.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_eltpath.c,v 1.1 2001/01/08 01:07:26 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_eltpath.c,v 1.2 2001/04/01 14:00:00 tsi Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -70,10 +70,10 @@ static void fire_elts( radeonContextPtr rmesa ) if ( rmesa->first_elt != rmesa->next_elt ) { radeonFireEltsLocked( rmesa, - ((GLuint)rmesa->first_elt - - (GLuint)rmesa->elt_buf->address), - ((GLuint)rmesa->next_elt - - (GLuint)rmesa->elt_buf->address), + ((char *)rmesa->first_elt - + (char *)rmesa->elt_buf->address), + ((char *)rmesa->next_elt - + (char *)rmesa->elt_buf->address), !retain ); } else if ( !retain ) { radeonReleaseBufLocked( rmesa, rmesa->elt_buf ); @@ -98,7 +98,7 @@ static void fire_elts( radeonContextPtr rmesa ) (((rmesa->elt_buf->idx + 1) * RADEON_BUFFER_SIZE / (8 * sizeof(GLuint))) - 1); rmesa->next_vert = (GLfloat *) - ((GLuint)rmesa->vert_heap + + ((char *)rmesa->vert_heap + rmesa->next_vert_index * 8 * sizeof(GLfloat)); break; @@ -107,7 +107,7 @@ static void fire_elts( radeonContextPtr rmesa ) (((rmesa->elt_buf->idx + 1) * RADEON_BUFFER_SIZE / (10 * sizeof(GLuint))) - 1); rmesa->next_vert = (GLfloat *) - ((GLuint)rmesa->vert_heap + + ((char *)rmesa->vert_heap + rmesa->next_vert_index * 10 * sizeof(GLfloat)); break; } @@ -126,10 +126,10 @@ static void release_bufs( radeonContextPtr rmesa ) LOCK_HARDWARE( rmesa ); if ( rmesa->first_elt != rmesa->next_elt ) { radeonFireEltsLocked( rmesa, - ((GLuint)rmesa->first_elt - - (GLuint)rmesa->elt_buf->address), - ((GLuint)rmesa->next_elt - - (GLuint)rmesa->elt_buf->address), + ((char *)rmesa->first_elt - + (char *)rmesa->elt_buf->address), + ((char *)rmesa->next_elt - + (char *)rmesa->elt_buf->address), 0 ); ALIGN_NEXT_ELT( rmesa ); @@ -236,8 +236,8 @@ static void radeon_tri_clip( radeonContextPtr rmesa, { GLuint *out = inlist[in]; - GLint space = (GLint)((GLuint)rmesa->next_vert - - (GLuint)rmesa->next_elt); + GLint space = (GLint)((char *)rmesa->next_vert - + (char *)rmesa->next_elt); if ( space < (GLint)(n * (vertsize + 2) * sizeof(GLuint)) ) { fire_elts( rmesa ); @@ -277,8 +277,8 @@ static void radeon_tri_clip( radeonContextPtr rmesa, #define TRIANGLE( e2, e1, e0 ) \ do { \ - if ( (GLint)((GLuint)rmesa->next_vert - \ - (GLuint)rmesa->next_elt) < TRI_THRESHOLD ) { \ + if ( (GLint)((char *)rmesa->next_vert - \ + (char *)rmesa->next_elt) < TRI_THRESHOLD ) { \ fire_elts( rmesa ); \ } \ rmesa->next_elt[0] = UNCLIPPED_VERT( e2 ); \ @@ -465,8 +465,8 @@ void radeonDDEltPath( struct vertex_buffer *VB ) if ( rmesa->new_state ) radeonDDUpdateHWState( ctx ); - space = (GLint)((GLuint)rmesa->next_vert - - (GLuint)rmesa->next_elt); + space = (GLint)((char *)rmesa->next_vert - + (char *)rmesa->next_elt); /* Allocate a single buffer to hold unclipped vertices. All * unclipped vertices must be contiguous. diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c index 5273072e7..550dcda3c 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v 1.1 2001/01/08 01:07:27 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v 1.3 2001/04/01 14:00:00 tsi Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -271,7 +271,7 @@ void radeonFireEltsLocked( radeonContextPtr rmesa, } rmesa->sarea->dirty |= RADEON_UPLOAD_CLIPRECTS; - drmRadeonFlushIndices( fd, prim, buffer->idx, start, end, discard ); + drmRadeonFlushIndices( fd, prim, buffer->idx, start, end, d ); } } @@ -282,10 +282,10 @@ void radeonFlushEltsLocked( radeonContextPtr rmesa ) { if ( rmesa->first_elt != rmesa->next_elt ) { radeonFireEltsLocked( rmesa, - ((GLuint)rmesa->first_elt - - (GLuint)rmesa->elt_buf->address), - ((GLuint)rmesa->next_elt - - (GLuint)rmesa->elt_buf->address), + ((char *)rmesa->first_elt - + (char *)rmesa->elt_buf->address), + ((char *)rmesa->next_elt - + (char *)rmesa->elt_buf->address), 0 ); ALIGN_NEXT_ELT( rmesa ); @@ -321,6 +321,7 @@ void radeonFireBlitLocked( radeonContextPtr rmesa, drmBufPtr buffer, GLint offset, GLint pitch, GLint format, GLint x, GLint y, GLint width, GLint height ) { +#if 0 GLint ret; ret = drmRadeonTextureBlit( rmesa->driFd, buffer->idx, @@ -332,6 +333,7 @@ void radeonFireBlitLocked( radeonContextPtr rmesa, drmBufPtr buffer, fprintf( stderr, "drmRadeonTextureBlit: return = %d\n", ret ); exit( 1 ); } +#endif } @@ -431,7 +433,7 @@ void radeonSwapBuffers( radeonContextPtr rmesa ) GLint n = 0; for ( ; i < nr ; i++ ) { - *b++ = *(XF86DRIClipRectRec *)&box[i]; + *b++ = *(XF86DRIClipRectPtr)&box[i]; n++; } rmesa->sarea->nbox = n; @@ -539,6 +541,8 @@ static GLbitfield radeonDDClear( GLcontext *ctx, GLbitfield mask, #endif CARD32 clear; GLuint flags = 0; + GLuint color_mask = 0; + GLuint depth_mask = 0; GLint ret, i; if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { @@ -557,17 +561,20 @@ static GLbitfield radeonDDClear( GLcontext *ctx, GLbitfield mask, if ( mask & DD_FRONT_LEFT_BIT ) { flags |= DRM_RADEON_FRONT; + color_mask = rmesa->setup.rb3d_planemask; mask &= ~DD_FRONT_LEFT_BIT; } if ( mask & DD_BACK_LEFT_BIT ) { flags |= DRM_RADEON_BACK; + color_mask = rmesa->setup.rb3d_planemask; mask &= ~DD_BACK_LEFT_BIT; } if ( mask & DD_DEPTH_BIT ) { if ( ctx->Depth.Mask ) { flags |= DRM_RADEON_DEPTH; + depth_mask |= rmesa->DepthMask; } mask &= ~DD_DEPTH_BIT; } @@ -575,6 +582,7 @@ static GLbitfield radeonDDClear( GLcontext *ctx, GLbitfield mask, /* FIXME: Add stencil support */ if ( mask & DD_STENCIL_BIT ) { flags |= DRM_RADEON_DEPTH; + depth_mask |= rmesa->StencilMask; mask &= ~DD_STENCIL_BIT; } #endif @@ -610,10 +618,6 @@ static GLbitfield radeonDDClear( GLcontext *ctx, GLbitfield mask, } #endif - if ( rmesa->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { - radeonEmitHwStateLocked( rmesa ); - } - for ( i = 0 ; i < rmesa->numClipRects ; ) { GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS, rmesa->numClipRects ); XF86DRIClipRectPtr box = rmesa->pClipRects; @@ -643,7 +647,7 @@ static GLbitfield radeonDDClear( GLcontext *ctx, GLbitfield mask, } } else { for ( ; i < nr ; i++ ) { - *b++ = *(XF86DRIClipRectRec *)&box[i]; + *b++ = *(XF86DRIClipRectPtr)&box[i]; n++; } } @@ -660,8 +664,9 @@ static GLbitfield radeonDDClear( GLcontext *ctx, GLbitfield mask, } ret = drmRadeonClear( rmesa->driFd, flags, - cx, cy, cw, ch, - rmesa->ClearColor, rmesa->ClearDepth ); + rmesa->ClearColor, rmesa->ClearDepth, + color_mask, depth_mask, + rmesa->sarea->boxes, rmesa->sarea->nbox ); if ( ret ) { UNLOCK_HARDWARE( rmesa ); diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h index 7b22a8766..c8f631ab0 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h,v 1.1 2001/01/08 01:07:27 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h,v 1.2 2001/04/01 14:00:00 tsi Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -131,7 +131,7 @@ do { \ #define ALIGN_NEXT_ELT( rmesa ) \ do { \ rmesa->next_elt = (GLushort *) \ - (((GLuint)rmesa->next_elt + 7) & ~0x7); \ + (((unsigned long)rmesa->next_elt + 7) & ~0x7); \ rmesa->next_elt = (GLushort *) \ ((GLubyte *)rmesa->next_elt + RADEON_INDEX_PRIM_OFFSET); \ } while (0) diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c index 65658e997..e506eea94 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c,v 1.1 2001/01/08 01:07:27 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c,v 1.2 2001/03/21 16:14:24 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -57,7 +57,6 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags ) __DRIdrawablePrivate *dPriv = rmesa->driDrawable; __DRIscreenPrivate *sPriv = rmesa->driScreen; RADEONSAREAPrivPtr sarea = rmesa->sarea; - int stamp = dPriv->lastStamp; int i; drmGetLock( rmesa->driFd, rmesa->hHWContext, flags ); @@ -72,7 +71,8 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags ) */ XMESA_VALIDATE_DRAWABLE_INFO( rmesa->display, sPriv, dPriv ); - if ( stamp != dPriv->lastStamp ) { + if ( rmesa->lastStamp != dPriv->lastStamp ) { + rmesa->lastStamp = dPriv->lastStamp; rmesa->new_state |= RADEON_NEW_WINDOW | RADEON_NEW_CLIP; rmesa->SetupDone = 0; } diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c index e3cb90812..7e901d9c7 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c,v 1.1 2001/01/08 01:07:27 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -61,39 +61,6 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) radeonScreenPtr radeonScreen; RADEONDRIPtr radeonDRIPriv = (RADEONDRIPtr)sPriv->pDevPriv; - /* Check the DRI version */ - { - int major, minor, patch; - if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) { - if ( major != 3 || minor != 1 || patch < 0 ) { - char msg[128]; - sprintf( msg, "Radeon DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch ); - __driMesaMessage( msg ); - return GL_FALSE; - } - } - } - - /* Check that the DDX driver version is compatible */ - if ( sPriv->ddxMajor != 4 || - sPriv->ddxMinor != 0 || - sPriv->ddxPatch < 0 ) { - char msg[128]; - sprintf( msg, "Radeon DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch ); - __driMesaMessage( msg ); - return GL_FALSE; - } - - /* Check that the DRM driver version is compatible */ - if ( sPriv->drmMajor != 1 || - sPriv->drmMinor != 0 || - sPriv->drmPatch < 0 ) { - char msg[128]; - sprintf( msg, "Radeon DRI driver expected DRM driver version 2.1.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); - __driMesaMessage( msg ); - return GL_FALSE; - } - /* Allocate the private area */ radeonScreen = (radeonScreenPtr) CALLOC( sizeof(*radeonScreen) ); if ( !radeonScreen ) return NULL; @@ -192,6 +159,11 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) } radeonScreen->driScreen = sPriv; + radeonScreen->sarea_priv_offset = radeonDRIPriv->sarea_priv_offset; + +#ifdef PER_CONTEXT_SAREA + radeonScreen->perctx_sarea_size = radeonDRIPriv->perctx_sarea_size; +#endif radeonDDSetupInit(); radeonDDTriangleFuncsInit(); diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h index 852e4f30a..e2ee91708 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h,v 1.1 2001/01/08 01:07:27 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -68,6 +68,10 @@ typedef struct { int texSize[RADEON_NR_TEX_HEAPS]; int logTexGranularity[RADEON_NR_TEX_HEAPS]; +#ifdef PER_CONTEXT_SAREA + drmSize private_sarea_size; +#endif + radeonRegionRec mmio; radeonRegionRec status; radeonRegionRec agpTextures; @@ -77,7 +81,7 @@ typedef struct { __volatile__ CARD32 *scratch; __DRIscreenPrivate *driScreen; - + unsigned int sarea_priv_offset; } radeonScreenRec, *radeonScreenPtr; extern radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ); diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c index 74ce2c827..baa8201e1 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.c,v 1.2 2001/01/16 05:10:58 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.c,v 1.3 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -57,7 +57,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. rmesa->readOffset + \ (dPriv->x * radeonScreen->cpp) + \ (dPriv->y * pitch)); \ - GLushort p; \ + GLuint p; \ (void) read_buf; (void) buf; (void) p #define LOCAL_DEPTH_VARS \ @@ -80,13 +80,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ - if ((_y < miny) || (_y >= maxy)) { \ + if ( _y < miny || _y >= maxy ) { \ _n1 = 0, _x1 = x; \ } else { \ _n1 = _n; \ _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx); \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ } #define Y_FLIP( _y ) (height - _y - 1) @@ -229,10 +229,10 @@ static GLuint radeon_mba_z32( radeonContextPtr rmesa, /* 16-bit depth buffer functions */ #define WRITE_DEPTH( _x, _y, d ) \ - *(GLushort *)(buf + radeon_mba_z16( rmesa, _x+xo, _y+yo )) = d; + *(GLushort *)(buf + radeon_mba_z16( rmesa, _x + xo, _y + yo )) = d; #define READ_DEPTH( d, _x, _y ) \ - d = *(GLushort *)(buf + radeon_mba_z16( rmesa, _x+xo, _y+yo )); + d = *(GLushort *)(buf + radeon_mba_z16( rmesa, _x + xo, _y + yo )); #define TAG(x) radeon##x##_16 #include "depthtmp.h" @@ -241,7 +241,7 @@ static GLuint radeon_mba_z32( radeonContextPtr rmesa, */ #define WRITE_DEPTH( _x, _y, d ) \ do { \ - GLuint offset = radeon_mba_z32( rmesa, _x+xo, _y+yo ); \ + GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \ GLuint tmp = *(GLuint *)(buf + offset); \ tmp &= 0xff000000; \ tmp |= ((d) & 0x00ffffff); \ @@ -249,7 +249,8 @@ do { \ } while (0) #define READ_DEPTH( d, _x, _y ) \ - d = *(GLuint *)(buf + radeon_mba_z32( rmesa, _x+xo, _y+yo )) & 0x00ffffff; + d = *(GLuint *)(buf + radeon_mba_z32( rmesa, _x + xo, \ + _y + yo )) & 0x00ffffff; #define TAG(x) radeon##x##_24_8 #include "depthtmp.h" @@ -263,7 +264,7 @@ do { \ */ #define WRITE_STENCIL( _x, _y, d ) \ do { \ - GLuint offset = radeon_mba_z32( rmesa, _x+xo, _y+yo ); \ + GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \ GLuint tmp = *(GLuint *)(buf + offset); \ tmp &= 0x00ffffff; \ tmp |= (((d) & 0xff) << 24); \ @@ -272,7 +273,7 @@ do { \ #define READ_STENCIL( d, _x, _y ) \ do { \ - GLuint offset = radeon_mba_z32( rmesa, _x+xo, _y+yo ); \ + GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \ GLuint tmp = *(GLuint *)(buf + offset); \ tmp &= 0xff000000; \ d = tmp >> 24; \ @@ -326,10 +327,12 @@ void radeonDDInitSpanFuncs( GLcontext *ctx ) ctx->Driver.ReadDepthPixels = radeonReadDepthPixels_24_8; ctx->Driver.WriteDepthPixels = radeonWriteDepthPixels_24_8; +#if 0 /* only need these for hardware stencil buffers */ ctx->Driver.ReadStencilSpan = radeonReadStencilSpan_24_8; ctx->Driver.WriteStencilSpan = radeonWriteStencilSpan_24_8; ctx->Driver.ReadStencilPixels = radeonReadStencilPixels_24_8; ctx->Driver.WriteStencilPixels = radeonWriteStencilPixels_24_8; +#endif break; default: diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c index 8cec8ff52..05b4cdf86 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_state.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.c,v 1.1 2001/01/08 01:07:28 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.c,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -54,10 +54,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. static void radeonUpdateAlphaMode( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - CARD32 a = rmesa->setup.pp_misc; - CARD32 p = rmesa->setup.pp_cntl; - CARD32 b = rmesa->setup.rb3d_blendcntl; - CARD32 c = rmesa->setup.rb3d_cntl; + GLuint a = rmesa->setup.pp_misc; + GLuint p = rmesa->setup.pp_cntl; + GLuint b = rmesa->setup.rb3d_blendcntl; + GLuint c = rmesa->setup.rb3d_cntl; if ( ctx->Color.AlphaEnabled ) { GLubyte ref = ctx->Color.AlphaRef; @@ -194,6 +194,11 @@ static void radeonDDBlendEquation( GLcontext *ctx, GLenum mode ) FLUSH_BATCH( rmesa ); rmesa->new_state |= RADEON_NEW_ALPHA; + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + rmesa->Fallback |= RADEON_FALLBACK_LOGICOP; + else + rmesa->Fallback &= ~RADEON_FALLBACK_LOGICOP; } static void radeonDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor ) @@ -222,8 +227,8 @@ static void radeonDDBlendFuncSeparate( GLcontext *ctx, static void radeonUpdateZMode( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - CARD32 z = rmesa->setup.rb3d_zstencilcntl; - CARD32 c = rmesa->setup.rb3d_cntl; + GLuint z = rmesa->setup.rb3d_zstencilcntl; + GLuint c = rmesa->setup.rb3d_cntl; if ( ctx->Depth.Test ) { z &= ~RADEON_Z_TEST_MASK; @@ -314,9 +319,9 @@ static void radeonDDClearDepth( GLcontext *ctx, GLclampd d ) static void radeonUpdateFogAttrib( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - CARD32 p = rmesa->setup.pp_cntl; + GLuint p = rmesa->setup.pp_cntl; GLubyte c[4]; - CARD32 col; + GLuint col; if ( ctx->FogMode == FOG_FRAGMENT ) { p |= RADEON_FOG_ENABLE; @@ -378,8 +383,8 @@ static void radeonUpdateClipping( GLcontext *ctx ) rmesa->scissor_rect.x1 = x + rmesa->driDrawable->x; rmesa->scissor_rect.y1 = y + rmesa->driDrawable->y; - rmesa->scissor_rect.x2 = w + rmesa->driDrawable->x; - rmesa->scissor_rect.y2 = h + rmesa->driDrawable->y; + rmesa->scissor_rect.x2 = w + rmesa->driDrawable->x + 1; + rmesa->scissor_rect.y2 = h + rmesa->driDrawable->y + 1; rmesa->dirty |= RADEON_UPLOAD_CLIPRECTS; } @@ -402,7 +407,7 @@ static void radeonDDScissor( GLcontext *ctx, static void radeonUpdateCull( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - CARD32 s = rmesa->setup.se_cntl; + GLuint s = rmesa->setup.se_cntl; s &= ~RADEON_FFACE_CULL_DIR_MASK; @@ -483,7 +488,8 @@ static GLboolean radeonDDColorMask( GLcontext *ctx, FLUSH_BATCH( rmesa ); rmesa->new_state |= RADEON_NEW_MASKS; - return GL_TRUE; + return GL_FALSE; /* This forces the software paths to do colormasking. */ + /* This function will return void when we use Mesa 3.5 */ } @@ -501,11 +507,12 @@ static void radeonDDLightModelfv( GLcontext *ctx, GLenum pname, radeonContextPtr rmesa = RADEON_CONTEXT(ctx); if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) { - CARD32 p = rmesa->setup.pp_cntl; + GLuint p = rmesa->setup.pp_cntl; FLUSH_BATCH( rmesa ); - if ( ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ) { + if ( ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR && + ctx->Light.Enabled && ctx->Texture.ReallyEnabled) { p |= RADEON_SPECULAR_ENABLE; } else { p &= ~RADEON_SPECULAR_ENABLE; @@ -521,7 +528,7 @@ static void radeonDDLightModelfv( GLcontext *ctx, GLenum pname, static void radeonDDShadeModel( GLcontext *ctx, GLenum mode ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - CARD32 s = rmesa->setup.se_cntl; + GLuint s = rmesa->setup.se_cntl; s &= ~(RADEON_DIFFUSE_SHADE_MASK | RADEON_ALPHA_SHADE_MASK | @@ -566,10 +573,8 @@ void radeonUpdateWindow( GLcontext *ctx ) GLfloat xoffset = (GLfloat)dPriv->x; GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h; const GLfloat one = 1.0; -#if 0 - CARD32 m = rmesa->setup.re_misc; - CARD32 sx, sy; -#endif + GLuint m = rmesa->setup.re_misc; + GLuint sx, sy; rmesa->setup.se_vport_xscale = *(GLuint *)&one; rmesa->setup.se_vport_xoffset = *(GLuint *)&xoffset; @@ -578,14 +583,14 @@ void radeonUpdateWindow( GLcontext *ctx ) rmesa->setup.se_vport_zscale = *(GLuint *)&rmesa->depth_scale; rmesa->setup.se_vport_zoffset = 0x00000000; -#if 0 - /* FIXME: This appears to be broken... - */ + /* Update polygon stipple offsets */ m &= ~(RADEON_STIPPLE_X_OFFSET_MASK | RADEON_STIPPLE_Y_OFFSET_MASK); - sx = rmesa->driDrawable->x & RADEON_STIPPLE_COORD_MASK; - sy = rmesa->driDrawable->y & RADEON_STIPPLE_COORD_MASK; + /* add magic offsets, then invert */ + sx = 31 - ((rmesa->driDrawable->x - 1) & RADEON_STIPPLE_COORD_MASK); + sy = 31 - ((rmesa->driDrawable->y + rmesa->driDrawable->h - 1) + & RADEON_STIPPLE_COORD_MASK); m |= ((sx << RADEON_STIPPLE_X_OFFSET_SHIFT) | (sy << RADEON_STIPPLE_Y_OFFSET_SHIFT)); @@ -594,7 +599,7 @@ void radeonUpdateWindow( GLcontext *ctx ) rmesa->setup.re_misc = m; rmesa->dirty |= RADEON_UPLOAD_MISC; } -#endif + rmesa->dirty |= RADEON_UPLOAD_VIEWPORT; } @@ -623,9 +628,9 @@ static void radeonDDColor( GLcontext *ctx, static void radeonDDLogicOpCode( GLcontext *ctx, GLenum opcode ) { - if ( ctx->Color.ColorLogicOpEnabled ) { - radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + if ( ctx->Color.ColorLogicOpEnabled ) { FLUSH_BATCH( rmesa ); /* FIXME: We can do color logic ops. @@ -636,6 +641,8 @@ static void radeonDDLogicOpCode( GLcontext *ctx, GLenum opcode ) rmesa->Fallback |= RADEON_FALLBACK_LOGICOP; } } + else + rmesa->Fallback &= ~RADEON_FALLBACK_LOGICOP; } static GLboolean radeonDDSetDrawBuffer( GLcontext *ctx, GLenum mode ) @@ -705,7 +712,12 @@ static void radeonDDSetReadBuffer( GLcontext *ctx, static void radeonDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - GLuint *stipple = (GLuint *)mask; + GLuint i, stipple[32]; + + /* must flip pattern upside down */ + for (i = 0; i < 32; i++) { + stipple[31 - i] = ((GLuint *) mask)[i]; + } FLUSH_BATCH( rmesa ); @@ -738,9 +750,18 @@ static void radeonDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) switch ( cap ) { case GL_ALPHA_TEST: + FLUSH_BATCH( rmesa ); + rmesa->new_state |= RADEON_NEW_ALPHA; + break; + case GL_BLEND: FLUSH_BATCH( rmesa ); rmesa->new_state |= RADEON_NEW_ALPHA; + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + rmesa->Fallback |= RADEON_FALLBACK_LOGICOP; + else + rmesa->Fallback &= ~RADEON_FALLBACK_LOGICOP; break; case GL_CULL_FACE: @@ -755,7 +776,7 @@ static void radeonDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_DITHER: do { - CARD32 r = rmesa->setup.rb3d_cntl; + GLuint r = rmesa->setup.rb3d_cntl; FLUSH_BATCH( rmesa ); if ( ctx->Color.DitherFlag ) { @@ -776,7 +797,6 @@ static void radeonDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) rmesa->new_state |= RADEON_NEW_FOG; break; - case GL_INDEX_LOGIC_OP: case GL_COLOR_LOGIC_OP: FLUSH_BATCH( rmesa ); if ( state && ctx->Color.LogicOp != GL_COPY ) { @@ -786,6 +806,22 @@ static void radeonDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; + case GL_LIGHTING: + { + GLuint p = rmesa->setup.pp_cntl; + if ( ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR && + ctx->Light.Enabled && ctx->Texture.ReallyEnabled) { + p |= RADEON_SPECULAR_ENABLE; + } else { + p &= ~RADEON_SPECULAR_ENABLE; + } + if ( rmesa->setup.pp_cntl != p ) { + rmesa->setup.pp_cntl = p; + rmesa->dirty |= RADEON_UPLOAD_CONTEXT; + } + break; + } + case GL_SCISSOR_TEST: FLUSH_BATCH( rmesa ); rmesa->scissor = state; @@ -900,29 +936,29 @@ void radeonEmitHwStateLocked( radeonContextPtr rmesa ) if ( (rmesa->dirty & RADEON_UPLOAD_TEX0) && t0 ) { radeon_texture_regs_t *tex = &sarea->TexState[0]; - tex->pp_txfilter = t0->setup.pp_txfilter | rmesa->lod_bias[0] << 8; - tex->pp_txformat = t0->setup.pp_txformat | RADEON_TXF_ST_ROUTE_STQ0; - tex->pp_txoffset = t0->setup.pp_txoffset; + tex->pp_txfilter = t0->pp_txfilter | rmesa->lod_bias[0] << 8; + tex->pp_txformat = t0->pp_txformat | RADEON_TXFORMAT_ST_ROUTE_STQ0; + tex->pp_txoffset = t0->pp_txoffset; tex->pp_txcblend = rmesa->color_combine[0]; tex->pp_txablend = rmesa->alpha_combine[0]; tex->pp_tfactor = rmesa->env_color[0]; - tex->pp_border_color = t0->setup.pp_border_color; + tex->pp_border_color = t0->pp_border_color; } if ( (rmesa->dirty & RADEON_UPLOAD_TEX1) && t1 ) { radeon_texture_regs_t *tex = &sarea->TexState[1]; - tex->pp_txfilter = t1->setup.pp_txfilter | rmesa->lod_bias[1] << 8; - tex->pp_txformat = t1->setup.pp_txformat | RADEON_TXF_ST_ROUTE_STQ1; - tex->pp_txoffset = t1->setup.pp_txoffset; + tex->pp_txfilter = t1->pp_txfilter | rmesa->lod_bias[1] << 8; + tex->pp_txformat = t1->pp_txformat | RADEON_TXFORMAT_ST_ROUTE_STQ1; + tex->pp_txoffset = t1->pp_txoffset; tex->pp_txcblend = rmesa->color_combine[1]; tex->pp_txablend = rmesa->alpha_combine[1]; tex->pp_tfactor = rmesa->env_color[1]; - tex->pp_border_color = t1->setup.pp_border_color; + tex->pp_border_color = t1->pp_border_color; } if ( rmesa->dirty & RADEON_UPLOAD_TEX2 ) { @@ -1006,7 +1042,7 @@ void radeonDDUpdateHWState( GLcontext *ctx ) static void radeonDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - CARD32 s = rmesa->setup.se_cntl; + GLuint s = rmesa->setup.se_cntl; s |= RADEON_FFACE_SOLID | RADEON_BFACE_SOLID; @@ -1098,11 +1134,13 @@ void radeonDDInitState( radeonContextPtr rmesa ) switch ( rmesa->glCtx->Visual->DepthBits ) { case 16: rmesa->ClearDepth = 0x0000ffff; + rmesa->DepthMask= 0xffffffff; depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z; rmesa->depth_scale = 1.0 / (GLfloat)0xffff; break; case 24: rmesa->ClearDepth = 0x00ffffff; + rmesa->DepthMask= 0x00ffffff; depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z; rmesa->depth_scale = 1.0 / (GLfloat)0xffffff; break; @@ -1270,7 +1308,7 @@ void radeonDDInitState( radeonContextPtr rmesa ) rmesa->setup.re_misc = ((0 << RADEON_STIPPLE_X_OFFSET_SHIFT) | (0 << RADEON_STIPPLE_Y_OFFSET_SHIFT) | - RADEON_STIPPLE_LITTLE_BIT_ORDER); + RADEON_STIPPLE_BIG_BIT_ORDER); rmesa->env_color[0] = 0x00000000; rmesa->env_color[1] = 0x00000000; diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c index 32709537b..802bb3ab1 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c,v 1.2 2001/01/16 05:10:59 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c,v 1.3 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -44,1963 +44,692 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "simple_list.h" #include "enums.h" #include "mem.h" +#include "texutil.h" static void radeonSetTexWrap( radeonTexObjPtr t, GLenum swrap, GLenum twrap ) { - t->setup.pp_txfilter &= ~(RADEON_CLAMP_S_MASK | RADEON_CLAMP_T_MASK); + t->pp_txfilter &= ~(RADEON_CLAMP_S_MASK | RADEON_CLAMP_T_MASK); switch ( swrap ) { case GL_REPEAT: - t->setup.pp_txfilter |= RADEON_CLAMP_S_WRAP; + t->pp_txfilter |= RADEON_CLAMP_S_WRAP; break; case GL_CLAMP: - t->setup.pp_txfilter |= RADEON_CLAMP_S_CLAMP_LAST; + t->pp_txfilter |= RADEON_CLAMP_S_CLAMP_LAST; break; case GL_CLAMP_TO_EDGE: - t->setup.pp_txfilter |= RADEON_CLAMP_S_CLAMP_LAST; + t->pp_txfilter |= RADEON_CLAMP_S_CLAMP_LAST; break; } switch ( twrap ) { case GL_REPEAT: - t->setup.pp_txfilter |= RADEON_CLAMP_T_WRAP; + t->pp_txfilter |= RADEON_CLAMP_T_WRAP; break; case GL_CLAMP: - t->setup.pp_txfilter |= RADEON_CLAMP_T_CLAMP_LAST; + t->pp_txfilter |= RADEON_CLAMP_T_CLAMP_LAST; break; case GL_CLAMP_TO_EDGE: - t->setup.pp_txfilter |= RADEON_CLAMP_T_CLAMP_LAST; + t->pp_txfilter |= RADEON_CLAMP_T_CLAMP_LAST; break; } } static void radeonSetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf ) { - t->setup.pp_txfilter &= ~(RADEON_MIN_FILTER_MASK | RADEON_MAG_FILTER_MASK); + t->pp_txfilter &= ~(RADEON_MIN_FILTER_MASK | RADEON_MAG_FILTER_MASK); switch ( minf ) { case GL_NEAREST: - t->setup.pp_txfilter |= RADEON_MIN_FILTER_NEAREST; + t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST; break; case GL_LINEAR: - t->setup.pp_txfilter |= RADEON_MIN_FILTER_LINEAR; + t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR; break; case GL_NEAREST_MIPMAP_NEAREST: - t->setup.pp_txfilter |= RADEON_MIN_FILTER_NEAREST_MIP_NEAREST; + t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST_MIP_NEAREST; break; case GL_LINEAR_MIPMAP_NEAREST: - t->setup.pp_txfilter |= RADEON_MIN_FILTER_LINEAR_MIP_NEAREST; + t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR_MIP_NEAREST; break; case GL_NEAREST_MIPMAP_LINEAR: - t->setup.pp_txfilter |= RADEON_MIN_FILTER_NEAREST_MIP_LINEAR; + t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST_MIP_LINEAR; break; case GL_LINEAR_MIPMAP_LINEAR: - t->setup.pp_txfilter |= RADEON_MIN_FILTER_LINEAR_MIP_LINEAR; + t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR_MIP_LINEAR; break; } switch ( magf ) { case GL_NEAREST: - t->setup.pp_txfilter |= RADEON_MAG_FILTER_NEAREST; + t->pp_txfilter |= RADEON_MAG_FILTER_NEAREST; break; case GL_LINEAR: - t->setup.pp_txfilter |= RADEON_MAG_FILTER_LINEAR; + t->pp_txfilter |= RADEON_MAG_FILTER_LINEAR; break; } } static void radeonSetTexBorderColor( radeonTexObjPtr t, GLubyte c[4] ) { - t->setup.pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] ); + t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] ); } - -/* Allocate and initialize hardware state associated with texture `t'. - */ -static radeonTexObjPtr radeonCreateTexObj( radeonContextPtr rmesa, - struct gl_texture_object *tObj ) +static radeonTexObjPtr radeonAllocTexObj( struct gl_texture_object *texObj ) { radeonTexObjPtr t; - struct gl_texture_image *image; - GLint log2Width, log2Height, log2Size, log2MinSize; - GLint totalSize; - GLint texelsPerDword = 0, blitWidth = 0, blitPitch = 0; - GLint x, y, width, height; - GLint i; - GLuint txformat, txalpha; - - image = tObj->Image[0]; - if ( !image ) - return NULL; - - t = (radeonTexObjPtr) CALLOC( sizeof(*t) ); - if ( !t ) - return NULL; - - if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) - fprintf( stderr, "%s( %p )\n", __FUNCTION__, tObj ); - - switch ( image->Format ) { - case GL_RGBA: - if ( image->IntFormat != GL_RGBA4 && - ( image->IntFormat == GL_RGBA8 || - rmesa->radeonScreen->cpp == 4 ) ) { - t->texelBytes = 4; - txformat = RADEON_TXF_32BPP_ARGB8888; - } else { - t->texelBytes = 2; - txformat = RADEON_TXF_16BPP_ARGB4444; - } - txalpha = RADEON_TXF_ALPHA_IN_MAP; - break; - - case GL_RGB: - if ( image->IntFormat != GL_RGB5 && - ( image->IntFormat == GL_RGB8 || - rmesa->radeonScreen->cpp == 4 ) ) { - t->texelBytes = 4; - txformat = RADEON_TXF_32BPP_ARGB8888; - } else { - t->texelBytes = 2; - txformat = RADEON_TXF_16BPP_RGB565; - } - txalpha = 0; - break; - - case GL_ALPHA: - case GL_LUMINANCE_ALPHA: - t->texelBytes = 2; - txformat = RADEON_TXF_16BPP_AI88; - txalpha = RADEON_TXF_ALPHA_IN_MAP; - break; - - case GL_LUMINANCE: - t->texelBytes = 2; - txformat = RADEON_TXF_16BPP_AI88; - txalpha = 0; - break; - - case GL_INTENSITY: - t->texelBytes = 1; - txformat = RADEON_TXF_8BPP_I; - txalpha = 0; - break; - - case GL_COLOR_INDEX: - default: - fprintf( stderr, "%s: bad image->Format\n", __FUNCTION__ ); - FREE( t ); - return NULL; - } - - /* Calculate dimensions in log domain. - */ - for ( i = 1, log2Height = 0 ; i < image->Height ; i *= 2 ) { - log2Height++; - } - for ( i = 1, log2Width = 0 ; i < image->Width ; i *= 2 ) { - log2Width++; - } - if ( image->Width > image->Height ) { - log2Size = log2Width; - } else { - log2Size = log2Height; - } - - t->dirty_images = 0; - /* The Radeon has a 64-byte minimum pitch for all blits. We - * calculate the equivalent number of texels to simplify the - * calculation of the texture image area. - */ - switch ( t->texelBytes ) { - case 1: - texelsPerDword = 4; - blitPitch = 64; - break; - case 2: - texelsPerDword = 2; - blitPitch = 32; - break; - case 4: - texelsPerDword = 1; - blitPitch = 16; - break; - } + t = CALLOC_STRUCT( radeon_tex_obj ); - /* Select the larger of the two widths for our global texture image - * coordinate space. As the Radeon has very strict offset rules, we - * can't upload mipmaps directly and have to reference their location - * from the aligned start of the whole image. - */ - blitWidth = MAX2( image->Width, blitPitch ); - - /* Calculate mipmap offsets and dimensions. - */ - totalSize = 0; - x = 0; - y = 0; - - for ( i = 0 ; i <= log2Size ; i++ ) { - GLuint size; - - image = tObj->Image[i]; - if ( !image ) - break; - - width = image->Width; - height = image->Height; - - /* Texture images have a minimum pitch of 32 bytes (half of the - * 64-byte minimum pitch for blits). For images that have a - * width smaller than this, we must pad each texture image - * scanline out to this amount. - */ - if ( width < blitPitch / 2 ) { - width = blitPitch / 2; - } - - size = width * height * t->texelBytes; - totalSize += size; - - t->dirty_images |= (1 << i); - - while ( width < blitWidth && height > 1 ) { - width *= 2; - height /= 2; - } - - t->image[i].x = x; - t->image[i].y = y; - - t->image[i].width = width; - t->image[i].height = height; - - t->image[i].dwords = size / sizeof(CARD32); - - /* While blits must have a pitch of at least 64 bytes, mipmaps - * must be aligned on a 32-byte boundary (just like each texture - * image scanline). - */ - if ( width >= blitWidth ) { - y += height; - } else { - x += width; - if ( x >= blitWidth ) { - x = 0; - y++; - } - } - - if ( 0 ) - fprintf( stderr, "level=%d p=%d %dx%d -> %dx%d at (%d,%d) %d dwords\n", - i, blitWidth, image->Width, image->Height, - t->image[i].width, t->image[i].height, - t->image[i].x, t->image[i].y, - t->image[i].dwords ); + if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, texObj, t ); } - log2MinSize = log2Size - i + 1; - - /* Align the total size of texture memory block. + /* Initialize non-image-dependent parts of the state: */ - totalSize = (totalSize + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK; - - t->totalSize = totalSize; - - t->bound = 0; - t->heap = 0; - t->tObj = tObj; - - t->memBlock = NULL; - t->bufAddr = 0; - - /* Hardware state: - */ - t->setup.pp_txfilter = ((log2Size << RADEON_MAX_MIP_LEVEL_SHIFT) | - RADEON_BORDER_MODE_OGL); - - t->setup.pp_txformat = (txformat | txalpha | - (log2Width << RADEON_TXF_WIDTH_SHIFT) | - (log2Height << RADEON_TXF_HEIGHT_SHIFT) | - RADEON_TXF_ENDIAN_NO_SWAP | - RADEON_TXF_PERSPECTIVE_ENABLE); - - t->setup.pp_txoffset = 0x00000000; - t->setup.pp_txcblend = 0x00000000; - t->setup.pp_txablend = 0x00000000; - t->setup.pp_tfactor = 0x00000000; - t->setup.pp_border_color = 0x00000000; - - radeonSetTexWrap( t, tObj->WrapS, tObj->WrapT ); - radeonSetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); - radeonSetTexBorderColor( t, tObj->BorderColor ); - - tObj->DriverData = t; - - make_empty_list( t ); - - return t; -} - -/* Destroy hardware state associated with texture `t'. - */ -void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t ) -{ -#if ENABLE_PERF_BOXES - /* Bump the performace counter */ - rmesa->c_textureSwaps++; -#endif - if ( !t ) return; - - if ( t->memBlock ) { - mmFreeMem( t->memBlock ); - t->memBlock = NULL; - } - - if ( t->tObj ) - t->tObj->DriverData = NULL; - if ( t->bound ) - rmesa->CurrentTexObj[t->bound-1] = NULL; - - remove_from_list( t ); - FREE( t ); -} - -/* Keep track of swapped out texture objects. - */ -static void radeonSwapOutTexObj( radeonContextPtr rmesa, radeonTexObjPtr t ) -{ -#if ENABLE_PERF_BOXES - /* Bump the performace counter */ - rmesa->c_textureSwaps++; -#endif - if ( t->memBlock ) { - mmFreeMem( t->memBlock ); - t->memBlock = NULL; - } - + t->tObj = texObj; +#if 0 t->dirty_images = ~0; - move_to_tail( &rmesa->SwappedOut, t ); -} - -/* Print out debugging information about texture LRU. - */ -void radeonPrintLocalLRU( radeonContextPtr rmesa, int heap ) -{ - radeonTexObjPtr t; - int sz = 1 << (rmesa->radeonScreen->logTexGranularity[heap]); - - fprintf( stderr, "\nLocal LRU, heap %d:\n", heap ); - - foreach ( t, &rmesa->TexObjList[heap] ) { - if (!t->tObj) { - fprintf( stderr, "Placeholder %d at 0x%x sz 0x%x\n", - t->memBlock->ofs / sz, - t->memBlock->ofs, - t->memBlock->size ); - } else { - fprintf( stderr, "Texture (bound %d) at 0x%x sz 0x%x\n", - t->bound, - t->memBlock->ofs, - t->memBlock->size ); - } - } - - fprintf( stderr, "\n" ); -} - -void radeonPrintGlobalLRU( radeonContextPtr rmesa, int heap ) -{ - radeon_tex_region_t *list = rmesa->sarea->texList[heap]; - int i, j; - - fprintf( stderr, "\nGlobal LRU, heap %d list %p:\n", heap, list ); - - for ( i = 0, j = RADEON_NR_TEX_REGIONS ; i < RADEON_NR_TEX_REGIONS ; i++ ) { - fprintf( stderr, "list[%d] age %d next %d prev %d\n", - j, list[j].age, list[j].next, list[j].prev ); - j = list[j].next; - if ( j == RADEON_NR_TEX_REGIONS ) break; - } - - if ( j != RADEON_NR_TEX_REGIONS ) { - fprintf( stderr, "Loop detected in global LRU\n" ); - for ( i = 0 ; i < RADEON_NR_TEX_REGIONS ; i++ ) { - fprintf( stderr, "list[%d] age %d next %d prev %d\n", - i, list[i].age, list[i].next, list[i].prev ); - } - } - - fprintf( stderr, "\n" ); -} - -/* Reset the global texture LRU. - */ -static void radeonResetGlobalLRU( radeonContextPtr rmesa, int heap ) -{ - radeon_tex_region_t *list = rmesa->sarea->texList[heap]; - int sz = 1 << rmesa->radeonScreen->logTexGranularity[heap]; - int i; - - /* - * (Re)initialize the global circular LRU list. The last element in - * the array (RADEON_NR_TEX_REGIONS) is the sentinal. Keeping it at - * the end of the array allows it to be addressed rationally when - * looking up objects at a particular location in texture memory. - */ - for ( i = 0 ; (i+1) * sz <= rmesa->radeonScreen->texSize[heap] ; i++ ) { - list[i].prev = i-1; - list[i].next = i+1; - list[i].age = 0; - } - - i--; - list[0].prev = RADEON_NR_TEX_REGIONS; - list[i].prev = i-1; - list[i].next = RADEON_NR_TEX_REGIONS; - list[RADEON_NR_TEX_REGIONS].prev = i; - list[RADEON_NR_TEX_REGIONS].next = 0; - rmesa->sarea->texAge[heap] = 0; -} - -/* Update the local and glock texture LRUs. - */ -static void radeonUpdateTexLRU(radeonContextPtr rmesa, radeonTexObjPtr t ) -{ - int heap = t->heap; - radeon_tex_region_t *list = rmesa->sarea->texList[heap]; - int sz = rmesa->radeonScreen->logTexGranularity[heap]; - int start = t->memBlock->ofs >> sz; - int end = (t->memBlock->ofs + t->memBlock->size-1) >> sz; - int i; - - rmesa->lastTexAge[heap] = ++rmesa->sarea->texAge[heap]; - - if ( !t->memBlock ) { - fprintf( stderr, "no memblock\n\n" ); - return; - } - - /* Update our local LRU */ - move_to_head( &rmesa->TexObjList[heap], t ); - - /* Update the global LRU */ - for ( i = start ; i <= end ; i++ ) { - list[i].in_use = 1; - list[i].age = rmesa->lastTexAge[heap]; - - /* remove_from_list(i) */ - list[(CARD32)list[i].next].prev = list[i].prev; - list[(CARD32)list[i].prev].next = list[i].next; - - /* insert_at_head(list, i) */ - list[i].prev = RADEON_NR_TEX_REGIONS; - list[i].next = list[RADEON_NR_TEX_REGIONS].next; - list[(CARD32)list[RADEON_NR_TEX_REGIONS].next].prev = i; - list[RADEON_NR_TEX_REGIONS].next = i; - } - - if ( 0 ) { - radeonPrintGlobalLRU( rmesa, t->heap ); - radeonPrintLocalLRU( rmesa, t->heap ); - } -} - -/* Update our notion of what textures have been changed since we last - * held the lock. This pertains to both our local textures and the - * textures belonging to other clients. Keep track of other client's - * textures by pushing a placeholder texture onto the LRU list -- these - * are denoted by (tObj == NULL). - */ -static void radeonTexturesGone( radeonContextPtr rmesa, int heap, - int offset, int size, int in_use ) -{ - radeonTexObjPtr t, tmp; - - foreach_s ( t, tmp, &rmesa->TexObjList[heap] ) { - if ( t->memBlock->ofs >= offset + size || - t->memBlock->ofs + t->memBlock->size <= offset ) - continue; - - /* It overlaps - kick it out. Need to hold onto the currently - * bound objects, however. - */ - if ( t->bound ) { - radeonSwapOutTexObj( rmesa, t ); - } else { - radeonDestroyTexObj( rmesa, t ); - } - } - - if ( in_use ) { - t = (radeonTexObjPtr) CALLOC( sizeof(*t) ); - if ( !t ) return; - - t->memBlock = mmAllocMem( rmesa->texHeap[heap], size, 0, offset ); - if ( !t->memBlock ) { - fprintf( stderr, "Couldn't alloc placeholder sz %x ofs %x\n", - (int)size, (int)offset ); - mmDumpMemInfo( rmesa->texHeap[heap] ); - return; - } - insert_at_head( &rmesa->TexObjList[heap], t ); - } -} - -/* Update our client's shared texture state. If another client has - * modified a region in which we have textures, then we need to figure - * out which of our textures has been removed, and update our global - * LRU. - */ -void radeonAgeTextures( radeonContextPtr rmesa, int heap ) -{ - RADEONSAREAPrivPtr sarea = rmesa->sarea; - - if ( sarea->texAge[heap] != rmesa->lastTexAge[heap] ) { - int sz = 1 << rmesa->radeonScreen->logTexGranularity[heap]; - int nr = 0; - int idx; - - for ( idx = sarea->texList[heap][RADEON_NR_TEX_REGIONS].prev ; - idx != RADEON_NR_TEX_REGIONS && nr < RADEON_NR_TEX_REGIONS ; - idx = sarea->texList[heap][idx].prev, nr++ ) - { - /* If switching texturing schemes, then the SAREA might not - * have been properly cleared, so we need to reset the - * global texture LRU. - */ - if ( idx * sz > rmesa->radeonScreen->texSize[heap] ) { - nr = RADEON_NR_TEX_REGIONS; - break; - } +#endif + t->pp_txfilter = RADEON_BORDER_MODE_OGL; + t->pp_txformat = (RADEON_TXFORMAT_ENDIAN_NO_SWAP | + RADEON_TXFORMAT_PERSPECTIVE_ENABLE); - if ( sarea->texList[heap][idx].age > rmesa->lastTexAge[heap] ) { - radeonTexturesGone( rmesa, heap, idx * sz, sz, - sarea->texList[heap][idx].in_use ); - } - } + make_empty_list( t ); - if ( nr == RADEON_NR_TEX_REGIONS ) { - radeonTexturesGone( rmesa, heap, 0, - rmesa->radeonScreen->texSize[heap], 0 ); - radeonResetGlobalLRU( rmesa, heap ); - } + radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT ); + radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); + radeonSetTexBorderColor( t, texObj->BorderColor ); - rmesa->dirty |= (RADEON_UPLOAD_CONTEXT | - RADEON_UPLOAD_TEX0IMAGES | - RADEON_UPLOAD_TEX1IMAGES); - rmesa->lastTexAge[heap] = sarea->texAge[heap]; - } + return t; } -/* ================================================================ - * Texture image conversions - */ - -/* Convert a block of Mesa-formatted texture to an 8bpp hardware format. - */ -static void radeonConvertTexture8bpp( CARD32 *dst, - struct gl_texture_image *image, - int x, int y, int width, int height, - int pitch ) +static GLint radeonChooseTexFormat( radeonContextPtr rmesa, + struct gl_texture_image *texImage, + GLenum format, GLenum type ) { - CARD8 *src; - int i, j; + const GLboolean do32bpt = ( rmesa->radeonScreen->cpp == 4 ); + const struct gl_texture_format *texFormat; + GLint ret; - if ( width < 4 ) { - width = 4; - } + if ( 0 ) + fprintf( stderr, "internal=%s format=%s type=%s\n", + texImage->IntFormat == 3 ? "GL_RGB (3)" : + texImage->IntFormat == 4 ? "GL_RGBA (4)" : + gl_lookup_enum_by_nr( texImage->IntFormat ), + gl_lookup_enum_by_nr( format ), + gl_lookup_enum_by_nr( type ) ); -#define ALIGN_DST \ +#define SET_FORMAT( r, gl ) \ do { \ - if ( width < 32 ) { \ - dst += ((32 - width) / 4); \ - } \ + ret = (r); \ + texFormat = &(gl); \ } while (0) - switch ( image->Format ) { - case GL_INTENSITY: - for ( i = 0 ; i < height ; i++ ) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for ( j = width >> 2 ; j ; j-- ) { - *dst++ = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24); - src += 4; - } - ALIGN_DST; - } - break; - - case GL_COLOR_INDEX: - default: - fprintf( stderr, "%s: unsupported format 0x%x\n", - __FUNCTION__, image->Format ); - break; - } -} -#undef ALIGN_DST - -/* Convert a block of Mesa-formatted texture to a 16bpp hardware format. - */ -static void radeonConvertTexture16bpp( CARD32 *dst, - struct gl_texture_image *image, - int x, int y, int width, int height, - int pitch ) -{ - CARD8 *src; - int i, j; - - if ( width < 2 ) { - width = 2; - } - -#define ALIGN_DST \ +#define SET_FORMAT_32BPT( r32, gl32, r16, gl16 ) \ do { \ - if ( width < 16 ) { \ - dst += ((16 - width) / 2); \ + if ( do32bpt ) { \ + ret = (r32); \ + texFormat = &(gl32); \ + } else { \ + ret = (r16); \ + texFormat = &(gl16); \ } \ } while (0) - switch ( image->Format ) { + switch ( texImage->IntFormat ) { + /* GH: Bias towards GL_RGB, GL_RGBA texture formats. This has + * got to be better than sticking them way down the end of this + * huge list. + */ case GL_RGBA: - for ( i = 0 ; i < height ; i++ ) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 4; - for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((RADEONPACKCOLOR4444( src[0], src[1], src[2], src[3] )) | - (RADEONPACKCOLOR4444( src[4], src[5], src[6], src[7] ) << 16)); - src += 8; + case 4: + if ( format == GL_BGRA ) { + if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) { + SET_FORMAT( RADEON_TXFORMAT_ARGB8888, _mesa_texformat_argb8888 ); + break; + } else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { + SET_FORMAT( RADEON_TXFORMAT_ARGB4444, _mesa_texformat_argb4444 ); + break; + } else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { + SET_FORMAT( RADEON_TXFORMAT_ARGB1555, _mesa_texformat_argb1555 ); + break; } - ALIGN_DST; } + SET_FORMAT_32BPT( RADEON_TXFORMAT_RGBA8888, _mesa_texformat_rgba8888, + RADEON_TXFORMAT_ARGB4444, _mesa_texformat_argb4444 ); break; case GL_RGB: - { - for ( i = 0 ; i < height ; i++ ) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; - for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((RADEONPACKCOLOR565( src[0], src[1], src[2] )) | - (RADEONPACKCOLOR565( src[3], src[4], src[5] ) << 16)); - src += 6; - } - ALIGN_DST; + case 3: + if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) { + SET_FORMAT( RADEON_TXFORMAT_RGB565, _mesa_texformat_rgb565 ); + break; } - } + SET_FORMAT_32BPT( RADEON_TXFORMAT_RGBA8888, _mesa_texformat_rgba8888, + RADEON_TXFORMAT_RGB565, _mesa_texformat_rgb565 ); break; - case GL_ALPHA: - for ( i = 0 ; i < height ; i++ ) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((RADEONPACKCOLOR88( 0x00, src[0] )) | - (RADEONPACKCOLOR88( 0x00, src[1] ) << 16)); - src += 2; - } - ALIGN_DST; - } + /* GH: Okay, keep checking as normal. Still test for GL_RGB, + * GL_RGBA formats first. + */ + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + SET_FORMAT_32BPT( RADEON_TXFORMAT_RGBA8888, _mesa_texformat_rgba8888, + RADEON_TXFORMAT_ARGB4444, _mesa_texformat_argb4444 ); break; - case GL_LUMINANCE: - for ( i = 0 ; i < height ; i++ ) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x); - for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((RADEONPACKCOLOR88( src[0], 0xff )) | - (RADEONPACKCOLOR88( src[1], 0xff ) << 16)); - src += 2; - } - ALIGN_DST; - } + case GL_RGBA4: + case GL_RGBA2: + SET_FORMAT( RADEON_TXFORMAT_ARGB4444, _mesa_texformat_argb4444 ); break; - case GL_LUMINANCE_ALPHA: - for ( i = 0 ; i < height ; i++ ) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 2; - for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((RADEONPACKCOLOR88( src[0], src[1] )) | - (RADEONPACKCOLOR88( src[2], src[3] ) << 16)); - src += 4; - } - ALIGN_DST; - } + case GL_RGB5_A1: + SET_FORMAT( RADEON_TXFORMAT_ARGB1555, _mesa_texformat_argb1555 ); break; - default: - fprintf( stderr, "%s: unsupported format 0x%x\n", - __FUNCTION__, image->Format ); + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + SET_FORMAT_32BPT( RADEON_TXFORMAT_RGBA8888, _mesa_texformat_rgba8888, + RADEON_TXFORMAT_RGB565, _mesa_texformat_rgb565 ); break; - } -} -#undef ALIGN_DST - -/* Convert a block of Mesa-formatted texture to a 32bpp hardware format. - */ -static void radeonConvertTexture32bpp( CARD32 *dst, - struct gl_texture_image *image, - int x, int y, int width, int height, - int pitch ) -{ - CARD8 *src; - int i, j; -#define ALIGN_DST \ - do { \ - if ( width < 8 ) { \ - dst += (8 - width); \ - } \ - } while (0) - - switch ( image->Format ) { - case GL_RGBA: - for ( i = 0 ; i < height ; i++ ) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 4; - for ( j = width ; j ; j-- ) { - *dst++ = RADEONPACKCOLOR8888( src[0], src[1], src[2], src[3] ); - src += 4; - } - ALIGN_DST; - } + case GL_RGB5: + case GL_RGB4: + case GL_R3_G3_B2: + SET_FORMAT( RADEON_TXFORMAT_RGB565, _mesa_texformat_rgb565 ); break; - case GL_RGB: - for ( i = 0 ; i < height ; i++ ) { - src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; - for ( j = width ; j ; j-- ) { - *dst++ = RADEONPACKCOLOR8888( src[0], src[1], src[2], 0xff ); - src += 3; - } - ALIGN_DST; - } + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + SET_FORMAT( RADEON_TXFORMAT_AI88, _mesa_texformat_al88 ); break; - default: - fprintf( stderr, "%s: unsupported format 0x%x\n", - __FUNCTION__, image->Format ); - break; - } -} - -/* Upload the texture image associated with texture `t' at level `level' - * at the address relative to `start'. - */ -static void radeonUploadSubImage( radeonContextPtr rmesa, - radeonTexObjPtr t, GLint level, - GLint x, GLint y, GLint width, GLint height ) -{ - struct gl_texture_image *image; - GLint texelsPerDword = 0; - GLint imageX, imageY, imageWidth, imageHeight; - GLint blitX, blitY, blitWidth, blitHeight; - GLint imageRows, blitRows; - GLint remaining ; - GLint format, dwords; - CARD32 pitch, offset; - drmBufPtr buffer; - CARD32 *dst; - - /* Ensure we have a valid texture to upload */ - if ( ( level < 0 ) || ( level >= RADEON_MAX_TEXTURE_LEVELS ) ) - return; - - image = t->tObj->Image[level]; - if ( !image ) - return; - - switch ( t->texelBytes ) { case 1: - texelsPerDword = 4; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + SET_FORMAT( RADEON_TXFORMAT_AI88, _mesa_texformat_al88 ); break; + case 2: - texelsPerDword = 2; + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + SET_FORMAT( RADEON_TXFORMAT_AI88, _mesa_texformat_al88 ); break; - case 4: - texelsPerDword = 1; + + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + SET_FORMAT( RADEON_TXFORMAT_I8, _mesa_texformat_i8 ); break; + + case GL_COLOR_INDEX: + case GL_COLOR_INDEX1_EXT: + case GL_COLOR_INDEX2_EXT: + case GL_COLOR_INDEX4_EXT: + case GL_COLOR_INDEX8_EXT: + case GL_COLOR_INDEX12_EXT: + case GL_COLOR_INDEX16_EXT: + default: + fprintf( stderr, "bad texture format in radeonChooseTexFormat() %d", + texImage->IntFormat ); + return -1; } - format = t->setup.pp_txformat & RADEON_TXF_FORMAT_MASK; + texImage->TexFormat = texFormat; - imageX = 0; - imageY = 0; - imageWidth = image->Width; - imageHeight = image->Height; + return ret; +} - blitX = t->image[level].x; - blitY = t->image[level].y; - blitWidth = t->image[level].width; - blitHeight = t->image[level].height; - dwords = t->image[level].dwords; - offset = t->bufAddr; - pitch = (t->image[0].width * t->texelBytes) / 64; +/* ================================================================ + * Texture image callbacks + */ -#if ENABLE_PERF_BOXES - /* Bump the performace counter */ - rmesa->c_textureBytes += (dwords << 2); -#endif +static GLboolean +radeonDDTexImage1D( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ) +{ + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + radeonTexObjPtr t = (radeonTexObjPtr)texObj->DriverData; + const struct gl_texture_format *texFormat; + GLuint texSize; + GLint txformat; + GLubyte *data; - if ( RADEON_DEBUG & DEBUG_VERBOSE_MSG ) { - fprintf( stderr, " upload image: %d,%d at %d,%d\n", - imageWidth, imageHeight, imageX, imageY ); - fprintf( stderr, " upload blit: %d,%d at %d,%d\n", - blitWidth, blitHeight, blitX, blitY ); - fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x dwords: %d " - "level: %d format: %x\n", - (GLuint)offset, (GLuint)pitch, dwords, level, format ); + if ( target != GL_TEXTURE_1D ) + return GL_FALSE; + + if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, texObj, level ); } - /* Subdivide the texture if required */ - if ( dwords <= RADEON_BUFFER_MAX_DWORDS / 2 ) { - imageRows = imageHeight; - blitRows = blitHeight; + if ( t ) { + if ( t->bound ) FLUSH_BATCH( rmesa ); + radeonSwapOutTexObj( rmesa, t ); } else { - imageRows = (RADEON_BUFFER_MAX_DWORDS * texelsPerDword)/(2 * imageWidth); - blitRows = (RADEON_BUFFER_MAX_DWORDS * texelsPerDword) / (2 * blitWidth); + t = radeonAllocTexObj( texObj ); + texObj->DriverData = t; } - for ( remaining = imageHeight ; - remaining > 0 ; - remaining -= imageRows, imageY += imageRows, blitY += blitRows ) - { - if ( remaining >= imageRows ) { - imageHeight = imageRows; - blitHeight = blitRows; - } else { - imageHeight = remaining; - blitHeight = blitRows; - } - dwords = blitWidth * blitHeight / texelsPerDword; - - if ( RADEON_DEBUG & DEBUG_VERBOSE_MSG ) { - fprintf( stderr, " blitting: %d,%d at %d,%d\n", - imageWidth, imageHeight, imageX, imageY ); - fprintf( stderr, " %d,%d at %d,%d - %d dwords\n", - blitWidth, blitHeight, blitX, blitY, dwords ); - } + txformat = radeonChooseTexFormat( rmesa, texImage, format, type ); + if ( txformat < 0 ) + return GL_FALSE; - /* Grab the indirect buffer for the texture blit */ - buffer = radeonGetBufferLocked( rmesa ); + texFormat = texImage->TexFormat; + texSize = texImage->Width * texFormat->TexelBytes; - dst = (CARD32 *)((char *)buffer->address + RADEON_HOSTDATA_BLIT_OFFSET); + /* We really shouldn't have to keep the texture image, it should be + * hung from the main texImage structure. + */ + if ( t->image[level].data ) { + FREE( t->image[level].data ); + t->image[level].data = NULL; + } - /* Actually do the texture conversion */ - switch ( t->texelBytes ) { - case 1: - radeonConvertTexture8bpp( dst, image, - imageX, imageY, imageWidth, imageHeight, - imageWidth ); - break; - case 2: - radeonConvertTexture16bpp( dst, image, - imageX, imageY, imageWidth, imageHeight, - imageWidth ); - break; - case 4: - radeonConvertTexture32bpp( dst, image, - imageX, imageY, imageWidth, imageHeight, - imageWidth ); - break; - } + data = (GLubyte *) MALLOC( texSize ); + if ( !data ) + return GL_FALSE; - radeonFireBlitLocked( rmesa, buffer, - offset, pitch, format, - blitX, blitY, blitWidth, blitHeight ); + if ( !_mesa_convert_texsubimage1d( texFormat->IntFormat, + 0, texImage->Width, + format, type, packing, + pixels, data ) ) { + /*fprintf( stderr, " *** convert failed!\n" );*/ + FREE( data ); + return GL_FALSE; } - rmesa->new_state |= RADEON_NEW_CONTEXT; - rmesa->dirty |= RADEON_UPLOAD_CONTEXT | RADEON_UPLOAD_MASKS; -} + t->image[level].data = data; + t->dirty_images |= (1 << level); -/* Upload the texture images associated with texture `t'. This might - * require removing our own and/or other client's texture objects to - * make room for these images. - */ -/* NOTE: This function is only called while holding the hardware lock */ -int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t ) -{ - int i; - int heap; + /* Format-specific hardware state: + */ + t->pp_txformat &= ~(RADEON_TXFORMAT_FORMAT_MASK | + RADEON_TXFORMAT_ALPHA_IN_MAP); + t->pp_txformat |= txformat; - if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { - fprintf( stderr, "%s( %p, %p )\n", - __FUNCTION__, rmesa->glCtx, t ); + if ( txformat == RADEON_TXFORMAT_RGBA8888 || + txformat == RADEON_TXFORMAT_ARGB4444 || + txformat == RADEON_TXFORMAT_ARGB1555 || + txformat == RADEON_TXFORMAT_AI88 ) { + t->pp_txformat |= RADEON_TXFORMAT_ALPHA_IN_MAP; } - if ( !t ) - return 0; + ASSERT( t->image[level].data ); - /* Choose the heap appropriately */ - heap = t->heap = RADEON_CARD_HEAP; -#if 0 - if ( !rmesa->radeonScreen->IsPCI && - t->totalSize > rmesa->radeonScreen->texSize[heap] ) { - heap = t->heap = RADEON_AGP_HEAP; - } -#endif - - /* Do we need to eject LRU texture objects? */ - if ( !t->memBlock ) { - /* Allocate a memory block on a 4k boundary (1<<12 == 4096) */ - t->memBlock = mmAllocMem( rmesa->texHeap[heap], - t->totalSize, 12, 0 ); + rmesa->new_state |= RADEON_NEW_TEXTURE; -#if 0 - /* Try AGP before kicking anything out of local mem */ - if ( !t->memBlock && heap == RADEON_CARD_HEAP ) { - t->memBlock = mmAllocMem( rmesa->texHeap[RADEON_AGP_HEAP], - t->totalSize, 12, 0 ); + *retainInternalCopy = GL_FALSE; + return GL_TRUE; +} - if ( t->memBlock ) - heap = t->heap = RADEON_AGP_HEAP; - } -#endif +static GLboolean +radeonDDTexImage2D( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ) +{ + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + radeonTexObjPtr t = (radeonTexObjPtr)texObj->DriverData; + const struct gl_texture_format *texFormat; + GLuint texSize; + GLint txformat; + GLubyte *data; - /* Kick out textures until the requested texture fits */ - while ( !t->memBlock ) { - if ( rmesa->TexObjList[heap].prev->bound ) { - fprintf( stderr, - "radeonUploadTexImages: ran into bound texture\n" ); - return -1; - } - if ( rmesa->TexObjList[heap].prev == - &rmesa->TexObjList[heap] ) { - if ( rmesa->radeonScreen->IsPCI ) { - fprintf( stderr, "radeonUploadTexImages: upload texture " - "failure on local texture heaps, sz=%d\n", - t->totalSize ); - return -1; -#if 0 - } else if ( heap == RADEON_CARD_HEAP ) { - heap = t->heap = RADEON_AGP_HEAP; - continue; -#endif - } else { - fprintf( stderr, "radeonUploadTexImages: upload texture " - "failure on both local and AGP texture heaps, " - "sz=%d\n", - t->totalSize ); - return -1; - } - } + if ( target != GL_TEXTURE_2D ) + return GL_FALSE; - radeonDestroyTexObj( rmesa, rmesa->TexObjList[heap].prev ); + if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, texObj, level ); + } - t->memBlock = mmAllocMem( rmesa->texHeap[heap], - t->totalSize, 12, 0 ); - } + if ( t ) { + if ( t->bound ) FLUSH_BATCH( rmesa ); + if ( t->image[level].data ) radeonSwapOutTexObj( rmesa, t ); + } else { + t = radeonAllocTexObj( texObj ); + texObj->DriverData = t; + } - /* Set the base offset of the texture image */ - t->bufAddr = rmesa->radeonScreen->texOffset[heap] + t->memBlock->ofs; + txformat = radeonChooseTexFormat( rmesa, texImage, format, type ); + if ( txformat < 0 ) + return GL_FALSE; - t->setup.pp_txoffset = t->bufAddr; -#if 0 - /* Fix AGP texture offsets */ - if ( heap == RADEON_AGP_HEAP ) { - t->setup.pp_tx_offset += RADEON_AGP_TEX_OFFSET + - rmesa->radeonScreen->agpTexOffset; - } -#endif + texFormat = texImage->TexFormat; + texSize = texImage->Width * texImage->Height * texFormat->TexelBytes; - /* Force loading the new state into the hardware */ - switch ( t->bound ) { - case 1: - rmesa->dirty |= RADEON_UPLOAD_CONTEXT | RADEON_UPLOAD_TEX0; - break; + /* We really shouldn't have to keep the texture image, it should be + * hung from the main texImage structure. + */ + if ( t->image[level].data ) { + FREE( t->image[level].data ); + t->image[level].data = NULL; + } - case 2: - rmesa->dirty |= RADEON_UPLOAD_CONTEXT | RADEON_UPLOAD_TEX1; - break; + data = (GLubyte *) MALLOC( texSize ); + if ( !data ) + return GL_FALSE; - default: - return -1; - } + if ( !_mesa_convert_texsubimage2d( texFormat->IntFormat, + 0, 0, texImage->Width, texImage->Height, + texImage->Width, format, type, packing, + pixels, data ) ) { + if ( 0 ) + fprintf( stderr, " *** convert failed! %s/%s-> %s\n", + gl_lookup_enum_by_nr( format ), + gl_lookup_enum_by_nr( type ), + gl_lookup_enum_by_nr( texImage->IntFormat ) ); + FREE( data ); + return GL_FALSE; } - /* Let the world know we've used this memory recently */ - radeonUpdateTexLRU( rmesa, t ); + t->image[level].data = data; + t->dirty_images |= (1 << level); - /* Upload any images that are new */ - if ( t->dirty_images ) { - int num_levels = ((t->setup.pp_txfilter & RADEON_MAX_MIP_LEVEL_MASK) >> - RADEON_MAX_MIP_LEVEL_SHIFT); - - for ( i = 0 ; i <= num_levels ; i++ ) { - if ( t->dirty_images & (1 << i) ) { - radeonUploadSubImage( rmesa, t, i, 0, 0, - t->image[i].width, t->image[i].height ); - } - } + /* Format-specific hardware state: + */ + t->pp_txformat &= ~(RADEON_TXFORMAT_FORMAT_MASK | + RADEON_TXFORMAT_ALPHA_IN_MAP); + t->pp_txformat |= txformat; - rmesa->dirty |= RADEON_UPLOAD_CONTEXT; + if ( txformat == RADEON_TXFORMAT_RGBA8888 || + txformat == RADEON_TXFORMAT_ARGB4444 || + txformat == RADEON_TXFORMAT_ARGB1555 || + txformat == RADEON_TXFORMAT_AI88 ) { + t->pp_txformat |= RADEON_TXFORMAT_ALPHA_IN_MAP; } - t->dirty_images = 0; - return 0; -} - + ASSERT( t->image[level].data ); -/* ================================================================ - * Texture combine functions - */ + rmesa->new_state |= RADEON_NEW_TEXTURE; -#define RADEON_DISABLE 0 -#define RADEON_REPLACE 1 -#define RADEON_MODULATE 2 -#define RADEON_DECAL 3 -#define RADEON_BLEND 4 -#define RADEON_ADD 5 -#define RADEON_MAX_COMBFUNC 6 + *retainInternalCopy = GL_FALSE; + return GL_TRUE; +} -static GLuint radeon_color_combine[][RADEON_MAX_COMBFUNC] = +/* GH: This is undoubtedly broken... + */ +static GLboolean +radeonDDTexImage3D( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ) { - /* Unit 0: - */ - { - /* Disable combiner stage - */ - (RADEON_COLOR_ARG_A_ZERO | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_CURRENT_COLOR | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_REPLACE = 0x00802800 - */ - (RADEON_COLOR_ARG_A_ZERO | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_T0_COLOR | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_MODULATE = 0x00800142 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_T0_COLOR | - RADEON_COLOR_ARG_C_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_DECAL = 0x008c2d42 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_T0_COLOR | - RADEON_COLOR_ARG_C_T0_ALPHA | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_BLEND = 0x008c2902 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_TFACTOR_COLOR | - RADEON_COLOR_ARG_C_T0_COLOR | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_ADD = 0x00812802 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_T0_COLOR | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - }, - - /* Unit 1: - */ - { - /* Disable combiner stage - */ - (RADEON_COLOR_ARG_A_ZERO | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_CURRENT_COLOR | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_REPLACE = 0x00803000 - */ - (RADEON_COLOR_ARG_A_ZERO | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_T1_COLOR | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_MODULATE = 0x00800182 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_T1_COLOR | - RADEON_COLOR_ARG_C_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_DECAL = 0x008c3582 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_T1_COLOR | - RADEON_COLOR_ARG_C_T1_ALPHA | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_BLEND = 0x008c3102 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_TFACTOR_COLOR | - RADEON_COLOR_ARG_C_T1_COLOR | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_ADD = 0x00813002 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_T1_COLOR | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - }, - - /* Unit 2: - */ - { - /* Disable combiner stage - */ - (RADEON_COLOR_ARG_A_ZERO | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_CURRENT_COLOR | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_REPLACE = 0x00803800 - */ - (RADEON_COLOR_ARG_A_ZERO | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_T2_COLOR | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_MODULATE = 0x008001c2 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_T2_COLOR | - RADEON_COLOR_ARG_C_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_DECAL = 0x008c3dc2 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_T2_COLOR | - RADEON_COLOR_ARG_C_T2_ALPHA | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_BLEND = 0x008c3902 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_TFACTOR_COLOR | - RADEON_COLOR_ARG_C_T2_COLOR | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_ADD = 0x00813802 - */ - (RADEON_COLOR_ARG_A_CURRENT_COLOR | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_T2_COLOR | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - } -}; + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + radeonTexObjPtr t = (radeonTexObjPtr)texObj->DriverData; + const struct gl_texture_format *texFormat; + GLuint texSize; + GLint txformat; + GLubyte *data; -static GLuint radeon_alpha_combine[][RADEON_MAX_COMBFUNC] = -{ - /* Unit 0: - */ - { - /* Disable combiner stage - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_CURRENT_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_REPLACE = 0x00800500 - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_T0_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_MODULATE = 0x00800051 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_T0_ALPHA | - RADEON_ALPHA_ARG_C_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_DECAL = 0x00800100 - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_CURRENT_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_BLEND = 0x00800051 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_TFACTOR_ALPHA | - RADEON_ALPHA_ARG_C_T0_ALPHA | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_ADD = 0x00800051 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_T0_ALPHA | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - }, - - /* Unit 1: - */ - { - /* Disable combiner stage - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_CURRENT_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_REPLACE = 0x00800600 - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_T1_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_MODULATE = 0x00800061 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_T1_ALPHA | - RADEON_ALPHA_ARG_C_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_DECAL = 0x00800100 - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_CURRENT_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_BLEND = 0x00800061 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_TFACTOR_ALPHA | - RADEON_ALPHA_ARG_C_T1_ALPHA | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_ADD = 0x00800061 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_T1_ALPHA | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - }, - - /* Unit 2: - */ - { - /* Disable combiner stage - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_CURRENT_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_REPLACE = 0x00800700 - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_T2_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_MODULATE = 0x00800071 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_T2_ALPHA | - RADEON_ALPHA_ARG_C_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_DECAL = 0x00800100 - */ - (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_CURRENT_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_BLEND = 0x00800071 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_TFACTOR_ALPHA | - RADEON_ALPHA_ARG_C_T2_ALPHA | - RADEON_BLEND_CTL_BLEND | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - - /* GL_ADD = 0x00800021 - */ - (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_T2_ALPHA | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADD | - RADEON_SCALE_1X | - RADEON_CLAMP_TX), - } -}; + if ( target != GL_TEXTURE_3D ) + return GL_FALSE; + if ( t ) { + if ( t->bound ) FLUSH_BATCH( rmesa ); + radeonSwapOutTexObj( rmesa, t ); + } else { + t = radeonAllocTexObj( texObj ); + texObj->DriverData = t; + } -/* GL_EXT_texture_env_combine support - */ + txformat = radeonChooseTexFormat( rmesa, texImage, format, type ); + if ( txformat < 0 ) + return GL_FALSE; -/* The color tables have combine functions for GL_SRC_COLOR, - * GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. - */ -static GLuint radeon_texture_color[][RADEON_MAX_TEXTURE_UNITS] = -{ - { - RADEON_COLOR_ARG_A_T0_COLOR, - RADEON_COLOR_ARG_A_T1_COLOR, - RADEON_COLOR_ARG_A_T2_COLOR - }, - { - RADEON_COLOR_ARG_A_T0_COLOR | RADEON_COMP_ARG_A, - RADEON_COLOR_ARG_A_T1_COLOR | RADEON_COMP_ARG_A, - RADEON_COLOR_ARG_A_T2_COLOR | RADEON_COMP_ARG_A - }, - { - RADEON_COLOR_ARG_A_T0_ALPHA, - RADEON_COLOR_ARG_A_T1_ALPHA, - RADEON_COLOR_ARG_A_T2_ALPHA - }, - { - RADEON_COLOR_ARG_A_T0_ALPHA | RADEON_COMP_ARG_A, - RADEON_COLOR_ARG_A_T1_ALPHA | RADEON_COMP_ARG_A, - RADEON_COLOR_ARG_A_T2_ALPHA | RADEON_COMP_ARG_A - }, -}; - -static GLuint radeon_tfactor_color[] = -{ - RADEON_COLOR_ARG_A_TFACTOR_COLOR, - RADEON_COLOR_ARG_A_TFACTOR_COLOR | RADEON_COMP_ARG_A, - RADEON_COLOR_ARG_A_TFACTOR_ALPHA, - RADEON_COLOR_ARG_A_TFACTOR_ALPHA | RADEON_COMP_ARG_A -}; + texFormat = texImage->TexFormat; + texSize = (texImage->Width * texImage->Height * + texImage->Depth * texFormat->TexelBytes); -static GLuint radeon_primary_color[] = -{ - RADEON_COLOR_ARG_A_DIFFUSE_COLOR, - RADEON_COLOR_ARG_A_DIFFUSE_COLOR | RADEON_COMP_ARG_A, - RADEON_COLOR_ARG_A_DIFFUSE_ALPHA, - RADEON_COLOR_ARG_A_DIFFUSE_ALPHA | RADEON_COMP_ARG_A -}; + /* We really shouldn't have to keep the texture image, it should be + * hung from the main texImage structure. + */ + if ( t->image[level].data ) { + FREE( t->image[level].data ); + t->image[level].data = NULL; + } -static GLuint radeon_previous_color[] = -{ - RADEON_COLOR_ARG_A_CURRENT_COLOR, - RADEON_COLOR_ARG_A_CURRENT_COLOR | RADEON_COMP_ARG_A, - RADEON_COLOR_ARG_A_CURRENT_ALPHA, - RADEON_COLOR_ARG_A_CURRENT_ALPHA | RADEON_COMP_ARG_A -}; + data = (GLubyte *) MALLOC( texSize ); + if ( !data ) + return GL_FALSE; -/* The alpha tables only have GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. - */ -static GLuint radeon_texture_alpha[][RADEON_MAX_TEXTURE_UNITS] = -{ - { - RADEON_ALPHA_ARG_A_T0_ALPHA, - RADEON_ALPHA_ARG_A_T1_ALPHA, - RADEON_ALPHA_ARG_A_T2_ALPHA - }, - { - RADEON_ALPHA_ARG_A_T0_ALPHA | RADEON_COMP_ARG_A, - RADEON_ALPHA_ARG_A_T1_ALPHA | RADEON_COMP_ARG_A, - RADEON_ALPHA_ARG_A_T2_ALPHA | RADEON_COMP_ARG_A - }, -}; - -static GLuint radeon_tfactor_alpha[] = -{ - RADEON_ALPHA_ARG_A_TFACTOR_ALPHA, - RADEON_ALPHA_ARG_A_TFACTOR_ALPHA | RADEON_COMP_ARG_A -}; + if ( !_mesa_convert_texsubimage3d( texFormat->IntFormat, + 0, 0, 0, texImage->Width, + texImage->Height, texImage->Depth, + texImage->Width, texImage->Height, + format, type, packing, + pixels, data ) ) { + FREE( data ); + return GL_FALSE; + } -static GLuint radeon_primary_alpha[] = -{ - RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA, - RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA | RADEON_COMP_ARG_A -}; + t->image[level].data = data; + t->dirty_images |= (1 << level); -static GLuint radeon_previous_alpha[] = -{ - RADEON_ALPHA_ARG_A_CURRENT_ALPHA, - RADEON_ALPHA_ARG_A_CURRENT_ALPHA | RADEON_COMP_ARG_A -}; + ASSERT( t->image[level].data ); + rmesa->new_state |= RADEON_NEW_TEXTURE; -/* Extract the arg from slot A, shift it into the correct argument slot - * and set the corresponding complement bit. - */ -#define RADEON_COLOR_ARG( n, arg ) \ -do { \ - color_combine |= \ - ((color_arg[n] & RADEON_COLOR_ARG_MASK) \ - << RADEON_COLOR_ARG_##arg##_SHIFT); \ - color_combine |= \ - ((color_arg[n] >> RADEON_COMP_ARG_SHIFT) \ - << RADEON_COMP_ARG_##arg##_SHIFT); \ -} while (0) - -#define RADEON_ALPHA_ARG( n, arg ) \ -do { \ - alpha_combine |= \ - ((alpha_arg[n] & RADEON_ALPHA_ARG_MASK) \ - << RADEON_ALPHA_ARG_##arg##_SHIFT); \ - alpha_combine |= \ - ((alpha_arg[n] >> RADEON_COMP_ARG_SHIFT) \ - << RADEON_COMP_ARG_##arg##_SHIFT); \ -} while (0) + *retainInternalCopy = GL_FALSE; + return GL_TRUE; +} /* ================================================================ - * Texture unit state management + * Texture subimage callbacks */ -static void radeonUpdateTextureEnv( GLcontext *ctx, int unit ) +static GLboolean +radeonDDTexSubImage1D( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - int source = rmesa->tmu_source[unit]; - struct gl_texture_object *tObj; - struct gl_texture_unit *texUnit; - GLuint enabled; - GLuint color_combine, alpha_combine; - GLuint color_arg[3], alpha_arg[3]; - GLuint i, numColorArgs = 0, numAlphaArgs = 0; - GLuint op; - - if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { - fprintf( stderr, "%s( %p, %d )\n", - __FUNCTION__, ctx, unit ); - } - - enabled = (ctx->Texture.ReallyEnabled >> (source * 4)) & TEXTURE0_ANY; - if ( enabled != TEXTURE0_2D && enabled != TEXTURE0_1D ) - return; - - /* Only update the hardware texture state if the texture is current, - * complete and enabled. - */ - texUnit = &ctx->Texture.Unit[source]; - tObj = texUnit->Current; - if ( !tObj || !tObj->Complete ) - return; + radeonTexObjPtr t = (radeonTexObjPtr)texObj->DriverData; + const struct gl_texture_format *texFormat; - if ( ( tObj != texUnit->CurrentD[2] ) && - ( tObj != texUnit->CurrentD[1] ) ) - return; + if ( target != GL_TEXTURE_1D ) + return GL_FALSE; - /* Set the texture environment state. Isn't this nice and clean? - * The Radeon will automagically set the texture alpha to 0xff when - * the texture format does not include an alpha component. This - * reduces the amount of special-casing we have to do, alpha-only - * textures being a notable exception. + /* FIXME: Can this ever be NULL??? */ - switch ( texUnit->EnvMode ) { - case GL_REPLACE: - switch ( tObj->Image[0]->Format ) { - case GL_RGBA: - case GL_RGB: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - color_combine = radeon_color_combine[unit][RADEON_REPLACE]; - alpha_combine = radeon_alpha_combine[unit][RADEON_REPLACE]; - break; - case GL_ALPHA: - color_combine = radeon_color_combine[unit][RADEON_DISABLE]; - alpha_combine = radeon_alpha_combine[unit][RADEON_REPLACE]; - break; - case GL_COLOR_INDEX: - default: - return; - } - break; + ASSERT( t ); + ASSERT( t->image[level].data ); - case GL_MODULATE: - switch ( tObj->Image[0]->Format ) { - case GL_RGBA: - case GL_RGB: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - color_combine = radeon_color_combine[unit][RADEON_MODULATE]; - alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; - break; - case GL_ALPHA: - color_combine = radeon_color_combine[unit][RADEON_DISABLE]; - alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_DECAL: - switch ( tObj->Image[0]->Format ) { - case GL_RGBA: - case GL_RGB: - color_combine = radeon_color_combine[unit][RADEON_DECAL]; - alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE]; - break; - case GL_ALPHA: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - case GL_INTENSITY: - color_combine = radeon_color_combine[unit][RADEON_DISABLE]; - alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE]; - break; - case GL_COLOR_INDEX: - default: - return; - } - break; - - case GL_BLEND: - switch ( tObj->Image[0]->Format ) { - case GL_RGBA: - case GL_RGB: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - color_combine = radeon_color_combine[unit][RADEON_BLEND]; - alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; - break; - case GL_ALPHA: - color_combine = radeon_color_combine[unit][RADEON_DISABLE]; - alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; - break; - case GL_INTENSITY: - color_combine = radeon_color_combine[unit][RADEON_BLEND]; - alpha_combine = radeon_alpha_combine[unit][RADEON_BLEND]; - break; - case GL_COLOR_INDEX: - default: - return; - } - break; + if ( t->bound ) + FLUSH_BATCH( rmesa ); - case GL_ADD: - switch ( tObj->Image[0]->Format ) { - case GL_RGBA: - case GL_RGB: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - color_combine = radeon_color_combine[unit][RADEON_ADD]; - alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; - break; - case GL_ALPHA: - color_combine = radeon_color_combine[unit][RADEON_DISABLE]; - alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; - break; - case GL_INTENSITY: - color_combine = radeon_color_combine[unit][RADEON_ADD]; - alpha_combine = radeon_alpha_combine[unit][RADEON_ADD]; - break; - case GL_COLOR_INDEX: - default: - return; - } - break; + texFormat = texImage->TexFormat; - case GL_COMBINE_EXT: - /* Step 0: - * Calculate how many arguments we need to process. - */ - switch ( texUnit->CombineModeRGB ) { - case GL_REPLACE: - numColorArgs = 1; - break; - case GL_MODULATE: - case GL_ADD: - case GL_ADD_SIGNED_EXT: - case GL_DOT3_RGB_EXT: - case GL_DOT3_RGBA_EXT: - numColorArgs = 2; - break; - case GL_INTERPOLATE_EXT: - numColorArgs = 3; - break; - default: - return; - } + if ( !_mesa_convert_texsubimage1d( texFormat->IntFormat, + xoffset, width, format, type, packing, + pixels, t->image[level].data ) ) { + /*fprintf( stderr, " *** convert failed!\n" );*/ + return GL_FALSE; + } - switch ( texUnit->CombineModeA ) { - case GL_REPLACE: - numAlphaArgs = 1; - break; - case GL_MODULATE: - case GL_ADD: - case GL_ADD_SIGNED_EXT: - numAlphaArgs = 2; - break; - case GL_INTERPOLATE_EXT: - numAlphaArgs = 3; - break; - default: - return; - } + t->dirty_images |= (1 << level); + rmesa->new_state |= RADEON_NEW_TEXTURE; - /* Step 1: - * Extract the color and alpha combine function arguments. - */ - for ( i = 0 ; i < numColorArgs ; i++ ) { - op = texUnit->CombineOperandRGB[i] - GL_SRC_COLOR; - switch ( texUnit->CombineSourceRGB[i] ) { - case GL_TEXTURE: - color_arg[i] = radeon_texture_color[op][unit]; - break; - case GL_CONSTANT_EXT: - color_arg[i] = radeon_tfactor_color[op]; - break; - case GL_PRIMARY_COLOR_EXT: - color_arg[i] = radeon_primary_color[op]; - break; - case GL_PREVIOUS_EXT: - color_arg[i] = radeon_previous_color[op]; - break; - default: - return; - } - } + return GL_TRUE; +} - for ( i = 0 ; i < numAlphaArgs ; i++ ) { - op = texUnit->CombineOperandA[i] - GL_SRC_ALPHA; - switch ( texUnit->CombineSourceA[i] ) { - case GL_TEXTURE: - alpha_arg[i] = radeon_texture_alpha[op][unit]; - break; - case GL_CONSTANT_EXT: - alpha_arg[i] = radeon_tfactor_alpha[op]; - break; - case GL_PRIMARY_COLOR_EXT: - alpha_arg[i] = radeon_primary_alpha[op]; - break; - case GL_PREVIOUS_EXT: - alpha_arg[i] = radeon_previous_alpha[op]; - break; - default: - return; - } - } +static GLboolean +radeonDDTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) +{ + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + radeonTexObjPtr t = (radeonTexObjPtr)texObj->DriverData; + const struct gl_texture_format *texFormat; - /* Step 2: - * Build up the color and alpha combine functions. - */ - switch ( texUnit->CombineModeRGB ) { - case GL_REPLACE: - color_combine = (RADEON_COLOR_ARG_A_ZERO | - RADEON_COLOR_ARG_B_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_CLAMP_TX); - RADEON_COLOR_ARG( 0, C ); - break; - case GL_MODULATE: - color_combine = (RADEON_COLOR_ARG_C_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_CLAMP_TX); - RADEON_COLOR_ARG( 0, A ); - RADEON_COLOR_ARG( 1, B ); - break; - case GL_ADD: - color_combine = (RADEON_COLOR_ARG_B_ZERO | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADD | - RADEON_CLAMP_TX); - RADEON_COLOR_ARG( 0, A ); - RADEON_COLOR_ARG( 1, C ); - break; - case GL_ADD_SIGNED_EXT: - color_combine = (RADEON_COLOR_ARG_B_ZERO | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADDSIGNED | - RADEON_CLAMP_TX); - RADEON_COLOR_ARG( 0, A ); - RADEON_COLOR_ARG( 1, C ); - break; - case GL_INTERPOLATE_EXT: - color_combine = (RADEON_BLEND_CTL_BLEND | - RADEON_CLAMP_TX); - RADEON_COLOR_ARG( 0, B ); - RADEON_COLOR_ARG( 1, A ); - RADEON_COLOR_ARG( 2, C ); - break; - case GL_DOT3_RGB_EXT: - case GL_DOT3_RGBA_EXT: - color_combine = (RADEON_COLOR_ARG_C_ZERO | - RADEON_BLEND_CTL_DOT3 | - RADEON_CLAMP_TX); - RADEON_COLOR_ARG( 0, A ); - RADEON_COLOR_ARG( 1, B ); - break; - default: - return; - } + if ( target != GL_TEXTURE_2D ) + return GL_FALSE; - switch ( texUnit->CombineModeA ) { - case GL_REPLACE: - alpha_combine = (RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_CLAMP_TX); - RADEON_ALPHA_ARG( 0, C ); - break; - case GL_MODULATE: - alpha_combine = (RADEON_ALPHA_ARG_C_ZERO | - RADEON_BLEND_CTL_ADD | - RADEON_CLAMP_TX); - RADEON_ALPHA_ARG( 0, A ); - RADEON_ALPHA_ARG( 1, B ); - break; - case GL_ADD: - alpha_combine = (RADEON_ALPHA_ARG_B_ZERO | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADD | - RADEON_CLAMP_TX); - RADEON_ALPHA_ARG( 0, A ); - RADEON_ALPHA_ARG( 1, C ); - break; - case GL_ADD_SIGNED_EXT: - alpha_combine = (RADEON_ALPHA_ARG_B_ZERO | - RADEON_COMP_ARG_B | - RADEON_BLEND_CTL_ADDSIGNED | - RADEON_CLAMP_TX); - RADEON_ALPHA_ARG( 0, A ); - RADEON_ALPHA_ARG( 1, C ); - break; - case GL_INTERPOLATE_EXT: - alpha_combine = (RADEON_BLEND_CTL_BLEND | - RADEON_CLAMP_TX); - RADEON_ALPHA_ARG( 0, B ); - RADEON_ALPHA_ARG( 1, A ); - RADEON_ALPHA_ARG( 2, C ); - break; - default: - return; - } + if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, texObj, level ); + } - if ( texUnit->CombineModeRGB == GL_DOT3_RGB_EXT ) { - alpha_combine |= RADEON_DOT_ALPHA_DONT_REPLICATE; - } + /* FIXME: Can this ever be NULL??? + */ + ASSERT( t ); + ASSERT( t->image[level].data ); - /* Step 3: - * Apply the scale factor. The EXT extension has a somewhat - * unnecessary restriction that the scale must be 4x. The ARB - * extension will likely drop this and we can just apply the - * scale factors regardless. - */ - if ( texUnit->CombineModeRGB != GL_DOT3_RGB_EXT && - texUnit->CombineModeRGB != GL_DOT3_RGBA_EXT ) { - color_combine |= (texUnit->CombineScaleShiftRGB << 21); - alpha_combine |= (texUnit->CombineScaleShiftA << 21); - } else { - color_combine |= RADEON_SCALE_4X; - alpha_combine |= RADEON_SCALE_4X; - } + if ( t->bound ) + FLUSH_BATCH( rmesa ); - /* All done! - */ - break; + texFormat = texImage->TexFormat; - default: - return; + if ( !_mesa_convert_texsubimage2d( texFormat->IntFormat, + xoffset, yoffset, width, height, + texImage->Width, format, type, packing, + pixels, t->image[level].data ) ) { + /*fprintf( stderr, " *** convert failed!\n" );*/ + return GL_FALSE; } - rmesa->color_combine[source] = color_combine; - rmesa->alpha_combine[source] = alpha_combine; + t->dirty_images |= (1 << level); + rmesa->new_state |= RADEON_NEW_TEXTURE; + + return GL_TRUE; } -static void radeonUpdateTextureObject( GLcontext *ctx, int unit ) +/* GH: This is undoubtedly broken... + */ +static GLboolean +radeonDDTexSubImage3D( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - int source = rmesa->tmu_source[unit]; - struct gl_texture_object *tObj; - radeonTexObjPtr t; - GLuint enabled; - - if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { - fprintf( stderr, "%s( %p, %d )\n", - __FUNCTION__, ctx, unit ); - } + radeonTexObjPtr t = (radeonTexObjPtr)texObj->DriverData; + const struct gl_texture_format *texFormat; - enabled = (ctx->Texture.ReallyEnabled >> (source * 4)) & TEXTURE0_ANY; - if ( enabled != TEXTURE0_2D && enabled != TEXTURE0_1D ) { - if ( enabled ) - rmesa->Fallback |= RADEON_FALLBACK_TEXTURE; - return; - } + if ( target != GL_TEXTURE_3D ) + return GL_FALSE; - /* Only update the hardware texture state if the texture is current, - * complete and enabled. + /* FIXME: Can this ever be NULL??? */ - tObj = ctx->Texture.Unit[source].Current; - if ( !tObj || !tObj->Complete ) - return; + ASSERT( t ); + ASSERT( t->image[level].data ); - if ( ( tObj != ctx->Texture.Unit[source].CurrentD[2] ) && - ( tObj != ctx->Texture.Unit[source].CurrentD[1] ) ) - return; - - if ( !tObj->DriverData ) { - /* If this is the first time the texture has been used, then create - * a new texture object for it. - */ - radeonCreateTexObj( rmesa, tObj ); - - if ( !tObj->DriverData ) { - /* Can't create a texture object... */ - fprintf( stderr, "%s: texture object creation failed!\n", - __FUNCTION__ ); - rmesa->Fallback |= RADEON_FALLBACK_TEXTURE; - return; - } - } - - /* We definately have a valid texture now */ - t = tObj->DriverData; - - /* Force the texture unit state to be loaded into the hardware */ - rmesa->dirty |= RADEON_UPLOAD_CONTEXT | (RADEON_UPLOAD_TEX0 << unit); + if ( t->bound ) + FLUSH_BATCH( rmesa ); - /* Force any texture images to be loaded into the hardware */ - if ( t->dirty_images ) - rmesa->dirty |= (RADEON_UPLOAD_TEX0IMAGES << unit); + texFormat = texImage->TexFormat; - /* Bind to the given texture unit */ - rmesa->CurrentTexObj[unit] = t; - t->bound = unit + 1; + if ( !_mesa_convert_texsubimage3d( texFormat->IntFormat, + xoffset, yoffset, zoffset, + width, height, depth, + texImage->Width, texImage->Height, + format, type, packing, + pixels, t->image[level].data ) ) { + /*fprintf( stderr, " *** convert failed!\n" );*/ + return GL_FALSE; + } - if ( t->memBlock ) - radeonUpdateTexLRU( rmesa, t ); + t->dirty_images |= (1 << level); + rmesa->new_state |= RADEON_NEW_TEXTURE; - switch ( unit ) { - case 0: - rmesa->setup.pp_cntl |= (RADEON_TEX_0_ENABLE | - RADEON_TEX_BLEND_0_ENABLE); - break; - case 1: - rmesa->setup.pp_cntl |= (RADEON_TEX_1_ENABLE | - RADEON_TEX_BLEND_1_ENABLE); - break; - } + return GL_TRUE; } -void radeonUpdateTextureState( GLcontext *ctx ) -{ - radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - - if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { - fprintf( stderr, "%s( %p ) en=0x%x\n", - __FUNCTION__, ctx, ctx->Texture.ReallyEnabled ); - } - /* Clear any texturing fallbacks */ - rmesa->Fallback &= ~RADEON_FALLBACK_TEXTURE; +/* ================================================================ + * DEPRECATED... + */ - /* Unbind any currently bound textures */ - if ( rmesa->CurrentTexObj[0] ) rmesa->CurrentTexObj[0]->bound = 0; - if ( rmesa->CurrentTexObj[1] ) rmesa->CurrentTexObj[1]->bound = 0; - rmesa->CurrentTexObj[0] = NULL; - rmesa->CurrentTexObj[1] = NULL; +static GLvoid *radeonDDGetTexImage( GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum *formatOut, GLenum *typeOut, + GLboolean *freeImageOut ) +{ + const struct gl_texture_image *texImage = texObj->Image[level]; + const struct gl_texture_format *texFormat = texImage->TexFormat; + radeonTexObjPtr t = (radeonTexObjPtr)texObj->DriverData; + GLubyte *data; - if ( ctx->Enabled & (TEXTURE0_3D|TEXTURE1_3D) ) - rmesa->Fallback |= RADEON_FALLBACK_TEXTURE; + if ( !t || !t->image[level].data ) + return NULL; - /* Disable all texturing until it is known to be good */ - rmesa->setup.pp_cntl &= ~(RADEON_TEX_ENABLE_MASK | - RADEON_TEX_BLEND_ENABLE_MASK); + data = (GLubyte *) MALLOC( texImage->Width * texImage->Height * 4 ); + if ( !data ) + return NULL; - radeonUpdateTextureObject( ctx, 0 ); - radeonUpdateTextureEnv( ctx, 0 ); + if ( 0 ) + fprintf( stderr, " in=%d out=%s\n", + texFormat->IntFormat, + gl_lookup_enum_by_nr( texImage->Format ) ); - if ( rmesa->multitex ) { - radeonUpdateTextureObject( ctx, 1 ); - radeonUpdateTextureEnv( ctx, 1 ); + switch ( target ) { + case GL_TEXTURE_1D: + _mesa_unconvert_teximage1d( texFormat->IntFormat, texImage->Format, + texImage->Width, + t->image[level].data, data ); + break; + case GL_TEXTURE_2D: + _mesa_unconvert_teximage2d( texFormat->IntFormat, texImage->Format, + texImage->Width, texImage->Height, + t->image[level].data, data ); + break; + default: + return NULL; } - rmesa->dirty |= RADEON_UPLOAD_CONTEXT; + *formatOut = texImage->Format; + *typeOut = GL_UNSIGNED_BYTE; + *freeImageOut = GL_TRUE; + + return data; } /* ================================================================ - * DD interface texturing functions - * - * FIXME: Many of these are deprecated -- we should move to the new - * single-copy texture interface. + * Texture state callbacks */ + #define SCALED_FLOAT_TO_BYTE( x, scale ) \ ((((GLint)((256.0F / scale) * (x))) - 1) / 2) @@ -2067,79 +796,6 @@ static void radeonDDTexEnv( GLcontext *ctx, GLenum target, } } -static void radeonDDTexImage( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, GLint level, - GLint internalFormat, - const struct gl_texture_image *image ) -{ - radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - radeonTexObjPtr t; - - if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) - fprintf( stderr, "%s( %p, level %d )\n", __FUNCTION__, tObj, level ); - - if ( ( target != GL_TEXTURE_2D ) && - ( target != GL_TEXTURE_1D ) ) - return; - - if ( level >= RADEON_MAX_TEXTURE_LEVELS ) - return; - - t = (radeonTexObjPtr)tObj->DriverData; - if ( t ) { - if ( t->bound ) FLUSH_BATCH( rmesa ); - - /* Destroy the old texture, and upload a new one. The actual - * uploading of the texture image occurs in the UploadSubImage - * function. - */ - radeonDestroyTexObj( rmesa, t ); - rmesa->new_state |= RADEON_NEW_TEXTURE; - } -} - -static void radeonDDTexSubImage( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLint internalFormat, - const struct gl_texture_image *image ) -{ - radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - radeonTexObjPtr t; - - if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { - fprintf( stderr, "%s( %p, level %d ) size: %d,%d of %d,%d\n", - __FUNCTION__, tObj, level, width, height, - image->Width, image->Height ); - } - - if ( ( target != GL_TEXTURE_2D ) && - ( target != GL_TEXTURE_1D ) ) - return; - - if ( level >= RADEON_MAX_TEXTURE_LEVELS ) - return; - - t = (radeonTexObjPtr)tObj->DriverData; - if ( t ) { - if ( t->bound ) FLUSH_BATCH( rmesa ); - -#if 0 - /* FIXME: Only upload textures if we already have space in the heap. - */ - LOCK_HARDWARE( rmesa ); - radeonUploadSubImage( rmesa, t, level, - xoffset, yoffset, width, height ); - UNLOCK_HARDWARE( rmesa ); -#else - radeonDestroyTexObj( rmesa, t ); -#endif - /* Update the context state */ - rmesa->new_state |= RADEON_NEW_TEXTURE; - } -} - static void radeonDDTexParameter( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLenum pname, const GLfloat *params ) @@ -2156,7 +812,7 @@ static void radeonDDTexParameter( GLcontext *ctx, GLenum target, * created with current state before it is used, so we don't have * to do anything now. */ - if ( !t || !t->bound ) + if ( !t ) return; if ( ( target != GL_TEXTURE_2D ) && @@ -2192,34 +848,51 @@ static void radeonDDBindTexture( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - GLint unit = ctx->Texture.CurrentUnit; + radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData; + GLuint unit = ctx->Texture.CurrentUnit; if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { fprintf( stderr, "%s( %p ) unit=%d\n", - __FUNCTION__, tObj, ctx->Texture.CurrentUnit ); + __FUNCTION__, tObj, unit ); } FLUSH_BATCH( rmesa ); + if ( !t ) { + t = radeonAllocTexObj( tObj ); + tObj->DriverData = t; + } + + /* Unbind a currently bound texture. + */ if ( rmesa->CurrentTexObj[unit] ) { - rmesa->CurrentTexObj[unit]->bound = 0; + rmesa->CurrentTexObj[unit]->bound &= ~(unit + 1); rmesa->CurrentTexObj[unit] = NULL; } + /* Bind to the given texture unit. + */ + rmesa->CurrentTexObj[unit] = t; + t->bound |= unit + 1; + rmesa->new_state |= RADEON_NEW_TEXTURE; } static void radeonDDDeleteTexture( GLcontext *ctx, - struct gl_texture_object *tObj ) + struct gl_texture_object *tObj ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonTexObjPtr t = (radeonTexObjPtr)tObj->DriverData; + if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, __FUNCTION__ "( %p )\n", tObj ); + } + if ( t ) { if ( t->bound ) { FLUSH_BATCH( rmesa ); - - rmesa->CurrentTexObj[t->bound-1] = 0; + if ( t->bound & TEX_0 ) rmesa->CurrentTexObj[0] = NULL; + if ( t->bound & TEX_1 ) rmesa->CurrentTexObj[1] = NULL; rmesa->new_state |= RADEON_NEW_TEXTURE; } @@ -2236,18 +909,52 @@ static GLboolean radeonDDIsTextureResident( GLcontext *ctx, return ( t && t->memBlock ); } +static void radeonDDInitTextureObjects( GLcontext *ctx ) +{ + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + struct gl_texture_object *texObj; + GLuint tmp = ctx->Texture.CurrentUnit; + + ctx->Texture.CurrentUnit = 0; + + texObj = ctx->Texture.Unit[0].CurrentD[1]; + radeonDDBindTexture( ctx, GL_TEXTURE_1D, texObj ); + move_to_tail( &rmesa->SwappedOut, (radeonTexObjPtr)texObj->DriverData ); + + texObj = ctx->Texture.Unit[0].CurrentD[2]; + radeonDDBindTexture( ctx, GL_TEXTURE_2D, texObj ); + move_to_tail( &rmesa->SwappedOut, (radeonTexObjPtr)texObj->DriverData ); + ctx->Texture.CurrentUnit = 1; + + texObj = ctx->Texture.Unit[1].CurrentD[1]; + radeonDDBindTexture( ctx, GL_TEXTURE_1D, texObj ); + move_to_tail( &rmesa->SwappedOut, (radeonTexObjPtr)texObj->DriverData ); + + texObj = ctx->Texture.Unit[1].CurrentD[2]; + radeonDDBindTexture( ctx, GL_TEXTURE_2D, texObj ); + move_to_tail( &rmesa->SwappedOut, (radeonTexObjPtr)texObj->DriverData ); + + ctx->Texture.CurrentUnit = tmp; +} void radeonDDInitTextureFuncs( GLcontext *ctx ) { + ctx->Driver.TexImage1D = radeonDDTexImage1D; + ctx->Driver.TexImage2D = radeonDDTexImage2D; + ctx->Driver.TexImage3D = NULL; (void) radeonDDTexImage3D; + ctx->Driver.TexSubImage1D = radeonDDTexSubImage1D; + ctx->Driver.TexSubImage2D = radeonDDTexSubImage2D; + ctx->Driver.TexSubImage3D = NULL; (void) radeonDDTexSubImage3D; + ctx->Driver.GetTexImage = radeonDDGetTexImage; ctx->Driver.TexEnv = radeonDDTexEnv; - ctx->Driver.TexImage = radeonDDTexImage; - ctx->Driver.TexSubImage = radeonDDTexSubImage; ctx->Driver.TexParameter = radeonDDTexParameter; ctx->Driver.BindTexture = radeonDDBindTexture; ctx->Driver.DeleteTexture = radeonDDDeleteTexture; - ctx->Driver.UpdateTexturePalette = NULL; - ctx->Driver.ActiveTexture = NULL; ctx->Driver.IsTextureResident = radeonDDIsTextureResident; ctx->Driver.PrioritizeTexture = NULL; + ctx->Driver.ActiveTexture = NULL; + ctx->Driver.UpdateTexturePalette = NULL; + + radeonDDInitTextureObjects( ctx ); } diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h index 2534335aa..b521b8f96 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h,v 1.1 2001/01/08 01:07:28 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -45,9 +45,11 @@ extern int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t ); extern void radeonAgeTextures( radeonContextPtr rmesa, int heap ); extern void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t ); +extern void radeonSwapOutTexObj( radeonContextPtr rmesa, radeonTexObjPtr t ); extern void radeonPrintLocalLRU( radeonContextPtr rmesa, int heap ); extern void radeonPrintGlobalLRU( radeonContextPtr rmesa, int heap ); +extern void radeonUpdateTexLRU(radeonContextPtr rmesa, radeonTexObjPtr t ); extern void radeonDDInitTextureFuncs( GLcontext *ctx ); diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c new file mode 100644 index 000000000..cbef6fcf4 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c @@ -0,0 +1,527 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c,v 1.1 2001/03/21 16:14:25 dawes Exp $ */ +/************************************************************************** + +Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and + VA Linux Systems Inc., Fremont, California. + +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 +on 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 +ATI, VA LINUX SYSTEMS AND/OR THEIR 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: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include "radeon_context.h" +#include "radeon_state.h" +#include "radeon_ioctl.h" +#include "radeon_vb.h" +#include "radeon_tex.h" + +#include "mmath.h" +#include "simple_list.h" +#include "enums.h" +#include "mem.h" + + +/* Destroy hardware state associated with texture `t'. + */ +void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t ) +{ + GLint i; +#if ENABLE_PERF_BOXES + /* Bump the performace counter */ + rmesa->c_textureSwaps++; +#endif + if ( !t ) return; + + if ( RADEON_DEBUG & DEBUG_VERBOSE_TEXTURE ) { + fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, t, t->tObj ); + } + + for ( i = 0 ; i < RADEON_MAX_TEXTURE_LEVELS ; i++ ) { + if ( t->image[i].data ) FREE( t->image[i].data ); + } + + if ( t->memBlock ) { + mmFreeMem( t->memBlock ); + t->memBlock = NULL; + } + + if ( t->tObj ) + t->tObj->DriverData = NULL; + + if ( t->bound & TEX_0 ) rmesa->CurrentTexObj[0] = NULL; + if ( t->bound & TEX_1 ) rmesa->CurrentTexObj[1] = NULL; + + remove_from_list( t ); + FREE( t ); +} + +/* Keep track of swapped out texture objects. + */ +void radeonSwapOutTexObj( radeonContextPtr rmesa, radeonTexObjPtr t ) +{ + if ( RADEON_DEBUG & DEBUG_VERBOSE_TEXTURE ) { + fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, t, t->tObj ); + } +#if ENABLE_PERF_BOXES + /* Bump the performace counter */ + rmesa->c_textureSwaps++; +#endif + if ( t->memBlock ) { + mmFreeMem( t->memBlock ); + t->memBlock = NULL; + } + + t->dirty_images = ~0; + move_to_tail( &rmesa->SwappedOut, t ); +} + +/* Print out debugging information about texture LRU. + */ +void radeonPrintLocalLRU( radeonContextPtr rmesa, int heap ) +{ + radeonTexObjPtr t; + int sz = 1 << (rmesa->radeonScreen->logTexGranularity[heap]); + + fprintf( stderr, "\nLocal LRU, heap %d:\n", heap ); + + foreach ( t, &rmesa->TexObjList[heap] ) { + if (!t->tObj) { + fprintf( stderr, "Placeholder %d at 0x%x sz 0x%x\n", + t->memBlock->ofs / sz, + t->memBlock->ofs, + t->memBlock->size ); + } else { + fprintf( stderr, "Texture (bound %d) at 0x%x sz 0x%x\n", + t->bound, + t->memBlock->ofs, + t->memBlock->size ); + } + } + + fprintf( stderr, "\n" ); +} + +void radeonPrintGlobalLRU( radeonContextPtr rmesa, int heap ) +{ + radeon_tex_region_t *list = rmesa->sarea->texList[heap]; + int i, j; + + fprintf( stderr, "\nGlobal LRU, heap %d list %p:\n", heap, list ); + + for ( i = 0, j = RADEON_NR_TEX_REGIONS ; i < RADEON_NR_TEX_REGIONS ; i++ ) { + fprintf( stderr, "list[%d] age %d next %d prev %d\n", + j, list[j].age, list[j].next, list[j].prev ); + j = list[j].next; + if ( j == RADEON_NR_TEX_REGIONS ) break; + } + + if ( j != RADEON_NR_TEX_REGIONS ) { + fprintf( stderr, "Loop detected in global LRU\n" ); + for ( i = 0 ; i < RADEON_NR_TEX_REGIONS ; i++ ) { + fprintf( stderr, "list[%d] age %d next %d prev %d\n", + i, list[i].age, list[i].next, list[i].prev ); + } + } + + fprintf( stderr, "\n" ); +} + +/* Reset the global texture LRU. + */ +static void radeonResetGlobalLRU( radeonContextPtr rmesa, int heap ) +{ + radeon_tex_region_t *list = rmesa->sarea->texList[heap]; + int sz = 1 << rmesa->radeonScreen->logTexGranularity[heap]; + int i; + + /* + * (Re)initialize the global circular LRU list. The last element in + * the array (RADEON_NR_TEX_REGIONS) is the sentinal. Keeping it at + * the end of the array allows it to be addressed rationally when + * looking up objects at a particular location in texture memory. + */ + for ( i = 0 ; (i+1) * sz <= rmesa->radeonScreen->texSize[heap] ; i++ ) { + list[i].prev = i-1; + list[i].next = i+1; + list[i].age = 0; + } + + i--; + list[0].prev = RADEON_NR_TEX_REGIONS; + list[i].prev = i-1; + list[i].next = RADEON_NR_TEX_REGIONS; + list[RADEON_NR_TEX_REGIONS].prev = i; + list[RADEON_NR_TEX_REGIONS].next = 0; + rmesa->sarea->texAge[heap] = 0; +} + +/* Update the local and glock texture LRUs. + */ +void radeonUpdateTexLRU( radeonContextPtr rmesa, radeonTexObjPtr t ) +{ + int heap = t->heap; + radeon_tex_region_t *list = rmesa->sarea->texList[heap]; + int sz = rmesa->radeonScreen->logTexGranularity[heap]; + int start = t->memBlock->ofs >> sz; + int end = (t->memBlock->ofs + t->memBlock->size-1) >> sz; + int i; + + rmesa->lastTexAge[heap] = ++rmesa->sarea->texAge[heap]; + + if ( !t->memBlock ) { + fprintf( stderr, "no memblock\n\n" ); + return; + } + + /* Update our local LRU */ + move_to_head( &rmesa->TexObjList[heap], t ); + + /* Update the global LRU */ + for ( i = start ; i <= end ; i++ ) { + list[i].in_use = 1; + list[i].age = rmesa->lastTexAge[heap]; + + /* remove_from_list(i) */ + list[(CARD32)list[i].next].prev = list[i].prev; + list[(CARD32)list[i].prev].next = list[i].next; + + /* insert_at_head(list, i) */ + list[i].prev = RADEON_NR_TEX_REGIONS; + list[i].next = list[RADEON_NR_TEX_REGIONS].next; + list[(CARD32)list[RADEON_NR_TEX_REGIONS].next].prev = i; + list[RADEON_NR_TEX_REGIONS].next = i; + } + + if ( 0 ) { + radeonPrintGlobalLRU( rmesa, t->heap ); + radeonPrintLocalLRU( rmesa, t->heap ); + } +} + +/* Update our notion of what textures have been changed since we last + * held the lock. This pertains to both our local textures and the + * textures belonging to other clients. Keep track of other client's + * textures by pushing a placeholder texture onto the LRU list -- these + * are denoted by (tObj == NULL). + */ +static void radeonTexturesGone( radeonContextPtr rmesa, int heap, + int offset, int size, int in_use ) +{ + radeonTexObjPtr t, tmp; + + foreach_s ( t, tmp, &rmesa->TexObjList[heap] ) { + if ( t->memBlock->ofs >= offset + size || + t->memBlock->ofs + t->memBlock->size <= offset ) + continue; + + /* It overlaps - kick it out. Need to hold onto the currently + * bound objects, however. + */ + radeonSwapOutTexObj( rmesa, t ); + } + + if ( in_use ) { + t = (radeonTexObjPtr) CALLOC( sizeof(*t) ); + if ( !t ) return; + + t->memBlock = mmAllocMem( rmesa->texHeap[heap], size, 0, offset ); + if ( !t->memBlock ) { + fprintf( stderr, "Couldn't alloc placeholder sz %x ofs %x\n", + (int)size, (int)offset ); + mmDumpMemInfo( rmesa->texHeap[heap] ); + return; + } + insert_at_head( &rmesa->TexObjList[heap], t ); + } +} + +/* Update our client's shared texture state. If another client has + * modified a region in which we have textures, then we need to figure + * out which of our textures has been removed, and update our global + * LRU. + */ +void radeonAgeTextures( radeonContextPtr rmesa, int heap ) +{ + RADEONSAREAPrivPtr sarea = rmesa->sarea; + + if ( sarea->texAge[heap] != rmesa->lastTexAge[heap] ) { + int sz = 1 << rmesa->radeonScreen->logTexGranularity[heap]; + int nr = 0; + int idx; + + for ( idx = sarea->texList[heap][RADEON_NR_TEX_REGIONS].prev ; + idx != RADEON_NR_TEX_REGIONS && nr < RADEON_NR_TEX_REGIONS ; + idx = sarea->texList[heap][idx].prev, nr++ ) + { + /* If switching texturing schemes, then the SAREA might not + * have been properly cleared, so we need to reset the + * global texture LRU. + */ + if ( idx * sz > rmesa->radeonScreen->texSize[heap] ) { + nr = RADEON_NR_TEX_REGIONS; + break; + } + + if ( sarea->texList[heap][idx].age > rmesa->lastTexAge[heap] ) { + radeonTexturesGone( rmesa, heap, idx * sz, sz, + sarea->texList[heap][idx].in_use ); + } + } + + if ( nr == RADEON_NR_TEX_REGIONS ) { + radeonTexturesGone( rmesa, heap, 0, + rmesa->radeonScreen->texSize[heap], 0 ); + radeonResetGlobalLRU( rmesa, heap ); + } + + rmesa->dirty |= (RADEON_UPLOAD_CONTEXT | + RADEON_UPLOAD_TEX0IMAGES | + RADEON_UPLOAD_TEX1IMAGES); + rmesa->lastTexAge[heap] = sarea->texAge[heap]; + } +} + + +/* ================================================================ + * Texture image uploads + */ + +/* Upload the texture image associated with texture `t' at level `level' + * at the address relative to `start'. + */ +static void radeonUploadSubImage( radeonContextPtr rmesa, + radeonTexObjPtr t, GLint level, + GLint x, GLint y, GLint width, GLint height ) +{ + struct gl_texture_image *texImage; + const struct gl_texture_format *texFormat; + GLint texelsPerDword = 0; + GLint imageX, imageY, imageWidth, imageHeight; + GLint blitX, blitY, blitWidth, blitHeight; + GLint imageRows, blitRows; + GLint remaining; + GLint format, dwords; + CARD32 pitch, offset; + drmBufPtr buffer; + CARD32 *dst; + GLint ret; + + if ( RADEON_DEBUG & DEBUG_VERBOSE_TEXTURE ) { + fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, t, t->tObj ); + } + + /* Ensure we have a valid texture to upload */ + texImage = t->tObj->Image[level]; + if ( !texImage ) { + if ( RADEON_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, __FUNCTION__ ": texImage %d is NULL!\n", level ); + return; + } + if ( !t->image[level].data ) { + if ( RADEON_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, __FUNCTION__ ": image data is NULL!\n" ); + return; + } + + texFormat = texImage->TexFormat; + + switch ( texFormat->TexelBytes ) { + case 1: + texelsPerDword = 4; + break; + case 2: + texelsPerDword = 2; + break; + case 4: + texelsPerDword = 1; + break; + } + + format = t->pp_txformat & RADEON_TXFORMAT_FORMAT_MASK; + + imageX = 0; + imageY = 0; + imageWidth = texImage->Width; + imageHeight = texImage->Height; + + blitX = t->image[level].x; + blitY = t->image[level].y; + blitWidth = t->image[level].width; + blitHeight = t->image[level].height; + + offset = t->bufAddr; + pitch = (t->image[0].width * texFormat->TexelBytes) / 64; + + if ( RADEON_DEBUG & DEBUG_VERBOSE_MSG ) { + fprintf( stderr, " upload image: %d,%d at %d,%d\n", + imageWidth, imageHeight, imageX, imageY ); + fprintf( stderr, " upload blit: %d,%d at %d,%d\n", + blitWidth, blitHeight, blitX, blitY ); + fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x " + "level: %d format: %x\n", + (GLuint)offset, (GLuint)pitch, level, format ); + } + + ret = drmRadeonLoadTexture( rmesa->driFd, offset, pitch, format, + imageWidth, imageHeight, &t->image[level] ); + + if ( ret ) { + UNLOCK_HARDWARE( rmesa ); + fprintf( stderr, "drmRadeonTextureBlit: return = %d\n", ret ); + fprintf( stderr, " offset=0x%08x pitch=0x%x format=%d\n", + offset, pitch, format ); + fprintf( stderr, " image width=%d height=%d\n", + imageWidth, imageHeight ); + fprintf( stderr, " blit width=%d height=%d data=%p\n", + t->image[level].width, t->image[level].height, + t->image[level].data ); + exit( 1 ); + } + + rmesa->new_state |= RADEON_NEW_CONTEXT; + rmesa->dirty |= RADEON_UPLOAD_CONTEXT | RADEON_UPLOAD_MASKS; +} + +/* Upload the texture images associated with texture `t'. This might + * require removing our own and/or other client's texture objects to + * make room for these images. + */ +int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t ) +{ + int i; + int heap; + + if ( RADEON_DEBUG & DEBUG_VERBOSE_TEXTURE ) { + fprintf( stderr, "%s( %p, %p ) sz=%d\n", + __FUNCTION__, rmesa->glCtx, t->tObj, t->totalSize ); + } + + if ( !t || t->totalSize == 0 ) + return 0; + + /* Choose the heap appropriately */ + heap = t->heap = RADEON_CARD_HEAP; +#if 0 + if ( !rmesa->radeonScreen->IsPCI && + t->totalSize > rmesa->radeonScreen->texSize[heap] ) { + heap = t->heap = RADEON_AGP_HEAP; + } +#endif + + /* Do we need to eject LRU texture objects? */ + if ( !t->memBlock ) { + /* Allocate a memory block on a 4k boundary (1<<12 == 4096) */ + t->memBlock = mmAllocMem( rmesa->texHeap[heap], + t->totalSize, 12, 0 ); + +#if 0 + /* Try AGP before kicking anything out of local mem */ + if ( !t->memBlock && heap == RADEON_CARD_HEAP ) { + t->memBlock = mmAllocMem( rmesa->texHeap[RADEON_AGP_HEAP], + t->totalSize, 12, 0 ); + + if ( t->memBlock ) + heap = t->heap = RADEON_AGP_HEAP; + } +#endif + + /* Kick out textures until the requested texture fits */ + while ( !t->memBlock ) { + if ( rmesa->TexObjList[heap].prev->bound ) { + fprintf( stderr, + "radeonUploadTexImages: ran into bound texture\n" ); + return -1; + } + if ( rmesa->TexObjList[heap].prev == &rmesa->TexObjList[heap] ) { + if ( rmesa->radeonScreen->IsPCI ) { + fprintf( stderr, "radeonUploadTexImages: upload texture " + "failure on local texture heaps, sz=%d\n", + t->totalSize ); + return -1; +#if 0 + } else if ( heap == RADEON_CARD_HEAP ) { + heap = t->heap = RADEON_AGP_HEAP; + continue; +#endif + } else { + fprintf( stderr, "radeonUploadTexImages: upload texture " + "failure on both local and AGP texture heaps, " + "sz=%d\n", + t->totalSize ); + return -1; + } + } + + radeonSwapOutTexObj( rmesa, rmesa->TexObjList[heap].prev ); + + t->memBlock = mmAllocMem( rmesa->texHeap[heap], + t->totalSize, 12, 0 ); + } + + /* Set the base offset of the texture image */ + t->bufAddr = rmesa->radeonScreen->texOffset[heap] + t->memBlock->ofs; + + t->pp_txoffset = t->bufAddr; +#if 0 + /* Fix AGP texture offsets */ + if ( heap == RADEON_AGP_HEAP ) { + t->setup.pp_tx_offset += RADEON_AGP_TEX_OFFSET + + rmesa->radeonScreen->agpTexOffset; + } +#endif + + /* Force loading the new state into the hardware */ + if ( t->bound & TEX_0 ) { + rmesa->dirty |= RADEON_UPLOAD_CONTEXT | RADEON_UPLOAD_TEX0; + } + if ( t->bound & TEX_1 ) { + rmesa->dirty |= RADEON_UPLOAD_CONTEXT | RADEON_UPLOAD_TEX1; + } + } + + /* Let the world know we've used this memory recently */ + radeonUpdateTexLRU( rmesa, t ); + + /* Upload any images that are new */ + if ( t->dirty_images ) { + int levels = ((t->pp_txfilter & RADEON_MAX_MIP_LEVEL_MASK) >> + RADEON_MAX_MIP_LEVEL_SHIFT); + + for ( i = 0 ; i <= levels ; i++ ) { + if ( (t->dirty_images & (1 << i)) && t->image[i].data ) { + radeonUploadSubImage( rmesa, t, i, 0, 0, + t->image[i].width, t->image[i].height ); + } + } + + rmesa->dirty |= RADEON_UPLOAD_CONTEXT; + } + + t->dirty_images = 0; + return 0; +} diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h index 45368e076..800f3cec4 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h,v 1.1 2001/01/08 01:07:28 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -40,17 +40,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_sarea.h" #include "mm.h" -/* Handle the Radeon's tightly packed mipmaps and strict offset, - * pitch rules for blits by assigning each mipmap a set of - * coordinates that can be used for a hostdata blit. - */ -typedef struct { - GLuint x; /* Blit coordinates */ - GLuint y; - GLuint width; /* Blit dimensions */ - GLuint height; - GLuint dwords; /* Size of image level */ -} radeonTexImage; +#define TEX_0 1 +#define TEX_1 2 typedef struct radeon_tex_obj radeonTexObj, *radeonTexObjPtr; @@ -72,16 +63,15 @@ struct radeon_tex_obj { GLint bound; /* Texture unit currently bound to */ GLint heap; /* Texture heap currently stored in */ - radeonTexImage image[RADEON_MAX_TEXTURE_LEVELS]; /* Image data for all - mipmap levels */ + drmRadeonTexImage image[RADEON_MAX_TEXTURE_LEVELS]; GLint totalSize; /* Total size of the texture including all mipmap levels */ - GLint texelBytes; /* Number of bytes per texel */ - - GLboolean hasAlpha; - radeon_texture_regs_t setup; /* Setup regs for texture */ + GLuint pp_txfilter; /* Hardware register values */ + GLuint pp_txformat; + GLuint pp_txoffset; + GLuint pp_border_color; }; #endif /* __RADEON_TEXOBJ_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c new file mode 100644 index 000000000..6a9f53255 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c @@ -0,0 +1,1103 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c,v 1.1 2001/03/21 16:14:25 dawes Exp $ */ +/************************************************************************** + +Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and + VA Linux Systems Inc., Fremont, California. + +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 +on 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 +ATI, VA LINUX SYSTEMS AND/OR THEIR 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: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include "radeon_context.h" +#include "radeon_state.h" +#include "radeon_ioctl.h" +#include "radeon_vb.h" +#include "radeon_tex.h" + +#include "mmath.h" +#include "simple_list.h" +#include "enums.h" +#include "mem.h" + +static void radeonSetTexImages( radeonContextPtr rmesa, + struct gl_texture_object *tObj ) +{ + radeonTexObjPtr t = (radeonTexObjPtr)tObj->DriverData; + struct gl_texture_image *texImage = tObj->Image[0]; + const struct gl_texture_format *texFormat = texImage->TexFormat; + GLint log2Width, log2Height, log2Size; + GLint totalSize; + GLint texelsPerDword = 0, blitWidth = 0, blitPitch = 0; + GLint x, y, width, height; + GLint i; + + /* Calculate dimensions in log domain. + */ + for ( i = 1, log2Height = 0 ; i < texImage->Height ; i *= 2 ) { + log2Height++; + } + for ( i = 1, log2Width = 0 ; i < texImage->Width ; i *= 2 ) { + log2Width++; + } + log2Size = MAX2( log2Width, log2Height ); + + /* The Radeon has a 64-byte minimum pitch for all blits. We + * calculate the equivalent number of texels to simplify the + * calculation of the texture image area. + */ + switch ( texFormat->TexelBytes ) { + case 4: + texelsPerDword = 1; + blitPitch = 16; + break; + case 2: + texelsPerDword = 2; + blitPitch = 32; + break; + case 1: + texelsPerDword = 4; + blitPitch = 64; + break; + } + + /* Select the larger of the two widths for our global texture image + * coordinate space. As the Radeon has very strict offset rules, we + * can't upload mipmaps directly and have to reference their location + * from the aligned start of the whole image. + */ + blitWidth = MAX2( texImage->Width, blitPitch ); + + /* Calculate mipmap offsets and dimensions. + */ + totalSize = 0; + x = 0; + y = 0; + + for ( i = 0 ; i <= log2Size ; i++ ) { + GLuint size; + + texImage = tObj->Image[i]; + if ( !texImage ) + break; + + width = texImage->Width; + height = texImage->Height; + + /* Texture images have a minimum pitch of 32 bytes (half of the + * 64-byte minimum pitch for blits). For images that have a + * width smaller than this, we must pad each texture image + * scanline out to this amount. + */ + if ( width < blitPitch / 2 ) { + width = blitPitch / 2; + } + + size = width * height * texFormat->TexelBytes; + totalSize += size; + ASSERT( (totalSize & 31) == 0 ); + + while ( width < blitWidth && height > 1 ) { + width *= 2; + height /= 2; + } + + t->image[i].x = x; + t->image[i].y = y; + + t->image[i].width = width; + t->image[i].height = height; + + /* While blits must have a pitch of at least 64 bytes, mipmaps + * must be aligned on a 32-byte boundary (just like each texture + * image scanline). + */ + if ( width >= blitWidth ) { + y += height; + } else { + x += width; + if ( x >= blitWidth ) { + x = 0; + y++; + } + } + + if ( 0 ) { + fprintf( stderr, "level=%d p=%d %dx%d -> %dx%d at (%d,%d)\n", + i, blitWidth, texImage->Width, texImage->Height, + t->image[i].width, t->image[i].height, + t->image[i].x, t->image[i].y ); + } + } + + /* Align the total size of texture memory block. + */ + t->totalSize = (totalSize + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK; + + /* Hardware state: + */ + t->pp_txfilter &= ~RADEON_MAX_MIP_LEVEL_MASK; + t->pp_txfilter |= i << RADEON_MAX_MIP_LEVEL_SHIFT; + + t->pp_txformat &= ~(RADEON_TXFORMAT_WIDTH_MASK | + RADEON_TXFORMAT_HEIGHT_MASK); + t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_WIDTH_SHIFT) | + (log2Height << RADEON_TXFORMAT_HEIGHT_SHIFT)); +} + + +/* ================================================================ + * Texture combine functions + */ + +#define RADEON_DISABLE 0 +#define RADEON_REPLACE 1 +#define RADEON_MODULATE 2 +#define RADEON_DECAL 3 +#define RADEON_BLEND 4 +#define RADEON_ADD 5 +#define RADEON_MAX_COMBFUNC 6 + +static GLuint radeon_color_combine[][RADEON_MAX_COMBFUNC] = +{ + /* Unit 0: + */ + { + /* Disable combiner stage + */ + (RADEON_COLOR_ARG_A_ZERO | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_CURRENT_COLOR | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_REPLACE = 0x00802800 + */ + (RADEON_COLOR_ARG_A_ZERO | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_T0_COLOR | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_MODULATE = 0x00800142 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_T0_COLOR | + RADEON_COLOR_ARG_C_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_DECAL = 0x008c2d42 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_T0_COLOR | + RADEON_COLOR_ARG_C_T0_ALPHA | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_BLEND = 0x008c2902 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_TFACTOR_COLOR | + RADEON_COLOR_ARG_C_T0_COLOR | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_ADD = 0x00812802 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_T0_COLOR | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + }, + + /* Unit 1: + */ + { + /* Disable combiner stage + */ + (RADEON_COLOR_ARG_A_ZERO | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_CURRENT_COLOR | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_REPLACE = 0x00803000 + */ + (RADEON_COLOR_ARG_A_ZERO | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_T1_COLOR | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_MODULATE = 0x00800182 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_T1_COLOR | + RADEON_COLOR_ARG_C_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_DECAL = 0x008c3582 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_T1_COLOR | + RADEON_COLOR_ARG_C_T1_ALPHA | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_BLEND = 0x008c3102 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_TFACTOR_COLOR | + RADEON_COLOR_ARG_C_T1_COLOR | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_ADD = 0x00813002 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_T1_COLOR | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + }, + + /* Unit 2: + */ + { + /* Disable combiner stage + */ + (RADEON_COLOR_ARG_A_ZERO | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_CURRENT_COLOR | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_REPLACE = 0x00803800 + */ + (RADEON_COLOR_ARG_A_ZERO | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_T2_COLOR | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_MODULATE = 0x008001c2 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_T2_COLOR | + RADEON_COLOR_ARG_C_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_DECAL = 0x008c3dc2 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_T2_COLOR | + RADEON_COLOR_ARG_C_T2_ALPHA | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_BLEND = 0x008c3902 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_TFACTOR_COLOR | + RADEON_COLOR_ARG_C_T2_COLOR | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_ADD = 0x00813802 + */ + (RADEON_COLOR_ARG_A_CURRENT_COLOR | + RADEON_COLOR_ARG_B_ZERO | + RADEON_COLOR_ARG_C_T2_COLOR | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + } +}; + +static GLuint radeon_alpha_combine[][RADEON_MAX_COMBFUNC] = +{ + /* Unit 0: + */ + { + /* Disable combiner stage + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_CURRENT_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_REPLACE = 0x00800500 + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_T0_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_MODULATE = 0x00800051 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_T0_ALPHA | + RADEON_ALPHA_ARG_C_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_DECAL = 0x00800100 + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_CURRENT_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_BLEND = 0x00800051 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_TFACTOR_ALPHA | + RADEON_ALPHA_ARG_C_T0_ALPHA | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_ADD = 0x00800051 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_T0_ALPHA | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + }, + + /* Unit 1: + */ + { + /* Disable combiner stage + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_CURRENT_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_REPLACE = 0x00800600 + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_T1_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_MODULATE = 0x00800061 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_T1_ALPHA | + RADEON_ALPHA_ARG_C_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_DECAL = 0x00800100 + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_CURRENT_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_BLEND = 0x00800061 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_TFACTOR_ALPHA | + RADEON_ALPHA_ARG_C_T1_ALPHA | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_ADD = 0x00800061 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_T1_ALPHA | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + }, + + /* Unit 2: + */ + { + /* Disable combiner stage + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_CURRENT_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_REPLACE = 0x00800700 + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_T2_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_MODULATE = 0x00800071 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_T2_ALPHA | + RADEON_ALPHA_ARG_C_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_DECAL = 0x00800100 + */ + (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_CURRENT_ALPHA | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_BLEND = 0x00800071 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_TFACTOR_ALPHA | + RADEON_ALPHA_ARG_C_T2_ALPHA | + RADEON_BLEND_CTL_BLEND | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + + /* GL_ADD = 0x00800021 + */ + (RADEON_ALPHA_ARG_A_CURRENT_ALPHA | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_ALPHA_ARG_C_T2_ALPHA | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADD | + RADEON_SCALE_1X | + RADEON_CLAMP_TX), + } +}; + + +/* GL_EXT_texture_env_combine support + */ + +/* The color tables have combine functions for GL_SRC_COLOR, + * GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. + */ +static GLuint radeon_texture_color[][RADEON_MAX_TEXTURE_UNITS] = +{ + { + RADEON_COLOR_ARG_A_T0_COLOR, + RADEON_COLOR_ARG_A_T1_COLOR, + RADEON_COLOR_ARG_A_T2_COLOR + }, + { + RADEON_COLOR_ARG_A_T0_COLOR | RADEON_COMP_ARG_A, + RADEON_COLOR_ARG_A_T1_COLOR | RADEON_COMP_ARG_A, + RADEON_COLOR_ARG_A_T2_COLOR | RADEON_COMP_ARG_A + }, + { + RADEON_COLOR_ARG_A_T0_ALPHA, + RADEON_COLOR_ARG_A_T1_ALPHA, + RADEON_COLOR_ARG_A_T2_ALPHA + }, + { + RADEON_COLOR_ARG_A_T0_ALPHA | RADEON_COMP_ARG_A, + RADEON_COLOR_ARG_A_T1_ALPHA | RADEON_COMP_ARG_A, + RADEON_COLOR_ARG_A_T2_ALPHA | RADEON_COMP_ARG_A + }, +}; + +static GLuint radeon_tfactor_color[] = +{ + RADEON_COLOR_ARG_A_TFACTOR_COLOR, + RADEON_COLOR_ARG_A_TFACTOR_COLOR | RADEON_COMP_ARG_A, + RADEON_COLOR_ARG_A_TFACTOR_ALPHA, + RADEON_COLOR_ARG_A_TFACTOR_ALPHA | RADEON_COMP_ARG_A +}; + +static GLuint radeon_primary_color[] = +{ + RADEON_COLOR_ARG_A_DIFFUSE_COLOR, + RADEON_COLOR_ARG_A_DIFFUSE_COLOR | RADEON_COMP_ARG_A, + RADEON_COLOR_ARG_A_DIFFUSE_ALPHA, + RADEON_COLOR_ARG_A_DIFFUSE_ALPHA | RADEON_COMP_ARG_A +}; + +static GLuint radeon_previous_color[] = +{ + RADEON_COLOR_ARG_A_CURRENT_COLOR, + RADEON_COLOR_ARG_A_CURRENT_COLOR | RADEON_COMP_ARG_A, + RADEON_COLOR_ARG_A_CURRENT_ALPHA, + RADEON_COLOR_ARG_A_CURRENT_ALPHA | RADEON_COMP_ARG_A +}; + +/* The alpha tables only have GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. + */ +static GLuint radeon_texture_alpha[][RADEON_MAX_TEXTURE_UNITS] = +{ + { + RADEON_ALPHA_ARG_A_T0_ALPHA, + RADEON_ALPHA_ARG_A_T1_ALPHA, + RADEON_ALPHA_ARG_A_T2_ALPHA + }, + { + RADEON_ALPHA_ARG_A_T0_ALPHA | RADEON_COMP_ARG_A, + RADEON_ALPHA_ARG_A_T1_ALPHA | RADEON_COMP_ARG_A, + RADEON_ALPHA_ARG_A_T2_ALPHA | RADEON_COMP_ARG_A + }, +}; + +static GLuint radeon_tfactor_alpha[] = +{ + RADEON_ALPHA_ARG_A_TFACTOR_ALPHA, + RADEON_ALPHA_ARG_A_TFACTOR_ALPHA | RADEON_COMP_ARG_A +}; + +static GLuint radeon_primary_alpha[] = +{ + RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA, + RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA | RADEON_COMP_ARG_A +}; + +static GLuint radeon_previous_alpha[] = +{ + RADEON_ALPHA_ARG_A_CURRENT_ALPHA, + RADEON_ALPHA_ARG_A_CURRENT_ALPHA | RADEON_COMP_ARG_A +}; + + +/* Extract the arg from slot A, shift it into the correct argument slot + * and set the corresponding complement bit. + */ +#define RADEON_COLOR_ARG( n, arg ) \ +do { \ + color_combine |= \ + ((color_arg[n] & RADEON_COLOR_ARG_MASK) \ + << RADEON_COLOR_ARG_##arg##_SHIFT); \ + color_combine |= \ + ((color_arg[n] >> RADEON_COMP_ARG_SHIFT) \ + << RADEON_COMP_ARG_##arg##_SHIFT); \ +} while (0) + +#define RADEON_ALPHA_ARG( n, arg ) \ +do { \ + alpha_combine |= \ + ((alpha_arg[n] & RADEON_ALPHA_ARG_MASK) \ + << RADEON_ALPHA_ARG_##arg##_SHIFT); \ + alpha_combine |= \ + ((alpha_arg[n] >> RADEON_COMP_ARG_SHIFT) \ + << RADEON_COMP_ARG_##arg##_SHIFT); \ +} while (0) + + +/* ================================================================ + * Texture unit state management + */ + +static void radeonUpdateTextureEnv( GLcontext *ctx, int unit ) +{ + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + int source = rmesa->tmu_source[unit]; + struct gl_texture_object *tObj; + struct gl_texture_unit *texUnit; + GLuint enabled; + GLuint color_combine, alpha_combine; + GLuint color_arg[3], alpha_arg[3]; + GLuint i, numColorArgs = 0, numAlphaArgs = 0; + GLuint op; + + if ( RADEON_DEBUG & DEBUG_VERBOSE_MSG ) { + fprintf( stderr, "%s( %p, %d )\n", + __FUNCTION__, ctx, unit ); + } + + enabled = (ctx->Texture.ReallyEnabled >> (source * 4)) & TEXTURE0_ANY; + if ( enabled != TEXTURE0_2D && enabled != TEXTURE0_1D ) + return; + + /* Only update the hardware texture state if the texture is current, + * complete and enabled. + */ + texUnit = &ctx->Texture.Unit[source]; + tObj = texUnit->Current; + if ( !tObj || !tObj->Complete ) + return; + + if ( ( tObj != texUnit->CurrentD[2] ) && + ( tObj != texUnit->CurrentD[1] ) ) + return; + + /* Set the texture environment state. Isn't this nice and clean? + * The Radeon will automagically set the texture alpha to 0xff when + * the texture format does not include an alpha component. This + * reduces the amount of special-casing we have to do, alpha-only + * textures being a notable exception. + */ + switch ( texUnit->EnvMode ) { + case GL_REPLACE: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_RGB: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + color_combine = radeon_color_combine[unit][RADEON_REPLACE]; + alpha_combine = radeon_alpha_combine[unit][RADEON_REPLACE]; + break; + case GL_ALPHA: + color_combine = radeon_color_combine[unit][RADEON_DISABLE]; + alpha_combine = radeon_alpha_combine[unit][RADEON_REPLACE]; + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_MODULATE: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_RGB: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + color_combine = radeon_color_combine[unit][RADEON_MODULATE]; + alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; + break; + case GL_ALPHA: + color_combine = radeon_color_combine[unit][RADEON_DISABLE]; + alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_DECAL: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_RGB: + color_combine = radeon_color_combine[unit][RADEON_DECAL]; + alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE]; + break; + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + color_combine = radeon_color_combine[unit][RADEON_DISABLE]; + alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE]; + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_BLEND: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_RGB: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + color_combine = radeon_color_combine[unit][RADEON_BLEND]; + alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; + break; + case GL_ALPHA: + color_combine = radeon_color_combine[unit][RADEON_DISABLE]; + alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; + break; + case GL_INTENSITY: + color_combine = radeon_color_combine[unit][RADEON_BLEND]; + alpha_combine = radeon_alpha_combine[unit][RADEON_BLEND]; + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_ADD: + switch ( tObj->Image[0]->Format ) { + case GL_RGBA: + case GL_RGB: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + color_combine = radeon_color_combine[unit][RADEON_ADD]; + alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; + break; + case GL_ALPHA: + color_combine = radeon_color_combine[unit][RADEON_DISABLE]; + alpha_combine = radeon_alpha_combine[unit][RADEON_MODULATE]; + break; + case GL_INTENSITY: + color_combine = radeon_color_combine[unit][RADEON_ADD]; + alpha_combine = radeon_alpha_combine[unit][RADEON_ADD]; + break; + case GL_COLOR_INDEX: + default: + return; + } + break; + + case GL_COMBINE_EXT: + /* Step 0: + * Calculate how many arguments we need to process. + */ + switch ( texUnit->CombineModeRGB ) { + case GL_REPLACE: + numColorArgs = 1; + break; + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED_EXT: + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + numColorArgs = 2; + break; + case GL_INTERPOLATE_EXT: + numColorArgs = 3; + break; + default: + return; + } + + switch ( texUnit->CombineModeA ) { + case GL_REPLACE: + numAlphaArgs = 1; + break; + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED_EXT: + numAlphaArgs = 2; + break; + case GL_INTERPOLATE_EXT: + numAlphaArgs = 3; + break; + default: + return; + } + + /* Step 1: + * Extract the color and alpha combine function arguments. + */ + for ( i = 0 ; i < numColorArgs ; i++ ) { + op = texUnit->CombineOperandRGB[i] - GL_SRC_COLOR; + switch ( texUnit->CombineSourceRGB[i] ) { + case GL_TEXTURE: + color_arg[i] = radeon_texture_color[op][unit]; + break; + case GL_CONSTANT_EXT: + color_arg[i] = radeon_tfactor_color[op]; + break; + case GL_PRIMARY_COLOR_EXT: + color_arg[i] = radeon_primary_color[op]; + break; + case GL_PREVIOUS_EXT: + color_arg[i] = radeon_previous_color[op]; + break; + default: + return; + } + } + + for ( i = 0 ; i < numAlphaArgs ; i++ ) { + op = texUnit->CombineOperandA[i] - GL_SRC_ALPHA; + switch ( texUnit->CombineSourceA[i] ) { + case GL_TEXTURE: + alpha_arg[i] = radeon_texture_alpha[op][unit]; + break; + case GL_CONSTANT_EXT: + alpha_arg[i] = radeon_tfactor_alpha[op]; + break; + case GL_PRIMARY_COLOR_EXT: + alpha_arg[i] = radeon_primary_alpha[op]; + break; + case GL_PREVIOUS_EXT: + alpha_arg[i] = radeon_previous_alpha[op]; + break; + default: + return; + } + } + + /* Step 2: + * Build up the color and alpha combine functions. + */ + switch ( texUnit->CombineModeRGB ) { + case GL_REPLACE: + color_combine = (RADEON_COLOR_ARG_A_ZERO | + RADEON_COLOR_ARG_B_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_CLAMP_TX); + RADEON_COLOR_ARG( 0, C ); + break; + case GL_MODULATE: + color_combine = (RADEON_COLOR_ARG_C_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_CLAMP_TX); + RADEON_COLOR_ARG( 0, A ); + RADEON_COLOR_ARG( 1, B ); + break; + case GL_ADD: + color_combine = (RADEON_COLOR_ARG_B_ZERO | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADD | + RADEON_CLAMP_TX); + RADEON_COLOR_ARG( 0, A ); + RADEON_COLOR_ARG( 1, C ); + break; + case GL_ADD_SIGNED_EXT: + color_combine = (RADEON_COLOR_ARG_B_ZERO | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADDSIGNED | + RADEON_CLAMP_TX); + RADEON_COLOR_ARG( 0, A ); + RADEON_COLOR_ARG( 1, C ); + break; + case GL_INTERPOLATE_EXT: + color_combine = (RADEON_BLEND_CTL_BLEND | + RADEON_CLAMP_TX); + RADEON_COLOR_ARG( 0, B ); + RADEON_COLOR_ARG( 1, A ); + RADEON_COLOR_ARG( 2, C ); + break; + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + color_combine = (RADEON_COLOR_ARG_C_ZERO | + RADEON_BLEND_CTL_DOT3 | + RADEON_CLAMP_TX); + RADEON_COLOR_ARG( 0, A ); + RADEON_COLOR_ARG( 1, B ); + break; + default: + return; + } + + switch ( texUnit->CombineModeA ) { + case GL_REPLACE: + alpha_combine = (RADEON_ALPHA_ARG_A_ZERO | + RADEON_ALPHA_ARG_B_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_CLAMP_TX); + RADEON_ALPHA_ARG( 0, C ); + break; + case GL_MODULATE: + alpha_combine = (RADEON_ALPHA_ARG_C_ZERO | + RADEON_BLEND_CTL_ADD | + RADEON_CLAMP_TX); + RADEON_ALPHA_ARG( 0, A ); + RADEON_ALPHA_ARG( 1, B ); + break; + case GL_ADD: + alpha_combine = (RADEON_ALPHA_ARG_B_ZERO | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADD | + RADEON_CLAMP_TX); + RADEON_ALPHA_ARG( 0, A ); + RADEON_ALPHA_ARG( 1, C ); + break; + case GL_ADD_SIGNED_EXT: + alpha_combine = (RADEON_ALPHA_ARG_B_ZERO | + RADEON_COMP_ARG_B | + RADEON_BLEND_CTL_ADDSIGNED | + RADEON_CLAMP_TX); + RADEON_ALPHA_ARG( 0, A ); + RADEON_ALPHA_ARG( 1, C ); + break; + case GL_INTERPOLATE_EXT: + alpha_combine = (RADEON_BLEND_CTL_BLEND | + RADEON_CLAMP_TX); + RADEON_ALPHA_ARG( 0, B ); + RADEON_ALPHA_ARG( 1, A ); + RADEON_ALPHA_ARG( 2, C ); + break; + default: + return; + } + + if ( texUnit->CombineModeRGB == GL_DOT3_RGB_EXT ) { + alpha_combine |= RADEON_DOT_ALPHA_DONT_REPLICATE; + } + + /* Step 3: + * Apply the scale factor. The EXT extension has a somewhat + * unnecessary restriction that the scale must be 4x. The ARB + * extension will likely drop this and we can just apply the + * scale factors regardless. + */ + if ( texUnit->CombineModeRGB != GL_DOT3_RGB_EXT && + texUnit->CombineModeRGB != GL_DOT3_RGBA_EXT ) { + color_combine |= (texUnit->CombineScaleShiftRGB << 21); + alpha_combine |= (texUnit->CombineScaleShiftA << 21); + } else { + color_combine |= RADEON_SCALE_4X; + alpha_combine |= RADEON_SCALE_4X; + } + + /* All done! + */ + break; + + default: + return; + } + + rmesa->color_combine[source] = color_combine; + rmesa->alpha_combine[source] = alpha_combine; +} + +static void radeonUpdateTextureObject( GLcontext *ctx, int unit ) +{ + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + int source = rmesa->tmu_source[unit]; + struct gl_texture_object *tObj; + radeonTexObjPtr t; + GLuint enabled; + + if ( RADEON_DEBUG & DEBUG_VERBOSE_MSG ) { + fprintf( stderr, "%s( %p, %d )\n", + __FUNCTION__, ctx, unit ); + } + + enabled = (ctx->Texture.ReallyEnabled >> (source * 4)) & TEXTURE0_ANY; + if ( enabled != TEXTURE0_2D && enabled != TEXTURE0_1D ) { + if ( enabled ) + rmesa->Fallback |= RADEON_FALLBACK_TEXTURE; + return; + } + + /* Only update the hardware texture state if the texture is current, + * complete and enabled. + */ + tObj = ctx->Texture.Unit[source].Current; + if ( !tObj || !tObj->Complete ) + return; + + if ( ( tObj != ctx->Texture.Unit[source].CurrentD[2] ) && + ( tObj != ctx->Texture.Unit[source].CurrentD[1] ) ) + return; + + /* We definately have a valid texture now */ + t = tObj->DriverData; + + /* Force the texture unit state to be loaded into the hardware */ + rmesa->dirty |= RADEON_UPLOAD_CONTEXT | (RADEON_UPLOAD_TEX0 << unit); + + /* Force any texture images to be loaded into the hardware */ + if ( t->dirty_images ) { + if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, " t->dirty_images = 0x%x\n", t->dirty_images ); + } + radeonSetTexImages( rmesa, tObj ); + rmesa->dirty |= (RADEON_UPLOAD_TEX0IMAGES << unit); + } + + if ( t->memBlock ) + radeonUpdateTexLRU( rmesa, t ); + + switch ( unit ) { + case 0: + rmesa->setup.pp_cntl |= (RADEON_TEX_0_ENABLE | + RADEON_TEX_BLEND_0_ENABLE); + break; + case 1: + rmesa->setup.pp_cntl |= (RADEON_TEX_1_ENABLE | + RADEON_TEX_BLEND_1_ENABLE); + break; + } +} + +void radeonUpdateTextureState( GLcontext *ctx ) +{ + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + + if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %p ) en=0x%x\n", + __FUNCTION__, ctx, ctx->Texture.ReallyEnabled ); + } + + /* Clear any texturing fallbacks */ + rmesa->Fallback &= ~RADEON_FALLBACK_TEXTURE; + + /* Disable all texturing until it is known to be good */ + rmesa->setup.pp_cntl &= ~(RADEON_TEX_ENABLE_MASK | + RADEON_TEX_BLEND_ENABLE_MASK); + + radeonUpdateTextureObject( ctx, 0 ); + radeonUpdateTextureEnv( ctx, 0 ); + + if ( rmesa->multitex ) { + radeonUpdateTextureObject( ctx, 1 ); + radeonUpdateTextureEnv( ctx, 1 ); + } + + rmesa->dirty |= RADEON_UPLOAD_CONTEXT; +} diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tris.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_tris.c index bbc766129..4555bce6d 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tris.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tris.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tris.c,v 1.1 2001/01/08 01:07:28 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tris.c,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -55,6 +55,13 @@ do { \ *(GLuint *)(to) = *(GLuint *)(from); \ } while (0) +#define RADEON_COLOR3( to, from ) \ +do { \ + (to)[0] = (from)[2]; \ + (to)[1] = (from)[1]; \ + (to)[2] = (from)[0]; \ +} while (0) + static void radeon_null_quad( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv ) @@ -162,6 +169,10 @@ void radeonDDChooseRenderState( GLcontext *ctx ) if ( rmesa->Fallback ) { rmesa->RenderIndex = RADEON_FALLBACK_BIT; + /* fixes vorder.c failure: */ + if (flags & DD_TRI_LIGHT_TWOSIDE) { + rmesa->IndirectTriangles = DD_TRI_LIGHT_TWOSIDE; + } return; } @@ -200,6 +211,11 @@ void radeonDDChooseRenderState( GLcontext *ctx ) rmesa->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE); } + + /* fixes vorder.c failure: */ + if (flags & DD_TRI_LIGHT_TWOSIDE) { + rmesa->IndirectTriangles |= DD_TRI_LIGHT_TWOSIDE; + } } if ( 0 ) { diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tris.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_tris.h index 57fadaeca..00c07e184 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tris.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tris.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tris.h,v 1.1 2001/01/08 01:07:28 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tris.h,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -168,53 +168,76 @@ static __inline void radeon_draw_line( radeonContextPtr rmesa, #if 1 GLuint vertsize = rmesa->vertsize; CARD32 *vb = radeonAllocVerticesInline( rmesa, 6 ); - GLfloat dx, dy, ix, iy; + GLfloat hw, dx, dy, ix, iy; GLuint j; + GLfloat x0 = tmp0->v.x; + GLfloat y0 = tmp0->v.y; + GLfloat x1 = tmp1->v.x; + GLfloat y1 = tmp1->v.y; + + hw = 0.5F * width; + if (hw > 0.1F && hw < 0.5F) { + hw = 0.5F; + } + /* adjust vertices depending on line direction */ dx = tmp0->v.x - tmp1->v.x; dy = tmp0->v.y - tmp1->v.y; - - ix = width * .5; iy = 0; - - if ((ix<.5) && (ix>0.1)) ix = .5; /* I want to see lines with width - 0.5 also */ - if (dx * dx > dy * dy) { - iy = ix; ix = 0; + /* X-major line */ + ix = 0.0F; + iy = hw; + if (x1 < x0) { + x0 += 0.5F; + x1 += 0.5F; + } + y0 -= 0.5F; + y1 -= 0.5F; + } + else { + /* Y-major line */ + ix = hw; + iy = 0.0F; + if (y1 > y0) { + y0 -= 0.5F; + y1 -= 0.5F; + } + x0 += 0.5F; + x1 += 0.5F; } - *(float *)&vb[0] = tmp0->v.x - ix; - *(float *)&vb[1] = tmp0->v.y - iy; + *(float *)&vb[0] = x0 - ix; + *(float *)&vb[1] = y0 - iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp0->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp1->v.x + ix; - *(float *)&vb[1] = tmp1->v.y + iy; + *(float *)&vb[0] = x1 + ix; + *(float *)&vb[1] = y1 + iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp1->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp0->v.x + ix; - *(float *)&vb[1] = tmp0->v.y + iy; + *(float *)&vb[0] = x0 + ix; + *(float *)&vb[1] = y0 + iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp0->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp0->v.x - ix; - *(float *)&vb[1] = tmp0->v.y - iy; + *(float *)&vb[0] = x0 - ix; + *(float *)&vb[1] = y0 - iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp0->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp1->v.x - ix; - *(float *)&vb[1] = tmp1->v.y - iy; + *(float *)&vb[0] = x1 - ix; + *(float *)&vb[1] = y1 - iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp1->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp1->v.x + ix; - *(float *)&vb[1] = tmp1->v.y + iy; + *(float *)&vb[0] = x1 + ix; + *(float *)&vb[1] = y1 + iy; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp1->ui[j]; #else @@ -254,39 +277,41 @@ static __inline void radeon_draw_point( radeonContextPtr rmesa, GLuint vertsize = rmesa->vertsize; CARD32 *vb = radeonAllocVerticesInline( rmesa, 6 ); GLuint j; + const float x = tmp->v.x + PNT_X_OFFSET; + const float y = tmp->v.y + PNT_Y_OFFSET; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x + sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x + sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y + sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y + sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; vb += vertsize; - *(float *)&vb[0] = tmp->v.x - sz; - *(float *)&vb[1] = tmp->v.y - sz; + *(float *)&vb[0] = x - sz; + *(float *)&vb[1] = y - sz; for (j = 2 ; j < vertsize ; j++) vb[j] = tmp->ui[j]; diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tritmp.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_tritmp.h index ffa0d4746..690e74bd2 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tritmp.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tritmp.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tritmp.h,v 1.1 2001/01/08 01:07:28 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tritmp.h,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -247,7 +247,8 @@ static void TAG(line)( GLcontext *ctx, GLfloat z[2]; #endif #if (IND & RADEON_TWOSIDE_BIT) - int c[2]; + GLuint c[2]; + GLuint s[2]; #endif v[0] = &verts[e0]; @@ -256,17 +257,24 @@ static void TAG(line)( GLcontext *ctx, #if (IND & RADEON_TWOSIDE_BIT) c[0] = v[0]->ui[4]; c[1] = v[1]->ui[4]; + s[0] = v[0]->ui[5]; + s[1] = v[1]->ui[5]; #endif #if (IND & RADEON_TWOSIDE_BIT) { GLubyte (*vbcolor)[4] = ctx->VB->ColorPtr->data; + GLubyte (*vbspec)[4] = ctx->VB->Specular; if ( IND & RADEON_FLAT_BIT ) { RADEON_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); v[1]->ui[4] = v[0]->ui[4]; + RADEON_COLOR3( (char *)&v[0]->ui[5], vbspec[pv] ); + v[1]->ui[5] = v[0]->ui[5]; } else { RADEON_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); RADEON_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + RADEON_COLOR3( (char *)&v[0]->ui[5], vbspec[e0] ); + RADEON_COLOR3( (char *)&v[1]->ui[5], vbspec[e1] ); } } #endif @@ -289,6 +297,8 @@ static void TAG(line)( GLcontext *ctx, #if (IND & RADEON_TWOSIDE_BIT) v[0]->ui[4] = c[0]; v[1]->ui[4] = c[1]; + v[0]->ui[5] = s[0]; + v[1]->ui[5] = s[1]; #endif } @@ -309,7 +319,10 @@ static void TAG(points)( GLcontext *ctx, if ( IND & RADEON_TWOSIDE_BIT ) { GLubyte (*vbcolor)[4] = VB->ColorPtr->data; + GLubyte (*vbspec)[4] = VB->Specular; RADEON_COLOR( (char *)&tmp0.v.color, vbcolor[i] ); + if (vbspec) + RADEON_COLOR3( (char *)&tmp0.v.specular, vbspec[i] ); } if ( IND & RADEON_OFFSET_BIT ) { GLfloat offset = ctx->PointZoffset * rmesa->depth_scale; diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_vb.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_vb.c index bdf19b2d6..12461373b 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_vb.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_vb.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vb.c,v 1.2 2001/01/11 03:36:55 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vb.c,v 1.4 2001/03/25 05:32:00 tsi Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -120,8 +120,8 @@ do { \ #define COORD \ do { \ GLfloat *win = VB->Win.data[i]; \ - v->v.x = win[0]; \ - v->v.y = - win[1]; \ + v->v.x = win[0] + SUBPIXEL_X; \ + v->v.y = - win[1] + SUBPIXEL_Y; \ v->v.z = win[2]; \ v->v.rhw = win[3]; \ } while (0) \ diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c index 1f24b8409..8a02e3275 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c,v 1.2 2001/01/23 18:14:39 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c,v 1.3 2001/03/21 16:14:25 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -61,33 +61,31 @@ GLboolean XMesaInitDriver( __DRIscreenPrivate *sPriv ) /* Check the DRI version */ { int major, minor, patch; - if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { - if (major != 3 || minor != 1 || patch < 0) { - char msg[1000]; - sprintf(msg, "RADEON DRI driver expected DRI version 3.1.x but got version %d.%d.%d", major, minor, patch); - __driMesaMessage(msg); + if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) { + if ( major != 4 || minor < 0 ) { + char msg[128]; + sprintf( msg, "RADEON DRI driver expected DRI version 4.0.x but got version %d.%d.%d", major, minor, patch ); + __driMesaMessage( msg ); return GL_FALSE; } } } /* Check that the DDX driver version is compatible */ - if (sPriv->ddxMajor != 4 || - sPriv->ddxMinor != 0 || - sPriv->ddxPatch < 0) { - char msg[1000]; - sprintf(msg, "RADEON DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); - __driMesaMessage(msg); + if ( sPriv->ddxMajor != 4 || + sPriv->ddxMinor < 0 ) { + char msg[128]; + sprintf( msg, "RADEON DRI driver expected DDX driver version 4.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch ); + __driMesaMessage( msg ); return GL_FALSE; } /* Check that the DRM driver version is compatible */ - if (sPriv->drmMajor != 1 || - sPriv->drmMinor != 0 || - sPriv->drmPatch < 0) { - char msg[1000]; - sprintf(msg, "RADEON DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); - __driMesaMessage(msg); + if ( sPriv->drmMajor != 1 || + sPriv->drmMinor < 0 ) { + char msg[128]; + sprintf( msg, "RADEON DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); + __driMesaMessage( msg ); return GL_FALSE; } diff --git a/xc/lib/GL/mesa/src/drv/sis/Imakefile b/xc/lib/GL/mesa/src/drv/sis/Imakefile index 505d18831..11d0966b3 100644 --- a/xc/lib/GL/mesa/src/drv/sis/Imakefile +++ b/xc/lib/GL/mesa/src/drv/sis/Imakefile @@ -1,349 +1,45 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile,v 1.12 2000/12/12 23:24:28 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile,v 1.16 2001/04/03 02:29:36 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -XCOMM SIS_DEFINES = -DSIS_USE_HW_CULL -DSIS_USE_FASTPATH -SIS_DEFINES = -DSIS_USE_HW_CULL - -XCOMM DEBUG_DEFINES = -DDEBUG_LOCKING -XCOMM DEBUG_DEFINES = -DSIS_DEBUG - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../Imakefile.inc" #ifdef i386Architecture -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif -#if MesaUseKatmai - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) -#endif - -#if BuildXF86DRI - DRI_DEFINES = GlxDefines $(SIS_DEFINES) - DRI_INCLUDES = -I../../../../dri -I../../../../glx \ - -I../../../dri \ - -I$(TOP)/include -I$(TOP)/include/GL \ - -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \ - -I$(XF86DRIVERSRC)/sis \ - -I../../../include -I../.. -I../../X \ - -I../common/ +#include "../../X86/Imakefile.inc" #endif -MESA_INCLUDES = -I. -I.. -I../../include \ - -I../../../../dri/drm - -LinkSourceFile(xdriP.h, ../../X) - -#if 0 - DEBUG_SRC = sis_debug.c - DEBUG_OBJ = sis_debug.o - DEBUG_DEFINES += -DSIS_DUMP -#endif +XCOMM SIS_DEFINES = -DSIS_USE_HW_CULL -DSIS_USE_FASTPATH +SIS_DEFINES = -DSIS_USE_HW_CULL -#if 0 - STEREO_SRC = sis_stereo.c - STEREO_OBJ = sis_stereo.o - STEREO_DEFINES = -DSIS_STEREO=1 -#else - STEREO_DEFINES = -DSIS_STEREO=0 -#endif +XCOMM DEBUG_DEFINES = -DDEBUG_LOCKING +XCOMM DEBUG_DEFINES = -DSIS_DEBUG - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) \ + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) \ $(DEBUG_DEFINES) $(STEREO_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) \ - -I./misc \ - -I$(SERVERSRC)/hw/xfree86/drivers/sis - - SISSRCS = sis_render.c \ - sis_mesa.c \ - sis_ctx.c \ - sis_alloc.c \ - sis_fog.c \ - sis_clear.c \ - sis_stencil.c \ - sis_texture.c \ - sis_xwin.c \ - sis_xmesa.c \ - sis_span.c \ - sis_fastpath.c \ - $(DEBUG_SRC) \ - $(STEREO_SRC) - - SISOBJS = sis_render.o \ - sis_mesa.o \ - sis_ctx.o \ - sis_alloc.o \ - sis_fog.o \ - sis_clear.o \ - sis_stencil.o \ - sis_texture.o \ - sis_xwin.o \ - sis_xmesa.o \ - sis_span.o \ - sis_fastpath.o \ - $(DEBUG_OBJ) \ - $(STEREO_OBJ) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) - DRISRCS = ../../../dri/dri_mesa.c \ - ../../../../dri/dri_tmm.c + DRIOBJS = $(GLXLIBSRC)/mesa/dri/dri_mesa.o \ + $(GLXLIBSRC)/dri/dri_tmm.o - DRIOBJS = ../../../dri/dri_mesa.o \ - ../../../../dri/dri_tmm.o - - DRMSRCS = ../../../../dri/drm/xf86drm.c \ - ../../../../dri/drm/xf86drmHash.c \ - ../../../../dri/drm/xf86drmRandom.c \ - ../../../../dri/drm/xf86drmSL.c - - DRMOBJS = ../../../../dri/drm/xf86drm.o \ - ../../../../dri/drm/xf86drmHash.o \ - ../../../../dri/drm/xf86drmRandom.o \ - ../../../../dri/drm/xf86drmSL.o - - MESASRCS = ../../aatriangle.c \ - ../../accum.c \ - ../../alpha.c \ - ../../alphabuf.c \ - ../../attrib.c \ - ../../bbox.c \ - ../../bitmap.c \ - ../../blend.c \ - ../../buffers.c \ - ../../clip.c \ - ../../colortab.c \ - ../../config.c \ - ../../context.c \ - ../../copypix.c \ - ../../cva.c \ - ../../debug_xform.c \ - ../../depth.c \ - ../../dlist.c \ - ../../drawpix.c \ - ../../enable.c \ - ../../enums.c \ - ../../eval.c \ - ../../extensions.c \ - ../../feedback.c \ - ../../fog.c \ - ../../get.c \ - ../../glapi.c \ - ../../glapinoop.c \ - ../../glthread.c \ - ../../hash.c \ - ../../image.c \ - ../../imaging.c \ - ../../light.c \ - ../../lines.c \ - ../../logic.c \ - ../../masking.c \ - ../../matrix.c \ - ../../mem.c \ - ../../mmath.c \ - ../../pb.c \ - ../../pipeline.c \ - ../../pixel.c \ - ../../pixeltex.c \ - ../../points.c \ - ../../polygon.c \ - ../../quads.c \ - ../../rastpos.c \ - ../../readpix.c \ - ../../rect.c \ - ../../scissor.c \ - ../../shade.c \ - ../../span.c \ - ../../stages.c \ - ../../state.c \ - ../../stencil.c \ - ../../teximage.c \ - ../../texobj.c \ - ../../texstate.c \ - ../../texture.c \ - ../../texutil.c \ - ../../translate.c \ - ../../triangle.c \ - ../../varray.c \ - ../../vb.c \ - ../../vbcull.c \ - ../../vbfill.c \ - ../../vbindirect.c \ - ../../vbrender.c \ - ../../vbxform.c \ - ../../vector.c \ - ../../vertices.c \ - ../../winpos.c \ - ../../xform.c \ - ../../zoom.c - - MESAOBJS = ../../aatriangle.o \ - ../../accum.o \ - ../../alpha.o \ - ../../alphabuf.o \ - ../../attrib.o \ - ../../bbox.o \ - ../../bitmap.o \ - ../../blend.o \ - ../../buffers.o \ - ../../clip.o \ - ../../colortab.o \ - ../../config.o \ - ../../context.o \ - ../../copypix.o \ - ../../cva.o \ - ../../debug_xform.o \ - ../../depth.o \ - ../../dlist.o \ - ../../drawpix.o \ - ../../enable.o \ - ../../enums.o \ - ../../eval.o \ - ../../extensions.o \ - ../../feedback.o \ - ../../fog.o \ - ../../get.o \ - ../../hash.o \ - ../../hint.o \ - ../../image.o \ - ../../imaging.o \ - ../../light.o \ - ../../lines.o \ - ../../logic.o \ - ../../masking.o \ - ../../matrix.o \ - ../../mem.o \ - ../../mmath.o \ - ../../pb.o \ - ../../pipeline.o \ - ../../pixel.o \ - ../../pixeltex.o \ - ../../points.o \ - ../../polygon.o \ - ../../quads.o \ - ../../rastpos.o \ - ../../readpix.o \ - ../../rect.o \ - ../../scissor.o \ - ../../shade.o \ - ../../span.o \ - ../../stages.o \ - ../../state.o \ - ../../stencil.o \ - ../../teximage.o \ - ../../texobj.o \ - ../../texstate.o \ - ../../texture.o \ - ../../texutil.o \ - ../../translate.o \ - ../../triangle.o \ - ../../varray.o \ - ../../vb.o \ - ../../vbcull.o \ - ../../vbfill.o \ - ../../vbindirect.o \ - ../../vbrender.o \ - ../../vbxform.o \ - ../../vector.o \ - ../../vertices.o \ - ../../winpos.o \ - ../../xform.o \ - ../../zoom.o - -#ifdef i386Architecture - X86_SRCS = ../../X86/common_x86.c \ - ../../X86/common_x86_asm.S \ - ../../X86/x86.c \ - ../../X86/x86_cliptest.S \ - ../../X86/x86_vertex.S \ - ../../X86/x86_xform_masked2.S \ - ../../X86/x86_xform_masked3.S \ - ../../X86/x86_xform_masked4.S \ - ../../X86/x86_xform_raw2.S \ - ../../X86/x86_xform_raw3.S \ - ../../X86/x86_xform_raw4.S - - X86_OBJS = ../../X86/common_x86.o \ - ../../X86/common_x86_asm.o \ - ../../X86/x86.o \ - ../../X86/x86_cliptest.o \ - ../../X86/x86_vertex.o \ - ../../X86/x86_xform_masked2.o \ - ../../X86/x86_xform_masked3.o \ - ../../X86/x86_xform_masked4.o \ - ../../X86/x86_xform_raw2.o \ - ../../X86/x86_xform_raw3.o \ - ../../X86/x86_xform_raw4.o - -#if MesaUseMMX - MMX_SRCS = ../../X86/mmx_blend.S - - MMX_OBJS = ../../X86/mmx_blend.o -#endif - -#if MesaUse3DNow - 3DNOW_SRCS = ../../X86/3dnow.c \ - ../../X86/3dnow_norm_raw.S \ - ../../X86/3dnow_vertex.S \ - ../../X86/3dnow_xform_masked1.S \ - ../../X86/3dnow_xform_masked2.S \ - ../../X86/3dnow_xform_masked3.S \ - ../../X86/3dnow_xform_masked4.S \ - ../../X86/3dnow_xform_raw1.S \ - ../../X86/3dnow_xform_raw2.S \ - ../../X86/3dnow_xform_raw3.S \ - ../../X86/3dnow_xform_raw4.S - - 3DNOW_OBJS = ../../X86/3dnow.o \ - ../../X86/3dnow_norm_raw.o \ - ../../X86/3dnow_vertex.o \ - ../../X86/3dnow_xform_masked1.o \ - ../../X86/3dnow_xform_masked2.o \ - ../../X86/3dnow_xform_masked3.o \ - ../../X86/3dnow_xform_masked4.o \ - ../../X86/3dnow_xform_raw1.o \ - ../../X86/3dnow_xform_raw2.o \ - ../../X86/3dnow_xform_raw3.o \ - ../../X86/3dnow_xform_raw4.o -#endif - -#if MesaUseKatmai - KATMAI_SRCS = ../../X86/katmai.c \ - ../../X86/katmai_norm_raw.S \ - ../../X86/katmai_vertex.S \ - ../../X86/katmai_xform_masked1.S \ - ../../X86/katmai_xform_masked2.S \ - ../../X86/katmai_xform_masked3.S \ - ../../X86/katmai_xform_masked4.S \ - ../../X86/katmai_xform_raw1.S \ - ../../X86/katmai_xform_raw2.S \ - ../../X86/katmai_xform_raw3.S \ - ../../X86/katmai_xform_raw4.S - - KATMAI_OBJS = ../../X86/katmai.o \ - ../../X86/katmai_norm_raw.o \ - ../../X86/katmai_vertex.o \ - ../../X86/katmai_xform_masked1.o \ - ../../X86/katmai_xform_masked2.o \ - ../../X86/katmai_xform_masked3.o \ - ../../X86/katmai_xform_masked4.o \ - ../../X86/katmai_xform_raw1.o \ - ../../X86/katmai_xform_raw2.o \ - ../../X86/katmai_xform_raw3.o \ - ../../X86/katmai_xform_raw4.o -#endif -#endif + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o #ifdef GlxSoProf LOSRCS = ../../../../lowpc.c @@ -353,46 +49,30 @@ LinkSourceFile(xdriP.h, ../../X) HIOBJS = ../../../../highpc.o #endif - ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) - - SRCS = $(LOSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) \ - $(ASMSRCS) $(SISSRCS) $(HISRCS) - OBJS = $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) \ - $(ASMOBJS) $(SISOBJS) $(HIOBJS) - -REQUIREDLIBS += MathLibrary -#if !GlxBuiltInSIS -REQUIREDLIBS += -L../../../.. -lGL -L../../../../../X11 -lX11 -#endif - + SRCS = $(SISSRCS) + OBJS = $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \ + $(MESA_ASM_OBJS) $(SISOBJS) $(HIOBJS) -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif +REQUIREDLIBS = MathLibrary $(LDPRELIB) $(GLXLIB) #include <Library.tmpl> LibraryObjectRule() -SubdirLibraryRule($(OBJS)) +SubdirLibraryRule($(SISOBJS)) NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = sis_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +SharedDepModuleTarget($(LIBNAME),DONE,$(OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #ifdef GlxSoProf SOPROF_LIBNAME = _sis_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE,$(OBJS)) InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) #endif #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc b/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc new file mode 100644 index 000000000..26dfa5d46 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc @@ -0,0 +1,149 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile.inc,v 1.1 2001/03/23 19:18:43 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvSisBuildDir +#define MesaDrvSisBuildDir /**/ +#endif +MESADRVSISBUILDDIR = MesaDrvSisBuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines $(SIS_DEFINES) + DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/mesa/dri \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86OSSRC) \ + -I$(XF86DRIVERSRC)/sis \ + -I$(GLXLIBSRC)/dri/drm \ + -I$(GLXLIBSRC)/mesa/src/X +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESASRCDIR)/include \ + -I$(MESADRVSRCDIR)/common -I$(MESADRVSRCDIR)/sis + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + +#if 0 + DEBUG_SRC = $(MESADRVSISBUILDDIR)sis_debug.c + DEBUG_OBJ = $(MESADRVSISBUILDDIR)sis_debug.o + DEBUG_UOBJ = $(MESADRVSISBUILDDIR)unshared/sis_debug.o + DEBUG_DOBJ = $(MESADRVSISBUILDDIR)debugger/sis_debug.o + DEBUG_POBJ = $(MESADRVSISBUILDDIR)profiled/sis_debug.o + DEBUG_DEFINES += -DSIS_DUMP +#ifdef NeedToLinkMesaSrc +LinkSourceFile(sis_debug.c, $(MESADRVSRCDIR)/sis) +#endif +#endif + +#if 0 + STEREO_SRC = $(MESADRVSISBUILDDIR)sis_stereo.c + STEREO_OBJ = $(MESADRVSISBUILDDIR)sis_stereo.o + STEREO_UOBJ = $(MESADRVSISBUILDDIR)unshared/sis_stereo.o + STEREO_DOBJ = $(MESADRVSISBUILDDIR)debugger/sis_stereo.o + STEREO_POBJ = $(MESADRVSISBUILDDIR)profiled/sis_stereo.o + STEREO_DEFINES = -DSIS_STEREO=1 +#ifdef NeedToLinkMesaSrc +LinkSourceFile(sis_stereo.c, $(MESADRVSRCDIR)/sis) +#endif +#else + STEREO_DEFINES = -DSIS_STEREO=0 +#endif + + SISSRCS = $(MESADRVSISBUILDDIR)sis_render.c \ + $(MESADRVSISBUILDDIR)sis_mesa.c \ + $(MESADRVSISBUILDDIR)sis_ctx.c \ + $(MESADRVSISBUILDDIR)sis_alloc.c \ + $(MESADRVSISBUILDDIR)sis_fog.c \ + $(MESADRVSISBUILDDIR)sis_clear.c \ + $(MESADRVSISBUILDDIR)sis_stencil.c \ + $(MESADRVSISBUILDDIR)sis_texture.c \ + $(MESADRVSISBUILDDIR)sis_xwin.c \ + $(MESADRVSISBUILDDIR)sis_xmesa.c \ + $(MESADRVSISBUILDDIR)sis_span.c \ + $(MESADRVSISBUILDDIR)sis_fastpath.c \ + $(DEBUG_SRC) \ + $(STEREO_SRC) + + SISOBJS = $(MESADRVSISBUILDDIR)sis_render.o \ + $(MESADRVSISBUILDDIR)sis_mesa.o \ + $(MESADRVSISBUILDDIR)sis_ctx.o \ + $(MESADRVSISBUILDDIR)sis_alloc.o \ + $(MESADRVSISBUILDDIR)sis_fog.o \ + $(MESADRVSISBUILDDIR)sis_clear.o \ + $(MESADRVSISBUILDDIR)sis_stencil.o \ + $(MESADRVSISBUILDDIR)sis_texture.o \ + $(MESADRVSISBUILDDIR)sis_xwin.o \ + $(MESADRVSISBUILDDIR)sis_xmesa.o \ + $(MESADRVSISBUILDDIR)sis_span.o \ + $(MESADRVSISBUILDDIR)sis_fastpath.o \ + $(DEBUG_OBJ) \ + $(STEREO_OBJ) + + SISUOBJS = $(MESADRVSISBUILDDIR)unshared/sis_render.o \ + $(MESADRVSISBUILDDIR)unshared/sis_mesa.o \ + $(MESADRVSISBUILDDIR)unshared/sis_ctx.o \ + $(MESADRVSISBUILDDIR)unshared/sis_alloc.o \ + $(MESADRVSISBUILDDIR)unshared/sis_fog.o \ + $(MESADRVSISBUILDDIR)unshared/sis_clear.o \ + $(MESADRVSISBUILDDIR)unshared/sis_stencil.o \ + $(MESADRVSISBUILDDIR)unshared/sis_texture.o \ + $(MESADRVSISBUILDDIR)unshared/sis_xwin.o \ + $(MESADRVSISBUILDDIR)unshared/sis_xmesa.o \ + $(MESADRVSISBUILDDIR)unshared/sis_span.o \ + $(MESADRVSISBUILDDIR)unshared/sis_fastpath.o \ + $(DEBUG_UOBJ) \ + $(STEREO_UOBJ) + + SISDOBJS = $(MESADRVSISBUILDDIR)debugger/sis_render.o \ + $(MESADRVSISBUILDDIR)debugger/sis_mesa.o \ + $(MESADRVSISBUILDDIR)debugger/sis_ctx.o \ + $(MESADRVSISBUILDDIR)debugger/sis_alloc.o \ + $(MESADRVSISBUILDDIR)debugger/sis_fog.o \ + $(MESADRVSISBUILDDIR)debugger/sis_clear.o \ + $(MESADRVSISBUILDDIR)debugger/sis_stencil.o \ + $(MESADRVSISBUILDDIR)debugger/sis_texture.o \ + $(MESADRVSISBUILDDIR)debugger/sis_xwin.o \ + $(MESADRVSISBUILDDIR)debugger/sis_xmesa.o \ + $(MESADRVSISBUILDDIR)debugger/sis_span.o \ + $(MESADRVSISBUILDDIR)debugger/sis_fastpath.o \ + $(DEBUG_DOBJ) \ + $(STEREO_DOBJ) + + SISPOBJS = $(MESADRVSISBUILDDIR)profiled/sis_render.o \ + $(MESADRVSISBUILDDIR)profiled/sis_mesa.o \ + $(MESADRVSISBUILDDIR)profiled/sis_ctx.o \ + $(MESADRVSISBUILDDIR)profiled/sis_alloc.o \ + $(MESADRVSISBUILDDIR)profiled/sis_fog.o \ + $(MESADRVSISBUILDDIR)profiled/sis_clear.o \ + $(MESADRVSISBUILDDIR)profiled/sis_stencil.o \ + $(MESADRVSISBUILDDIR)profiled/sis_texture.o \ + $(MESADRVSISBUILDDIR)profiled/sis_xwin.o \ + $(MESADRVSISBUILDDIR)profiled/sis_xmesa.o \ + $(MESADRVSISBUILDDIR)profiled/sis_span.o \ + $(MESADRVSISBUILDDIR)profiled/sis_fastpath.o \ + $(DEBUG_POBJ) \ + $(STEREO_POBJ) + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(sis_render.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_mesa.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_ctx.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_alloc.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_fog.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_clear.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_stencil.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_texture.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_xwin.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_xmesa.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_span.c, $(MESADRVSRCDIR)/sis) +LinkSourceFile(sis_fastpath.c, $(MESADRVSRCDIR)/sis) +#endif + 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 70fbd7f64..324175b79 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_span.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_span.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/sis/sis_span.c,v 1.4 2000/09/26 15:56:49 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_span.c,v 1.5 2001/03/21 16:14:26 dawes Exp $ */ /* * Authors: @@ -51,14 +51,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ _y >= miny && _y < maxy) -#define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ - if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ - else { \ - _n1 = _n; \ - _x1 = _x; \ - if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 > maxx) n1 -= (_x1 + n1 - maxx); \ - } +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } #define HW_LOCK() do{}while(0); diff --git a/xc/lib/GL/mesa/src/drv/tdfx/BUGS b/xc/lib/GL/mesa/src/drv/tdfx/BUGS new file mode 100644 index 000000000..b15f6a91e --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/BUGS @@ -0,0 +1,64 @@ +REMOVE THIS FILE BEFORE MERGING WITH TRUNK +------------------------------------------ + +OUTSTANDING BUGS + +demos/reflect - reading back Z on Voodoo3, image offset to right + Fixed in latest Glide. + +Q3 - some polygons drawn as vertical strips, similar to bug that was + seen in demos/fire. Voodoo3 only. May be related to glDepthMask + or glColorMask. + +book/fog - not fogging + Fog in orthograph mode still not implemented. Checking with + 3dfx engineers for ideas. + +Q3 demo crashes after changing display settings + but the full Q3 game version seems OK. + + + +MORE OUTSTANDING BUGS + +private context was NULL! causing immediate failure of any glx prog. cant +reproduce after restarting the X server. putting it down as halluc. + +texture object image was NULL, causing segmentation failure. happens with +prboom. ive put a check in tdfx_texstate.c but this isn't a fix. + +prboom, wall textures near first chainsaw aren't bound properly. sideways +movements causes the wall textures to move with you. prboom busted? + +16bpp mode, quake3, windowed, q3dm1, floor under rocketlauncher bands. it +looks like multitexturing gone wrong. i'll disable a tmu and test. + +sof, polygons appear at wrong x,y,z positions, intermittent, have not yet +found reliable way of reproducing. culling? sometimes polys disappear. + +descent3 is all black in 16bpp mode - FIXED (palette problems) + +smeared pixels in quake3 - FIXED (texture memory overlapped FB) + + + +PERFORMANCE COMPARISON (Brian / Alan) + + V3/16 is Voodoo3 in 16bpp on a P3/500 + V5/16 is Voodoo5 in 16bpp on a P3/600 + V5/32 is Voodoo5 in 32bpp on a P3/600 + V5A/16 is Voodoo5 in 16bpp on an Alpha AXP/600 + V5A/32 is Voodoo5 in 32bpp on an Alpha AXP/600 + + tdfx-2-1-branch tdfx-3-0-0-branch +demo V3/16 V5/16 V5/32 V3/16 V5/16 V5/32 V5A/16 V5A/32 +------------------------------------------------------------------------ +gloss 257 183 174 320 308 177 313 167 +fire 42 39 52 41 +fire (no help) 98 80 50 106 113 73 124 80 +tunnel 61 50 70 58 +tunnel (no help) 167 142 57 138 152 113 171 122 +gears 663 554 540 881 1232 776 1484 830 +teapot 20 21 37 36 +teapot (no help) 22 14 14 24 30 30 43 42 + diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile index 6b3c488ab..7a17ca558 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile +++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile @@ -1,329 +1,39 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.20 2001/02/16 01:26:11 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.24 2001/04/03 02:29:36 dawes Exp $ #include <Threads.tmpl> -#define DoNormalLib NormalLibGlx -#define DoSharedLib SharedLibGlx +#if GlxUseBuiltInDRIDriver +#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) +#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#else +#define DoNormalLib SharedLibGlxWithoutPIC +#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoExtrasLib NO +#define DoDebugLib NO +#define DoProfileLib NO #endif +#include "../common/Imakefile.inc" +#include "Imakefile.inc" +#include "../../Imakefile.inc" #ifdef i386Architecture -#if MesaUseMMX - MMX_DEFS = -DUSE_MMX_ASM -#endif -#if MesaUse3DNow - 3DNOW_DEFS = -DUSE_3DNOW_ASM -#endif -#if MesaUseKatmai - KATMAI_DEFS = -DUSE_KATMAI_ASM -#endif - ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS) +#include "../../X86/Imakefile.inc" #endif -#if BuildXF86DRI - DRI_DEFINES = GlxDefines -DFX_GLIDE3 -DDRIVERTS - DRI_INCLUDES = -I../../../../dri -I../../../../glx \ - -I../../../dri \ - -I$(TOP)/include -I$(TOP)/include/GL \ - -I$(XF86OSSRC) -I$(SERVERSRC)/GL/dri \ - -I$(XF86DRIVERSRC)/tdfx \ - -I../../../include -I../.. -I../../X -I../common -#endif - -MESA_INCLUDES = -I. -I.. -I../../include - - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) \ + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) + INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) \ -I$(GLIDE3INCDIR) - DRISRCS = ../../../dri/dri_mesa.c \ - ../../../../dri/dri_tmm.c - - DRIOBJS = ../../../dri/dri_mesa.o \ - ../../../../dri/dri_tmm.o - - DRMSRCS = ../../../../dri/drm/xf86drm.c \ - ../../../../dri/drm/xf86drmHash.c \ - ../../../../dri/drm/xf86drmRandom.c \ - ../../../../dri/drm/xf86drmSL.c - - DRMOBJS = ../../../../dri/drm/xf86drm.o \ - ../../../../dri/drm/xf86drmHash.o \ - ../../../../dri/drm/xf86drmRandom.o \ - ../../../../dri/drm/xf86drmSL.o - - TDFXSRCS = tdfx_xmesa.c \ - tdfx_init.c \ - tdfx_inithw.c \ - fxclip.c \ - fxcva.c \ - fxdd.c \ - fxddspan.c \ - fxddtex.c \ - fxfastpath.c \ - fxglidew.c \ - fxpipeline.c \ - fxrender.c \ - fxsanity.c \ - fxsetup.c \ - fxtexman.c \ - fxtrifuncs.c \ - fxvsetup.c - - TDFXOBJS = tdfx_xmesa.o \ - tdfx_init.o \ - tdfx_inithw.o \ - fxclip.o \ - fxcva.o \ - fxdd.o \ - fxddspan.o \ - fxddtex.o \ - fxfastpath.o \ - fxglidew.o \ - fxpipeline.o \ - fxrender.o \ - fxsanity.o \ - fxsetup.o \ - fxtexman.o \ - fxtrifuncs.o \ - fxvsetup.o - - MESASRCS = ../../aatriangle.c \ - ../../accum.c \ - ../../alpha.c \ - ../../alphabuf.c \ - ../../attrib.c \ - ../../bbox.c \ - ../../bitmap.c \ - ../../blend.c \ - ../../buffers.c \ - ../../clip.c \ - ../../colortab.c \ - ../../config.c \ - ../../context.c \ - ../../copypix.c \ - ../../cva.c \ - ../../debug_xform.c \ - ../../depth.c \ - ../../dlist.c \ - ../../drawpix.c \ - ../../enable.c \ - ../../enums.c \ - ../../eval.c \ - ../../extensions.c \ - ../../feedback.c \ - ../../fog.c \ - ../../get.c \ - ../../glapi.c \ - ../../glapinoop.c \ - ../../glthread.c \ - ../../hash.c \ - ../../image.c \ - ../../imaging.c \ - ../../light.c \ - ../../lines.c \ - ../../logic.c \ - ../../masking.c \ - ../../matrix.c \ - ../../mem.c \ - ../../mmath.c \ - ../../pb.c \ - ../../pipeline.c \ - ../../pixel.c \ - ../../pixeltex.c \ - ../../points.c \ - ../../polygon.c \ - ../../quads.c \ - ../../rastpos.c \ - ../../readpix.c \ - ../../rect.c \ - ../../scissor.c \ - ../../shade.c \ - ../../span.c \ - ../../stages.c \ - ../../state.c \ - ../../stencil.c \ - ../../teximage.c \ - ../../texobj.c \ - ../../texstate.c \ - ../../texture.c \ - ../../texutil.c \ - ../../translate.c \ - ../../triangle.c \ - ../../varray.c \ - ../../vb.c \ - ../../vbcull.c \ - ../../vbfill.c \ - ../../vbindirect.c \ - ../../vbrender.c \ - ../../vbxform.c \ - ../../vector.c \ - ../../vertices.c \ - ../../winpos.c \ - ../../xform.c \ - ../../zoom.c - - MESAOBJS = ../../aatriangle.o \ - ../../accum.o \ - ../../alpha.o \ - ../../alphabuf.o \ - ../../attrib.o \ - ../../bbox.o \ - ../../bitmap.o \ - ../../blend.o \ - ../../buffers.o \ - ../../clip.o \ - ../../colortab.o \ - ../../config.o \ - ../../context.o \ - ../../copypix.o \ - ../../cva.o \ - ../../debug_xform.o \ - ../../depth.o \ - ../../dlist.o \ - ../../drawpix.o \ - ../../enable.o \ - ../../enums.o \ - ../../eval.o \ - ../../extensions.o \ - ../../feedback.o \ - ../../fog.o \ - ../../get.o \ - ../../hash.o \ - ../../hint.o \ - ../../image.o \ - ../../imaging.o \ - ../../light.o \ - ../../lines.o \ - ../../logic.o \ - ../../masking.o \ - ../../matrix.o \ - ../../mem.o \ - ../../mmath.o \ - ../../pb.o \ - ../../pipeline.o \ - ../../pixel.o \ - ../../pixeltex.o \ - ../../points.o \ - ../../polygon.o \ - ../../quads.o \ - ../../rastpos.o \ - ../../readpix.o \ - ../../rect.o \ - ../../scissor.o \ - ../../shade.o \ - ../../span.o \ - ../../stages.o \ - ../../state.o \ - ../../stencil.o \ - ../../teximage.o \ - ../../texobj.o \ - ../../texstate.o \ - ../../texture.o \ - ../../texutil.o \ - ../../translate.o \ - ../../triangle.o \ - ../../varray.o \ - ../../vb.o \ - ../../vbcull.o \ - ../../vbfill.o \ - ../../vbindirect.o \ - ../../vbrender.o \ - ../../vbxform.o \ - ../../vector.o \ - ../../vertices.o \ - ../../winpos.o \ - ../../xform.o \ - ../../zoom.o - -#ifdef i386Architecture - X86_SRCS = ../../X86/common_x86.c \ - ../../X86/common_x86_asm.S \ - ../../X86/x86.c \ - ../../X86/x86_cliptest.S \ - ../../X86/x86_vertex.S \ - ../../X86/x86_xform_masked2.S \ - ../../X86/x86_xform_masked3.S \ - ../../X86/x86_xform_masked4.S \ - ../../X86/x86_xform_raw2.S \ - ../../X86/x86_xform_raw3.S \ - ../../X86/x86_xform_raw4.S - - X86_OBJS = ../../X86/common_x86.o \ - ../../X86/common_x86_asm.o \ - ../../X86/x86.o \ - ../../X86/x86_cliptest.o \ - ../../X86/x86_vertex.o \ - ../../X86/x86_xform_masked2.o \ - ../../X86/x86_xform_masked3.o \ - ../../X86/x86_xform_masked4.o \ - ../../X86/x86_xform_raw2.o \ - ../../X86/x86_xform_raw3.o \ - ../../X86/x86_xform_raw4.o + DRIOBJS = $(GLXLIBSRC)/mesa/dri/dri_mesa.o \ + $(GLXLIBSRC)/dri/dri_tmm.o -#if MesaUseMMX - MMX_SRCS = ../../X86/mmx_blend.S - - MMX_OBJS = ../../X86/mmx_blend.o -#endif - -#if MesaUse3DNow - 3DNOW_SRCS = ../../X86/3dnow.c \ - ../../X86/3dnow_norm_raw.S \ - ../../X86/3dnow_vertex.S \ - ../../X86/3dnow_xform_masked1.S \ - ../../X86/3dnow_xform_masked2.S \ - ../../X86/3dnow_xform_masked3.S \ - ../../X86/3dnow_xform_masked4.S \ - ../../X86/3dnow_xform_raw1.S \ - ../../X86/3dnow_xform_raw2.S \ - ../../X86/3dnow_xform_raw3.S \ - ../../X86/3dnow_xform_raw4.S - - 3DNOW_OBJS = ../../X86/3dnow.o \ - ../../X86/3dnow_norm_raw.o \ - ../../X86/3dnow_vertex.o \ - ../../X86/3dnow_xform_masked1.o \ - ../../X86/3dnow_xform_masked2.o \ - ../../X86/3dnow_xform_masked3.o \ - ../../X86/3dnow_xform_masked4.o \ - ../../X86/3dnow_xform_raw1.o \ - ../../X86/3dnow_xform_raw2.o \ - ../../X86/3dnow_xform_raw3.o \ - ../../X86/3dnow_xform_raw4.o -#endif - -#if MesaUseKatmai - KATMAI_SRCS = ../../X86/katmai.c \ - ../../X86/katmai_norm_raw.S \ - ../../X86/katmai_vertex.S \ - ../../X86/katmai_xform_masked1.S \ - ../../X86/katmai_xform_masked2.S \ - ../../X86/katmai_xform_masked3.S \ - ../../X86/katmai_xform_masked4.S \ - ../../X86/katmai_xform_raw1.S \ - ../../X86/katmai_xform_raw2.S \ - ../../X86/katmai_xform_raw3.S \ - ../../X86/katmai_xform_raw4.S - - KATMAI_OBJS = ../../X86/katmai.o \ - ../../X86/katmai_norm_raw.o \ - ../../X86/katmai_vertex.o \ - ../../X86/katmai_xform_masked1.o \ - ../../X86/katmai_xform_masked2.o \ - ../../X86/katmai_xform_masked3.o \ - ../../X86/katmai_xform_masked4.o \ - ../../X86/katmai_xform_raw1.o \ - ../../X86/katmai_xform_raw2.o \ - ../../X86/katmai_xform_raw3.o \ - ../../X86/katmai_xform_raw4.o -#endif -#endif + DRMOBJS = $(GLXLIBSRC)/dri/drm/xf86drm.o \ + $(GLXLIBSRC)/dri/drm/xf86drmHash.o \ + $(GLXLIBSRC)/dri/drm/xf86drmRandom.o \ + $(GLXLIBSRC)/dri/drm/xf86drmSL.o #ifdef GlxSoProf LOSRCS = ../../../../lowpc.c @@ -333,46 +43,30 @@ MESA_INCLUDES = -I. -I.. -I../../include HIOBJS = ../../../../highpc.o #endif - ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) $(KATMAI_SRCS) - ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS) - - SRCS = $(LOSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) \ - $(ASMSRCS) $(TDFXSRCS) $(HISRCS) - OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) \ - $(ASMOBJS) $(TDFXOBJS) $(HIOBJS) - -REQUIREDLIBS = -l$(GLIDE3LIBNAME) MathLibrary -#if !GlxBuiltInTdfx -REQUIREDLIBS += -L../../../.. -lGL -#endif - + SRCS = $(TDFXSRCS) + OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(COREMESAOBJS) \ + $(MESA_ASM_OBJS) $(TDFXOBJS) $(HIOBJS) -#if !GlxUseBuiltInDRIDriver -#undef DoNormalLib NormalLibGlx -#undef DoExtraLib SharedLibGlx -#undef DoDebugLib DebugLibGlx -#undef DoProfileLib ProfileLibGlx -#endif +REQUIREDLIBS = -l$(GLIDE3LIBNAME) MathLibrary $(LDPRELIB) $(GLXLIB) #include <Library.tmpl> LibraryObjectRule() -SubdirLibraryRule($(OBJS)) +SubdirLibraryRule($(TDFXOBJS)) NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = tdfx_dri.so -ALL_OBJS = $(OBJS) -ALL_DEPS = DONE -SharedDriModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +SharedDriModuleTarget($(LIBNAME),DONE,$(OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) #ifdef GlxSoProf SOPROF_LIBNAME = _tdfx_dri_p -NormalDepLibraryTarget($(SOPROF_LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +NormalDepLibraryTarget($(SOPROF_LIBNAME),DONE,$(OBJS)) InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) #endif #endif DependTarget() + diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc new file mode 100644 index 000000000..273eed852 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc @@ -0,0 +1,148 @@ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc,v 1.1 2001/03/23 19:18:44 dawes Exp $ + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + +#ifndef MesaDrvTdfxBuildDir +#define MesaDrvTdfxBuildDir /**/ +#endif +MESADRVTDFXBUILDDIR = MesaDrvTdfxBuildDir + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +#if BuildXF86DRI + DRI_DEFINES = GlxDefines -DFX_GLIDE3 -DDRIVERTS + DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ + -I$(GLXLIBSRC)/mesa/dri \ + -I$(SERVERSRC)/GL/dri \ + -I$(XF86OSSRC) \ + -I$(XF86DRIVERSRC)/tdfx \ + -I$(GLXLIBSRC)/dri/drm +#endif + +MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESADRVSRCDIR)/common \ + -I$(MESADRVSRCDIR)/tdfx + X_INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) + + TDFXSRCS = $(MESADRVTDFXBUILDDIR)tdfx_context.c \ + $(MESADRVTDFXBUILDDIR)tdfx_dd.c \ + $(MESADRVTDFXBUILDDIR)tdfx_pixels.c \ + $(MESADRVTDFXBUILDDIR)tdfx_fastpath.c \ + $(MESADRVTDFXBUILDDIR)tdfx_g3ext.c \ + $(MESADRVTDFXBUILDDIR)tdfx_lock.c \ + $(MESADRVTDFXBUILDDIR)tdfx_pipeline.c \ + $(MESADRVTDFXBUILDDIR)tdfx_render.c \ + $(MESADRVTDFXBUILDDIR)tdfx_screen.c \ + $(MESADRVTDFXBUILDDIR)tdfx_span.c \ + $(MESADRVTDFXBUILDDIR)tdfx_state.c \ + $(MESADRVTDFXBUILDDIR)tdfx_tex.c \ + $(MESADRVTDFXBUILDDIR)tdfx_texman.c \ + $(MESADRVTDFXBUILDDIR)tdfx_texstate.c \ + $(MESADRVTDFXBUILDDIR)tdfx_tris.c \ + $(MESADRVTDFXBUILDDIR)tdfx_vb.c \ + $(MESADRVTDFXBUILDDIR)tdfx_wrapper.c \ + $(MESADRVTDFXBUILDDIR)tdfx_xmesa.c + + TDFXOBJS = $(MESADRVTDFXBUILDDIR)tdfx_context.o \ + $(MESADRVTDFXBUILDDIR)tdfx_dd.o \ + $(MESADRVTDFXBUILDDIR)tdfx_pixels.o \ + $(MESADRVTDFXBUILDDIR)tdfx_fastpath.o \ + $(MESADRVTDFXBUILDDIR)tdfx_g3ext.o \ + $(MESADRVTDFXBUILDDIR)tdfx_lock.o \ + $(MESADRVTDFXBUILDDIR)tdfx_pipeline.o \ + $(MESADRVTDFXBUILDDIR)tdfx_render.o \ + $(MESADRVTDFXBUILDDIR)tdfx_screen.o \ + $(MESADRVTDFXBUILDDIR)tdfx_span.o \ + $(MESADRVTDFXBUILDDIR)tdfx_state.o \ + $(MESADRVTDFXBUILDDIR)tdfx_tex.o \ + $(MESADRVTDFXBUILDDIR)tdfx_texman.o \ + $(MESADRVTDFXBUILDDIR)tdfx_texstate.o \ + $(MESADRVTDFXBUILDDIR)tdfx_tris.o \ + $(MESADRVTDFXBUILDDIR)tdfx_vb.o \ + $(MESADRVTDFXBUILDDIR)tdfx_wrapper.o \ + $(MESADRVTDFXBUILDDIR)tdfx_xmesa.o + + TDFXUOBJS = $(MESADRVTDFXBUILDDIR)unshared/tdfx_context.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_dd.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_pixels.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_fastpath.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_g3ext.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_lock.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_pipeline.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_render.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_screen.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_span.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_state.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_tex.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_texman.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_texstate.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_tris.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_vb.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_wrapper.o \ + $(MESADRVTDFXBUILDDIR)unshared/tdfx_xmesa.o + + TDFXDOBJS = $(MESADRVTDFXBUILDDIR)debugger/tdfx_context.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_dd.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_pixels.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_fastpath.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_g3ext.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_lock.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_pipeline.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_render.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_screen.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_span.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_state.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_tex.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_texman.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_texstate.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_tris.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_vb.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_wrapper.o \ + $(MESADRVTDFXBUILDDIR)debugger/tdfx_xmesa.o + + TDFXPOBJS = $(MESADRVTDFXBUILDDIR)profiled/tdfx_context.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_dd.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_pixels.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_fastpath.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_g3ext.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_lock.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_pipeline.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_render.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_screen.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_span.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_state.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_tex.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_texman.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_texstate.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_tris.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_vb.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_wrapper.o \ + $(MESADRVTDFXBUILDDIR)profiled/tdfx_xmesa.o + +#ifdef NeedToLinkMesaSrc +LinkSourceFile(tdfx_context.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_dd.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_pixels.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_fastpath.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_g3ext.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_lock.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_pipeline.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_render.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_screen.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_span.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_state.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_tex.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_texman.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_texstate.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_tris.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_vb.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_wrapper.c, $(MESADRVSRCDIR)/tdfx) +LinkSourceFile(tdfx_xmesa.c, $(MESADRVSRCDIR)/tdfx) +#endif + diff --git a/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h b/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h new file mode 100644 index 000000000..0af560174 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h @@ -0,0 +1,63 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/dri_glide.h,v 1.1 2001/03/21 16:14:26 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __DRI_GLIDE_H__ +#define __DRI_GLIDE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <glide.h> +#include "dri_mesaint.h" + +/* + * This is the private interface between Glide and the DRI. + */ +extern void grDRIOpen( char *pFB, char *pRegs, int deviceID, + int width, int height, + int mem, int cpp, int stride, + int fifoOffset, int fifoSize, + int fbOffset, int backOffset, int depthOffset, + int textureOffset, int textureSize, + volatile int *fifoPtr, volatile int *fifoRead ); +extern void grDRIPosition( int x, int y, int w, int h, + int numClip, XF86DRIClipRectPtr pClip ); +extern void grDRILostContext( void ); +extern void grDRIImportFifo( int fifoPtr, int fifoRead ); +extern void grDRIInvalidateAll( void ); +extern void grDRIResetSAREA( void ); +extern void grDRIBufferSwap( FxU32 swapInterval ); +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c new file mode 100644 index 000000000..c38e10f19 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c @@ -0,0 +1,478 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_context.c,v 1.1 2001/03/21 16:14:27 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "dri_glide.h" +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_render.h" +#include "tdfx_pipeline.h" +#include "tdfx_span.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" +#include "extensions.h" + +#ifndef TDFX_DEBUG +int TDFX_DEBUG = (0 +/* | DEBUG_ALWAYS_SYNC */ +/* | DEBUG_VERBOSE_API */ +/* | DEBUG_VERBOSE_MSG */ +/* | DEBUG_VERBOSE_LRU */ +/* | DEBUG_VERBOSE_DRI */ +/* | DEBUG_VERBOSE_IOCTL */ +/* | DEBUG_VERBOSE_2D */ +/* | DEBUG_VERBOSE_TEXTURE */ + ); +#endif + + +#if 0 +/* Example extension function */ +static void +fxFooBarEXT(GLint i) +{ + printf("You called glFooBarEXT(%d)\n", i); +} +#endif + + +/* + * Enable/Disable the extensions for this context. + */ +static void tdfxDDInitExtensions( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); + gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); + gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); + gl_extensions_disable( ctx, "GL_EXT_blend_color" ); + gl_extensions_disable( ctx, "GL_EXT_blend_func_separate" ); + gl_extensions_disable( ctx, "GL_EXT_point_parameters" ); + gl_extensions_disable( ctx, "GL_EXT_shared_texture_palette" ); + gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); + gl_extensions_enable( ctx, "GL_HP_occlusion_test" ); + + if ( fxMesa->numTMUs == 1 ) { + gl_extensions_disable( ctx, "GL_EXT_texture_env_add" ); + gl_extensions_disable( ctx, "GL_ARB_multitexture" ); + } + + if ( TDFX_IS_NAPALM( fxMesa ) ) { + gl_extensions_enable( ctx, "GL_EXT_texture_env_combine" ); + } + + if (fxMesa->haveHwStencil) { + gl_extensions_enable( ctx, "GL_EXT_stencil_wrap" ); + } + + /* Example of hooking in an extension function. + * For DRI-based drivers, also see __driRegisterExtensions in the + * tdfx_xmesa.c file. + */ +#if 0 + { + void **dispatchTable = (void **) ctx->Exec; + const int _gloffset_FooBarEXT = 555; /* just an example number! */ + const int tabSize = _glapi_get_dispatch_table_size(); + assert(_gloffset_FooBarEXT < tabSize); + dispatchTable[_gloffset_FooBarEXT] = (void *) tdfxFooBarEXT; + /* XXX You would also need to hook into the display list dispatch + * table. Really, the implementation of extensions might as well + * be in the core of Mesa since core Mesa and the device driver + * is one big shared lib. + */ + } +#endif +} + + + +GLboolean tdfxCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ) +{ + tdfxContextPtr fxMesa; + GLcontext *ctx = driContextPriv->mesaContext; + __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; + TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA + + fxScreen->sarea_priv_offset); + + + fxMesa = (tdfxContextPtr) Xmalloc( sizeof(tdfxContextRec) ); + if ( !fxMesa ) { + return GL_FALSE; + } + BZERO(fxMesa, sizeof(tdfxContextRec)); + + /* Mirror some important DRI state + */ + fxMesa->hHWContext = driContextPriv->hHWContext; + fxMesa->driHwLock = &sPriv->pSAREA->lock; + fxMesa->driFd = sPriv->fd; + + fxMesa->driScreen = sPriv; + fxMesa->driContext = driContextPriv; + fxMesa->fxScreen = fxScreen; + fxMesa->sarea = saPriv; + + + + fxMesa->haveHwStencil = ( TDFX_IS_NAPALM( fxMesa ) && + mesaVis->StencilBits && + mesaVis->DepthBits == 24 ); + + fxMesa->screen_width = fxScreen->width; + fxMesa->screen_height = fxScreen->height; + + fxMesa->new_state = ~0; + fxMesa->dirty = ~0; + + fxMesa->vertexFormat = 0; + + fxMesa->glCtx = driContextPriv->mesaContext; + fxMesa->glVis = mesaVis; + + grDRIOpen( sPriv->pFB, fxScreen->regs.map, fxScreen->deviceID, + fxScreen->width, fxScreen->height, fxScreen->mem, fxScreen->cpp, + fxScreen->stride, fxScreen->fifoOffset, fxScreen->fifoSize, + fxScreen->fbOffset, fxScreen->backOffset, fxScreen->depthOffset, + fxScreen->textureOffset, fxScreen->textureSize, &saPriv->fifoPtr, + &saPriv->fifoRead ); + + if ( getenv( "FX_GLIDE_SWAPINTERVAL" ) ) { + fxMesa->Glide.SwapInterval = atoi( getenv( "FX_GLIDE_SWAPINTERVAL" ) ); + } else { + fxMesa->Glide.SwapInterval = 1; + } + if ( getenv( "FX_MAX_PENDING_SWAPS" ) ) { + fxMesa->Glide.MaxPendingSwaps = atoi( getenv( "FX_MAX_PENDING_SWAPS" ) ); + } else { + fxMesa->Glide.MaxPendingSwaps = 2; + } + + fxMesa->Glide.Initialized = GL_FALSE; + fxMesa->Glide.Board = 0; + + if ( getenv( "FX_EMULATE_SINGLE_TMU" ) || TDFX_IS_BANSHEE( fxMesa ) ) { + fxMesa->numTMUs = 1; + } else { + fxMesa->numTMUs = 2; + } + + fxMesa->stats.swapBuffer = 0; + fxMesa->stats.reqTexUpload = 0; + fxMesa->stats.texUpload = 0; + fxMesa->stats.memTexUpload = 0; + + fxMesa->tmuSrc = TDFX_TMU_NONE; + + if ( TDFX_IS_NAPALM( fxMesa ) ) { + ctx->Const.MaxTextureLevels = 12; + ctx->Const.MaxTextureSize = 2048; + ctx->Const.NumCompressedTextureFormats = 1; + } else { + ctx->Const.MaxTextureLevels = 9; + ctx->Const.MaxTextureSize = 256; + ctx->Const.NumCompressedTextureFormats = 0; + } + ctx->Const.MaxTextureUnits = TDFX_IS_BANSHEE( fxMesa ) ? 1 : 2; + ctx->NewState |= NEW_DRVSTATE1; + + + ctx->DriverCtx = (void *) fxMesa; + + tdfxDDInitExtensions( ctx ); + + tdfxDDInitDriverFuncs( ctx ); + tdfxDDInitStateFuncs( ctx ); + tdfxDDInitRenderFuncs( ctx ); + tdfxDDInitSpanFuncs( ctx ); + tdfxDDInitTextureFuncs( ctx ); + + ctx->Driver.TriangleCaps = (DD_TRI_CULL | + DD_TRI_LIGHT_TWOSIDE | + DD_TRI_STIPPLE | + DD_TRI_OFFSET); + + if ( ctx->VB ) + tdfxDDRegisterVB( ctx->VB ); + + if ( ctx->NrPipelineStages ) + ctx->NrPipelineStages = + tdfxDDRegisterPipelineStages( ctx->PipelineStage, + ctx->PipelineStage, + ctx->NrPipelineStages ); + + /* Run the config file */ + gl_context_initialize( ctx ); + +#if 0 + /* HACK: Allocate buffer for vertex data. + */ + if ( fxMesa->buffer ) { + ALIGN_FREE( fxMesa->buffer ); + } + fxMesa->buffer = ALIGN_MALLOC( 2048, 32 ); + fxMesa->buffer_total = 2048; + fxMesa->buffer_used = 0; +#endif + + tdfxInitState( fxMesa ); + + driContextPriv->driverPrivate = (void *) fxMesa; + + return GL_TRUE; +} + + +static GLboolean tdfxInitVertexFormats( tdfxContextPtr fxMesa ) +{ + FxI32 result; + int i; + + LOCK_HARDWARE( fxMesa ); + + grGet( GR_GLIDE_VERTEXLAYOUT_SIZE, sizeof(FxI32), &result ); + for ( i = 0 ; i < TDFX_NUM_LAYOUTS ; i++ ) { + fxMesa->layout[i] = MALLOC( result ); + if ( !fxMesa->layout[i] ) { + UNLOCK_HARDWARE( fxMesa ); + return GL_FALSE; + } + } + + /* Single textured vertex format - 32 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_SINGLE] ); + + /* Multitextured vertex format - 40 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_MULTI] ); + + /* Projected texture vertex format - 48 bytes. + */ + grReset( GR_VERTEX_PARAMETER ); + + grCoordinateSpace( GR_WINDOW_COORDS ); + grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q0, TDFX_Q0_OFFSET, GR_PARAM_ENABLE ); + grVertexLayout( GR_PARAM_Q1, TDFX_Q1_OFFSET, GR_PARAM_ENABLE ); +#if 0 + grVertexLayout( GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET, GR_PARAM_ENABLE ); +#endif + + grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_PROJECT] ); + + UNLOCK_HARDWARE( fxMesa ); + + return GL_TRUE; +} + + +/* + * Initialize the state in an tdfxContextPtr struct. + */ +GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, + tdfxContextPtr fxMesa ) +{ + /* KW: Would be nice to make one of these a member of the other. + */ + FxI32 result[2]; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, fxMesa ); + } + +#if DEBUG_LOCKING + fprintf(stderr, "Debug locking enabled\n"); +#endif + + if ( fxMesa->Glide.Initialized ) + return GL_TRUE; + + fxMesa->width = driDrawPriv->w; + fxMesa->height = driDrawPriv->h; + + /* We have to use a light lock here, because we can't do any glide + * operations yet. No use of FX_* functions in this function. + */ + DRM_LIGHT_LOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); + + grGlideInit(); + grSstSelect( fxMesa->Glide.Board ); + + fxMesa->Glide.Context = grSstWinOpen( (FxU32) -1, + GR_RESOLUTION_NONE, + GR_REFRESH_NONE, + fxMesa->Glide.ColorFormat, + fxMesa->Glide.Origin, + 2, 1 ); + + grDRIResetSAREA(); + + DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); + + if ( !fxMesa->Glide.Context ) + return GL_FALSE; + + + /* Perform the Glide-dependant part of the context initialization. + */ + FX_grColorMaskv( fxMesa->glCtx, true4 ); + + tdfxTMInit( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + + if ( fxMesa->glVis->DepthBits > 0 ) { + grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); + } else { + grDepthBufferMode(GR_DEPTHBUFFER_DISABLE); + } + + grLfbWriteColorFormat( GR_COLORFORMAT_ABGR ); + + grGet( GR_TEXTURE_ALIGN, sizeof(FxI32), result ); + fxMesa->Glide.TextureAlign = result[0]; + + fxMesa->Glide.State = NULL; + grGet( GR_GLIDE_STATE_SIZE, sizeof(FxI32), result ); + fxMesa->Glide.State = MALLOC( result[0] ); + + fxMesa->Fog.Table = NULL; + grGet( GR_FOG_TABLE_ENTRIES, sizeof(FxI32), result ); + fxMesa->Fog.Table = MALLOC( result[0] * sizeof(GrFog_t) ); + + UNLOCK_HARDWARE( fxMesa ); + + if ( !fxMesa->Glide.State || !fxMesa->Fog.Table ) { + if ( fxMesa->Glide.State ) + FREE( fxMesa->Glide.State ); + if ( fxMesa->Fog.Table ) + FREE( fxMesa->Fog.Table ); + return GL_FALSE; + } + + if ( !tdfxInitVertexFormats( fxMesa ) ) { + return GL_FALSE; + } + + LOCK_HARDWARE( fxMesa ); + + grGlideGetState( fxMesa->Glide.State ); + + if ( getenv( "FX_GLIDE_INFO" ) ) { + printf( "GR_RENDERER = %s\n", (char *) grGetString( GR_RENDERER ) ); + printf( "GR_VERSION = %s\n", (char *) grGetString( GR_VERSION ) ); + printf( "GR_VENDOR = %s\n", (char *) grGetString( GR_VENDOR ) ); + printf( "GR_HARDWARE = %s\n", (char *) grGetString( GR_HARDWARE ) ); + printf( "GR_EXTENSION = %s\n", (char *) grGetString( GR_EXTENSION ) ); + } + + UNLOCK_HARDWARE( fxMesa ); + + fxMesa->numClipRects = 0; + fxMesa->pClipRects = NULL; + fxMesa->scissoredClipRects = GL_FALSE; + + fxMesa->Glide.Initialized = GL_TRUE; + + return GL_TRUE; +} + + +void tdfxDestroyContext( tdfxContextPtr fxMesa ) +{ + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, fxMesa ); + } + + if ( fxMesa ) { + GLcontext *ctx = fxMesa->glCtx; + struct gl_texture_object *tObj; + + if ( ctx->Shared->RefCount == 1 ) { + /* This share group is about to go away, free our private + * texture object data. + */ + LOCK_HARDWARE( fxMesa ); + for ( tObj = ctx->Shared->TexObjectList ; tObj ; tObj = tObj->Next ) { + tdfxTMFreeTextureLocked( fxMesa, tObj ); + } + UNLOCK_HARDWARE( fxMesa ); + } + + tdfxTMClose( fxMesa ); /* free texture memory */ + XFree( fxMesa ); + } + +#if 0 + glx_fini_prof(); +#endif +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h new file mode 100644 index 000000000..88727f6ae --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h @@ -0,0 +1,767 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_context.h,v 1.1 2001/03/21 16:14:27 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_CONTEXT_H__ +#define __TDFX_CONTEXT_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <sys/time.h> +#include "dri_tmm.h" +#include "dri_mesaint.h" +#include "dri_mesa.h" +#include "dri_xmesaapi.h" +#ifdef XFree86Server +#include "GL/xf86glx.h" +#else +#include "glheader.h" +#endif +#if defined(__linux__) +#include <signal.h> +#endif +#include "clip.h" +#include "context.h" + +#include "macros.h" +#include "matrix.h" +#include "mem.h" +#include "texture.h" +#include "types.h" +#include "vb.h" +#include "vbrender.h" +#include "xform.h" + +#include "tdfx_wrapper.h" +#include "tdfx_screen.h" +#include "tdfx_lock.h" +#include "tdfx_g3ext.h" + + + +/* Mergable items first + */ +#define SETUP_RGBA 0x1 +#define SETUP_TMU0 0x2 +#define SETUP_TMU1 0x4 +#define SETUP_XY 0x8 +#define SETUP_Z 0x10 +#define SETUP_W 0x20 + +#define MAX_MERGABLE 0x8 + + +#define TDFX_TMU0 GR_TMU0 +#define TDFX_TMU1 GR_TMU1 +#define TDFX_TMU_SPLIT 98 +#define TDFX_TMU_BOTH 99 +#define TDFX_TMU_NONE 100 + + + +/* Flags for fxMesa->new_state + */ +#define TDFX_NEW_COLOR 0x0001 +#define TDFX_NEW_ALPHA 0x0002 +#define TDFX_NEW_DEPTH 0x0004 +#define TDFX_NEW_FOG 0x0008 +#define TDFX_NEW_STENCIL 0x0010 +#define TDFX_NEW_CLIP 0x0020 +#define TDFX_NEW_VIEWPORT 0x0040 +#define TDFX_NEW_CULL 0x0080 +#define TDFX_NEW_GLIDE 0x0100 +#define TDFX_NEW_TEXTURE 0x0200 +#define TDFX_NEW_CONTEXT 0x0400 +#define TDFX_NEW_LINE 0x0800 +#define TDFX_NEW_RENDER 0x1000 +#define TDFX_NEW_STIPPLE 0x2000 +#define TDFX_NEW_TEXTURE_BIND 0x4000 /* experimental */ + + +/* Flags for fxMesa->dirty + */ +#define TDFX_UPLOAD_COLOR_COMBINE 0x00000001 +#define TDFX_UPLOAD_ALPHA_COMBINE 0x00000002 +#define TDFX_UPLOAD_RENDER_BUFFER 0x00000004 +#define TDFX_UPLOAD_ALPHA_TEST 0x00000008 +#define TDFX_UPLOAD_ALPHA_REF 0x00000010 +#define TDFX_UPLOAD_BLEND_FUNC 0x00000020 +#define TDFX_UPLOAD_DEPTH_MODE 0x00000040 +#define TDFX_UPLOAD_DEPTH_BIAS 0x00000080 +#define TDFX_UPLOAD_DEPTH_FUNC 0x00000100 +#define TDFX_UPLOAD_DEPTH_MASK 0x00000200 +#define TDFX_UPLOAD_FOG_MODE 0x00000400 +#define TDFX_UPLOAD_FOG_COLOR 0x00000800 +#define TDFX_UPLOAD_FOG_TABLE 0x00001000 + +#define TDFX_UPLOAD_CLIP 0x00002000 +#define TDFX_UPLOAD_CULL 0x00004000 +#define TDFX_UPLOAD_VERTEX_LAYOUT 0x00008000 +#define TDFX_UPLOAD_COLOR_MASK 0x00010000 +#define TDFX_UPLOAD_CONSTANT_COLOR 0x00020000 +#define TDFX_UPLOAD_DITHER 0x00040000 +#define TDFX_UPLOAD_STENCIL 0x00080000 + +#define TDFX_UPLOAD_TEXTURE_SOURCE 0x00100000 +#define TDFX_UPLOAD_TEXTURE_PARAMS 0x00200000 +#define TDFX_UPLOAD_TEXTURE_PALETTE 0x00400000 +#define TDFX_UPLOAD_TEXTURE_ENV 0x00800000 +#define TDFX_UPLOAD_TEXTURE_IMAGES 0x01000000 + +#define TDFX_UPLOAD_LINE 0x02000000 + +#define TDFX_UPLOAD_STIPPLE 0x04000000 + +/* Flags for software fallback cases + */ +#define TDFX_FALLBACK_TEXTURE 0x0001 +#define TDFX_FALLBACK_BUFFER 0x0002 +#define TDFX_FALLBACK_SPECULAR 0x0004 +#define TDFX_FALLBACK_STENCIL 0x0008 +#define TDFX_FALLBACK_RENDER_MODE 0x0010 +#define TDFX_FALLBACK_MULTIDRAW 0x0020 +#define TDFX_FALLBACK_LOGICOP 0x0040 +#define TDFX_FALLBACK_WIDE_AA_LINE 0x0080 +#define TDFX_FALLBACK_TEXTURE_ENV 0x0100 +#define TDFX_FALLBACK_TEXTURE_BORDER 0x0200 +#define TDFX_FALLBACK_COLORMASK 0x0400 +#define TDFX_FALLBACK_BLEND 0x0800 + +/* Different Glide vertex layouts + */ +#define TDFX_LAYOUT_SINGLE 0 +#define TDFX_LAYOUT_MULTI 1 +#define TDFX_LAYOUT_PROJECT 2 +#define TDFX_NUM_LAYOUTS 3 + +#define TDFX_XY_OFFSET 0 +#define TDFX_Z_OFFSET 8 +#define TDFX_Q_OFFSET 12 +#define TDFX_ARGB_OFFSET 16 +#define TDFX_PAD_OFFSET 20 +#define TDFX_FOG_OFFSET 20 /* experimental */ +#define TDFX_ST0_OFFSET 24 +#define TDFX_ST1_OFFSET 32 +#define TDFX_Q0_OFFSET 40 +#define TDFX_Q1_OFFSET 44 + + +/* Flags for buffer clears + */ +#define TDFX_FRONT 0x1 +#define TDFX_BACK 0x2 +#define TDFX_DEPTH 0x4 +#define TDFX_STENCIL 0x8 + +/* + * Subpixel offsets to adjust Mesa's (true) window coordinates to + * Glide coordinates. We need these to ensure precise rasterization. + * Otherwise, we'll fail a bunch of conformance tests. + */ +#define TRI_X_OFFSET ( 0.0F) +#define TRI_Y_OFFSET ( 0.0F) +#define LINE_X_OFFSET ( 0.0F) +#define LINE_Y_OFFSET ( 0.125F) +#define PNT_X_OFFSET ( 0.375F) +#define PNT_Y_OFFSET ( 0.375F) + + +#define TDFX_DEPTH_BIAS_SCALE 128 + +/* Including xf86PciInfo.h causes a bunch of errors + */ +#ifndef PCI_CHIP_BANSHEE +#define PCI_CHIP_BANSHEE 0x0003 +#define PCI_CHIP_VOODOO3 0x0005 +#define PCI_CHIP_VOODOO4 0x0009 +#define PCI_CHIP_VOODOO5 0x0009 +#endif + +#define TDFX_IS_BANSHEE( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_BANSHEE ) +#define TDFX_IS_VOODOO3( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO3 ) +#define TDFX_IS_VOODOO4( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4 ) +#define TDFX_IS_VOODOO5( fxMesa ) \ + ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5 ) +#define TDFX_IS_NAPALM( fxMesa ) \ + ( (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4) || \ + (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5) ) + + +#define PACK_BGRA32(R, G, B, A) \ + ( (((GLuint) (R)) << 16) | \ + (((GLuint) (G)) << 8) | \ + (((GLuint) (B)) ) | \ + (((GLuint) (A)) << 24) ) + +#define PACK_RGBA32(R, G, B, A) \ + ( (((GLuint) (R)) ) | \ + (((GLuint) (G)) << 8) | \ + (((GLuint) (B)) << 16) | \ + (((GLuint) (A)) << 24) ) + +/* + * The first two macros are to pack 8 bit color + * channel values into a 565 format. + */ +#define PACK_RGB16(R, G, B) \ + ((((GLuint) (R) & 0xF8) << 8) | \ + (((GLuint) (G) & 0xFC) << 3) | \ + (((GLuint) (B) & 0xFF) >> 3)) +#define PACK_BGR16(R, G, B) \ + ((((GLuint) (B) & 0xF8) << 8) | \ + (((GLuint) (G) & 0xFC) << 3) | \ + (((GLuint) (R) & 0xFF) >> 3)) +/* + * The second two macros pack 8 bit color channel values + * into 1555 values. + */ +#define PACK_RGBA16(R, G, B, A) \ + (((((GLuint) (A) & 0xFF) > 0) << 15)| \ + (((GLuint) (R) & 0xF8) << 7) | \ + (((GLuint) (G) & 0xF8) << 2) | \ + (((GLuint) (B) & 0xF8) >> 3)) +#define PACK_BGRA16(R, G, B, A) \ + (((((GLuint) (A) & 0xFF) > 0) << 15)| \ + (((GLuint) (B) & 0xF8) << 7) | \ + (((GLuint) (G) & 0xF8) << 2) | \ + (((GLuint) (R) & 0xF8) >> 3)) + +typedef void (*tdfxRenderEltsFunc)( struct vertex_buffer * ); + +/* Used in calls to grColorMaskv()... + */ +extern const GLboolean false4[4]; +extern const GLboolean true4[4]; + + +typedef void (*tdfx_interp_func)( GLfloat t, + GLfloat *result, + const GLfloat *in, + const GLfloat *out ); + +typedef struct { + volatile int fifoPtr; + volatile int fifoRead; + volatile int fifoOwner; + volatile int ctxOwner; + volatile int texOwner; +} TDFXSAREAPriv; + +typedef struct { + GLuint swapBuffer; + GLuint reqTexUpload; + GLuint texUpload; + GLuint memTexUpload; + GLuint texSwaps; +} tdfxStats; + +/* + * Memory range from startAddr to endAddr-1 + */ +typedef struct mem_range { + struct mem_range *next; + FxU32 startAddr, endAddr; +} tdfxMemRange; + +typedef struct { + GLvoid *data; + GLsizei width, height; + FxU32 size; +} tdfxTexRawData; + +typedef struct { + tdfxTexRawData original; /* Mesa-formatted texture image */ + tdfxTexRawData rescaled; /* Only needed if aspect ratio > 8:1 */ + + GLvoid *data; /* Final version of texture image */ + FxU32 size; /* image size in bytes */ + + GrTextureFormat_t glideFormat; /* Glide image format */ + GLint wScale, hScale; /* Broken hardware... */ +} tdfxTexImage, *tdfxTexImagePtr; + + +#define TDFX_NUM_TMU 2 + + +typedef struct { + GLboolean isInTM; + GLboolean reloadImages; /* if true, resend images to Glide */ + GLuint lastTimeUsed; + FxU32 whichTMU; + + GrTexInfo info; + tdfxTexImage image[MAX_TEXTURE_LEVELS]; + tdfxMemRange *range[TDFX_NUM_TMU]; + + GLint minLevel, maxLevel; + GrMipMapMode_t mmMode; + GrAspectRatio_t aspectRatio; + FxBool LODblend; + GrTextureFilterMode_t minFilt; + GrTextureFilterMode_t magFilt; + GrTextureClampMode_t sClamp; + GrTextureClampMode_t tClamp; + + GLfloat sScale, tScale; /* texcoord scale factor */ + + GuTexPalette palette; +} tdfxTexObj, *tdfxTexObjPtr; + +#define TDFX_TEXTURE_DATA(tObj) ((tdfxTexObjPtr)((tObj)->DriverData)) + + +/* This is state which may be shared by several tdfx contexts. + * It hangs off of Mesa's gl_shared_state object (ctx->Shared->DriverData). + */ +typedef struct tdfx_shared_state { + GLboolean umaTexMemory; + GLuint totalTexMem[TDFX_NUM_TMU]; /* constant */ + GLuint freeTexMem[TDFX_NUM_TMU]; /* changes as we go */ + tdfxMemRange *rangePool; + tdfxMemRange *freeRanges[TDFX_NUM_TMU]; +} tdfxSharedState, *tdfxSharedStatePtr; + + + + +/* ================================================================ + * + * We want to keep a mirror of the Glide function call parameters so we + * can avoid updating our state too often. + * + * Each of these broad groups will typically have a new state flag + * associated with it, and will be updated together. The individual + * Glide function calls each have a dirty flag and will only be called + * when absolutely necessary. + */ + +/* for grTexSource() */ +struct tdfx_texsource { + FxU32 StartAddress; + FxU32 EvenOdd; + GrTexInfo *Info; +}; + +/* Texture object params */ +struct tdfx_texparams { + GrTextureClampMode_t sClamp; + GrTextureClampMode_t tClamp; + GrTextureFilterMode_t minFilt; + GrTextureFilterMode_t magFilt; + GrMipMapMode_t mmMode; + FxBool LODblend; + GLfloat LodBias; +}; + +/* for grTexDownloadTable() texture palettes */ +struct tdfx_texpalette { + GrTexTable_t Type; + void *Data; +}; + +/* for Voodoo3/Banshee's grColorCombine() and grAlphaCombine() */ +struct tdfx_combine { + GrCombineFunction_t Function; /* Combine function */ + GrCombineFactor_t Factor; /* Combine scale factor */ + GrCombineLocal_t Local; /* Local combine source */ + GrCombineOther_t Other; /* Other combine source */ + FxBool Invert; /* Combine result inversion flag */ +}; + +/* for Voodoo3's grTexCombine() */ +struct tdfx_texcombine { + GrCombineFunction_t FunctionRGB; + GrCombineFactor_t FactorRGB; + GrCombineFunction_t FunctionAlpha; + GrCombineFactor_t FactorAlpha; + FxBool InvertRGB; + FxBool InvertAlpha; +}; + + +/* for Voodoo5's grColorCombineExt() */ +struct tdfx_combine_color_ext { + GrCCUColor_t SourceA; + GrCombineMode_t ModeA; + GrCCUColor_t SourceB; + GrCombineMode_t ModeB; + GrCCUColor_t SourceC; + FxBool InvertC; + GrCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grAlphaCombineExt() */ +struct tdfx_combine_alpha_ext { + GrACUColor_t SourceA; + GrCombineMode_t ModeA; + GrACUColor_t SourceB; + GrCombineMode_t ModeB; + GrACUColor_t SourceC; + FxBool InvertC; + GrACUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grTexColorCombineExt() */ +struct tdfx_color_texenv { + GrTCCUColor_t SourceA; + GrCombineMode_t ModeA; + GrTCCUColor_t SourceB; + GrCombineMode_t ModeB; + GrTCCUColor_t SourceC; + FxBool InvertC; + GrTCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* for Voodoo5's grTexAlphaCombineExt() */ +struct tdfx_alpha_texenv { + GrTACUColor_t SourceA; + GrCombineMode_t ModeA; + GrTACUColor_t SourceB; + GrCombineMode_t ModeB; + GrTACUColor_t SourceC; + FxBool InvertC; + GrTCCUColor_t SourceD; + FxBool InvertD; + FxU32 Shift; + FxBool Invert; +}; + +/* Voodoo5's texture combine environment */ +struct tdfx_texcombine_ext { + struct tdfx_alpha_texenv Alpha; + struct tdfx_color_texenv Color; + GrColor_t EnvColor; +}; + +/* Used to track changes between Glide's state and Mesa's */ +struct tdfx_texstate { + GLuint Enabled; /* bitmask of all units */ + GLenum EnvMode[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */ + GLenum TexFormat[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */ +}; + +struct tdfx_color { + GrColor_t ClearColor; /* Buffer clear color value */ + GrAlpha_t ClearAlpha; /* Buffer clear alpha value */ + FxBool ColorMask[4]; /* Per-channel write enable flags */ + + GrColor_t MonoColor; /* Constant color value */ + + /* Alpha testing */ + GrCmpFnc_t AlphaFunc; /* Alpha test function */ + GrAlpha_t AlphaRef; /* Alpha ref value in range [0,255] */ + + /* Blending */ + GrAlphaBlendFnc_t BlendSrcRGB; /* Blend source RGB factor */ + GrAlphaBlendFnc_t BlendDstRGB; /* Blend destination RGB factor */ + GrAlphaBlendFnc_t BlendSrcA; /* Blend source alpha factor */ + GrAlphaBlendFnc_t BlendDstA; /* Blend destination alpha factor */ + + GrDitherMode_t Dither; /* Dither enable */ +}; + +struct tdfx_depth { + GrDepthBufferMode_t Mode; /* Fixed-point Z or floating-point W */ + FxI32 Bias; /* Polygon offset factor */ + GrCmpFnc_t Func; /* Depth test function */ + FxU32 Clear; /* Buffer clear value */ + FxBool Mask; /* Write enable flag */ +}; + +#ifndef GR_STIPPLE_PATTERN +#error You MUST upgrade your Glide3 libraries and headers. +#error Get the latest from http://dri.sourceforge.net/res.phtml +#endif + +struct tdfx_stipple { + GrStippleMode_t Mode; /* Stipple enable/disable */ + FxU32 Pattern; /* 8x4 Stipple Pattern */ +}; + +struct tdfx_fog { + GrFogMode_t Mode; /* Glide fog mode */ + GrColor_t Color; /* Fog color value */ + GLenum TableMode; /* GL fog mode currently in table */ + GrFog_t *Table; /* Fog value table */ + FxFloat Density; /* Density >= 0 */ + FxFloat Near; /* Start distance in eye coords */ + FxFloat Far; /* End distance in eye coords */ +}; + +struct tdfx_stencil { + GrCmpFnc_t Function; /* Stencil function */ + GrStencil_t RefValue; /* Stencil reference value */ + GrStencil_t ValueMask; /* Value mask */ + GrStencil_t WriteMask; /* Write mask */ + GrStencil_t FailFunc; /* Stencil fail function */ + GrStencil_t ZFailFunc; /* Stencil pass, depth fail function */ + GrStencil_t ZPassFunc; /* Stencil pass, depth pass function */ + GrStencil_t Clear; /* Buffer clear value */ +}; + +struct tdfx_scissor { + FxU32 minX, minY; /* Lower left corner */ + FxU32 maxX, maxY; /* Upper right corner */ +}; + +struct tdfx_viewport { + GrCoordinateSpaceMode_t Mode; /* Coordinate space */ + FxI32 X, Y; /* Position */ + FxI32 Width, Height; /* Size */ + FxFloat Near, Far; /* Depth buffer range */ +}; + +struct tdfx_glide { + void *State; /* Mirror of internal Glide state */ + GrContext_t Context; /* Glide context identifier */ + FxI32 Board; /* Current graphics subsystem */ + GrColorFormat_t ColorFormat; /* Framebuffer format */ + GrOriginLocation_t Origin; /* Location of screen space origin */ + + FxBool Initialized; /* Glide initialization done? */ + + FxI32 SwapInterval; /* SwapBuffers interval */ + FxI32 MaxPendingSwaps; /* Maximum outstanding SwapBuffers */ + FxI32 TextureAlign; + + /* Extensions */ + FxBool HaveCombineExt; /* COMBINE */ + FxBool HaveCommandTransportExt; /* COMMAND_TRANSPORT */ + FxBool HaveFogCoordExt; /* FOGCOORD */ + FxBool HavePixelExt; /* PIXEXT */ + FxBool HaveTextureBufferExt; /* TEXTUREBUFFER */ + FxBool HaveTexFmtExt; /* TEXFMT */ + FxBool HaveTexUMAExt; /* TEXUMA */ + FxBool HaveTexus2; /* Texus 2 - FXT1 */ +}; + + +struct tdfx_context { + /* Set once and never changed: + */ + GLcontext *glCtx; /* The core Mesa context */ + GLvisual *glVis; /* Describes the color buffer */ + + GLuint new_state; + GLuint dirty; + + /* Mirror of hardware state, Glide parameters + */ + struct tdfx_texsource TexSource[TDFX_NUM_TMU]; + struct tdfx_texparams TexParams[TDFX_NUM_TMU]; + struct tdfx_texpalette TexPalette; + + /* Voodoo3 texture/color combine state */ + struct tdfx_combine ColorCombine; + struct tdfx_combine AlphaCombine; + struct tdfx_texcombine TexCombine[TDFX_NUM_TMU]; + + /* Voodoo5 texture/color combine state */ + struct tdfx_combine_color_ext ColorCombineExt; + struct tdfx_combine_alpha_ext AlphaCombineExt; + struct tdfx_texcombine_ext TexCombineExt[TDFX_NUM_TMU]; + + /* Tracks tex state difference between Glide and Mesa */ + struct tdfx_texstate TexState; + + GrBuffer_t DrawBuffer; /* Current draw buffer */ + GrBuffer_t ReadBuffer; /* Current read buffer */ + + struct tdfx_color Color; + struct tdfx_depth Depth; + struct tdfx_fog Fog; + struct tdfx_stencil Stencil; + struct tdfx_scissor Scissor; + struct tdfx_viewport Viewport; + struct tdfx_stipple Stipple; + + GrCullMode_t CullMode; + + struct tdfx_glide Glide; + + /* Variable-size Glide vertex formats + */ + GLuint vertsize; /* bytes per vertex */ + GLuint vertexFormat; /* the current format */ + void *layout[TDFX_NUM_LAYOUTS]; + + GLuint tmu_source[TDFX_NUM_TMU]; + GLuint tex_dest[MAX_TEXTURE_UNITS]; + GLuint numTMUs; + + GLuint SetupIndex; + GLuint SetupDone; + GLuint RenderIndex; + + GLuint IndirectTriangles; + GLuint Fallback; + + GLfloat sScale0, tScale0; + GLfloat sScale1, tScale1; + + GLuint using_fast_path, passes, multipass; + GLuint texBindNumber; + GLint tmuSrc; + + int screen_width; + int screen_height; + + GLboolean haveHwStencil; + + GLint maxPendingSwapBuffers; + + /* stuff added for DRI */ + __DRIscreenPrivate *driScreen; + __DRIcontextPrivate *driContext; + __DRIdrawablePrivate *driDrawable; + drmContext hHWContext; + drmLock *driHwLock; + int driFd; + tdfxScreenPrivate *fxScreen; + TDFXSAREAPriv *sarea; + + + /* + * Changes during execution: + */ + int width, height; /* size of window */ + int x_offset; /* distance from window left to screen left */ + int y_offset; /* distance from window top to screen top */ + int y_delta; /* distance from window bottom to screen bottom */ + + int numClipRects; + XF86DRIClipRectPtr pClipRects; + GLboolean scissoredClipRects; /* if true, pClipRects is private storage */ + + + GuTexPalette glbPalette; /* global texture palette */ + + tdfx_interp_func interp; + + points_func PointsFunc; + line_func LineFunc; + triangle_func TriangleFunc; + quad_func QuadFunc; + render_func *RenderVBRawTab; + tdfxRenderEltsFunc RenderElementsRaw; + + + tdfxStats stats; + + /* HACK: Let's get some buffering of vertices happening... + */ + GLuint *buffer; + GLuint buffer_total; + GLuint buffer_used; +}; + +#define TDFX_CONTEXT(ctx) ((tdfxContextPtr)((ctx)->DriverCtx)) + + +extern GLboolean tdfxCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ); +extern void tdfxDestroyContext( tdfxContextPtr fxMesa ); + +extern GLboolean tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, + tdfxContextPtr fxMesa ); + + +/* Color packing utilities + */ +#define TDFXPACKCOLOR332( r, g, b ) \ + (((b) & 0xe0) | (((g) & 0xe0) >> 3) | (((r) & 0xc0) >> 6)) + +#define TDFXPACKCOLOR1555( r, g, b, a ) \ + ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ + ((a) ? 0x8000 : 0)) + +#define TDFXPACKCOLOR565( r, g, b ) \ + ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) + +#define TDFXPACKCOLOR888( r, g, b ) \ + (((b) << 16) | ((g) << 8) | (r)) + +#define TDFXPACKCOLOR8888( r, g, b, a ) \ + (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) + +#define TDFXPACKCOLOR4444( r, g, b, a ) \ + ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((g) & 0xf0) | ((r) >> 4)) + +static __inline__ GrColor_t tdfxPackColor( GLuint cpp, + GLubyte r, GLubyte g, + GLubyte b, GLubyte a ) +{ + switch ( cpp ) { + case 2: + return TDFXPACKCOLOR565( r, g, b ); + case 4: + return TDFXPACKCOLOR8888( r, g, b, a ); + default: + return 0; + } +} + +#define DO_DEBUG 0 +#if DO_DEBUG +extern int TDFX_DEBUG; +#else +#define TDFX_DEBUG 0 +#endif + +#define DEBUG_ALWAYS_SYNC 0x01 +#define DEBUG_VERBOSE_API 0x02 +#define DEBUG_VERBOSE_MSG 0x04 +#define DEBUG_VERBOSE_LRU 0x08 +#define DEBUG_VERBOSE_DRI 0x10 +#define DEBUG_VERBOSE_IOCTL 0x20 +#define DEBUG_VERBOSE_2D 0x40 +#define DEBUG_VERBOSE_TEXTURE 0x80 + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_CONTEXT_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c new file mode 100644 index 000000000..ba3d3f390 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c @@ -0,0 +1,299 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c,v 1.2 2001/04/01 14:00:00 tsi Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_vb.h" +#include "tdfx_pipeline.h" +#include "tdfx_pixels.h" + +#include "enums.h" +#include "pb.h" +#if defined(USE_X86_ASM) || defined(USE_3DNOW_ASM) || defined(USE_KATMAI_ASM) +#include "X86/common_x86_asm.h" +#endif + +#define TDFX_DATE "20010305" + + +/* These are used in calls to FX_grColorMaskv() */ +const GLboolean false4[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE }; +const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE }; + + + +/* KW: Put the word Mesa in the render string because quakeworld + * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE). + * Why? + */ +static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name ) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + + switch ( name ) { + case GL_VENDOR: + return (GLubyte *)"VA Linux Systems, Inc."; + + case GL_RENDERER: { + static char buffer[128]; + char hardware[128]; + + strcpy( hardware, FX_grGetString( fxMesa, GR_HARDWARE ) ); + + if ( strcmp( hardware, "Voodoo3 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo3" ); + } + else if ( strcmp( hardware, "Voodoo Banshee (tm)" ) == 0 ) { + strcpy( hardware, "VoodooBanshee" ); + } + else if ( strcmp( hardware, "Voodoo4 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo4" ); + } + else if ( strcmp( hardware, "Voodoo5 (tm)" ) == 0 ) { + strcpy( hardware, "Voodoo5" ); + } + else { + /* Unexpected result: replace spaces with hyphens */ + int i; + for ( i = 0 ; hardware[i] ; i++ ) { + if ( hardware[i] == ' ' || hardware[i] == '\t' ) + hardware[i] = '-'; + } + } + /* Now make the GL_RENDERER string */ + sprintf( buffer, "Mesa DRI %s " TDFX_DATE, hardware ); + + /* Append any CPU-specific information. + */ +#ifdef USE_X86_ASM + if ( gl_x86_cpu_features ) { + strncat( buffer, " x86", 4 ); + } +#endif +#ifdef USE_MMX_ASM + if ( cpu_has_mmx ) { + strncat( buffer, "/MMX", 4 ); + } +#endif +#ifdef USE_3DNOW_ASM + if ( cpu_has_3dnow ) { + strncat( buffer, "/3DNow!", 7 ); + } +#endif +#ifdef USE_KATMAI_ASM + if ( cpu_has_xmm ) { + strncat( buffer, "/SSE", 4 ); + } +#endif + return (GLubyte *)buffer; + } + + default: + return NULL; + } +} + + +/* Return buffer size information. + */ +static void tdfxDDGetBufferSize( GLcontext *ctx, + GLuint *width, GLuint *height ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + *width = fxMesa->width; + *height = fxMesa->height; +} + + +static GLint tdfxDDGetParameteri( const GLcontext *ctx, GLint param ) +{ + switch ( param ) { + case DD_HAVE_HARDWARE_FOG: + return 1; + default: + return 0; + } +} + +/* + * Return the current value of the occlusion test flag and + * reset the flag (hardware counters) to false. + */ +static GLboolean get_occlusion_result( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLboolean result; + + LOCK_HARDWARE( fxMesa ); + + if (ctx->Depth.OcclusionTest) { + if (ctx->OcclusionResult) { + result = GL_TRUE; /* result of software rendering */ + } + else { + FxI32 zfail, in; + zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL); + in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN); + if (in == zfail) + result = GL_FALSE; /* geom was completely occluded */ + else + result = GL_TRUE; /* all or part of geom was visible */ + } + } + else { + result = ctx->OcclusionResultSaved; + } + + /* reset results now */ + grReset(GR_STATS_PIXELS); + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + + UNLOCK_HARDWARE( fxMesa ); + + return result; +} + + +/* + * We're only implementing this function to handle the + * GL_OCCLUSTION_TEST_RESULT_HP case. It's special because it + * has a side-effect: resetting the occlustion result flag. + */ +static GLboolean tdfxDDGetBooleanv( GLcontext *ctx, GLenum pname, + GLboolean *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetDoublev( GLcontext *ctx, GLenum pname, + GLdouble *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLdouble) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetFloatv( GLcontext *ctx, GLenum pname, + GLfloat *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLfloat) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + +static GLboolean tdfxDDGetIntegerv( GLcontext *ctx, GLenum pname, + GLint *result ) +{ + if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) { + *result = (GLint) get_occlusion_result( ctx ); + return GL_TRUE; + } + return GL_FALSE; +} + + + +#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \ + ((vis->RedBits == r) && \ + (vis->GreenBits == g) && \ + (vis->BlueBits == b) && \ + (vis->AlphaBits == a)) + +void tdfxDDInitDriverFuncs( GLcontext *ctx ) +{ + if ( MESA_VERBOSE & VERBOSE_DRIVER ) { + fprintf( stderr, "tdfx: %s()\n", __FUNCTION__ ); + } + + ctx->Driver.GetString = tdfxDDGetString; + ctx->Driver.GetBufferSize = tdfxDDGetBufferSize; + ctx->Driver.Error = NULL; + ctx->Driver.GetParameteri = tdfxDDGetParameteri; + + if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) ) + { + ctx->Driver.DrawPixels = tdfx_drawpixels_R8G8B8A8; + ctx->Driver.ReadPixels = tdfx_readpixels_R8G8B8A8; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) ) + { + ctx->Driver.DrawPixels = NULL; + ctx->Driver.ReadPixels = tdfx_readpixels_R5G6B5; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + else + { + ctx->Driver.DrawPixels = NULL; + ctx->Driver.ReadPixels = NULL; + ctx->Driver.CopyPixels = NULL; + ctx->Driver.Bitmap = NULL; + } + + ctx->Driver.RegisterVB = tdfxDDRegisterVB; + ctx->Driver.UnregisterVB = tdfxDDUnregisterVB; + ctx->Driver.ResetVB = NULL; + ctx->Driver.ResetCvaVB = NULL; + + if ( !getenv( "TDFX_NO_FAST" ) ) { + ctx->Driver.BuildPrecalcPipeline = tdfxDDBuildPrecalcPipeline; + } else { + ctx->Driver.BuildPrecalcPipeline = NULL; + } + ctx->Driver.BuildEltPipeline = NULL; + + ctx->Driver.OptimizeImmediatePipeline = NULL; + ctx->Driver.OptimizePrecalcPipeline = NULL; + + ctx->Driver.GetBooleanv = tdfxDDGetBooleanv; + ctx->Driver.GetDoublev = tdfxDDGetDoublev; + ctx->Driver.GetFloatv = tdfxDDGetFloatv; + ctx->Driver.GetIntegerv = tdfxDDGetIntegerv; + ctx->Driver.GetPointerv = NULL; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h new file mode 100644 index 000000000..dbb585e3b --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h @@ -0,0 +1,47 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h,v 1.1 2001/03/21 16:14:27 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_DD_H__ +#define __TDFX_DD_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern void tdfxDDInitDriverFuncs( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c new file mode 100644 index 000000000..8d91dfb88 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c @@ -0,0 +1,594 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "types.h" +#include "enums.h" +#include "cva.h" +#include "vertices.h" +#include "mmath.h" + +#include "tdfx_context.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" +#include "tdfx_pipeline.h" + + +struct tdfx_fast_tab { + void (*build_vertices)( struct vertex_buffer *VB, GLuint do_cliptest ); + void (*interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J ); + void (*project_vertices)( struct vertex_buffer *VB ); + void (*project_clipped_vertices)( struct vertex_buffer *VB ); +}; + + +#define POINT(x) tdfx_draw_point( fxMesa, &vert[x], psize ) +#define LINE(x,y) tdfx_draw_line( fxMesa, &vert[x], &vert[y], lwidth ) +#define TRI(x,y,z) grDrawTriangle( &vert[x], &vert[y], &vert[z] ); + + +#define INDIRECT_TRI(x,y,z) \ +do { \ + out[next_elt + 0] = &vert[x]; \ + out[next_elt + 1] = &vert[y]; \ + out[next_elt + 2] = &vert[z]; \ + next_elt += 3; \ +} while (0) + + + +/* Direct, and no clipping required. The clip funcs have not been + * written yet, so this is only useful for the fast path. + */ +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint e; \ + for ( e = start ; e < count ; e++ ) \ + POINT( elt[e] ); \ +} while (0) + +#define RENDER_LINE( i1, i ) \ +do { \ + GLuint e1 = elt[i1], e = elt[i]; \ + LINE( e1, e ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + if ( parity ) { \ + GLuint tmp = e2; e2 = e1; e1 = tmp; \ + } \ + TRI( e2, e1, e ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + TRI( e3, e2, e ); \ + TRI( e2, e1, e ); \ +} while (0) + +#define LOCAL_VARS \ + tdfxVertexPtr vert = TDFX_DRIVER_DATA(VB)->verts; \ + const GLuint *elt = VB->EltPtr->data; \ + GLcontext *ctx = VB->ctx; \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + const GLfloat lwidth = ctx->Line.Width; \ + const GLfloat psize = ctx->Point.Size; \ + (void) lwidth; (void) psize; (void) vert; (void) fxMesa; + +#define TAG(x) tdfx_##x##_smooth_direct +#include "render_tmp.h" + + + +/* Indirect, and no clipping required. The clip funcs have not been + * written yet, so this is only useful for the fast path. + */ +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint e; \ + for ( e = start ; e < count ; e++ ) \ + POINT( elt[e] ); \ +} while (0) + +#define RENDER_LINE( i1, i ) \ +do { \ + GLuint e1 = elt[i1], e = elt[i]; \ + LINE( e1, e ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + if ( parity ) { \ + GLuint tmp = e2; e2 = e1; e1 = tmp; \ + } \ + INDIRECT_TRI( e2, e1, e ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ + TRI( e3, e2, e ); \ + TRI( e2, e1, e ); \ +} while (0) + +#define LOCAL_VARS \ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); \ + tdfxVertexPtr vert = fxVB->verts; \ + GLuint next_elt = fxVB->last_elt; \ + tdfxVertexPtr *out = fxVB->elts; \ + const GLuint *elt = VB->EltPtr->data; \ + GLcontext *ctx = VB->ctx; \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + const GLfloat lwidth = ctx->Line.Width; \ + const GLfloat psize = ctx->Point.Size; \ + (void) lwidth; (void) psize; (void) vert; (void) out; (void) fxMesa; + +#define POSTFIX \ + fxVB->last_elt = next_elt; + +#define TAG(x) tdfx_##x##_smooth_indirect +#include "render_tmp.h" + + + +#define NEGATIVE(f) (f < 0) +#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) +#define LINTERP(T, A, B) ((A) + (T) * ((B) - (A))) + +#define INTERP_RGBA( t, out, a, b ) \ +do { \ + int i; \ + for ( i = 0 ; i < 4 ; i++ ) { \ + GLfloat fa = UBYTE_COLOR_TO_FLOAT_COLOR( a[i] ); \ + GLfloat fb = UBYTE_COLOR_TO_FLOAT_COLOR( b[i] ); \ + GLfloat fo = LINTERP( t, fa, fb ); \ + FLOAT_COLOR_TO_UBYTE_COLOR( out[i], fo ); \ + } \ +} while (0) + +#define CLIP( SGN, V, PLANE ) \ +do { \ + if ( mask & PLANE ) { \ + GLuint *indata = inlist[in]; \ + GLuint *outdata = inlist[in ^= 1]; \ + GLuint nr = n; \ + GLfloat *J = verts[indata[nr-1]].f; \ + GLfloat dpJ = (SGN J[V]) + J[3]; \ + \ + inlist[0] = vlist1; \ + for ( i = n = 0 ; i < nr ; i++ ) { \ + GLuint elt_i = indata[i]; \ + GLfloat *I = verts[elt_i].f; \ + GLfloat dpI = (SGN I[V]) + I[3]; \ + \ + if ( DIFFERENT_SIGNS( dpI, dpJ ) ) { \ + GLfloat *O = verts[next_vert].f; \ + GLfloat t, *in, *out; \ + \ + if ( NEGATIVE( dpI ) ) { \ + t = dpI / (dpI - dpJ); \ + in = I; \ + out = J; \ + } else { \ + t = dpJ / (dpJ - dpI); \ + in = J; \ + out = I; \ + } \ + \ + interp( t, O, in, out ); \ + \ + clipmask[next_vert] = 0; \ + outdata[n++] = next_vert++; \ + } \ + \ + clipmask[elt_i] |= PLANE; /* don't set up */ \ + \ + if ( !NEGATIVE( dpI ) ) { \ + outdata[n++] = elt_i; \ + clipmask[elt_i] &= ~PLANE; /* set up after all */ \ + } \ + \ + J = I; \ + dpJ = dpI; \ + } \ + \ + if ( n < 3 ) return; \ + } \ +} while (0) + +#define LINE_CLIP( x, y, z, w, PLANE ) \ +do { \ + if ( mask & PLANE ) { \ + GLfloat dpI = DOT4V( I, x, y, z, w ); \ + GLfloat dpJ = DOT4V( J, x, y, z, w ); \ + \ + if ( DIFFERENT_SIGNS( dpI, dpJ ) ) { \ + GLfloat *O = verts[next_vert].f; \ + GLfloat t = dpI / (dpI - dpJ); \ + \ + interp( t, O, I, J ); \ + \ + clipmask[next_vert] = 0; \ + \ + if ( NEGATIVE( dpI ) ) { \ + clipmask[elts[0]] |= PLANE; \ + I = O; \ + elts[0] = next_vert++; \ + } else { \ + clipmask[elts[1]] |= PLANE; \ + J = O; \ + elts[1] = next_vert++; \ + } \ + } else if ( NEGATIVE( dpI ) ) { \ + return; \ + } \ + } \ +} while (0) + + +static __inline void tdfx_tri_clip( GLuint **p_elts, + tdfxVertex *verts, + GLubyte *clipmask, + GLuint *p_next_vert, + GLubyte mask, + tdfx_interp_func interp ) +{ + GLuint *elts = *p_elts; + GLuint next_vert = *p_next_vert; + GLuint in = 0; + GLuint n = 3; + GLuint vlist1[VB_MAX_CLIPPED_VERTS]; + GLuint vlist2[VB_MAX_CLIPPED_VERTS]; + GLuint *inlist[2]; + GLuint *out; + GLuint i; + + inlist[0] = elts; + inlist[1] = vlist2; + + CLIP( -, 0, CLIP_RIGHT_BIT ); + CLIP( +, 0, CLIP_LEFT_BIT ); + CLIP( -, 1, CLIP_TOP_BIT ); + CLIP( +, 1, CLIP_BOTTOM_BIT ); + CLIP( -, 2, CLIP_FAR_BIT ); + CLIP( +, 2, CLIP_NEAR_BIT ); + + /* Convert the planar polygon to a list of triangles */ + out = inlist[in]; + + for ( i = 2 ; i < n ; i++ ) { + elts[0] = out[0]; + elts[1] = out[i-1]; + elts[2] = out[i]; + elts += 3; + } + + *p_next_vert = next_vert; + *p_elts = elts; +} + + +static __inline void tdfx_line_clip( GLuint **p_elts, + tdfxVertex *verts, + GLubyte *clipmask, + GLuint *p_next_vert, + GLubyte mask, + tdfx_interp_func interp ) +{ + GLuint *elts = *p_elts; + GLfloat *I = verts[elts[0]].f; + GLfloat *J = verts[elts[1]].f; + GLuint next_vert = *p_next_vert; + + LINE_CLIP( 1, 0, 0, -1, CLIP_LEFT_BIT ); + LINE_CLIP( -1, 0, 0, 1, CLIP_RIGHT_BIT ); + LINE_CLIP( 0, 1, 0, -1, CLIP_TOP_BIT ); + LINE_CLIP( 0, -1, 0, 1, CLIP_BOTTOM_BIT ); + LINE_CLIP( 0, 0, 1, -1, CLIP_FAR_BIT ); + LINE_CLIP( 0, 0, -1, 1, CLIP_NEAR_BIT ); + + *p_next_vert = next_vert; + *p_elts += 2; +} + + +#define CLIP_POINT( e ) \ +do { \ + if ( mask[e] ) *out++ = e; \ +} while (0) + +#define CLIP_LINE( e1, e0 ) \ +do { \ + GLubyte ormask = mask[e0] | mask[e1]; \ + out[0] = e1; \ + out[1] = e0; \ + out += 2; \ + if ( ormask ) { \ + out-=2; \ + if ( !(mask[e0] & mask[e1]) ) { \ + tdfx_line_clip( &out, verts, mask, \ + &next_vert, ormask, interp ); \ + } \ + } \ +} while (0) + +#define CLIP_TRIANGLE( e2, e1, e0 ) \ +do { \ + GLubyte ormask; \ + out[0] = e2; \ + out[1] = e1; \ + out[2] = e0; \ + out += 3; \ + ormask = mask[e2] | mask[e1] | mask[e0]; \ + if ( ormask ) { \ + out -= 3; \ + if ( !(mask[e2] & mask[e1] & mask[e0]) ) { \ + tdfx_tri_clip( &out, verts, mask, \ + &next_vert, ormask, interp ); \ + } \ + } \ +} while (0) + + + +/* Build a table of functions to clip each primitive type. These + * produce a list of elements in the appropriate 'reduced' primitive, + * ie (points, lines, triangles) containing all the clipped and + * unclipped primitives from the original list. + */ +#define LOCAL_VARS \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx); \ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); \ + GLuint *elt = VB->EltPtr->data; \ + tdfxVertexPtr verts = fxVB->verts; \ + GLuint next_vert = fxVB->last_vert; \ + GLuint *out = fxVB->clipped_elements.data; \ + GLubyte *mask = VB->ClipMask; \ + tdfx_interp_func interp = fxMesa->interp; \ + (void) interp; (void) verts; + +#define POSTFIX \ + fxVB->clipped_elements.count = out - fxVB->clipped_elements.data; \ + fxVB->last_vert = next_vert; + + +#define INIT( x ) + +#define RENDER_POINTS( start, count ) \ +do { \ + GLuint i; \ + for ( i = start ; i < count ; i++ ) \ + CLIP_POINT( elt[i] ); \ +} while (0) + +#define RENDER_LINE( i1, i0 ) \ +do { \ + CLIP_LINE( elt[i1], elt[i0] ); \ +} while (0) + +#define RENDER_TRI( i2, i1, i0, pv, parity ) \ +do { \ + GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ + if ( parity ) e2 = elt[i1], e1 = elt[i2]; \ + CLIP_TRIANGLE( e2, e1, e0 ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i0, pv ) \ +do { \ + CLIP_TRIANGLE( elt[i3], elt[i2], elt[i0] ); \ + CLIP_TRIANGLE( elt[i2], elt[i1], elt[i0] ); \ +} while (0) + +#define TAG(x) tdfx_##x##_clip_elt +#include "render_tmp.h" + + + + +/* Pack rgba and/or texture into the remaining half of a 32 byte vertex. + */ +#define CLIP_UBYTE_COLOR 4 +#define CLIP_UBYTE_B 0 +#define CLIP_UBYTE_G 1 +#define CLIP_UBYTE_R 2 +#define CLIP_UBYTE_A 3 +#define CLIP_S0 6 +#define CLIP_T0 7 +#define CLIP_S1 8 +#define CLIP_T1 9 + +#define TYPE (0) +#define TAG(x) x +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT) +#define TAG(x) x##_RGBA +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_TEX0_BIT) +#define TAG(x) x##_TEX0 +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT | TDFX_TEX0_BIT) +#define TAG(x) x##_RGBA_TEX0 +#include "tdfx_fasttmp.h" + +#define TYPE (TDFX_RGBA_BIT | TDFX_TEX0_BIT | TDFX_TEX1_BIT) +#define TAG(x) x##_RGBA_TEX0_TEX1 +#include "tdfx_fasttmp.h" + +/* This one *could* get away with sneaking TEX1 into the color and + * specular slots, thus fitting inside a cache line. Would be even + * better to switch to a smaller vertex. + */ +#define TYPE (TDFX_TEX0_BIT | TDFX_TEX1_BIT) +#define TAG(x) x##_TEX0_TEX1 +#include "tdfx_fasttmp.h" + + + +/* Render elements directly from original list of vertices. + */ +static void tdfx_render_elements_direct( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_smooth_direct[prim]; + GLuint p = 0; + + if ( fxMesa->new_state ) + tdfxDDUpdateHwState( ctx ); + + BEGIN_CLIP_LOOP( fxMesa ); + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + END_CLIP_LOOP( fxMesa ); +} + +/* Render elements indirectly from original list of vertices. + */ +#if 0 +static void tdfx_render_elements_indirect( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_smooth_indirect[prim]; + GLuint p = 0; + + if ( fxMesa->new_state ) + tdfxDDUpdateHwState( ctx ); + + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + + BEGIN_CLIP_LOOP( fxMesa ); + grDrawVertexArray( GR_TRIANGLES, fxVB->last_elt, fxVB->elts ); + END_CLIP_LOOP( fxMesa ); + + fxVB->last_elt = 0; +} +#endif + +/* Very sparsely popluated array - fix the indices. + */ +static struct tdfx_fast_tab fxFastTab[0x80]; + +void tdfxDDFastPathInit( void ) +{ + tdfx_render_init_clip_elt(); + tdfx_render_init_smooth_direct(); + tdfx_render_init_smooth_indirect(); + + tdfx_init_fastpath( &fxFastTab[0] ); + tdfx_init_fastpath_RGBA( &fxFastTab[TDFX_RGBA_BIT] ); + tdfx_init_fastpath_TEX0( &fxFastTab[TDFX_TEX0_BIT] ); + tdfx_init_fastpath_RGBA_TEX0( &fxFastTab[TDFX_RGBA_BIT|TDFX_TEX0_BIT] ); + tdfx_init_fastpath_TEX0_TEX1( &fxFastTab[TDFX_TEX0_BIT|TDFX_TEX1_BIT] ); + tdfx_init_fastpath_RGBA_TEX0_TEX1( &fxFastTab[TDFX_RGBA_BIT|TDFX_TEX0_BIT| + TDFX_TEX1_BIT] ); +} + + +#define VALID_SETUP (TDFX_RGBA_BIT | TDFX_TEX0_BIT | TDFX_TEX1_BIT) + + +void tdfxDDFastPath( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + GLenum prim = ctx->CVA.elt_mode; + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + struct tdfx_fast_tab *tab = &fxFastTab[fxMesa->SetupIndex & VALID_SETUP]; + + if ( fxMesa->new_state ) { + tdfxDDUpdateHwState( ctx ); + } + else if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) { + /* After extensive debugging I discovered that the vertex layout + * may need to be updated at this point. Not sure how this works + * in the other drivers. -BP + */ + LOCK_HARDWARE( fxMesa ); + grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] ); + fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT; + UNLOCK_HARDWARE( fxMesa ); + } + + gl_prepare_arrays_cva( VB ); /* still need this */ + + /* Reserve enough space for the pathological case */ + if ( VB->EltPtr->count * 12 > fxVB->size ) + tdfxDDResizeVB( VB, VB->EltPtr->count * 12 ); + + tab->build_vertices( VB, 1 ); /* object->clip space */ + + if ( VB->ClipOrMask ) { + if ( !VB->ClipAndMask ) { + render_func *clip = tdfx_render_tab_clip_elt; + + fxMesa->interp = tab->interp; + + clip[prim]( VB, 0, VB->EltPtr->count, 0 ); /* build new elts */ + + ctx->CVA.elt_mode = gl_reduce_prim[prim]; + VB->EltPtr = &(fxVB->clipped_elements); + + tab->project_clipped_vertices( VB ); /* clip->device space */ + tdfx_render_elements_direct( VB ); /* render using new list */ + } + } else { + tab->project_vertices( VB ); /* clip->device space */ + tdfx_render_elements_direct( VB ); /* render using orig list */ + } + + /* This indicates that there is no cached data to reuse */ + VB->pipeline->data_valid = 0; + VB->pipeline->new_state = 0; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h new file mode 100644 index 000000000..ab97a3895 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h @@ -0,0 +1,293 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_fasttmp.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +/* The first part of setup is applied to all vertices, clipped or + * unclipped. This data will be used for clipping, and then all + * vertices with a zero clipmask will be projected to device space. + * + * This could be split into several loops, but - it seems that the + * large stride of the fxVertices makes cache issues the big + * performance factor, and that multiple loops mean multiple cache + * misses.... + */ + +static void TAG(tdfx_setup_full)( struct vertex_buffer *VB, + GLuint do_cliptest ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLfloat * const m = ctx->ModelProjectMatrix.m; + GLuint start = VB->CopyStart; + GLuint count = VB->Count; + + if (0) fprintf(stderr, "%s\n", __FUNCTION__); + + gl_xform_points3_v16_general( TDFX_DRIVER_DATA(VB)->verts[start].f, + m, + VB->ObjPtr->start, + VB->ObjPtr->stride, + count - start ); + + if ( do_cliptest ) { + VB->ClipAndMask = ~0; + VB->ClipOrMask = 0; + gl_cliptest_points4_v16( fxVB->verts[start].f, + fxVB->verts[count].f, + &(VB->ClipOrMask), + &(VB->ClipAndMask), + VB->ClipMask + start ); + } + + /* These branches are all resolved at compile time. Hopefully all + * the pointers are valid addresses even when not enabled. + */ + if ( TYPE ) { + GLubyte *color = VB->ColorPtr->start; + GLfloat *tex0_data = VB->TexCoordPtr[fxMesa->tmu_source[0]]->start; + GLfloat *tex1_data = VB->TexCoordPtr[fxMesa->tmu_source[1]]->start; + + const GLuint color_stride = VB->ColorPtr->stride; + const GLuint tex0_stride = VB->TexCoordPtr[fxMesa->tmu_source[0]]->stride; + const GLuint tex1_stride = VB->TexCoordPtr[fxMesa->tmu_source[1]]->stride; + + GLfloat *f = fxVB->verts[start].f; + GLfloat *end = f + (16 * (count - start)); + + while ( f != end ) { + if ( TYPE & TDFX_RGBA_BIT ) { +#if defined(USE_X86_ASM) + __asm__ ( + "movl (%%edx),%%eax \n" + "bswap %%eax \n" + "rorl $8,%%eax \n" + "movl %%eax,16(%%edi) \n" + : + : "d" (color), "D" (f) + : "%eax" ); +#else + GLubyte *col = color; + GLubyte *b = (GLubyte *)&f[CLIP_UBYTE_COLOR]; + b[CLIP_UBYTE_B] = col[2]; + b[CLIP_UBYTE_G] = col[1]; + b[CLIP_UBYTE_R] = col[0]; + b[CLIP_UBYTE_A] = col[3]; +#endif + } + if (TYPE & TDFX_TEX0_BIT) { +#if defined (USE_X86_ASM) + __asm__ ( + "movl (%%ecx), %%eax \n" + "movl %%eax, 24(%%edi) \n" + "movl 4(%%ecx), %%eax \n" + "movl %%eax, 28(%%edi)" + : + : "c" (tex0_data), "D" (f) + : "%eax"); +#else + *(unsigned int *)(f+CLIP_S0) = *(unsigned int *)tex0_data; + *(unsigned int *)(f+CLIP_T0) = *(unsigned int *)(tex0_data+1); +#endif + } + if (TYPE & TDFX_TEX1_BIT) { + /* Hits a second cache line. + */ +#if defined (USE_X86_ASM) + __asm__ ( + "movl (%%esi), %%eax \n" + "movl %%eax, 32(%%edi) \n" + "movl 4(%%esi), %%eax \n" + "movl %%eax, 36(%%edi)" + : + : "S" (tex1_data), "D" (f) + : "%eax"); +#else + *(unsigned int *)(f+CLIP_S1) = *(unsigned int *)tex1_data; + *(unsigned int *)(f+CLIP_T1) = *(unsigned int *)(tex1_data+1); +#endif + } + if ( TYPE & TDFX_RGBA_BIT ) color += color_stride; + if ( TYPE & TDFX_TEX0_BIT ) STRIDE_F( tex0_data, tex0_stride ); + if ( TYPE & TDFX_TEX1_BIT ) STRIDE_F( tex1_data, tex1_stride ); + f += 16; + } + } + + fxVB->clipped_elements.count = start; + fxVB->last_vert = count; +} + + +/* Changed to just put the interp func instead of the whole clip + * routine into the header. Less code and better chance of doing some + * of this stuff in assembly. + */ +static void TAG(tdfx_interp_vert)( GLfloat t, + GLfloat *O, + const GLfloat *I, + const GLfloat *J ) +{ + O[0] = LINTERP( t, I[0], J[0] ); + O[1] = LINTERP( t, I[1], J[1] ); + O[2] = LINTERP( t, I[2], J[2] ); + O[3] = LINTERP( t, I[3], J[3] ); + + if ( TYPE & TDFX_RGBA_BIT ) { + INTERP_RGBA( t, + ((GLubyte *)&(O[4])), + ((GLubyte *)&(I[4])), + ((GLubyte *)&(J[4])) ); + } + + if ( TYPE & TDFX_TEX0_BIT ) { + O[6] = LINTERP( t, I[6], J[6] ); + O[7] = LINTERP( t, I[7], J[7] ); + } + + if ( TYPE & TDFX_TEX1_BIT ) { + O[8] = LINTERP( t, I[8], J[8] ); + O[9] = LINTERP( t, I[9], J[9] ); + } +} + + + +static void TAG(tdfx_project_vertices)( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + GLmatrix *mat = &ctx->Viewport.WindowMap; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLfloat *first = fxVB->verts[VB->CopyStart].f; + GLfloat *last = fxVB->verts[fxVB->last_vert].f; + GLfloat m[16]; + GLfloat *f; + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX] + fxMesa->x_offset + TRI_X_OFFSET; + m[MAT_SY] = mat->m[MAT_SY]; + m[MAT_TY] = mat->m[MAT_TY] + fxMesa->y_delta + TRI_Y_OFFSET; + m[MAT_SZ] = mat->m[MAT_SZ]; + m[MAT_TZ] = mat->m[MAT_TZ]; + + gl_project_v16( first, last, m, 16 * 4 ); + + /* V3 at least requires texcoords to be multiplied by 1/w: + */ + if ( TYPE & (TDFX_TEX0_BIT|TDFX_TEX1_BIT) ) { + + const GLfloat sScale0 = fxMesa->sScale0; + const GLfloat tScale0 = fxMesa->tScale0; + const GLfloat sScale1 = fxMesa->sScale1; + const GLfloat tScale1 = fxMesa->tScale1; + + + for ( f = first ; f != last ; f += 16) { + const GLfloat oow = f[3]; + + if (TYPE & TDFX_TEX0_BIT) { + f[CLIP_S0] *= sScale0 * oow; + f[CLIP_T0] *= tScale0 * oow; + } + + if (TYPE & TDFX_TEX1_BIT) { + f[CLIP_S1] *= sScale1 * oow; + f[CLIP_T1] *= tScale1 * oow; + } + } + } +} + +static void TAG(tdfx_project_clipped_vertices)( struct vertex_buffer *VB ) +{ + GLfloat *f; + + GLcontext *ctx = VB->ctx; + GLmatrix *mat = &ctx->Viewport.WindowMap; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + GLfloat *first = fxVB->verts[VB->CopyStart].f; + GLfloat *last = fxVB->verts[fxVB->last_vert].f; + const GLubyte *mask = VB->ClipMask + VB->CopyStart; + GLfloat m[16]; + + m[MAT_SX] = mat->m[MAT_SX]; + m[MAT_TX] = mat->m[MAT_TX] + fxMesa->x_offset + TRI_X_OFFSET; + m[MAT_SY] = mat->m[MAT_SY]; + m[MAT_TY] = mat->m[MAT_TY] + fxMesa->y_delta + TRI_Y_OFFSET; + m[MAT_SZ] = mat->m[MAT_SZ]; + m[MAT_TZ] = mat->m[MAT_TZ]; + + gl_project_clipped_v16( first, last, m, 16 * 4, mask ); + + /* V3 at least requires texcoords to be multiplied by 1/w: + */ + if ( TYPE & (TDFX_TEX0_BIT|TDFX_TEX1_BIT) ) { + + const GLfloat sScale0 = fxMesa->sScale0; + const GLfloat tScale0 = fxMesa->tScale0; + const GLfloat sScale1 = fxMesa->sScale1; + const GLfloat tScale1 = fxMesa->tScale1; + + for ( f = first ; f != last ; f += 16, mask++) { + if (!*mask) { + const GLfloat oow = f[3]; + if (TYPE & TDFX_TEX0_BIT) { + f[CLIP_S0] *= sScale0 * oow; + f[CLIP_T0] *= tScale0 * oow; + } + + if (TYPE & TDFX_TEX1_BIT) { + f[CLIP_S1] *= sScale1 * oow; + f[CLIP_T1] *= tScale1 * oow; + } + } + } + } +} + +static void TAG(tdfx_init_fastpath)( struct tdfx_fast_tab *tab ) +{ + tab->build_vertices = TAG(tdfx_setup_full); + tab->interp = TAG(tdfx_interp_vert); + tab->project_vertices = TAG(tdfx_project_vertices); + tab->project_clipped_vertices = TAG(tdfx_project_clipped_vertices); +} + +#undef TYPE +#undef TAG +#undef SIZE diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c new file mode 100644 index 000000000..50d055b7f --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c @@ -0,0 +1,122 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include <stdlib.h> +#include <string.h> +#include <dlfcn.h> + +#include "tdfx_context.h" +#include "tdfx_g3ext.h" + + +/* STENCIL extension + */ +GrProc grStencilFuncProc = NULL; +GrProc grStencilMaskProc = NULL; +GrProc grStencilOpProc = NULL; +GrProc grBufferClearExtProc = NULL; +GrProc grColorMaskExtProc = NULL; + +/* COMBINE extension + */ +GrProc grColorCombineExtProc = NULL; +GrProc grTexColorCombineExtProc = NULL; +GrProc grAlphaCombineExtProc = NULL; +GrProc grTexAlphaCombineExtProc = NULL; +GrProc grAlphaBlendFunctionExtProc = NULL; +GrProc grConstantColorValueExtProc = NULL; + +/* Texus 2 + */ +GrProc txImgQuantizeProc = NULL; +GrProc txImgDequantizeFXT1Proc = NULL; +GrProc txErrorSetCallbackProc = NULL; + + +/* Initialize the Glide extensions not exported in the Glide headers. + * This is just plain evil stuff... + */ +void tdfxDDGlideExtensionsInit( void ) +{ + void *handle; + + /* Get Glide3 extension function pointers */ + handle = dlopen( NULL, RTLD_NOW | RTLD_GLOBAL ); + + if ( handle ) { + /* PIXEXT extension */ + grStencilFuncProc = dlsym( handle, "grStencilFunc" ); + grStencilMaskProc = dlsym( handle, "grStencilMask" ); + grStencilOpProc = dlsym( handle, "grStencilOp" ); + grBufferClearExtProc = dlsym( handle, "grBufferClearExt" ); + grColorMaskExtProc = dlsym( handle, "grColorMaskExt" ); + + /* COMBINE extension */ + grColorCombineExtProc = dlsym( handle, "grColorCombineExt" ); + grTexColorCombineExtProc = dlsym( handle, "grTexColorCombineExt" ); + grAlphaCombineExtProc = dlsym( handle, "grAlphaCombineExt" ); + grTexAlphaCombineExtProc = dlsym( handle, "grTexAlphaCombineExt" ); + grAlphaBlendFunctionExtProc = dlsym( handle, "grAlphaBlendFunctionExt" ); + grConstantColorValueExtProc = dlsym( handle, "grConstantColorValueExt" ); + + /* Texus 2 */ + txImgQuantizeProc = dlsym( handle, "txImgQuantize" ); + txImgDequantizeFXT1Proc = dlsym( handle, "_txImgDequantizeFXT1" ); + txErrorSetCallbackProc = dlsym( handle, "txErrorSetCallback" ); + } else { + /* PIXEXT extension */ + grStencilFuncProc = NULL; + grStencilMaskProc = NULL; + grStencilOpProc = NULL; + grBufferClearExtProc = NULL; + grColorMaskExtProc = NULL; + + /* COMBINE extension */ + grColorCombineExtProc = NULL; + grTexColorCombineExtProc = NULL; + grAlphaCombineExtProc = NULL; + grTexAlphaCombineExtProc = NULL; + grAlphaBlendFunctionExtProc = NULL; + grConstantColorValueExtProc = NULL; + + /* Texus 2 */ + txImgQuantizeProc = NULL; + txImgDequantizeFXT1Proc = NULL; + txErrorSetCallbackProc = NULL; + } + + dlclose( handle ); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h new file mode 100644 index 000000000..1595051c9 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h @@ -0,0 +1,145 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_g3ext.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_G3EXT_H__ +#define __TDFX_G3EXT_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include <glide.h> +#include <g3ext.h> + +/* + * These are glide extension definitions. These are not + * defined in glide.h. They should really be defined in + * g3ext.h, but they are not. + */ +typedef void (*grStencilFunc_t)( GrCmpFnc_t fnc, GrStencil_t ref, + GrStencil_t mask ); +typedef void (*grStencilMask_t)( GrStencil_t write_mask ); +typedef void (*grStencilOp_t)( GrStencilOp_t stencil_fail, + GrStencilOp_t depth_fail, + GrStencilOp_t depth_pass ); +typedef void (*grBufferClearExt_t)( GrColor_t color, GrAlpha_t alpha, + FxU32 depth, GrStencil_t stencil ); +typedef void (*grColorMaskExt_t)( FxBool r, FxBool g, FxBool b, FxBool a ); + +/* + * "COMBINE" extension for Napalm + */ +typedef void (*grColorCombineExt_t)( GrCCUColor_t a, GrCombineMode_t a_mode, + GrCCUColor_t b, GrCombineMode_t b_mode, + GrCCUColor_t c, FxBool c_invert, + GrCCUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grTexColorCombineExt_t)( FxU32 tmu, + GrTCCUColor_t a, + GrCombineMode_t a_mode, + GrTCCUColor_t b, + GrCombineMode_t b_mode, + GrTCCUColor_t c, FxBool c_invert, + GrTCCUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grAlphaCombineExt_t)( GrACUColor_t a, GrCombineMode_t a_mode, + GrACUColor_t b, GrCombineMode_t b_mode, + GrACUColor_t c, FxBool c_invert, + GrACUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grTexAlphaCombineExt_t)( FxU32 tmu, + GrTACUColor_t a, + GrCombineMode_t a_mode, + GrTACUColor_t b, + GrCombineMode_t b_mode, + GrTACUColor_t c, FxBool c_invert, + GrTACUColor_t d, FxBool d_invert, + FxU32 shift, FxBool invert ); +typedef void (*grAlphaBlendFunctionExt_t)( GrAlphaBlendFnc_t rgb_sf, + GrAlphaBlendFnc_t rgb_df, + GrAlphaBlendOp_t rgb_op, + GrAlphaBlendFnc_t alpha_sf, + GrAlphaBlendFnc_t alpha_df, + GrAlphaBlendOp_t alpha_op); +typedef void (*grConstantColorValueExt_t)( FxU32 tmu, GrColor_t value ); + + + +/* + * These are functions to compress and decompress images. + * The types of the first and second parameters are not exactly + * right. The texus library declares them to be "char *", not + * "void *". However, "void *" is more correct, and more convenient. + */ +typedef void (*txImgQuantize_t)( void *dst, void *src, + int w, int h, + FxU32 format, FxU32 dither ); +typedef void (*txImgDeQuantize_t)( void *dst, void *src, int w, int h ); + +/* + * These next three declarations should probably be taken from + * texus.h. However, there are duplicate declarations in g3ext.h + * and texus.h which make it hard to include them both. + */ +typedef void (*TxErrorCallbackFnc_t)( const char *string, FxBool fatal ); +typedef void (*txErrorSetCallback_t)( TxErrorCallbackFnc_t fnc, + TxErrorCallbackFnc_t *old_fnc ); + +/* PIXEXT extension + */ +GrProc grStencilFuncProc; +GrProc grStencilMaskProc; +GrProc grStencilOpProc; +GrProc grBufferClearExtProc; +GrProc grColorMaskExtProc; + +/* COMBINE extension + */ +GrProc grColorCombineExtProc; +GrProc grTexColorCombineExtProc; +GrProc grAlphaCombineExtProc; +GrProc grTexAlphaCombineExtProc; +GrProc grAlphaBlendFunctionExtProc; +GrProc grConstantColorValueExtProc; + +/* Texus extensions??? + */ +GrProc txImgQuantizeProc; +GrProc txImgDequantizeFXT1Proc; +GrProc txErrorSetCallbackProc; + +extern void tdfxDDGlideExtensionsInit( void ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c new file mode 100644 index 000000000..d98231629 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c @@ -0,0 +1,96 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include "dri_glide.h" + +#include "tdfx_context.h" +#include "tdfx_lock.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" +#include "tdfx_tris.h" + + +void tdfxGetLock( tdfxContextPtr fxMesa ) +{ + __DRIcontextPrivate *cPriv = fxMesa->driContext; + __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv; + __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; + TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + + fxMesa->fxScreen->sarea_priv_offset); + int stamp = dPriv->lastStamp; + int one_rect = (fxMesa->numClipRects <= 1); + + drmGetLock( fxMesa->driFd, fxMesa->hHWContext, 0 ); + + /* This macro will update dPriv's cliprects if needed */ + XMESA_VALIDATE_DRAWABLE_INFO( cPriv->display, sPriv, dPriv ); + + if ( saPriv->fifoOwner != fxMesa->hHWContext ) { + grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead ); + } + + if ( saPriv->ctxOwner != fxMesa->hHWContext ) { + /* This sequence looks a little odd. Glide mirrors the state, and + * when you get the state you are forcing the mirror to be up to + * date, and then getting a copy from the mirror. You can then force + * that state onto the hardware when you set the state. + */ + void *state; + state = malloc( FX_grGetInteger_NoLock( FX_GLIDE_STATE_SIZE ) ); + FX_grGlideGetState_NoLock( state ); + FX_grGlideSetState_NoLock( state ); + free( state ); + } + +#if 0 + if ( saPriv->texOwner != fxMesa->hHWContext ) { + tdfxTMRestoreTextures_NoLock( fxMesa ); + } +#endif + + if ( *dPriv->pStamp != stamp || saPriv->ctxOwner != fxMesa->hHWContext ) { + tdfxUpdateClipping(fxMesa->glCtx); + tdfxUploadClipping(fxMesa); + } + + /* Detect if we have swapped between 1 and >1 cliprects, and change + * triangle funcs if necessary. + */ + if (one_rect != (fxMesa->numClipRects <= 1)) + tdfxDDToggleTriCliprects( fxMesa->glCtx ); + + DEBUG_LOCK(); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h new file mode 100644 index 000000000..19e57f092 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h @@ -0,0 +1,149 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_LOCK_H__ +#define __TDFX_LOCK_H__ + +#ifdef GLX_DIRECT_RENDERING + +/* You can turn this on to find locking conflicts. + */ +#define DEBUG_LOCKING 0 + +#if DEBUG_LOCKING +extern char *prevLockFile; +extern int prevLockLine; + +#define DEBUG_LOCK() \ + do { \ + prevLockFile = (__FILE__); \ + prevLockLine = (__LINE__); \ + } while (0) + +#define DEBUG_RESET() \ + do { \ + prevLockFile = 0; \ + prevLockLine = 0; \ + } while (0) + +#define DEBUG_CHECK_LOCK() \ + do { \ + if ( prevLockFile ) { \ + fprintf( stderr, \ + "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \ + prevLockFile, prevLockLine, __FILE__, __LINE__ ); \ + exit( 1 ); \ + } \ + } while (0) + +#else + +#define DEBUG_LOCK() +#define DEBUG_RESET() +#define DEBUG_CHECK_LOCK() + +#endif /* DEBUG_LOCKING */ + + +extern void tdfxGetLock( tdfxContextPtr fxMesa ); + + +/* !!! We may want to separate locks from locks with validation. + This could be used to improve performance for those things + commands that do not do any drawing !!! */ + +#define DRM_LIGHT_LOCK_RETURN(fd,lock,context,__ret) \ + do { \ + DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \ + if (__ret) drmGetLock(fd,context,0); \ + } while(0) + +#define LOCK_HARDWARE( fxMesa ) \ + do { \ + char __ret = 0; \ + \ + DEBUG_CHECK_LOCK(); \ + DRM_CAS( fxMesa->driHwLock, fxMesa->hHWContext, \ + DRM_LOCK_HELD | fxMesa->hHWContext, __ret ); \ + if ( __ret ) { \ + tdfxGetLock( fxMesa ); \ + } \ + DEBUG_LOCK(); \ + } while (0) + +/* Unlock the hardware using the global current context */ +#define UNLOCK_HARDWARE( fxMesa ) \ + do { \ + DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); \ + DEBUG_RESET(); \ + } while (0) + +/* + * This pair of macros makes a loop over the drawing operations + * so it is not self contained and doesn't have the nice single + * statement semantics of most macros. + */ +#define BEGIN_CLIP_LOOP(fxMesa) \ + do { \ + LOCK_HARDWARE( fxMesa ); \ + BEGIN_CLIP_LOOP_LOCKED( fxMesa ) + +#define BEGIN_CLIP_LOOP_LOCKED(fxMesa) \ + do { \ + int _nc = fxMesa->numClipRects; \ + while (_nc--) { \ + if (fxMesa->numClipRects > 1) { \ + int _height = fxMesa->screen_height; \ + grClipWindow(fxMesa->pClipRects[_nc].x1, \ + _height - fxMesa->pClipRects[_nc].y2, \ + fxMesa->pClipRects[_nc].x2, \ + _height - fxMesa->pClipRects[_nc].y1); \ + } + + +#define END_CLIP_LOOP_LOCKED( fxMesa ) \ + } \ + } while (0) + +#define END_CLIP_LOOP( fxMesa ) \ + END_CLIP_LOOP_LOCKED( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + } while (0) + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_LOCK_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c new file mode 100644 index 000000000..370ed51f2 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c @@ -0,0 +1,177 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_pipeline.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" + +#include "vbindirect.h" + +static struct gl_pipeline_stage tdfx_fast_stage = { + "TDFX Fast Path", + (PIPE_OP_VERT_XFORM | + PIPE_OP_RAST_SETUP_0 | + PIPE_OP_RAST_SETUP_1 | + PIPE_OP_RENDER), + PIPE_PRECALC, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + tdfxDDFastPath +}; + +#define ILLEGAL_ENABLES (TEXTURE0_3D | \ + TEXTURE1_3D | \ + ENABLE_TEXMAT0 | \ + ENABLE_TEXMAT1 | \ + ENABLE_TEXGEN0 | \ + ENABLE_TEXGEN1 | \ + ENABLE_USERCLIP | \ + ENABLE_LIGHT | \ + ENABLE_FOG) + +/* Build the PRECALC pipeline with our stage, if possible. Otherwise, + * return GL_FALSE. + */ +GLboolean tdfxDDBuildPrecalcPipeline( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_pipeline *pipe = &ctx->CVA.pre; + + if ( (fxMesa->RenderIndex & ~TDFX_CLIPRECT_BIT) == 0 && + (ctx->Enabled & ILLEGAL_ENABLES) == 0 && +#ifdef VAO + (ctx->Array.Current->Flags & (VERT_OBJ_234 | +#else + (ctx->Array.Flags & (VERT_OBJ_234 | +#endif + VERT_TEX0_4 | + VERT_TEX1_4 | + VERT_ELT)) == (VERT_OBJ_23 | VERT_ELT) ) + { + pipe->stages[0] = &tdfx_fast_stage; + pipe->stages[1] = 0; + pipe->new_inputs = ctx->RenderFlags & VERT_DATA; + pipe->ops = pipe->stages[0]->ops; + + fxMesa->using_fast_path = GL_TRUE; + return GL_TRUE; + } + + if ( fxMesa->using_fast_path ) { + fxMesa->using_fast_path = GL_FALSE; + + ctx->CVA.VB->ClipOrMask = 0; + ctx->CVA.VB->ClipAndMask = CLIP_ALL_BITS; +#ifdef VAO + ctx->Array.NewArrayState |= ctx->Array.Current->Summary; +#else + ctx->Array.NewArrayState |= ctx->Array.Summary; +#endif + } + + return GL_FALSE; +} + + +static void tdfxDDCheckRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *d ) +{ + d->type = PIPE_IMMEDIATE | PIPE_PRECALC; + d->inputs = ctx->RenderFlags; + + d->outputs = VERT_SETUP_FULL; + + if ( ctx->IndirectTriangles & DD_SW_SETUP ) + d->type = PIPE_IMMEDIATE; +} + + +static void tdfxDDRenderElements(struct vertex_buffer *VB) +{ + if (VB->ClipOrMask) { + gl_render_elts( VB ); + } else { + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + fxMesa->RenderElementsRaw( VB ); + } +} + + +/* Register the pipeline with our stages included */ +GLuint tdfxDDRegisterPipelineStages( struct gl_pipeline_stage *out, + const struct gl_pipeline_stage *in, + GLuint nr ) +{ + int i, o; + + for ( i = o = 0 ; i < nr ; i++ ) { + switch ( in[i].ops ) { + + case PIPE_OP_RAST_SETUP_0: + out[o] = in[i]; + out[o].cva_state_change = (NEW_LIGHTING | + NEW_TEXTURING | + NEW_RASTER_OPS); + out[o].state_change = ~0; + out[o].check = tdfxDDCheckPartialRasterSetup; + out[o].run = tdfxDDPartialRasterSetup; + o++; + break; + + case PIPE_OP_RAST_SETUP_0 | PIPE_OP_RAST_SETUP_1: + out[o] = in[i]; + out[o].check = tdfxDDCheckRasterSetup; + out[o].run = tdfxDDDoRasterSetup; + o++; + break; + + case PIPE_OP_RENDER: + out[o] = in[i]; + if (in[i].type == PIPE_PRECALC) + out[o].run = tdfxDDRenderElements; + o++; + break; + + default: + out[o++] = in[i]; + break; + } + } + + return o; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h new file mode 100644 index 000000000..2f199a007 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h @@ -0,0 +1,54 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_pipeline.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_PIPELINE_H__ +#define __TDFX_PIPELINE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern GLboolean tdfxDDBuildPrecalcPipeline( GLcontext *ctx ); +extern GLuint tdfxDDRegisterPipelineStages( struct gl_pipeline_stage *out, + const struct gl_pipeline_stage *in, + GLuint nr ); + +extern void tdfxDDFastPathInit( void ); +extern void tdfxDDFastPath( struct vertex_buffer *VB ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c new file mode 100644 index 000000000..2afc90f93 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c @@ -0,0 +1,638 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c,v 1.2 2001/04/02 20:07:48 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Nathan Hand <nhand@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_dd.h" +#include "tdfx_vb.h" +#include "tdfx_pipeline.h" +#include "tdfx_pixels.h" +#include "tdfx_render.h" + +#include "image.h" + +#if 0 +/* test if window coord (px,py) is visible */ +static GLboolean +inClipRects(tdfxContextPtr fxMesa, int px, int py) +{ + int i; + for (i = 0; i < fxMesa->numClipRects; i++) { + if ((px >= fxMesa->pClipRects[i].x1) && + (px < fxMesa->pClipRects[i].x2) && + (py >= fxMesa->pClipRects[i].y1) && + (py < fxMesa->pClipRects[i].y2)) return GL_TRUE; + } + return GL_FALSE; +} +#endif + +/* test if rectangle of pixels (px,py) (px+width,py+height) is visible */ +static GLboolean +inClipRects_Region(tdfxContextPtr fxMesa, int x, int y, int width, int height) +{ + int i; + int x1, y1, x2, y2; + int xmin, xmax, ymin, ymax, pixelsleft; + + y1 = y - height + 1; y2 = y; + x1 = x; x2 = x + width - 1; + pixelsleft = width * height; + + for (i = 0; i < fxMesa->numClipRects; i++) + { + /* algorithm requires x1 < x2 and y1 < y2 */ + if ((fxMesa->pClipRects[i].x1 < fxMesa->pClipRects[i].x2)) { + xmin = fxMesa->pClipRects[i].x1; + xmax = fxMesa->pClipRects[i].x2-1; + } else { + xmin = fxMesa->pClipRects[i].x2; + xmax = fxMesa->pClipRects[i].x1-1; + } + if ((fxMesa->pClipRects[i].y1 < fxMesa->pClipRects[i].y2)) { + ymin = fxMesa->pClipRects[i].y1; + ymax = fxMesa->pClipRects[i].y2-1; + } else { + ymin = fxMesa->pClipRects[i].y2; + ymax = fxMesa->pClipRects[i].y1-1; + } + + /* reject trivial cases */ + if (xmax < x1) continue; + if (ymax < y1) continue; + if (xmin > x2) continue; + if (ymin > y2) continue; + + /* find the intersection */ + if (xmin < x1) xmin = x1; + if (ymin < y1) ymin = y1; + if (xmax > x2) xmax = x2; + if (ymax > y2) ymax = y2; + + pixelsleft -= (xmax-xmin+1) * (ymax-ymin+1); + } + + return pixelsleft == 0; +} + +#if 0 +GLboolean +tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte * bitmap) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + TdfxU16 color; + const struct gl_pixelstore_attrib *finalUnpack; + struct gl_pixelstore_attrib scissoredUnpack; + + /* check if there's any raster operations enabled which we can't handle */ + if (ctx->RasterMask & (ALPHATEST_BIT | + BLEND_BIT | + DEPTH_BIT | + FOG_BIT | + LOGIC_OP_BIT | + SCISSOR_BIT | + STENCIL_BIT | + MASKING_BIT | + ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; + + if (ctx->Scissor.Enabled) { + /* This is a bit tricky, but by carefully adjusting the px, py, + * width, height, skipPixels and skipRows values we can do + * scissoring without special code in the rendering loop. + */ + + /* we'll construct a new pixelstore struct */ + finalUnpack = &scissoredUnpack; + scissoredUnpack = *unpack; + if (scissoredUnpack.RowLength == 0) + scissoredUnpack.RowLength = width; + + /* clip left */ + if (px < ctx->Scissor.X) { + scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); + width -= (ctx->Scissor.X - px); + px = ctx->Scissor.X; + } + /* clip right */ + if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { + width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); + } + /* clip bottom */ + if (py < ctx->Scissor.Y) { + scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); + height -= (ctx->Scissor.Y - py); + py = ctx->Scissor.Y; + } + /* clip top */ + if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { + height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); + } + + if (width <= 0 || height <= 0) + return GL_TRUE; /* totally scissored away */ + } + else { + finalUnpack = unpack; + } + + /* compute pixel value */ + { + GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); + /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f); */ + if (fxMesa->bgrOrder) { + color = (TdfxU16) + (((TdfxU16) 0xf8 & b) << (11 - 3)) | + (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) | + (((TdfxU16) 0xf8 & r) >> 3); + } + else + color = (TdfxU16) + (((TdfxU16) 0xf8 & r) << (11 - 3)) | + (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) | + (((TdfxU16) 0xf8 & b) >> 3); + } + + info.size = sizeof(info); + if (!TDFX_grLfbLock(fxMesa, + GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_565, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { +#ifndef TDFX_SILENT + fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n"); +#endif + return GL_TRUE; + } + + { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + /* The dest stride depends on the hardware and whether we're drawing + * to the front or back buffer. This compile-time test seems to do + * the job for now. + */ + const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 2); + GLint row; + /* compute dest address of bottom-left pixel in bitmap */ + GLushort *dst = (GLushort *) info.lfbPtr + + (winY - py) * dstStride + (winX + px); + + for (row = 0; row < height; row++) { + const GLubyte *src = + (const GLubyte *) _mesa_image_address(finalUnpack, + bitmap, width, height, + GL_COLOR_INDEX, + GL_BITMAP, 0, row, 0); + if (finalUnpack->LsbFirst) { + /* least significan bit first */ + GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + if (mask != 1) + src++; + } + else { + /* most significan bit first */ + GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + if (mask != 128) + src++; + } + dst -= dstStride; + } + } + + TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB); + return GL_TRUE; +} +#endif + +#if 0 +GLboolean +tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte * bitmap) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLuint color; + const struct gl_pixelstore_attrib *finalUnpack; + struct gl_pixelstore_attrib scissoredUnpack; + + /* check if there's any raster operations enabled which we can't handle */ + if (ctx->RasterMask & (ALPHATEST_BIT | + BLEND_BIT | + DEPTH_BIT | + FOG_BIT | + LOGIC_OP_BIT | + SCISSOR_BIT | + STENCIL_BIT | + MASKING_BIT | + ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; + + if (ctx->Scissor.Enabled) { + /* This is a bit tricky, but by carefully adjusting the px, py, + * width, height, skipPixels and skipRows values we can do + * scissoring without special code in the rendering loop. + */ + + /* we'll construct a new pixelstore struct */ + finalUnpack = &scissoredUnpack; + scissoredUnpack = *unpack; + if (scissoredUnpack.RowLength == 0) + scissoredUnpack.RowLength = width; + + /* clip left */ + if (px < ctx->Scissor.X) { + scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); + width -= (ctx->Scissor.X - px); + px = ctx->Scissor.X; + } + /* clip right */ + if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { + width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); + } + /* clip bottom */ + if (py < ctx->Scissor.Y) { + scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); + height -= (ctx->Scissor.Y - py); + py = ctx->Scissor.Y; + } + /* clip top */ + if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { + height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); + } + + if (width <= 0 || height <= 0) + return GL_TRUE; /* totally scissored away */ + } + else { + finalUnpack = unpack; + } + + /* compute pixel value */ + { + GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); + GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0f); + color = PACK_BGRA32(r, g, b, a); + } + + info.size = sizeof(info); + if (!TDFX_grLfbLock(fxMesa, GR_LFB_WRITE_ONLY, + fxMesa->currentFB, GR_LFBWRITEMODE_8888, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { +#ifndef TDFX_SILENT + fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n"); +#endif + return GL_TRUE; + } + + { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + GLint dstStride; + GLuint *dst; + GLint row; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + dstStride = fxMesa->screen_width; + dst = + (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + + px); + } + else { + dstStride = info.strideInBytes / 4; + dst = + (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + + px); + } + + /* compute dest address of bottom-left pixel in bitmap */ + for (row = 0; row < height; row++) { + const GLubyte *src = + (const GLubyte *) _mesa_image_address(finalUnpack, + bitmap, width, height, + GL_COLOR_INDEX, + GL_BITMAP, 0, row, 0); + if (finalUnpack->LsbFirst) { + /* least significan bit first */ + GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + if (mask != 1) + src++; + } + else { + /* most significan bit first */ + GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col = 0; col < width; col++) { + if (*src & mask) { + if (inClipRects(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + if (mask != 128) + src++; + } + dst -= dstStride; + } + } + + TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB); + return GL_TRUE; +} +#endif + +GLboolean +tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid * dstImage) +{ + if (!(format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5)) { + return GL_FALSE; /* format/type not recognised */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + LOCK_HARDWARE( fxMesa ); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->ReadBuffer, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == + GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / 2); + const GLushort *src = (const GLushort *) info.lfbPtr + + scrY * srcStride + scrX; + const GLubyte *dst = (GLubyte *) _mesa_image_address(packing, + dstImage, width, height, format, type, 0, 0, 0); + const GLint dstStride = _mesa_image_row_stride(packing, + width, format, type); + + if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { + /* directly memcpy 5R6G5B pixels into client's buffer */ + const GLint widthInBytes = width * 2; + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer); + } + UNLOCK_HARDWARE( fxMesa ); + return result; + } +} + +GLboolean +tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid * dstImage) +{ + if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) && + !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + return GL_FALSE; /* format/type not optimised */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + LOCK_HARDWARE(fxMesa); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->ReadBuffer, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) + { + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 4); + const GLuint *src = (const GLuint *) info.lfbPtr + + scrY * srcStride + scrX; + const GLint dstStride = + _mesa_image_row_stride(packing, width, format, type); + const GLubyte *dst = (GLubyte *) _mesa_image_address(packing, + dstImage, width, height, format, type, 0, 0, 0); + const GLint widthInBytes = width * 4; + + if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) || + (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer); + } + UNLOCK_HARDWARE(fxMesa); + return result; + } +} + +GLboolean +tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid * pixels) +{ + if (!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) && + !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + return GL_FALSE; /* format/type not optimised */ + } + + if (ctx->Pixel.ZoomX!=1.0F || ctx->Pixel.ZoomY!=1.0F) { + return GL_FALSE; /* can't scale pixels */ + } + + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + + if (ctx->RasterMask & (~BLEND_BIT)) { + return GL_FALSE; /* can't do any raster ops, except blend */ + } + + { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + /* lock early to make sure cliprects are right */ + LOCK_HARDWARE(fxMesa); + + /* make sure hardware has latest blend funcs */ + if (ctx->RasterMask & BLEND_BIT) { + fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC; + tdfxEmitHwStateLocked( fxMesa ); + } + + /* look for clipmasks, giveup if region obscured */ + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + if (!inClipRects_Region(fxMesa, scrX, scrY, width, height)) { + UNLOCK_HARDWARE(fxMesa); + return GL_FALSE; + } + } + + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->DrawBuffer, + GR_LFBWRITEMODE_8888, + GR_ORIGIN_UPPER_LEFT, FXTRUE, &info)) + { + const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width * 4) : (info.strideInBytes); + const GLubyte *dst = (const GLubyte *) info.lfbPtr + + scrY * dstStride + scrX * 4; + const GLint srcStride = + _mesa_image_row_stride(unpack, width, format, type); + const GLubyte *src = (GLubyte *) _mesa_image_address(unpack, + pixels, width, height, format, type, 0, 0, 0); + const GLint widthInBytes = width * 4; + + if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) || + (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) { + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst -= dstStride; + src += srcStride; + } + result = GL_TRUE; + } + + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer); + } + UNLOCK_HARDWARE(fxMesa); + return result; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h new file mode 100644 index 000000000..bb409d6fa --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h @@ -0,0 +1,80 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Nathan Hand <nhand@valinux.com> + * + */ + +#ifndef __TDFX_PIXELS_H__ +#define __TDFX_PIXELS_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern GLboolean +tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern GLboolean +tdfx_bitmap_R8G8B8A8( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ); + +extern GLboolean +tdfx_readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage ); + +extern GLboolean +tdfx_readpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage ); + +extern GLboolean +tdfx_drawpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c new file mode 100644 index 000000000..473646d10 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c @@ -0,0 +1,861 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_render.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "dri_glide.h" +#include "tdfx_context.h" +#include "tdfx_render.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" + +/* Clear the color and/or depth buffers. + */ +static GLbitfield tdfxDDClear( GLcontext *ctx, + GLbitfield mask, GLboolean all, + GLint x, GLint y, GLint width, GLint height ) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLbitfield softwareMask = mask & (DD_ACCUM_BIT); + const GLuint stencil_size = + fxMesa->haveHwStencil ? fxMesa->glVis->StencilBits : 0; + +#if 0 + GLuint flags; + + FLUSH_BATCH( fxMesa ); + + if ( mask & DD_FRONT_LEFT_BIT ) { + flags |= TDFX_FRONT; + mask &= ~DD_FRONT_LEFT_BIT; + } + + if ( mask & DD_BACK_LEFT_BIT ) { + flags |= TDFX_BACK; + mask &= ~DD_BACK_LEFT_BIT; + } + + if ( (mask & DD_DEPTH_BIT) && ctx->Depth.Mask ) { + flags |= TDFX_DEPTH; + mask &= ~DD_DEPTH_BIT; + } + + if ( (mask & DD_STENCIL_BIT) && fxMesa->haveHwStencil ) { + clear.flags |= TDFX_STENCIL; + mask &= ~DD_STENCIL_BIT; + } + + if ( !flags ) + return mask; + + LOCK_HARDWARE( fxMesa ); + + + if ( flags & TDFX_FRONT ) { + + } + + if ( flags & TDFX_BACK ) { + + } + + if ( flags & TDFX_DEPTH ) { + + } + + if ( flags & TDFX_STENCIL ) { + grStencilMask( fxMesa->Stencil.WriteMask ); + /* set stencil ref value = desired clear value */ + grStencilFunc( GR_CMP_ALWAYS, fxMesa->Stencil.Clear, 0xff ); + grStencilOp( GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE ); + grEnable( GR_STENCIL_MODE_EXT ); + + if ( ctx->Stencil.Enabled ) { + grStencilOp( fxMesa->Stencil.FailFunc, + fxMesa->Stencil.ZFailFunc, + fxMesa->Stencil.ZPassFunc ); + grStencilMask( fxMesa->Stencil.WriteMask ); + grStencilFunc( fxMesa->Stencil.Function, + fxMesa->Stencil.RefValue, + fxMesa->Stencil.ValueMask ); + grEnable_NoLock( GR_STENCIL_MODE_EXT ); + } else { + grDisable( GR_STENCIL_MODE_EXT ); + } + + } + UNLOCK_HARDWARE( fxMesa ); + +#else + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s( %d, %d, %d, %d )\n", + __FUNCTION__, (int) x, (int) y, (int) width, (int) height ); + } + + /* Need this check to respond to glScissor and clipping updates */ + if ((fxMesa->new_state & (TDFX_NEW_CLIP | TDFX_NEW_DEPTH)) || + (fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK)) { + tdfxDDUpdateHwState(ctx); + } + + /* we can't clear accum buffers */ + mask &= ~(DD_ACCUM_BIT); + + if (mask & DD_STENCIL_BIT) { + if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask != 0xff) { + /* Napalm seems to have trouble with stencil write masks != 0xff */ + /* do stencil clear in software */ + mask &= ~(DD_STENCIL_BIT); + softwareMask |= DD_STENCIL_BIT; + } + } + + if (fxMesa->glVis->RedBits != 8) { + /* can only do color masking if running in 24/32bpp on Napalm */ + if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] || + ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) { + softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)); + mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT); + } + } + + if (fxMesa->haveHwStencil) { + /* + * If we want to clear stencil, it must be enabled + * in the HW, even if the stencil test is not enabled + * in the OGL state. + */ + LOCK_HARDWARE(fxMesa); + if (mask & DD_STENCIL_BIT) { + FX_grStencilMask_NoLock(/*ctx->Stencil.WriteMask*/ 0xff); + /* set stencil ref value = desired clear value */ + FX_grStencilFunc_NoLock(GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff); + FX_grStencilOp_NoLock(GR_STENCILOP_REPLACE, + GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE); + FX_grEnable_NoLock(GR_STENCIL_MODE_EXT); + } + else { + FX_grDisable_NoLock(GR_STENCIL_MODE_EXT); + } + UNLOCK_HARDWARE(fxMesa); + } + + /* + * FIXME: This is just plain ugly... + */ + BEGIN_CLIP_LOOP(fxMesa); + { + /* + * This could probably be done fancier but doing each possible case + * explicitly is less error prone. + */ + switch (mask & ~DD_STENCIL_BIT) { + case DD_BACK_LEFT_BIT | DD_DEPTH_BIT: + /* back buffer & depth */ + FX_grColorMaskv_NoLock(ctx, true4); /* work around Voodoo3 bug */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) { + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + } + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT: + /* XXX it appears that the depth buffer isn't cleared when + * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set. + * This is a work-around/ + */ + /* clear depth */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grColorMaskv_NoLock(ctx, false4); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + /* clear front */ + FX_grColorMaskv_NoLock(ctx, true4); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_BACK_LEFT_BIT: + /* back buffer only */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT: + /* front buffer only */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT: + /* front and back */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + break; + case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT: + /* clear front */ + FX_grDepthMask_NoLock(FXFALSE); + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + /* clear back and depth */ + FX_grDepthMask_NoLock(FXTRUE); + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + if (!ctx->Depth.Mask || !ctx->Depth.Mask) { + FX_grDepthMask_NoLock(FXFALSE); + } + break; + case DD_DEPTH_BIT: + /* just the depth buffer */ + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grColorMaskv_NoLock(ctx, false4); + FX_grDepthMask_NoLock(FXTRUE); + if (stencil_size > 0) + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + else + FX_grBufferClear_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear); + FX_grColorMaskv_NoLock(ctx, true4); + if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + if (!ctx->Depth.Test || !ctx->Depth.Mask) + FX_grDepthMask_NoLock(FXFALSE); + break; + default: + /* clear no color buffers or depth buffer but might clear stencil */ + if (stencil_size > 0 && (mask & DD_STENCIL_BIT)) { + /* XXX need this RenderBuffer call to work around Glide bug */ + FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER); + FX_grDepthMask_NoLock(FXFALSE); + FX_grColorMaskv_NoLock(ctx, false4); + FX_grBufferClearExt_NoLock(fxMesa->Color.ClearColor, + fxMesa->Color.ClearAlpha, + fxMesa->Depth.Clear, + (FxU32) ctx->Stencil.Clear); + if (ctx->Depth.Mask && ctx->Depth.Test) { + FX_grDepthMask_NoLock(FXTRUE); + } + FX_grColorMaskv_NoLock(ctx, true4); + if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) + FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER); + } + } + } + END_CLIP_LOOP(fxMesa); + + if (fxMesa->haveHwStencil && (mask & DD_STENCIL_BIT)) { + /* We changed the stencil state above. Signal that we need to + * upload it again. + */ + fxMesa->dirty |= TDFX_UPLOAD_STENCIL; + } + +#endif + return softwareMask; +} + + + +static void tdfxDDFinish( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + grFinish(); + UNLOCK_HARDWARE( fxMesa ); +} + +static void tdfxDDFlush( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + LOCK_HARDWARE( fxMesa ); + grFlush(); + UNLOCK_HARDWARE( fxMesa ); +} + + + +static const char *texSource(int k) +{ + switch (k) { + case GR_CMBX_ZERO: + return "GR_CMBX_ZERO"; + case GR_CMBX_TEXTURE_ALPHA: + return "GR_CMBX_TEXTURE_ALPHA"; + case GR_CMBX_ALOCAL: + return "GR_CMBX_ALOCAL"; + case GR_CMBX_AOTHER: + return "GR_CMBX_AOTHER"; + case GR_CMBX_B: + return "GR_CMBX_B"; + case GR_CMBX_CONSTANT_ALPHA: + return "GR_CMBX_CONSTANT_ALPHA"; + case GR_CMBX_CONSTANT_COLOR: + return "GR_CMBX_CONSTANT_COLOR"; + case GR_CMBX_DETAIL_FACTOR: + return "GR_CMBX_DETAIL_FACTOR"; + case GR_CMBX_ITALPHA: + return "GR_CMBX_ITALPHA"; + case GR_CMBX_ITRGB: + return "GR_CMBX_ITRGB"; + case GR_CMBX_LOCAL_TEXTURE_ALPHA: + return "GR_CMBX_LOCAL_TEXTURE_ALPHA"; + case GR_CMBX_LOCAL_TEXTURE_RGB: + return "GR_CMBX_LOCAL_TEXTURE_RGB"; + case GR_CMBX_LOD_FRAC: + return "GR_CMBX_LOD_FRAC"; + case GR_CMBX_OTHER_TEXTURE_ALPHA: + return "GR_CMBX_OTHER_TEXTURE_ALPHA"; + case GR_CMBX_OTHER_TEXTURE_RGB: + return "GR_CMBX_OTHER_TEXTURE_RGB"; + case GR_CMBX_TEXTURE_RGB: + return "GR_CMBX_TEXTURE_RGB"; + case GR_CMBX_TMU_CALPHA: + return "GR_CMBX_TMU_CALPHA"; + case GR_CMBX_TMU_CCOLOR: + return "GR_CMBX_TMU_CCOLOR"; + default: + return ""; + } +} + +static const char *texMode(int k) +{ + switch (k) { + case GR_FUNC_MODE_ZERO: + return "GR_FUNC_MODE_ZERO"; + case GR_FUNC_MODE_X: + return "GR_FUNC_MODE_X"; + case GR_FUNC_MODE_ONE_MINUS_X: + return "GR_FUNC_MODE_ONE_MINUS_X"; + case GR_FUNC_MODE_NEGATIVE_X: + return "GR_FUNC_MODE_NEGATIVE_X"; + case GR_FUNC_MODE_X_MINUS_HALF: + return "GR_FUNC_MODE_X_MINUS_HALF"; + default: + return ""; + } +} + +static const char *texInvert(int k) +{ + return k ? "FXTRUE" : "FXFALSE"; +} + +static void uploadTextureEnv( tdfxContextPtr fxMesa ) +{ + if (TDFX_IS_NAPALM(fxMesa)) { + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { +#if 0 + printf("upload env %d\n", unit); + printf(" cSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceA)); + printf(" cModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeA)); + printf(" cSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceB)); + printf(" cModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeB)); + printf(" cSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceC)); + printf(" cInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertC)); + printf(" cSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceD)); + printf(" cInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertD)); + printf(" cShift = %d\t", fxMesa->TexCombineExt[unit].Color.Shift); + printf(" cInvert = %d\n", fxMesa->TexCombineExt[unit].Color.Invert); + printf(" aSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceA)); + printf(" aModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeA)); + printf(" aSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceB)); + printf(" aModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeB)); + printf(" aSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceC)); + printf(" aInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertC)); + printf(" aSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceD)); + printf(" aInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertD)); + printf(" aShift = %d\t", fxMesa->TexCombineExt[unit].Alpha.Shift); + printf(" aInvert = %d\n", fxMesa->TexCombineExt[unit].Alpha.Invert); + printf(" Color = 0x%08x\n", fxMesa->TexCombineExt[unit].EnvColor); +#endif + (*grTexColorCombineExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].Color.SourceA, + fxMesa->TexCombineExt[unit].Color.ModeA, + fxMesa->TexCombineExt[unit].Color.SourceB, + fxMesa->TexCombineExt[unit].Color.ModeB, + fxMesa->TexCombineExt[unit].Color.SourceC, + fxMesa->TexCombineExt[unit].Color.InvertC, + fxMesa->TexCombineExt[unit].Color.SourceD, + fxMesa->TexCombineExt[unit].Color.InvertD, + fxMesa->TexCombineExt[unit].Color.Shift, + fxMesa->TexCombineExt[unit].Color.Invert); + (*grTexAlphaCombineExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].Alpha.SourceA, + fxMesa->TexCombineExt[unit].Alpha.ModeA, + fxMesa->TexCombineExt[unit].Alpha.SourceB, + fxMesa->TexCombineExt[unit].Alpha.ModeB, + fxMesa->TexCombineExt[unit].Alpha.SourceC, + fxMesa->TexCombineExt[unit].Alpha.InvertC, + fxMesa->TexCombineExt[unit].Alpha.SourceD, + fxMesa->TexCombineExt[unit].Alpha.InvertD, + fxMesa->TexCombineExt[unit].Alpha.Shift, + fxMesa->TexCombineExt[unit].Alpha.Invert); + (*grConstantColorValueExtProc)(TDFX_TMU0 + unit, + fxMesa->TexCombineExt[unit].EnvColor); + } + } + else { + /* Voodoo3 */ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + struct tdfx_texcombine *comb = &fxMesa->TexCombine[unit]; + FX_grTexCombine_NoLock(TDFX_TMU0 + unit, + comb->FunctionRGB, + comb->FactorRGB, + comb->FunctionAlpha, + comb->FactorAlpha, + comb->InvertRGB, + comb->InvertAlpha); + } + } +} + + +static void uploadTextureParams( tdfxContextPtr fxMesa ) +{ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + const struct tdfx_texparams *p = &fxMesa->TexParams[unit]; + /* + printf("upload params %d\n", unit); + printf(" clamp %x %x\n", env->sClamp, env->tClamp); + printf(" filter %x %x\n", env->minFilt, env->magFilt); + printf(" mipmap %x %x\n", env->mmMode, env->LODblend); + printf(" lod bias %f\n", env->LodBias); + */ + FX_grTexClampMode_NoLock(GR_TMU0 + unit, p->sClamp, p->tClamp); + FX_grTexFilterMode_NoLock(GR_TMU0 + unit, p->minFilt, p->magFilt); + FX_grTexMipMapMode_NoLock(GR_TMU0 + unit, p->mmMode, p->LODblend); + FX_grTexLodBiasValue_NoLock(GR_TMU0 + unit, p->LodBias); + } +} + + +static void uploadTextureSource( tdfxContextPtr fxMesa ) +{ + int unit; + for (unit = 0; unit < TDFX_NUM_TMU; unit++) { + const struct tdfx_texsource *src = &fxMesa->TexSource[unit]; + /* + printf("upload source %d @ %d %p\n", unit, src->StartAddress, src->Info); + */ + if (src->Info) { + /* + printf(" smallLodLog2=%d largeLodLog2=%d ar=%d format=%d data=%p\n", + src->Info->smallLodLog2, src->Info->largeLodLog2, + src->Info->aspectRatioLog2, src->Info->format, + src->Info->data); + */ + FX_grTexSource_NoLock(GR_TMU0 + unit, + src->StartAddress, + src->EvenOdd, + src->Info); + } + } +} + + +static void uploadTextureImages( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + int unit; + for ( unit = 0 ; unit < TDFX_NUM_TMU ; unit++ ) { + if ( ctx->Texture.Unit[unit].ReallyEnabled == TEXTURE0_2D ) { + struct gl_texture_object *tObj = ctx->Texture.Unit[unit].CurrentD[2]; + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + if ( t && t->reloadImages ) { + tdfxTMDownloadTextureLocked( fxMesa, tObj ); + t->reloadImages = GL_FALSE; + } + } + } +} + + + +/* + * If scissoring is enabled, compute intersection of scissor region + * with all X clip rects, resulting in new cliprect list. + * If number of cliprects is zero or one, call grClipWindow to setup + * the clip region. Otherwise we'll call grClipWindow inside the + * BEGIN_CLIP_LOOP macro. + */ +void tdfxUploadClipping( tdfxContextPtr fxMesa ) +{ + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; + + assert(dPriv); + + if (fxMesa->numClipRects == 0) { + /* all drawing clipped away */ + grClipWindow(0, 0, 0, 0); + } + else if (fxMesa->numClipRects == 1) { + grClipWindow(fxMesa->pClipRects[0].x1, + fxMesa->screen_height - fxMesa->pClipRects[0].y2, + fxMesa->pClipRects[0].x2, + fxMesa->screen_height - fxMesa->pClipRects[0].y1); + } + /* else, we'll do a cliprect loop around all drawing */ + + grDRIPosition( dPriv->x, dPriv->y, dPriv->w, dPriv->h, + fxMesa->numClipRects, fxMesa->pClipRects ); +} + + +void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa ) +{ + if ( !fxMesa->dirty ) + return; + + if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_COMBINE ) { + if (TDFX_IS_NAPALM(fxMesa)) { + (*grColorCombineExtProc)(fxMesa->ColorCombineExt.SourceA, + fxMesa->ColorCombineExt.ModeA, + fxMesa->ColorCombineExt.SourceB, + fxMesa->ColorCombineExt.ModeB, + fxMesa->ColorCombineExt.SourceC, + fxMesa->ColorCombineExt.InvertC, + fxMesa->ColorCombineExt.SourceD, + fxMesa->ColorCombineExt.InvertD, + fxMesa->ColorCombineExt.Shift, + fxMesa->ColorCombineExt.Invert); + } + else { + /* Voodoo 3 */ + grColorCombine( fxMesa->ColorCombine.Function, + fxMesa->ColorCombine.Factor, + fxMesa->ColorCombine.Local, + fxMesa->ColorCombine.Other, + fxMesa->ColorCombine.Invert ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_COMBINE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_COMBINE ) { + if (TDFX_IS_NAPALM(fxMesa)) { + (*grAlphaCombineExtProc)(fxMesa->AlphaCombineExt.SourceA, + fxMesa->AlphaCombineExt.ModeA, + fxMesa->AlphaCombineExt.SourceB, + fxMesa->AlphaCombineExt.ModeB, + fxMesa->AlphaCombineExt.SourceC, + fxMesa->AlphaCombineExt.InvertC, + fxMesa->AlphaCombineExt.SourceD, + fxMesa->AlphaCombineExt.InvertD, + fxMesa->AlphaCombineExt.Shift, + fxMesa->AlphaCombineExt.Invert); + } + else { + /* Voodoo 3 */ + grAlphaCombine( fxMesa->AlphaCombine.Function, + fxMesa->AlphaCombine.Factor, + fxMesa->AlphaCombine.Local, + fxMesa->AlphaCombine.Other, + fxMesa->AlphaCombine.Invert ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_COMBINE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_RENDER_BUFFER ) { + grRenderBuffer( fxMesa->DrawBuffer ); + fxMesa->dirty &= ~TDFX_UPLOAD_RENDER_BUFFER; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE) { + grStipplePattern( fxMesa->Stipple.Pattern ); + grStippleMode( fxMesa->Stipple.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_TEST ) { + grAlphaTestFunction( fxMesa->Color.AlphaFunc ); + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_TEST; + } + if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_REF ) { + grAlphaTestReferenceValue( fxMesa->Color.AlphaRef ); + fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_REF; + } + if ( fxMesa->dirty & TDFX_UPLOAD_BLEND_FUNC ) { + if (grAlphaBlendFunctionExtProc) { + (*grAlphaBlendFunctionExtProc)( fxMesa->Color.BlendSrcRGB, + fxMesa->Color.BlendDstRGB, + GR_BLEND_OP_ADD, + fxMesa->Color.BlendSrcA, + fxMesa->Color.BlendDstA, + GR_BLEND_OP_ADD ); + } + else { + grAlphaBlendFunction( fxMesa->Color.BlendSrcRGB, + fxMesa->Color.BlendDstRGB, + fxMesa->Color.BlendSrcA, + fxMesa->Color.BlendDstA ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_BLEND_FUNC; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MODE ) { + grDepthBufferMode( fxMesa->Depth.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MODE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_BIAS ) { + grDepthBiasLevel( fxMesa->Depth.Bias ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_BIAS; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_FUNC ) { + grDepthBufferFunction( fxMesa->Depth.Func ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_FUNC; + } + if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MASK ) { + grDepthMask( fxMesa->Depth.Mask ); + fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MASK; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_DITHER) { + grDitherMode( fxMesa->Color.Dither ); + } + + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_MODE ) { + grFogMode( fxMesa->Fog.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_MODE; + } + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_COLOR ) { + grFogColorValue( fxMesa->Fog.Color ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_COLOR; + } + if ( fxMesa->dirty & TDFX_UPLOAD_FOG_TABLE ) { + grFogTable( fxMesa->Fog.Table ); + fxMesa->dirty &= ~TDFX_UPLOAD_FOG_TABLE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) { + grCullMode( fxMesa->CullMode ); + fxMesa->dirty &= ~TDFX_UPLOAD_CULL; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CLIP ) { + tdfxUploadClipping( fxMesa ); + fxMesa->dirty &= ~TDFX_UPLOAD_CLIP; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK ) { + if ( grColorMaskExtProc && fxMesa->glCtx->Visual->RedBits == 8) { + grColorMaskExtProc( fxMesa->Color.ColorMask[RCOMP], + fxMesa->Color.ColorMask[GCOMP], + fxMesa->Color.ColorMask[BCOMP], + fxMesa->Color.ColorMask[ACOMP] ); + } else { + grColorMask( fxMesa->Color.ColorMask[RCOMP] || + fxMesa->Color.ColorMask[GCOMP] || + fxMesa->Color.ColorMask[BCOMP], + fxMesa->Color.ColorMask[ACOMP] ); + } + fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_MASK; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_CONSTANT_COLOR ) { + grConstantColorValue( fxMesa->Color.MonoColor ); + fxMesa->dirty &= ~TDFX_UPLOAD_CONSTANT_COLOR; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_LINE ) { + if (fxMesa->glCtx->Line.SmoothFlag && fxMesa->glCtx->Line.Width == 1.0) + grEnable(GR_AA_ORDERED); + else + grDisable(GR_AA_ORDERED); + fxMesa->dirty &= ~TDFX_UPLOAD_LINE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_STENCIL ) { + if (fxMesa->glCtx->Stencil.Enabled) { + grEnable(GR_STENCIL_MODE_EXT); + FX_grStencilOp_NoLock(fxMesa->Stencil.FailFunc, + fxMesa->Stencil.ZFailFunc, + fxMesa->Stencil.ZPassFunc); + FX_grStencilFunc_NoLock(fxMesa->Stencil.Function, + fxMesa->Stencil.RefValue, + fxMesa->Stencil.ValueMask); + FX_grStencilMask_NoLock(fxMesa->Stencil.WriteMask); + } + else { + grDisable(GR_STENCIL_MODE_EXT); + } + fxMesa->dirty &= ~TDFX_UPLOAD_STENCIL; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) { + grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] ); + fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_ENV ) { + uploadTextureEnv(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_ENV; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PARAMS ) { + uploadTextureParams(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PARAMS; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PALETTE ) { + if (fxMesa->TexPalette.Data) { + grTexDownloadTable(fxMesa->TexPalette.Type, fxMesa->TexPalette.Data); + } + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PALETTE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_SOURCE ) { + uploadTextureSource(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_SOURCE; + } + + if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_IMAGES ) { + uploadTextureImages(fxMesa); + fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_IMAGES; + } + + fxMesa->dirty = 0; +} + + + +void tdfxDDInitRenderFuncs( GLcontext *ctx ) +{ + ctx->Driver.Clear = tdfxDDClear; + ctx->Driver.Finish = tdfxDDFinish; + ctx->Driver.Flush = tdfxDDFlush; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h new file mode 100644 index 000000000..146120bc0 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h @@ -0,0 +1,54 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_render.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_RENDER_H__ +#define __TDFX_RENDER_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "tdfx_context.h" + +extern void tdfxDDInitRenderFuncs( GLcontext *ctx ); + +extern void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa ); + +extern void tdfxUploadClipping( tdfxContextPtr fxMesa ); + +#define FLUSH_BATCH( fxMesa ) + + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c new file mode 100644 index 000000000..b770423af --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c @@ -0,0 +1,106 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#include <X11/Xlibint.h> + +#include "tdfx_dri.h" +#include "tdfx_context.h" +#include "tdfx_vb.h" +#include "tdfx_tris.h" +#include "tdfx_pipeline.h" + + +#ifdef DEBUG_LOCKING +char *prevLockFile = 0; +int prevLockLine = 0; +#endif + + +GLboolean tdfxCreateScreen( __DRIscreenPrivate *sPriv ) +{ + tdfxScreenPrivate *fxScreen; + TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv; + + /* Allocate the private area */ + fxScreen = (tdfxScreenPrivate *) Xmalloc( sizeof(tdfxScreenPrivate) ); + if ( !fxScreen ) + return GL_FALSE; + + fxScreen->driScrnPriv = sPriv; + sPriv->private = (void *) fxScreen; + + fxScreen->regs.handle = fxDRIPriv->regs; + fxScreen->regs.size = fxDRIPriv->regsSize; + fxScreen->deviceID = fxDRIPriv->deviceID; + fxScreen->width = fxDRIPriv->width; + fxScreen->height = fxDRIPriv->height; + fxScreen->mem = fxDRIPriv->mem; + fxScreen->cpp = fxDRIPriv->cpp; + fxScreen->stride = fxDRIPriv->stride; + fxScreen->fifoOffset = fxDRIPriv->fifoOffset; + fxScreen->fifoSize = fxDRIPriv->fifoSize; + fxScreen->fbOffset = fxDRIPriv->fbOffset; + fxScreen->backOffset = fxDRIPriv->backOffset; + fxScreen->depthOffset = fxDRIPriv->depthOffset; + fxScreen->textureOffset = fxDRIPriv->textureOffset; + fxScreen->textureSize = fxDRIPriv->textureSize; + fxScreen->sarea_priv_offset = fxDRIPriv->sarea_priv_offset; + + if ( drmMap( sPriv->fd, fxScreen->regs.handle, + fxScreen->regs.size, &fxScreen->regs.map ) ) { + return GL_FALSE; + } + + tdfxDDSetupInit(); + tdfxDDTriangleFuncsInit(); + tdfxDDFastPathInit(); + + tdfxDDGlideExtensionsInit(); + + return GL_TRUE; +} + +void tdfxDestroyScreen( __DRIscreenPrivate *sPriv ) +{ + tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; + + if ( fxScreen ) { + drmUnmap( fxScreen->regs.map, fxScreen->regs.size ); + + Xfree( fxScreen ); + sPriv->private = NULL; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h new file mode 100644 index 000000000..9c41933d8 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h @@ -0,0 +1,78 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef __TDFX_SCREEN_H__ +#define __TDFX_SCREEN_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "dri_mesaint.h" + +typedef struct { + drmHandle handle; + drmSize size; + drmAddress map; +} tdfxRegion, *tdfxRegionPtr; + +typedef struct { + tdfxRegion regs; + + int deviceID; + int width; + int height; + int mem; + int cpp; + int stride; + + int fifoOffset; + int fifoSize; + + int fbOffset; + int backOffset; + int depthOffset; + int textureOffset; + int textureSize; + + __DRIscreenPrivate *driScrnPriv; + unsigned int sarea_priv_offset; +} tdfxScreenPrivate; + + +extern GLboolean tdfxCreateScreen( __DRIscreenPrivate *driScrnPriv ); +extern void tdfxDestroyScreen( __DRIscreenPrivate *driScrnPriv ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c new file mode 100644 index 000000000..7dce5112f --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c @@ -0,0 +1,1335 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_span.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_span.h" +#include "tdfx_render.h" + + +#define DBG 0 + + +#define LOCAL_VARS \ + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \ + tdfxScreenPrivate *fxPriv = fxMesa->fxScreen; \ + GLuint pitch = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) \ + ? (fxMesa->screen_width * BYTESPERPIXEL) : \ + (info.strideInBytes); \ + GLuint height = fxMesa->height; \ + char *buf = (char *)((char *)info.lfbPtr + \ + dPriv->x * fxPriv->cpp + \ + dPriv->y * pitch); \ + GLuint p; \ + (void) buf; (void) p; + + +#define INIT_MONO_PIXEL( p ) p = fxMesa->Color.MonoColor; + +#define CLIPPIXEL( _x, _y ) ( _x >= minx && _x < maxx && \ + _y >= miny && _y < maxy ) + +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } + +#define Y_FLIP(_y) (height - _y - 1) + + +#define HW_WRITE_LOCK() \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + FLUSH_BATCH( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + LOCK_HARDWARE( fxMesa ); \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer, LFB_MODE, \ + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \ + { + +#define HW_WRITE_UNLOCK() \ + grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer ); \ + } + + +#define HW_READ_LOCK() \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \ + GrLfbInfo_t info; \ + FLUSH_BATCH( fxMesa ); \ + UNLOCK_HARDWARE( fxMesa ); \ + LOCK_HARDWARE( fxMesa ); \ + info.size = sizeof(GrLfbInfo_t); \ + if ( grLfbLock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer, LFB_MODE, \ + GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \ + { + +#define HW_READ_UNLOCK() \ + grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer ); \ + } + + +#define HW_WRITE_CLIPLOOP() \ + do { \ + int _nc = fxMesa->numClipRects; \ + while (_nc--) { \ + int minx = fxMesa->pClipRects[_nc].x1 - fxMesa->x_offset; \ + int miny = fxMesa->pClipRects[_nc].y1 - fxMesa->y_offset; \ + int maxx = fxMesa->pClipRects[_nc].x2 - fxMesa->x_offset; \ + int maxy = fxMesa->pClipRects[_nc].y2 - fxMesa->y_offset; + +#define HW_READ_CLIPLOOP() \ + do { \ + const __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \ + XF86DRIClipRectPtr rect = dPriv->pClipRects; \ + int _nc = dPriv->numClipRects; \ + while (_nc--) { \ + const int minx = rect->x1 - fxMesa->x_offset; \ + const int miny = rect->y1 - fxMesa->y_offset; \ + const int maxx = rect->x2 - fxMesa->x_offset; \ + const int maxy = rect->y2 - fxMesa->y_offset; \ + rect++; + +#define HW_ENDCLIPLOOP() \ + } \ + } while (0) + + + +#define LFB_MODE GR_LFBWRITEMODE_565 + + +/* 16 bit, RGB565 color spanline and pixel functions */ \ + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ + rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \ + rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \ + rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \ + rgba[3] = 0xff; \ + } while (0) + +#define TAG(x) tdfx##x##_RGB565 +#define BYTESPERPIXEL 2 +#include "spantmp.h" +#undef BYTESPERPIXEL + + +/* 16 bit, BGR565 color spanline and pixel functions */ \ +#if 0 + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)b & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)r & 0xf8) >> 3)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ + rgba[0] = (p << 3) & 0xf8; \ + rgba[1] = (p >> 3) & 0xfc; \ + rgba[2] = (p >> 8) & 0xf8; \ + rgba[3] = 0xff; \ + } while (0) + +#define TAG(x) tdfx##x##_BGR565 +#define BYTESPERPIXEL 2 +#include "spantmp.h" +#undef BYTESPERPIXEL +#endif + + +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_888 + + +/* 24 bit, RGB888 color spanline and pixel functions */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = ((b << 0) | \ + (g << 8) | \ + (r << 16)) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*3 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLuint p = *(GLuint *)(buf + _x*3 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = 0xff; \ +} while (0) + +#define TAG(x) tdfx##x##_RGB888 +#define BYTESPERPIXEL 4 +#include "spantmp.h" +#undef BYTESPERPIXEL + + +#undef LFB_MODE +#define LFB_MODE GR_LFBWRITEMODE_8888 + + +/* 32 bit, ARGB8888 color spanline and pixel functions */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \ + (g << 8) | \ + (r << 16) | \ + (a << 24) ) + +#define WRITE_PIXEL( _x, _y, p ) \ + *(GLuint *)(buf + _x*4 + _y*pitch) = p + +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = (p >> 24) & 0xff; \ +} while (0) + +#define TAG(x) tdfx##x##_ARGB8888 +#define BYTESPERPIXEL 4 +#include "spantmp.h" +#undef BYTESPERPIXEL + + + +/* ================================================================ + * Old span functions below... + */ + + +/* + * Examine the cliprects to generate an array of flags to indicate + * which pixels in a span are visible. Note: (x,y) is a screen + * coordinate. + */ +static void +generate_vismask(const tdfxContextPtr fxMesa, GLint x, GLint y, GLint n, + GLubyte vismask[]) +{ + GLboolean initialized = GL_FALSE; + GLint i, j; + + /* Ensure we clear the visual mask */ + MEMSET(vismask, 0, n); + + /* turn on flags for all visible pixels */ + for (i = 0; i < fxMesa->numClipRects; i++) { + const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; + + if (y >= rect->y1 && y < rect->y2) { + if (x >= rect->x1 && x + n <= rect->x2) { + /* common case, whole span inside cliprect */ + MEMSET(vismask, 1, n); + return; + } + if (x < rect->x2 && x + n >= rect->x1) { + /* some of the span is inside the rect */ + GLint start, end; + if (!initialized) { + MEMSET(vismask, 0, n); + initialized = GL_TRUE; + } + if (x < rect->x1) + start = rect->x1 - x; + else + start = 0; + if (x + n > rect->x2) + end = rect->x2 - x; + else + end = n; + assert(start >= 0); + assert(end <= n); + for (j = start; j < end; j++) + vismask[j] = 1; + } + } + } +} + +/* + * Examine cliprects and determine if the given screen pixel is visible. + */ +static GLboolean +visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY) +{ + int i; + for (i = 0; i < fxMesa->numClipRects; i++) { + const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; + if (scrX >= rect->x1 && + scrX < rect->x2 && + scrY >= rect->y1 && scrY < rect->y2) return GL_TRUE; + } + return GL_FALSE; +} + + + +/* + * Depth buffer read/write functions. + */ +/* + * To read the frame buffer, we need to lock and unlock it. The + * four macros {READ,WRITE}_FB_SPAN_{LOCK,UNLOCK} + * do this for us. + * + * Note that the lock must be matched with an unlock. These + * macros include a spare curly brace, so they must + * be syntactically matched. + * + * Note, also, that you can't lock a buffer twice with different + * modes. That is to say, you can't lock a buffer in both read + * and write modes. The strideInBytes and LFB pointer will be + * the same with read and write locks, so you can use either. + * o The HW has different state for reads and writes, so + * locking it twice may give screwy results. + * o The DRM won't let you lock twice. It hangs. This is probably + * because of the LOCK_HARDWARE IN THE *_FB_SPAN_LOCK macros, + * and could be eliminated with nonlocking lock routines. But + * what's the point after all. + */ +#define READ_FB_SPAN_LOCK(fxMesa, info, target_buffer) \ + UNLOCK_HARDWARE(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + (info).size=sizeof(info); \ + if (grLfbLock(GR_LFB_READ_ONLY, \ + target_buffer, \ + GR_LFBWRITEMODE_ANY, \ + GR_ORIGIN_UPPER_LEFT, \ + FXFALSE, \ + &(info))) { + +#define READ_FB_SPAN_UNLOCK(fxMesa, target_buffer) \ + grLfbUnlock(GR_LFB_READ_ONLY, target_buffer); \ + } else { \ + fprintf(stderr, "tdfxDriver: Can't get %s (%d) read lock\n", \ + (target_buffer == GR_BUFFER_BACKBUFFER) \ + ? "back buffer" \ + : ((target_buffer == GR_BUFFER_AUXBUFFER) \ + ? "depth buffer" \ + : "unknown buffer"), \ + target_buffer); \ + } + +#define WRITE_FB_SPAN_LOCK(fxMesa, info, target_buffer, write_mode) \ + UNLOCK_HARDWARE(fxMesa); \ + LOCK_HARDWARE(fxMesa); \ + info.size=sizeof(info); \ + if (grLfbLock(GR_LFB_WRITE_ONLY, \ + target_buffer, \ + write_mode, \ + GR_ORIGIN_UPPER_LEFT, \ + FXFALSE, \ + &info)) { + +#define WRITE_FB_SPAN_UNLOCK(fxMesa, target_buffer) \ + grLfbUnlock(GR_LFB_WRITE_ONLY, target_buffer); \ + } else { \ + fprintf(stderr, "tdfxDriver: Can't get %s (%d) write lock\n", \ + (target_buffer == GR_BUFFER_BACKBUFFER) \ + ? "back buffer" \ + : ((target_buffer == GR_BUFFER_AUXBUFFER) \ + ? "depth buffer" \ + : "unknown buffer"), \ + target_buffer); \ + } + +/* + * Because the Linear Frame Buffer is not necessarily aligned + * with the depth buffer, we have to do some fiddling + * around to get the right addresses. + * + * Perhaps a picture is in order. The Linear Frame Buffer + * looks like this: + * + * |<----------------------info.strideInBytes------------->| + * |<-----physicalStrideInBytes------->| + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * | | | + * | Legal Memory | Forbidden Zone | + * | | | + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * + * You can only reliably read and write legal locations. Reads + * and writes from the Forbidden Zone will return undefined values, + * and may cause segmentation faults. + * + * Now, the depth buffer may not end up in a location such each + * scan line is an LFB line. For example, the depth buffer may + * look like this: + * + * wrapped ordinary. + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * |0000000000000000000000 | | back + * |1111111111111111111111 | | buffer + * |2222222222222222222222 | | + * |4096b align. padxx00000000000000000| Forbidden Zone | depth + * |0000 11111111111111111| | buffer + * |1111 22222222222222222| | + * |2222 | | + * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+ + * where each number is the scan line number. We know it will + * be aligned on 128 byte boundaries, at least. Aligning this + * on a scanline boundary causes the back and depth buffers to + * thrash in the SST1 cache. (Note that the back buffer is always + * allocated at the beginning of LFB memory, and so it is always + * properly aligned with the LFB stride.) + * + * We call the beginning of the line (which is the rightmost + * part of the depth line in the picture above) the *ordinary* part + * of the scanline, and the end of the line (which is the + * leftmost part, one line below) the *wrapped* part of the scanline. + * a.) We need to know what x value to subtract from the screen + * x coordinate to index into the wrapped part. + * b.) We also need to figure out if we need to read from the ordinary + * part scan line, or from the wrapped part of the scan line. + * + * [ad a] + * The first wrapped x coordinate is that coordinate such that + * depthBufferOffset&(info.strideInBytes) + x*elmentSize {*} + * > physicalStrideInBytes + * where depthBufferOffset is the LFB distance in bytes + * from the back buffer to the depth buffer. The expression + * depthBufferOffset&(info.strideInBytes) + * is then the offset (in bytes) from the beginining of (any) + * depth buffer line to first element in the line. + * Simplifying inequation {*} above we see that x is the smallest + * value such that + * x*elementSize > physicalStrideInBytes {**} + * - depthBufferOffset&(info.strideInBytes) + * Now, we know that both the summands on the right are multiples of + * 128, and elementSize <= 4, so if equality holds in {**}, x would + * be a multiple of 32. Thus we can set x to + * xwrapped = (physicalStrideInBytes + * - depthBufferOffset&(info.strideInBytes))/elementSize + * + 1 + * + * [ad b] + * Question b is now simple. We read from the wrapped scan line if + * x is greater than xwrapped. + */ +#define TILE_WIDTH_IN_BYTES 128 +#define TILE_WIDTH_IN_ZOXELS(bpz) (TILE_WIDTH_IN_BYTES/(bpz)) +#define TILE_HEIGHT_IN_LINES 32 +typedef struct +{ + void *lfbPtr; + void *lfbWrapPtr; + FxU32 LFBStrideInElts; + GLint firstWrappedX; +} +LFBParameters; + +/* + * We need information about the back buffer. Note that + * this function *cannot be called* while the aux buffer + * is locked, or the caller will hang. + * + * Only Glide knows the LFB address of the back and depth + * offsets. The upper levels of Mesa know the depth offset, + * but that is not in LFB space, it is tiled memory space, + * and is not useable for us. + */ +static void +GetBackBufferInfo(tdfxContextPtr fxMesa, GrLfbInfo_t * backBufferInfo) +{ + READ_FB_SPAN_LOCK(fxMesa, *backBufferInfo, GR_BUFFER_BACKBUFFER); + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_BACKBUFFER); +} + +static void +GetFbParams(tdfxContextPtr fxMesa, + GrLfbInfo_t * info, + GrLfbInfo_t * backBufferInfo, + LFBParameters * ReadParamsp, FxU32 elementSize) +{ + FxU32 physicalStrideInBytes, bufferOffset; + FxU32 strideInBytes = info->strideInBytes; + char *lfbPtr = (char *) (info->lfbPtr); /* For arithmetic, use char * */ + + /* + * These two come directly from the info structure. + */ + ReadParamsp->lfbPtr = (void *) lfbPtr; + ReadParamsp->LFBStrideInElts = strideInBytes / elementSize; + /* + * Now, calculate the value of firstWrappedX. + * + * The physical stride is the screen width in bytes rounded up to + * the next highest multiple of 128 bytes. Note that this fails + * when TILE_WIDTH_IN_BYTES is not a power of two. + * + * The buffer Offset is the distance between the beginning of + * the LFB space, which is the beginning of the back buffer, + * and the buffer we are gathering information about. + * We want to make this routine usable for operations on the + * back buffer, though we don't actually use it on the back + * buffer. Note, then, that if bufferOffset == 0, the firstWrappedX + * is in the forbidden zone, and is therefore never reached. + * + * Note that if + * physicalStrideInBytes + * < bufferOffset&(info->strideInBytes-1) + * the buffer begins in the forbidden zone. We assert for this. + */ + bufferOffset = (FxU32)(lfbPtr - (char *) backBufferInfo->lfbPtr); + physicalStrideInBytes + = (fxMesa->screen_width * elementSize + TILE_WIDTH_IN_BYTES - 1) + & ~(TILE_WIDTH_IN_BYTES - 1); + assert(physicalStrideInBytes > (bufferOffset & (strideInBytes - 1))); + ReadParamsp->firstWrappedX + = (physicalStrideInBytes + - (bufferOffset & (strideInBytes - 1))) / elementSize; + /* + * This is the address of the next physical line. + */ + ReadParamsp->lfbWrapPtr + = (void *) ((char *) backBufferInfo->lfbPtr + + (bufferOffset & ~(strideInBytes - 1)) + + (TILE_HEIGHT_IN_LINES) * strideInBytes); +} + +/* + * These macros fetch data from the frame buffer. The type is + * the type of data we want to fetch. It should match the type + * whose size was used with GetFbParams to fill in the structure + * in *ReadParamsp. We have a macro to read the ordinary + * part, a second macro to read the wrapped part, and one which + * will do either. When we are reading a span, we will know + * when the ordinary part ends, so there's no need to test for + * it. However, when reading and writing pixels, we don't + * necessarily know. I suppose it's a matter of taste whether + * it's better in the macro or in the call. + * + * Recall that x and y are screen coordinates. + */ +#define GET_FB_DATA(ReadParamsp, type, x, y) \ + (((x) < (ReadParamsp)->firstWrappedX) \ + ? (((type *)((ReadParamsp)->lfbPtr)) \ + [(y) * ((ReadParamsp)->LFBStrideInElts) \ + + (x)]) \ + : (((type *)((ReadParamsp)->lfbWrapPtr)) \ + [((y)) * ((ReadParamsp)->LFBStrideInElts) \ + + ((x) - (ReadParamsp)->firstWrappedX)])) +#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) \ + (((type *)((ReadParamsp)->lfbPtr)) \ + [(y) * ((ReadParamsp)->LFBStrideInElts) \ + + (x)]) +#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) \ + (((type *)((ReadParamsp)->lfbWrapPtr)) \ + [((y)) * ((ReadParamsp)->LFBStrideInElts) \ + + ((x) - (ReadParamsp)->firstWrappedX)]) +#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) +#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) +#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value) \ + (GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value)) + +static void +tdfxDDWriteDepthSpan(GLcontext * ctx, + GLuint n, GLint x, GLint y, const GLdepth depth[], + const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->y_offset + fxMesa->height - 1; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GrLfbInfo_t info; + GLubyte visMask[MAX_WIDTH]; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthSpan(...)\n"); + } + + assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32)); + /* + * Convert x and y to screen coordinates. + */ + x += fxMesa->x_offset; + y = bottom - y; + if (mask) { + GLint i; + GLushort d16; + GrLfbInfo_t backBufferInfo; + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, + GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + int wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (mask[i] && visMask[i]) { + d16 = depth[i]; + PUT_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y, d16); + } + } + for (; i < n; i++) { + if (mask[i] && visMask[i]) { + d16 = depth[i]; + PUT_WRAPPED_FB_DATA(&ReadParams, GLushort, x + i, y, d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, + GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + int wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + GLuint d32; + if (mask[i] && visMask[i]) { + if (stencil_size > 0) { + d32 = + GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + for (; i < n; i++) { + GLuint d32; + if (mask[i] && visMask[i]) { + if (stencil_size > 0) { + d32 = + GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } + else { + GLint i; + GLuint d32; + GLushort d16; + GrLfbInfo_t backBufferInfo; + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + GLuint wrappedPartStart; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i]) { + d16 = depth[i]; + PUT_ORDINARY_FB_DATA(&ReadParams, + GLushort, + x + i, y, + d16); + } + } + for (; i < n; i++) { + if (visMask[i]) { + d16 = depth[i]; + PUT_WRAPPED_FB_DATA(&ReadParams, + GLushort, + x + i, y, + d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + generate_vismask(fxMesa, x, y, n, visMask); + { + LFBParameters ReadParams; + GLuint wrappedPartStart; + + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i]) { + if (stencil_size > 0) { + d32 = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + for (; i < n; i++) { + if (visMask[i]) { + if (stencil_size > 0) { + d32 = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y); + d32 = + (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF); + } + else { + d32 = depth[i]; + } + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } +} + +static void +tdfxDDReadDepthSpan(GLcontext * ctx, + GLuint n, GLint x, GLint y, GLdepth depth[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLuint depth_size = fxMesa->glVis->DepthBits; + GrLfbInfo_t info; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDReadDepthSpan(...)\n"); + } + + /* + * Convert to screen coordinates. + */ + x += fxMesa->x_offset; + y = bottom - y; + switch (depth_size) { + case 16: + { + LFBParameters ReadParams; + GrLfbInfo_t backBufferInfo; + int wrappedPartStart; + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + /* + * Read the line. + */ + for (i = 0; i < wrappedPartStart; i++) { + depth[i] = + GET_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y); + } + for (; i < n; i++) { + depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLushort, + x + i, y); + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + case 24: + case 32: + { + LFBParameters ReadParams; + GrLfbInfo_t backBufferInfo; + int wrappedPartStart; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + /* + * Read the line. + */ + for (i = 0; i < wrappedPartStart; i++) { + const GLuint mask = + (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF; + depth[i] = + GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y); + depth[i] &= mask; + } + for (; i < n; i++) { + const GLuint mask = + (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF; + depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y); + depth[i] &= mask; + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } + } +} + + +static void +tdfxDDWriteDepthPixels(GLcontext * ctx, + GLuint n, const GLint x[], const GLint y[], + const GLdepth depth[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLushort d16; + GLuint d32; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; + GrLfbInfo_t info; + int xpos; + int ypos; + GrLfbInfo_t backBufferInfo; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthPixels(...)\n"); + } + + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + for (i = 0; i < n; i++) { + if (mask[i] && visible_pixel(fxMesa, x[i], y[i])) { + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d16 = depth[i]; + PUT_FB_DATA(&ReadParams, GLushort, xpos, ypos, d16); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, + GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + for (i = 0; i < n; i++) { + if (mask[i]) { + if (visible_pixel(fxMesa, x[i], y[i])) { + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + if (stencil_size > 0) { + d32 = + GET_FB_DATA(&ReadParams, GLuint, xpos, ypos); + d32 = (d32 & 0xFF000000) | (depth[i] & 0xFFFFFF); + } + else { + d32 = depth[i]; + } + PUT_FB_DATA(&ReadParams, GLuint, xpos, ypos, d32); + } + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + } +} + + +static void +tdfxDDReadDepthPixels(GLcontext * ctx, GLuint n, + const GLint x[], const GLint y[], GLdepth depth[]) +{ + tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLushort d16; + int xpos; + int ypos; + GrLfbInfo_t info; + GLuint stencil_size; + GrLfbInfo_t backBufferInfo; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "tdfxmesa: tdfxDDReadDepthPixels(...)\n"); + } + + assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32)); + switch (depth_size) { + case 16: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLushort)); + for (i = 0; i < n; i++) { + /* + * Convert to screen coordinates. + */ + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d16 = GET_FB_DATA(&ReadParams, GLushort, xpos, ypos); + depth[i] = d16; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + case 24: + case 32: + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + stencil_size = fxMesa->glVis->StencilBits; + { + LFBParameters ReadParams; + GetFbParams(fxMesa, &info, &backBufferInfo, + &ReadParams, sizeof(GLuint)); + for (i = 0; i < n; i++) { + GLuint d32; + + /* + * Convert to screen coordinates. + */ + xpos = x[i] + fxMesa->x_offset; + ypos = bottom - y[i]; + d32 = GET_FB_DATA(&ReadParams, GLuint, xpos, ypos); + if (stencil_size > 0) { + d32 &= 0x00FFFFFF; + } + depth[i] = d32; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); + break; + default: + assert(0); + } +} + +/* + * Stencil buffer read/write functions. + */ +#define EXTRACT_S_FROM_ZS(zs) (((zs) >> 24) & 0xFF) +#define EXTRACT_Z_FROM_ZS(zs) ((zs) & 0xffffff) +#define BUILD_ZS(z, s) (((s) << 24) | (z)) + +static void +write_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, + const GLstencil stencil[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + LFBParameters ReadParams; + GLubyte visMask[MAX_WIDTH]; + GLuint i; + int wrappedPartStart; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + generate_vismask(fxMesa, scrX, scrY, n, visMask); + for (i = 0; i < wrappedPartStart; i++) { + if (visMask[i] && (!mask || mask[i])) { + GLuint z = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + scrX + i, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z); + } + } + for (; i < n; i++) { + if (visMask[i] && (!mask || mask[i])) { + GLuint z = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + scrX + i, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +read_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, + GLstencil stencil[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + GLuint i; + LFBParameters ReadParams; + int wrappedPartStart; + + /* + * Convert to screen coordinates. + */ + x += winX; + y = winY - y; + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + if (ReadParams.firstWrappedX <= x) { + wrappedPartStart = 0; + } + else if (n <= (ReadParams.firstWrappedX - x)) { + wrappedPartStart = n; + } + else { + wrappedPartStart = (ReadParams.firstWrappedX - x); + } + for (i = 0; i < wrappedPartStart; i++) { + stencil[i] = (GET_ORDINARY_FB_DATA(&ReadParams, GLuint, + x + i, y) >> 24) & 0xFF; + } + for (; i < n; i++) { + stencil[i] = (GET_WRAPPED_FB_DATA(&ReadParams, GLuint, + x + i, y) >> 24) & 0xFF; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +write_stencil_pixels(GLcontext * ctx, GLuint n, + const GLint x[], const GLint y[], + const GLstencil stencil[], const GLubyte mask[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + LFBParameters ReadParams; + GLuint i; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + for (i = 0; i < n; i++) { + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + if ((!mask || mask[i]) && visible_pixel(fxMesa, scrX, scrY)) { + GLuint z = + GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) & 0x00FFFFFF; + z |= (stencil[i] & 0xFF) << 24; + PUT_FB_DATA(&ReadParams, GLuint, scrX, scrY, z); + } + } + } + WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + + +static void +read_stencil_pixels(GLcontext * ctx, GLuint n, const GLint x[], + const GLint y[], GLstencil stencil[]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrLfbInfo_t info; + GrLfbInfo_t backBufferInfo; + + GetBackBufferInfo(fxMesa, &backBufferInfo); + /* + * Note that the _LOCK macro adds a curly brace, + * and the UNLOCK macro removes it. + */ + READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER); + { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + GLuint i; + LFBParameters ReadParams; + + GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams, + sizeof(GLuint)); + for (i = 0; i < n; i++) { + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + stencil[i] = + (GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) >> 24) & 0xFF; + } + } + READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER); +} + +#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \ + ((vis->RedBits == r) && \ + (vis->GreenBits == g) && \ + (vis->BlueBits == b) && \ + (vis->AlphaBits == a)) + +void tdfxDDInitSpanFuncs( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) ) + { + /* 16bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_RGB565; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_RGB565; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB565; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_RGB565; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB565; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_RGB565; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_RGB565; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 0) ) + { + /* 24bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_RGB888; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_RGB888; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB888; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_RGB888; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB888; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_RGB888; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_RGB888; + } + else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) ) + { + /* 32bpp mode */ + ctx->Driver.WriteRGBASpan = tdfxWriteRGBASpan_ARGB8888; + ctx->Driver.WriteRGBSpan = tdfxWriteRGBSpan_ARGB8888; + ctx->Driver.WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB8888; + ctx->Driver.WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB8888; + ctx->Driver.WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB8888; + ctx->Driver.ReadRGBAPixels = tdfxReadRGBAPixels_ARGB8888; + ctx->Driver.ReadRGBASpan = tdfxReadRGBASpan_ARGB8888; + } + else + { + abort(); + } + + if ( fxMesa->haveHwStencil ) { + ctx->Driver.WriteStencilSpan = write_stencil_span; + ctx->Driver.ReadStencilSpan = read_stencil_span; + ctx->Driver.WriteStencilPixels = write_stencil_pixels; + ctx->Driver.ReadStencilPixels = read_stencil_pixels; + } + + ctx->Driver.WriteDepthSpan = tdfxDDWriteDepthSpan; + ctx->Driver.WriteDepthPixels = tdfxDDWriteDepthPixels; + ctx->Driver.ReadDepthSpan = tdfxDDReadDepthSpan; + ctx->Driver.ReadDepthPixels = tdfxDDReadDepthPixels; + + ctx->Driver.WriteCI8Span = NULL; + ctx->Driver.WriteCI32Span = NULL; + ctx->Driver.WriteMonoCISpan = NULL; + ctx->Driver.WriteCI32Pixels = NULL; + ctx->Driver.WriteMonoCIPixels = NULL; + ctx->Driver.ReadCI32Span = NULL; + ctx->Driver.ReadCI32Pixels = NULL; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h new file mode 100644 index 000000000..8373d1af4 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h @@ -0,0 +1,48 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_span.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_SPAN_H__ +#define __TDFX_SPAN_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" + +extern void tdfxDDInitSpanFuncs( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c new file mode 100644 index 000000000..289ecde4d --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c @@ -0,0 +1,1548 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_state.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "types.h" +#include "pb.h" + +#include "dri_glide.h" + +#include "tdfx_context.h" +#include "tdfx_state.h" +#include "tdfx_vb.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" +#include "tdfx_tris.h" +#include "tdfx_render.h" + + + +/* ============================================================= + * Alpha blending + */ + +static void tdfxUpdateAlphaMode( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCmpFnc_t func; + GrAlphaBlendFnc_t srcRGB, dstRGB, srcA, dstA; + GrAlpha_t ref = ctx->Color.AlphaRef; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Color.AlphaEnabled ) { + switch ( ctx->Color.AlphaFunc ) { + case GL_NEVER: + func = GR_CMP_NEVER; + break; + case GL_LESS: + func = GR_CMP_LESS; + break; + case GL_LEQUAL: + func = GR_CMP_LEQUAL; + break; + case GL_EQUAL: + func = GR_CMP_EQUAL; + break; + case GL_GEQUAL: + func = GR_CMP_GEQUAL; + break; + case GL_GREATER: + func = GR_CMP_GREATER; + break; + case GL_NOTEQUAL: + func = GR_CMP_NOTEQUAL; + break; + case GL_ALWAYS: + default: + func = GR_CMP_ALWAYS; + break; + } + } else { + func = GR_CMP_ALWAYS; + } + + if ( ctx->Color.BlendEnabled + && (fxMesa->Fallback & TDFX_FALLBACK_BLEND) == 0 ) { + switch ( ctx->Color.BlendSrcRGB ) { + case GL_ZERO: + srcRGB = GR_BLEND_ZERO; + break; + case GL_ONE: + srcRGB = GR_BLEND_ONE; + break; + case GL_DST_COLOR: + srcRGB = GR_BLEND_DST_COLOR; + break; + case GL_ONE_MINUS_DST_COLOR: + srcRGB = GR_BLEND_ONE_MINUS_DST_COLOR; + break; + case GL_SRC_ALPHA: + srcRGB = GR_BLEND_SRC_ALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + srcRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA; + break; + case GL_DST_ALPHA: + srcRGB = GR_BLEND_DST_ALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + srcRGB = GR_BLEND_ONE_MINUS_DST_ALPHA; + break; + case GL_SRC_ALPHA_SATURATE: + srcRGB = GR_BLEND_ALPHA_SATURATE; + break; + default: + srcRGB = GR_BLEND_ONE; + } + + switch ( ctx->Color.BlendSrcA ) { + case GL_ZERO: + srcA = GR_BLEND_ZERO; + break; + case GL_ONE: + srcA = GR_BLEND_ONE; + break; + case GL_DST_COLOR: + srcA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_COLOR: + srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA: + srcA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_ALPHA: + srcA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_DST_ALPHA: + srcA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_ALPHA: + srcA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA_SATURATE: + srcA = GR_BLEND_ONE; + break; + default: + srcA = GR_BLEND_ONE; + } + + switch ( ctx->Color.BlendDstRGB ) { + case GL_ZERO: + dstRGB = GR_BLEND_ZERO; + break; + case GL_ONE: + dstRGB = GR_BLEND_ONE; + break; + case GL_SRC_COLOR: + dstRGB = GR_BLEND_SRC_COLOR; + break; + case GL_ONE_MINUS_SRC_COLOR: + dstRGB = GR_BLEND_ONE_MINUS_SRC_COLOR; + break; + case GL_SRC_ALPHA: + dstRGB = GR_BLEND_SRC_ALPHA; + break; + case GL_ONE_MINUS_SRC_ALPHA: + dstRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA; + break; + case GL_DST_ALPHA: + dstRGB = GR_BLEND_DST_ALPHA; + break; + case GL_ONE_MINUS_DST_ALPHA: + dstRGB = GR_BLEND_ONE_MINUS_DST_ALPHA; + break; + default: + dstRGB = GR_BLEND_ZERO; + } + + switch ( ctx->Color.BlendDstA ) { + case GL_ZERO: + dstA = GR_BLEND_ZERO; + break; + case GL_ONE: + dstA = GR_BLEND_ONE; + break; + case GL_SRC_COLOR: + dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_COLOR: + dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_SRC_ALPHA: + dstA = GR_BLEND_SRC_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_SRC_ALPHA: + dstA = GR_BLEND_ONE_MINUS_SRC_ALPHA; /* Napalm only */ + break; + case GL_DST_ALPHA: + dstA = GR_BLEND_DST_ALPHA; /* Napalm only */ + break; + case GL_ONE_MINUS_DST_ALPHA: + dstA = GR_BLEND_ONE_MINUS_DST_ALPHA; /* Napalm only */ + break; + default: + dstA = GR_BLEND_ZERO; + } + } else { + /* blend disabled */ + srcRGB = GR_BLEND_ONE; + dstRGB = GR_BLEND_ZERO; + srcA = GR_BLEND_ONE; + dstA = GR_BLEND_ZERO; + } + + if ( fxMesa->Color.AlphaFunc != func ) { + fxMesa->Color.AlphaFunc = func; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_TEST; + } + if ( fxMesa->Color.AlphaRef != ref ) { + fxMesa->Color.AlphaRef = ref; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_REF; + } + + if ( fxMesa->Color.BlendSrcRGB != srcRGB || + fxMesa->Color.BlendDstRGB != dstRGB || + fxMesa->Color.BlendSrcA != srcA || + fxMesa->Color.BlendDstA != dstA ) + { + fxMesa->Color.BlendSrcRGB = srcRGB; + fxMesa->Color.BlendDstRGB = dstRGB; + fxMesa->Color.BlendSrcA = srcA; + fxMesa->Color.BlendDstA = dstA; + fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC; + } +} + +static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLclampf ref ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; +} + +static void tdfxDDBlendEquation( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; +} + +static void tdfxDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + + /* + * XXX - Voodoo5 seems to suffer from precision problems in some + * blend modes. To pass all the conformance tests we'd have to + * fall back to software for many modes. Revisit someday. + */ +} + +static void tdfxDDBlendFuncSeparate( GLcontext *ctx, + GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; +} + +/* ============================================================= + * Stipple + */ + +static void tdfxUpdateStipple( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GrStippleMode_t mode = GR_STIPPLE_DISABLE; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + + if (ctx->Polygon.StippleFlag) { + mode = GR_STIPPLE_PATTERN; + } + + if ( fxMesa->Stipple.Mode != mode ) { + fxMesa->Stipple.Mode = mode; + fxMesa->dirty |= TDFX_UPLOAD_STIPPLE; + } +} + + +/* ============================================================= + * Depth testing + */ + +static void tdfxUpdateZMode( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GrCmpFnc_t func; + FxI32 bias; + FxBool mask; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE); + + if ( ctx->Depth.Test ) { + switch ( ctx->Depth.Func ) { + case GL_NEVER: + func = GR_CMP_NEVER; + break; + case GL_LESS: + func = GR_CMP_LESS; + break; + case GL_LEQUAL: + func = GR_CMP_LEQUAL; + break; + case GL_EQUAL: + func = GR_CMP_EQUAL; + break; + case GL_GEQUAL: + func = GR_CMP_GEQUAL; + break; + case GL_GREATER: + func = GR_CMP_GREATER; + break; + case GL_NOTEQUAL: + func = GR_CMP_NOTEQUAL; + break; + case GL_ALWAYS: + default: + func = GR_CMP_ALWAYS; + break; + } + + if ( ctx->Depth.Mask ) { + mask = FXTRUE; + } + else { + mask = FXFALSE; + } + } + else { + /* depth testing disabled */ + func = GR_CMP_ALWAYS; /* fragments always pass */ + mask = FXFALSE; /* zbuffer is not touched */ + } + + fxMesa->Depth.Clear = (FxU32) (((1 << fxMesa->glVis->DepthBits) - 1) + * ctx->Depth.Clear); + + if ( fxMesa->Depth.Bias != bias ) { + fxMesa->Depth.Bias = bias; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS; + } + if ( fxMesa->Depth.Func != func ) { + fxMesa->Depth.Func = func; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_FUNC | TDFX_UPLOAD_DEPTH_MASK; + } + if ( fxMesa->Depth.Mask != mask ) { + fxMesa->Depth.Mask = mask; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_MASK; + } +} + +static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + +static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + +static void tdfxDDClearDepth( GLcontext *ctx, GLclampd d ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; +} + + + +/* ============================================================= + * Stencil + */ + + +/* Evaluate all stencil state and make the Glide calls. + */ +static GrStencil_t convertGLStencilOp( GLenum op ) +{ + switch ( op ) { + case GL_KEEP: + return GR_STENCILOP_KEEP; + case GL_ZERO: + return GR_STENCILOP_ZERO; + case GL_REPLACE: + return GR_STENCILOP_REPLACE; + case GL_INCR: + return GR_STENCILOP_INCR_CLAMP; + case GL_DECR: + return GR_STENCILOP_DECR_CLAMP; + case GL_INVERT: + return GR_STENCILOP_INVERT; + case GL_INCR_WRAP_EXT: + return GR_STENCILOP_INCR_WRAP; + case GL_DECR_WRAP_EXT: + return GR_STENCILOP_DECR_WRAP; + default: + gl_problem( NULL, "bad stencil op in convertGLStencilOp" ); + } + return GR_STENCILOP_KEEP; /* never get, silence compiler warning */ +} + + +static void tdfxUpdateStencil( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if (fxMesa->haveHwStencil) { + if (ctx->Stencil.Enabled) { + fxMesa->Stencil.Function = ctx->Stencil.Function - GL_NEVER; + fxMesa->Stencil.RefValue = ctx->Stencil.Ref; + fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask; + fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask; + fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc); + fxMesa->Stencil.ZFailFunc =convertGLStencilOp(ctx->Stencil.ZFailFunc); + fxMesa->Stencil.ZPassFunc =convertGLStencilOp(ctx->Stencil.ZPassFunc); + fxMesa->Stencil.Clear = ctx->Stencil.Clear & 0xff; + } + fxMesa->dirty |= TDFX_UPLOAD_STENCIL; + } +} + + +static void tdfxDDStencilFunc( GLcontext *ctx, GLenum func, + GLint ref, GLuint mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + +static void tdfxDDStencilMask( GLcontext *ctx, GLuint mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + +static void tdfxDDStencilOp( GLcontext *ctx, GLenum sfail, + GLenum zfail, GLenum zpass ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_STENCIL; +} + + +/* ============================================================= + * Fog - orthographic fog still not working + */ + +static void tdfxUpdateFogAttrib( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrFogMode_t mode; + GrColor_t color; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Fog.Enabled ) { + mode = GR_FOG_WITH_TABLE_ON_Q; + } else { + mode = GR_FOG_DISABLE; + } + + color = TDFXPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F), + (GLubyte)(ctx->Fog.Color[1]*255.0F), + (GLubyte)(ctx->Fog.Color[2]*255.0F)); + + if ( fxMesa->Fog.Mode != mode ) { + fxMesa->Fog.Mode = mode; + fxMesa->dirty |= TDFX_UPLOAD_FOG_MODE; + } + if ( fxMesa->Fog.Color != color ) { + fxMesa->Fog.Color = color; + fxMesa->dirty |= TDFX_UPLOAD_FOG_COLOR; + } + if ( fxMesa->Fog.TableMode != ctx->Fog.Mode || + fxMesa->Fog.Density != ctx->Fog.Density || + fxMesa->Fog.Near != ctx->Fog.Start || + fxMesa->Fog.Far != ctx->Fog.End ) + { + switch( ctx->Fog.Mode ) { + case GL_EXP: + guFogGenerateExp( fxMesa->Fog.Table, ctx->Fog.Density ); + break; + case GL_EXP2: + guFogGenerateExp2( fxMesa->Fog.Table, ctx->Fog.Density ); + break; + case GL_LINEAR: + guFogGenerateLinear( fxMesa->Fog.Table, + ctx->Fog.Start, ctx->Fog.End ); + break; + } + + fxMesa->Fog.TableMode = ctx->Fog.Mode; + fxMesa->Fog.Density = ctx->Fog.Density; + fxMesa->Fog.Near = ctx->Fog.Start; + fxMesa->Fog.Far = ctx->Fog.End; + fxMesa->dirty |= TDFX_UPLOAD_FOG_TABLE; + } +} + +static void tdfxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_FOG; +} + + +/* ============================================================= + * Clipping + */ + +static int intersect_rect( XF86DRIClipRectPtr out, + const XF86DRIClipRectPtr a, + const XF86DRIClipRectPtr b) +{ + *out = *a; + if (b->x1 > out->x1) out->x1 = b->x1; + if (b->y1 > out->y1) out->y1 = b->y1; + if (b->x2 < out->x2) out->x2 = b->x2; + if (b->y2 < out->y2) out->y2 = b->y2; + if (out->x1 >= out->x2) return 0; + if (out->y1 >= out->y2) return 0; + return 1; +} + + +/* + * Examine XF86 cliprect list and scissor state to recompute our + * cliprect list. + */ +void tdfxUpdateClipping( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + assert(ctx); + assert(fxMesa); + assert(dPriv); + + if ( dPriv->x != fxMesa->x_offset || dPriv->y != fxMesa->y_offset || + dPriv->w != fxMesa->width || dPriv->h != fxMesa->height ) { + fxMesa->x_offset = dPriv->x; + fxMesa->y_offset = dPriv->y; + fxMesa->width = dPriv->w; + fxMesa->height = dPriv->h; + fxMesa->y_delta = + fxMesa->screen_height - fxMesa->y_offset - fxMesa->height; + } + + if (fxMesa->scissoredClipRects && fxMesa->pClipRects) { + free(fxMesa->pClipRects); + } + + if (ctx->Scissor.Enabled) { + /* intersect OpenGL scissor box with all cliprects to make a new + * list of cliprects. + */ + XF86DRIClipRectRec scissor; + int x1 = ctx->Scissor.X + fxMesa->x_offset; + int y1 = fxMesa->screen_height - fxMesa->y_delta + - ctx->Scissor.Y - ctx->Scissor.Height; + int x2 = x1 + ctx->Scissor.Width; + int y2 = y1 + ctx->Scissor.Height; + scissor.x1 = MAX2(x1, 0); + scissor.y1 = MAX2(y1, 0); + scissor.x2 = MAX2(x2, 0); + scissor.y2 = MAX2(y2, 0); + + assert(scissor.x2 >= scissor.x1); + assert(scissor.y2 >= scissor.y1); + + fxMesa->pClipRects = malloc(dPriv->numClipRects + * sizeof(XF86DRIClipRectRec)); + if (fxMesa->pClipRects) { + int i; + fxMesa->numClipRects = 0; + for (i = 0; i < dPriv->numClipRects; i++) { + if (intersect_rect(&fxMesa->pClipRects[fxMesa->numClipRects], + &scissor, &dPriv->pClipRects[i])) { + fxMesa->numClipRects++; + } + } + fxMesa->scissoredClipRects = GL_TRUE; + } + else { + /* out of memory, forgo scissor */ + fxMesa->numClipRects = dPriv->numClipRects; + fxMesa->pClipRects = dPriv->pClipRects; + fxMesa->scissoredClipRects = GL_FALSE; + } + } + else { + fxMesa->numClipRects = dPriv->numClipRects; + fxMesa->pClipRects = dPriv->pClipRects; + fxMesa->scissoredClipRects = GL_FALSE; + } + + fxMesa->dirty |= TDFX_UPLOAD_CLIP; +} + + + +/* ============================================================= + * Culling + */ + +static void tdfxUpdateCull( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCullMode_t mode = GR_CULL_DISABLE; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( ctx->Polygon.CullFlag && + (ctx->PB->primitive == GL_POLYGON || + ctx->PB->primitive == GL_BITMAP) ) { + switch ( ctx->Polygon.CullFaceMode ) { + case GL_FRONT: + if ( ctx->Polygon.FrontFace == GL_CCW ) { + mode = GR_CULL_POSITIVE; + } else { + mode = GR_CULL_NEGATIVE; + } + break; + + case GL_BACK: + if ( ctx->Polygon.FrontFace == GL_CCW ) { + mode = GR_CULL_NEGATIVE; + } else { + mode = GR_CULL_POSITIVE; + } + break; + + case GL_FRONT_AND_BACK: + default: + mode = GR_CULL_DISABLE; + break; + } + } + + if ( fxMesa->CullMode != mode ) { + fxMesa->CullMode = mode; + fxMesa->dirty |= TDFX_UPLOAD_CULL; + } +} + +static void tdfxDDCullFace( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; +} + +static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; +} + + +/* ============================================================= + * Line drawing. + */ + +static void tdfxUpdateLine( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + fxMesa->dirty |= TDFX_UPLOAD_LINE; +} + + +static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_LINE; +} + + + +/* ============================================================= + * Color Attributes + */ + +static void tdfxDDLogicOp( GLcontext *ctx, GLenum opcode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if (ctx->Color.ColorLogicOpEnabled) + { + FLUSH_BATCH( fxMesa ); + + if (opcode == GL_COPY) + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; + else + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + } + else + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; +} + + +static GLboolean tdfxDDColorMask( GLcontext *ctx, + GLboolean r, GLboolean g, + GLboolean b, GLboolean a ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + if ( fxMesa->Color.ColorMask[RCOMP] != r || + fxMesa->Color.ColorMask[GCOMP] != g || + fxMesa->Color.ColorMask[BCOMP] != b || + fxMesa->Color.ColorMask[ACOMP] != a ) { + fxMesa->Color.ColorMask[RCOMP] = r; + fxMesa->Color.ColorMask[GCOMP] = g; + fxMesa->Color.ColorMask[BCOMP] = b; + fxMesa->Color.ColorMask[ACOMP] = a; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_MASK; + + if (ctx->Visual->RedBits < 8) { + /* Can't do RGB colormasking in 16bpp mode. */ + /* We can completely ignore the alpha mask. */ + if (r != g || g != b) { + fxMesa->Fallback |= TDFX_FALLBACK_COLORMASK; + } + else { + fxMesa->Fallback &= ~TDFX_FALLBACK_COLORMASK; + } + } + } + + return GL_FALSE; /* This forces the software paths to do colormasking. */ + /* This function will return void when we use Mesa 3.5 */ +} + +static void tdfxDDColor( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrColor_t color; + + FLUSH_BATCH( fxMesa ); + + color = tdfxPackColor( fxMesa->fxScreen->cpp, r, g, b, a ); + + if ( fxMesa->Color.MonoColor != color ) { + fxMesa->Color.MonoColor = color; + fxMesa->dirty |= TDFX_UPLOAD_CONSTANT_COLOR; + } +} + +static void tdfxDDClearColor( GLcontext *ctx, + GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + FLUSH_BATCH( fxMesa ); + + fxMesa->Color.ClearColor = TDFXPACKCOLOR888( red, green, blue ); + fxMesa->Color.ClearAlpha = alpha; +} + + +/* ============================================================= + * Light Model + */ + +static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname, + const GLfloat *param ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) { + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_SPECULAR; + + if ( ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ) { + fxMesa->Fallback |= TDFX_FALLBACK_SPECULAR; + } + } +} + +static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + /* FIXME: Can we implement native flat shading? */ + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + + +/* ============================================================= + * Scissor + */ + +static void +tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CLIP; +} + +/* ============================================================= + * Render + */ + +static void tdfxUpdateRenderAttrib( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->dirty |= TDFX_UPLOAD_RENDER_BUFFER; +} + +/* ============================================================= + * Viewport + */ + +static void tdfxUpdateViewport( GLcontext *ctx ) +{ + /* XXX: Implement this when we're doing clip coordinates */ + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } +} + + +static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y, + GLsizei w, GLsizei h ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_VIEWPORT; +} + + +static void tdfxDDNearFar( GLcontext *ctx, GLfloat nearVal, GLfloat farVal ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_VIEWPORT; +} + + +/* ============================================================= + * State enable/disable + */ + +static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + switch ( cap ) { + case GL_ALPHA_TEST: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + break; + + case GL_BLEND: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_ALPHA; + + if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; + break; + + case GL_CULL_FACE: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CULL; + break; + + case GL_DEPTH_TEST: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_DEPTH; + break; + + case GL_DITHER: + FLUSH_BATCH( fxMesa ); + if ( state ) { + fxMesa->Color.Dither = GR_DITHER_2x2; + } else { + fxMesa->Color.Dither = GR_DITHER_DISABLE; + } + fxMesa->dirty |= TDFX_UPLOAD_DITHER; + break; + + case GL_FOG: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_FOG; + break; + + case GL_COLOR_LOGIC_OP: + FLUSH_BATCH( fxMesa ); + if ( state && ctx->Color.LogicOp != GL_COPY ) { + fxMesa->Fallback |= TDFX_FALLBACK_LOGICOP; + } else { + fxMesa->Fallback &= ~TDFX_FALLBACK_LOGICOP; + } + break; + + case GL_LINE_SMOOTH: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_LINE; + break; + + case GL_POLYGON_STIPPLE: + FLUSH_BATCH(fxMesa); + fxMesa->new_state |= TDFX_NEW_STIPPLE; + break; + + case GL_SCISSOR_TEST: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_CLIP; + break; + + case GL_STENCIL_TEST: + FLUSH_BATCH( fxMesa ); + if (fxMesa->haveHwStencil) + fxMesa->new_state |= TDFX_NEW_STENCIL; + else if (state) + fxMesa->Fallback |= TDFX_FALLBACK_STENCIL; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_STENCIL; + break; + + case GL_TEXTURE_1D: + case GL_TEXTURE_3D: + if (state) + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE; + else + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_2D: + FLUSH_BATCH( fxMesa ); + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + default: + return; + } +} + + + +/* Set the buffer used for drawing */ +/* XXX support for separate read/draw buffers hasn't been tested */ +static GLboolean tdfxDDSetDrawBuffer( GLcontext *ctx, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_BUFFER; + + switch ( mode ) { + case GL_FRONT_LEFT: + fxMesa->DrawBuffer = GR_BUFFER_FRONTBUFFER; + fxMesa->new_state |= TDFX_NEW_RENDER; + return GL_TRUE; + + case GL_BACK_LEFT: + fxMesa->DrawBuffer = GR_BUFFER_BACKBUFFER; + fxMesa->new_state |= TDFX_NEW_RENDER; + return GL_TRUE; + + case GL_NONE: + FX_grColorMaskv( ctx, false4 ); + return GL_TRUE; + + default: + fxMesa->Fallback |= TDFX_FALLBACK_BUFFER; + return GL_FALSE; + } +} + + +/* Set the buffer used for reading */ +/* XXX support for separate read/draw buffers hasn't been tested */ +static void tdfxDDSetReadBuffer( GLcontext *ctx, + GLframebuffer *buffer, GLenum mode ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + (void) buffer; + + FLUSH_BATCH( fxMesa ); + + fxMesa->Fallback &= ~TDFX_FALLBACK_BUFFER; + + switch ( mode ) { + case GL_FRONT_LEFT: + fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER; + break; + + case GL_BACK_LEFT: + fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER; + break; + + default: + fxMesa->Fallback |= TDFX_FALLBACK_BUFFER; + break; + } +} + +/* ============================================================= + * Polygon stipple + */ + +static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GLubyte *m = mask; + GLubyte q[4]; + int i,j,k; + int active = (ctx->Polygon.StippleFlag && ctx->PB->primitive == GL_POLYGON); + + FLUSH_BATCH(fxMesa); + + if (active) { + ctx->Driver.TriangleCaps |= DD_TRI_STIPPLE; + } + + q[0] = mask[0]; + q[1] = mask[4]; + q[2] = mask[8]; + q[3] = mask[12]; + + for (k = 0 ; k < 8 ; k++) + for (j = 0 ; j < 4; j++) + for (i = 0 ; i < 4 ; i++,m++) { + if (*m != q[j]) { + ctx->Driver.TriangleCaps &= ~DD_TRI_STIPPLE; + fxMesa->Stipple.Pattern = 0xffffffff; /* ensure all pixels on */ + return; + } + } + + /* We can do it, so flag an upload of the stipple pattern */ + fxMesa->Stipple.Pattern = ( (q[0] << 0) | + (q[1] << 8) | + (q[2] << 16) | + (q[3] << 24) ); + fxMesa->dirty |= TDFX_UPLOAD_STIPPLE; +} + +/* Always called between RenderStart and RenderFinish --> We already + * hold the lock. + */ +static void tdfxDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + + FLUSH_BATCH( fxMesa ); + + tdfxUpdateCull(ctx); + if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) { + grCullMode( fxMesa->CullMode ); + fxMesa->dirty &= ~TDFX_UPLOAD_CULL; + } + + tdfxUpdateStipple(ctx); + if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE ) { + grStipplePattern ( fxMesa->Stipple.Pattern ); + grStippleMode ( fxMesa->Stipple.Mode ); + fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE; + } +} + + + +static void tdfxDDPrintState( const char *msg, GLuint flags ) +{ + fprintf( stderr, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s\n", + msg, + flags, + (flags & TDFX_NEW_COLOR) ? "color, " : "", + (flags & TDFX_NEW_ALPHA) ? "alpha, " : "", + (flags & TDFX_NEW_DEPTH) ? "depth, " : "", + (flags & TDFX_NEW_RENDER) ? "render, " : "", + (flags & TDFX_NEW_FOG) ? "fog, " : "", + (flags & TDFX_NEW_STENCIL) ? "stencil, " : "", + (flags & TDFX_NEW_STIPPLE) ? "stipple, " : "", + (flags & TDFX_NEW_CLIP) ? "clip, " : "", + (flags & TDFX_NEW_VIEWPORT) ? "viewport, " : "", + (flags & TDFX_NEW_CULL) ? "cull, " : "", + (flags & TDFX_NEW_GLIDE) ? "glide, " : "", + (flags & TDFX_NEW_TEXTURE) ? "texture, " : "", + (flags & TDFX_NEW_CONTEXT) ? "context, " : ""); +} + + + +void tdfxDDUpdateHwState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + int new_state = fxMesa->new_state; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + if ( new_state ) + { + FLUSH_BATCH( fxMesa ); + + fxMesa->new_state = 0; + + if ( 0 ) + tdfxDDPrintState( "tdfxUpdateHwState", new_state ); + + /* Update the various parts of the context's state. + */ + if ( new_state & TDFX_NEW_ALPHA ) { + tdfxUpdateAlphaMode( ctx ); + } + + if ( new_state & TDFX_NEW_DEPTH ) + tdfxUpdateZMode( ctx ); + + if ( new_state & TDFX_NEW_FOG ) + tdfxUpdateFogAttrib( ctx ); + + if ( new_state & TDFX_NEW_CLIP ) + tdfxUpdateClipping( ctx ); + + if ( new_state & TDFX_NEW_STIPPLE ) + tdfxUpdateStipple( ctx ); + + if ( new_state & TDFX_NEW_CULL ) + tdfxUpdateCull( ctx ); + + if ( new_state & TDFX_NEW_LINE ) + tdfxUpdateLine( ctx ); + + if ( new_state & TDFX_NEW_VIEWPORT ) + tdfxUpdateViewport( ctx ); + + if ( new_state & TDFX_NEW_RENDER ) + tdfxUpdateRenderAttrib( ctx ); + + if ( new_state & TDFX_NEW_STENCIL ) + tdfxUpdateStencil( ctx ); + + if ( new_state & TDFX_NEW_TEXTURE ) { + tdfxUpdateTextureState( ctx ); + } + else if ( new_state & TDFX_NEW_TEXTURE_BIND ) { + tdfxUpdateTextureBinding( ctx ); + } + } + + if ( 0 ) { + FxI32 bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE); + + if ( fxMesa->Depth.Bias != bias ) { + fxMesa->Depth.Bias = bias; + fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS; + } + } + + if ( fxMesa->dirty ) { + LOCK_HARDWARE( fxMesa ); + tdfxEmitHwStateLocked( fxMesa ); + UNLOCK_HARDWARE( fxMesa ); + } +} + + +static void tdfxDDRenderStart( GLcontext *ctx ) +{ + tdfxDDUpdateHwState( ctx ); + LOCK_HARDWARE( TDFX_CONTEXT(ctx) ); +} + +static void tdfxDDRenderFinish( GLcontext *ctx ) +{ + UNLOCK_HARDWARE( TDFX_CONTEXT(ctx) ); +} + +#define INTERESTED (~(NEW_MODELVIEW | \ + NEW_PROJECTION | \ + NEW_TEXTURE_MATRIX | \ + NEW_USER_CLIP | \ + NEW_CLIENT_STATE | \ + NEW_TEXTURE_ENABLE)) + +static void tdfxDDUpdateState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, "%s()\n", __FUNCTION__ ); + } + + /* Have to do this here to detect texture, line fallbacks in time: + */ + if ( fxMesa->new_state & (TDFX_NEW_TEXTURE | TDFX_NEW_LINE) ) + tdfxDDUpdateHwState( ctx ); + + if ( ctx->NewState & INTERESTED ) { + tdfxDDChooseRenderState( ctx ); + } + + /* The choise of vertex setup function only depends on whether fog + * and/or texturing is enabled. + */ + if ( ctx->NewState & (NEW_FOG | NEW_TEXTURE_ENABLE | NEW_TEXTURING)) { + tdfxDDChooseRasterSetupFunc( ctx ); + } + + if ( 0 ) + fprintf( stderr, "fallback %x indirect %x\n", + fxMesa->Fallback, fxMesa->IndirectTriangles ); + + if ( fxMesa->Fallback ) { + ctx->IndirectTriangles |= ctx->TriangleCaps; + } + else { + ctx->IndirectTriangles &= ~DD_SW_RASTERIZE; + ctx->IndirectTriangles |= fxMesa->IndirectTriangles; + + ctx->Driver.PointsFunc = fxMesa->PointsFunc; + ctx->Driver.LineFunc = fxMesa->LineFunc; + ctx->Driver.TriangleFunc = fxMesa->TriangleFunc; + ctx->Driver.QuadFunc = fxMesa->QuadFunc; + ctx->Driver.RenderVBRawTab = fxMesa->RenderVBRawTab; + } +} + + + +/* Initialize the context's Glide state mirror. These values will be + * used as Glide function call parameters when the time comes. + */ +void tdfxInitState( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + GLint i; + + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + + fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + + fxMesa->sScale0 = fxMesa->tScale0 = 1.0; + fxMesa->sScale1 = fxMesa->tScale1 = 1.0; + + fxMesa->TexPalette.Type = 0; + fxMesa->TexPalette.Data = NULL; + + for ( i = 0 ; i < TDFX_NUM_TMU ; i++ ) { + fxMesa->TexSource[i].StartAddress = 0; + fxMesa->TexSource[i].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[i].Info = NULL; + + fxMesa->TexCombine[i].FunctionRGB = 0; + fxMesa->TexCombine[i].FactorRGB = 0; + fxMesa->TexCombine[i].FunctionAlpha = 0; + fxMesa->TexCombine[i].FactorAlpha = 0; + fxMesa->TexCombine[i].InvertRGB = FXFALSE; + fxMesa->TexCombine[i].InvertAlpha = FXFALSE; + + fxMesa->TexCombineExt[i].Alpha.SourceA = 0; + /* XXX more state to init here */ + fxMesa->TexCombineExt[i].Color.SourceA = 0; + fxMesa->TexCombineExt[i].EnvColor = 0x0; + + fxMesa->TexParams[i].sClamp = GR_TEXTURECLAMP_WRAP; + fxMesa->TexParams[i].tClamp = GR_TEXTURECLAMP_WRAP; + fxMesa->TexParams[i].minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + fxMesa->TexParams[i].magFilt = GR_TEXTUREFILTER_BILINEAR; + fxMesa->TexParams[i].mmMode = GR_MIPMAP_DISABLE; + fxMesa->TexParams[i].LODblend = FXFALSE; + fxMesa->TexParams[i].LodBias = 0.0; + + fxMesa->TexState.EnvMode[i] = ~0; + fxMesa->TexState.TexFormat[i] = ~0; + fxMesa->TexState.Enabled = 0; + } + + if ( ctx->Visual->DBflag) { + fxMesa->DrawBuffer = GR_BUFFER_BACKBUFFER; + fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER; + } else { + fxMesa->DrawBuffer = GR_BUFFER_FRONTBUFFER; + fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER; + } + + fxMesa->Color.ClearColor = 0x00000000; + fxMesa->Color.ClearAlpha = 0x00; + fxMesa->Color.ColorMask[RCOMP] = FXTRUE; + fxMesa->Color.ColorMask[BCOMP] = FXTRUE; + fxMesa->Color.ColorMask[GCOMP] = FXTRUE; + fxMesa->Color.ColorMask[ACOMP] = FXTRUE; + fxMesa->Color.MonoColor = 0xffffffff; + + fxMesa->Color.AlphaFunc = GR_CMP_ALWAYS; + fxMesa->Color.AlphaRef = 0x00; + fxMesa->Color.BlendSrcRGB = GR_BLEND_ONE; + fxMesa->Color.BlendDstRGB = GR_BLEND_ZERO; + fxMesa->Color.BlendSrcA = GR_BLEND_ONE; + fxMesa->Color.BlendSrcA = GR_BLEND_ZERO; + + fxMesa->Color.Dither = GR_DITHER_2x2; + + if ( fxMesa->glVis->DepthBits > 0 ) { + fxMesa->Depth.Mode = GR_DEPTHBUFFER_ZBUFFER; + } else { + fxMesa->Depth.Mode = GR_DEPTHBUFFER_DISABLE; + } + fxMesa->Depth.Bias = 0; + fxMesa->Depth.Func = GR_CMP_LESS; + fxMesa->Depth.Clear = 0; /* computed later */ + fxMesa->Depth.Mask = FXTRUE; + + + fxMesa->Fog.Mode = GR_FOG_DISABLE; + fxMesa->Fog.Color = 0x00000000; + fxMesa->Fog.Table = NULL; + fxMesa->Fog.Density = 1.0; + fxMesa->Fog.Near = 1.0; + fxMesa->Fog.Far = 1.0; + + fxMesa->Stencil.Function = GR_CMP_ALWAYS; + fxMesa->Stencil.RefValue = 0; + fxMesa->Stencil.ValueMask = 0xff; + fxMesa->Stencil.WriteMask = 0xff; + fxMesa->Stencil.FailFunc = 0; + fxMesa->Stencil.ZFailFunc = 0; + fxMesa->Stencil.ZPassFunc = 0; + fxMesa->Stencil.Clear = 0; + + fxMesa->Stipple.Mode = GR_STIPPLE_DISABLE; + fxMesa->Stipple.Pattern = 0xffffffff; + + fxMesa->Scissor.minX = 0; + fxMesa->Scissor.minY = 0; + fxMesa->Scissor.maxX = 0; + fxMesa->Scissor.maxY = 0; + + fxMesa->Viewport.Mode = GR_WINDOW_COORDS; + fxMesa->Viewport.X = 0; + fxMesa->Viewport.Y = 0; + fxMesa->Viewport.Width = 0; + fxMesa->Viewport.Height = 0; + fxMesa->Viewport.Near = 0.0; + fxMesa->Viewport.Far = 0.0; + + fxMesa->CullMode = GR_CULL_DISABLE; + + fxMesa->Glide.ColorFormat = GR_COLORFORMAT_ABGR; + fxMesa->Glide.Origin = GR_ORIGIN_LOWER_LEFT; + fxMesa->Glide.Initialized = FXFALSE; +} + + + +void tdfxDDInitStateFuncs( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + ctx->Driver.UpdateState = tdfxDDUpdateState; + + ctx->Driver.ClearIndex = NULL; + ctx->Driver.ClearColor = tdfxDDClearColor; + ctx->Driver.Index = NULL; + ctx->Driver.Color = tdfxDDColor; + ctx->Driver.SetDrawBuffer = tdfxDDSetDrawBuffer; + ctx->Driver.SetReadBuffer = tdfxDDSetReadBuffer; + + ctx->Driver.IndexMask = NULL; + ctx->Driver.ColorMask = tdfxDDColorMask; + + ctx->Driver.NearFar = tdfxDDNearFar; + + ctx->Driver.RenderStart = tdfxDDRenderStart; + ctx->Driver.RenderFinish = tdfxDDRenderFinish; + ctx->Driver.RasterSetup = NULL; + + ctx->Driver.RenderVBClippedTab = NULL; + ctx->Driver.RenderVBCulledTab = NULL; + ctx->Driver.RenderVBRawTab = NULL; + + ctx->Driver.ReducedPrimitiveChange = tdfxDDReducedPrimitiveChange; + ctx->Driver.MultipassFunc = NULL; + + ctx->Driver.AlphaFunc = tdfxDDAlphaFunc; + ctx->Driver.BlendEquation = tdfxDDBlendEquation; + ctx->Driver.BlendFunc = tdfxDDBlendFunc; + ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate; + ctx->Driver.ClearDepth = tdfxDDClearDepth; + ctx->Driver.ClearStencil = NULL; + ctx->Driver.CullFace = tdfxDDCullFace; + ctx->Driver.FrontFace = tdfxDDFrontFace; + ctx->Driver.DepthFunc = tdfxDDDepthFunc; + ctx->Driver.DepthMask = tdfxDDDepthMask; + ctx->Driver.DepthRange = NULL; + ctx->Driver.Enable = tdfxDDEnable; + ctx->Driver.Fogfv = tdfxDDFogfv; + ctx->Driver.Hint = NULL; + ctx->Driver.Lightfv = NULL; + ctx->Driver.LightModelfv = tdfxDDLightModelfv; + ctx->Driver.LineStipple = NULL; + ctx->Driver.LineWidth = tdfxDDLineWidth; + ctx->Driver.LogicOpcode = tdfxDDLogicOp; +#if 0 + ctx->Driver.PolygonMode = NULL; +#endif + ctx->Driver.PolygonStipple = tdfxDDPolygonStipple; + ctx->Driver.Scissor = tdfxDDScissor; + ctx->Driver.ShadeModel = tdfxDDShadeModel; + + if ( fxMesa->haveHwStencil ) { + ctx->Driver.StencilFunc = tdfxDDStencilFunc; + ctx->Driver.StencilMask = tdfxDDStencilMask; + ctx->Driver.StencilOp = tdfxDDStencilOp; + } else { + ctx->Driver.StencilFunc = NULL; + ctx->Driver.StencilMask = NULL; + ctx->Driver.StencilOp = NULL; + } + + ctx->Driver.Viewport = tdfxDDViewport; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h new file mode 100644 index 000000000..d2ad058d2 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h @@ -0,0 +1,55 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_state.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_STATE_H__ +#define __TDFX_STATE_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "context.h" +#include "tdfx_context.h" + +extern void tdfxDDInitStateFuncs( GLcontext *ctx ); + +extern void tdfxDDUpdateHwState( GLcontext *ctx ); + +extern void tdfxInitState( tdfxContextPtr fxMesa ); + +extern void tdfxUpdateClipping( GLcontext *ctx ); + +#endif +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c new file mode 100644 index 000000000..ea0206ea7 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c @@ -0,0 +1,1058 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" + +#include "enums.h" +#include "image.h" +#include "texutil.h" + +#define TX_DITHER_NONE 0x00000000 + + +static int logbase2( int n ) +{ + GLint i = 1; + GLint log2 = 0; + + if ( n < 0 ) + return -1; + + while ( n > i ) { + i *= 2; + log2++; + } + if ( i != n ) { + return -1; + } else { + return log2; + } +} + +/* Compute various texture image parameters. + * Input: w, h - source texture width and height + * Output: lodlevel - Glide lod level token for the larger texture dimension + * aspectratio - Glide aspect ratio token + * sscale - S scale factor used during triangle setup + * tscale - T scale factor used during triangle setup + * wscale - OpenGL -> Glide image width scale factor + * hscale - OpenGL -> Glide image height scale factor + * + * Sample results: + * w h lodlevel aspectRatio + * 128 128 GR_LOD_LOG2_128 (=7) GR_ASPECT_LOG2_1x1 (=0) + * 64 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x1 (=0) + * 64 32 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_2x1 (=1) + * 32 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x2 (=-1) + * 32 32 GR_LOD_LOG2_32 (=5) GR_ASPECT_LOG2_1x1 (=0) + */ +static void tdfxTexGetInfo( const GLcontext *ctx, int w, int h, + GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio, + float *sscale, float *tscale, + int *wscale, int *hscale ) +{ + int logw, logh, ar, lod, ws, hs; + float s, t; + + ASSERT( w >= 1 ); + ASSERT( h >= 1 ); + + logw = logbase2( w ); + logh = logbase2( h ); + ar = logw - logh; /* aspect ratio = difference in log dimensions */ + + /* Hardware only allows a maximum aspect ratio of 8x1, so handle + * |ar| > 3 by scaling the image and using an 8x1 aspect ratio. + */ + if ( ar >= 0 ) { + ASSERT( w >= h ); + lod = logw; + s = 256.0; + ws = 1; + if ( ar <= GR_ASPECT_LOG2_8x1 ) { + t = 256 >> ar; + hs = 1; + } else { + /* have to stretch image height */ + t = 32.0; + hs = 1 << (ar - 3); + } + } else { + ASSERT( w < h ); + lod = logh; + t = 256.0; + hs = 1; + if ( ar >= GR_ASPECT_LOG2_1x8 ) { + s = 256 >> -ar; + ws = 1; + } else { + /* have to stretch image width */ + s = 32.0; + ws = 1 << (-ar - 3); + } + } + + if ( ar < GR_ASPECT_LOG2_1x8 ) { + ar = GR_ASPECT_LOG2_1x8; + } else if ( ar > GR_ASPECT_LOG2_8x1 ) { + ar = GR_ASPECT_LOG2_8x1; + } + + if ( lodlevel ) + *lodlevel = (GrLOD_t)lod; + if ( aspectratio ) + *aspectratio = (GrAspectRatio_t)ar; + if ( sscale ) + *sscale = s; + if ( tscale ) + *tscale = t; + if ( wscale ) + *wscale = ws; + if ( hscale ) + *hscale = hs; +} + + +/* We need to call this when a texture object's minification filter + * or texture image sizes change. + */ +static void tdfxRevalidateTexture( GLcontext *ctx, + struct gl_texture_object *tObj ) +{ + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + GLint minl, maxl; + + if ( !t ) + return; + + minl = maxl = tObj->BaseLevel; + + if ( tObj->Image[minl] ) { + maxl = MIN2( tObj->MaxLevel, tObj->Image[minl]->MaxLog2 ); + + /* Compute largeLodLog2, aspect ratio and texcoord scale factors. + */ + tdfxTexGetInfo( ctx, + tObj->Image[minl]->Width, tObj->Image[minl]->Height, + &t->info.largeLodLog2, &t->info.aspectRatioLog2, + &t->sScale, &t->tScale, NULL, NULL ); + } + + if ( tObj->Image[maxl] && + tObj->MinFilter != GL_NEAREST && + tObj->MinFilter != GL_LINEAR ) { + /* Mipmapping: need to compute smallLodLog2 */ + tdfxTexGetInfo( ctx, + tObj->Image[maxl]->Width, tObj->Image[maxl]->Height, + &t->info.smallLodLog2, + NULL, NULL, NULL, NULL, NULL ); + } else { + /* Not mipmapping: smallLodLog2 = largeLodLog2 */ + t->info.smallLodLog2 = t->info.largeLodLog2; + } + + t->minLevel = minl; + t->maxLevel = maxl; + t->info.data = NULL; +} + + +static tdfxTexObjPtr tdfxAllocTexObj( tdfxContextPtr fxMesa ) +{ + tdfxTexObjPtr t; + int i; + + t = CALLOC( sizeof(tdfxTexObj) ); + if ( !t ) { + gl_problem( NULL, "tdfx driver: out of memory" ); + return NULL; + } + + t->isInTM = GL_FALSE; + + t->whichTMU = TDFX_TMU_NONE; + + t->range[TDFX_TMU0] = NULL; + t->range[TDFX_TMU1] = NULL; + + t->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + t->magFilt = GR_TEXTUREFILTER_BILINEAR; + + t->sClamp = GR_TEXTURECLAMP_WRAP; + t->tClamp = GR_TEXTURECLAMP_WRAP; + + t->mmMode = GR_MIPMAP_NEAREST; + t->LODblend = FXFALSE; + + for ( i = 0 ; i < MAX_TEXTURE_LEVELS ; i++ ) { + t->image[i].original.data = NULL; + t->image[i].rescaled.data = NULL; + } + + return t; +} + + +/* Given an OpenGL internal texture format, return the corresponding + * Glide internal texture format and MesaIntTexFormat. + * If allow32bpp is true, we'll return 32-bit texel formats when + * appropriate. + */ +static GrTextureFormat_t +tdfxTexGetFormat( tdfxContextPtr fxMesa, struct gl_texture_image *texImage, + GLenum format, GLenum type ) +{ + const GLboolean allow32bpp = TDFX_IS_NAPALM(fxMesa); + const GLboolean is32bpp = ( fxMesa->fxScreen->cpp == 4 ); + const struct gl_texture_format *texFormat; + GrTextureFormat_t ret; + + if ( 0 ) + fprintf( stderr, "internal=%s format=%s type=%s\n", + texImage->IntFormat == 3 ? "GL_RGB (3)" : + texImage->IntFormat == 4 ? "GL_RGBA (4)" : + gl_lookup_enum_by_nr( texImage->IntFormat ), + gl_lookup_enum_by_nr( format ), + gl_lookup_enum_by_nr( type ) ); + +#define SET_FORMAT( gr, gl ) \ + do { \ + ret = (gr); \ + texFormat = &(gl); \ + } while (0) + +#define SET_FORMAT_32BPP( gr32, gl32, gr16, gl16 ) \ + do { \ + if ( allow32bpp ) { \ + ret = (gr32); \ + texFormat = &(gl32); \ + } else { \ + ret = (gr16); \ + texFormat = &(gl16); \ + } \ + } while (0) + + switch ( texImage->IntFormat ) { + /* GH: Bias towards GL_RGB, GL_RGBA texture formats. This has + * got to be better than sticking them way down the end of this + * huge list. + */ + case GL_RGBA: + case 4: + if ( format == GL_BGRA ) { + if ( type == GL_UNSIGNED_INT_8_8_8_8_REV && allow32bpp ) { + SET_FORMAT( GR_TEXFMT_ARGB_8888, _mesa_texformat_argb8888 ); + break; + } else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { + SET_FORMAT( GR_TEXFMT_ARGB_4444, _mesa_texformat_argb4444 ); + break; + } else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { + SET_FORMAT( GR_TEXFMT_ARGB_1555, _mesa_texformat_argb1555 ); + break; + } + } + if ( allow32bpp && is32bpp ) { + SET_FORMAT( GR_TEXFMT_ARGB_8888, _mesa_texformat_argb8888 ); + } else { + SET_FORMAT( GR_TEXFMT_ARGB_4444, _mesa_texformat_argb4444 ); + } + break; + + case GL_RGB: + case 3: + if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) { + SET_FORMAT( GR_TEXFMT_RGB_565, _mesa_texformat_rgb565 ); + break; + } + if ( allow32bpp && is32bpp ) { + SET_FORMAT( GR_TEXFMT_ARGB_8888, _mesa_texformat_argb8888 ); + } else { + SET_FORMAT( GR_TEXFMT_RGB_565, _mesa_texformat_rgb565 ); + } + break; + + /* GH: Okay, keep checking as normal. Still test for GL_RGB, + * GL_RGBA formats first. + */ + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + SET_FORMAT_32BPP( GR_TEXFMT_ARGB_8888, _mesa_texformat_argb8888, + GR_TEXFMT_ARGB_4444, _mesa_texformat_argb4444 ); + break; + + case GL_RGBA4: + case GL_RGBA2: + SET_FORMAT( GR_TEXFMT_ARGB_4444, _mesa_texformat_argb4444 ); + break; + + case GL_RGB5_A1: + SET_FORMAT( GR_TEXFMT_ARGB_1555, _mesa_texformat_argb1555 ); + break; + + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + SET_FORMAT_32BPP( GR_TEXFMT_ARGB_8888, _mesa_texformat_argb8888, + GR_TEXFMT_RGB_565, _mesa_texformat_rgb565 ); + break; + + case GL_RGB5: + case GL_RGB4: + case GL_R3_G3_B2: + SET_FORMAT( GR_TEXFMT_RGB_565, _mesa_texformat_rgb565 ); + break; + + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + SET_FORMAT( GR_TEXFMT_ALPHA_8, _mesa_texformat_a8 ); + break; + + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + SET_FORMAT( GR_TEXFMT_INTENSITY_8, _mesa_texformat_l8 ); + break; + + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + SET_FORMAT( GR_TEXFMT_ALPHA_INTENSITY_88, _mesa_texformat_al88 ); + break; + + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + SET_FORMAT( GR_TEXFMT_ALPHA_8, _mesa_texformat_i8 ); + break; + + case GL_COLOR_INDEX: + case GL_COLOR_INDEX1_EXT: + case GL_COLOR_INDEX2_EXT: + case GL_COLOR_INDEX4_EXT: + case GL_COLOR_INDEX8_EXT: + case GL_COLOR_INDEX12_EXT: + case GL_COLOR_INDEX16_EXT: + SET_FORMAT( GR_TEXFMT_P_8, _mesa_texformat_ci8 ); + break; + + default: + fprintf( stderr, "bad texture format in fxTexGetFormat() %d", + texImage->IntFormat ); + return -1; + } + + texImage->TexFormat = texFormat; + + return ret; +} + + +static GLboolean +tdfxDDTexImage2D( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const struct gl_texture_format *texFormat; + GrTextureFormat_t glideFormat; + tdfxTexObjPtr t; + tdfxTexImagePtr image; + GLint dstWidth, dstHeight, wScale, hScale; + GLint size; + void *data; + + if ( 0 ) { + printf("TexImage id=%d int 0x%x format 0x%x type 0x%x %dx%d\n", + texObj->Name, texImage->IntFormat, format, type, + texImage->Width, texImage->Height); + } + + if ( target != GL_TEXTURE_2D || texImage->Border > 0 ) + return GL_FALSE; + + if ( !texObj->DriverData ) + texObj->DriverData = tdfxAllocTexObj( fxMesa ); + + t = TDFX_TEXTURE_DATA(texObj); + image = &t->image[level]; + + /* Determine the appropriate GL internal texel format, Mesa internal + * texel format, and texelSize (bytes) given the user's internal + * texture format hint. + */ + glideFormat = tdfxTexGetFormat( fxMesa, texImage, format, type ); + + /* Get the destination internal format. + */ + texFormat = texImage->TexFormat; + + /* Determine width and height scale factors for texture. Remember, + * Glide is limited to 8:1 aspect ratios. + */ + tdfxTexGetInfo( ctx, + texImage->Width, texImage->Height, + NULL, NULL, NULL, NULL, + &wScale, &hScale ); + dstWidth = texImage->Width * wScale; + dstHeight = texImage->Height * hScale; + + /* Allocate new storage for texture image, if needed. This + * conditional wants to set uncompressedImage to point to the + * uncompressed image, and mml->data to the texture data. If the + * image is uncompressed, these are identical. If the image is not + * compressed, these are different. + */ + if ( !image->original.data || image->glideFormat != glideFormat || + image->original.width != texImage->Width || + image->original.height != texImage->Height ) + { + if ( image->original.data ) { + FREE( image->original.data ); + image->original.data = NULL; + } + if ( image->rescaled.data ) { + FREE( image->rescaled.data ); + image->rescaled.data = NULL; + } + + size = texImage->Width * texImage->Height * texFormat->TexelBytes; + image->original.data = (void *) MALLOC( size ); + if ( !image->original.data ) + return GL_FALSE; + + image->original.width = texImage->Width; + image->original.height = texImage->Height; + image->original.size = size; + + image->glideFormat = glideFormat; + image->wScale = wScale; + image->hScale = hScale; + + t->info.format = glideFormat; + tdfxTMMoveOutTM( fxMesa, texObj ); + } + + /* Store the texture image into the 'original' space. + */ + if ( !_mesa_convert_texsubimage2d( texFormat->IntFormat, + 0, 0, texImage->Width, + texImage->Height, texImage->Width, + format, type, packing, pixels, + image->original.data ) ) { + return GL_FALSE; + } + + data = image->original.data; + size = image->original.size; + + /* GH: Sigh... + */ + if ( wScale > 1 || hScale > 1 ) { + if ( image->rescaled.data ) { + FREE( image->rescaled.data ); + image->rescaled.data = NULL; + } + + size = dstWidth * dstHeight * texFormat->TexelBytes; + image->rescaled.data = (void *) MALLOC( size ); + if ( !image->rescaled.data ) + return GL_FALSE; + + image->rescaled.width = dstWidth; + image->rescaled.height = dstHeight; + image->rescaled.size = size; + + _mesa_rescale_teximage2d( texFormat, + texImage->Width, texImage->Height, + dstWidth, dstHeight, + image->original.data, image->rescaled.data ); + + data = image->rescaled.data; + } + + image->data = data; + image->size = size; + + tdfxRevalidateTexture( ctx, texObj ); + + t->reloadImages = GL_TRUE; + fxMesa->new_state |= TDFX_NEW_TEXTURE; + + *retainInternalCopy = GL_FALSE; + return GL_TRUE; +} + + +static GLboolean +tdfxDDTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(texObj); + tdfxTexImagePtr image; + + if ( target != GL_TEXTURE_2D ) + return GL_FALSE; + + if ( !t ) + return GL_FALSE; + + if ( 0 ) { + fprintf( stderr, "TexSubImage id=%d lvl=%d int=0x%x format=0x%x type=0x%x x=%d y=%d w=%d h=%d fullW=%d fullH=%d\n", + texObj->Name, level, texImage->IntFormat, format, type, + xoffset, yoffset, width, height, + texImage->Width, texImage->Height ); + } + + image = &t->image[level]; + + /* Must have an existing texture image! + */ + assert( image->original.data ); + + if ( !_mesa_convert_texsubimage2d( texImage->TexFormat->IntFormat, + xoffset, yoffset, width, height, + texImage->Width, + format, type, packing, + pixels, image->original.data ) ) { + return GL_FALSE; + } + + /* Rescale the original image again if we have to. + */ + if ( image->wScale > 1 || image->hScale > 1 ) { + assert( image->rescaled.data ); + _mesa_rescale_teximage2d( texImage->TexFormat, + image->original.width, image->original.height, + image->rescaled.width, image->rescaled.height, + image->original.data, image->rescaled.data ); + } + + t->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */ + fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX this might be a bit much */ + + return GL_TRUE; +} + + + +/* ================================================================ + * + */ + +static void tdfxDDTexEnv( GLcontext *ctx, GLenum target, + GLenum pname, const GLfloat *param ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + if ( param ) { + fprintf( stderr, __FUNCTION__"( %x, %x )\n", pname, (GLint)(*param) ); + } else { + fprintf( stderr, __FUNCTION__"( %x )\n", pname ); + } + } + + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + +static void tdfxDDTexParameter( GLcontext *ctx, GLenum target, + struct gl_texture_object *tObj, + GLenum pname, const GLfloat *params ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLenum param = (GLenum) (GLint) params[0]; + tdfxTexObjPtr t; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, __FUNCTION__ "( %d, %p, %x, %x )\n", + tObj->Name, tObj->DriverData, pname, param ); + } + + if ( target != GL_TEXTURE_2D ) + return; + + if ( !tObj->DriverData ) + tObj->DriverData = tdfxAllocTexObj( fxMesa ); + + t = TDFX_TEXTURE_DATA(tObj); + + switch ( pname ) { + case GL_TEXTURE_MIN_FILTER: + switch ( param ) { + case GL_NEAREST: + t->mmMode = GR_MIPMAP_DISABLE; + t->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + t->LODblend = FXFALSE; + break; + + case GL_LINEAR: + t->mmMode = GR_MIPMAP_DISABLE; + t->minFilt = GR_TEXTUREFILTER_BILINEAR; + t->LODblend = FXFALSE; + break; + + case GL_NEAREST_MIPMAP_LINEAR: + if ( TDFX_IS_NAPALM(fxMesa) ) { + if ( fxMesa->numTMUs > 1 ) { + t->mmMode = GR_MIPMAP_NEAREST; + t->LODblend = FXTRUE; + } else { + t->mmMode = GR_MIPMAP_NEAREST_DITHER; + t->LODblend = FXFALSE; + } + t->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + break; + } + /* XXX Voodoo3/Banshee mipmap blending seems to produce + * incorrectly filtered colors for the smallest mipmap levels. + * To work-around we fall-through here and use a different filter. + */ + case GL_NEAREST_MIPMAP_NEAREST: + t->mmMode = GR_MIPMAP_NEAREST; + t->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + t->LODblend = FXFALSE; + break; + + case GL_LINEAR_MIPMAP_LINEAR: + if ( TDFX_IS_NAPALM(fxMesa) ) { + if ( fxMesa->numTMUs > 1 ) { + t->mmMode = GR_MIPMAP_NEAREST; + t->LODblend = FXTRUE; + } else { + t->mmMode = GR_MIPMAP_NEAREST_DITHER; + t->LODblend = FXFALSE; + } + t->minFilt = GR_TEXTUREFILTER_BILINEAR; + break; + } + /* XXX Voodoo3/Banshee mipmap blending seems to produce + * incorrectly filtered colors for the smallest mipmap levels. + * To work-around we fall-through here and use a different filter. + */ + case GL_LINEAR_MIPMAP_NEAREST: + t->mmMode = GR_MIPMAP_NEAREST; + t->minFilt = GR_TEXTUREFILTER_BILINEAR; + t->LODblend = FXFALSE; + break; + default: + break; + } + tdfxRevalidateTexture( ctx, tObj ); + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_MAG_FILTER: + switch ( param ) { + case GL_NEAREST: + t->magFilt = GR_TEXTUREFILTER_POINT_SAMPLED; + break; + case GL_LINEAR: + t->magFilt = GR_TEXTUREFILTER_BILINEAR; + break; + default: + break; + } + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_WRAP_S: + switch ( param ) { + case GL_CLAMP: + t->sClamp = GR_TEXTURECLAMP_CLAMP; + break; + case GL_REPEAT: + t->sClamp = GR_TEXTURECLAMP_WRAP; + break; + default: + break; + } + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_WRAP_T: + switch ( param ) { + case GL_CLAMP: + t->tClamp = GR_TEXTURECLAMP_CLAMP; + break; + case GL_REPEAT: + t->tClamp = GR_TEXTURECLAMP_WRAP; + break; + default: + break; + } + fxMesa->new_state |= TDFX_NEW_TEXTURE; + break; + + case GL_TEXTURE_BASE_LEVEL: + tdfxRevalidateTexture( ctx, tObj ); + break; + + case GL_TEXTURE_MAX_LEVEL: + tdfxRevalidateTexture( ctx, tObj ); + break; + + case GL_TEXTURE_BORDER_COLOR: + /* TO DO */ + break; + case GL_TEXTURE_MIN_LOD: + /* TO DO */ + break; + case GL_TEXTURE_MAX_LOD: + /* TO DO */ + break; + + default: + break; + } +} + +static void tdfxDDBindTexture( GLcontext *ctx, GLenum target, + struct gl_texture_object *tObj ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexObjPtr t; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) { + fprintf( stderr, __FUNCTION__ "( %d, %p )\n", + tObj->Name, tObj->DriverData ); + } + + if ( target != GL_TEXTURE_2D ) + return; + + if ( !tObj->DriverData ) + tObj->DriverData = tdfxAllocTexObj( fxMesa ); + + t = TDFX_TEXTURE_DATA(tObj); + t->lastTimeUsed = fxMesa->texBindNumber++; + + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + +static void tdfxDDDeleteTexture( GLcontext *ctx, + struct gl_texture_object *tObj ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + + LOCK_HARDWARE( fxMesa ); + tdfxTMFreeTextureLocked( fxMesa, tObj ); + UNLOCK_HARDWARE( fxMesa ); + + fxMesa->new_state |= TDFX_NEW_TEXTURE; +} + +static GLboolean tdfxDDIsTextureResident( GLcontext *ctx, + struct gl_texture_object *tObj ) +{ + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + + return ( t && t->isInTM ); +} + + +/* Convert a gl_color_table texture palette to Glide's format. + */ +static void +tdfxConvertPalette( FxU32 data[256], const struct gl_color_table *table ) +{ + const GLubyte *tableUB = (const GLubyte *) table->Table; + GLint width = table->Size; + FxU32 r, g, b, a; + GLint i; + + ASSERT( table->TableType == GL_UNSIGNED_BYTE ); + + switch ( table->Format ) { + case GL_RGBA: + for ( i = 0 ; i < width ; i++ ) { + r = tableUB[i * 4 + 0]; + g = tableUB[i * 4 + 1]; + b = tableUB[i * 4 + 2]; + a = tableUB[i * 4 + 3]; + data[i] = PACK_COLOR_8888( a, r, g, b ); + } + break; + case GL_RGB: + for ( i = 0 ; i < width ; i++ ) { + r = tableUB[i * 3 + 0]; + g = tableUB[i * 3 + 1]; + b = tableUB[i * 3 + 2]; + a = 255; + data[i] = PACK_COLOR_8888( a, r, g, b ); + } + break; + case GL_LUMINANCE: + for ( i = 0 ; i < width ; i++ ) { + r = tableUB[i]; + g = tableUB[i]; + b = tableUB[i]; + a = 255; + data[i] = PACK_COLOR_8888( a, r, g, b ); + } + break; + case GL_ALPHA: + for ( i = 0 ; i < width ; i++ ) { + r = g = b = 255; + a = tableUB[i]; + data[i] = PACK_COLOR_8888( a, r, g, b ); + } + break; + case GL_LUMINANCE_ALPHA: + for ( i = 0 ; i < width ; i++ ) { + r = g = b = tableUB[i * 2 + 0]; + a = tableUB[i * 2 + 1]; + data[i] = PACK_COLOR_8888( a, r, g, b ); + } + break; + case GL_INTENSITY: + for ( i = 0 ; i < width ; i++ ) { + r = tableUB[i]; + g = tableUB[i]; + b = tableUB[i]; + a = tableUB[i]; + data[i] = PACK_COLOR_8888( a, r, g, b ); + } + break; + } +} + +static void +tdfxDDTexturePalette( GLcontext *ctx, struct gl_texture_object *tObj ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexObjPtr t; + + if ( tObj ) { + /* Per-texture palette */ + if ( !tObj->DriverData ) + tObj->DriverData = tdfxAllocTexObj(fxMesa); + + t = TDFX_TEXTURE_DATA(tObj); + tdfxConvertPalette( t->palette.data, &tObj->Palette ); + /*tdfxTexInvalidate( ctx, tObj );*/ + } else { + /* Global texture palette */ + tdfxConvertPalette( fxMesa->glbPalette.data, &ctx->Texture.Palette ); + } + + fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX too heavy-handed */ +} + + + + +/**********************************************************************/ +/**** NEW TEXTURE IMAGE FUNCTIONS ****/ +/**********************************************************************/ + + + +#if 0 +static void +PrintTexture(int w, int h, int c, const GLubyte * data) +{ + int i, j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + if (c == 2) + printf("%02x %02x ", data[0], data[1]); + else if (c == 3) + printf("%02x %02x %02x ", data[0], data[1], data[2]); + data += c; + } + printf("\n"); + } +} +#endif + + +static GLboolean +tdfxDDTestProxyTexImage( GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLint width, GLint height, + GLint depth, GLint border ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_shared_state *ss = fxMesa->glCtx->Shared; + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + + switch (target) { + case GL_PROXY_TEXTURE_1D: + return GL_TRUE; /* software rendering */ + case GL_PROXY_TEXTURE_2D: + { + struct gl_texture_object *tObj; + tdfxTexObjPtr t; + int memNeeded; + + tObj = ctx->Texture.Proxy2D; + if (!tObj->DriverData) + tObj->DriverData = tdfxAllocTexObj(fxMesa); + t = TDFX_TEXTURE_DATA(tObj); + + /* assign the parameters to test against */ + tObj->Image[level]->Width = width; + tObj->Image[level]->Height = height; + tObj->Image[level]->Border = border; + tObj->Image[level]->IntFormat = internalFormat; + if (level == 0) { + /* don't use mipmap levels > 0 */ + tObj->MinFilter = tObj->MagFilter = GL_NEAREST; + } + else { + /* test with all mipmap levels */ + tObj->MinFilter = GL_LINEAR_MIPMAP_LINEAR; + tObj->MagFilter = GL_NEAREST; + } + tdfxRevalidateTexture(ctx, tObj); + + /* + printf("small lodlog2 0x%x\n", t->info.smallLodLog2); + printf("large lodlog2 0x%x\n", t->info.largeLodLog2); + printf("aspect ratio 0x%x\n", t->info.aspectRatioLog2); + printf("glide format 0x%x\n", t->info.format); + printf("data %p\n", t->info.data); + printf("lodblend %d\n", (int) t->LODblend); + */ + + /* determine where texture will reside */ + if (t->LODblend && !tss->umaTexMemory) { + /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */ + memNeeded = FX_grTexTextureMemRequired_NoLock( + GR_MIPMAPLEVELMASK_BOTH, &(t->info)); + } + else { + /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */ + memNeeded = FX_grTexTextureMemRequired_NoLock( + GR_MIPMAPLEVELMASK_BOTH, &(t->info)); + } + /* + printf("Proxy test %d > %d\n", memNeeded, tss->totalTexMem[0]); + */ + if (memNeeded > tss->totalTexMem[0]) + return GL_FALSE; + else + return GL_TRUE; + } + case GL_PROXY_TEXTURE_3D: + return GL_TRUE; /* software rendering */ + default: + return GL_TRUE; /* never happens, silence compiler */ + } +} + + +/* Return a texture image to Mesa. This is either to satisfy + * a glGetTexImage() call or to prepare for software texturing. + */ +static GLvoid * +tdfxDDGetTexImage( GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum *formatOut, GLenum *typeOut, + GLboolean *freeImageOut ) +{ + const struct gl_texture_image *texImage = texObj->Image[level]; + const struct gl_texture_format *texFormat = texImage->TexFormat; + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(texObj); + tdfxTexImagePtr image; + GLubyte *data; + + if ( target != GL_TEXTURE_2D ) + return NULL; + if ( !t ) + return NULL; + + image = &t->image[level]; + if ( !image->original.data ) + return NULL; + + data = (GLubyte *) MALLOC( texImage->Width * texImage->Height * 4 ); + if ( !data ) + return NULL; + + _mesa_unconvert_teximage2d( texFormat->IntFormat, texImage->Format, + texImage->Width, texImage->Height, + image->original.data, data ); + + *formatOut = texImage->Format; + *typeOut = GL_UNSIGNED_BYTE; + *freeImageOut = GL_TRUE; + + return data; +} + + +void tdfxDDInitTextureFuncs( GLcontext *ctx ) +{ + ctx->Driver.TexImage2D = tdfxDDTexImage2D; + ctx->Driver.TexSubImage2D = tdfxDDTexSubImage2D; + ctx->Driver.GetTexImage = tdfxDDGetTexImage; + ctx->Driver.TexEnv = tdfxDDTexEnv; + ctx->Driver.TexParameter = tdfxDDTexParameter; + ctx->Driver.BindTexture = tdfxDDBindTexture; + ctx->Driver.DeleteTexture = tdfxDDDeleteTexture; + ctx->Driver.IsTextureResident = tdfxDDIsTextureResident; + ctx->Driver.UpdateTexturePalette = tdfxDDTexturePalette; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h new file mode 100644 index 000000000..3de4285a9 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h @@ -0,0 +1,46 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_TEX_H__ +#define __TDFX_TEX_H__ + +extern void tdfxUpdateTextureState( GLcontext *ctx ); +extern void tdfxUpdateTextureBinding( GLcontext *ctx ); + +extern void tdfxDDInitTextureFuncs( GLcontext *ctx ); + +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c new file mode 100644 index 000000000..64648887c --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c @@ -0,0 +1,920 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" + +#define BAD_ADDRESS ((FxU32) -1) + +/* Verify the consistancy of the texture memory manager. + * This involves: + * Traversing all texture objects and computing total memory used. + * Traverse the free block list and computing total memory free. + * Compare the total free and total used amounts to the total memory size. + * Make various assertions about the results. + */ +static void tdfxTMVerifyFreeList( tdfxContextPtr fxMesa, FxU32 unit ) +{ + struct gl_shared_state *ss = fxMesa->glCtx->Shared; + struct gl_texture_object *texObj; + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + tdfxMemRange *block; + int prevStart = -1, prevEnd = -1; + int totalFree = 0; + int numObj = 0, numRes = 0; + int totalUsed = 0; + + for ( block = tss->freeRanges[unit] ; block ; block = block->next ) { + assert( block->endAddr > 0 ); + assert( block->startAddr <= tss->totalTexMem[unit] ); + assert( block->endAddr <= tss->totalTexMem[unit] ); + assert( (int) block->startAddr > prevStart ); + assert( (int) block->startAddr >= prevEnd ); + prevStart = (int) block->startAddr; + prevEnd = (int) block->endAddr; + totalFree += (block->endAddr - block->startAddr); + } + assert( totalFree == tss->freeTexMem[unit] ); + + for ( texObj = ss->TexObjectList ; texObj ; texObj = texObj->Next ) { + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(texObj); + numObj++; + if ( t ) { + if ( t->isInTM ) { + numRes++; + assert( t->range[0] ); + if ( t->range[unit] ) + totalUsed += (t->range[unit]->endAddr - t->range[unit]->startAddr); + } else { + assert(!t->range[0]); + } + } + } + + fprintf( stderr, + "totalFree: %d totalUsed: %d totalMem: %d #objs=%d #res=%d\n", + tss->freeTexMem[unit], totalUsed, tss->totalTexMem[unit], + numObj, numRes ); + + assert( totalUsed + totalFree == tss->totalTexMem[unit] ); +} + +static void tdfxTMDumpTexMem( tdfxContextPtr fxMesa ) +{ + struct gl_shared_state *ss = fxMesa->glCtx->Shared; + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + struct gl_texture_object *texObj; + tdfxMemRange *r; + FxU32 prev; + + printf( "DUMP Objects:\n" ); + for ( texObj = ss->TexObjectList ; texObj ; texObj = texObj->Next ) { + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(texObj); + + if ( t && t->isInTM ) { + printf( "Obj %8p: %4d info = %p\n", texObj, texObj->Name, t ); + + printf( " isInTM=%d whichTMU=%ld lastTimeUsed=%d\n", + t->isInTM, t->whichTMU, t->lastTimeUsed ); + printf( " tm[0] = %p", t->range[0] ); + assert( t->range[0] ); + if ( t->range[0] ) { + printf( " tm startAddr = %ld endAddr = %ld", + t->range[0]->startAddr, + t->range[0]->endAddr ); + } + printf( "\n" ); + printf( " tm[1] = %p", t->range[1] ); + if ( t->range[1] ) { + printf( " tm startAddr = %ld endAddr = %ld", + t->range[1]->startAddr, + t->range[1]->endAddr ); + } + printf( "\n" ); + } + } + + tdfxTMVerifyFreeList( fxMesa, 0 ); + tdfxTMVerifyFreeList( fxMesa, 1 ); + + printf( "Free memory unit 0: %d bytes\n", tss->freeTexMem[0] ); + prev = 0; + for ( r = tss->freeRanges[0] ; r ; r = r->next ) { + printf( "%8p: start %8ld end %8ld size %8ld gap %8ld\n", + r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, + r->startAddr - prev ); + prev = r->endAddr; + } + + printf( "Free memory unit 1: %d bytes\n", tss->freeTexMem[1] ); + prev = 0; + for ( r = tss->freeRanges[1] ; r ; r = r->next ) { + printf( "%8p: start %8ld end %8ld size %8ld gap %8ld\n", + r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, + r->startAddr - prev ); + prev = r->endAddr; + } +} + + +#ifdef TEXSANITY +static void fubar( void ) +{ + /* GH: What am I meant to do??? */ +} + +/* Sanity Check + */ +static void sanity( tdfxContextPtr fxMesa ) +{ + tdfxMemRange *tmp, *prev, *pos; + + prev = 0; + tmp = fxMesa->freeRanges[0]; + while ( tmp ) { + if ( !tmp->startAddr && !tmp->endAddr ) { + fprintf( stderr, "Textures fubar\n" ); + fubar(); + } + if ( tmp->startAddr >= tmp->endAddr ) { + fprintf( stderr, "Node fubar\n" ); + fubar(); + } + if ( prev && ( prev->startAddr >= tmp->startAddr || + prev->endAddr > tmp->startAddr ) ) { + fprintf( stderr, "Sorting fubar\n" ); + fubar(); + } + prev = tmp; + tmp = tmp->next; + } + + prev = 0; + tmp = fxMesa->freeRanges[1]; + while ( tmp ) { + if ( !tmp->startAddr && !tmp->endAddr ) { + fprintf( stderr, "Textures fubar\n" ); + fubar(); + } + if ( tmp->startAddr >= tmp->endAddr ) { + fprintf( stderr, "Node fubar\n" ); + fubar(); + } + if ( prev && ( prev->startAddr >= tmp->startAddr || + prev->endAddr > tmp->startAddr ) ) { + fprintf( stderr, "Sorting fubar\n" ); + fubar(); + } + prev = tmp; + tmp = tmp->next; + } +} +#endif + + +/* Allocate and initialize a new MemRange struct. Try to allocate it + * from the pool of free MemRange nodes rather than malloc. + */ +static tdfxMemRange * +tdfxTMNewRangeNode( tdfxContextPtr fxMesa, FxU32 start, FxU32 end ) +{ + struct gl_shared_state *ss = fxMesa->glCtx->Shared; + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + tdfxMemRange *range; + + _glthread_LOCK_MUTEX( ss->Mutex ); + if ( tss && tss->rangePool ) { + range = tss->rangePool; + tss->rangePool = tss->rangePool->next; + } else { + range = MALLOC( sizeof(tdfxMemRange) ); + } + _glthread_UNLOCK_MUTEX( ss->Mutex ); + + if ( !range ) { + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, __FUNCTION__ ": out of memory!\n" ); + return NULL; + } + + range->startAddr = start; + range->endAddr = end; + range->next = NULL; + + return range; +} + + +/* Initialize texture memory. We take care of one or both TMU's here. + */ +void tdfxTMInit( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, __FUNCTION__ "\n" ); + + if ( !ctx->Shared->DriverData ) { + const char *extensions; + tdfxSharedStatePtr tss = CALLOC_STRUCT( tdfx_shared_state ); + + if ( !tss ) + return; + + LOCK_HARDWARE( fxMesa ); + + extensions = grGetString( GR_EXTENSION ); + + if ( strstr( extensions, " TEXUMA " ) ) { + FxU32 start, end; + + tss->umaTexMemory = GL_TRUE; + + grEnable( GR_TEXTURE_UMA_EXT ); + + start = grTexMinAddress( 0 ); + end = grTexMaxAddress( 0 ); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, " UMA tex memory: %d\n", (int)(end - start) ); + + tss->totalTexMem[0] = end - start; + tss->totalTexMem[1] = 0; + tss->freeTexMem[0] = end - start; + tss->freeTexMem[1] = 0; + tss->freeRanges[0] = tdfxTMNewRangeNode( fxMesa, start, end ); + tss->freeRanges[1] = NULL; + } else { + int unit; + + tss->umaTexMemory = GL_FALSE; + + for ( unit = 0 ; unit < fxMesa->numTMUs ; unit++ ) { + FxU32 start, end; + + start = grTexMinAddress( unit ); + end = grTexMaxAddress( unit ); + + tss->totalTexMem[unit] = end - start; + tss->freeTexMem[unit] = end - start; + tss->freeRanges[unit] = tdfxTMNewRangeNode( fxMesa, start, end ); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, " Split tex memory: %d\n", + (int)(end - start) ); + } + } + + UNLOCK_HARDWARE( fxMesa ); + + tss->rangePool = NULL; + ctx->Shared->DriverData = tss; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, " init UMA: %d\n", tss->umaTexMemory ); + } +} + + +/* Clean-up texture memory before destroying context. + */ +void tdfxTMClose( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + + if ( ctx->Shared->RefCount == 1 ) { + /* RefCount will soon go to zero, free our 3dfx stuff */ + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ctx->Shared->DriverData; + int unit; + tdfxMemRange *tmp, *next; + + /* Deallocate the pool of free tdfxMemRange nodes */ + tmp = tss->rangePool; + while ( tmp ) { + next = tmp->next; + FREE( tmp ); + tmp = next; + } + + /* Delete the texture memory block tdfxMemRange nodes */ + for ( unit = 0 ; unit < fxMesa->numTMUs ; unit++ ) { + tmp = tss->freeRanges[unit]; + while ( tmp ) { + next = tmp->next; + FREE( tmp ); + tmp = next; + } + } + + FREE( tss ); + ctx->Shared->DriverData = NULL; + } +} + + + +/* Delete a tdfxMemRange struct. + * We keep a linked list of free/available tdfxMemRange structs to + * avoid extra malloc/free calls. + */ +#define DELETE_RANGE_NODE( tss, range ) \ +do { \ + (range)->next = (tss)->rangePool; \ + (tss)->rangePool = (range); \ +} while (0) + +/* When we've run out of texture memory we have to throw out an + * existing texture to make room for the new one. This function + * determins the texture to throw out. + */ +static struct gl_texture_object * +tdfxTMFindOldestObject( tdfxContextPtr fxMesa, FxU32 unit ) +{ + struct gl_shared_state *ss = fxMesa->glCtx->Shared; + const GLuint bindNumber = fxMesa->texBindNumber; + struct gl_texture_object *oldestObj, *texObj, *lowestPriorityObj; + GLfloat lowestPriority; + GLuint oldestAge; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, __FUNCTION__ "\n" ); + + oldestObj = NULL; + oldestAge = 0; + + lowestPriority = 1.0F; + lowestPriorityObj = NULL; + + for ( texObj = ss->TexObjectList ; texObj ; texObj = texObj->Next ) { + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(texObj); + + if ( t && t->isInTM && + ( ( t->whichTMU == unit ) || + ( t->whichTMU == TDFX_TMU_BOTH ) || + ( t->whichTMU == TDFX_TMU_SPLIT ) ) ) { + GLuint age, lastTime; + + assert( t->range[0] ); + lastTime = t->lastTimeUsed; + + if ( lastTime > bindNumber ) { + /* TODO: check wrap around */ + age = bindNumber + (UINT_MAX - lastTime + 1); + } else { + age = bindNumber - lastTime; + } + if ( age >= oldestAge ) { + oldestAge = age; + oldestObj = texObj; + } + + /* examine priority */ + if ( texObj->Priority < lowestPriority ) { + lowestPriority = texObj->Priority; + lowestPriorityObj = texObj; + } + } + } + + if ( lowestPriority < 1.0 ) { + ASSERT( lowestPriorityObj ); + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, "discard %d pri=%f\n", + lowestPriorityObj->Name, lowestPriority ); + return lowestPriorityObj; + } else { + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) + fprintf( stderr, "discard %d age=%d\n", + oldestObj->Name, oldestAge ); + return oldestObj; + } +} + + +/* Find the address (offset?) at which we can store a new texture. + * <unit> is the texture unit. + * <size> is the texture size in bytes. + */ +static FxU32 tdfxTMFindStartAddr( tdfxContextPtr fxMesa, + FxU32 unit, FxU32 size ) +{ + struct gl_shared_state *ss = fxMesa->glCtx->Shared; + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + struct gl_texture_object *texObj; + tdfxMemRange *prev, *block; + FxU32 result; + + if ( tss->umaTexMemory ) { + assert( unit == TDFX_TMU0 ); + } + + _glthread_LOCK_MUTEX( ss->Mutex ); + while ( 1 ) { + prev = NULL; + block = tss->freeRanges[unit]; + + while ( block ) { + if ( block->endAddr - block->startAddr >= size ) { + /* The texture will fit here */ + result = block->startAddr; + block->startAddr += size; + if ( block->startAddr == block->endAddr ) { + /* Remove this node since it's empty */ + if ( prev ) { + prev->next = block->next; + } else { + tss->freeRanges[unit] = block->next; + } + DELETE_RANGE_NODE( tss, block ); + } + tss->freeTexMem[unit] -= size; + _glthread_UNLOCK_MUTEX( ss->Mutex ); + return result; + } + prev = block; + block = block->next; + } + + /* We failed to find a block large enough to accomodate <size> bytes. + * Find the oldest texObject and free it. + */ + texObj = tdfxTMFindOldestObject( fxMesa, unit ); + if ( texObj ) { + tdfxTMMoveOutTMLocked( fxMesa, texObj ); + fxMesa->stats.texSwaps++; + } else { + gl_problem( NULL, "tdfx driver: extreme texmem fragmentation" ); + _glthread_UNLOCK_MUTEX( ss->Mutex ); + return BAD_ADDRESS; + } + } + + /* never get here, but play it safe */ + _glthread_UNLOCK_MUTEX( ss->Mutex ); + return BAD_ADDRESS; +} + + +/* Remove the given tdfxMemRange node from hardware texture memory. + */ +static void tdfxTMRemoveRangeLocked( tdfxContextPtr fxMesa, + FxU32 unit, tdfxMemRange *range ) +{ + struct gl_shared_state *ss = fxMesa->glCtx->Shared; + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + tdfxMemRange *block, *prev; + + if ( tss->umaTexMemory ) { + assert( unit == TDFX_TMU0 ); + } + + if ( !range ) + return; + + if ( range->startAddr == range->endAddr ) { + DELETE_RANGE_NODE( tss, range ); + return; + } + tss->freeTexMem[unit] += range->endAddr - range->startAddr; + + /* find position in linked list to insert this tdfxMemRange node */ + prev = NULL; + block = tss->freeRanges[unit]; + while ( block ) { + assert( range->startAddr != block->startAddr ); + if ( range->startAddr > block->startAddr ) { + prev = block; + block = block->next; + } else { + break; + } + } + + /* Insert the free block, combine with adjacent blocks when possible */ + range->next = block; + if ( block ) { + if ( range->endAddr == block->startAddr ) { + /* Combine */ + block->startAddr = range->startAddr; + DELETE_RANGE_NODE( tss, range ); + range = block; + } + } + if ( prev ) { + if ( prev->endAddr == range->startAddr ) { + /* Combine */ + prev->endAddr = range->endAddr; + prev->next = range->next; + DELETE_RANGE_NODE( tss, range ); + } else { + prev->next = range; + } + } else { + tss->freeRanges[unit] = range; + } +} + + +/* Allocate space for a texture image. + * <tmu> is the texture unit + * <texmemsize> is the number of bytes to allocate + */ +static tdfxMemRange * +tdfxTMAllocTexMem( tdfxContextPtr fxMesa, FxU32 unit, FxU32 size ) +{ + tdfxMemRange *range = NULL; + FxU32 start; + + start = tdfxTMFindStartAddr( fxMesa, unit, size ); + + if ( start != BAD_ADDRESS ) { + range = tdfxTMNewRangeNode( fxMesa, start, start + size ); + } else { + fprintf( stderr, + "tdfxTMAllocTexMem returned NULL! unit=%ld size=%ld\n", + unit, size ); + } + return range; +} + + +/* Download (copy) the given texture data (all mipmap levels) into the + * Voodoo's texture memory. The texture memory must have already been + * allocated. + */ +void tdfxTMDownloadTextureLocked( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ) +{ + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + FxU32 targetTMU; + GLint l; + + assert( tObj ); + assert( t ); + + targetTMU = t->whichTMU; + + switch ( targetTMU ) { + case TDFX_TMU0: + case TDFX_TMU1: + if ( t->range[targetTMU] ) { + for ( l = t->minLevel ; l <= t->maxLevel && t->image[l].data ; l++ ) { + GrLOD_t glideLod = t->info.largeLodLog2 - l + tObj->BaseLevel; + + grTexDownloadMipMapLevel( targetTMU, + t->range[targetTMU]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_BOTH, + t->image[l].data ); + } + } + break; + + case TDFX_TMU_SPLIT: + if ( t->range[TDFX_TMU0] && t->range[TDFX_TMU1] ) { + for ( l = t->minLevel ; l <= t->maxLevel && t->image[l].data ; l++ ) { + GrLOD_t glideLod = t->info.largeLodLog2 - l + tObj->BaseLevel; + + grTexDownloadMipMapLevel( GR_TMU0, + t->range[TDFX_TMU0]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_ODD, + t->image[l].data ); + + grTexDownloadMipMapLevel( GR_TMU1, + t->range[TDFX_TMU1]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_EVEN, + t->image[l].data ); + } + } + break; + + case TDFX_TMU_BOTH: + if ( t->range[TDFX_TMU0] && t->range[TDFX_TMU1] ) { + for ( l = t->minLevel ; l <= t->maxLevel && t->image[l].data ; l++ ) { + GrLOD_t glideLod = t->info.largeLodLog2 - l + tObj->BaseLevel; + + grTexDownloadMipMapLevel( GR_TMU0, + t->range[TDFX_TMU0]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_BOTH, + t->image[l].data ); + + grTexDownloadMipMapLevel( GR_TMU1, + t->range[TDFX_TMU1]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_BOTH, + t->image[l].data ); + } + } + break; + + default: + gl_problem( NULL, "error in tdfxTMDownloadTexture: bad unit" ); + return; + } +} + + +void tdfxTMReloadMipMapLevelLocked( GLcontext *ctx, + struct gl_texture_object *tObj, + GLint level ) +{ + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + GrLOD_t glideLod; + FxU32 unit; + + ASSERT( t->isInTM ); + + unit = t->whichTMU; + glideLod = t->info.largeLodLog2 - level + tObj->BaseLevel; + + switch ( unit ) { + case TDFX_TMU0: + case TDFX_TMU1: + grTexDownloadMipMapLevel( unit, + t->range[unit]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_BOTH, + t->image[level].data ); + break; + + case TDFX_TMU_SPLIT: + grTexDownloadMipMapLevel( GR_TMU0, + t->range[GR_TMU0]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_ODD, + t->image[level].data ); + + grTexDownloadMipMapLevel( GR_TMU1, + t->range[GR_TMU1]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_EVEN, + t->image[level].data ); + break; + + case TDFX_TMU_BOTH: + grTexDownloadMipMapLevel( GR_TMU0, + t->range[GR_TMU0]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_BOTH, + t->image[level].data ); + + grTexDownloadMipMapLevel( GR_TMU1, + t->range[GR_TMU1]->startAddr, + glideLod, + t->info.largeLodLog2, + t->info.aspectRatioLog2, + t->info.format, + GR_MIPMAPLEVELMASK_BOTH, + t->image[level].data ); + break; + + default: + gl_problem( ctx, "error in tdfxTMReloadMipMapLevel(): wrong unit" ); + break; + } +} + + +/* Allocate space for the given texture in texture memory then + * download (copy) it into that space. + */ +void tdfxTMMoveInTMLocked( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj, FxU32 targetTMU ) +{ + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + FxU32 size; + + fxMesa->stats.reqTexUpload++; + + if ( t->isInTM ) { + if ( t->whichTMU == targetTMU ) + return; + + if ( targetTMU == TDFX_TMU_SPLIT || t->whichTMU == TDFX_TMU_SPLIT ) { + tdfxTMMoveOutTMLocked( fxMesa, tObj ); + } else { + if ( t->whichTMU == TDFX_TMU_BOTH ) + return; + targetTMU = TDFX_TMU_BOTH; + } + } + + t->whichTMU = targetTMU; + + switch ( targetTMU ) { + case TDFX_TMU0: + case TDFX_TMU1: + size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info ); + t->range[targetTMU] = tdfxTMAllocTexMem(fxMesa, targetTMU, size); + break; + + case TDFX_TMU_SPLIT: + size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_ODD, &t->info ); + t->range[TDFX_TMU0] = tdfxTMAllocTexMem( fxMesa, TDFX_TMU0, size ); + if ( t->range[TDFX_TMU0] ) + fxMesa->stats.memTexUpload += size; + + size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_EVEN, &t->info ); + t->range[TDFX_TMU1] = tdfxTMAllocTexMem( fxMesa, TDFX_TMU1, size ); + break; + + case TDFX_TMU_BOTH: + size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info ); + t->range[TDFX_TMU0] = tdfxTMAllocTexMem( fxMesa, TDFX_TMU0, size ); + if ( t->range[TDFX_TMU0] ) + fxMesa->stats.memTexUpload += size; + + size = grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info ); + t->range[TDFX_TMU1] = tdfxTMAllocTexMem( fxMesa, TDFX_TMU1, size ); + break; + + default: + gl_problem( NULL, "error in tdfxTMMoveInTM() -> bad unit (%d)" ); + return; + } + + t->reloadImages = GL_TRUE; + t->isInTM = GL_TRUE; + + fxMesa->stats.texUpload++; +} + + +/* Move the given texture out of hardware texture memory. + * This deallocates the texture's memory space. + */ +void tdfxTMMoveOutTMLocked( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ) +{ + struct gl_shared_state *ss = fxMesa->glCtx->Shared; + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) { + fprintf( stderr, __FUNCTION__ "( %p (%d) )\n", tObj, tObj->Name ); + tdfxTMVerifyFreeList( fxMesa, 0 ); + tdfxTMVerifyFreeList( fxMesa, 1 ); + } + + if ( !t || !t->isInTM ) + return; + + switch ( t->whichTMU ) { + case TDFX_TMU0: + case TDFX_TMU1: + tdfxTMRemoveRangeLocked( fxMesa, t->whichTMU, t->range[t->whichTMU] ); + break; + + case TDFX_TMU_SPLIT: + case TDFX_TMU_BOTH: + assert( !tss->umaTexMemory ); + tdfxTMRemoveRangeLocked( fxMesa, TDFX_TMU0, t->range[TDFX_TMU0] ); + tdfxTMRemoveRangeLocked( fxMesa, TDFX_TMU1, t->range[TDFX_TMU1] ); + break; + + default: + gl_problem( NULL, "tdfx driver: bad unit in tdfxTMMOveOutTM()" ); + return; + } + + t->isInTM = GL_FALSE; + t->range[0] = NULL; + t->range[1] = NULL; + t->whichTMU = TDFX_TMU_NONE; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) { + tdfxTMVerifyFreeList( fxMesa, 0 ); + tdfxTMVerifyFreeList( fxMesa, 1 ); + } +} + + +void tdfxTMFreeTextureLocked( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ) +{ + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + + if ( t ) { + int i; + tdfxTMMoveOutTMLocked( fxMesa, tObj ); + for ( i = 0 ; i < MAX_TEXTURE_LEVELS ; i++ ) { + if ( t->image[i].original.data ) { + FREE( t->image[i].original.data ); + t->image[i].original.data = NULL; + t->image[i].original.width = 0; + t->image[i].original.height = 0; + t->image[i].original.size = 0; + } + if ( t->image[i].rescaled.data ) { + FREE( t->image[i].rescaled.data ); + t->image[i].rescaled.data = NULL; + t->image[i].rescaled.width = 0; + t->image[i].rescaled.height = 0; + t->image[i].rescaled.size = 0; + } + } + FREE( t ); + tObj->DriverData = NULL; + } + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) { + tdfxTMVerifyFreeList( fxMesa, 0 ); + tdfxTMVerifyFreeList( fxMesa, 1 ); + } +} + + +/* After a context switch this function will be called to restore + * texture memory for the new context. + */ +void tdfxTMRestoreTexturesLocked( tdfxContextPtr fxMesa ) +{ + GLcontext *ctx = fxMesa->glCtx; + struct gl_texture_object *tObj; + int i; + + for ( tObj = ctx->Shared->TexObjectList ; tObj ; tObj = tObj->Next ) { + tdfxTexObjPtr t = TDFX_TEXTURE_DATA( tObj ); + if ( t && t->isInTM ) { + for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) { + if ( ctx->Texture.Unit[i].Current == tObj ) { + tdfxTMDownloadTextureLocked( fxMesa, tObj ); + break; + } + } + if ( i == MAX_TEXTURE_UNITS ) { + tdfxTMMoveOutTMLocked( fxMesa, tObj ); + } + } + } + + if ( TDFX_DEBUG & DEBUG_VERBOSE_TEXTURE ) { + tdfxTMVerifyFreeList( fxMesa, 0 ); + tdfxTMVerifyFreeList( fxMesa, 1 ); + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h new file mode 100644 index 000000000..485d8cf3b --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h @@ -0,0 +1,76 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#ifndef __TDFX_TEXMAN_H__ +#define __TDFX_TEXMAN_H__ + +#include "tdfx_lock.h" + +extern void tdfxTMInit( tdfxContextPtr fxMesa ); +extern void tdfxTMClose( tdfxContextPtr fxMesa ); + +extern void tdfxTMDownloadTextureLocked( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ); +extern void tdfxTMReloadMipMapLevelLocked( GLcontext *ctx, + struct gl_texture_object *tObj, + GLint level ); +extern void tdfxTMMoveInTMLocked( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj, + FxU32 targetTMU ); +extern void tdfxTMMoveOutTMLocked( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ); +extern void tdfxTMRestoreTexturesLocked( tdfxContextPtr fxMesa ); + +extern void tdfxTMFreeTextureLocked( tdfxContextPtr fxMesa, + struct gl_texture_object *tObj ); + + +#define tdfxTMMoveInTM( fxMesa, tObj, targetTMU ) \ +do { \ + LOCK_HARDWARE( fxMesa ); \ + tdfxTMMoveInTMLocked( fxMesa, tObj, targetTMU ); \ + UNLOCK_HARDWARE( fxMesa ); \ +} while (0) + +#define tdfxTMMoveOutTM( fxMesa, tObj ) \ +do { \ + LOCK_HARDWARE( fxMesa ); \ + tdfxTMMoveOutTMLocked( fxMesa, tObj ); \ + UNLOCK_HARDWARE( fxMesa ); \ +} while (0) + +#endif diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c new file mode 100644 index 000000000..a32dd431d --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c @@ -0,0 +1,2097 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include "tdfx_state.h" +#include "tdfx_tex.h" +#include "tdfx_texman.h" + + +/* ============================================================= + * Texture + */ + +/* + * These macros are used below when handling COMBINE_EXT. + */ +#define TEXENV_OPERAND_INVERTED(operand) \ + (((operand) == GL_ONE_MINUS_SRC_ALPHA) \ + || ((operand) == GL_ONE_MINUS_SRC_COLOR)) +#define TEXENV_OPERAND_ALPHA(operand) \ + (((operand) == GL_SRC_ALPHA) || ((operand) == GL_ONE_MINUS_SRC_ALPHA)) +#define TEXENV_SETUP_ARG_A(param, source, operand, iteratedAlpha) \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CALPHA; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITALPHA; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedAlpha; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } + +#define TEXENV_SETUP_ARG_RGB(param, source, operand, iteratedColor, iteratedAlpha) \ + if (!TEXENV_OPERAND_ALPHA(operand)) { \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_RGB; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CCOLOR; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITRGB; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedColor; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } \ + } else { \ + switch (source) { \ + case GL_TEXTURE: \ + param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \ + break; \ + case GL_CONSTANT_EXT: \ + param = GR_CMBX_TMU_CALPHA; \ + break; \ + case GL_PRIMARY_COLOR_EXT: \ + param = GR_CMBX_ITALPHA; \ + break; \ + case GL_PREVIOUS_EXT: \ + param = iteratedAlpha; \ + break; \ + default: \ + /* \ + * This is here just to keep from getting \ + * compiler warnings. \ + */ \ + param = GR_CMBX_ZERO; \ + break; \ + } \ + } + +#define TEXENV_SETUP_MODE_RGB(param, operand) \ + switch (operand) { \ + case GL_SRC_COLOR: \ + case GL_SRC_ALPHA: \ + param = GR_FUNC_MODE_X; \ + break; \ + case GL_ONE_MINUS_SRC_ALPHA: \ + case GL_ONE_MINUS_SRC_COLOR: \ + param = GR_FUNC_MODE_ONE_MINUS_X; \ + break; \ + default: \ + param = GR_FUNC_MODE_ZERO; \ + break; \ + } + +#define TEXENV_SETUP_MODE_A(param, operand) \ + switch (operand) { \ + case GL_SRC_ALPHA: \ + param = GR_FUNC_MODE_X; \ + break; \ + case GL_ONE_MINUS_SRC_ALPHA: \ + param = GR_FUNC_MODE_ONE_MINUS_X; \ + break; \ + default: \ + param = GR_FUNC_MODE_ZERO; \ + break; \ + } + + + +/* + * Setup a texture environment on Voodoo5. + * Return GL_TRUE for success, GL_FALSE for failure. + * If we fail, we'll have to use software rendering. + */ +static GLboolean +SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA, + const struct gl_texture_unit *texUnit, GLenum baseFormat, + struct tdfx_texcombine_ext *env) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrTCCUColor_t incomingRGB, incomingAlpha; + const GLenum envMode = texUnit->EnvMode; + + if (useIteratedRGBA) { + incomingRGB = GR_CMBX_ITRGB; + incomingAlpha = GR_CMBX_ITALPHA; + } + else { + incomingRGB = GR_CMBX_OTHER_TEXTURE_RGB; + incomingAlpha = GR_CMBX_OTHER_TEXTURE_ALPHA; + } + + /* invariant: */ + env->Color.Shift = 0; + env->Color.Invert = FXFALSE; + env->Alpha.Shift = 0; + env->Alpha.Invert = FXFALSE; + + switch (envMode) { + case GL_REPLACE: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceA = incomingRGB; + } + else { + /* Rv = Rt */ + env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB; + } + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceD = incomingAlpha; + } + else { + /* Av = At */ + env->Alpha.SourceD = GR_CMBX_LOCAL_TEXTURE_ALPHA; + } + env->Alpha.SourceA = GR_CMBX_ITALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_ZERO; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXFALSE; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_MODULATE: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + } + else { + /* Result = Frag * Tex */ + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.InvertC = FXFALSE; + } + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + } + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_DECAL: + /* -- Setup RGB combiner */ + if (baseFormat == GL_RGB) { + /* Rv = Rt */ + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_X; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + } + else { + /* Rv = Rf * (1 - At) + Rt * At */ + env->Color.SourceB = incomingRGB; + env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Color.InvertC = FXFALSE; + env->Color.SourceD = GR_CMBX_B; + env->Color.InvertD = FXFALSE; + } + env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.ModeA = GR_FUNC_MODE_X; + /* -- Setup Alpha combiner */ + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_BLEND: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + } + else { + /* Rv = Rf * (1 - Rt) + Rc * Rt */ + env->Color.SourceA = GR_CMBX_TMU_CCOLOR; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceB = incomingRGB; + env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.InvertC = FXFALSE; + env->Color.SourceD = GR_CMBX_B; + env->Color.InvertD = FXFALSE; + } + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ZERO; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af * (1 - It) + Ac * It */ + env->Alpha.SourceA = GR_CMBX_TMU_CALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = incomingAlpha; + env->Alpha.ModeB = GR_FUNC_MODE_NEGATIVE_X; + env->Alpha.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.InvertC = FXFALSE; + env->Alpha.SourceD = GR_CMBX_B; + env->Alpha.InvertD = FXFALSE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + } + /* Also have to set up the tex env constant color */ + env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F, + texUnit->EnvColor[1] * 255.0F, + texUnit->EnvColor[2] * 255.0F, + texUnit->EnvColor[3] * 255.0F); + break; + case GL_ADD: + /* -- Setup RGB combiner */ + if (baseFormat == GL_ALPHA) { + /* Rv = Rf */ + env->Color.SourceB = GR_CMBX_ZERO; + env->Color.ModeB = GR_FUNC_MODE_ZERO; + } + else { + /* Rv = Rf + Tt */ + env->Color.SourceB = GR_CMBX_LOCAL_TEXTURE_RGB; + env->Color.ModeB = GR_FUNC_MODE_X; + } + env->Color.SourceA = incomingRGB; + env->Color.ModeA = GR_FUNC_MODE_X; + env->Color.SourceC = GR_CMBX_ZERO; + env->Color.InvertC = FXTRUE; + env->Color.SourceD = GR_CMBX_ZERO; + env->Color.InvertD = FXFALSE; + /* -- Setup Alpha combiner */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af + It */ + env->Alpha.SourceA = incomingAlpha; + env->Alpha.SourceB = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_X; + env->Alpha.SourceC = GR_CMBX_ZERO; + env->Alpha.InvertC = FXTRUE; + } + else { + /* Av = Af * At */ + env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA; + env->Alpha.SourceB = GR_CMBX_ITALPHA; + env->Alpha.ModeB = GR_FUNC_MODE_ZERO; + env->Alpha.SourceC = incomingAlpha; + env->Alpha.InvertC = FXFALSE; + } + env->Alpha.ModeA = GR_FUNC_MODE_X; + env->Alpha.SourceD = GR_CMBX_ZERO; + env->Alpha.InvertD = FXFALSE; + break; + + case GL_COMBINE_EXT: + { + FxU32 A_RGB, B_RGB, C_RGB, D_RGB; + FxU32 Amode_RGB, Bmode_RGB; + FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB; + FxU32 Shift_RGB; + FxU32 A_A, B_A, C_A, D_A; + FxU32 Amode_A, Bmode_A; + FxBool Cinv_A, Dinv_A, Ginv_A; + FxU32 Shift_A; + + /* + * + * In the formulas below, we write: + * o "1(x)" for the identity function applied to x, + * so 1(x) = x. + * o "0(x)" for the constant function 0, so + * 0(x) = 0 for all values of x. + * + * Calculate the color combination. + */ + Shift_RGB = texUnit->CombineScaleShiftRGB; + Shift_A = texUnit->CombineScaleShiftA; + switch (texUnit->CombineModeRGB) { + case GL_REPLACE: + /* + * The formula is: Arg0 + * We implement this by the formula: + * (Arg0 + 0(0))*(1-0) + 0 + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; + Bmode_RGB = GR_FUNC_MODE_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_MODULATE: + /* + * The formula is: Arg0 * Arg1 + * + * We implement this by the formula + * (Arg0 + 0(0)) * Arg1 + 0(0) + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + B_RGB = GR_CMBX_ZERO; + Bmode_RGB = GR_CMBX_ZERO; + TEXENV_SETUP_ARG_RGB(C_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + Cinv_RGB = TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1]); + D_RGB = GR_CMBX_ZERO; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_ADD: + /* + * The formula is Arg0 + Arg1 + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Bmode_RGB, + texUnit->CombineOperandRGB[1]); + C_RGB = D_RGB = GR_CMBX_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_ADD_SIGNED_EXT: + /* + * The formula is: Arg0 + Arg1 - 0.5. + * We compute this by calculating: + * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} + * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} + * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} + * we cannot implement the formula properly. + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) { + /* + * A is not inverted. So, choose it. + */ + Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1])) { + Bmode_RGB = GR_FUNC_MODE_X; + } + else { + Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + } + } + else { + /* + * A is inverted, so try to subtract 1/2 + * from B. + */ + Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandRGB[1])) { + Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF; + } + else { + /* + * Both are inverted. This is the case + * we cannot handle properly. We just + * choose to not add the - 1/2. + */ + Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X; + return GL_FALSE; + } + } + C_RGB = D_RGB = GR_CMBX_ZERO; + Cinv_RGB = FXTRUE; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + case GL_INTERPOLATE_EXT: + /* + * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). + * We compute this by the formula: + * (Arg0 - Arg1) * Arg2 + Arg1 + * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 + * == Arg0 * Arg2 + Arg1 * (1 - Arg2) + * However, if both Arg1 is ONE_MINUS_X, the HW does + * not support it properly. + */ + TEXENV_SETUP_ARG_RGB(A_RGB, + texUnit->CombineSourceRGB[0], + texUnit->CombineOperandRGB[0], + incomingRGB, incomingAlpha); + TEXENV_SETUP_MODE_RGB(Amode_RGB, + texUnit->CombineOperandRGB[0]); + TEXENV_SETUP_ARG_RGB(B_RGB, + texUnit->CombineSourceRGB[1], + texUnit->CombineOperandRGB[1], + incomingRGB, incomingAlpha); + if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) { + /* + * This case is wrong. + */ + Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; + return GL_FALSE; + } + else { + Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X; + } + /* + * The Source/Operand for the C value must + * specify some kind of alpha value. + */ + TEXENV_SETUP_ARG_A(C_RGB, + texUnit->CombineSourceRGB[2], + texUnit->CombineOperandRGB[2], + incomingAlpha); + Cinv_RGB = FXFALSE; + D_RGB = GR_CMBX_B; + Dinv_RGB = Ginv_RGB = FXFALSE; + break; + default: + /* + * This is here mostly to keep from getting + * a compiler warning about these not being set. + * However, this should set all the texture values + * to zero. + */ + A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO; + Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X; + Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE; + break; + } + /* + * Calculate the alpha combination. + */ + switch (texUnit->CombineModeA) { + case GL_REPLACE: + /* + * The formula is: Arg0 + * We implement this by the formula: + * (Arg0 + 0(0))*(1-0) + 0 + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + B_A = GR_CMBX_ITALPHA; + Bmode_A = GR_FUNC_MODE_ZERO; + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_MODULATE: + /* + * The formula is: Arg0 * Arg1 + * + * We implement this by the formula + * (Arg0 + 0(0)) * Arg1 + 0(0) + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + B_A = GR_CMBX_ZERO; + Bmode_A = GR_CMBX_ZERO; + TEXENV_SETUP_ARG_A(C_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + Cinv_A = TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1]); + D_A = GR_CMBX_ZERO; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_ADD: + /* + * The formula is Arg0 + Arg1 + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + TEXENV_SETUP_MODE_A(Bmode_A, + texUnit->CombineOperandA[0]); + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_ADD_SIGNED_EXT: + /* + * The formula is: Arg0 + Arg1 - 0.5. + * We compute this by calculating: + * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA} + * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA} + * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA} + * we cannot implement the formula properly. + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) { + /* + * A is not inverted. So, choose it. + */ + Amode_A = GR_FUNC_MODE_X_MINUS_HALF; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_X; + } else { + Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; + } + } else { + /* + * A is inverted, so try to subtract 1/2 + * from B. + */ + Amode_A = GR_FUNC_MODE_ONE_MINUS_X; + if (!TEXENV_OPERAND_INVERTED + (texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_X_MINUS_HALF; + } else { + /* + * Both are inverted. This is the case + * we cannot handle properly. We just + * choose to not add the - 1/2. + */ + Bmode_A = GR_FUNC_MODE_ONE_MINUS_X; + return GL_FALSE; + } + } + C_A = D_A = GR_CMBX_ZERO; + Cinv_A = FXTRUE; + Dinv_A = Ginv_A = FXFALSE; + break; + case GL_INTERPOLATE_EXT: + /* + * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2). + * We compute this by the formula: + * (Arg0 - Arg1) * Arg2 + Arg1 + * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1 + * == Arg0 * Arg2 + Arg1 * (1 - Arg2) + * However, if both Arg1 is ONE_MINUS_X, the HW does + * not support it properly. + */ + TEXENV_SETUP_ARG_A(A_A, + texUnit->CombineSourceA[0], + texUnit->CombineOperandA[0], + incomingAlpha); + TEXENV_SETUP_MODE_A(Amode_A, + texUnit->CombineOperandA[0]); + TEXENV_SETUP_ARG_A(B_A, + texUnit->CombineSourceA[1], + texUnit->CombineOperandA[1], + incomingAlpha); + if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) { + Bmode_A = GR_FUNC_MODE_NEGATIVE_X; + } + else { + /* + * This case is wrong. + */ + Bmode_A = GR_FUNC_MODE_NEGATIVE_X; + return GL_FALSE; + } + /* + * The Source/Operand for the C value must + * specify some kind of alpha value. + */ + TEXENV_SETUP_ARG_A(C_A, + texUnit->CombineSourceA[2], + texUnit->CombineOperandA[2], + incomingAlpha); + Cinv_A = FXFALSE; + D_A = GR_CMBX_ZERO; + Dinv_A = Ginv_A = FXFALSE; + break; + default: + /* + * This is here mostly to keep from getting + * a compiler warning about these not being set. + * However, this should set all the alpha values + * to one. + */ + A_A = B_A = C_A = D_A = GR_CMBX_ZERO; + Amode_A = Bmode_A = GR_FUNC_MODE_X; + Cinv_A = Dinv_A = FXFALSE; + Ginv_A = FXTRUE; + break; + } + /* + * Save the parameters. + */ + env->Color.SourceA = A_RGB; + env->Color.ModeA = Amode_RGB; + env->Color.SourceB = B_RGB; + env->Color.ModeB = Bmode_RGB; + env->Color.SourceC = C_RGB; + env->Color.InvertC = Cinv_RGB; + env->Color.SourceD = D_RGB; + env->Color.InvertD = Dinv_RGB; + env->Color.Shift = Shift_RGB; + env->Color.Invert = Ginv_RGB; + env->Alpha.SourceA = A_A; + env->Alpha.ModeA = Amode_A; + env->Alpha.SourceB = B_A; + env->Alpha.ModeB = Bmode_A; + env->Alpha.SourceC = C_A; + env->Alpha.InvertC = Cinv_A; + env->Alpha.SourceD = D_A; + env->Alpha.InvertD = Dinv_A; + env->Alpha.Shift = Shift_A; + env->Alpha.Invert = Ginv_A; + env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F, + texUnit->EnvColor[1] * 255.0F, + texUnit->EnvColor[2] * 255.0F, + texUnit->EnvColor[3] * 255.0F); + } + break; + + default: + gl_problem(ctx, "Bad envMode in SetupTexEnvNapalm"); + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; + + fxMesa->ColorCombineExt.SourceA = GR_CMBX_TEXTURE_RGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X, + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_TEXTURE_ALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + return GL_TRUE; /* success */ +} + + + +/* + * Setup the Voodoo3 texture environment for a single texture unit. + * Return GL_TRUE for success, GL_FALSE for failure. + * If failure, we'll use software rendering. + */ +static GLboolean +SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit, + GLenum envMode, GLenum baseFormat) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GrCombineLocal_t localc, locala; + struct tdfx_combine alphaComb, colorComb; + + if (1 /*iteratedRGBA*/) + localc = locala = GR_COMBINE_LOCAL_ITERATED; + else + localc = locala = GR_COMBINE_LOCAL_CONSTANT; + + switch (envMode) { + case GL_DECAL: + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + colorComb.Function = GR_COMBINE_FUNCTION_BLEND; + colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + break; + case GL_MODULATE: + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_LOCAL; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + case GL_BLEND: + /* + * XXX we can't do real GL_BLEND mode. These settings assume that + * the TexEnv color is black and incoming fragment color is white. + */ + if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* Av = Af */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else if (baseFormat == GL_INTENSITY) { + /* Av = Af * (1 - It) + Ac * It */ + /* XXX this is wrong */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + /* Av = Af * At */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXTRUE; + } + /* XXX return GL_FALSE for modes we don't support */ + break; + + case GL_REPLACE: + if ((baseFormat == GL_RGB) || (baseFormat == GL_LUMINANCE)) { + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + case GL_ADD: + if (baseFormat == GL_ALPHA || + baseFormat == GL_LUMINANCE_ALPHA || + baseFormat == GL_RGBA) { + /* product of texel and fragment alpha */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + else if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) { + /* fragment alpha is unchanged */ + alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL; + alphaComb.Factor = GR_COMBINE_FACTOR_NONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_NONE; + alphaComb.Invert = FXFALSE; + } + else { + ASSERT(baseFormat == GL_INTENSITY); + /* sum of texel and fragment alpha */ + alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, + alphaComb.Factor = GR_COMBINE_FACTOR_ONE; + alphaComb.Local = locala; + alphaComb.Other = GR_COMBINE_OTHER_TEXTURE; + alphaComb.Invert = FXFALSE; + } + if (baseFormat == GL_ALPHA) { + /* rgb unchanged */ + colorComb.Function = GR_COMBINE_FUNCTION_LOCAL; + colorComb.Factor = GR_COMBINE_FACTOR_NONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_NONE; + colorComb.Invert = FXFALSE; + } + else { + /* sum of texel and fragment rgb */ + colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, + colorComb.Factor = GR_COMBINE_FACTOR_ONE; + colorComb.Local = localc; + colorComb.Other = GR_COMBINE_OTHER_TEXTURE; + colorComb.Invert = FXFALSE; + } + break; + + default: + gl_problem(NULL, "bad texture env mode in SetupSingleTexEnvVoodoo3"); + } + + if (colorComb.Function != fxMesa->ColorCombine.Function || + colorComb.Factor != fxMesa->ColorCombine.Factor || + colorComb.Local != fxMesa->ColorCombine.Local || + colorComb.Other != fxMesa->ColorCombine.Other || + colorComb.Invert != fxMesa->ColorCombine.Invert) { + fxMesa->ColorCombine = colorComb; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + } + + if (alphaComb.Function != fxMesa->AlphaCombine.Function || + alphaComb.Factor != fxMesa->AlphaCombine.Factor || + alphaComb.Local != fxMesa->AlphaCombine.Local || + alphaComb.Other != fxMesa->AlphaCombine.Other || + alphaComb.Invert != fxMesa->AlphaCombine.Invert) { + fxMesa->AlphaCombine = alphaComb; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + } + return GL_TRUE; +} + + +/* + * Setup the Voodoo3 texture environment for dual texture units. + * Return GL_TRUE for success, GL_FALSE for failure. + * If failure, we'll use software rendering. + */ +static GLboolean +SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0, + GLenum envMode0, GLenum baseFormat0, + GLenum envMode1, GLenum baseFormat1) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const GrCombineLocal_t locala = GR_COMBINE_LOCAL_ITERATED; + const GrCombineLocal_t localc = GR_COMBINE_LOCAL_ITERATED; + const int tmu1 = 1 - tmu0; + + if (envMode0 == GL_MODULATE && envMode1 == GL_MODULATE) { + GLboolean isalpha[TDFX_NUM_TMU]; + + if (baseFormat0 == GL_ALPHA) + isalpha[tmu0] = GL_TRUE; + else + isalpha[tmu0] = GL_FALSE; + + if (baseFormat1 == GL_ALPHA) + isalpha[tmu1] = GL_TRUE; + else + isalpha[tmu1] = GL_FALSE; + + if (isalpha[TDFX_TMU1]) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + if (isalpha[TDFX_TMU0]) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else if (envMode0 == GL_REPLACE && envMode1 == GL_BLEND) { /* Quake */ + if (tmu1 == TDFX_TMU1) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else if (envMode0 == GL_REPLACE && envMode1 == GL_MODULATE) { + /* Quake 2/3 */ + if (tmu1 == TDFX_TMU1) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXTRUE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + if (baseFormat0 == GL_RGB) { + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else { + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_ONE; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + } + else if (envMode0 == GL_MODULATE && envMode1 == GL_ADD) { + /* Quake 3 sky */ + GLboolean isalpha[TDFX_NUM_TMU]; + if (baseFormat0 == GL_ALPHA) + isalpha[tmu0] = GL_TRUE; + else + isalpha[tmu0] = GL_FALSE; + if (baseFormat1 == GL_ALPHA) + isalpha[tmu1] = GL_TRUE; + else + isalpha[tmu1] = GL_FALSE; + + if (isalpha[TDFX_TMU1]) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXTRUE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + if (isalpha[TDFX_TMU0]) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + else { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + } + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->ColorCombine.Local = localc; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL; + fxMesa->AlphaCombine.Local = locala; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + else { + /*gl_problem(ctx, "Unexpected dual texture mode encountered\n");*/ + return GL_FALSE; + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + return GL_TRUE; +} + + +/* + * This function makes sure that the correct mipmap levels are loaded + * in the right places in memory and then makes the Glide calls to + * setup the texture source pointers. + */ +static void +setupSingleTMU(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) +{ + const GLcontext *ctx = fxMesa->glCtx; + tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ctx->Shared->DriverData; + tdfxTexObjPtr t = TDFX_TEXTURE_DATA(tObj); + + /* Make sure we're not loaded incorrectly */ + if (t->isInTM && !tss->umaTexMemory) { + /* if doing filtering between mipmap levels, alternate mipmap levels + * must be in alternate TMUs. + */ + if (t->LODblend) { + if (t->whichTMU != TDFX_TMU_SPLIT) + tdfxTMMoveOutTMLocked(fxMesa, tObj); + } + else { + if (t->whichTMU == TDFX_TMU_SPLIT) + tdfxTMMoveOutTMLocked(fxMesa, tObj); + } + } + + /* Make sure we're loaded correctly */ + if (!t->isInTM) { + /* Have to download the texture */ + if (tss->umaTexMemory) { + tdfxTMMoveInTMLocked(fxMesa, tObj, TDFX_TMU0); + } + else { + /* Voodoo3 (split texture memory) */ + if (t->LODblend) { + tdfxTMMoveInTMLocked(fxMesa, tObj, TDFX_TMU_SPLIT); + } + else { +#if 0 + /* XXX putting textures into the second memory bank when the + * first bank is full is not working at this time. + */ + if (fxMesa->numTMUs > 1) { + GLint memReq = + grTexTextureMemRequired( GR_MIPMAPLEVELMASK_BOTH, &t->info ); + if (tss->freeTexMem[TDFX_TMU0] > memReq) { + tdfxTMMoveInTMLocked(fxMesa, tObj, TDFX_TMU0); + } + else { + tdfxTMMoveInTMLocked(fxMesa, tObj, TDFX_TMU1); + } + } + else +#endif + { + tdfxTMMoveInTMLocked( fxMesa, tObj, TDFX_TMU0 ); + } + } + } + } + + if (t->LODblend && t->whichTMU == TDFX_TMU_SPLIT) { + /* mipmap levels split between texture banks */ + GLint u; + + if (t->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(t->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + + for (u = 0; u < 2; u++) { + fxMesa->TexParams[u].sClamp = t->sClamp; + fxMesa->TexParams[u].tClamp = t->tClamp; + fxMesa->TexParams[u].minFilt = t->minFilt; + fxMesa->TexParams[u].magFilt = t->magFilt; + fxMesa->TexParams[u].mmMode = t->mmMode; + fxMesa->TexParams[u].LODblend = t->LODblend; + fxMesa->TexParams[u].LodBias = ctx->Texture.Unit[u].LodBias; + } + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + + fxMesa->TexSource[0].StartAddress = t->range[TDFX_TMU0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD; + fxMesa->TexSource[0].Info = &(t->info); + fxMesa->TexSource[1].StartAddress = t->range[TDFX_TMU1]->startAddr; + fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[1].Info = &(t->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + } + else { + FxU32 tmu; + + if (t->whichTMU == TDFX_TMU_BOTH) + tmu = TDFX_TMU0; + else + tmu = t->whichTMU; + + if (tss->umaTexMemory) { + assert(t->whichTMU == TDFX_TMU0); + assert(tmu == TDFX_TMU0); + } + + if (t->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(t->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + + /* KW: The alternative is to do the download to the other tmu. If + * we get to this point, I think it means we are thrashing the + * texture memory, so perhaps it's not a good idea. + */ + + if (fxMesa->TexParams[tmu].sClamp != t->sClamp || + fxMesa->TexParams[tmu].tClamp != t->tClamp || + fxMesa->TexParams[tmu].minFilt != t->minFilt || + fxMesa->TexParams[tmu].magFilt != t->magFilt || + fxMesa->TexParams[tmu].mmMode != t->mmMode || + fxMesa->TexParams[tmu].LODblend != FXFALSE || + fxMesa->TexParams[tmu].LodBias != ctx->Texture.Unit[tmu].LodBias) { + fxMesa->TexParams[tmu].sClamp = t->sClamp; + fxMesa->TexParams[tmu].tClamp = t->tClamp; + fxMesa->TexParams[tmu].minFilt = t->minFilt; + fxMesa->TexParams[tmu].magFilt = t->magFilt; + fxMesa->TexParams[tmu].mmMode = t->mmMode; + fxMesa->TexParams[tmu].LODblend = FXFALSE; + fxMesa->TexParams[tmu].LodBias = ctx->Texture.Unit[tmu].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + /* Glide texture source info */ + fxMesa->TexSource[0].Info = NULL; + fxMesa->TexSource[1].Info = NULL; + if (t->range[tmu]) { + fxMesa->TexSource[tmu].StartAddress = t->range[tmu]->startAddr; + fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu].Info = &(t->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + } + } + + fxMesa->sScale0 = t->sScale; + fxMesa->tScale0 = t->tScale; +} + +static void +selectSingleTMUSrc(tdfxContextPtr fxMesa, GLint tmu, FxBool LODblend) +{ + if (LODblend) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + + if ( fxMesa->numTMUs > 1 ) { + const struct gl_shared_state *ss = fxMesa->glCtx->Shared; + const tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + int tmu; + + if (tss->umaTexMemory) + tmu = GR_TMU0; + else + tmu = GR_TMU1; + + fxMesa->TexCombine[tmu].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[tmu].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[tmu].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[tmu].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[tmu].InvertRGB = FXFALSE; + fxMesa->TexCombine[tmu].InvertAlpha = FXFALSE; + } + fxMesa->tmuSrc = TDFX_TMU_SPLIT; + } + else { + if (tmu != TDFX_TMU1) { + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + if ( fxMesa->numTMUs > 1 ) { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + } + fxMesa->tmuSrc = TDFX_TMU0; + } + else { + fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE; + fxMesa->TexCombine[1].InvertRGB = FXFALSE; + fxMesa->TexCombine[1].InvertAlpha = FXFALSE; + /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */ + fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND; + fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE; + fxMesa->TexCombine[0].InvertRGB = FXFALSE; + fxMesa->TexCombine[0].InvertAlpha = FXFALSE; + fxMesa->tmuSrc = TDFX_TMU1; + } + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV; +} + +static void print_state(tdfxContextPtr fxMesa) +{ + GLcontext *ctx = fxMesa->glCtx; + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + GLenum base0 = tObj0->Image[tObj0->BaseLevel] ? tObj0->Image[tObj0->BaseLevel]->Format : 99; + GLenum base1 = tObj1->Image[tObj1->BaseLevel] ? tObj1->Image[tObj1->BaseLevel]->Format : 99; + + printf("Unit 0: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[0].ReallyEnabled, + fxMesa->TexState.Enabled); + printf(" EnvMode: GL=0x%x Gr=0x%x\n", ctx->Texture.Unit[0].EnvMode, + fxMesa->TexState.EnvMode[0]); + printf(" BaseFmt: GL=0x%x Gr=0x%x\n", base0, fxMesa->TexState.TexFormat[0]); + + + printf("Unit 1: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[1].ReallyEnabled, + fxMesa->TexState.Enabled); + printf(" EnvMode: GL=0x%x Gr:0x%x\n", ctx->Texture.Unit[1].EnvMode, + fxMesa->TexState.EnvMode[1]); + printf(" BaseFmt: GL=0x%x Gr:0x%x\n", base1, fxMesa->TexState.TexFormat[1]); +} + + +/* + * When we're only using a single texture unit, we always use the 0th + * Glide/hardware unit, regardless if it's GL_TEXTURE0_ARB or GL_TEXTURE1_ARB + * that's enalbed. + * Input: ctx - the context + * unit - the OpenGL texture unit to use. + */ +static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxTexObjPtr t; + struct gl_texture_object *tObj; + int tmu; + GLenum envMode, baseFormat; + + tObj = ctx->Texture.Unit[unit].CurrentD[2]; + + if (!tObj->Image[tObj->BaseLevel]) { + fprintf(stderr, "tObj->Image[BaseLevel] is nil, how did this happen?!?\n"); + return; + } + + if (tObj->Image[tObj->BaseLevel]->Border > 0) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_BORDER; + return; + } + + setupSingleTMU(fxMesa, tObj); + + t = TDFX_TEXTURE_DATA(tObj); + if (t->whichTMU == TDFX_TMU_BOTH) + tmu = TDFX_TMU0; + else + tmu = t->whichTMU; + + if (fxMesa->tmuSrc != tmu) { + selectSingleTMUSrc(fxMesa, tmu, t->LODblend); + } + + if (t->reloadImages) + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES; + + /* Some texture environments not supported */ + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE_ENV; + + /* Check if we really need to update the texenv state */ + envMode = ctx->Texture.Unit[unit].EnvMode; + baseFormat = tObj->Image[tObj->BaseLevel]->Format; + + if (TDFX_IS_NAPALM(fxMesa)) { + /* see if we really need to update the unit */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode != fxMesa->TexState.EnvMode[0] || + envMode == GL_COMBINE_EXT || + baseFormat != fxMesa->TexState.TexFormat[0]) { + struct tdfx_texcombine_ext *otherEnv; + if (!SetupTexEnvNapalm(ctx, GL_TRUE, + &ctx->Texture.Unit[unit], baseFormat, + &fxMesa->TexCombineExt[0])) { + /* software fallback */ + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + /* disable other unit */ + otherEnv = &fxMesa->TexCombineExt[1]; + otherEnv->Color.SourceA = GR_CMBX_ZERO; + otherEnv->Color.ModeA = GR_FUNC_MODE_ZERO; + otherEnv->Color.SourceB = GR_CMBX_ZERO; + otherEnv->Color.ModeB = GR_FUNC_MODE_ZERO; + otherEnv->Color.SourceC = GR_CMBX_ZERO; + otherEnv->Color.InvertC = FXFALSE; + otherEnv->Color.SourceD = GR_CMBX_ZERO; + otherEnv->Color.InvertD = FXFALSE; + otherEnv->Color.Shift = 0; + otherEnv->Color.Invert = FXFALSE; + otherEnv->Alpha.SourceA = GR_CMBX_ITALPHA; + otherEnv->Alpha.ModeA = GR_FUNC_MODE_ZERO; + otherEnv->Alpha.SourceB = GR_CMBX_ITALPHA; + otherEnv->Alpha.ModeB = GR_FUNC_MODE_ZERO; + otherEnv->Alpha.SourceC = GR_CMBX_ZERO; + otherEnv->Alpha.InvertC = FXFALSE; + otherEnv->Alpha.SourceD = GR_CMBX_ZERO; + otherEnv->Alpha.InvertD = FXFALSE; + otherEnv->Alpha.Shift = 0; + otherEnv->Alpha.Invert = FXFALSE; + + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + fxMesa->TexState.EnvMode[0] = envMode; + fxMesa->TexState.TexFormat[0] = baseFormat; + fxMesa->TexState.EnvMode[1] = 0; + fxMesa->TexState.TexFormat[1] = 0; + } + } + else { + /* Voodoo3 */ + + /* see if we really need to update the unit */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode != fxMesa->TexState.EnvMode[0] || + envMode == GL_COMBINE_EXT || + baseFormat != fxMesa->TexState.TexFormat[0]) { + if (!SetupSingleTexEnvVoodoo3(ctx, tmu, envMode, baseFormat)) { + /* software fallback */ + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + fxMesa->TexState.EnvMode[0] = envMode; + fxMesa->TexState.TexFormat[0] = baseFormat; + fxMesa->TexState.EnvMode[1] = 0; + fxMesa->TexState.TexFormat[1] = 0; + } + } +} + + +static void +setupDoubleTMU(tdfxContextPtr fxMesa, + struct gl_texture_object *tObj0, + struct gl_texture_object *tObj1) +{ +#define T0_NOT_IN_TMU 0x01 +#define T1_NOT_IN_TMU 0x02 +#define T0_IN_TMU0 0x04 +#define T1_IN_TMU0 0x08 +#define T0_IN_TMU1 0x10 +#define T1_IN_TMU1 0x20 + + const struct gl_shared_state *ss = fxMesa->glCtx->Shared; + const tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + const GLcontext *ctx = fxMesa->glCtx; + tdfxTexObjPtr t0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexObjPtr t1 = TDFX_TEXTURE_DATA(tObj1); + GLuint tstate = 0; + int tmu0 = 0, tmu1 = 1; + + if (tss->umaTexMemory) { + if (!t0->isInTM) { + tdfxTMMoveInTMLocked(fxMesa, tObj0, TDFX_TMU0); + assert(t0->isInTM); + } + if (!t1->isInTM) { + tdfxTMMoveInTMLocked(fxMesa, tObj1, TDFX_TMU0); + assert(t1->isInTM); + } + } + else { + /* We shouldn't need to do this. There is something wrong with + multitexturing when the TMUs are swapped. So, we're forcing + them to always be loaded correctly. !!! */ + if (t0->whichTMU == TDFX_TMU1) + tdfxTMMoveOutTMLocked(fxMesa, tObj0); + if (t1->whichTMU == TDFX_TMU0) + tdfxTMMoveOutTMLocked(fxMesa, tObj1); + + if (t0->isInTM) { + switch (t0->whichTMU) { + case TDFX_TMU0: + tstate |= T0_IN_TMU0; + break; + case TDFX_TMU1: + tstate |= T0_IN_TMU1; + break; + case TDFX_TMU_BOTH: + tstate |= T0_IN_TMU0 | T0_IN_TMU1; + break; + case TDFX_TMU_SPLIT: + tstate |= T0_NOT_IN_TMU; + break; + } + } + else + tstate |= T0_NOT_IN_TMU; + + if (t1->isInTM) { + switch (t1->whichTMU) { + case TDFX_TMU0: + tstate |= T1_IN_TMU0; + break; + case TDFX_TMU1: + tstate |= T1_IN_TMU1; + break; + case TDFX_TMU_BOTH: + tstate |= T1_IN_TMU0 | T1_IN_TMU1; + break; + case TDFX_TMU_SPLIT: + tstate |= T1_NOT_IN_TMU; + break; + } + } + else + tstate |= T1_NOT_IN_TMU; + + /* Move texture maps into TMUs */ + + if (!(((tstate & T0_IN_TMU0) && (tstate & T1_IN_TMU1)) || + ((tstate & T0_IN_TMU1) && (tstate & T1_IN_TMU0)))) { + if (tObj0 == tObj1) { + tdfxTMMoveInTMLocked(fxMesa, tObj1, TDFX_TMU_BOTH); + } + else { + /* Find the minimal way to correct the situation */ + if ((tstate & T0_IN_TMU0) || (tstate & T1_IN_TMU1)) { + /* We have one in the standard order, setup the other */ + if (tstate & T0_IN_TMU0) { + /* T0 is in TMU0, put T1 in TMU1 */ + tdfxTMMoveInTMLocked(fxMesa, tObj1, TDFX_TMU1); + } + else { + tdfxTMMoveInTMLocked(fxMesa, tObj0, TDFX_TMU0); + } + /* tmu0 and tmu1 are setup */ + } + else if ((tstate & T0_IN_TMU1) || (tstate & T1_IN_TMU0)) { + /* we have one in the reverse order, setup the other */ + if (tstate & T1_IN_TMU0) { + /* T1 is in TMU0, put T0 in TMU1 */ + tdfxTMMoveInTMLocked(fxMesa, tObj0, TDFX_TMU1); + } + else { + tdfxTMMoveInTMLocked(fxMesa, tObj1, TDFX_TMU0); + } + tmu0 = 1; + tmu1 = 0; + } + else { /* Nothing is loaded */ + tdfxTMMoveInTMLocked(fxMesa, tObj0, TDFX_TMU0); + tdfxTMMoveInTMLocked(fxMesa, tObj1, TDFX_TMU1); + /* tmu0 and tmu1 are setup */ + } + } + } + } + + t0->lastTimeUsed = fxMesa->texBindNumber; + t1->lastTimeUsed = fxMesa->texBindNumber; + + + if (!ctx->Texture.SharedPalette) { + if (t0->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(t0->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + else if (t1->info.format == GR_TEXFMT_P_8) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &(t1->palette); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + else { + fxMesa->TexPalette.Data = NULL; + } + } + + /* + * Setup Unit 0 + */ + assert(t0->isInTM); + assert(t0->range[tmu0]); + fxMesa->TexSource[tmu0].StartAddress = t0->range[tmu0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &(t0->info); + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; + + if (fxMesa->TexParams[tmu0].sClamp != t0->sClamp || + fxMesa->TexParams[tmu0].tClamp != t0->tClamp || + fxMesa->TexParams[tmu0].minFilt != t0->minFilt || + fxMesa->TexParams[tmu0].magFilt != t0->magFilt || + fxMesa->TexParams[tmu0].mmMode != t0->mmMode || + fxMesa->TexParams[tmu0].LODblend != FXFALSE || + fxMesa->TexParams[tmu0].LodBias != ctx->Texture.Unit[tmu0].LodBias) { + fxMesa->TexParams[tmu0].sClamp = t0->sClamp; + fxMesa->TexParams[tmu0].tClamp = t0->tClamp; + fxMesa->TexParams[tmu0].minFilt = t0->minFilt; + fxMesa->TexParams[tmu0].magFilt = t0->magFilt; + fxMesa->TexParams[tmu0].mmMode = t0->mmMode; + fxMesa->TexParams[tmu0].LODblend = FXFALSE; + fxMesa->TexParams[tmu0].LodBias = ctx->Texture.Unit[tmu0].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + /* + * Setup Unit 1 + */ + if (tss->umaTexMemory) { + ASSERT(t1->isInTM); + ASSERT(t1->range[0]); + fxMesa->TexSource[tmu1].StartAddress = t1->range[0]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(t1->info); + } + else { + ASSERT(t1->isInTM); + ASSERT(t1->range[tmu1]); + fxMesa->TexSource[tmu1].StartAddress = t1->range[tmu1]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &(t1->info); + } + + if (fxMesa->TexParams[tmu1].sClamp != t1->sClamp || + fxMesa->TexParams[tmu1].tClamp != t1->tClamp || + fxMesa->TexParams[tmu1].minFilt != t1->minFilt || + fxMesa->TexParams[tmu1].magFilt != t1->magFilt || + fxMesa->TexParams[tmu1].mmMode != t1->mmMode || + fxMesa->TexParams[tmu1].LODblend != FXFALSE || + fxMesa->TexParams[tmu1].LodBias != ctx->Texture.Unit[tmu1].LodBias) { + fxMesa->TexParams[tmu1].sClamp = t1->sClamp; + fxMesa->TexParams[tmu1].tClamp = t1->tClamp; + fxMesa->TexParams[tmu1].minFilt = t1->minFilt; + fxMesa->TexParams[tmu1].magFilt = t1->magFilt; + fxMesa->TexParams[tmu1].mmMode = t1->mmMode; + fxMesa->TexParams[tmu1].LODblend = FXFALSE; + fxMesa->TexParams[tmu1].LodBias = ctx->Texture.Unit[tmu1].LodBias; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS; + } + + fxMesa->sScale0 = t0->sScale; + fxMesa->tScale0 = t0->tScale; + fxMesa->sScale1 = t1->sScale; + fxMesa->tScale1 = t1->tScale; + +#undef T0_NOT_IN_TMU +#undef T1_NOT_IN_TMU +#undef T0_IN_TMU0 +#undef T1_IN_TMU0 +#undef T0_IN_TMU1 +#undef T1_IN_TMU1 +} + +static void setupTextureDoubleTMU(GLcontext * ctx) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + tdfxTexObjPtr t0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexObjPtr t1 = TDFX_TEXTURE_DATA(tObj1); + struct gl_texture_image *baseImage0 = tObj0->Image[tObj0->BaseLevel]; + struct gl_texture_image *baseImage1 = tObj1->Image[tObj1->BaseLevel]; + const GLenum envMode0 = ctx->Texture.Unit[0].EnvMode; + const GLenum envMode1 = ctx->Texture.Unit[1].EnvMode; + + if (baseImage0->Border > 0 || baseImage1->Border >0) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_BORDER; + return; + } + + setupDoubleTMU(fxMesa, tObj0, tObj1); + + if (t0->reloadImages || t1->reloadImages) + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES; + + fxMesa->tmuSrc = TDFX_TMU_BOTH; + + /* Some texture environments not supported */ + fxMesa->Fallback &= ~TDFX_FALLBACK_TEXTURE_ENV; + + if (TDFX_IS_NAPALM(fxMesa)) { + /* Remember, Glide has its texture units numbered in backward + * order compared to OpenGL. + */ + GLboolean hw1 = GL_TRUE, hw2 = GL_TRUE; + + /* check if we really need to update glide unit 1 */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode0 != fxMesa->TexState.EnvMode[1] || + envMode0 == GL_COMBINE_EXT || + baseImage0->Format != fxMesa->TexState.TexFormat[1] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + hw1 = SetupTexEnvNapalm(ctx, GL_TRUE, &ctx->Texture.Unit[0], + baseImage0->Format, &fxMesa->TexCombineExt[1]); + fxMesa->TexState.EnvMode[1] = envMode0; + fxMesa->TexState.TexFormat[1] = baseImage0->Format; + } + + /* check if we really need to update glide unit 0 */ + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode1 != fxMesa->TexState.EnvMode[0] || + envMode1 == GL_COMBINE_EXT || + baseImage1->Format != fxMesa->TexState.TexFormat[0] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + hw2 = SetupTexEnvNapalm(ctx, GL_FALSE, &ctx->Texture.Unit[1], + baseImage1->Format, &fxMesa->TexCombineExt[0]); + fxMesa->TexState.EnvMode[0] = envMode1; + fxMesa->TexState.TexFormat[0] = baseImage1->Format; + } + + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + + if (!hw1 || !hw2) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + } + else { + int unit0, unit1; + if ((t0->whichTMU == TDFX_TMU1) || (t1->whichTMU == TDFX_TMU0)) + unit0 = 1; + else + unit0 = 0; + unit1 = 1 - unit0; + + if (fxMesa->TexState.Enabled != ctx->Texture.ReallyEnabled || + envMode0 != fxMesa->TexState.EnvMode[unit0] || + envMode0 == GL_COMBINE_EXT || + envMode1 != fxMesa->TexState.EnvMode[unit1] || + envMode1 == GL_COMBINE_EXT || + baseImage0->Format != fxMesa->TexState.TexFormat[unit0] || + baseImage1->Format != fxMesa->TexState.TexFormat[unit1] || + (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)) { + + if (!SetupDoubleTexEnvVoodoo3(ctx, unit0, + ctx->Texture.Unit[0].EnvMode, baseImage0->Format, + ctx->Texture.Unit[1].EnvMode, baseImage1->Format)) { + fxMesa->Fallback |= TDFX_FALLBACK_TEXTURE_ENV; + } + + fxMesa->TexState.EnvMode[unit0] = envMode0; + fxMesa->TexState.TexFormat[unit0] = baseImage0->Format; + fxMesa->TexState.EnvMode[unit1] = envMode1; + fxMesa->TexState.TexFormat[unit1] = baseImage1->Format; + fxMesa->TexState.Enabled = ctx->Texture.ReallyEnabled; + } + } +} + + +void tdfxUpdateTextureState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + GLuint enabled = ctx->Texture.ReallyEnabled; + + if ( fxMesa->numTMUs == 1 ) + enabled &= TEXTURE0_2D; + + switch ( enabled ) { + case TEXTURE0_2D: + LOCK_HARDWARE( fxMesa ); /* XXX remove locking eventually */ + setupTextureSingleTMU( ctx, 0 ); + UNLOCK_HARDWARE( fxMesa ); + break; + case TEXTURE1_2D: + LOCK_HARDWARE( fxMesa ); + setupTextureSingleTMU( ctx, 1 ); + UNLOCK_HARDWARE( fxMesa ); + break; + case TEXTURE0_2D | TEXTURE1_2D: + LOCK_HARDWARE( fxMesa ); + setupTextureDoubleTMU( ctx ); + UNLOCK_HARDWARE( fxMesa ); + break; + + default: + /* Disable hardware texturing */ + if ( TDFX_IS_NAPALM( fxMesa ) ) { + fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB; + fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertC = FXTRUE; + fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->ColorCombineExt.InvertD = FXFALSE; + fxMesa->ColorCombineExt.Shift = 0; + fxMesa->ColorCombineExt.Invert = FXFALSE; + fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA; + fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X; + fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO; + fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertC = FXTRUE; + fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO; + fxMesa->AlphaCombineExt.InvertD = FXFALSE; + fxMesa->AlphaCombineExt.Shift = 0; + fxMesa->AlphaCombineExt.Invert = FXFALSE; + } else { + /* Voodoo 3 */ + fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->ColorCombine.Invert = FXFALSE; + fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL; + fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE; + fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED; + fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE; + fxMesa->AlphaCombine.Invert = FXFALSE; + } + + fxMesa->TexState.Enabled = 0; + fxMesa->TexState.EnvMode[0] = 0; + fxMesa->TexState.EnvMode[1] = 0; + + fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE; + fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE; + } +} + + +/* This is a special case of texture state update. + * It's used when we've simply bound a new texture to a texture + * unit and the new texture has the exact same attributes as the + * previously bound texture. + * This is very common in Quake3. + */ +void tdfxUpdateTextureBinding( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + const struct gl_shared_state *ss = fxMesa->glCtx->Shared; + const tdfxSharedStatePtr tss = (tdfxSharedStatePtr)ss->DriverData; + struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].CurrentD[2]; + struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].CurrentD[2]; + tdfxTexObjPtr t0 = TDFX_TEXTURE_DATA(tObj0); + tdfxTexObjPtr t1 = TDFX_TEXTURE_DATA(tObj1); + + if ( t0 ) { + fxMesa->sScale0 = t0->sScale; + fxMesa->tScale0 = t0->tScale; + if ( t0->info.format == GR_TEXFMT_P_8 ) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &t0->palette; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } else if ( t1 && t1->info.format == GR_TEXFMT_P_8 ) { + fxMesa->TexPalette.Type = GR_TEXTABLE_PALETTE_6666_EXT; + fxMesa->TexPalette.Data = &t1->palette; + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE; + } + } + if ( t1 ) { + fxMesa->sScale1 = t1->sScale; + fxMesa->tScale1 = t1->tScale; + } + + switch ( ctx->Texture.ReallyEnabled ) { + case TEXTURE0_2D: + if ( tss->umaTexMemory ) { + fxMesa->TexSource[0].StartAddress = t0->range[0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[0].Info = &(t0->info); + } else { + if ( t0->LODblend && t0->whichTMU == TDFX_TMU_SPLIT ) { + fxMesa->TexSource[0].StartAddress = t0->range[TDFX_TMU0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD; + fxMesa->TexSource[0].Info = &t0->info; + fxMesa->TexSource[1].StartAddress = t0->range[TDFX_TMU1]->startAddr; + fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN; + fxMesa->TexSource[1].Info = &t0->info; + } else { + FxU32 unit; + if ( t0->whichTMU == TDFX_TMU_BOTH ) { + unit = TDFX_TMU0; + } else { + unit = t0->whichTMU; + } + fxMesa->TexSource[0].Info = NULL; + fxMesa->TexSource[1].Info = NULL; + if ( t0->range[unit] ) { + fxMesa->TexSource[unit].StartAddress = t0->range[unit]->startAddr; + fxMesa->TexSource[unit].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[unit].Info = &t0->info; + } + } + } + break; + + case TEXTURE1_2D: + if ( tss->umaTexMemory ) { + fxMesa->TexSource[0].StartAddress = t1->range[0]->startAddr; + fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[0].Info = &t1->info; + } + break; + + case TEXTURE0_2D | TEXTURE1_2D: + if ( tss->umaTexMemory ) { + const FxU32 tmu0 = 0, tmu1 = 1; + fxMesa->TexSource[tmu0].StartAddress = t0->range[0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &t0->info; + + fxMesa->TexSource[tmu1].StartAddress = t1->range[0]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &t1->info; + } + else { + const FxU32 tmu0 = 0, tmu1 = 1; + fxMesa->TexSource[tmu0].StartAddress = t0->range[tmu0]->startAddr; + fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu0].Info = &t0->info; + + fxMesa->TexSource[tmu1].StartAddress = t1->range[tmu1]->startAddr; + fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH; + fxMesa->TexSource[tmu1].Info = &t1->info; + } + break; + } + + fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c new file mode 100644 index 000000000..b5dbaea64 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c @@ -0,0 +1,508 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_tris.h" + +#include "pipeline.h" +#include "vbindirect.h" + +static struct { + points_func points; + line_func line; + triangle_func triangle; + quad_func quad; + render_func *render_tab; +} rast_tab[TDFX_MAX_TRIFUNC]; + +#define TDFX_COLOR( to, from ) \ + do { \ + (to)[0] = (from)[2]; \ + (to)[1] = (from)[1]; \ + (to)[2] = (from)[0]; \ + (to)[3] = (from)[3]; \ + } while (0) + + +static void tdfxPrintRenderState( const char *msg, GLuint state ) +{ + fprintf( stderr, "%s: (0x%x) %s%s%s%s\n", + msg, state, + (state & TDFX_FLAT_BIT) ? "flat, " : "", + (state & TDFX_OFFSET_BIT) ? "offset, " : "", + (state & TDFX_TWOSIDE_BIT) ? "twoside, " : "", + (state & TDFX_CLIPRECT_BIT) ? "cliprects, " : ""); +} + + +#define IND (0) +#define TAG(x) x +#include "tdfx_tritmp.h" + +#define IND (TDFX_FLAT_BIT) +#define TAG(x) x##_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT) +#define TAG(x) x##_offset +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_offset_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT) +#define TAG(x) x##_twoside +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_twoside_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT) +#define TAG(x) x##_twoside_offset +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_FLAT_BIT) +#define TAG(x) x##_twoside_offset_flat +#include "tdfx_tritmp.h" + +#define IND (TDFX_CLIPRECT_BIT) +#define TAG(x) x##_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_offset_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_OFFSET_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_offset_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_flat_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_offset_cliprect +#include "tdfx_tritmp.h" + +#define IND (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT | TDFX_FLAT_BIT | TDFX_CLIPRECT_BIT) +#define TAG(x) x##_twoside_offset_flat_cliprect +#include "tdfx_tritmp.h" + +static void tdfx_render_vb_points( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* Adjust point coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += PNT_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_POINTS, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore point coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= PNT_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_line_strip( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* adjust line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_lines( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLint i; + (void) parity; + /* adjust line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x += LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + } + grDrawVertexArrayContiguous( GR_LINES, count-start, fxVB+start, + sizeof(*fxVB)); + /* restore line coords */ + for (i = start; i < count; i++) { + fxVB[i].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; + fxVB[i].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; + } +} + +static void tdfx_render_vb_triangles( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLES, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +static void tdfx_render_vb_tri_strip( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +static void tdfx_render_vb_tri_fan( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start, fxVB+start, + sizeof(*fxVB) ); + (void) parity; +} + + +static void tdfx_render_vb_poly( struct vertex_buffer *VB, + GLuint start, + GLuint count, + GLuint parity ) +{ + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + grDrawVertexArrayContiguous( GR_POLYGON, count-start, fxVB+start, + sizeof(*fxVB)); + (void) parity; +} + + +#define RENDER_POINTS( start, count ) \ +do { \ + int i; \ + for (i = start ; i < count ; i++) { \ + v[elt[i]].v.x += PNT_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i]].v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; \ + grDrawPoint(&v[elt[i]]); \ + v[elt[i]].v.x -= PNT_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i]].v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET; \ + } \ +} while (0) + +#define RENDER_LINE( i0, i1 ) \ +do { \ + v[elt[i0]].v.x += LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i0]].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \ + v[elt[i1]].v.x += LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i1]].v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; \ + grDrawLine( &v[elt[i0]], &v[elt[i1]] ); \ + v[elt[i0]].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i0]].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \ + v[elt[i1]].v.x -= LINE_X_OFFSET - TRI_X_OFFSET; \ + v[elt[i1]].v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET; \ +} while (0) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + if (parity) grDrawTriangle( &v[elt[i1]], &v[elt[i2]], &v[elt[i]] ); \ + else grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ +do { \ + grDrawTriangle( &v[elt[i3]], &v[elt[i2]], &v[elt[i]] ); \ + grDrawTriangle( &v[elt[i2]], &v[elt[i1]], &v[elt[i]] ); \ +} while (0) + + +#define LOCAL_VARS \ + GLcontext *ctx = VB->ctx; \ + const GLuint *elt = VB->EltPtr->data; \ + tdfxVertexPtr v = TDFX_DRIVER_DATA(VB)->verts; \ + (void) v; (void) ctx; + +#define TAG(x) tdfx_##x##_elts +#include "render_tmp.h" + + +static void tdfxDDRenderEltsRaw( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + struct vertex_buffer *OldVB = ctx->VB; + GLenum prim = ctx->CVA.elt_mode; + GLuint nr = VB->EltPtr->count; + render_func func = tdfx_render_tab_elts[prim]; + GLuint p = 0; + + ctx->VB = VB; + ctx->Driver.RenderStart( ctx ); + + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + do { + func( VB, 0, nr, 0 ); + } while ( ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( VB, ++p ) ); + END_CLIP_LOOP_LOCKED( fxMesa ); + + ctx->Driver.RenderFinish( ctx ); + ctx->VB = OldVB; +} + + +void tdfxDDTriangleFuncsInit( void ) +{ + init(); + init_flat(); + init_offset(); + init_offset_flat(); + init_twoside(); + init_twoside_flat(); + init_twoside_offset(); + init_twoside_offset_flat(); + + init_cliprect(); + init_flat_cliprect(); + init_offset_cliprect(); + init_offset_flat_cliprect(); + init_twoside_cliprect(); + init_twoside_flat_cliprect(); + init_twoside_offset_cliprect(); + init_twoside_offset_flat_cliprect(); + + rast_tab[0].render_tab[GL_POINTS] = tdfx_render_vb_points; + rast_tab[0].render_tab[GL_LINE_STRIP] = tdfx_render_vb_line_strip; + rast_tab[0].render_tab[GL_LINES] = tdfx_render_vb_lines; + rast_tab[0].render_tab[GL_TRIANGLES] = tdfx_render_vb_triangles; + rast_tab[0].render_tab[GL_TRIANGLE_STRIP] = tdfx_render_vb_tri_strip; + rast_tab[0].render_tab[GL_TRIANGLE_FAN] = tdfx_render_vb_tri_fan; + rast_tab[0].render_tab[GL_POLYGON] = tdfx_render_vb_poly; + + tdfx_render_init_elts(); +} + + +#define ALL_FALLBACK (DD_SELECT | DD_FEEDBACK) +#define POINT_FALLBACK (ALL_FALLBACK | DD_POINT_SMOOTH | DD_POINT_ATTEN) +#define LINE_FALLBACK (ALL_FALLBACK | DD_LINE_STIPPLE) +#define TRI_FALLBACK (ALL_FALLBACK | DD_TRI_SMOOTH | DD_TRI_UNFILLED) +#define ANY_FALLBACK (POINT_FALLBACK | LINE_FALLBACK | TRI_FALLBACK | DD_TRI_STIPPLE | DD_LINE_SMOOTH | DD_LINE_WIDTH | DD_POINT_SIZE ) +#define ANY_RENDER_FLAGS (DD_FLATSHADE | DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET) + +/* Setup the Point, Line, Triangle and Quad functions based on the + * current rendering state. Wherever possible, use the hardware to + * render the primitive. Otherwise, fallback to software rendering. + */ +void tdfxDDChooseRenderState( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + GLuint flags = ctx->TriangleCaps; + CARD32 index = 0; + fxMesa->RenderElementsRaw = tdfxDDRenderEltsRaw; + + if ( fxMesa->Fallback ) { + fxMesa->RenderElementsRaw = gl_render_elts; + fxMesa->RenderIndex = TDFX_FALLBACK_BIT; + return; + } + + if ( flags & ANY_RENDER_FLAGS ) { + if ( flags & DD_FLATSHADE ) index |= TDFX_FLAT_BIT; + if ( flags & DD_TRI_LIGHT_TWOSIDE ) index |= TDFX_TWOSIDE_BIT; + if ( flags & DD_TRI_OFFSET ) index |= TDFX_OFFSET_BIT; + fxMesa->RenderElementsRaw = gl_render_elts; + } + + if ( fxMesa->numClipRects > 1 ) + index |= TDFX_CLIPRECT_BIT; + + fxMesa->PointsFunc = rast_tab[index].points; + fxMesa->LineFunc = rast_tab[index].line; + fxMesa->TriangleFunc = rast_tab[index].triangle; + fxMesa->QuadFunc = rast_tab[index].quad; + fxMesa->RenderVBRawTab = rast_tab[index].render_tab; + fxMesa->RenderIndex = index; + fxMesa->IndirectTriangles = 0; + + if ( flags & ANY_FALLBACK ) { + if ( flags & POINT_FALLBACK ) { + fxMesa->PointsFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= DD_POINT_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if ( flags & LINE_FALLBACK ) { + fxMesa->LineFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= DD_LINE_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if ( flags & TRI_FALLBACK ) { + fxMesa->TriangleFunc = 0; + fxMesa->QuadFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | + DD_QUAD_SW_RASTERIZE); + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + /* Special case: wide, AA lines must be done in software */ + if (flags & DD_LINE_SMOOTH) { + if (ctx->Line.Width != 1.0) { + fxMesa->RenderVBRawTab = 0; + fxMesa->LineFunc = 0; + fxMesa->IndirectTriangles |= DD_LINE_SW_RASTERIZE; + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + } + + /* Special case: we can do polygon stipples, but otherwise */ + if ((flags & DD_TRI_STIPPLE) && + (ctx->IndirectTriangles & DD_TRI_STIPPLE)) { + fxMesa->TriangleFunc = 0; + fxMesa->QuadFunc = 0; + fxMesa->RenderVBRawTab = 0; + fxMesa->IndirectTriangles |= (DD_TRI_SW_RASTERIZE | + DD_QUAD_SW_RASTERIZE); + fxMesa->RenderIndex |= TDFX_FALLBACK_BIT; + } + + if (flags & (DD_LINE_WIDTH | DD_POINT_SIZE)) + fxMesa->RenderVBRawTab = 0; + + fxMesa->RenderElementsRaw = gl_render_elts; + } + + + if ( 0 ) { + gl_print_tri_caps( "tricaps", ctx->TriangleCaps ); + tdfxPrintRenderState( "tdfx render state", fxMesa->RenderIndex ); + } +} + + +void tdfxDDToggleTriCliprects( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + int oldidx = fxMesa->RenderIndex; + int newidx; + + if (fxMesa->Fallback) + return; + + if (fxMesa->numClipRects > 1) + newidx = (fxMesa->RenderIndex |= TDFX_CLIPRECT_BIT); + else + newidx = (fxMesa->RenderIndex &= ~TDFX_CLIPRECT_BIT); + + if (ctx->Driver.TriangleFunc == rast_tab[oldidx].triangle) + ctx->Driver.TriangleFunc = rast_tab[newidx].triangle; + + if (ctx->Driver.QuadFunc == rast_tab[oldidx].quad) + ctx->Driver.QuadFunc = rast_tab[newidx].quad; + + if (ctx->Driver.LineFunc == rast_tab[oldidx].line) + ctx->Driver.LineFunc = rast_tab[newidx].line; + + if (ctx->Driver.PointsFunc == rast_tab[oldidx].points) + ctx->Driver.PointsFunc = rast_tab[newidx].points; + + if (ctx->Driver.RenderVBRawTab == rast_tab[oldidx].render_tab) + ctx->Driver.RenderVBRawTab = rast_tab[newidx].render_tab; + + if (ctx->TriangleFunc == rast_tab[oldidx].triangle) + ctx->TriangleFunc = rast_tab[newidx].triangle; + + if (ctx->QuadFunc == rast_tab[oldidx].quad) + ctx->QuadFunc = rast_tab[newidx].quad; + + fxMesa->PointsFunc = rast_tab[newidx].points; + fxMesa->LineFunc = rast_tab[newidx].line; + fxMesa->TriangleFunc = rast_tab[newidx].triangle; + fxMesa->QuadFunc = rast_tab[newidx].quad; + fxMesa->RenderVBRawTab = rast_tab[newidx].render_tab; + + if (newidx == 0 && + (ctx->IndirectTriangles & (DD_LINE_WIDTH|DD_POINT_SIZE)) == 0) + fxMesa->RenderElementsRaw = tdfxDDRenderEltsRaw; + else + fxMesa->RenderElementsRaw = gl_render_elts; + + if (0) + tdfxPrintRenderState( "toggle tdfx render state", fxMesa->RenderIndex ); +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h new file mode 100644 index 000000000..442acf877 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h @@ -0,0 +1,176 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_TRIS_H__ +#define __TDFX_TRIS_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "tdfx_vb.h" +#include "tdfx_render.h" + +extern void tdfxDDChooseRenderState( GLcontext *ctx ); +extern void tdfxDDTriangleFuncsInit( void ); + + +#define TDFX_FLAT_BIT 0x01 +#define TDFX_OFFSET_BIT 0x02 +#define TDFX_TWOSIDE_BIT 0x04 +#define TDFX_CLIPRECT_BIT 0x10 +#define TDFX_FALLBACK_BIT 0x20 +#define TDFX_MAX_TRIFUNC 0x40 + + +static __inline void tdfx_draw_triangle( tdfxContextPtr fxMesa, + tdfxVertex *v0, + tdfxVertex *v1, + tdfxVertex *v2 ) +{ + grDrawTriangle( v0, v1, v2 ); +} + + +static __inline void tdfx_draw_point( tdfxContextPtr fxMesa, + tdfxVertex *tmp, float sz ) +{ + if ( sz <= 1.0 ) { + /* Save and restore original x,y rather than copying whole + * vertex. + */ + GLfloat x = tmp->v.x, y = tmp->v.y; + tmp->v.x += PNT_X_OFFSET - TRI_X_OFFSET; + tmp->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET; + grDrawPoint( tmp ); + tmp->v.x = x; + tmp->v.y = y; + } + else { + const GLfloat xLeft = tmp->v.x - 0.5 * sz - TRI_X_OFFSET + PNT_X_OFFSET; + const GLfloat xRight = tmp->v.x + 0.5 * sz - TRI_X_OFFSET + PNT_X_OFFSET; + const GLfloat yBot = tmp->v.y - 0.5 * sz - TRI_Y_OFFSET + PNT_Y_OFFSET; + const GLfloat yTop = tmp->v.y + 0.5 * sz - TRI_Y_OFFSET + PNT_Y_OFFSET; + tdfxVertex verts[4]; + + verts[0] = *tmp; + verts[1] = *tmp; + verts[2] = *tmp; + verts[3] = *tmp; + + verts[0].v.x = xLeft; + verts[0].v.y = yBot; + + verts[1].v.x = xRight; + verts[1].v.y = yBot; + + verts[2].v.x = xRight; + verts[2].v.y = yTop; + + verts[3].v.x = xLeft; + verts[3].v.y = yTop; + + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts, + sizeof(tdfxVertex) ); + } +} + + +static __inline void tdfx_draw_line( tdfxContextPtr fxMesa, + tdfxVertex *tmp0, + tdfxVertex *tmp1, + float width ) +{ + if ( width <= 1.0 ) + { + /* Faster to save and restore 4 dwords than to copy 32 dwords. + */ + GLfloat x0 = tmp0->v.x, y0 = tmp0->v.y; + GLfloat x1 = tmp1->v.x, y1 = tmp1->v.y; + tmp0->v.x += LINE_X_OFFSET - TRI_X_OFFSET; + tmp0->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + tmp1->v.x += LINE_X_OFFSET - TRI_X_OFFSET; + tmp1->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET; + grDrawLine(tmp0, tmp1); + tmp0->v.x = x0; + tmp0->v.y = y0; + tmp1->v.x = x1; + tmp1->v.y = y1; + } + else + { + tdfxVertex verts[4]; + float dx, dy, ix, iy; + + dx = tmp0->v.x - tmp1->v.x; + dy = tmp0->v.y - tmp1->v.y; + + if (dx * dx > dy * dy) { + iy = width * .5; + ix = 0; + } else { + iy = 0; + ix = width * .5; + } + + verts[0] = *tmp0; + verts[1] = *tmp0; + verts[2] = *tmp1; + verts[3] = *tmp1; + + verts[0].v.x = tmp0->v.x - ix; + verts[0].v.y = tmp0->v.y - iy; + + verts[1].v.x = tmp0->v.x + ix; + verts[1].v.y = tmp0->v.y + iy; + + verts[2].v.x = tmp1->v.x + ix; + verts[2].v.y = tmp1->v.y + iy; + + verts[3].v.x = tmp1->v.x - ix; + verts[3].v.y = tmp1->v.y - iy; + + grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, 4, verts, + sizeof(tdfxVertex) ); + } +} + +void tdfxDDToggleTriCliprects( GLcontext *ctx ); + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_TRIS_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h new file mode 100644 index 000000000..53b8c07b2 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h @@ -0,0 +1,422 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +static __inline void TAG(triangle)( GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, + GLuint pv ) +{ + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxverts = TDFX_DRIVER_DATA(VB)->verts; + tdfxVertex *v[3]; + +#if (IND & TDFX_OFFSET_BIT) + GLfloat offset; + GLfloat z[3]; +#endif + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + GLuint c[3]; +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); +#endif + + v[0] = &fxverts[e0]; + v[1] = &fxverts[e1]; + v[2] = &fxverts[e2]; + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; +#endif + + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT)) + { + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; + +#if (IND & TDFX_TWOSIDE_BIT) + { + GLuint facing = ( cc < 0.0 ) ^ ctx->Polygon.FrontBit; + GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + if (IND & TDFX_FLAT_BIT) { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); + v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + } else { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); + TDFX_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + TDFX_COLOR( (char *)&v[2]->ui[4], vbcolor[e2] ); + } + } +#endif + +#if (IND & TDFX_OFFSET_BIT) + { + offset = ctx->Polygon.OffsetUnits; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; + if (cc * cc > 1e-16) { + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + + } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; + } +#endif + } +#elif (IND & TDFX_FLAT_BIT) + { + GLuint color = fxverts[pv].ui[4]; + v[0]->ui[4] = color; + v[1]->ui[4] = color; + v[2]->ui[4] = color; + } +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + grDrawTriangle( v[0], v[1], v[2] ); + END_CLIP_LOOP_LOCKED( fxMesa ); +#else + grDrawTriangle( v[0], v[1], v[2] ); +#endif + +#if (IND & TDFX_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; +#endif + +#if (IND & (TDFX_FLAT_BIT | TDFX_TWOSIDE_BIT)) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; +#endif + +} + + + +static __inline void TAG(quad)( GLcontext *ctx, GLuint e0, + GLuint e1, GLuint e2, GLuint e3, + GLuint pv ) +{ + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxverts = TDFX_DRIVER_DATA(VB)->verts; + tdfxVertex *v[4]; + +#if (IND & TDFX_OFFSET_BIT) + GLfloat offset; + GLfloat z[4]; +#endif + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + GLuint c[4]; +#endif + +#if (IND & TDFX_CLIPRECT_BIT) + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); +#endif + + + v[0] = &fxverts[e0]; + v[1] = &fxverts[e1]; + v[2] = &fxverts[e2]; + v[3] = &fxverts[e3]; + + +/* fprintf(stderr, "%s\n", __FUNCTION__); */ + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_FLAT_BIT)) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; + c[3] = v[3]->ui[4]; +#endif + + +#if (IND & (TDFX_TWOSIDE_BIT | TDFX_OFFSET_BIT)) + { + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; + +#if (IND & TDFX_TWOSIDE_BIT) + { + GLuint facing = ( cc < 0.0 ) ^ ctx->Polygon.FrontBit; + GLubyte (*vbcolor)[4] = VB->Color[facing]->data; + if (IND & TDFX_FLAT_BIT) { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[pv] ); + v[3]->ui[4] = v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; + } else { + TDFX_COLOR( (char *)&v[0]->ui[4], vbcolor[e0] ); + TDFX_COLOR( (char *)&v[1]->ui[4], vbcolor[e1] ); + TDFX_COLOR( (char *)&v[2]->ui[4], vbcolor[e2] ); + TDFX_COLOR( (char *)&v[3]->ui[4], vbcolor[e3] ); + } + } +#endif + +#if (IND & TDFX_OFFSET_BIT) + { + offset = ctx->Polygon.OffsetUnits; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; + z[3] = v[3]->v.z; + if (cc * cc > 1e-16) { + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if ( ac < 0.0f ) ac = -ac; + if ( bc < 0.0f ) bc = -bc; + offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + + } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; + v[3]->v.z += offset; + } +#endif + } +#elif (IND & TDFX_FLAT_BIT) + { + GLuint color = fxverts[pv].ui[4]; + v[0]->ui[4] = color; + v[1]->ui[4] = color; + v[2]->ui[4] = color; + v[3]->ui[4] = color; + } +#endif + +/* Marginally faster to call grDrawTriangle twice + * than calling grDrawVertexArray. + */ +#if (IND & TDFX_CLIPRECT_BIT) + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); +/* grDrawVertexArray( GR_TRIANGLE_FAN, 4, v ); */ + grDrawTriangle( v[0], v[1], v[3] ); + grDrawTriangle( v[1], v[2], v[3] ); + END_CLIP_LOOP_LOCKED( fxMesa ); +#else +/* grDrawVertexArray( GR_TRIANGLE_FAN, 4, v ); */ + grDrawTriangle( v[0], v[1], v[3] ); + grDrawTriangle( v[1], v[2], v[3] ); +#endif + +#if (IND & TDFX_OFFSET_BIT) + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; + v[3]->v.z = z[3]; +#endif + +#if (IND & (TDFX_FLAT_BIT | TDFX_TWOSIDE_BIT)) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; + v[3]->ui[4] = c[3]; +#endif +} + + + + + +static __inline void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, + GLuint pv ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(ctx->VB)->verts; + float width = ctx->Line.Width; + GLfloat z0, z1; + GLuint c0, c1; + tdfxVertex *vert0 = &fxVB[v0]; + tdfxVertex *vert1 = &fxVB[v1]; + + if ( IND & TDFX_TWOSIDE_BIT ) { + GLubyte (*vbcolor)[4] = ctx->VB->ColorPtr->data; + + if ( IND & TDFX_FLAT_BIT ) { + TDFX_COLOR( (char *)&vert0->v.color,vbcolor[pv] ); + *(int *)&vert1->v.color = *(int *)&vert0->v.color; + } else { + TDFX_COLOR( (char *)&vert0->v.color,vbcolor[v0] ); + TDFX_COLOR( (char *)&vert1->v.color,vbcolor[v1] ); + } + } else if ( IND & TDFX_FLAT_BIT ) { + c0 = *(GLuint *) &(vert0->v.color); + c1 = *(GLuint *) &(vert1->v.color); + *(int *)&vert0->v.color = + *(int *)&vert1->v.color = *(int *)&fxVB[pv].v.color; + } + + if ( IND & TDFX_OFFSET_BIT ) { + GLfloat offset = ctx->LineZoffset; + z0 = vert0->v.z; + z1 = vert1->v.z; + vert0->v.z += offset; + vert1->v.z += offset; + } + + if (IND & TDFX_CLIPRECT_BIT) { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_line( fxMesa, &fxVB[v0], &fxVB[v1], width ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } else + tdfx_draw_line( fxMesa, &fxVB[v0], &fxVB[v1], width ); + + if ( IND & TDFX_OFFSET_BIT ) { + vert0->v.z = z0; + vert1->v.z = z1; + } + + if ( (IND & TDFX_FLAT_BIT) && !(IND & TDFX_TWOSIDE_BIT) ) { + *(GLuint *) &(vert0->v.color) = c0; + *(GLuint *) &(vert1->v.color) = c1; + } +} + + +static __inline void TAG(points)( GLcontext *ctx, GLuint first, GLuint last ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + struct vertex_buffer *VB = ctx->VB; + tdfxVertexPtr fxVB = TDFX_DRIVER_DATA(VB)->verts; + GLfloat sz = ctx->Point.Size; + int i; + + for ( i = first ; i < last ; i++ ) { + if ( VB->ClipMask[i] == 0 ) { + if ( IND & (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT) ) + { + tdfxVertex tmp0 = fxVB[i]; + + if ( IND & TDFX_TWOSIDE_BIT ) { + GLubyte (*vbcolor)[4] = VB->ColorPtr->data; + TDFX_COLOR( (char *)&tmp0.v.color, vbcolor[i] ); + } + + if ( IND & TDFX_OFFSET_BIT ) { + GLfloat offset = ctx->PointZoffset; + tmp0.v.z += offset; + } + + if (IND & TDFX_CLIPRECT_BIT) { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_point( fxMesa, &tmp0, sz ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } else + tdfx_draw_point( fxMesa, &tmp0, sz ); + } + else if (IND & TDFX_CLIPRECT_BIT) + { + BEGIN_CLIP_LOOP_LOCKED( fxMesa ); + tdfx_draw_point( fxMesa, &fxVB[i], sz ); + END_CLIP_LOOP_LOCKED( fxMesa ); + } + else + tdfx_draw_point( fxMesa, &fxVB[i], sz ); + } + } +} + + + + +/* Accelerate unclipped VB rendering when fxMesa->renderIndex != 0 + * + * The versions for renderIndex == 0 are further optimized and appear + * in tdfx_tris.c + */ +#if (TYPE == 0) +#define RENDER_POINTS( start, count ) TAG(points)( ctx, start, count ) +#define RENDER_LINE( i1, i ) TAG(line)( ctx, i1, i, i ) +#define RENDER_TRI( i2, i1, i, pv, parity ) \ + do { \ + if (parity) TAG(triangle)( ctx, i1, i2, i, pv ); \ + else TAG(triangle)( ctx, i2, i1, i, pv ); \ + } while (0) +#define RENDER_QUAD( i3, i2, i1, i, pv ) TAG(quad)( ctx, i3, i2, i1, i, pv ) +#define LOCAL_VARS GLcontext *ctx = VB->ctx; +#define PRESERVE_TAG +#include "render_tmp.h" +#endif + + + +static void TAG(init)( void ) +{ + rast_tab[IND].triangle = TAG(triangle); + rast_tab[IND].quad = TAG(quad); + rast_tab[IND].line = TAG(line); + rast_tab[IND].points = TAG(points); +#if (TYPE == 0) + rast_tab[IND].render_tab = TAG(render_tab); +#else + rast_tab[IND].render_tab = 0; +#endif + TAG(render_init)(); +} + + +#undef IND +#undef TAG diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c new file mode 100644 index 000000000..a6c27612e --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c @@ -0,0 +1,498 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#include "tdfx_context.h" +#include "tdfx_vb.h" + +#include "stages.h" +#include "mem.h" + + +#define COORD \ +do { \ + v->v.x = winCoord[0] + xoffset; \ + v->v.y = winCoord[1] + yoffset; \ + v->v.z = winCoord[2]; \ + v->v.rhw = w; \ +} while (0) + + +/* The assembly is slower... + */ +#if 0 && defined(USE_X86_ASM) +#define COL \ +do { \ + __asm__ ( \ + "movl (%%edx),%%eax \n" \ + "bswap %%eax \n" \ + "rorl $8,%%eax \n" \ + "movl %%eax,16(%%edi) \n" \ + : \ + : "d" (color), "D" (v) \ + : "%eax" ); \ +} while (0) +#else +#define COL \ +do { \ + v->v.color.blue = color[2]; \ + v->v.color.green = color[1]; \ + v->v.color.red = color[0]; \ + v->v.color.alpha = color[3]; \ +} while (0) +#endif + + +#define TEX0 \ +do { \ + v->v.tu0 = tc0[i][0] * sScale0 * w; \ + v->v.tv0 = tc0[i][1] * tScale0 * w; \ +} while (0) + +#define TEX1 \ +do { \ + v->v.tu1 = tc1[i][0] * sScale1 * w; \ + v->v.tv1 = tc1[i][1] * tScale1 * w; \ +} while (0) + + +#define TEX0_4 \ + if ( VB->TexCoordPtr[0]->size == 4 ) { \ + GLfloat (*tc)[4] = VB->TexCoordPtr[0]->data; \ + winCoord = VB->Win.data[start]; \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + for ( i = start ; i < end ; i++, v++, winCoord+=4 ) { \ + v->v.tq0 = tc[i][3] * winCoord[3]; \ + } \ + } + +#define TEX1_4 \ + if ( VB->TexCoordPtr[1]->size == 4 ) { \ + GLfloat (*tc)[4] = VB->TexCoordPtr[1]->data; \ + winCoord = VB->Win.data[start]; \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + for ( i = start ; i < end ; i++, v++, winCoord+=4 ) { \ + v->v.tq1 = tc[i][3] * winCoord[3]; \ + } \ + } + + +#define FOG + + +#define NOP + + + +#define SETUPFUNC(name,win,col,tex0,tex1,tex0_4,tex1_4,fog) \ +static void name( struct vertex_buffer *VB, GLuint start, GLuint end ) \ +{ \ + tdfxContextPtr fxMesa = TDFX_CONTEXT(VB->ctx); \ + tdfxVertexPtr v; \ + const GLfloat *winCoord; \ + GLfloat (*tc0)[4]; \ + GLfloat (*tc1)[4]; \ + const GLfloat xoffset = fxMesa->x_offset + TRI_X_OFFSET; \ + const GLfloat yoffset = fxMesa->y_delta + TRI_Y_OFFSET; \ + const GLfloat sScale0 = fxMesa->sScale0; \ + const GLfloat tScale0 = fxMesa->tScale0; \ + const GLfloat sScale1 = fxMesa->sScale1; \ + const GLfloat tScale1 = fxMesa->tScale1; \ + const GLubyte *color; \ + int i; \ + \ + (void) xoffset; (void) yoffset; \ + (void) sScale0; (void) tScale0; \ + (void) sScale1; (void) tScale1; \ + \ + if (0) fprintf(stderr, "%s\n", __FUNCTION__); \ + gl_import_client_data( VB, VB->ctx->RenderFlags, \ + (VB->ClipOrMask \ + ? VEC_WRITABLE|VEC_GOOD_STRIDE \ + : VEC_GOOD_STRIDE)); \ + \ + tc0 = VB->TexCoordPtr[fxMesa->tmu_source[0]]->data; \ + tc1 = VB->TexCoordPtr[fxMesa->tmu_source[1]]->data; \ + color = VB->Color[0]->data[start]; \ + winCoord = VB->Win.data[start]; \ + \ + v = &(TDFX_DRIVER_DATA(VB)->verts[start]); \ + \ + if ( VB->ClipOrMask == 0 ) { \ + for ( i = start ; i < end ; i++, v++, color+=4, winCoord+=4 ) { \ + const GLfloat w = winCoord[3]; \ + (void) w; \ + win; \ + col; \ + fog; \ + tex0; \ + tex1; \ + } \ + } else { \ + for ( i = start ; i < end ; i++, v++, color+=4, winCoord+=4 ) { \ + if ( VB->ClipMask[i] == 0 ) { \ + const GLfloat w = winCoord[3]; \ + (void) w; \ + win; \ + fog; \ + tex0; \ + tex1; \ + } \ + col; \ + } \ + } \ + tex0_4; \ + tex1_4; \ +} + + +SETUPFUNC(rs_wt0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_wt0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_wft0, COORD, NOP, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_wft0t1, COORD, NOP, TEX0, TEX1, TEX0_4, TEX1_4, FOG) +SETUPFUNC(rs_wg, COORD, COL, NOP, NOP, NOP, NOP, NOP) +SETUPFUNC(rs_wgt0, COORD, COL, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_wgt0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_wgf, COORD, COL, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_wgft0, COORD, COL, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_wgft0t1, COORD, COL, TEX0, TEX1, TEX0_4, TEX1_4, FOG) + +SETUPFUNC(rs_t0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_t0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_f, NOP, NOP, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_ft0, NOP, NOP, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_ft0t1, NOP, NOP, TEX0, TEX1, TEX0_4, TEX1_4, FOG) +SETUPFUNC(rs_g, NOP, COL, NOP, NOP, NOP, NOP, NOP) +SETUPFUNC(rs_gt0, NOP, COL, TEX0, NOP, TEX0_4, NOP, NOP) +SETUPFUNC(rs_gt0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, NOP) +SETUPFUNC(rs_gf, NOP, COL, NOP, NOP, NOP, NOP, FOG) +SETUPFUNC(rs_gft0, NOP, COL, TEX0, NOP, TEX0_4, NOP, FOG) +SETUPFUNC(rs_gft0t1, NOP, COL, TEX0, TEX1, TEX0_4, TEX1_4, FOG) + + + +static void rs_invalid( struct vertex_buffer *VB, GLuint start, GLuint end ) +{ + fprintf( stderr, "tdfxRasterSetup(): invalid setup function\n" ); +} + +typedef void (*setupFunc)( struct vertex_buffer *, GLuint, GLuint ); + +static setupFunc setup_func[0x40]; + + +void tdfxDDSetupInit( void ) +{ + int i; + + for (i = 0; i < Elements(setup_func); i++) + setup_func[i] = rs_invalid; + + /* Functions to build vertices from scratch */ + setup_func[TDFX_WIN_BIT|TDFX_TEX0_BIT] = rs_wt0; + setup_func[TDFX_WIN_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wt0t1; + setup_func[TDFX_WIN_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_wft0; + setup_func[TDFX_WIN_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wft0t1; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT] = rs_wg; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_TEX0_BIT] = rs_wgt0; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wgt0t1; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT] = rs_wgf; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_wgft0; + setup_func[TDFX_WIN_BIT|TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_wgft0t1; + + /* Repair functions */ + setup_func[TDFX_TEX0_BIT] = rs_t0; + setup_func[TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_t0t1; + setup_func[TDFX_FOG_BIT] = rs_f; + setup_func[TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_ft0; + setup_func[TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_ft0t1; + setup_func[TDFX_RGBA_BIT] = rs_g; + setup_func[TDFX_RGBA_BIT|TDFX_TEX0_BIT] = rs_gt0; + setup_func[TDFX_RGBA_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_gt0t1; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT] = rs_gf; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT] = rs_gft0; + setup_func[TDFX_RGBA_BIT|TDFX_FOG_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT] = rs_gft0t1; +} + + +void tdfxPrintSetupFlags( char *msg, GLuint flags ) +{ + fprintf( stderr, "%s: 0x%x %s%s%s%s%s\n", + msg, + (int)flags, + (flags & TDFX_WIN_BIT) ? " xyzw," : "", + (flags & TDFX_RGBA_BIT) ? " rgba," : "", + (flags & TDFX_FOG_BIT) ? " fog," : "", + (flags & TDFX_TEX0_BIT) ? " tex-0," : "", + (flags & TDFX_TEX1_BIT) ? " tex-1," : "" ); +} + + +/* ================================================================ + * Raster Setup + */ + +void tdfxDDChooseRasterSetupFunc( GLcontext *ctx ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx ); + int index = TDFX_WIN_BIT | TDFX_RGBA_BIT; + int vertexFormat = fxMesa->vertexFormat; + + fxMesa->vertsize = 8; + fxMesa->tmu_source[0] = 0; + fxMesa->tmu_source[1] = 1; + fxMesa->tex_dest[0] = TDFX_TEX0_BIT; + fxMesa->tex_dest[1] = TDFX_TEX1_BIT; + fxMesa->vertexFormat = TDFX_LAYOUT_SINGLE; + + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX0 ) { + index |= TDFX_TEX0_BIT; + } + + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX1 ) { + if ( ctx->Texture.ReallyEnabled & ENABLE_TEX0 ) { + fxMesa->vertexFormat = TDFX_LAYOUT_MULTI; + fxMesa->vertsize = 10; + index |= TDFX_TEX1_BIT; + } else { + /* Just a funny way of doing single texturing. + */ + fxMesa->tmu_source[0] = 1; + fxMesa->tex_dest[1] = TDFX_TEX0_BIT; + index |= TDFX_TEX0_BIT; + } + } + + if (ctx->Texture.ReallyEnabled & (ENABLE_TEX0 | ENABLE_TEX1)) { + if ((ctx->VB->TexCoordPtr[0] && ctx->VB->TexCoordPtr[0]->size == 4) || + (ctx->VB->TexCoordPtr[1] && ctx->VB->TexCoordPtr[1]->size == 4)) { + fxMesa->vertexFormat = TDFX_LAYOUT_PROJECT; + } + } + + if ( ctx->Fog.Enabled ) + index |= TDFX_FOG_BIT; + + fxMesa->SetupIndex = index; + ctx->Driver.RasterSetup = setup_func[index]; + + if ( fxMesa->vertexFormat != vertexFormat ) { + fxMesa->dirty |= TDFX_UPLOAD_VERTEX_LAYOUT; + } + + if (0) { + tdfxPrintSetupFlags( "full setup function", index ); + fprintf(stderr, "full setup function %p\n", ctx->Driver.RasterSetup); + } +} + +/* Check to see if vertices need repairing. + */ +void tdfxDDCheckPartialRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *d ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + int tmp = fxMesa->SetupDone; + + d->type = 0; + fxMesa->SetupDone = 0; /* cleared if we return */ + + if ( (ctx->Array.Summary & VERT_OBJ_ANY) == 0 ) + return; + if ( ctx->IndirectTriangles ) + return; + + fxMesa->SetupDone = tmp; +} + +/* Repair existing precalculated vertices with new data. + */ +void tdfxDDPartialRasterSetup( struct vertex_buffer *VB ) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT( VB->ctx ); + GLuint new = VB->pipeline->new_outputs; + GLuint available = VB->pipeline->outputs; + GLuint index = 0; + + if ( new & VERT_WIN ) { + new = available; + index |= TDFX_WIN_BIT | TDFX_FOG_BIT; + } + + if ( new & VERT_RGBA ) + index |= TDFX_RGBA_BIT; + + if ( new & VERT_TEX0_ANY ) + index |= TDFX_TEX0_BIT; + + if ( new & VERT_TEX1_ANY ) + index |= fxMesa->tex_dest[1]; + + if ( new & VERT_FOG_COORD ) + index |= TDFX_FOG_BIT; + + fxMesa->SetupDone &= ~index; + index &= fxMesa->SetupIndex; + fxMesa->SetupDone |= index; + + if ( 0 ) + tdfxPrintSetupFlags( "partial setup function", index ); + + if ( index ) + setup_func[index]( VB, VB->Start, VB->Count ); +} + +void tdfxDDDoRasterSetup( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + + if ( VB->Type == VB_CVA_PRECALC ) { + tdfxDDPartialRasterSetup( VB ); + } else if ( ctx->Driver.RasterSetup ) { + ctx->Driver.RasterSetup( VB, VB->CopyStart, VB->Count ); + } +} + + +/* ================================================================ + * Device-specific Vertex Buffers + */ + +void tdfxDDResizeVB( struct vertex_buffer *VB, GLuint size ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + while ( fxVB->size < size ) + fxVB->size *= 2; + + ALIGN_FREE( fxVB->vert_store ); + fxVB->vert_store = ALIGN_MALLOC( sizeof(tdfxVertex) * fxVB->size, 32 ); + if ( !fxVB->vert_store ) { + fprintf( stderr, "Cannot allocate vertex store! Exiting...\n" ); + exit( 1 ); + } + + fxVB->verts = (tdfxVertexPtr)fxVB->vert_store; + + gl_vector1ui_free( &fxVB->clipped_elements ); + gl_vector1ui_alloc( &fxVB->clipped_elements, + VEC_WRITABLE, fxVB->size, 32 ); + if ( !fxVB->clipped_elements.start ) { + fprintf( stderr, "Cannot allocate clipped elements! Exiting...\n" ); + exit( 1 ); + } + + ALIGN_FREE( VB->ClipMask ); + VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * fxVB->size, 32 ); + if ( !VB->ClipMask ) { + fprintf( stderr, "Cannot allocate clipmask! Exiting...\n" ); + exit( 1 ); + } +} + +void tdfxDDResizeElts( struct vertex_buffer *VB, GLuint size ) +{ +#if 0 + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + FREE(fxVB->elts); + + while (fxVB->elt_size < size) + fxVB->elt_size *= 2; + + FREE(fxVB->elts); + fxVB->elts = MALLOC( sizeof(tdfxVertex *) * fxVB->elt_size ); + if ( !fxVB->elts ) { + fprintf( stderr, "Cannot allocate vertex indirection! Exiting...\n" ); + exit( 1 ); + } +#endif +} + +void tdfxDDRegisterVB( struct vertex_buffer *VB ) +{ + tdfxVertexBufferPtr fxVB; + + fxVB = (tdfxVertexBufferPtr) CALLOC( sizeof(*fxVB) ); + + fxVB->elt_size = fxVB->size = VB->Size * 2; + fxVB->vert_store = ALIGN_MALLOC( sizeof(tdfxVertex) * fxVB->size, 32 ); + if ( !fxVB->vert_store ) { + fprintf( stderr, "Cannot allocate vertex store! Exiting...\n" ); + exit( 1 ); + } + + fxVB->verts = (tdfxVertexPtr)fxVB->vert_store; + +#if 0 + fxVB->elts = MALLOC( sizeof(tdfxVertex *) * fxVB->elt_size ); + if ( !fxVB->elts ) { + fprintf( stderr, "Cannot allocate vertex indirection! Exiting...\n" ); + exit( 1 ); + } +#endif + + gl_vector1ui_alloc( &fxVB->clipped_elements, + VEC_WRITABLE, fxVB->size, 32 ); + if ( !fxVB->clipped_elements.start ) { + fprintf( stderr, "Cannot allocate clipped elements! Exiting...\n" ); + exit( 1 ); + } + + + ALIGN_FREE( VB->ClipMask ); + VB->ClipMask = (GLubyte *)ALIGN_MALLOC( sizeof(GLubyte) * fxVB->size, 32 ); + if ( !VB->ClipMask ) { + fprintf( stderr, "Cannot allocate clipmask! Exiting...\n" ); + exit( 1 ); + } + + VB->driver_data = fxVB; +} + +void tdfxDDUnregisterVB( struct vertex_buffer *VB ) +{ + tdfxVertexBufferPtr fxVB = TDFX_DRIVER_DATA(VB); + + if ( fxVB ) { + if ( fxVB->vert_store ) ALIGN_FREE( fxVB->vert_store ); + if ( fxVB->elts ) ALIGN_FREE( fxVB->elts ); + gl_vector1ui_free( &fxVB->clipped_elements ); + FREE( fxVB ); + VB->driver_data = NULL; + } +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h new file mode 100644 index 000000000..29d426add --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h @@ -0,0 +1,127 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * Keith Whitwell <keithw@valinux.com> + * + */ + +#ifndef __TDFX_VB_H__ +#define __TDFX_VB_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "types.h" +#include "vb.h" + +/* + * Color type for the vertex data + */ +typedef struct { + GLubyte blue; + GLubyte green; + GLubyte red; + GLubyte alpha; +} tdfx_color_t; + + +/* The vertex structure. The final tu1/tv1 values only used in + * multitexture modes, and tq0/tq1 in projected texture modes. + */ +typedef struct { + GLfloat x, y, z; /* Coordinates in screen space */ + GLfloat rhw; /* Reciprocal homogeneous w */ + tdfx_color_t color; /* Diffuse color */ + GLuint padding; /* ... */ + GLfloat tu0, tv0; /* Texture 0 coordinates */ + GLfloat tu1, tv1; /* Texture 1 coordinates */ + GLfloat tq0, tq1; /* Projected texture coordinates */ +} tdfx_vertex; + + +/* The fastpath code still expects a 16-float stride vertex. + */ +union tdfx_vertex_t { + tdfx_vertex v; + GLfloat f[16]; + GLuint ui[16]; +}; + +typedef union tdfx_vertex_t tdfxVertex; +typedef union tdfx_vertex_t *tdfxVertexPtr; + +/* Vertex buffer for use when on the fast path */ +struct tdfx_vertex_buffer { + tdfxVertexPtr verts; + GLvector1ui clipped_elements; + GLuint size; + int last_vert; + void *vert_store; + + tdfxVertexPtr *elts; + GLuint elt_size; + GLuint last_elt; +}; + +typedef struct tdfx_vertex_buffer *tdfxVertexBufferPtr; + +#define TDFX_DRIVER_DATA(vb) ((tdfxVertexBufferPtr)((vb)->driver_data)) + + +#define TDFX_WIN_BIT 0x01 +#define TDFX_RGBA_BIT 0x02 +#define TDFX_FOG_BIT 0x04 +#define TDFX_SPEC_BIT 0x08 +#define TDFX_TEX0_BIT 0x10 +#define TDFX_TEX1_BIT 0x20 + + +extern void tdfxDDSetupInit( void ); + +extern void tdfxDDChooseRasterSetupFunc( GLcontext *ctx ); +extern void tdfxPrintSetupFlags( char *msg, GLuint flags ); + +extern void tdfxDDCheckPartialRasterSetup( GLcontext *ctx, + struct gl_pipeline_stage *s ); +extern void tdfxDDPartialRasterSetup( struct vertex_buffer *VB ); +extern void tdfxDDDoRasterSetup( struct vertex_buffer *VB ); + +extern void tdfxDDResizeVB( struct vertex_buffer *VB, GLuint size ); +extern void tdfxDDResizeElts( struct vertex_buffer *VB, GLuint size ); +extern void tdfxDDRegisterVB( struct vertex_buffer *VB ); +extern void tdfxDDUnregisterVB( struct vertex_buffer *VB ); + + +#endif /* GLX_DIRECT_RENDERING */ + +#endif /* __TDFX_VB_H__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c new file mode 100644 index 000000000..52a7a1755 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c @@ -0,0 +1,382 @@ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c,v 1.1 2001/03/21 16:14:28 dawes Exp $ */ + +/* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * + */ + +#include <stdlib.h> +#include <string.h> + +#include "tdfx_context.h" + + +FxI32 +FX_grGetInteger_NoLock(FxU32 pname) +{ + switch (pname) { + case FX_FOG_TABLE_ENTRIES: + case FX_GLIDE_STATE_SIZE: + case FX_LFB_PIXEL_PIPE: + case FX_PENDING_BUFFERSWAPS: + case FX_TEXTURE_ALIGN: + case GR_STATS_PIXELS_DEPTHFUNC_FAIL: + case GR_STATS_PIXELS_IN: + case GR_STATS_PIXELS_OUT: + { + FxI32 result; + FxU32 grname = pname; + grGet(grname, 4, &result); + return result; + } + case FX_ZDEPTH_MAX: + { + FxI32 zvals[2]; + grGet(GR_ZDEPTH_MIN_MAX, 8, zvals); + return zvals[0]; + } + default: + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n"); + } + } + + return 0; +} + + +FxI32 +FX_grGetInteger(tdfxContextPtr fxMesa, FxU32 pname) +{ + int result; + LOCK_HARDWARE(fxMesa); + result = FX_grGetInteger_NoLock(pname); + UNLOCK_HARDWARE(fxMesa); + return result; +} + + +const char * +FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname) +{ + const char *s; + LOCK_HARDWARE(fxMesa); + s = grGetString(pname); + UNLOCK_HARDWARE(fxMesa); + return s; +} + + + +/* Wrapper for grColorMask() and grColorMaskExt(). + */ +void +FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + LOCK_HARDWARE(fxMesa); + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(r, g, b, a); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(r || g || b, GL_FALSE); + } + UNLOCK_HARDWARE(fxMesa); +} + + +void +FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a) +{ + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(r, g, b, a); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(r || g || b, GL_FALSE); + } +} + + +/* As above, but pass the mask as an array + */ +void +FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]) +{ + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + LOCK_HARDWARE(fxMesa); + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(rgba[RCOMP], rgba[GCOMP], + rgba[BCOMP], rgba[ACOMP]); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE); + } + UNLOCK_HARDWARE(fxMesa); +} + +void +FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]) +{ + if (ctx->Visual->RedBits == 8) { + /* 32bpp mode */ + ASSERT( grColorMaskExtProc ); + grColorMaskExtProc(rgba[RCOMP], rgba[GCOMP], + rgba[BCOMP], rgba[ACOMP]); + } + else { + /* 16 bpp mode */ + /* we never have an alpha buffer */ + grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE); + } +} + + + +FxBool +FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer, + GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, + FxBool pixelPipeline, GrLfbInfo_t * info) +{ + FxBool result; + + LOCK_HARDWARE(fxMesa); + result = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +FxU32 +FX_grTexTextureMemRequired(tdfxContextPtr fxMesa, FxU32 evenOdd, GrTexInfo * info) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexTextureMemRequired(evenOdd, info); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +FxU32 +FX_grTexMinAddress(tdfxContextPtr fxMesa, GrChipID_t tmu) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexMinAddress(tmu); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +extern FxU32 +FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu) +{ + FxU32 result; + + LOCK_HARDWARE(fxMesa); + result = grTexMaxAddress(tmu); + UNLOCK_HARDWARE(fxMesa); + return result; +} + + +int +FX_getFogTableSize(tdfxContextPtr fxMesa) +{ + int result; + LOCK_HARDWARE(fxMesa); + grGet(GR_FOG_TABLE_ENTRIES, sizeof(int), (void *) &result); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +int +FX_getGrStateSize(tdfxContextPtr fxMesa) +{ + int result; + LOCK_HARDWARE(fxMesa); + grGet(GR_GLIDE_STATE_SIZE, sizeof(int), (void *) &result); + UNLOCK_HARDWARE(fxMesa); + return result; +} + +void +FX_grAADrawLine(tdfxContextPtr fxMesa, GrVertex * a, GrVertex * b) +{ + /* ToDo */ + BEGIN_CLIP_LOOP(fxMesa); + grDrawLine(a, b); + END_CLIP_LOOP(fxMesa); +} + +void +FX_grAADrawPoint(tdfxContextPtr fxMesa, GrVertex * a) +{ + BEGIN_CLIP_LOOP(fxMesa); + grDrawPoint(a); + END_CLIP_LOOP(fxMesa); +} + +void +FX_grDrawPolygonVertexList(tdfxContextPtr fxMesa, int n, GrVertex * verts) +{ + BEGIN_CLIP_LOOP(fxMesa); + grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex)); + END_CLIP_LOOP(fxMesa); +} + +#if TDFX_USE_PARGB +void +FX_setupGrVertexLayout(tdfxContextPtr fxMesa) +{ + LOCK_HARDWARE(fxMesa); + grReset(GR_VERTEX_PARAMETER); + + grCoordinateSpace(GR_WINDOW_COORDS); + grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + UNLOCK_HARDWARE(fxMesa); +} +#else /* TDFX_USE_PARGB */ +void +FX_setupGrVertexLayout(tdfxContextPtr fxMesa) +{ + LOCK_HARDWARE(fxMesa); + grReset(GR_VERTEX_PARAMETER); + + grCoordinateSpace(GR_WINDOW_COORDS); + grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + UNLOCK_HARDWARE(fxMesa); +} +#endif /* TDFX_USE_PARGB */ + +void +FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask) +{ + switch (hintType) { + case GR_HINT_STWHINT: + { + if (hintMask & GR_STWHINT_W_DIFF_TMU0) + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, + GR_PARAM_DISABLE); + + if (hintMask & GR_STWHINT_ST_DIFF_TMU1) + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, + GR_PARAM_DISABLE); + + if (hintMask & GR_STWHINT_W_DIFF_TMU1) + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, + GR_PARAM_DISABLE); + + } + } +} + +void +FX_grHints(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask) +{ + LOCK_HARDWARE(fxMesa); + FX_grHints_NoLock(hintType, hintMask); + UNLOCK_HARDWARE(fxMesa); +} + +/* It appears to me that this function is needed either way. */ +FX_GrContext_t +FX_grSstWinOpen(tdfxContextPtr fxMesa, + FxU32 hWnd, + GrScreenResolution_t screen_resolution, + GrScreenRefresh_t refresh_rate, + GrColorFormat_t color_format, + GrOriginLocation_t origin_location, + int nColBuffers, int nAuxBuffers) +{ + FX_GrContext_t i; + LOCK_HARDWARE(fxMesa); + i = grSstWinOpen(hWnd, + screen_resolution, + refresh_rate, + color_format, origin_location, nColBuffers, nAuxBuffers); + + /* + fprintf(stderr, + "grSstWinOpen( win %d res %d ref %d fmt %d\n" + " org %d ncol %d naux %d )\n" + " ==> %d\n", + hWnd, + screen_resolution, + refresh_rate, + color_format, + origin_location, + nColBuffers, + nAuxBuffers, + i); + */ + UNLOCK_HARDWARE(fxMesa); + return i; +} diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h new file mode 100644 index 000000000..0adb85b41 --- /dev/null +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h @@ -0,0 +1,673 @@ +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul 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 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 + * BRIAN PAUL 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. + * + * + * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the + * terms stated above. + * + * Thank you for your contribution, David! + * + * Please make note of the above copyright/license statement. If you + * contributed code or bug fixes to this code under the previous (GNU + * Library) license and object to the new license, your code will be + * removed at your request. Please see the Mesa docs/COPYRIGHT file + * for more information. + * + * Additional Mesa/3Dfx driver developers: + * Daryll Strauss <daryll@precisioninsight.com> + * Keith Whitwell <keith@precisioninsight.com> + * + * See fxapi.h for more revision/author details. + */ + + +#ifndef __FX_GLIDE_WARPER__ +#define __FX_GLIDE_WARPER__ + +#include <glide.h> +#include <g3ext.h> + +typedef struct tdfx_context tdfxContextRec; +typedef struct tdfx_context *tdfxContextPtr; + +/* + * General context: + */ +typedef GrContext_t FX_GrContext_t; + +#define FX_FOG_TABLE_ENTRIES GR_FOG_TABLE_ENTRIES +#define FX_GLIDE_STATE_SIZE GR_GLIDE_STATE_SIZE +#define FX_LFB_PIXEL_PIPE GR_LFB_PIXEL_PIPE +#define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS +#define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN + +#define FX_ZDEPTH_MAX 0x100 + + +#define GR_ASPECT_1x1 GR_ASPECT_LOG2_1x1 +#define GR_ASPECT_2x1 GR_ASPECT_LOG2_2x1 +#define GR_ASPECT_4x1 GR_ASPECT_LOG2_4x1 +#define GR_ASPECT_8x1 GR_ASPECT_LOG2_8x1 +#define GR_ASPECT_1x2 GR_ASPECT_LOG2_1x2 +#define GR_ASPECT_1x4 GR_ASPECT_LOG2_1x4 +#define GR_ASPECT_1x8 GR_ASPECT_LOG2_1x8 + +#define GR_LOD_256 GR_LOD_LOG2_256 +#define GR_LOD_128 GR_LOD_LOG2_128 +#define GR_LOD_64 GR_LOD_LOG2_64 +#define GR_LOD_32 GR_LOD_LOG2_32 +#define GR_LOD_16 GR_LOD_LOG2_16 +#define GR_LOD_8 GR_LOD_LOG2_8 +#define GR_LOD_4 GR_LOD_LOG2_4 +#define GR_LOD_2 GR_LOD_LOG2_2 +#define GR_LOD_1 GR_LOD_LOG2_1 + +#define GR_FOG_WITH_TABLE GR_FOG_WITH_TABLE_ON_Q + + +typedef FxU32 GrHint_t; +#define GR_HINTTYPE_MIN 0 +#define GR_HINT_STWHINT 0 + +typedef FxU32 GrSTWHint_t; +#define GR_STWHINT_W_DIFF_FBI FXBIT(0) +#define GR_STWHINT_W_DIFF_TMU0 FXBIT(1) +#define GR_STWHINT_ST_DIFF_TMU0 FXBIT(2) +#define GR_STWHINT_W_DIFF_TMU1 FXBIT(3) +#define GR_STWHINT_ST_DIFF_TMU1 FXBIT(4) +#define GR_STWHINT_W_DIFF_TMU2 FXBIT(5) +#define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6) + +#define GR_CONTROL_ACTIVATE 1 +#define GR_CONTROL_DEACTIVATE 0 + +#define GrState void + +/* +** move the vertex layout defintion to application +*/ +typedef struct +{ + GLfloat sow; /* s texture ordinate (s over w) */ + GLfloat tow; /* t texture ordinate (t over w) */ + GLfloat oow; /* 1/w (used mipmapping - really 0xfff/w) */ +} +GrTmuVertex; + + +#if FX_USE_PARGB + +/* standard vertex, packed argb, double texture, 12 dwords */ +typedef struct +{ + GLfloat x, y; /* X and Y in screen space */ + GLfloat ooz; /* 65535/Z (used for Z-buffering) */ + GLfloat oow; /* 1/W (used for W-buffering, texturing) */ + FxU32 argb; /* R, G, B, A [0..255.0] */ + GrTmuVertex tmuvtx[GLIDE_NUM_TMU]; + GLfloat z; /* Z is ignored */ +} +GrVertex; + +/* optimised vertex, packed argb, single texture, 8 dwords = 1 cacheline */ +typedef struct +{ + GLfloat x, y; /* X and Y in screen space */ + GLfloat ooz; /* 65535/Z (used for Z-buffering) */ + GLfloat oow; /* 1/W (used for W-buffering, texturing) */ + FxU32 argb; /* R, G, B, A [0..255.0] */ + GrTmuVertex tmuvtx; /* only 1 TMU used to keep vertex size down */ +} +GrVertex_Fast; + +/* following offsets work for both vertex layouts */ +#define GR_VERTEX_X_OFFSET 0 +#define GR_VERTEX_Y_OFFSET 1 +#define GR_VERTEX_OOZ_OFFSET 2 +#define GR_VERTEX_OOW_OFFSET 3 +#define GR_VERTEX_PARGB_OFFSET 4 +#define GR_VERTEX_SOW_TMU0_OFFSET 5 +#define GR_VERTEX_TOW_TMU0_OFFSET 6 +#define GR_VERTEX_OOW_TMU0_OFFSET 7 +#define GR_VERTEX_SOW_TMU1_OFFSET 8 +#define GR_VERTEX_TOW_TMU1_OFFSET 9 +#define GR_VERTEX_OOW_TMU1_OFFSET 10 +#define GR_VERTEX_Z_OFFSET 11 + +#if GLIDE_ENDIAN == GLIDE_ENDIAN_BIG +#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3] +#define GET_PR(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+2] +#define GET_PG(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+1] +#define GET_PB(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+0] +#else +#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+0] +#define GET_PR(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+1] +#define GET_PG(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+2] +#define GET_PB(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3] +#endif + +#define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET] +#define PACK_4F_ARGB(dest, a, r, g, b) { \ + const GLuint cr = (int)r; \ + const GLuint cg = (int)g; \ + const GLuint ca = (int)a; \ + const GLuint cb = (int)b; \ + dest = ca << 24 | cr << 16 | cg << 8 | cb; \ +} + +#else /* FX_USE_PARGB */ + +typedef struct +{ + float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */ + float r, g, b; /* R, G, B, ([0..255.0]) */ + float ooz; /* 65535/Z (used for Z-buffering) */ + float a; /* Alpha [0..255.0] */ + float oow; /* 1/W (used for W-buffering, texturing) */ + GrTmuVertex tmuvtx[GLIDE_NUM_TMU]; +} +GrVertex; + +#define GR_VERTEX_X_OFFSET 0 +#define GR_VERTEX_Y_OFFSET 1 +#define GR_VERTEX_Z_OFFSET 2 +#define GR_VERTEX_R_OFFSET 3 +#define GR_VERTEX_G_OFFSET 4 +#define GR_VERTEX_B_OFFSET 5 +#define GR_VERTEX_OOZ_OFFSET 6 +#define GR_VERTEX_A_OFFSET 7 +#define GR_VERTEX_OOW_OFFSET 8 +#define GR_VERTEX_SOW_TMU0_OFFSET 9 +#define GR_VERTEX_TOW_TMU0_OFFSET 10 +#define GR_VERTEX_OOW_TMU0_OFFSET 11 +#define GR_VERTEX_SOW_TMU1_OFFSET 12 +#define GR_VERTEX_TOW_TMU1_OFFSET 13 +#define GR_VERTEX_OOW_TMU1_OFFSET 14 +#endif /* FX_USE_PARGB */ + + + +extern FxI32 FX_grGetInteger_NoLock(FxU32 pname); + +extern FxI32 FX_grGetInteger(tdfxContextPtr fxMesa, FxU32 pname); + +extern const char *FX_grGetString(tdfxContextPtr fxMesa, FxU32 pname); + + +#define FX_grTexDownloadTable(fxMesa, type, data) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexDownloadTable(type,data); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0); + +#define FX_grTexDownloadTable_NoLock(type, data) \ + grTexDownloadTable(type, data) + + +#define FX_grFlush(fxMesa) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFlush(); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grFinish(fxMesa) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFinish(); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + + +#define FX_grLfbWriteRegion(fxMesa,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \ + UNLOCK_HARDWARE(fxMesa); \ + } while(0) + + +#define FX_grLfbReadRegion(fxMesa,src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0); + + +#define FX_grDrawTriangle_NoLock(a,b,c) grDrawTriangle(a,b,c) +#define FX_grDrawTriangle(fxMesa, a,b,c) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + FX_grDrawTriangle_NoLock(a,b,c); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + + + +extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask); +extern void FX_grHints(tdfxContextPtr fxMesa, GrHint_t hintType, FxU32 hintMask); + + +extern void FX_grAADrawLine(tdfxContextPtr fxMesa, GrVertex * a, GrVertex * b); + +extern void FX_grAADrawPoint(tdfxContextPtr fxMesa, GrVertex * a); + + +extern void FX_setupGrVertexLayout(tdfxContextPtr fxMesa); + + +extern FX_GrContext_t FX_grSstWinOpen(tdfxContextPtr fxMesa, + FxU32 hWnd, + GrScreenResolution_t screen_resolution, + GrScreenRefresh_t refresh_rate, + GrColorFormat_t color_format, + GrOriginLocation_t origin_location, + int nColBuffers, int nAuxBuffers); + + +#define FX_grDrawLine_NoLock(v1, v2) grDrawLine(v1, v2) +#define FX_grDrawLine(fxMesa, v1, v2) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + FX_grDrawLine_NoLock(v1, v2); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grDrawPoint_NoLock(p) grDrawPoint(p) +#define FX_grDrawPoint(fxMesa, p) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + FX_grDrawPoint_NoLock(p); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +extern void FX_grDrawPolygonVertexList(tdfxContextPtr fxMesa, + int n, GrVertex * v); + +#define FX_grDitherMode(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDitherMode(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grRenderBuffer(fxMesa, b) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grRenderBuffer(b); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grRenderBuffer_NoLock(b) grRenderBuffer(b) + +#define FX_grBufferClear(fxMesa, c, a, d) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + grBufferClear(c, a, d); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grBufferClear_NoLock(c, a, d) grBufferClear(c, a, d) + + +#define FX_grBufferClearExt_NoLock(c, a, d, s) grBufferClearExtProc(c, a, d, s) + +#define FX_grBufferClearExt(fxMesa, c, a, d, s) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + grBufferClearExtProc(c, a, d, s); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grEnable(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grEnable(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grEnable_NoLock(m) grEnable(m) + +#define FX_grDisable(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDisable(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDisable_NoLock(m) grDisable(m) + + +#define FX_grStencilFunc(fxMesa, fnc, ref, mask) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grStencilFuncProc((fnc), (ref), (mask)); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grStencilFunc_NoLock(f, r, m) grStencilFuncProc(f, r, m) + +#define FX_grStencilMask(fxMesa, write_mask) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grStencilMaskProc(write_mask); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grStencilMask_NoLock(m) grStencilMaskProc(m) + +#define FX_grStencilOp(fxMesa, stencil_fail, depth_fail, depth_pass) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grStencilOpProc((stencil_fail), (depth_fail), (depth_pass)); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grStencilOp_NoLock(sf, df, dp) grStencilOpProc(sf, df, dp) + +#define FX_grDepthMask(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDepthMask(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDepthMask_NoLock(m) grDepthMask(m) + + +extern void FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a); + +extern void FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g, + GLboolean b, GLboolean a); + +extern void FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]); + +extern void FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]); + + +extern FxBool FX_grLfbLock(tdfxContextPtr fxMesa, + GrLock_t type, GrBuffer_t buffer, + GrLfbWriteMode_t writeMode, + GrOriginLocation_t origin, FxBool pixelPipeline, + GrLfbInfo_t * info); + +#define FX_grLfbUnlock(fxMesa, t, b) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grLfbUnlock(t, b); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grConstantColorValue(fxMesa, v) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grConstantColorValue(v); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grConstantColorValue_NoLock grConstantColorValue + +#define FX_grAADrawTriangle(fxMesa, a, b, c, ab, bc, ca) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + grAADrawTriangle(a, b, c, ab, bc, ca); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grAlphaBlendFunction(rs, rd, as, ad) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grAlphaBlendFunction(rs, rd, as, ad); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grAlphaCombine(func, fact, loc, oth, inv) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grAlphaCombine(func, fact, loc, oth, inv); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grAlphaCombine_NoLock grAlphaCombine + +#define FX_grAlphaTestFunction(fxMesa, f) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grAlphaTestFunction(f); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grAlphaTestReferenceValue(fxMesa, v) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grAlphaTestReferenceValue(v); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grClipWindow(fxMesa, minx, miny, maxx, maxy) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grClipWindow(minx, miny, maxx, maxy); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grClipWindow_NoLock grClipWindow + +#define FX_grColorCombine(fxMesa, func, fact, loc, oth, inv) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grColorCombine(func, fact, loc, oth, inv); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grColorCombine_NoLock grColorCombine + +#define FX_grCullMode(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grCullMode(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDepthBiasLevel(fxMesa, lev) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDepthBiasLevel(lev); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDepthBufferFunction(fxMesa, func) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDepthBufferFunction(func); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grFogColorValue(fxMesa, c) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFogColorValue(c); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grFogMode(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFogMode(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grFogTable(fxMesa, t)\ + do { \ + LOCK_HARDWARE(fxMesa); \ + grFogTable(t); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexClampMode(fxMesa, t, sc, tc) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexClampMode(t, sc, tc); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexClampMode_NoLock grTexClampMode + +#define FX_grTexCombine(fxMesa, t, rfunc, rfact, afunc, afact, rinv, ainv) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexCombine_NoLock grTexCombine + +#define FX_grTexDownloadMipMapLevel(fxMesa, t, sa, tlod, llod, ar, f, eo, d) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexDownloadMipMapLevelPartial(fxMesa, t, sa, tlod, llod, ar, f, eo, d, s, e); \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexFilterMode(fxMesa, t, minf, magf) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexFilterMode(t, minf, magf); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexFilterMode_NoLock grTexFilterMode + +extern FxU32 FX_grTexMinAddress(tdfxContextPtr fxMesa, GrChipID_t tmu); +extern FxU32 FX_grTexMaxAddress(tdfxContextPtr fxMesa, GrChipID_t tmu); + +#define FX_grTexMipMapMode(t, m, lod) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexMipMapMode(t, m, lod); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexMipMapMode_NoLock grTexMipMapMode + +#define FX_grTexSource(t, sa, eo, i) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexSource(t, sa, eo, i); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexSource_NoLock grTexSource + +extern FxU32 FX_grTexTextureMemRequired(tdfxContextPtr fxMesa, + FxU32 evenOdd, GrTexInfo * info); + +#define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired + +#define FX_grGlideGetState(fxMesa, s) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grGlideGetState(s); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) +#define FX_grGlideGetState_NoLock(s) grGlideGetState(s); + +#define FX_grDRIBufferSwap(fxMesa, i) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDRIBufferSwap(i); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grSstSelect(fxMesa, b) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grSstSelect(b); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grSstSelect_NoLock grSstSelect + +#define FX_grGlideSetState(fxMesa, s) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grGlideSetState(s); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) +#define FX_grGlideSetState_NoLock(s) grGlideSetState(s); + +#define FX_grDepthBufferMode(fxMesa, m) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grDepthBufferMode(m); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grLfbWriteColorFormat(fxMesa, f) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grLfbWriteColorFormat(f); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grDrawVertexArray(fxMesa, m, c, p) \ + do { \ + BEGIN_CLIP_LOOP(fxMesa); \ + grDrawVertexArray(m, c, p); \ + END_CLIP_LOOP(fxMesa); \ + } while (0) + +#define FX_grGlideShutdown(fxMesa) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grGlideShutdown(); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grTexLodBiasValue_NoLock(t, v) grTexLodBiasValue(t, v) + +#define FX_grTexLodBiasValue(t, v) \ + do { \ + LOCK_HARDWARE(fxMesa); \ + grTexLodBiasValue(t, v); \ + UNLOCK_HARDWARE(fxMesa); \ + } while (0) + +#define FX_grGlideInit_NoLock grGlideInit +#define FX_grSstWinOpen_NoLock grSstWinOpen + +extern int FX_getFogTableSize(tdfxContextPtr fxMesa); + +extern int FX_getGrStateSize(tdfxContextPtr fxMesa); + +#endif /* __FX_GLIDE_WARPER__ */ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c index 12775ef64..5b97c54bc 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c @@ -1,139 +1,137 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -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 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. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c,v 1.11 2000/12/21 13:58:56 alanh Exp $ */ +/* -*- mode: c; c-basic-offset: 3 -*- + * + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * + * 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 + * VA LINUX SYSTEMS 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/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c,v 1.12 2001/03/21 16:14:28 dawes Exp $ */ /* + * Original rewrite: + * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000 + * * Authors: - * Daryll Strauss <daryll@valinux.com> - * Brian E. Paul <brianp@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * Brian Paul <brianp@valinux.com> + * */ #ifdef GLX_DIRECT_RENDERING #include <X11/Xlibint.h> -#include <glide.h> -#include "fxdrv.h" + #include "context.h" #include "matrix.h" #include "mmath.h" #include "vbxform.h" -#include "fxtexman.h" +#include "dri_glide.h" -/* including xf86PciInfo.h causes a bunch of errors */ -#ifndef PCI_CHIP_VOODOO5 -#define PCI_CHIP_VOODOO5 0x0009 -#endif +#include "tdfx_context.h" +#include "tdfx_render.h" +#include "tdfx_state.h" +#include "tdfx_texman.h" GLboolean -XMesaInitDriver(__DRIscreenPrivate * sPriv) +XMesaInitDriver( __DRIscreenPrivate *sPriv ) { - tdfxScreenPrivate *gsp; - - /* Check the DRI version */ - { - int major, minor, patch; - if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { - if (major != 3 || minor != 1 || patch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DRI version 3.1.x but got version %d.%d.%d", - major, minor, patch); - __driMesaMessage(msg); - return GL_FALSE; - } - } - } - - /* Check that the DDX driver version is compatible */ - if (sPriv->ddxMajor != 1 || sPriv->ddxMinor != 0 || sPriv->ddxPatch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", - sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); - __driMesaMessage(msg); - return GL_FALSE; - } - - /* Check that the DRM driver version is compatible */ - if (sPriv->drmMajor != 1 || sPriv->drmMinor != 0 || sPriv->drmPatch < 0) { - char msg[1000]; - sprintf(msg, - "3dfx DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", - sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); - __driMesaMessage(msg); - return GL_FALSE; - } - - /* Allocate the private area */ - gsp = (tdfxScreenPrivate *) Xmalloc(sizeof(tdfxScreenPrivate)); - if (!gsp) - return GL_FALSE; - - gsp->driScrnPriv = sPriv; - - sPriv->private = (void *) gsp; - - if (!tdfxMapAllRegions(sPriv)) { - Xfree(gsp); - sPriv->private = NULL; - return GL_FALSE; - } - - return GL_TRUE; + int major, minor, patch; + char msg[1024]; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, sPriv ); + } + + /* Check the DRI version */ + if ( XF86DRIQueryVersion( sPriv->display, &major, &minor, &patch ) ) { + if ( major != 4 || + minor < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DRI version 4.0.x " + "but got version %d.%d.%d", + major, minor, patch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + } + + /* Check that the DDX driver version is compatible */ + if ( sPriv->ddxMajor != 1 || + sPriv->ddxMinor < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DDX driver version 1.0.x " + "but got version %d.%d.%d", + sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if ( sPriv->drmMajor != 1 || + sPriv->drmMinor < 0 ) { + sprintf( msg, + "3dfx DRI driver expected DRM driver version 1.0.x " + "but got version %d.%d.%d", + sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); + __driMesaMessage( msg ); + return GL_FALSE; + } + + if ( !tdfxCreateScreen( sPriv ) ) { + tdfxDestroyScreen( sPriv ); + return GL_FALSE; + } + + return GL_TRUE; } void -XMesaResetDriver(__DRIscreenPrivate * sPriv) +XMesaResetDriver( __DRIscreenPrivate *sPriv ) { - tdfxUnmapAllRegions(sPriv); - Xfree(sPriv->private); - sPriv->private = NULL; + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, sPriv ); + } + + tdfxDestroyScreen( sPriv ); } GLvisual * -XMesaCreateVisual(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - const XVisualInfo * visinfo, - const __GLXvisualConfig * config) +XMesaCreateVisual( Display * dpy, + __DRIscreenPrivate *driScrnPriv, + const XVisualInfo *visinfo, + const __GLXvisualConfig *config ) { - /* Drivers may change the args to _mesa_create_visual() in order to - * setup special visuals. - */ - return _mesa_create_visual(config->rgba, + /* Drivers may change the args to _mesa_create_visual() in order to + * setup special visuals. + */ + return _mesa_create_visual( config->rgba, config->doubleBuffer, config->stereo, - _mesa_bitcount(visinfo->red_mask), - _mesa_bitcount(visinfo->green_mask), - _mesa_bitcount(visinfo->blue_mask), + _mesa_bitcount( visinfo->red_mask ), + _mesa_bitcount( visinfo->green_mask ), + _mesa_bitcount( visinfo->blue_mask ), config->alphaSize, 0, /* index bits */ config->depthSize, @@ -142,410 +140,287 @@ XMesaCreateVisual(Display * dpy, config->accumGreenSize, config->accumBlueSize, config->accumAlphaSize, - 0 /* num samples */ - ); + 0 /* num samples */ ); } GLboolean -XMesaCreateContext(Display * dpy, GLvisual * mesaVis, - __DRIcontextPrivate * driContextPriv) +XMesaCreateContext( Display *dpy, GLvisual *mesaVis, + __DRIcontextPrivate *driContextPriv ) { - fxMesaContext fxMesa; - __DRIscreenPrivate *driScrnPriv = driContextPriv->driScreenPriv; - tdfxScreenPrivate *sPriv = (tdfxScreenPrivate *) driScrnPriv->private; - TDFXSAREAPriv *saPriv; - - fxMesa = (fxMesaContext) Xmalloc(sizeof(struct tfxMesaContext)); - if (!fxMesa) { - return GL_FALSE; - } - - fxMesa->hHWContext = driContextPriv->hHWContext; - fxMesa->tdfxScrnPriv = sPriv; - /* deviceID = 0x05 = Voodoo3 */ - /* deviceID = 0x09 = Voodoo5 (and Voodoo4?) */ - fxMesa->isNapalm = sPriv->deviceID == PCI_CHIP_VOODOO5; - fxMesa->haveHwStencil = fxMesa->isNapalm && sPriv->cpp == 4; - - - fxMesa->glVis = mesaVis; - fxMesa->screen_width = sPriv->width; - fxMesa->screen_height = sPriv->height; - fxMesa->new_state = ~0; - fxMesa->driContextPriv = driContextPriv; - fxMesa->glCtx = driContextPriv->mesaContext; - fxMesa->initDone = GL_FALSE; - - saPriv = - (TDFXSAREAPriv *) ((char *) driScrnPriv->pSAREA + - sizeof(XF86DRISAREARec)); - grDRIOpen(driScrnPriv->pFB, sPriv->regs.map, sPriv->deviceID, - sPriv->width, sPriv->height, sPriv->mem, sPriv->cpp, - sPriv->stride, sPriv->fifoOffset, sPriv->fifoSize, - sPriv->fbOffset, sPriv->backOffset, sPriv->depthOffset, - sPriv->textureOffset, sPriv->textureSize, &saPriv->fifoPtr, - &saPriv->fifoRead); - - driContextPriv->driverPrivate = (void *) fxMesa; - - return GL_TRUE; + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + return tdfxCreateContext( dpy, mesaVis, driContextPriv ); } void -XMesaDestroyContext(__DRIcontextPrivate * driContextPriv) +XMesaDestroyContext( __DRIcontextPrivate *driContextPriv ) { - fxMesaContext fxMesa = (fxMesaContext) driContextPriv->driverPrivate; - if (fxMesa) { - if (fxMesa->glCtx->Shared->RefCount == 1) { - /* This share group is about to go away, free our private - * texture object data. - */ - struct gl_texture_object *tObj; - tObj = fxMesa->glCtx->Shared->TexObjectList; - while (tObj) { - fxTMFreeTexture(fxMesa, tObj); - tObj = tObj->Next; - } - } - XFree(fxMesa); - driContextPriv->driverPrivate = NULL; - } + tdfxContextPtr fxMesa; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate; + tdfxDestroyContext( fxMesa ); + driContextPriv->driverPrivate = NULL; } GLframebuffer * -XMesaCreateWindowBuffer(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - __DRIdrawablePrivate * driDrawPriv, - GLvisual * mesaVis) +XMesaCreateWindowBuffer( Display *dpy, + __DRIscreenPrivate *driScrnPriv, + __DRIdrawablePrivate *driDrawPriv, + GLvisual *mesaVis ) { - return gl_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->StencilBits > 0, - mesaVis->AccumRedBits > 0, - GL_FALSE /* software alpha channel? */ - ); + return gl_create_framebuffer( mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->StencilBits > 0, + mesaVis->AccumRedBits > 0, + GL_FALSE /* software alpha channel? */ ); } GLframebuffer * -XMesaCreatePixmapBuffer(Display * dpy, - __DRIscreenPrivate * driScrnPriv, - __DRIdrawablePrivate * driDrawPriv, - GLvisual * mesaVis) +XMesaCreatePixmapBuffer( Display *dpy, + __DRIscreenPrivate *driScrnPriv, + __DRIdrawablePrivate *driDrawPriv, + GLvisual *mesaVis ) { #if 0 - /* Different drivers may have different combinations of hardware and - * software ancillary buffers. - */ - return gl_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - mesaVis->StencilBits > 0, - mesaVis->AccumRedBits > 0, - mesaVis->AlphaBits > 0); + /* Different drivers may have different combinations of hardware and + * software ancillary buffers. + */ + return gl_create_framebuffer( mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->StencilBits > 0, + mesaVis->AccumRedBits > 0, + mesaVis->AlphaBits > 0 ); #else - return NULL; /* not implemented yet */ + return NULL; /* not implemented yet */ #endif } - void -XMesaSwapBuffers(__DRIdrawablePrivate * driDrawPriv) +XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv ) { - GET_CURRENT_CONTEXT(ctx); - fxMesaContext fxMesa = 0; - - if (!driDrawPriv->mesaBuffer->Visual->DBflag) - return; /* can't swap a single-buffered window */ - - /* If the current context's drawable matches the given drawable - * we have to do a glFinish (per the GLX spec). - */ - if (ctx) { - __DRIdrawablePrivate *curDrawPriv; - fxMesa = FX_CONTEXT(ctx); - curDrawPriv = fxMesa->driContextPriv->driDrawablePriv; - if (curDrawPriv == driDrawPriv) { - /* swapping window bound to current context, flush first */ - FLUSH_VB(ctx, "swap buffers"); - BEGIN_BOARD_LOCK(fxMesa); - } - else { - /* make fxMesa context current */ - grGlideGetState((GrState *) fxMesa->state); - fxMesa = (fxMesaContext) driDrawPriv->driContextPriv->driverPrivate; - BEGIN_BOARD_LOCK(fxMesa); - grSstSelect(fxMesa->board); - grGlideSetState((GrState *) fxMesa->state); - } - } - + GET_CURRENT_CONTEXT(ctx); + tdfxContextPtr fxMesa = 0; + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driDrawPriv ); + } + + if ( !driDrawPriv->mesaBuffer->Visual->DBflag ) + return; /* can't swap a single-buffered window */ + + /* If the current context's drawable matches the given drawable + * we have to do a glFinish (per the GLX spec). + */ + if ( ctx ) { + __DRIdrawablePrivate *curDrawPriv; + fxMesa = TDFX_CONTEXT(ctx); + curDrawPriv = fxMesa->driContext->driDrawablePriv; + + if ( curDrawPriv == driDrawPriv ) { + /* swapping window bound to current context, flush first */ + FLUSH_VB( ctx, "swap buffers" ); + LOCK_HARDWARE( fxMesa ); + } + else { + /* find the fxMesa context previously bound to the window */ + fxMesa = (tdfxContextPtr) driDrawPriv->driContextPriv->driverPrivate; + if (!fxMesa) + return; + LOCK_HARDWARE( fxMesa ); + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( (GrState *) fxMesa->Glide.State ); + } + } #ifdef STATS - { - int stalls; - static int prevStalls = 0; - stalls = grFifoGetStalls(); - if (stalls != prevStalls) { - fprintf(stderr, "%d stalls occurred\n", stalls - prevStalls); - prevStalls = stalls; - } - if (fxMesa && fxMesa->texSwaps) { - fprintf(stderr, "%d texture swaps occurred\n", fxMesa->texSwaps); - fxMesa->texSwaps = 0; - } - } + { + int stalls; + static int prevStalls = 0; + + stalls = grFifoGetStalls(); + + fprintf( stderr, "%s:\n", __FUNCTION__ ); + if ( stalls != prevStalls ) { + fprintf( stderr, " %d stalls occurred\n", + stalls - prevStalls ); + prevStalls = stalls; + } + if ( fxMesa && fxMesa->texSwaps ) { + fprintf( stderr, " %d texture swaps occurred\n", + fxMesa->texSwaps ); + fxMesa->texSwaps = 0; + } + } #endif + if (fxMesa->scissoredClipRects) { + /* restore clip rects without scissor box */ + grDRIPosition( driDrawPriv->x, driDrawPriv->y, + driDrawPriv->w, driDrawPriv->h, + driDrawPriv->numClipRects, driDrawPriv->pClipRects ); + } - /* XXX prototype grDRISwapClipRects() function may not be - * needed after all - */ -#if 0 - FX_grDRIBufferSwap(fxMesa, fxMesa->swapInterval); -#elif 1 - grDRIBufferSwap(fxMesa->swapInterval); -#else - grDRISwapClipRects(fxMesa->swapInterval, - driDrawPriv->numClipRects, - driDrawPriv->pClipRects); -#endif + grDRIBufferSwap( fxMesa->Glide.SwapInterval ); + + if (fxMesa->scissoredClipRects) { + /* restore clip rects WITH scissor box */ + grDRIPosition( driDrawPriv->x, driDrawPriv->y, + driDrawPriv->w, driDrawPriv->h, + fxMesa->numClipRects, fxMesa->pClipRects ); + } #if 0 - { - FxI32 result; - do { - result = FX_grGetInteger(FX_PENDING_BUFFERSWAPS); - } while (result > fxMesa->maxPendingSwapBuffers); - } + { + FxI32 result; + do { + result = FX_grGetInteger( FX_PENDING_BUFFERSWAPS ); + } while ( result > fxMesa->maxPendingSwapBuffers ); + } #endif - fxMesa->stats.swapBuffer++; - - - if (ctx) { - if (ctx->DriverCtx != fxMesa) { - /* restore original context */ - fxMesa = FX_CONTEXT(ctx); - grSstSelect(fxMesa->board); - grGlideSetState((GrState *) fxMesa->state); - } - END_BOARD_LOCK(fxMesa); - } + + fxMesa->stats.swapBuffer++; + + if (ctx) { + if (ctx->DriverCtx != fxMesa) { + fxMesa = TDFX_CONTEXT(ctx); + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( (GrState *) fxMesa->Glide.State ); + } + UNLOCK_HARDWARE( fxMesa ); + } } GLboolean -XMesaUnbindContext(__DRIcontextPrivate * driContextPriv) +XMesaUnbindContext( __DRIcontextPrivate *driContextPriv ) { - GET_CURRENT_CONTEXT(ctx); - if (driContextPriv && driContextPriv->mesaContext == ctx) { - fxMesaContext fxMesa = FX_CONTEXT(ctx); - FX_grGlideGetState(fxMesa, (GrState *) fxMesa->state); - } - return GL_TRUE; + GET_CURRENT_CONTEXT(ctx); + + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + if ( driContextPriv && driContextPriv->mesaContext == ctx ) { + tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); + FX_grGlideGetState( fxMesa, (GrState *) fxMesa->Glide.State ); + } + return GL_TRUE; } + GLboolean -XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +XMesaMakeCurrent( __DRIcontextPrivate *driContextPriv, + __DRIdrawablePrivate *driDrawPriv, + __DRIdrawablePrivate *driReadPriv ) { - fprintf(stderr,"XMesaOpenFullScreen\n"); -#if 0 /* When new glide3 calls exist */ - return((GLboolean)grDRISetupFullScreen(GL_TRUE)); -#else - return GL_TRUE; -#endif + if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) { + fprintf( stderr, "%s( %p )\n", __FUNCTION__, driContextPriv ); + } + + if ( driContextPriv ) { + tdfxContextPtr fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate; + GLcontext *ctx = fxMesa->glCtx; + + if ( fxMesa->driDrawable != driDrawPriv ) { + fxMesa->driDrawable = driDrawPriv; + fxMesa->dirty = ~0; + } + + if ( !fxMesa->Glide.Initialized ) { + if ( !tdfxInitContext( driDrawPriv, fxMesa ) ) + return GL_FALSE; + + LOCK_HARDWARE( fxMesa ); + + /* FIXME: Force loading of window information */ + fxMesa->width = 0; + tdfxUpdateClipping(ctx); + tdfxUploadClipping(fxMesa); + + UNLOCK_HARDWARE( fxMesa ); + } else { + LOCK_HARDWARE( fxMesa ); + + grSstSelect( fxMesa->Glide.Board ); + grGlideSetState( fxMesa->Glide.State ); + + tdfxUpdateClipping(ctx); + tdfxUploadClipping(fxMesa); + + UNLOCK_HARDWARE( fxMesa ); + } + + assert( ctx == driContextPriv->mesaContext ); + + gl_make_current2( ctx, driDrawPriv->mesaBuffer, + driReadPriv->mesaBuffer ); + + if ( !ctx->Viewport.Width ) { + gl_Viewport( ctx, 0, 0, driDrawPriv->w, driDrawPriv->h ); + } + } else { + gl_make_current( 0, 0 ); + } + + return GL_TRUE; } + GLboolean -XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) { - fprintf(stderr,"***** XMesaCloseFullScreen *****\n"); + if ( 0 ) + fprintf( stderr, "***** XMesaOpenFullScreen *****\n" ); #if 0 /* When new glide3 calls exist */ - return((GLboolean)grDRISetupFullScreen(GL_FALSE)); + return (GLboolean)grDRISetupFullScreen( GL_TRUE ); #else - return GL_TRUE; + return GL_TRUE; #endif } -/* - * This function sends the window position and cliprect list to - * Glide for the given context. - */ -static void -XMesaWindowMoved(fxMesaContext fxMesa) -{ - __DRIdrawablePrivate *dPriv = fxMesa->driContextPriv->driDrawablePriv; - GLcontext *ctx = fxMesa->glCtx; - - grDRIPosition(dPriv->x, dPriv->y, dPriv->w, dPriv->h, - dPriv->numClipRects, dPriv->pClipRects); - fxMesa->numClipRects = dPriv->numClipRects; - fxMesa->pClipRects = dPriv->pClipRects; - if (dPriv->x != fxMesa->x_offset || dPriv->y != fxMesa->y_offset || - dPriv->w != fxMesa->width || dPriv->h != fxMesa->height) { - fxMesa->x_offset = dPriv->x; - fxMesa->y_offset = dPriv->y; - fxMesa->width = dPriv->w; - fxMesa->height = dPriv->h; - fxMesa->y_delta = - fxMesa->screen_height - fxMesa->y_offset - fxMesa->height; - } - switch (dPriv->numClipRects) { - case 0: - fxMesa->clipMinX = dPriv->x; - fxMesa->clipMaxX = dPriv->x + dPriv->w; - fxMesa->clipMinY = dPriv->y; - fxMesa->clipMaxY = dPriv->y + dPriv->h; - fxSetScissorValues(ctx); - fxMesa->needClip = 0; - break; - case 1: - fxMesa->clipMinX = dPriv->pClipRects[0].x1; - fxMesa->clipMaxX = dPriv->pClipRects[0].x2; - fxMesa->clipMinY = dPriv->pClipRects[0].y1; - fxMesa->clipMaxY = dPriv->pClipRects[0].y2; - fxSetScissorValues(ctx); - fxMesa->needClip = 0; - break; - default: - fxMesa->needClip = 1; - } -} - GLboolean -XMesaMakeCurrent(__DRIcontextPrivate * driContextPriv, - __DRIdrawablePrivate * driDrawPriv, - __DRIdrawablePrivate * driReadPriv) -{ - if (driContextPriv) { - fxMesaContext fxMesa; - - fxMesa = (fxMesaContext) driContextPriv->driverPrivate; - - if (!fxMesa->initDone) { - if (!tdfxInitHW(driDrawPriv, fxMesa)) - return GL_FALSE; - fxMesa->width = 0; - XMesaWindowMoved(fxMesa); - FX_grGlideGetState(fxMesa, (GrState *) fxMesa->state); - } - else { - FX_grSstSelect(fxMesa, fxMesa->board); - FX_grGlideSetState(fxMesa, (GrState *) fxMesa->state); - XMesaWindowMoved(fxMesa); - } - - assert(fxMesa->glCtx == driContextPriv->mesaContext); - - gl_make_current2(fxMesa->glCtx, driDrawPriv->mesaBuffer, - driReadPriv->mesaBuffer); - - if (!fxMesa->glCtx->Viewport.Width) - gl_Viewport(fxMesa->glCtx, 0, 0, driDrawPriv->w, driDrawPriv->h); - } - else { - gl_make_current(0, 0); - } - return GL_TRUE; -} - - -/* This is called from within the LOCK_HARDWARE routine */ -void -XMesaUpdateState(fxMesaContext fxMesa) +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) { - __DRIcontextPrivate *cPriv = fxMesa->driContextPriv; - __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv; - __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; - TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + - sizeof(XF86DRISAREARec)); - int stamp; - char ret; - - DEBUG_CHECK_LOCK(); - DRM_CAS(&sPriv->pSAREA->lock, dPriv->driContextPriv->hHWContext, - DRM_LOCK_HELD | dPriv->driContextPriv->hHWContext, ret); - if (!ret) { - DEBUG_LOCK(); - return; - } - drmGetLock(sPriv->fd, dPriv->driContextPriv->hHWContext, 0); - stamp = dPriv->lastStamp; - /* This macro will update dPriv's cliprects if needed */ - XMESA_VALIDATE_DRAWABLE_INFO(cPriv->display, sPriv, dPriv); - /* fprintf(stderr, "In FifoPtr=%d FifoRead=%d\n", saPriv->fifoPtr, saPriv->fifoRead); */ - if (saPriv->fifoOwner != dPriv->driContextPriv->hHWContext) { - grDRIImportFifo(saPriv->fifoPtr, saPriv->fifoRead); - } - if (saPriv->ctxOwner != dPriv->driContextPriv->hHWContext) { - /* This sequence looks a little odd. Glide mirrors the state, and - when you get the state you are forcing the mirror to be up to - date, and then getting a copy from the mirror. You can then force - that state onto the hardware when you set the state. */ - void *state; - state = malloc(FX_grGetInteger_NoLock(FX_GLIDE_STATE_SIZE)); - FX_grGlideGetState_NoLock(state); - FX_grGlideSetState_NoLock(state); - free(state); - } - if (saPriv->texOwner != dPriv->driContextPriv->hHWContext) { - fxTMRestoreTextures_NoLock(fxMesa); - } -#if 0 - if (*dPriv->pStamp != stamp) + if ( 0 ) + fprintf( stderr, "***** XMesaCloseFullScreen *****\n" ); +#if 0 /* When new glide3 calls exist */ + return (GLboolean)grDRISetupFullScreen( GL_FALSE ); #else - if (*dPriv->pStamp != stamp || - saPriv->ctxOwner != dPriv->driContextPriv->hHWContext) + return GL_TRUE; #endif - XMesaWindowMoved(fxMesa); - DEBUG_LOCK(); } -/* - * XXX is this used by anyone? +/* Silence compiler warnings. */ -#if 000 -static void -XMesaSetSAREA(void) -{ - __DRIdrawablePrivate *dPriv = gCC->driDrawablePriv; - __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; - TDFXSAREAPriv *saPriv = - (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) + - sizeof(XF86DRISAREARec)); - - saPriv->fifoOwner = dPriv->driContextPriv->hHWContext; - saPriv->ctxOwner = dPriv->driContextPriv->hHWContext; - saPriv->texOwner = dPriv->driContextPriv->hHWContext; - grDRIResetSAREA(); - /* fprintf(stderr, "Out FifoPtr=%d FifoRead=%d\n", saPriv->fifoPtr, saPriv->fifoRead); */ -} -#endif - - - -extern void __driRegisterExtensions(void); /* silence compiler warning */ +extern void __driRegisterExtensions( void ); /* This function is called by libGL.so as soon as libGL.so is loaded. * This is where we'd register new extension functions with the dispatcher. */ -void -__driRegisterExtensions(void) +void __driRegisterExtensions( void ) { #if 0 - /* Example. Also look in fxdd.c for more details. */ - { - const int _gloffset_FooBarEXT = 555; /* just an example number! */ - if (_glapi_add_entrypoint("glFooBarEXT", _gloffset_FooBarEXT)) { - void *f = glXGetProcAddressARB("glFooBarEXT"); - assert(f); - } - } + /* Example. Also look in tdfx_dd.c for more details. */ + { + const int _gloffset_FooBarEXT = 555; /* just an example number! */ + if ( _glapi_add_entrypoint( "glFooBarEXT", _gloffset_FooBarEXT ) ) { + void *f = glXGetProcAddressARB( "glFooBarEXT" ); + assert( f ); + } + } #endif } diff --git a/xc/lib/Imakefile b/xc/lib/Imakefile index aa4bbfad8..a6e7a2a93 100644 --- a/xc/lib/Imakefile +++ b/xc/lib/Imakefile @@ -3,12 +3,12 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:44:00 cpqbld Exp $ -XCOMM $XFree86: xc/lib/Imakefile,v 3.47 2001/02/18 09:02:32 herrb Exp $ +XCOMM $XFree86: xc/lib/Imakefile,v 3.52 2001/04/03 17:36:28 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags -#if BuildXaw6 +#if BuildXaw6 && BuildLibraries XAW6LIBDIR = Xaw6 #endif @@ -28,10 +28,22 @@ XKBLIBDIR = xkbfile XKBUILIBDIR = xkbui #endif -#if BuildThreadStubLibrary +#if BuildThreadStubLibrary && BuildLibraries THRSTUBLIBDIR = XThrStub #endif +#if BuildXIElib +XIELIBDIR = XIE +#endif + +#if BuildPexLib +PEX5LIBDIR = PEX5 +#endif + +#if BuildXInputLib +XINPUTLIBDIR = Xi +#endif + #if BuildScreenSaverLibrary SSLIBDIR = Xss #endif @@ -54,6 +66,7 @@ XF86RUSHLIBDIR = Xxf86rush #if BuildXvLibrary XVLIBDIR = Xv +XVMCLIBDIR = XvMC #endif #if BuildXineramaLibrary @@ -90,7 +103,7 @@ XFTLIBDIR = Xft #endif #if BuildFreetype2Library -FREETYPE2LIBDIR = freetype2 +FREETYPE2BUILDDIR = freetype2 #endif XF86EXTLIBS = $(XF86MISCLIBDIR) $(XF86VMLIBDIR) \ @@ -112,31 +125,50 @@ REGEXDIR = regex XALIBDIR = Xa #endif +#if BuildXprintLib +XPRINTLIBDIR = Xp +#endif + #if BuildFontCacheLib FONTCACHELIBDIR = Xfontcache #endif FONTSUBDIR = font -#if !BuildServersOnly -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) $(GLXLIBDIR) $(GLULIBDIR) $(GLWLIBDIR) \ - $(DPSLIBDIR) $(DPSTKLIBDIR) $(PSRESLIBDIR) $(XINERAMADIR) \ - $(ZLIBDIR) $(REGEXDIR) $(RENDERLIBDIR) $(FREETYPE2LIBDIR) \ - $(XFTLIBDIR) -#else -#if XnestServer || BuildGLXLibrary -XEXTDIR = Xext -#endif +XAULIBDIR = Xau +XDMCPLIBDIR = Xdmcp +X11LIBDIR = X11 -LINTSUBDIRS = Xau Xdmcp X11 $(LBXUTILDIR) $(ZLIBDIR) $(REGEXDIR) \ - $(XKBLIBDIR) +#if BuildLibraries || XnestServer || BuildGLXLibrary +XEXTLIBDIR = Xext +#endif +#if BuildLibraries +OLDXLIBDIR = oldX +ICELIBDIR = ICE +SMLIBDIR = SM +XTLIBDIR = Xt +XMULIBDIR = Xmu +XMUULIBDIR = Xmuu +XPMLIBDIR = Xpm +XAWLIBDIR = Xaw +XTSTLIBDIR = Xtst +FSLIBDIR = FS #endif + +LINTSUBDIRS = $(XAULIBDIR) $(XDMCPLIBDIR) $(THRSTUBLIBDIR) $(X11LIBDIR) \ + $(OLDXLIBDIR) $(ICELIBDIR) $(SMLIBDIR) $(XEXTLIBDIR) $(XTLIBDIR) \ + $(SSLIBDIR) $(XF86MISCLIBDIR) $(XF86VMLIBDIR) $(XF86DGALIBDIR) \ + $(XF86RUSHLIBDIR) $(XMULIBDIR) $(XMUULIBDIR) $(XPMLIBDIR) \ + $(XAWLIBDIR) $(XAW6LIBDIR) $(XIELIBDIR) $(XINPUTLIBDIR) \ + $(XTSTLIBDIR) $(FSLIBDIR) $(PEX5LIBDIR) $(XKBLIBDIR) \ + $(XKBUILIBDIR) $(LBXUTILDIR) $(XALIBDIR) $(XPRINTLIBDIR) \ + $(XVLIBDIR) $(GLXLIBDIR) $(GLULIBDIR) $(GLWLIBDIR) \ + $(DPSLIBDIR) $(DPSTKLIBDIR) $(PSRESLIBDIR) $(XINERAMADIR) \ + $(ZLIBDIR) $(REGEXDIR) $(RENDERLIBDIR) $(FREETYPE2BUILDDIR) \ + $(XFTLIBDIR) $(XVMCLIBDIR) + SUBDIRS = $(BERKDIR) xtrans $(LINTSUBDIRS) $(FONTSUBDIR) $(FONTCACHELIBDIR) MakeSubdirs($(SUBDIRS)) diff --git a/xc/lib/X11/Imakefile b/xc/lib/X11/Imakefile index 00b6b3e37..7af7007c3 100644 --- a/xc/lib/X11/Imakefile +++ b/xc/lib/X11/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:44:38 cpqbld Exp $ -XCOMM $XFree86: xc/lib/X11/Imakefile,v 3.35 2001/01/17 19:41:38 dawes Exp $ +XCOMM $XFree86: xc/lib/X11/Imakefile,v 3.36 2001/03/21 17:36:44 dawes Exp $ #define DoNormalLib NormalLibX11 #define DoSharedLib SharedLibX11 @@ -901,7 +901,7 @@ MISCOBJS = os2Stubs.o OBJS = $(OBJS1) $(OBJS2) $(OBJS3) -#if !BuildServersOnly || XnestServer || BuildGLXLibrary +#if !BuildServersOnly || XnestServer || BuildGLXLibrary || BuildClients #include <Library.tmpl> SpecialCLibObjectRule(ErrDes,$(ICONFIGFILES),$(EDB_DEFINES)) diff --git a/xc/lib/X11/X11-def.cpp b/xc/lib/X11/X11-def.cpp index 71a2a3e1b..25f83a38b 100644 --- a/xc/lib/X11/X11-def.cpp +++ b/xc/lib/X11/X11-def.cpp @@ -12,25 +12,6 @@ EXPORTS _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 @@ -623,22 +604,13 @@ 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 @@ -652,10 +624,8 @@ EXPORTS _XUnregisterFilter _XUnregisterInternalConnection _XVIDtoVisual -#ifndef __CYGWIN__ _Xthread_init _Xthread_waiter -#endif XkbIgnoreExtension XkbOpenDisplay XkbQueryExtension @@ -841,6 +811,1181 @@ EXPORTS XkbUpdateMapFromCore XkbXlibControlsImplemented Xutf8TextPropertyToTextList + Xutf8TextListToTextProperty +#else + XSaveContext + XFindContext + XDeleteContext + XListDepths + XrmParseCommand + Xpermalloc + _XrmInternalStringToQuark + XrmStringToQuark + XrmPermStringToQuark + XrmUniqueQuark + XrmQuarkToString + XAllocColorCells + XAllocColorPlanes + XAllowEvents + XAutoRepeatOn + XAutoRepeatOff + XSetWindowBackground + XSetWindowBorderWidth + XBell + XSetWindowBorder + XEnableAccessControl + XDisableAccessControl + XSetAccessControl + XSetCloseDownMode + XChangeActivePointerGrab + XSetWindowColormap + XChangeGC + XChangeKeyboardControl + XChangePointerControl + XChangeProperty + XChangeSaveSet + XAddToSaveSet + XRemoveFromSaveSet + XChangeWindowAttributes + XResizeWindow + XCheckIfEvent + XCheckMaskEvent + XCheckWindowEvent + XCheckTypedEvent + XCheckTypedWindowEvent + XCirculateSubwindows + XCirculateSubwindowsDown + XCirculateSubwindowsUp + XCloseDisplay + XClearWindow + XClearArea + XMoveResizeWindow + _XConnectDisplay + _XDisconnectDisplay + _XSendClientPrefix + XSetAuthorization + XConvertSelection + XCopyArea + XCopyColormapAndFree + XCopyGC + XCopyPlane + XCreateBitmapFromData + XCreateColormap + XCreatePixmapCursor + XCreateGC + _XUpdateGCCache + _XFlushGCCache + XFlushGC + XGContextFromGC + XCreateGlyphCursor + XCreatePixmapFromBitmapData + XCreatePixmap + XCreateSimpleWindow + XCreateFontCursor + XDefineCursor + XDeleteProperty + XDestroySubwindows + XDestroyWindow + XDisplayName + XDrawArc + XDrawArcs + XDrawLine + XDrawLines + XDrawPoint + XDrawPoints + XDrawRectangle + XDrawRectangles + XDrawSegments + XGetErrorText + XGetErrorDatabaseText + XSetErrorHandler + XSetIOErrorHandler + _XEventToWire + XFetchName + XGetIconName + XFillArc + XFillArcs + XFillPolygon + XFillRectangle + XFillRectangles + XFlush + XLoadQueryFont + XFreeFont + XQueryFont + XListFonts + XFreeFontNames + XListFontsWithInfo + XFreeFontInfo + XFreeColormap + XFreeColors + XFreeCursor + _XFreeExtData + XFreeGC + XFreePixmap + XActivateScreenSaver + XResetScreenSaver + XForceScreenSaver + XSetArcMode + XSetFillRule + XSetFillStyle + XSetGraphicsExposures + XSetSubwindowMode + XGeometry + XGetAtomName + XAllocNamedColor + XGetDefault + XGetFontPath + XFreeFontPath + XGetFontProperty + XGetGeometry + XAllocColor + XGetSizeHints + XGetWMHints + XGetZoomHints + XGetNormalHints + XGetIconSizes + XGetCommand + XGetTransientForHint + XGetClassHint + XGetInputFocus + XGetImage + XGetSubImage + XGetKeyboardControl + XGetMotionEvents + XGetPointerControl + XGetPointerMapping + XGetKeyboardMapping + XGetWindowProperty + XGetSelectionOwner + XGetScreenSaver + XGetStandardColormap + XGetWindowAttributes + XGrabButton + XGrabKey + XGrabKeyboard + XGrabPointer + XGrabServer + XAddHost + XRemoveHost + XAddHosts + XRemoveHosts + XIfEvent + _XGetScanlinePad + _XGetBitsPerPixel + XCreateImage + _XSetImage + _XInitImageFuncPtrs + XDrawImageString + XDrawImageString16 + XInitExtension + XAddExtension + XEHeadOfExtensionList + XAddToExtensionList + XFindOnExtensionList + XESetCreateGC + XESetCopyGC + XESetFlushGC + XESetFreeGC + XESetCreateFont + XESetFreeFont + XESetCloseDisplay + XESetWireToEvent + XESetEventToWire + XESetWireToError + XESetError + XESetErrorString + XESetPrintErrorValues + XInstallColormap + XInternAtom + XKeycodeToKeysym + XKeysymToKeycode + XLookupKeysym + XRefreshKeyboardMapping + XLookupString + XRebindKeysym + XKeysymToString + XKillClient + XListHosts + XListInstalledColormaps + XListProperties + XListExtensions + XFreeExtensionList + XLoadFont + XLookupColor + XLowerWindow + XConnectionNumber + XRootWindow + XDefaultScreen + XDefaultRootWindow + XDefaultVisual + XDefaultGC + XBlackPixel + XWhitePixel + XAllPlanes + XQLength + XDisplayWidth + XDisplayHeight + XDisplayWidthMM + XDisplayHeightMM + XDisplayPlanes + XDisplayCells + XScreenCount + XServerVendor + XProtocolVersion + XProtocolRevision + XVendorRelease + XDisplayString + XDefaultDepth + XDefaultColormap + XBitmapUnit + XBitmapBitOrder + XBitmapPad + XImageByteOrder + XNextRequest + XLastKnownRequestProcessed + XScreenOfDisplay + XDefaultScreenOfDisplay + XDisplayOfScreen + XRootWindowOfScreen + XBlackPixelOfScreen + XWhitePixelOfScreen + XDefaultColormapOfScreen + XDefaultDepthOfScreen + XDefaultGCOfScreen + XDefaultVisualOfScreen + XWidthOfScreen + XHeightOfScreen + XWidthMMOfScreen + XHeightMMOfScreen + XPlanesOfScreen + XCellsOfScreen + XMinCmapsOfScreen + XMaxCmapsOfScreen + XDoesSaveUnders + XDoesBackingStore + XEventMaskOfScreen + XScreenNumberOfScreen + XDestroyImage + XGetPixel + XPutPixel + XSubImage + XAddPixel + XNoOp + XMapRaised + XMapSubwindows + XMapWindow + XMaskEvent + XMaxRequestSize + XResourceManagerString + XDisplayMotionBufferSize + XDisplayKeycodes + XVisualIDFromVisual + XGetModifierMapping + XSetModifierMapping + XNewModifiermap + XFreeModifiermap + XInsertModifiermapEntry + XDeleteModifiermapEntry + XMoveWindow + XNextEvent + XOpenDisplay + _XFreeDisplayStructure + XParseColor + XParseGeometry + XPeekEvent + XPeekIfEvent + XEventsQueued + XPending + XSetWindowBackgroundPixmap + XSetWindowBorderPixmap + XPolygonRegion + XDrawText + XDrawText16 + XPutBackEvent + _XReverse_Bytes + XPutImage + XQueryBestSize + XQueryColor + XQueryColors + XQueryBestCursor + XQueryExtension + XQueryKeymap + XQueryPointer + XQueryBestStipple + XQueryTextExtents16 + XQueryTextExtents + XQueryBestTile + XQueryTree + XRaiseWindow + XReadBitmapFile + XRecolorCursor + XConfigureWindow + XCreateRegion + XClipBox + XUnionRectWithRegion + XSetRegion + XDestroyRegion + XOffsetRegion + XShrinkRegion + XIntersectRegion + XUnionRegion + XSubtractRegion + XXorRegion + XEmptyRegion + XEqualRegion + XPointInRegion + XRectInRegion + XReparentWindow + XRestackWindows + XRotateWindowProperties + XScreenResourceString + XSelectInput + XSendEvent + XSetBackground + XSetClipRectangles + _XSetClipRectangles + XSetClipMask + XSetClipOrigin + XSetDashes + XSetFontPath + XSetFont + XSetForeground + XSetFunction + XSetSizeHints + XSetWMHints + XSetZoomHints + XSetNormalHints + XSetIconSizes + XSetCommand + XSetStandardProperties + XSetTransientForHint + XSetClassHint + XSetInputFocus + XSetLineAttributes + XSetPlaneMask + XSetPointerMapping + XChangeKeyboardMapping + XSetSelectionOwner + XSetScreenSaver + XSetState + XSetStipple + XSetStandardColormap + XSetTile + XSetTSOrigin + XRotateBuffers + XFetchBuffer + XFetchBytes + XStoreBuffer + XStoreBytes + XStoreColor + XStoreColors + XStoreNamedColor + XStoreName + XSetIconName + _XInitKeysymDB + XStringToKeysym + XSync + _XSyncFunction + XSynchronize + XSetAfterFunction + XDrawString + XDrawString16 + XTextExtents + XTextWidth + XTextExtents16 + XTextWidth16 + XTranslateCoordinates + XUndefineCursor + XUngrabButton + XUngrabKeyboard + XUngrabKey + XUngrabPointer + XUngrabServer + XUninstallColormap + XUnloadFont + XUnmapSubwindows + XUnmapWindow + XGetVisualInfo + XMatchVisualInfo + XWarpPointer + XWindowEvent + XCreateWindow + _XProcessWindowAttributes + XWriteBitmapFile + _XFlush + _XEventsQueued + _XReadEvents + _XRead + _XReadPad + _XSend + _XAllocID + _XSetLastRequestRead + _XReply + _XEatData + _XEnq + _XUnknownWireEvent + _XUnknownNativeEvent + _XWireToEvent + _XDefaultIOError + _XDefaultError + _XDefaultWireError + _XError + _XIOError + _XAllocScratch + _XVIDtoVisual + XFree + _XGetHostname + _XScreenOfWindow + _XAllocIDs + _XAllocTemp + _XFreeTemp + XrmInitialize + XrmGetDatabase + XrmSetDatabase + XrmStringToQuarkList + XrmStringToBindingQuarkList + XrmCombineDatabase + XrmMergeDatabases + XrmQPutResource + XrmPutResource + XrmQPutStringResource + XrmPutStringResource + XrmPutLineResource + XrmGetStringDatabase + XrmGetFileDatabase + XrmCombineFileDatabase + XrmEnumerateDatabase + XrmPutFileDatabase + XrmQGetSearchList + XrmQGetSearchResource + XrmQGetResource + XrmGetResource + XrmLocaleOfDatabase + XrmDestroyDatabase + XGetGCValues + XGetWMSizeHints + XGetWMNormalHints + XGetRGBColormaps + XGetTextProperty + XGetWMName + XGetWMIconName + XGetWMClientMachine + XGetWMColormapWindows + XGetWMProtocols + XIconifyWindow + XListPixmapFormats + XAllocSizeHints + XAllocStandardColormap + XAllocWMHints + XAllocClassHint + XAllocIconSize + XReconfigureWMWindow + XSetWMSizeHints + XSetWMNormalHints + XSetRGBColormaps + XSetTextProperty + XSetWMName + XSetWMIconName + XSetWMClientMachine + XSetWMColormapWindows + XSetWMProperties + XSetWMProtocols + XStringListToTextProperty + XTextPropertyToStringList + XFreeStringList + XWMGeometry + XWithdrawWindow + XauDisposeAuth + XauGetBestAuthByAddr + XauFileName + XauReadAuth + XcmsCIELabToCIEXYZ + XcmsCIEXYZToCIELab + XcmsCIELabClipab + XcmsCIELabClipL + XcmsCIELabClipLab + XcmsCIELabQueryMinL + XcmsCIELabQueryMaxC + XcmsCIELabQueryMaxL + _XcmsCIELabQueryMaxLCRGB + XcmsCIELabQueryMaxLC + XcmsCIELabWhiteShiftColors + XcmsCIELuvToCIEuvY + XcmsCIEuvYToCIELuv + XcmsCIELuvClipuv + XcmsCIELuvClipL + XcmsCIELuvClipLuv + XcmsCIELuvQueryMinL + XcmsCIELuvQueryMaxC + XcmsCIELuvQueryMaxL + _XcmsCIELuvQueryMaxLCRGB + XcmsCIELuvQueryMaxLC + XcmsCIELuvWhiteShiftColors + XcmsCIEuvYToCIEXYZ + XcmsCIEXYZToCIEuvY + XcmsCIExyYToCIEXYZ + XcmsCIEXYZToCIExyY + XcmsTekHVCToCIEuvY + XcmsCIEuvYToTekHVC + _XcmsTekHVC_CheckModify + XcmsTekHVCClipC + XcmsTekHVCClipV + XcmsTekHVCClipVC + XcmsTekHVCQueryMinV + XcmsTekHVCQueryMaxC + XcmsTekHVCQueryMaxV + _XcmsTekHVCQueryMaxVCRGB + XcmsTekHVCQueryMaxVC + XcmsTekHVCQueryMaxVSamples + XcmsTekHVCWhiteShiftColors + XcmsAddColorSpace + XcmsAddFunctionSet + XcmsAllocNamedColor + XcmsAllocColor + XcmsCreateCCC + XcmsDefaultCCC + XcmsFreeCCC + _XcmsAddCmapRec + _XcmsCopyCmapRecAndFree + _XcmsDeleteCmapRec + XcmsCCCOfColormap + _XcmsCopyISOLatin1Lowered + _XcmsResolveColorString + _XcmsConvertColorsWithWhitePt + _XcmsEqualWhitePts + _XcmsDIConvertColors + _XcmsDDConvertColors + XcmsConvertColors + _XcmsRegFormatOfPrefix + XcmsFormatOfPrefix + _XcmsCopyPointerArray + _XcmsFreePointerArray + _XcmsPushPointerArray + _XcmsInitDefaultCCCs + _XcmsInitScrnInfo + _XcmsFreeIntensityMaps + _XcmsGetIntensityMap + _XcmsGetTableType0 + _XcmsGetTableType1 + _XcmsValueCmp + _XcmsIntensityCmp + _XcmsValueInterpolation + _XcmsIntensityInterpolation + _XcmsTableSearch + _XcmsMatVec + XcmsCIEXYZToRGBi + XcmsRGBiToCIEXYZ + XcmsRGBiToRGB + XcmsRGBToRGBi + _XcmsLRGB_InitScrnDefault + XcmsLookupColor + _XcmsCubeRoot + _XcmsSquareRoot + XcmsDisplayOfCCC + XcmsVisualOfCCC + XcmsScreenNumberOfCCC + XcmsScreenWhitePointOfCCC + XcmsClientWhitePointOfCCC + XcmsPrefixOfFormat + _XcmsGetElement + _XcmsGetProperty + XcmsQueryBlack + XcmsQueryBlue + XcmsQueryGreen + XcmsQueryRed + XcmsQueryWhite + XcmsQueryColor + XcmsQueryColors + XcmsSetWhitePoint + XcmsSetCompressionProc + XcmsSetWhiteAdjustProc + _XcmsSetGetColors + XcmsStoreColor + XcmsStoreColors + _XcmsCosine + _XcmsSine + _XcmsArcTangent + _XcmsRGB_to_XColor + _XColor_to_XcmsRGB + _XcmsResolveColor + _XcmsUnresolveColor + _XUnresolveColor + _XParseBaseFontNameList + XCreateFontSet + XFontsOfFontSet + XBaseFontNameListOfFontSet + XLocaleOfFontSet + XContextDependentDrawing + XExtentsOfFontSet + XFreeFontSet + XVaCreateNestedList + XGetIMValues + XCreateIC + XDestroyIC + XGetICValues + XSetICValues + XSetICFocus + XUnsetICFocus + XIMOfIC + XmbResetIC + XwcResetIC + XmbLookupString + XwcLookupString + _XIMCompileResourceList + _XCopyToArg + XOpenIM + XCloseIM + XDisplayOfIM + XLocaleOfIM + XSetLocaleModifiers + XSupportsLocale + _XlcValidModSyntax + _XlcDefaultMapModifiers + _XlcAddLoader + _XlcCurrentLC + XmbSetWMProperties + XmbDrawText + XmbDrawString + XmbDrawImageString + XmbTextEscapement + XmbTextExtents + XmbTextPerCharExtents + XwcDrawText + XwcDrawString + XwcDrawImageString + XwcTextEscapement + XwcTextExtents + XwcTextPerCharExtents + XFilterEvent + _XRegisterFilterByMask + _XRegisterFilterByType + _XUnregisterFilter + _Xsetlocale + XDefaultString + _XlcDefaultLoader + _XrmInitParseInfo + XmbTextPropertyToTextList + XmbTextListToTextProperty + XwcTextPropertyToTextList + XwcFreeStringList + XwcTextListToTextProperty + _X11TransConnectDisplay + XGetAtomNames + XInitImage + XESetBeforeFlush + _XFreeAtomTable + _XUpdateAtomCache + XInternAtoms + _XKeyInitialize + XConvertCase + _XTranslateKey + _XTranslateKeySym + _XKeysymToModifiers + XExtendedMaxRequestSize + XReadBitmapFileData + _XAsyncErrorHandler + _XDeqAsyncHandler + _XGetAsyncReply + _XGetAsyncData + _XPollfdCacheInit + _XPollfdCacheAdd + _XPollfdCacheDel + _XRegisterInternalConnection + _XUnregisterInternalConnection + XInternalConnectionNumbers + XProcessInternalConnection + XAddConnectionWatch + XRemoveConnectionWatch + _XDeq + _XcmsCIEXYZ_ValidSpec + _XcmsCIEuvY_ValidSpec + XcmsSetCCCOfColormap + XDirectionalDependentDrawing + XContextualDrawing + XSetIMValues + XRegisterIMInstantiateCallback + XUnregisterIMInstantiateCallback + XCreateOC + XDestroyOC + XOMOfOC + XSetOCValues + XGetOCValues + XOpenOM + XCloseOM + XSetOMValues + XGetOMValues + XDisplayOfOM + XLocaleOfOM + _XlcRemoveLoader + _XOpenLC + _XCloseLC + _XlcCopyFromArg + _XlcCopyToArg + _XlcCountVaList + _XlcVaToArgList + _XlcCompileResourceList + _XlcGetValues + _XlcSetValues + XInitThreads + XLockDisplay + XUnlockDisplay + _X11TransFreeConnInfo + _X11TransOpenCOTSClient + _X11TransOpenCLTSClient + _X11TransSetOption + _X11TransConnect + _X11TransBytesReadable + _X11TransRead + _X11TransWrite + _X11TransReadv + _X11TransWritev + _X11TransDisconnect + _X11TransClose + _X11TransCloseForCloning + _X11TransIsLocal + _X11TransGetMyAddr + _X11TransGetPeerAddr + _X11TransGetConnectionNumber + _X11TransGetHostname + _X11TransConvertAddress + _XimCbDispatch + _XimLookupMBText + _XimLookupWCText + _XimRegisterFilter + _XimUnregisterFilter + _XimReregisterFilter + _XimRegisterServerFilter + _XimUnregisterServerFilter + _XimProtoCreateIC + _XimCheckDataSize + _XimSetHeader + _XimProtoIMFree + _XimProtoOpenIM + _XimICOfXICID + _XimSetEventMaskCallback + _XimSync + _XimProcSyncReply + _XimRespSyncReply + _XimSyncCallback + _XimForwardEvent + _XimForwardEventCallback + _XimRegisterTriggerKeysCallback + _XimGetWindowEventmask + _XimTriggerNotify + _XimFreeCommitInfo + _XimCommitCallback + _XimProcError + _XimErrorCallback + _XimError + _Ximctstombs + _Ximctstowcs + _XimProtoMbLookupString + _XimProtoWcLookupString + _XimRegProtoIntrCallback + _XimFreeProtoIntrCallback + _XimDispatchInit + _XimProtoEventToWire + _XimProtoWireToEvent + _XimExtension + _XimRegisterIMInstantiateCallback + _XimUnRegisterIMInstantiateCallback + _XimResetIMInstantiateCallback + _XimDestroyIMStructureList + _XimServerDestroy + _XInitIM + _XimLocalFilter + _XimLocalGetICValues + _XimLocalCreateIC + _XimCheckIfLocalProcessing + _XimLocalIMFree + _XimLocalGetIMValues + _XimLocalSetIMValues + _XimLocalOpenIM + _XimLocalMbLookupString + _XimLocalWcLookupString + _XimParseStringFile + _XimSetICValueData + _XimLocalSetICValues + _XimSetIMResourceList + _XimSetICResourceList + _XimSetInnerIMResourceList + _XimSetInnerICResourceList + _XimCheckCreateICValues + _XimGetResourceListRec + _XimSetIMMode + _XimCheckIMMode + _XimSetICMode + _XimCheckICMode + _XimSetLocalIMDefaults + _XimSetICDefaults + _XimDecodeLocalIMAttr + _XimDecodeLocalICAttr + _XimCheckLocalInputStyle + _XimEncodeLocalIMAttr + _XimEncodeLocalICAttr + _XimGetCurrentIMValues + _XimSetCurrentIMValues + _XimGetCurrentICValues + _XimSetCurrentICValues + _XimInitialResourceInfo + _XimDecodeIMATTRIBUTE + _XimDecodeICATTRIBUTE + _XimEncodeIMATTRIBUTE + _XimEncodeICATTRIBUTE + _XimGetAttributeID + _XimThaiFilter + _XimThaiCreateIC + _XimCheckIfThaiProcessing + _XimThaiOpenIM + _XimThaiIMFree + _XimThaiCloseIM + _XimXConf + _XimConnect + _XimShutdown + _XimFlush + _XimFilterWaitEvent + _XimFreeTransIntrCallback + _XimTransFilterWaitEvent + _XimTransInternalConnection + _XimTransFlush + _XimTransConf + _XlcParseCharSet + _XlcInitCTInfo + _XlcGetCSValues + _XlcGetCharSet + _XlcAddCharSet + _XlcCreateDefaultCharSet + _XlcSetConverter + _XlcOpenConverter + _XlcCloseConverter + _XlcConvert + _XlcResetConverter + _XlcGetResource + _XlcGetLocaleDataBase + _XlcDestroyLocaleDataBase + _XlcCreateLocaleDataBase + _XlcEucLoader + _XlcFileName + _XlcResolveLocaleName +;REMOVED _XlcResolveDBName + _XlcResolveI18NPath + _XlcGenericLoader + _XlcInitLoader + _XmbTextPropertyToTextList + _XwcTextPropertyToTextList + _XwcFreeStringList + _XGetLCValues + _XlcDestroyLC + _XlcCreateLC + _XrmDefaultInitParseInfo + _XlcSjisLoader + _Xlcmbtowc + _Xlcwctomb + _Xlcmbstowcs + _Xlcwcstombs + _Xmbtowc + _Xwctomb + _Xmbstowcs + _Xwcstombs + _Xwcscpy + _Xwcsncpy + _Xwcslen + _Xwcscmp + _Xwcsncmp + _XmbTextListToTextProperty + _XwcTextListToTextProperty +; _XlcUtfLoader + _XlcCompareISOLatin1 + _XlcNCompareISOLatin1 + _XmbDefaultTextEscapement + _XwcDefaultTextEscapement + _XmbDefaultTextExtents + _XwcDefaultTextExtents + _XmbDefaultTextPerCharExtents + _XwcDefaultTextPerCharExtents + _XmbDefaultDrawString + _XwcDefaultDrawString + _XmbDefaultDrawImageString + _XwcDefaultDrawImageString + _XomGenericOpenOM + _XInitOM + _XmbGenericDrawImageString + _XwcGenericDrawImageString + _XomGenericDrawString + _XmbGenericDrawString + _XwcGenericDrawString + _XmbGenericTextEscapement + _XwcGenericTextEscapement + _XomGenericTextExtents + _XmbGenericTextExtents + _XwcGenericTextExtents + _XmbGenericTextPerCharExtents + _XwcGenericTextPerCharExtents + _XomConvert + _XomInitConverter + _Xmblen + _XimGetResourceListRecByQuark + _XimSetIMValueData + _XimGetIMValueData + _XimGetICValueData + _XimMakeIMAttrIDList + _XimMakeICAttrIDList + _XimWrite + _XimRead + _XimRegisterDispatcher + _XimTransRegisterDispatcher + _XimTransCallDispatcher + _XimTransWrite + _XimTransRead + _XimXTransFreeConnInfo + _XimXTransOpenCOTSClient + _XimXTransOpenCLTSClient + _XimXTransSetOption + _XimXTransConnect + _XimXTransBytesReadable + _XimXTransRead + _XimXTransWrite + _XimXTransReadv + _XimXTransWritev + _XimXTransDisconnect + _XimXTransClose + _XimXTransCloseForCloning + _XimXTransIsLocal + _XimXTransGetMyAddr + _XimXTransGetPeerAddr + _XimXTransGetConnectionNumber + _XimXTransGetHostname + _Xdebug + Xutf8TextPropertyToTextList + Xutf8TextListToTextProperty + XkbIgnoreExtension + XkbOpenDisplay + XkbQueryExtension + XkbUseExtension + XkbLibraryVersion + XkbSetXlibControls + XkbGetXlibControls + XkbSetAtomFuncs + XkbKeycodeToKeysym + XkbKeysymToModifiers + XkbLookupKeySym + XkbLookupKeyBinding + XkbTranslateKeyCode + XkbTranslateKeySym + XkbSetAutoRepeatRate + XkbGetAutoRepeatRate + XkbChangeEnabledControls + XkbDeviceBell + XkbForceDeviceBell + XkbDeviceBellEvent + XkbBell + XkbForceBell + XkbBellEvent + XkbSelectEvents + XkbSelectEventDetails + XkbNoteMapChanges + XkbNoteNameChanges + XkbGetIndicatorState + XkbGetIndicatorMap + XkbSetIndicatorMap + XkbGetNamedIndicator + XkbGetNamedDeviceIndicator + XkbSetNamedIndicator + XkbSetNamedDeviceIndicator + XkbLockModifiers + XkbLatchModifiers + XkbLockGroup + XkbLatchGroup + XkbSetServerInternalMods + XkbSetIgnoreLockMods + XkbVirtualModsToReal + XkbComputeEffectiveMap + XkbInitCanonicalKeyTypes + XkbAllocKeyboard + XkbFreeKeyboard + XkbAllocClientMap + XkbAllocServerMap + XkbFreeClientMap + XkbFreeServerMap + XkbAddKeyType + XkbAllocIndicatorMaps + XkbFreeIndicatorMaps + XkbGetMap + XkbGetUpdatedMap + XkbGetMapChanges + XkbRefreshKeyboardMapping + XkbGetKeyTypes + XkbGetKeySyms + XkbGetKeyActions + XkbGetKeyBehaviors + XkbGetVirtualMods + XkbGetKeyExplicitComponents + XkbGetKeyModifierMap + XkbAllocControls + XkbFreeControls + XkbGetControls + XkbSetControls + XkbAllocCompatMap + XkbFreeCompatMap + XkbGetCompatMap + XkbSetCompatMap + XkbAllocNames + XkbGetNames + XkbSetNames + XkbChangeNames + XkbFreeNames + XkbGetState + XkbSetMap + XkbChangeMap + XkbSetDetectableAutoRepeat + XkbGetDetectableAutoRepeat + XkbSetAutoResetControls + XkbGetAutoResetControls + XkbCopyKeyType + XkbCopyKeyTypes + XkbResizeKeyType + XkbResizeKeySyms + XkbResizeKeyActions + XkbChangeTypesOfKey + XkbListComponents + XkbFreeComponentList + XkbGetKeyboard + XkbGetKeyboardByName + XkbAddDeviceLedInfo + XkbResizeDeviceButtonActions + XkbAllocDeviceInfo + XkbFreeDeviceInfo + XkbNoteDeviceChanges + XkbGetDeviceInfo + XkbGetDeviceInfoChanges + XkbGetDeviceButtonActions + XkbGetDeviceLedInfo + XkbSetDeviceInfo + XkbChangeDeviceInfo + XkbSetDeviceLedInfo + XkbSetDeviceButtonActions + XkbToControl + XkbSetDebuggingFlags + _XkbInternAtomFunc + _XkbGetAtomNameFunc + _XkbReloadDpy + _XKeycodeToKeysym + _XKeysymToKeycode + _XLookupKeysym + _XRefreshKeyboardMapping + _XLookupString + _XkbNoteCoreMapChanges + _XkbInitReadBuffer + _XkbSkipReadBufferData + _XkbCopyFromReadBuffer + _XkbReadCopyKeySyms + _XkbWriteCopyKeySyms + _XkbReadBufferCopyKeySyms + _XkbPeekAtReadBuffer + _XkbGetReadBufferPtr + _XkbFreeReadBuffer + _XkbGetReadBufferCountedString + _XkbGetCharset + _XkbGetConverters + XkbGetGeometry + XkbAddGeomShape + XkbAddGeomOutline + XkbComputeShapeBounds + XkbAddGeomDoodad + XkbAddGeomColor + XkbAddGeomOverlayRow + XkbAddGeomSection + XkbAddGeomRow + XkbAddGeomKey + XkbComputeSectionBounds + XkbAllocGeometry + XkbAddGeomProperty + XkbAddGeomOverlay + XkbComputeShapeTop + XkbFindOverlayForKey + XkbAllocGeomKeyAliases + XkbSetGeometry + XkbXlibControlsImplemented + XkbTranslateKey + XkbAddGeomOverlayKey + XkbNoteControlsChanges + XkbGetKeyVirtualModMap + XkbComputeRowBounds + XkbGetNamedGeometry + XkbKeyTypesForCoreSymbols + XkbApplyCompatMapToKey + XkbUpdateMapFromCore + XkbUpdateActionVirtualMods + XkbUpdateKeyTypeVirtualMods + XkbApplyVirtualModChanges + XkbFreeGeomProperties + XkbFreeGeomKeyAliases + XkbFreeGeomColors + XkbFreeGeomPoints + XkbFreeGeomOutlines + XkbFreeGeomShapes + XkbFreeGeomOverlayKeys + XkbFreeGeomOverlayRows + XkbFreeGeomOverlays + XkbFreeGeomKeys + XkbFreeGeomRows + XkbFreeGeomSections + XkbFreeGeomDoodads + XkbFreeGeometry + XkbAllocGeomProps + XkbAllocGeomColors + XkbAllocGeomShapes + XkbAllocGeomSections + XkbAllocGeomOverlays + XkbAllocGeomOverlayRows + XkbAllocGeomOverlayKeys + XkbAllocGeomDoodads + XkbAllocGeomSectionDoodads + XkbAllocGeomOutlines + XkbAllocGeomRows + XkbAllocGeomPoints + XkbAllocGeomKeys + XkbAddGeomKeyAlias + _XkeyTable + _Xevent_to_mask + _qfree + _XIOErrorFunction + _XErrorFunction + _XHeadOfDisplayList + XcmsCIELabColorSpace + XcmsCIELuvColorSpace + XcmsCIEXYZColorSpace + XcmsCIEuvYColorSpace + XcmsCIExyYColorSpace + XcmsTekHVCColorSpace + XcmsUNDEFINEDColorSpace + _XcmsDIColorSpacesInit + _XcmsDIColorSpaces + _XcmsDDColorSpacesInit + _XcmsDDColorSpaces + _XcmsSCCFuncSetsInit + _XcmsSCCFuncSets + _XcmsCIEXYZ_prefix + _XcmsCIEuvY_prefix + _XcmsCIExyY_prefix + _XcmsCIELab_prefix + _XcmsCIELuv_prefix + _XcmsTekHVC_prefix + _XcmsRGBi_prefix + _XcmsRGB_prefix + _XcmsRegColorSpaces + XcmsRGBiColorSpace + XcmsRGBColorSpace + XcmsLinearRGBFunctionSet + _X11TransSocketINETFuncs + _X11TransSocketTCPFuncs + _XimXTransSocketINETFuncs + _XimXTransSocketTCPFuncs + _XimImSportRec + _XimTransportRec + _XlcGenericMethods + _XlcPublicMethods +#endif /* $Xorg: X11-def.cpp,v 1.3 2000/08/17 19:44:59 cpqbld Exp $ */ -/* $XFree86: xc/lib/X11/X11-def.cpp,v 1.8 2001/02/13 19:19:11 dawes Exp $ */ +/* $XFree86: xc/lib/X11/X11-def.cpp,v 1.10 2001/04/05 19:29:38 dawes Exp $ */ diff --git a/xc/lib/X11/XKB.c b/xc/lib/X11/XKB.c index dd93e08a1..661e1d71c 100644 --- a/xc/lib/X11/XKB.c +++ b/xc/lib/X11/XKB.c @@ -24,7 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/lib/X11/XKB.c,v 1.4 2001/01/17 19:41:48 dawes Exp $ */ +/* $XFree86: xc/lib/X11/XKB.c,v 1.5 2001/02/20 16:43:14 paulo Exp $ */ #include <stdio.h> #define NEED_REPLIES @@ -854,9 +854,9 @@ XkbInfoPtr xkbi; UnlockDisplay(dpy); SyncHandle(); if (ctrls) - *ctrls= ((rep.value & XkbPCF_GrabsUseXKBStateMask) | + *ctrls= (rep.value & (XkbPCF_GrabsUseXKBStateMask | XkbPCF_LookupStateWhenGrabbed | - XkbPCF_SendEventUsesXKBState); + XkbPCF_SendEventUsesXKBState)); return (True); } diff --git a/xc/lib/X11/XKBleds.c b/xc/lib/X11/XKBleds.c index a46361571..aa6ba3d06 100644 --- a/xc/lib/X11/XKBleds.c +++ b/xc/lib/X11/XKBleds.c @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/lib/X11/XKBleds.c,v 1.3 2001/02/21 15:18:03 tsi Exp $ */ #define NEED_REPLIES #define NEED_EVENTS @@ -340,8 +341,7 @@ XkbSetNamedDeviceIndicator(dpy,device,class,id,name,changeState, XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (name==None) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)) || - (pMap==NULL)) + (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; diff --git a/xc/lib/X11/XKeysymDB b/xc/lib/X11/XKeysymDB index 80a2ad19e..e16b2a8b4 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.7 2001/01/17 19:41:49 dawes Exp $ +! $XFree86: xc/lib/X11/XKeysymDB,v 3.11 2001/04/06 02:16:21 dawes Exp $ hpmute_acute :100000A8 hpmute_grave :100000A9 @@ -227,7 +227,10 @@ XF86Stop :1008FF28 XF86Refresh :1008FF29 XF86PowerOff :1008FF2A XF86WakeUp :1008FF2B -! 1008FF2C - 1008FF2F are yet to be assigned +XF86Eject :1008FF2C +XF86ScreenSaver :1008FF2D +XF86WWW :1008FF2E +XF86Sleep :1008FF2F XF86Favorites :1008FF30 XF86AudioPause :1008FF31 XF86AudioMedia :1008FF32 @@ -235,6 +238,29 @@ XF86MyComputer :1008FF33 XF86VendorHome :1008FF34 XF86LightBulb :1008FF35 XF86Shop :1008FF36 +XF86History :1008FF37 +XF86OpenURL :1008FF38 +XF86AddFavorite :1008FF39 +XF86HotLinks :1008FF3A +XF86BrightnessAdjust :1008FF3B +! Allocate 1008FF3C-F next + +XF86Launch0 :1008FF40 +XF86Launch1 :1008FF41 +XF86Launch2 :1008FF42 +XF86Launch3 :1008FF43 +XF86Launch4 :1008FF44 +XF86Launch5 :1008FF45 +XF86Launch6 :1008FF46 +XF86Launch7 :1008FF47 +XF86Launch8 :1008FF48 +XF86Launch9 :1008FF49 +XF86LaunchA :1008FF4A +XF86LaunchB :1008FF4B +XF86LaunchC :1008FF4C +XF86LaunchD :1008FF4D +XF86LaunchE :1008FF4E +XF86LaunchF :1008FF4F usldead_acute :100000A8 diff --git a/xc/lib/X11/imThaiFlt.c b/xc/lib/X11/imThaiFlt.c index 8a025942b..b77b8780b 100644 --- a/xc/lib/X11/imThaiFlt.c +++ b/xc/lib/X11/imThaiFlt.c @@ -41,7 +41,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/lib/X11/imThaiFlt.c,v 3.7 2001/01/17 19:41:52 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imThaiFlt.c,v 3.8 2001/03/01 00:56:52 dawes Exp $ */ /* **++ @@ -564,13 +564,63 @@ Private Bool ThaiComposeConvert(); #define BellVolume 0 +#define ucs2tis(wc) \ + (unsigned char) ( \ + (0<=(wc)&&(wc)<=0x7F) ? \ + (wc) : \ + ((0x0E01<=(wc)&&(wc)<=0x0E5F) ? ((wc)-0x0E00+0xA0) : 0)) + /* * Macros to save and recall last input character in XIC */ #define IC_SavePreviousChar(ic,ch) \ (*((ic)->private.local.context->mb) = (char) (ch)) -#define IC_GetPreviousChar(ic,ch) \ - ((ch) = (unsigned char) *((ic)->private.local.context->mb)) +/* +#define IC_GetPreviousChar(ic) \ + ((unsigned char) *((ic)->private.local.context->mb)) +*/ +Private unsigned char +#if NeedFunctionPrototypes +IC_GetPreviousChar(Xic ic) +#else +IC_GetPreviousChar(ic) + Xic ic; +#endif +{ + XICCallback* cb = &ic->core.string_conversion_callback; + + if (cb && cb->callback) { + XIMStringConversionCallbackStruct screc; + unsigned char c; + + screc.position = 0; + screc.direction = XIMBackwardChar; + screc.operation = XIMStringConversionRetrieval; + screc.factor = 2; + screc.text = 0; + + (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); + if (!screc.text) { return 0; } + if ((screc.text->feedback && + *screc.text->feedback == XIMStringConversionLeftEdge) || + screc.text->length < 2) + { + c = 0; + } else { + if (screc.text->encoding_is_wchar) { + c = ucs2tis(screc.text->string.wcs[1]); + XFree(screc.text->string.wcs); + } else { + c = screc.text->string.mbs[1]; + XFree(screc.text->string.mbs); + } + } + XFree(screc.text); + return c; + } else { + return (unsigned char) *((ic)->private.local.context->mb); + } +} #define IC_ClearPreviousChar(ic) \ (*((ic)->private.local.context->mb) = 0) /* @@ -1194,12 +1244,17 @@ XPointer client_data; (XK_KP_F1 <= symbol && symbol <= XK_KP_Delete) || (XK_KP_Multiply <= symbol && symbol <= XK_KP_9) || (XK_F1 <= symbol && symbol <= XK_F35) || - (symbol == XK_KP_Equal) || - (symbol == NoSymbol)))) + (symbol == XK_KP_Equal)))) { IC_ClearPreviousChar(ic); return False; } + if (((symbol >> 8 == 0xFF) && + (XK_Shift_L <= symbol && symbol <= XK_Hyper_R)) || + (symbol == NoSymbol)) + { + return False; + } #if 0 if (! XThaiTranslateKey(ev->xkey.display, ev->xkey.keycode, ev->xkey.state, &modifiers, &symbol, &lsym, &usym)) @@ -1234,8 +1289,8 @@ XPointer client_data; * Thai Input sequence check */ isc_mode = IC_IscMode(ic); - if (!(IC_GetPreviousChar(ic, previous_char))) previous_char = ' '; - if (!THAI_isaccepted(buf[0],previous_char, isc_mode)) { + if (!(previous_char = IC_GetPreviousChar(ic))) previous_char = ' '; + if (!THAI_isaccepted(buf[0], previous_char, isc_mode)) { /* reject character */ XBell(ev->xkey.display, BellVolume); return True; diff --git a/xc/lib/X11/omGeneric.c b/xc/lib/X11/omGeneric.c index 0df63555d..5d691cc5e 100644 --- a/xc/lib/X11/omGeneric.c +++ b/xc/lib/X11/omGeneric.c @@ -31,7 +31,7 @@ * Modifier: Takanori Tateno FUJITSU LIMITED * */ -/* $XFree86: xc/lib/X11/omGeneric.c,v 3.18 2001/01/17 19:41:56 dawes Exp $ */ +/* $XFree86: xc/lib/X11/omGeneric.c,v 3.20 2001/04/05 17:42:26 dawes Exp $ */ /* * Fixed the algorithms in parse_fontname() and parse_fontdata() @@ -940,6 +940,8 @@ parse_fontdata(oc, font_set, font_data, font_data_count, name_list, name_list_co return False; } + font_data_return->xlfd_name = NULL; + /* Loop through each FontSet defined in the "font_data" CharSet. */ for ( ; font_data_count-- > 0; font_data++) { is_found = False; @@ -1161,7 +1163,7 @@ parse_vw(oc, font_set, name_list, count) } vrotate_num = font_set->vrotate_num = sub_num; } else { - font_set->vrotate = (VRotate)NULL; + vrotate = font_set->vrotate = (VRotate)NULL; } ret = parse_fontdata(oc, font_set, (FontData) vrotate, vrotate_num, diff --git a/xc/lib/Xaw/SimpleMenu.c b/xc/lib/Xaw/SimpleMenu.c index a92743719..473371edb 100644 --- a/xc/lib/Xaw/SimpleMenu.c +++ b/xc/lib/Xaw/SimpleMenu.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/lib/Xaw/SimpleMenu.c,v 3.20 2001/01/17 19:42:30 dawes Exp $ */ +/* $XFree86: xc/lib/Xaw/SimpleMenu.c,v 3.21 2001/03/23 23:59:15 paulo Exp $ */ /* * SimpleMenu.c - Source code file for SimpleMenu widget. @@ -590,16 +590,17 @@ XawSimpleMenuSetValues(Widget current, Widget request, Widget cnew, XDefineCursor(XtDisplay(cnew), XtWindow(cnew), smw_new->simple_menu.cursor); - if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) - if (smw_new->simple_menu.label_string == NULL) /* Destroy */ - XtDestroyWidget((Widget)smw_old->simple_menu.label); - else if (smw_old->simple_menu.label_string == NULL) /* Create */ - CreateLabel(cnew); - else { /* Change */ - Arg arglist[1]; + if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) { + if (smw_new->simple_menu.label_string == NULL) /* Destroy */ + XtDestroyWidget((Widget)smw_old->simple_menu.label); + else if (smw_old->simple_menu.label_string == NULL) /* Create */ + CreateLabel(cnew); + else { /* Change */ + Arg arglist[1]; - XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string); - XtSetValues((Widget)smw_new->simple_menu.label, arglist, ONE); + XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string); + XtSetValues((Widget)smw_new->simple_menu.label, arglist, ONE); + } } if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class) @@ -1718,6 +1719,17 @@ Popdown(Widget w, XEvent *event, String *params, Cardinal *num_params) { SimpleMenuWidget smw = (SimpleMenuWidget)w; + while (XtParent(w) && + XtIsSubclass(XtParent(w), simpleMenuWidgetClass)) { + if (((SimpleMenuWidget)XtParent(w))->simple_menu.sub_menu == (Widget)w) { + w = XtParent(w); + smw = (SimpleMenuWidget)w; + smw->simple_menu.entry_set = NULL; + } + else + break; + } + smw->simple_menu.state |= SMW_UNMAPPING; if (smw->simple_menu.sub_menu) PopdownSubMenu(smw); diff --git a/xc/lib/Xaw/TextAction.c b/xc/lib/Xaw/TextAction.c index a2ae600c1..77adce91e 100644 --- a/xc/lib/Xaw/TextAction.c +++ b/xc/lib/Xaw/TextAction.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/Xaw/TextAction.c,v 3.39 2001/02/01 19:15:19 paulo Exp $ */ +/* $XFree86: xc/lib/Xaw/TextAction.c,v 3.41 2001/02/23 21:25:06 paulo Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -185,6 +185,7 @@ static void ToggleOverwrite(Widget, XEvent*, String*, Cardinal*); static void Undo(Widget, XEvent*, String*, Cardinal*); #endif static void UpcaseWord(Widget, XEvent*, String*, Cardinal*); +static void DestroyFocusCallback(Widget, XtPointer, XtPointer); /* * External @@ -2845,6 +2846,17 @@ RedrawDisplay(Widget w, XEvent *event, String *p, Cardinal *n) struct _focus { Display *display; Widget widget; }; static struct _focus *focus; static Cardinal num_focus; + +/*ARGSUSED*/ +static void +DestroyFocusCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + struct _focus *f = (struct _focus*)(user_data); + + if (f->widget == w) + f->widget = NULL; +} + /*ARGSUSED*/ static void TextFocusIn(Widget w, XEvent *event, String *p, Cardinal *n) @@ -2872,7 +2884,7 @@ TextFocusIn(Widget w, XEvent *event, String *p, Cardinal *n) focus = (struct _focus*) XtRealloc((XtPointer)focus, sizeof(struct _focus) * (num_focus + 1)); i = num_focus; - focus[i].widget = w; + focus[i].widget = NULL; focus[i].display = XtDisplay(w); num_focus++; } @@ -2882,6 +2894,8 @@ TextFocusIn(Widget w, XEvent *event, String *p, Cardinal *n) focus[i].widget = w; if (old != NULL) TextFocusOut(old, event, p, n); + XtAddCallback(w, XtNdestroyCallback, + DestroyFocusCallback, (XtPointer)&focus[i]); } } @@ -2911,6 +2925,10 @@ TextFocusOut(Widget w, XEvent *event, String *p, Cardinal *n) || event->xfocus.detail == NotifyPointer) return; + if (i < num_focus && focus[i].widget) + XtRemoveCallback(focus[i].widget, XtNdestroyCallback, + DestroyFocusCallback, (XtPointer)&focus[i]); + /* Let the input method know focus has left.*/ _XawImUnsetFocus(w); diff --git a/xc/lib/Xext/Xdbe.c b/xc/lib/Xext/Xdbe.c index 8cf682be5..f3e676cce 100644 --- a/xc/lib/Xext/Xdbe.c +++ b/xc/lib/Xext/Xdbe.c @@ -30,7 +30,7 @@ * Xlib DBE code * *****************************************************************************/ -/* $XFree86: xc/lib/Xext/Xdbe.c,v 3.3 2001/01/17 19:42:46 dawes Exp $ */ +/* $XFree86: xc/lib/Xext/Xdbe.c,v 3.4 2001/04/01 14:00:01 tsi Exp $ */ #define NEED_EVENTS #define NEED_REPLIES @@ -430,7 +430,7 @@ XdbeScreenVisualInfo *XdbeGetVisualInfo (dpy, screen_specifiers, num_screens) int j; long c; - _XRead32 (dpy, (long *)&c, sizeof(CARD32)); + _XRead32 (dpy, &c, sizeof(CARD32)); scrVisInfo[i].count = c; nbytes = scrVisInfo[i].count * sizeof(XdbeVisualInfo); diff --git a/xc/lib/Xft/Imakefile b/xc/lib/Xft/Imakefile index 68135d7aa..9b62f6212 100644 --- a/xc/lib/Xft/Imakefile +++ b/xc/lib/Xft/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.10 2001/02/09 00:35:03 keithp Exp $ +XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.12 2001/03/30 18:50:18 keithp Exp $ #define DoNormalLib NormalLibXft #define DoSharedLib SharedLibXft @@ -29,9 +29,14 @@ TYPE1DIR=XftType1Dir CONFIG_DEFS=-DXFT_TYPE1_DIR=\"$(TYPE1DIR)\" INCLUDES=$(FREETYPE2INCLUDES) DEFINES=-DXFT_DEFAULT_PATH=\"$(XFTCONFIG)\" $(FREETYPE2DEFINES) $(RENDERDEFINES) -REQUIREDLIBS=$(LDPRELIBS) $(XRENDERLIB) $(XLIB) $(FREETYPE2LIB) -#if HasFreetype2 +#if UseFreetype2 +FREETYPE2REQLIB = $(FREETYPE2LIB) +#endif + +REQUIREDLIBS=$(LDPRELIBS) $(XRENDERLIB) $(XLIB) $(FREETYPE2REQLIB) + +#if UseFreetype2 FT_HEADERS = XftFreetype.h FT_SRCS = xftcache.c xftdir.c xftfreetype.c xftglyphs.c xftrender.c FT_OBJS = xftcache.o xftdir.o xftfreetype.o xftglyphs.o xftrender.o @@ -41,13 +46,13 @@ HEADERS = Xft.h $(FT_HEADERS) SRCS = xftcfg.c xftcolor.c xftcore.c xftdbg.c xftdpy.c \ xftdraw.c xftextent.c xftfont.c xftfs.c xftgram.c \ - xftinit.c xftlex.c xftlist.c xftmatch.c xftname.c \ - xftpat.c xftstr.c xftxlfd.c $(FT_SRCS) + xftinit.c xftlex.c xftlist.c xftmatch.c xftmatrix.c \ + xftname.c xftpat.c xftstr.c xftxlfd.c $(FT_SRCS) OBJS = xftcfg.o xftcolor.o xftcore.o xftdbg.o xftdpy.o \ xftdraw.o xftextent.o xftfont.o xftfs.o xftgram.o \ - xftinit.o xftlex.o xftlist.o xftmatch.o xftname.o \ - xftpat.o xftstr.o xftxlfd.o $(FT_OBJS) + xftinit.o xftlex.o xftlist.o xftmatch.o xftmatrix.o \ + xftname.o xftpat.o xftstr.o xftxlfd.o $(FT_OBJS) #include <Library.tmpl> diff --git a/xc/lib/Xft/Xft-def.cpp b/xc/lib/Xft/Xft-def.cpp index 0f27d645e..3d8602021 100644 --- a/xc/lib/Xft/Xft-def.cpp +++ b/xc/lib/Xft/Xft-def.cpp @@ -141,6 +141,10 @@ XftCoreAddFonts XftCoreClose XftCoreOpen XftXlfdParse +XftInitFtLibrary +XftConfigDirs +XftDirScan +XftDirSave -/* $XFree86: xc/lib/Xft/Xft-def.cpp,v 1.1 2001/02/13 19:19:12 dawes Exp $ */ +/* $XFree86: xc/lib/Xft/Xft-def.cpp,v 1.2 2001/04/05 19:29:38 dawes Exp $ */ diff --git a/xc/lib/Xft/Xft.h b/xc/lib/Xft/Xft.h index 6304c633b..3e900de90 100644 --- a/xc/lib/Xft/Xft.h +++ b/xc/lib/Xft/Xft.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/Xft.h,v 1.17 2001/01/26 20:51:14 keithp Exp $ + * $XFree86: xc/lib/Xft/Xft.h,v 1.18 2001/03/30 18:50:18 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -62,6 +62,7 @@ typedef unsigned int XftChar32; /* specific to FreeType rasterizer */ #define XFT_CHAR_WIDTH "charwidth" /* Int */ #define XFT_CHAR_HEIGHT "charheight"/* Int */ +#define XFT_MATRIX "matrix" /* XftMatrix */ #define XFT_WEIGHT_LIGHT 0 #define XFT_WEIGHT_MEDIUM 100 @@ -88,9 +89,17 @@ typedef enum _XftType { XftTypeInteger, XftTypeDouble, XftTypeString, - XftTypeBool + XftTypeBool, + XftTypeMatrix } XftType; +typedef struct _XftMatrix { + double xx, xy, yx, yy; +} XftMatrix; + +#define XftMatrixInit(m) ((m)->xx = (m)->yy = 1, \ + (m)->xy = (m)->yx = 0) + typedef enum _XftResult { XftResultMatch, XftResultNoMatch, XftResultTypeMismatch, XftResultNoId } XftResult; @@ -102,6 +111,7 @@ typedef struct _XftValue { int i; Bool b; double d; + XftMatrix *m; } u; } XftValue; @@ -395,6 +405,22 @@ XftFontSetMatch (XftFontSet **sets, XftPattern *p, XftResult *result); +/* xftmatrix.c */ +int +XftMatrixEqual (const XftMatrix *mat1, const XftMatrix *mat2); + +void +XftMatrixMultiply (XftMatrix *result, XftMatrix *a, XftMatrix *b); + +void +XftMatrixRotate (XftMatrix *m, double c, double s); + +void +XftMatrixScale (XftMatrix *m, double sx, double sy); + +void +XftMatrixShear (XftMatrix *m, double sh, double sv); + /* xftname.c */ XftPattern * XftNameParse (const char *name); @@ -440,6 +466,9 @@ Bool XftPatternAddString (XftPattern *p, const char *object, const char *s); Bool +XftPatternAddMatrix (XftPattern *p, const char *object, const XftMatrix *s); + +Bool XftPatternAddBool (XftPattern *p, const char *object, Bool b); XftResult @@ -452,6 +481,9 @@ XftResult XftPatternGetString (XftPattern *p, const char *object, int n, char **s); XftResult +XftPatternGetMatrix (XftPattern *p, const char *object, int n, XftMatrix **s); + +XftResult XftPatternGetBool (XftPattern *p, const char *object, int n, Bool *b); XftPattern * diff --git a/xc/lib/Xft/XftFreetype.h b/xc/lib/Xft/XftFreetype.h index a8b6fb360..38635a110 100644 --- a/xc/lib/Xft/XftFreetype.h +++ b/xc/lib/Xft/XftFreetype.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/XftFreetype.h,v 1.12 2001/01/02 02:46:50 keithp Exp $ + * $XFree86: xc/lib/Xft/XftFreetype.h,v 1.15 2001/03/31 23:07:29 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -50,6 +50,8 @@ struct _XftFontStruct { XRenderPictFormat *format; XGlyphInfo **realized; int nrealized; + Bool transform; + FT_Matrix matrix; }; _XFUNCPROTOBEGIN @@ -66,7 +68,7 @@ XftPattern * XftFreeTypeQuery (const char *file, int id, int *count); Bool -XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap); +XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap, FT_Matrix *matrix); XftFontStruct * XftFreeTypeOpen (Display *dpy, XftPattern *pattern); @@ -157,9 +159,6 @@ XftRenderExtentsUtf8 (Display *dpy, int len, XGlyphInfo *extents); -XftFontStruct * -XftFreeTypeGet (XftFont *font); - _XFUNCPROTOEND #endif /* _XFTFREETYPE_H_ */ diff --git a/xc/lib/Xft/xftcfg.c b/xc/lib/Xft/xftcfg.c index 972d2502c..8ddbc463c 100644 --- a/xc/lib/Xft/xftcfg.c +++ b/xc/lib/Xft/xftcfg.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftcfg.c,v 1.8 2001/01/02 02:46:51 keithp Exp $ + * $XFree86: xc/lib/Xft/xftcfg.c,v 1.9 2001/03/31 01:57:20 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -39,7 +39,7 @@ char XftConfigDefaultCache[] = "~/.xftcache"; char *XftConfigCache = 0; static XftSubst *XftSubsts; -/* #define XFT_DEBUG_EDIT */ +/* #define XFT_DEBUG_EDIT */ Bool XftConfigAddDir (char *d) @@ -154,14 +154,21 @@ typedef struct _XftSubState { XftValueList *value; } XftSubState; +static XftMatrix XftIdentityMatrix = { 1, 0, 0, 1 }; + static XftValue -_XftConfigPromote (XftValue v) +_XftConfigPromote (XftValue v, XftValue u) { if (v.type == XftTypeInteger) { v.type = XftTypeDouble; v.u.d = (double) v.u.i; } + if (v.type == XftTypeVoid && u.type == XftTypeMatrix) + { + v.u.m = &XftIdentityMatrix; + v.type = XftTypeMatrix; + } return v; } @@ -174,8 +181,8 @@ _XftConfigCompareValue (XftValue m, if (m.type == XftTypeVoid) return True; - m = _XftConfigPromote (m); - v = _XftConfigPromote (v); + m = _XftConfigPromote (m, v); + v = _XftConfigPromote (v, m); if (m.type == v.type) { ret = False; @@ -286,6 +293,10 @@ _XftConfigEvaluate (XftPattern *p, XftExpr *e) v.type = XftTypeString; v.u.s = e->u.sval; break; + case XftOpMatrix: + v.type = XftTypeMatrix; + v.u.m = e->u.mval; + break; case XftOpBool: v.type = XftTypeBool; v.u.b = e->u.bval; @@ -321,8 +332,8 @@ _XftConfigEvaluate (XftPattern *p, XftExpr *e) case XftOpDivide: vl = _XftConfigEvaluate (p, e->u.tree.left); vr = _XftConfigEvaluate (p, e->u.tree.right); - vl = _XftConfigPromote (vl); - vr = _XftConfigPromote (vr); + vl = _XftConfigPromote (vl, vr); + vr = _XftConfigPromote (vr, vl); if (vl.type == vr.type) { switch (vl.type) { @@ -427,6 +438,26 @@ _XftConfigEvaluate (XftPattern *p, XftExpr *e) v.type = XftTypeVoid; break; } + case XftTypeMatrix: + switch (e->op) { + case XftOpEqual: + v.type = XftTypeBool; + v.u.b = XftMatrixEqual (vl.u.m, vr.u.m) == 0; + break; + case XftOpNotEqual: + v.type = XftTypeBool; + v.u.b = XftMatrixEqual (vl.u.m, vr.u.m) != 0; + break; + case XftOpTimes: + v.type = XftTypeMatrix; + v.u.m = malloc (sizeof (XftMatrix)); + XftMatrixMultiply (v.u.m, vl.u.m, vr.u.m); + break; + default: + v.type = XftTypeVoid; + break; + } + break; default: v.type = XftTypeVoid; break; diff --git a/xc/lib/Xft/xftdbg.c b/xc/lib/Xft/xftdbg.c index 69e3e6695..e58c166a2 100644 --- a/xc/lib/Xft/xftdbg.c +++ b/xc/lib/Xft/xftdbg.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftdbg.c,v 1.1 2000/11/29 08:39:21 keithp Exp $ + * $XFree86: xc/lib/Xft/xftdbg.c,v 1.3 2001/03/31 01:57:20 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -44,6 +44,9 @@ XftValuePrint (XftValue v) case XftTypeBool: printf (" %s", v.u.b ? "True" : "False"); break; + case XftTypeMatrix: + printf (" (%f %f; %f %f)", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy); + break; } } @@ -78,6 +81,7 @@ XftOpPrint (XftOp op) case XftOpInteger: printf ("Integer"); break; case XftOpDouble: printf ("Double"); break; case XftOpString: printf ("String"); break; + case XftOpMatrix: printf ("Matrix"); break; case XftOpBool: printf ("Bool"); break; case XftOpField: printf ("Field"); break; case XftOpAssign: printf ("Assign"); break; @@ -126,6 +130,11 @@ XftExprPrint (XftExpr *expr) case XftOpInteger: printf ("%d", expr->u.ival); break; case XftOpDouble: printf ("%g", expr->u.dval); break; case XftOpString: printf ("\"%s\"", expr->u.sval); break; + case XftOpMatrix: printf ("[%g %g %g %g]", + expr->u.mval->xx, + expr->u.mval->xy, + expr->u.mval->yx, + expr->u.mval->yy); case XftOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break; case XftOpField: printf ("%s", expr->u.field); break; case XftOpQuest: diff --git a/xc/lib/Xft/xftdraw.c b/xc/lib/Xft/xftdraw.c index d8f2c9835..409a5c947 100644 --- a/xc/lib/Xft/xftdraw.c +++ b/xc/lib/Xft/xftdraw.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftdraw.c,v 1.12 2000/12/20 00:28:44 keithp Exp $ + * $XFree86: xc/lib/Xft/xftdraw.c,v 1.14 2001/04/01 14:00:01 tsi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "xftint.h" #include <X11/Xutil.h> @@ -150,11 +151,13 @@ XftDrawChange (XftDraw *draw, void XftDrawDestroy (XftDraw *draw) { + int n; + if (draw->render_able) { XRenderFreePicture (draw->dpy, draw->render.pict); - XFreePixmap (draw->dpy, draw->render.fg_pix); - XRenderFreePicture (draw->dpy, draw->render.fg_pict); + for (n = 0; n < XFT_DRAW_N_SRC; n++) + XRenderFreePicture (draw->dpy, draw->render.src[n].pict); } if (draw->core_set) XFreeGC (draw->dpy, draw->core.draw_gc); @@ -166,13 +169,16 @@ XftDrawDestroy (XftDraw *draw) Bool XftDrawRenderPrepare (XftDraw *draw, XftColor *color, - XftFont *font) + XftFont *font, + int src) { if (!draw->render_set) { XRenderPictFormat *format; XRenderPictFormat *pix_format; XRenderPictureAttributes pa; + int n; + Pixmap pix; draw->render_set = True; draw->render_able = False; @@ -184,14 +190,22 @@ XftDrawRenderPrepare (XftDraw *draw, draw->render.pict = XRenderCreatePicture (draw->dpy, draw->drawable, format, 0, 0); - draw->render.fg_pix = XCreatePixmap (draw->dpy, draw->drawable, - 1, 1, pix_format->depth); - pa.repeat = True; - draw->render.fg_pict = XRenderCreatePicture (draw->dpy, - draw->render.fg_pix, - pix_format, - CPRepeat, &pa); - draw->render.fg_color.red = ~color->color.red; + for (n = 0; n < XFT_DRAW_N_SRC; n++) + { + pix = XCreatePixmap (draw->dpy, draw->drawable, + 1, 1, pix_format->depth); + pa.repeat = True; + draw->render.src[n].pict = XRenderCreatePicture (draw->dpy, + pix, + pix_format, + CPRepeat, &pa); + XFreePixmap (draw->dpy, pix); + + draw->render.src[n].color = color->color; + XRenderFillRectangle (draw->dpy, PictOpSrc, + draw->render.src[n].pict, + &color->color, 0, 0, 1, 1); + } if (draw->clip) XRenderSetPictureClipRegion (draw->dpy, draw->render.pict, draw->clip); @@ -199,7 +213,8 @@ XftDrawRenderPrepare (XftDraw *draw, } if (!draw->render_able) return False; - if (memcmp (&color->color, &draw->render.fg_color, sizeof (XRenderColor))) + if (memcmp (&color->color, &draw->render.src[src].color, + sizeof (XRenderColor))) { if (_XftFontDebug () & XFT_DBG_DRAW) { @@ -209,9 +224,10 @@ XftDrawRenderPrepare (XftDraw *draw, color->color.green, color->color.blue); } - XRenderFillRectangle (draw->dpy, PictOpSrc, draw->render.fg_pict, + XRenderFillRectangle (draw->dpy, PictOpSrc, + draw->render.src[src].pict, &color->color, 0, 0, 1, 1); - draw->render.fg_color = color->color; + draw->render.src[src].color = color->color; } return True; } @@ -275,9 +291,11 @@ XftDrawString8 (XftDraw *draw, (char *) string, len); } #ifdef FREETYPE2 - else if (XftDrawRenderPrepare (draw, color, font)) + else if (XftDrawRenderPrepare (draw, color, font, XFT_DRAW_SRC_TEXT)) { - XftRenderString8 (draw->dpy, draw->render.fg_pict, font->u.ft.font, + XftRenderString8 (draw->dpy, + draw->render.src[XFT_DRAW_SRC_TEXT].pict, + font->u.ft.font, draw->render.pict, 0, 0, x, y, string, len); } #endif @@ -307,9 +325,11 @@ XftDrawString16 (XftDraw *draw, free (xc); } #ifdef FREETYPE2 - else if (XftDrawRenderPrepare (draw, color, font)) + else if (XftDrawRenderPrepare (draw, color, font, XFT_DRAW_SRC_TEXT)) { - XftRenderString16 (draw->dpy, draw->render.fg_pict, font->u.ft.font, + XftRenderString16 (draw->dpy, + draw->render.src[XFT_DRAW_SRC_TEXT].pict, + font->u.ft.font, draw->render.pict, 0, 0, x, y, string, len); } #endif @@ -337,9 +357,11 @@ XftDrawString32 (XftDraw *draw, free (xc); } #ifdef FREETYPE2 - else if (XftDrawRenderPrepare (draw, color, font)) + else if (XftDrawRenderPrepare (draw, color, font, XFT_DRAW_SRC_TEXT)) { - XftRenderString32 (draw->dpy, draw->render.fg_pict, font->u.ft.font, + XftRenderString32 (draw->dpy, + draw->render.src[XFT_DRAW_SRC_TEXT].pict, + font->u.ft.font, draw->render.pict, 0, 0, x, y, string, len); } #endif @@ -371,9 +393,11 @@ XftDrawStringUtf8 (XftDraw *draw, free (xc); } #ifdef FREETYPE2 - else if (XftDrawRenderPrepare (draw, color, font)) + else if (XftDrawRenderPrepare (draw, color, font, XFT_DRAW_SRC_TEXT)) { - XftRenderStringUtf8 (draw->dpy, draw->render.fg_pict, font->u.ft.font, + XftRenderStringUtf8 (draw->dpy, + draw->render.src[XFT_DRAW_SRC_TEXT].pict, + font->u.ft.font, draw->render.pict, 0, 0, x, y, string, len); } #endif @@ -388,7 +412,7 @@ XftDrawRect (XftDraw *draw, unsigned int width, unsigned int height) { - if (XftDrawRenderPrepare (draw, color, 0)) + if (XftDrawRenderPrepare (draw, color, 0, XFT_DRAW_SRC_RECT)) { XRenderFillRectangle (draw->dpy, PictOpSrc, draw->render.pict, &color->color, x, y, width, height); diff --git a/xc/lib/Xft/xftextent.c b/xc/lib/Xft/xftextent.c index 3bff6d535..dab433f9b 100644 --- a/xc/lib/Xft/xftextent.c +++ b/xc/lib/Xft/xftextent.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftextent.c,v 1.5 2000/12/20 00:28:44 keithp Exp $ + * $XFree86: xc/lib/Xft/xftextent.c,v 1.6 2001/04/01 14:00:01 tsi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -23,6 +23,7 @@ */ #include <stdlib.h> +#include <string.h> #include "xftint.h" void diff --git a/xc/lib/Xft/xftfreetype.c b/xc/lib/Xft/xftfreetype.c index e891e0577..a750c10d0 100644 --- a/xc/lib/Xft/xftfreetype.c +++ b/xc/lib/Xft/xftfreetype.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftfreetype.c,v 1.10 2001/01/26 20:51:15 keithp Exp $ + * $XFree86: xc/lib/Xft/xftfreetype.c,v 1.12 2001/04/01 14:00:01 tsi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -24,6 +24,7 @@ #include <stdlib.h> #include <stdio.h> +#include <string.h> #include "xftint.h" FT_Library _XftFTlibrary; @@ -43,6 +44,11 @@ static XftFtEncoding xftFtEncoding[] = { #define NUM_FT_ENCODINGS (sizeof xftFtEncoding / sizeof xftFtEncoding[0]) +#define FT_Matrix_Equal(a,b) ((a)->xx == (b)->xx && \ + (a)->yy == (b)->yy && \ + (a)->xy == (b)->xy && \ + (a)->yx == (b)->yx) + XftPattern * XftFreeTypeQuery (const char *file, int id, int *count) { @@ -136,7 +142,7 @@ XftFreeTypeQuery (const char *file, int id, int *count) if (!XftPatternAddString (pat, XFT_ENCODING, "glyphs-fontspecific")) goto bail1; - + FT_Done_Face (face); return pat; @@ -160,6 +166,7 @@ typedef struct _XftFtFile { FT_Face face; FT_F26Dot6 size; + FT_Matrix matrix; int charmap; } XftFtFile; @@ -207,7 +214,7 @@ _XftFreeTypeOpenFile (char *file, int id) } Bool -XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap) +XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap, FT_Matrix *matrix) { XftFtFile *f, **prev; @@ -239,6 +246,17 @@ XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap) return False; f->charmap = charmap; } + if (!FT_Matrix_Equal (&f->matrix, matrix)) + { + if (_XftFontDebug() & XFT_DBG_GLYPH) + printf ("Set face matrix to (%g,%g,%g,%g)\n", + (double) matrix->xx / 0x10000, + (double) matrix->xy / 0x10000, + (double) matrix->yx / 0x10000, + (double) matrix->yy / 0x10000); + FT_Set_Transform (face, matrix, 0); + f->matrix = *matrix; + } break; } } @@ -300,6 +318,8 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) int j; FT_Encoding encoding; int charmap; + FT_Matrix matrix; + XftMatrix *font_matrix; int extra; int height, ascent, descent; @@ -338,7 +358,7 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) default: goto bail0; } - + switch (XftPatternGetBool (pattern, XFT_ANTIALIAS, 0, &antialias)) { case XftResultNoMatch: antialias = True; @@ -368,6 +388,32 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) default: goto bail1; } + + if (XftPatternGetInteger (pattern, XFT_CHAR_WIDTH, + 0, &char_width) != XftResultMatch) + { + char_width = 0; + } + else if (char_width) + spacing = XFT_MONO; + + matrix.xx = matrix.yy = 0x10000; + matrix.xy = matrix.yx = 0; + + switch (XftPatternGetMatrix (pattern, XFT_MATRIX, 0, &font_matrix)) { + case XftResultNoMatch: + break; + case XftResultMatch: + matrix.xx = 0x10000L * font_matrix->xx; + matrix.yy = 0x10000L * font_matrix->yy; + matrix.xy = 0x10000L * font_matrix->xy; + matrix.yx = 0x10000L * font_matrix->yx; + break; + default: + goto bail1; + } + + if (XftPatternGetInteger (pattern, XFT_CHAR_WIDTH, 0, &char_width) != XftResultMatch) @@ -413,7 +459,8 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) gs->font.spacing == spacing && gs->font.charmap == charmap && gs->font.rgba == rgba && - gs->font.antialias == antialias) + gs->font.antialias == antialias && + FT_Matrix_Equal (&gs->font.matrix, &matrix)) { ++gs->ref; if (_XftFontDebug () & XFT_DBG_REF) @@ -503,9 +550,7 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) if (!format) goto bail2; - font->size = size; - - if (!XftFreeTypeSetFace (face, size, charmap)) + if (!XftFreeTypeSetFace (face, size, charmap, &matrix)) goto bail2; descent = -(face->size->metrics.descender >> 6); @@ -540,6 +585,7 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) font->glyphset = XRenderCreateGlyphSet (dpy, format); + font->size = size; font->spacing = spacing; font->format = format; font->realized =0; @@ -547,6 +593,9 @@ XftFreeTypeOpen (Display *dpy, XftPattern *pattern) font->rgba = rgba; font->antialias = antialias; font->charmap = charmap; + font->transform = (matrix.xx != 0x10000 || matrix.xy != 0 || + matrix.yx != 0 || matrix.yy != 0x10000); + font->matrix = matrix; font->face = face; return font; diff --git a/xc/lib/Xft/xftglyphs.c b/xc/lib/Xft/xftglyphs.c index 6a6f2c274..b06431131 100644 --- a/xc/lib/Xft/xftglyphs.c +++ b/xc/lib/Xft/xftglyphs.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftglyphs.c,v 1.9 2001/01/26 20:51:16 keithp Exp $ + * $XFree86: xc/lib/Xft/xftglyphs.c,v 1.12 2001/04/01 14:00:01 tsi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "xftint.h" #include <freetype/ftoutln.h> @@ -74,29 +75,33 @@ XftGlyphLoad (Display *dpy, int vmul = 1; FT_Bitmap ftbit; FT_Matrix matrix; + FT_Vector vector; + Bool subpixel = False; - if (!XftFreeTypeSetFace (font->face, font->size, font->charmap)) + if (!XftFreeTypeSetFace (font->face, font->size, font->charmap, &font->matrix)) return ; + matrix.xx = matrix.yy = 0x10000L; + matrix.xy = matrix.yx = 0; + if (font->antialias) { switch (font->rgba) { case XFT_RGBA_RGB: case XFT_RGBA_BGR: - matrix.xx = 0x30000L; - matrix.yy = 0x10000L; - matrix.xy = matrix.yx = 0; + matrix.xx *= 3; + subpixel = True; hmul = 3; break; case XFT_RGBA_VRGB: case XFT_RGBA_VBGR: - matrix.xx = 0x10000L; - matrix.yy = 0x30000L; - matrix.xy = matrix.yx = 0; + matrix.yy *= 3; vmul = 3; + subpixel = True; break; } } + while (nglyph--) { charcode = (FT_ULong) *glyphs++; @@ -127,14 +132,56 @@ XftGlyphLoad (Display *dpy, #define ROUND(x) (((x)+32) & -64) glyph = font->face->glyph; - - left = FLOOR( glyph->metrics.horiBearingX ); - right = CEIL( glyph->metrics.horiBearingX + glyph->metrics.width ); + + if(font->transform) + { + /* + * calculate the true width by transforming all four corners. + */ + int xc, yc; + left = right = top = bottom = 0; + for(xc = 0; xc <= 1; xc ++) { + for(yc = 0; yc <= 1; yc++) { + vector.x = glyph->metrics.horiBearingX + xc * glyph->metrics.width; + vector.y = glyph->metrics.horiBearingY - yc * glyph->metrics.height; + FT_Vector_Transform(&vector, &font->matrix); + if (_XftFontDebug() & XFT_DBG_GLYPH) + printf("Trans %d %d: %d %d\n", (int) xc, (int) yc, + (int) vector.x, (int) vector.y); + if(xc == 0 && yc == 0) { + left = right = vector.x; + top = bottom = vector.y; + } else { + if(left > vector.x) left = vector.x; + if(right < vector.x) right = vector.x; + if(bottom > vector.y) bottom = vector.y; + if(top < vector.y) top = vector.y; + } + + } + } + left = FLOOR(left); + right = CEIL(right); + bottom = FLOOR(bottom); + top = CEIL(top); + + } else { + left = FLOOR( glyph->metrics.horiBearingX ); + right = CEIL( glyph->metrics.horiBearingX + glyph->metrics.width ); + + top = CEIL( glyph->metrics.horiBearingY ); + bottom = FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height ); + } + width = TRUNC(right - left); + height = TRUNC( top - bottom ); + + /* * Try to keep monospace fonts ink-inside + * XXX transformed? */ - if (font->spacing != XFT_PROPORTIONAL) + if (font->spacing != XFT_PROPORTIONAL && !font->transform) { if (TRUNC(right) > font->max_advance_width) { @@ -149,10 +196,6 @@ XftGlyphLoad (Display *dpy, } } - top = CEIL( glyph->metrics.horiBearingY ); - bottom = FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height ); - height = TRUNC( top - bottom ); - if ( glyph->format == ft_glyph_format_outline ) { if (font->antialias) @@ -183,7 +226,7 @@ XftGlyphLoad (Display *dpy, ftbit.buffer = bufBitmap; - if (font->antialias && font->rgba != XFT_RGBA_NONE) + if (subpixel) FT_Outline_Transform (&glyph->outline, &matrix); FT_Outline_Translate ( &glyph->outline, -left*hmul, -bottom*vmul ); @@ -217,6 +260,13 @@ XftGlyphLoad (Display *dpy, if (_XftFontDebug() & XFT_DBG_GLYPH) { printf ("char 0x%x (%c):\n", (int) charcode, (char) charcode); + printf (" xywh (%d %d %d %d), trans (%d %d %d %d) wh (%d %d)\n", + (int) glyph->metrics.horiBearingX, + (int) glyph->metrics.horiBearingY, + (int) glyph->metrics.width, + (int) glyph->metrics.height, + left, right, top, bottom, + width, height); if (_XftFontDebug() & XFT_DBG_GLYPHV) { int x, y; @@ -238,7 +288,7 @@ XftGlyphLoad (Display *dpy, printf ("%c", line[x>>3] & (1 << (x & 7)) ? '#' : ' '); } } - printf ("\n"); + printf ("|\n"); line += pitch; } printf ("\n"); @@ -259,17 +309,28 @@ XftGlyphLoad (Display *dpy, gi->y = TRUNC(top); if (font->spacing != XFT_PROPORTIONAL) { - gi->xOff = font->max_advance_width; - gi->yOff = 0; + if (font->transform) + { + vector.x = font->max_advance_width; + vector.y = 0; + FT_Vector_Transform (&vector, &font->matrix); + gi->xOff = vector.x; + gi->yOff = -vector.y; + } + else + { + gi->xOff = font->max_advance_width; + gi->yOff = 0; + } } else { gi->xOff = TRUNC(ROUND(glyph->advance.x)); - gi->yOff = TRUNC(ROUND(glyph->advance.y)); + gi->yOff = -TRUNC(ROUND(glyph->advance.y)); } g = charcode; - if (font->antialias && font->rgba != XFT_RGBA_NONE) + if (subpixel) { int x, y; unsigned char *in_line, *out_line, *in; diff --git a/xc/lib/Xft/xftgram.y b/xc/lib/Xft/xftgram.y index a6cb6ef4b..b58dcddbf 100644 --- a/xc/lib/Xft/xftgram.y +++ b/xc/lib/Xft/xftgram.y @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftgram.y,v 1.3 2001/01/02 02:46:51 keithp Exp $ + * $XFree86: xc/lib/Xft/xftgram.y,v 1.4 2001/03/31 01:57:20 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -28,6 +28,8 @@ #include <stdio.h> #include "xftint.h" +static XftMatrix matrix; + %} %union { @@ -49,7 +51,7 @@ %token <ival> ANY ALL %token <ival> DIR CACHE INCLUDE INCLUDEIF MATCH EDIT %token <ival> TOK_TRUE TOK_FALSE TOK_NIL -%token <ival> EQUAL SEMI +%token <ival> EQUAL SEMI OS CS %type <eval> expr %type <vval> value @@ -60,6 +62,7 @@ %type <qval> qual %type <oval> compare %type <tval> tests test +%type <dval> number %right <ival> QUEST COLON %left <ival> OROR @@ -149,6 +152,22 @@ value : INTEGER { $$.type = XftTypeVoid; } + | matrix + { + $$.type = XftTypeMatrix; + $$.u.m = &matrix; + } + ; +matrix : OS number number number number CS + { + matrix.xx = $2; + matrix.xy = $3; + matrix.yx = $4; + matrix.__REALLY_YY__ = $5; + } +number : INTEGER + { $$ = (double) $1; } + | DOUBLE ; edits : edit edits { $1->next = $2; $$ = $1; } @@ -177,6 +196,8 @@ expr : INTEGER { $$ = XftExprCreateBool (False); } | TOK_NIL { $$ = XftExprCreateNil (); } + | matrix + { $$ = XftExprCreateMatrix (&matrix); } | NAME { $$ = XftExprCreateField ($1); } | expr OROR expr @@ -241,6 +262,8 @@ XftTestCreate (XftQual qual, const char *field, XftOp compare, XftValue value) test->op = compare; if (value.type == XftTypeString) value.u.s = _XftSaveString (value.u.s); + else if (value.type == XftTypeMatrix) + value.u.m = _XftSaveMatrix (value.u.m); test->value = value; } return test; @@ -286,6 +309,19 @@ XftExprCreateString (const char *s) } XftExpr * +XftExprCreateMatrix (const XftMatrix *m) +{ + XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr)); + + if (e) + { + e->op = XftOpMatrix; + e->u.mval = _XftSaveMatrix (m); + } + return e; +} + +XftExpr * XftExprCreateBool (Bool b) { XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr)); @@ -348,6 +384,9 @@ XftExprDestroy (XftExpr *e) case XftOpString: free (e->u.sval); break; + case XftOpMatrix: + free (e->u.mval); + break; case XftOpBool: break; case XftOpField: diff --git a/xc/lib/Xft/xftint.h b/xc/lib/Xft/xftint.h index 53b95facc..37b8e8d81 100644 --- a/xc/lib/Xft/xftint.h +++ b/xc/lib/Xft/xftint.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftint.h,v 1.21 2001/01/26 20:51:16 keithp Exp $ + * $XFree86: xc/lib/Xft/xftint.h,v 1.24 2001/03/31 01:57:20 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -42,6 +42,11 @@ typedef struct _XftSymbolic { int value; } XftSymbolic; +#define XFT_DRAW_N_SRC 2 + +#define XFT_DRAW_SRC_TEXT 0 +#define XFT_DRAW_SRC_RECT 1 + struct _XftDraw { Display *dpy; Drawable drawable; @@ -53,9 +58,10 @@ struct _XftDraw { Bool render_able; struct { Picture pict; - Pixmap fg_pix; - Picture fg_pict; - XRenderColor fg_color; + struct { + Picture pict; + XRenderColor color; + } src[XFT_DRAW_N_SRC]; } render; struct { GC draw_gc; @@ -97,7 +103,7 @@ extern XftFontSet *_XftFontSet; #define XFT_DBG_MATCHV 1024 typedef enum _XftOp { - XftOpInteger, XftOpDouble, XftOpString, XftOpBool, XftOpNil, + XftOpInteger, XftOpDouble, XftOpString, XftOpMatrix, XftOpBool, XftOpNil, XftOpField, XftOpAssign, XftOpPrepend, XftOpAppend, XftOpQuest, @@ -110,11 +116,12 @@ typedef enum _XftOp { typedef struct _XftExpr { XftOp op; union { - int ival; - double dval; - char *sval; - Bool bval; - char *field; + int ival; + double dval; + char *sval; + XftMatrix *mval; + Bool bval; + char *field; struct { struct _XftExpr *left, *right; } tree; @@ -185,6 +192,9 @@ typedef struct _XftSubst { case XftTypeBool: \ __v__.u.b = va_arg (va, Bool); \ break; \ + case XftTypeMatrix: \ + __v__.u.m = va_arg (va, XftMatrix *); \ + break; \ } \ if (!XftPatternAdd (__p__, __o__, __v__, True)) \ goto _XftPatternVapBuild_bail1; \ @@ -333,7 +343,8 @@ XftDisplayGetFontSet (Display *dpy); Bool XftDrawRenderPrepare (XftDraw *draw, XftColor *color, - XftFont *font); + XftFont *font, + int src); Bool XftDrawCorePrepare (XftDraw *draw, @@ -372,6 +383,9 @@ XftExpr * XftExprCreateString (const char *s); XftExpr * +XftExprCreateMatrix (const XftMatrix *m); + +XftExpr * XftExprCreateBool (Bool b); XftExpr * @@ -393,8 +407,6 @@ void XftEditDestroy (XftEdit *e); /* xftinit.c */ -Bool -XftInit (char *config); /* xftlex.l */ extern int XftConfigLineno; @@ -440,6 +452,10 @@ XftNameConstant (char *string, int *result); /* xftrender.c */ +/* xftmatrix.c */ +XftMatrix * +_XftSaveMatrix (const XftMatrix *mat); + /* xftstr.c */ char * _XftSaveString (const char *s); diff --git a/xc/lib/Xft/xftlex.l b/xc/lib/Xft/xftlex.l index 14773789b..c426fa315 100644 --- a/xc/lib/Xft/xftlex.l +++ b/xc/lib/Xft/xftlex.l @@ -1,6 +1,6 @@ %{ /* - * $XFree86: xc/lib/Xft/xftlex.l,v 1.4 2001/01/02 02:46:51 keithp Exp $ + * $XFree86: xc/lib/Xft/xftlex.l,v 1.5 2001/03/31 01:57:20 keithp Exp $ * * Copyright (c) 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -124,6 +124,8 @@ all return ALL; ">" return MORE; "!=" return NOTEQ; "?" return QUEST; +"[" return OS; +"]" return CS; \"([^\n\"]|\\\")*\" { yytext[yyleng - 1] = '\0'; yylval.sval = yytext+1; diff --git a/xc/lib/Xft/xftmatch.c b/xc/lib/Xft/xftmatch.c index 2f274c302..e0e9b0f00 100644 --- a/xc/lib/Xft/xftmatch.c +++ b/xc/lib/Xft/xftmatch.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftmatch.c,v 1.4 2001/01/26 20:51:17 keithp Exp $ + * $XFree86: xc/lib/Xft/xftmatch.c,v 1.5 2001/03/06 18:00:26 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -97,9 +97,9 @@ _XftCompareSize (char *object, XftValue value1, XftValue value2) static XftMatcher _XftMatchers [] = { { XFT_FOUNDRY, _XftCompareString, }, { XFT_ENCODING, _XftCompareString, }, - { XFT_SPACING, _XftCompareInteger, }, { XFT_ANTIALIAS, _XftCompareBool, }, { XFT_FAMILY, _XftCompareString, }, + { XFT_SPACING, _XftCompareInteger, }, { XFT_PIXEL_SIZE, _XftCompareSize, }, { XFT_STYLE, _XftCompareString, }, { XFT_SLANT, _XftCompareInteger, }, diff --git a/xc/lib/Xft/xftmatrix.c b/xc/lib/Xft/xftmatrix.c new file mode 100644 index 000000000..bd6f155ed --- /dev/null +++ b/xc/lib/Xft/xftmatrix.c @@ -0,0 +1,104 @@ +/* + * $XFree86: xc/lib/Xft/xftmatrix.c,v 1.1 2001/03/30 18:50:18 keithp Exp $ + * + * Copyright © 2000 Tuomas J. Lukka + * + * 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 Tuomas Lukka not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Tuomas Lukka makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * TUOMAS LUKKA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL TUOMAS LUKKA 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 <math.h> +#include <stdlib.h> +#include <ctype.h> +#include "xftint.h" + +XftMatrix * +_XftSaveMatrix (const XftMatrix *mat) +{ + XftMatrix *r; + if(!mat) + return 0; + r = (XftMatrix *) malloc (sizeof (*r) ); + if (!r) + return 0; + *r = *mat; + return r; +} + +int +XftMatrixEqual (const XftMatrix *mat1, const XftMatrix *mat2) +{ + if(mat1 == mat2) return True; + if(mat1 == 0 || mat2 == 0) return False; + return mat1->xx == mat2->xx && + mat1->xy == mat2->xy && + mat1->yx == mat2->yx && + mat1->yy == mat2->yy; +} + +void +XftMatrixMultiply (XftMatrix *result, XftMatrix *a, XftMatrix *b) +{ + XftMatrix r; + + r.xx = a->xx * b->xx + a->xy * b->yx; + r.xy = a->xx * b->xy + a->xy * b->yy; + r.yx = a->yx * b->xx + a->yy * b->yx; + r.yy = a->yx * b->xy + a->yy * b->yy; + *result = r; +} + +void +XftMatrixRotate (XftMatrix *m, double c, double s) +{ + XftMatrix r; + + /* + * X Coordinate system is upside down, swap to make + * rotations counterclockwise + */ + r.xx = c; + r.xy = -s; + r.yx = s; + r.yy = c; + XftMatrixMultiply (m, &r, m); +} + +void +XftMatrixScale (XftMatrix *m, double sx, double sy) +{ + XftMatrix r; + + r.xx = sx; + r.xy = 0; + r.yx = 0; + r.yy = sy; + XftMatrixMultiply (m, &r, m); +} + +void +XftMatrixShear (XftMatrix *m, double sh, double sv) +{ + XftMatrix r; + + r.xx = 1; + r.xy = sh; + r.yx = sv; + r.yy = 1; + XftMatrixMultiply (m, &r, m); +} diff --git a/xc/lib/Xft/xftname.c b/xc/lib/Xft/xftname.c index 39e40e0b5..39af64a43 100644 --- a/xc/lib/Xft/xftname.c +++ b/xc/lib/Xft/xftname.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftname.c,v 1.9 2001/01/26 20:51:17 keithp Exp $ + * $XFree86: xc/lib/Xft/xftname.c,v 1.10 2001/03/30 18:50:18 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -57,6 +57,7 @@ static const XftObjectType _XftObjectTypes[] = { { XFT_MINSPACE, XftTypeBool, }, { XFT_CHAR_WIDTH, XftTypeInteger }, { XFT_CHAR_HEIGHT, XftTypeInteger }, + { XFT_MATRIX, XftTypeMatrix }, }; #define NUM_OBJECT_TYPES (sizeof _XftObjectTypes / sizeof _XftObjectTypes[0]) @@ -128,7 +129,7 @@ XftNameConstant (char *string, int *result) } static XftValue -_XftNameConvert (XftType type, char *string) +_XftNameConvert (XftType type, char *string, XftMatrix *m) { XftValue v; @@ -147,6 +148,10 @@ _XftNameConvert (XftType type, char *string) case XftTypeDouble: v.u.d = strtod (string, 0); break; + case XftTypeMatrix: + v.u.m = m; + sscanf (string, "%lg %lg %lg %lg", &m->xx, &m->xy, &m->yx, &m->yy); + break; default: break; } @@ -187,6 +192,7 @@ XftNameParse (const char *name) char *e; char delim; XftValue v; + XftMatrix m; const XftObjectType *t; XftConstant *c; @@ -236,7 +242,7 @@ XftNameParse (const char *name) name = _XftNameFindNext (name, ":,", save, &delim); if (save[0] && t) { - v = _XftNameConvert (t->type, save); + v = _XftNameConvert (t->type, save, &m); if (!XftPatternAdd (pat, t->object, v, True)) goto bail2; } @@ -308,6 +314,10 @@ _XftNameUnparseValue (XftValue v, char *escape, char **destp, int *lenp) return _XftNameUnparseString (v.u.s, escape, destp, lenp); case XftTypeBool: return _XftNameUnparseString (v.u.b ? "True" : "False", 0, destp, lenp); + case XftTypeMatrix: + sprintf (temp, "%g %g %g %g", + v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy); + return _XftNameUnparseString (temp, 0, destp, lenp); } return False; } diff --git a/xc/lib/Xft/xftpat.c b/xc/lib/Xft/xftpat.c index 6bd372c1f..d93dacae2 100644 --- a/xc/lib/Xft/xftpat.c +++ b/xc/lib/Xft/xftpat.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftpat.c,v 1.5 2000/12/14 23:03:56 keithp Exp $ + * $XFree86: xc/lib/Xft/xftpat.c,v 1.6 2001/03/30 18:50:18 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -45,6 +45,8 @@ XftValueDestroy (XftValue v) { if (v.type == XftTypeString) free (v.u.s); + if( v.type == XftTypeMatrix) + free (v.u.m); } void @@ -55,6 +57,8 @@ XftValueListDestroy (XftValueList *l) { if (l->value.type == XftTypeString) free (l->value.u.s); + if (l->value.type == XftTypeMatrix) + free (l->value.u.m); next = l->next; free (l); } @@ -136,6 +140,12 @@ XftPatternAdd (XftPattern *p, const char *object, XftValue value, Bool append) if (!value.u.s) goto bail1; } + else if (value.type == XftTypeMatrix) + { + value.u.m = _XftSaveMatrix (value.u.m); + if (!value.u.m) + goto bail1; + } new->value = value; new->next = 0; @@ -160,6 +170,8 @@ XftPatternAdd (XftPattern *p, const char *object, XftValue value, Bool append) bail2: if (value.type == XftTypeString) free (value.u.s); + else if (value.type == XftTypeMatrix) + free (value.u.m); bail1: free (new); bail0: @@ -220,6 +232,16 @@ XftPatternAddString (XftPattern *p, const char *object, const char *s) return XftPatternAdd (p, object, v, True); } +Bool +XftPatternAddMatrix (XftPattern *p, const char *object, const XftMatrix *s) +{ + XftValue v; + + v.type = XftTypeMatrix; + v.u.m = (XftMatrix *) s; + return XftPatternAdd (p, object, v, True); +} + Bool XftPatternAddBool (XftPattern *p, const char *object, Bool b) @@ -312,6 +334,22 @@ XftPatternGetString (XftPattern *p, const char *object, int id, char **s) } XftResult +XftPatternGetMatrix (XftPattern *p, const char *object, int id, XftMatrix **m) +{ + XftValue v; + XftResult r; + + r = XftPatternGet (p, object, id, &v); + if (r != XftResultMatch) + return r; + if (v.type != XftTypeMatrix) + return XftResultTypeMismatch; + *m = v.u.m; + return XftResultMatch; +} + + +XftResult XftPatternGetBool (XftPattern *p, const char *object, int id, Bool *b) { XftValue v; diff --git a/xc/lib/Xft/xftstr.c b/xc/lib/Xft/xftstr.c index e17c0fb40..8ab743b6f 100644 --- a/xc/lib/Xft/xftstr.c +++ b/xc/lib/Xft/xftstr.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftstr.c,v 1.4 2000/12/20 10:24:27 keithp Exp $ + * $XFree86: xc/lib/Xft/xftstr.c,v 1.6 2001/04/01 14:00:01 tsi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -24,6 +24,7 @@ #include <stdlib.h> #include <ctype.h> +#include <string.h> #include "xftint.h" char * @@ -31,6 +32,8 @@ _XftSaveString (const char *s) { char *r; + if (!s) + return 0; r = (char *) malloc (strlen (s) + 1); if (!r) return 0; diff --git a/xc/lib/Xmu/CursorName.c b/xc/lib/Xmu/CursorName.c index 67494fd34..e22eee8c1 100644 --- a/xc/lib/Xmu/CursorName.c +++ b/xc/lib/Xmu/CursorName.c @@ -21,9 +21,8 @@ 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/Xmu/CursorName.c,v 3.5 2001/01/17 19:42:54 dawes Exp $ */ +/* $XFree86: xc/lib/Xmu/CursorName.c,v 3.6 2001/03/30 02:15:19 keithp Exp $ */ -#include <X11/Intrinsic.h> #include <X11/Xmu/CharSet.h> #include <X11/Xmu/CurUtil.h> #include <X11/cursorfont.h> @@ -113,14 +112,15 @@ XmuCursorNameToIndex(_Xconst char *name) {"watch", XC_watch}, {"xterm", XC_xterm}, }; +#define NUM_CURSOR_NAMES (sizeof (cursor_names) / sizeof (cursor_names[0])) register _Xconst struct _CursorName *table; - register Cardinal i; + register int i; char tmp[40]; if (strlen (name) >= sizeof tmp) return -1; XmuCopyISOLatin1Lowered (tmp, name); - for (i=0, table=cursor_names; i < XtNumber(cursor_names); i++, table++ ) { + for (i=0, table=cursor_names; i < NUM_CURSOR_NAMES; i++, table++ ) { if (strcmp(tmp, table->name) == 0) return table->shape; } diff --git a/xc/lib/Xmu/WidgetNode.c b/xc/lib/Xmu/WidgetNode.c index 6a91daf17..e39797c50 100644 --- a/xc/lib/Xmu/WidgetNode.c +++ b/xc/lib/Xmu/WidgetNode.c @@ -22,7 +22,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/Xmu/WidgetNode.c,v 1.8 2001/01/17 19:42:57 dawes Exp $ */ +/* $XFree86: xc/lib/Xmu/WidgetNode.c,v 1.9 2001/04/01 14:00:01 tsi Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -31,6 +31,7 @@ in this Software without prior written authorization from The Open Group. #include <stdio.h> +#include <stdlib.h> #include <X11/Xos.h> #include <X11/IntrinsicP.h> #include <X11/Xaw/Cardinals.h> diff --git a/xc/lib/Xmuu/Imakefile b/xc/lib/Xmuu/Imakefile new file mode 100644 index 000000000..32a564b0d --- /dev/null +++ b/xc/lib/Xmuu/Imakefile @@ -0,0 +1,64 @@ +XCOMM $XFree86: xc/lib/Xmuu/Imakefile,v 1.1 2001/03/30 02:18:41 keithp Exp $ +XCOMM Mini Xmu library: pull out just those things that are used by apps +XCOMM that do not use Xt and Xaw in the core applications +XCOMM +XCOMM Feel free to include additional code into this library, please +XCOMM be careful not to use anything which requires libraries other +XCOMM other than Xlib and the system C library + +#define DoNormalLib NormalLibXmuu +#define DoSharedLib SharedLibXmuu +#define DoExtraLib SharedLibXmuuc +#define DoDebugLib DebugLibXmuu +#define DoProfileLib ProfileLibXmuu +#define LibName Xmuu +#define SoRev SOXMUUREV +#define LibHeaders NO + +#ifdef SharedXmuuReqs +REQUIREDLIBS = SharedXmuuReqs +#endif + LINTLIBS = $(LINTXLIB) + +#if HasSnprintf + MISC_DEFINES = -DHAS_SNPRINTF +#else + MISC_INCLUDES = -I$(LIBSRC)/misc +#endif + + DEFINES = $(MISC_DEFINES) + INCLUDES = $(MISC_INCLUDES) + +#ifdef OsNameDefines +OS_NAME_DEFINES = OsNameDefines +#endif + CSSDEFS = $(OS_NAME_DEFINES) $(CONNECTION_FLAGS) + + +SRCS = ClientWin.c\ + CursorName.c\ + DefErrMsg.c\ + GetHost.c\ + Lower.c + +OBJS = ClientWin.o\ + CursorName.o\ + DefErrMsg.o\ + GetHost.o\ + Lower.o + +INCLUDES = -I$(XMUSRC) + +#include <Library.tmpl> + +#if DoSharedLib +SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) +#endif + +LinkSourceFile(ClientWin.c,$(XMUSRC)) +LinkSourceFile(CursorName.c,$(XMUSRC)) +LinkSourceFile(DefErrMsg.c,$(XMUSRC)) +LinkSourceFile(GetHost.c,$(XMUSRC)) +LinkSourceFile(Lower.c,$(XMUSRC)) + +DependTarget() diff --git a/xc/lib/Xp/XpPrinter.c b/xc/lib/Xp/XpPrinter.c index 5e3f8c71a..da3410e78 100644 --- a/xc/lib/Xp/XpPrinter.c +++ b/xc/lib/Xp/XpPrinter.c @@ -34,7 +34,7 @@ ** ****************************************************************************** *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpPrinter.c,v 1.7 2001/01/17 19:43:02 dawes Exp $ */ +/* $XFree86: xc/lib/Xp/XpPrinter.c,v 1.8 2001/04/01 14:00:02 tsi Exp $ */ #define NEED_REPLIES @@ -58,7 +58,7 @@ XpGetPrinterList ( char *locale; /* For decoding the variable portion of Reply */ - CARD32 dataLenVR; + long dataLenVR; CARD8 *dataVR; /* aka STRING8 */ XPPrinterList ptr_list; @@ -146,7 +146,7 @@ XpGetPrinterList ( /* * Pull printer length and then name. */ - _XRead32 (dpy, (long *) &dataLenVR, (long) sizeof(dataLenVR) ); + _XRead32 (dpy, &dataLenVR, (long) sizeof(CARD32) ); if (dataLenVR) { dataVR = (CARD8 *) Xmalloc( (unsigned) dataLenVR + 1 ); @@ -168,7 +168,7 @@ XpGetPrinterList ( /* * Pull localized description length and then description. */ - _XRead32 (dpy, (long *) &dataLenVR, (long) sizeof(dataLenVR) ); + _XRead32 (dpy, &dataLenVR, (long) sizeof(CARD32) ); if (dataLenVR) { dataVR = (CARD8 *) Xmalloc( (unsigned) dataLenVR + 1 ); diff --git a/xc/lib/Xp/XpScreens.c b/xc/lib/Xp/XpScreens.c index c5227d3a3..405f41358 100644 --- a/xc/lib/Xp/XpScreens.c +++ b/xc/lib/Xp/XpScreens.c @@ -34,7 +34,7 @@ ** ****************************************************************************** *****************************************************************************/ -/* $XFree86: xc/lib/Xp/XpScreens.c,v 1.4 2001/01/17 19:43:02 dawes Exp $ */ +/* $XFree86: xc/lib/Xp/XpScreens.c,v 1.5 2001/04/01 14:00:02 tsi Exp $ */ #define NEED_REPLIES @@ -53,7 +53,7 @@ XpQueryScreens ( xPrintQueryScreensReply rep; /* For decoding the variable portion of Reply */ - CARD32 rootWindow; + long rootWindow; /* For converting root winID to corresponding ScreenPtr */ Screen **scr_list; @@ -94,7 +94,7 @@ XpQueryScreens ( /* * Pull printer length and then name. */ - _XRead32 (dpy, (char *) &rootWindow, (long) sizeof(rootWindow) ); + _XRead32 (dpy, &rootWindow, (long) sizeof(CARD32) ); scr_list[i] = NULL; for ( j = 0; j < XScreenCount(dpy); j++ ) { checkScr = XScreenOfDisplay(dpy, j); diff --git a/xc/lib/Xt/Error.c b/xc/lib/Xt/Error.c index ac95e7785..ae3455729 100644 --- a/xc/lib/Xt/Error.c +++ b/xc/lib/Xt/Error.c @@ -32,7 +32,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/lib/Xt/Error.c,v 3.10 2001/01/17 19:43:04 dawes Exp $ */ +/* $XFree86: xc/lib/Xt/Error.c,v 3.11 2001/04/01 14:00:02 tsi Exp $ */ /* @@ -58,6 +58,7 @@ in this Software without prior written authorization from The Open Group. #include "IntrinsicI.h" #include <stdio.h> +#include <stdlib.h> /* The error handlers in the application context aren't used since we can't come up with a uniform way of using them. If you can, define diff --git a/xc/lib/XvMC/Imakefile b/xc/lib/XvMC/Imakefile new file mode 100644 index 000000000..3a3c55df1 --- /dev/null +++ b/xc/lib/XvMC/Imakefile @@ -0,0 +1,29 @@ +XCOMM $XFree86: xc/lib/XvMC/Imakefile,v 1.2 2001/04/01 14:00:02 tsi Exp $ + +#define DoNormalLib NormalLibXvMC +#define DoSharedLib SharedLibXvMC +#define DoDebugLib DebugLibXvMC +#define DoProfileLib ProfileLibXvMC +#define LibName XvMC +#define SoRev SOXVMCREV +#define LibHeaders NO + +#include <Threads.tmpl> + +#ifdef SharedXvMCReqs +REQUIREDLIBS = SharedXvMCReqs +#endif + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + + DEFINES = $(ALLOC_DEFINES) + INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) + SRCS = XvMC.c + OBJS = XvMC.o + LINTLIBS = $(LINTXLIB) + +#include <Library.tmpl> + +DependTarget() diff --git a/xc/lib/XvMC/XvMC.c b/xc/lib/XvMC/XvMC.c new file mode 100644 index 000000000..911b81bf7 --- /dev/null +++ b/xc/lib/XvMC/XvMC.c @@ -0,0 +1,468 @@ +/* $XFree86: xc/lib/XvMC/XvMC.c,v 1.3 2001/04/01 14:00:02 tsi Exp $ */ + +#define NEED_REPLIES + +#include <stdio.h> +#include "XvMClibint.h" +#include "Xext.h" +#include "extutil.h" + +static XExtensionInfo _xvmc_info_data; +static XExtensionInfo *xvmc_info = &_xvmc_info_data; +static char *xvmc_extension_name = XvMCName; + +static char *xvmc_error_list[] = +{ + "BadContext", + "BadSurface", + "BadSubpicture" +}; + +static XEXT_GENERATE_CLOSE_DISPLAY (xvmc_close_display, xvmc_info) + + +static XEXT_GENERATE_ERROR_STRING (xvmc_error_string, xvmc_extension_name, + XvMCNumErrors, xvmc_error_list) + + +static XExtensionHooks xvmc_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + xvmc_close_display, /* close_display */ + NULL, /* wire_to_event */ + NULL, /* event_to_wire */ + NULL, /* error */ + xvmc_error_string /* error_string */ +}; + +static XEXT_GENERATE_FIND_DISPLAY (xvmc_find_display, xvmc_info, + xvmc_extension_name, + &xvmc_extension_hooks, + XvMCNumEvents, NULL) + +Bool XvMCQueryExtension (Display *dpy, int *event_basep, int *error_basep) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + + if (XextHasExtension(info)) { + *event_basep = info->codes->first_event; + *error_basep = info->codes->first_error; + return True; + } else { + return False; + } +} + +Status XvMCQueryVersion (Display *dpy, int *major, int *minor) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcQueryVersionReply rep; + xvmcQueryVersionReq *req; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (QueryVersion, req); + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return BadImplementation; + } + *major = rep.major; + *minor = rep.minor; + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + + +XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcListSurfaceTypesReply rep; + xvmcListSurfaceTypesReq *req; + XvMCSurfaceInfo *surface_info = NULL; + + *num = 0; + + XvMCCheckExtension (dpy, info, NULL); + + LockDisplay (dpy); + XvMCGetReq (ListSurfaceTypes, req); + req->port = port; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + if(rep.num > 0) { + surface_info = + (XvMCSurfaceInfo*)Xmalloc(rep.num * sizeof(XvMCSurfaceInfo)); + + if(surface_info) { + xvmcSurfaceInfo sinfo; + int i; + + *num = rep.num; + + for(i = 0; i < rep.num; i++) { + _XRead(dpy, (char*)&sinfo, sizeof(xvmcSurfaceInfo)); + surface_info[i].surface_type_id = sinfo.surface_type_id; + surface_info[i].chroma_format = sinfo.chroma_format; + surface_info[i].color_description = sinfo.color_description; + surface_info[i].max_width = sinfo.max_width; + surface_info[i].max_height = sinfo.max_height; + surface_info[i].subpicture_max_width = + sinfo.subpicture_max_width; + surface_info[i].subpicture_max_height = + sinfo.subpicture_max_height; + surface_info[i].mc_type = sinfo.mc_type; + surface_info[i].flags = sinfo.flags; + } + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return surface_info; +} + + +XvImageFormatValues * XvMCListSubpictureTypes ( + Display * dpy, + XvPortID port, + int surface_type_id, + int *count_return +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcListSubpictureTypesReply rep; + xvmcListSubpictureTypesReq *req; + XvImageFormatValues *ret = NULL; + + + *count_return = 0; + + XvMCCheckExtension (dpy, info, NULL); + + + LockDisplay (dpy); + XvMCGetReq (ListSubpictureTypes, req); + req->port = port; + req->surface_type_id = surface_type_id; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + if(rep.num > 0) { + ret = + (XvImageFormatValues*)Xmalloc(rep.num * sizeof(XvImageFormatValues)); + + if(ret) { + xvImageFormatInfo Info; + int i; + + *count_return = rep.num; + + for(i = 0; i < rep.num; i++) { + _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo); + ret[i].id = Info.id; + ret[i].type = Info.type; + ret[i].byte_order = Info.byte_order; + memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); + ret[i].bits_per_pixel = Info.bpp; + ret[i].format = Info.format; + ret[i].num_planes = Info.num_planes; + ret[i].depth = Info.depth; + ret[i].red_mask = Info.red_mask; + ret[i].green_mask = Info.green_mask; + ret[i].blue_mask = Info.blue_mask; + ret[i].y_sample_bits = Info.y_sample_bits; + ret[i].u_sample_bits = Info.u_sample_bits; + ret[i].v_sample_bits = Info.v_sample_bits; + ret[i].horz_y_period = Info.horz_y_period; + ret[i].horz_u_period = Info.horz_u_period; + ret[i].horz_v_period = Info.horz_v_period; + ret[i].vert_y_period = Info.vert_y_period; + ret[i].vert_u_period = Info.vert_u_period; + ret[i].vert_v_period = Info.vert_v_period; + memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); + ret[i].scanline_order = Info.scanline_order; + } + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return ret; +} + + +/****************************************************************** + These are intended as a protocol interface to be used by direct + rendering libraries. They are not intended to be client viewable + functions. These will stay in place until we have a mechanism in + place similar to that of OpenGL with an libXvMCcore library. +*******************************************************************/ + +/* + _xvmc_create_context - + + Pass in the context with the surface_type_id, width, height, + port and flags filled out. This function will fill out the + context_id and update the width, height and flags field. + The server may return implementation-specific information + back in the priv_data. The size of that information will + an array of priv_count CARD32s. This data is allocated by + this function. If returned, the caller is responsible for + freeing it! Generally, such information is only returned if + an XVMC_DIRECT context was specified. +*/ + + +Status _xvmc_create_context ( + Display *dpy, + XvMCContext *context, + int *priv_count, + CARD32 **priv_data +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcCreateContextReply rep; + xvmcCreateContextReq *req; + + *priv_count = 0; + *priv_data = NULL; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (CreateContext, req); + context->context_id = XAllocID(dpy); + req->context_id = context->context_id; + req->port = context->port; + req->surface_type_id = context->surface_type_id; + req->width = context->width; + req->height = context->height; + req->flags = context->flags; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return BadImplementation; + } + context->width = rep.width_actual; + context->height = rep.height_actual; + context->flags = rep.flags_return; + + if(rep.length) { + *priv_data = Xmalloc(rep.length << 2); + if(*priv_data) { + _XRead(dpy, (char*)(*priv_data), rep.length << 2); + *priv_count = rep.length; + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +Status _xvmc_destroy_context ( + Display *dpy, + XvMCContext *context +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcDestroyContextReq *req; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (DestroyContext, req); + req->context_id = context->context_id; + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + + +/* + _xvmc_create_surface - + + Pass the context and this function will fill out all the + information in the surface. + The server may return implementation-specific information + back in the priv_data. The size of that information will + an array of priv_count CARD32s. This data is allocated by + this function. If returned, the caller is responsible for + freeing it! Generally, such information is returned only if + the context was a direct context. + +*/ + +Status _xvmc_create_surface ( + Display *dpy, + XvMCContext *context, + XvMCSurface *surface, + int *priv_count, + CARD32 **priv_data +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcCreateSurfaceReply rep; + xvmcCreateSurfaceReq *req; + + *priv_count = 0; + *priv_data = NULL; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (CreateSurface, req); + + surface->surface_id = XAllocID(dpy); + surface->context_id = context->context_id; + surface->surface_type_id = context->surface_type_id; + surface->width = context->width; + surface->height = context->height; + + req->surface_id = surface->surface_id; + req->context_id = surface->context_id; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return BadImplementation; + } + + if(rep.length) { + *priv_data = Xmalloc(rep.length << 2); + if(*priv_data) { + _XRead(dpy, (char*)(*priv_data), rep.length << 2); + *priv_count = rep.length; + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +Status _xvmc_destroy_surface ( + Display *dpy, + XvMCSurface *surface +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcDestroySurfaceReq *req; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (DestroySurface, req); + req->surface_id = surface->surface_id; + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +/* + _xvmc_create_subpicture - + + Pass the subpicture with the width, height and xvimage_id filled + out and this function will fill out everything else in the + subpicture as well as adjust the width and height if needed. + The server may return implementation-specific information + back in the priv_data. The size of that information will + an array of priv_count CARD32s. This data is allocated by + this function. If returned, the caller is responsible for + freeing it! Generally, such information is returned only if + the context was a direct context. + +*/ + +Status _xvmc_create_subpicture ( + Display *dpy, + XvMCContext *context, + XvMCSubpicture *subpicture, + int *priv_count, + CARD32 **priv_data +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcCreateSubpictureReply rep; + xvmcCreateSubpictureReq *req; + + *priv_count = 0; + *priv_data = NULL; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (CreateSubpicture, req); + + subpicture->subpicture_id = XAllocID(dpy); + subpicture->context_id = context->context_id; + + req->subpicture_id = subpicture->subpicture_id; + req->context_id = subpicture->context_id; + req->xvimage_id = subpicture->xvimage_id; + req->width = subpicture->width; + req->height = subpicture->height; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return BadImplementation; + } + + subpicture->width = rep.width_actual; + subpicture->height = rep.height_actual; + subpicture->num_palette_entries = rep.num_palette_entries; + subpicture->entry_bytes = rep.entry_bytes; + subpicture->component_order[0] = rep.component_order[0]; + subpicture->component_order[1] = rep.component_order[1]; + subpicture->component_order[2] = rep.component_order[2]; + subpicture->component_order[3] = rep.component_order[3]; + + if(rep.length) { + *priv_data = Xmalloc(rep.length << 2); + if(*priv_data) { + _XRead(dpy, (char*)(*priv_data), rep.length << 2); + *priv_count = rep.length; + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +Status _xvmc_destroy_subpicture( + Display *dpy, + XvMCSubpicture *subpicture +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcDestroySubpictureReq *req; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (DestroySubpicture, req); + req->subpicture_id = subpicture->subpicture_id; + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + diff --git a/xc/lib/XvMC/XvMClibint.h b/xc/lib/XvMC/XvMClibint.h new file mode 100644 index 000000000..e3bd9891d --- /dev/null +++ b/xc/lib/XvMC/XvMClibint.h @@ -0,0 +1,40 @@ +/* $XFree86: xc/lib/XvMC/XvMClibint.h,v 1.3 2001/04/01 14:00:02 tsi Exp $ */ + +#ifndef _XVMCLIBINT_H +#define _XVMCLIBINT_H +#define NEED_REPLIES + +#include "Xlibint.h" +#include "Xvproto.h" +#include "XvMCproto.h" +#include "XvMClib.h" + +#define XvMCCheckExtension(dpy, i, val) \ + XextCheckExtension(dpy, i, xvmc_extension_name, val) + + +#if defined(__STDC__) && !defined(UNIXCPP) +#define XvMCGetReq(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + sizeof(xvmc##name##Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (xvmc##name##Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = info->codes->major_opcode;\ + req->xvmcReqType = xvmc_##name; \ + req->length = sizeof(xvmc##name##Req)>>2;\ + dpy->bufptr += sizeof(xvmc##name##Req);\ + dpy->request++ +#else +#define XvMCGetReq(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + sizeof(xvmc/**/name/**/Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (xvmc/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = info->codes->major_opcode;\ + req->xvmcReqType = xvmc_/**/name;\ + req->length = sizeof(xvmc/**/name/**/Req)>>2;\ + dpy->bufptr += sizeof(xvmc/**/name/**/Req);\ + dpy->request++ +#endif + +#endif /* XVMCLIBINT_H */ diff --git a/xc/lib/dps/dpsXpriv.c b/xc/lib/dps/dpsXpriv.c index f62023af5..264d0bd44 100644 --- a/xc/lib/dps/dpsXpriv.c +++ b/xc/lib/dps/dpsXpriv.c @@ -35,11 +35,12 @@ * * Author: Adobe Systems Incorporated */ -/* $XFree86: xc/lib/dps/dpsXpriv.c,v 1.3 2000/05/18 23:46:13 dawes Exp $ */ +/* $XFree86: xc/lib/dps/dpsXpriv.c,v 1.4 2001/04/01 14:00:03 tsi Exp $ */ #include <stdlib.h> #include <stdio.h> #include <errno.h> +#include <string.h> #ifdef GC #undef GC diff --git a/xc/lib/dps/dpsabbrev.c b/xc/lib/dps/dpsabbrev.c index ec4ad930c..95ae3afda 100644 --- a/xc/lib/dps/dpsabbrev.c +++ b/xc/lib/dps/dpsabbrev.c @@ -35,7 +35,9 @@ * * Author: Adobe Systems Incorporated */ +/* $XFree86: xc/lib/dps/dpsabbrev.c,v 1.3 2001/04/01 14:00:03 tsi Exp $ */ +#include <string.h> #include "publictypes.h" #include "DPS/dpsclient.h" #include "dpsprivate.h" diff --git a/xc/lib/font/Type1/fontfcn.c b/xc/lib/font/Type1/fontfcn.c index 75fde2267..9c917c22e 100644 --- a/xc/lib/font/Type1/fontfcn.c +++ b/xc/lib/font/Type1/fontfcn.c @@ -45,7 +45,7 @@ * The Original Software is CID font code that was developed by Silicon * Graphics, Inc. */ -/* $XFree86: xc/lib/font/Type1/fontfcn.c,v 1.9 2001/01/17 19:43:22 dawes Exp $ */ +/* $XFree86: xc/lib/font/Type1/fontfcn.c,v 1.10 2001/04/05 17:42:27 dawes Exp $ */ #ifndef FONTMODULE #include <stdio.h> @@ -61,6 +61,7 @@ #include "range.h" #include "Xdefs.h" #endif +#include "fntfilst.h" #include "fontfcn.h" extern struct segment *Type1Char ( char *env, XYspace S, diff --git a/xc/lib/font/X-TrueType/BIG5HKSCS/Imakefile b/xc/lib/font/X-TrueType/BIG5HKSCS/Imakefile new file mode 100644 index 000000000..b4d2b554d --- /dev/null +++ b/xc/lib/font/X-TrueType/BIG5HKSCS/Imakefile @@ -0,0 +1,4 @@ +XCOMM X-TrueType Server - TrueType rasterizer for X +XCOMM $XFree86: xc/lib/font/X-TrueType/BIG5HKSCS/Imakefile,v 1.1 2001/03/06 18:54:43 dawes Exp $ +/*#include "Imakefile.obj"*/ +#include <xttMod.tmpl> diff --git a/xc/lib/font/X-TrueType/BIG5HKSCS/Imakefile.inc b/xc/lib/font/X-TrueType/BIG5HKSCS/Imakefile.inc new file mode 100644 index 000000000..027d8e8e1 --- /dev/null +++ b/xc/lib/font/X-TrueType/BIG5HKSCS/Imakefile.inc @@ -0,0 +1,12 @@ +XCOMM $XFree86: xc/lib/font/X-TrueType/BIG5HKSCS/Imakefile.inc,v 1.1 2001/03/06 18:54:44 dawes Exp $ + +#define ModuleName BIG5HKSCS +MODULENAME = ModuleName +MODULESRCDIR = $(XTTSOURCEDIR)/$(MODULENAME) + +SRCS = main.c BIG5HKSCStoUCS2.c +OBJS = main.o BIG5HKSCStoUCS2.o + +LinkSourceFile(main.c,$(MODULESRCDIR)) +LinkSourceFile(BIG5HKSCStoUCS2.c,$(MODULESRCDIR)) + diff --git a/xc/lib/font/X-TrueType/BIG5HKSCS/module/Imakefile b/xc/lib/font/X-TrueType/BIG5HKSCS/module/Imakefile new file mode 100644 index 000000000..2894ac34b --- /dev/null +++ b/xc/lib/font/X-TrueType/BIG5HKSCS/module/Imakefile @@ -0,0 +1,5 @@ +XCOMM X-TrueType Server - TrueType rasterizer for X +XCOMM $XFree86: xc/lib/font/X-TrueType/BIG5HKSCS/module/Imakefile,v 1.1 2001/03/06 18:54:44 dawes Exp $ +#define IHaveModules +#include "../Imakefile.inc" +#include <xttMod.tmpl> diff --git a/xc/lib/font/X-TrueType/GBK/Imakefile b/xc/lib/font/X-TrueType/GBK/Imakefile new file mode 100644 index 000000000..0b6a7bcb6 --- /dev/null +++ b/xc/lib/font/X-TrueType/GBK/Imakefile @@ -0,0 +1,4 @@ +XCOMM X-TrueType Server - TrueType rasterizer for X +XCOMM $XFree86: xc/lib/font/X-TrueType/GBK/Imakefile,v 1.1 2001/03/06 18:03:16 dawes Exp $ +/*#include "Imakefile.inc"*/ +#include <xttMod.tmpl> diff --git a/xc/lib/font/X-TrueType/GBK/Imakefile.inc b/xc/lib/font/X-TrueType/GBK/Imakefile.inc new file mode 100644 index 000000000..45ed8b7e4 --- /dev/null +++ b/xc/lib/font/X-TrueType/GBK/Imakefile.inc @@ -0,0 +1,11 @@ +XCOMM $XFree86: xc/lib/font/X-TrueType/GBK/Imakefile.inc,v 1.1 2001/03/06 18:03:16 dawes Exp $ + +#define ModuleName GBK +MODULENAME = ModuleName +MODULESRCDIR = $(XTTSOURCEDIR)/$(MODULENAME) + +SRCS = main.c GBKtoUCS2.c +OBJS = main.o GBKtoUCS2.o + +LinkSourceFile(main.c,$(MODULESRCDIR)) +LinkSourceFile(GBKtoUCS2.c,$(MODULESRCDIR)) diff --git a/xc/lib/font/X-TrueType/GBK/module/Imakefile b/xc/lib/font/X-TrueType/GBK/module/Imakefile new file mode 100644 index 000000000..1b00b4b6d --- /dev/null +++ b/xc/lib/font/X-TrueType/GBK/module/Imakefile @@ -0,0 +1,5 @@ +XCOMM X-TrueType Server - TrueType rasterizer for X +XCOMM $XFree86: xc/lib/font/X-TrueType/GBK/module/Imakefile,v 1.1 2001/03/06 18:24:19 dawes Exp $ +#define IHaveModules +#include "../Imakefile.inc" +#include <xttMod.tmpl> diff --git a/xc/lib/font/X-TrueType/Imakefile.inc b/xc/lib/font/X-TrueType/Imakefile.inc index c1abca19c..0020367a9 100644 --- a/xc/lib/font/X-TrueType/Imakefile.inc +++ b/xc/lib/font/X-TrueType/Imakefile.inc @@ -1,15 +1,15 @@ -XCOMM $XFree86: xc/lib/font/X-TrueType/Imakefile.inc,v 1.3 2000/02/14 19:20:24 dawes Exp $ +XCOMM $XFree86: xc/lib/font/X-TrueType/Imakefile.inc,v 1.5 2001/03/06 18:54:43 dawes Exp $ /* -*- Makefile -*- */ DEFAULT_CCONV_SUBDIR = ISO8859.1 #if XTrueTypeUseOptEncodings XTT_USE_OPT_ENC_DEFINES = -DOPT_ENCODINGS -CCONV_SUBDIRS = BIG5 GB2312 JISX0201 JISX0208 JISX0212 \ +CCONV_SUBDIRS = BIG5 BIG5HKSCS GB2312 GBK JISX0201 JISX0208 JISX0212 \ KSC5601 KSCJOHAB GEORGIAN \ - ISO8859.2 ISO8859.3 ISO8859.4 ISO8859.5 ISO8859.6 \ - ISO8859.7 ISO8859.8 ISO8859.9 ISO8859.10 ISO8859.11 \ - ISO8859.14 ISO8859.15 KOI8 VISCII TCVN \ - ARMSCII8 ARABIC MULEENCODING DOSENCODING + ISO8859.2 ISO8859.3 ISO8859.4 ISO8859.5 ISO8859.6 \ + ISO8859.7 ISO8859.8 ISO8859.9 ISO8859.10 ISO8859.11 \ + ISO8859.14 ISO8859.15 KOI8 VISCII TCVN \ + ARMSCII8 ARABIC MULEENCODING DOSENCODING #endif SUBDIRS = $(MODULE_SUBDIRS) $(DEFAULT_CCONV_SUBDIR) $(CCONV_SUBDIRS) diff --git a/xc/lib/font/bitmap/Imakefile b/xc/lib/font/bitmap/Imakefile index 12deda3f2..717c81b34 100644 --- a/xc/lib/font/bitmap/Imakefile +++ b/xc/lib/font/bitmap/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:34 cpqbld Exp $ -XCOMM $XFree86: xc/lib/font/bitmap/Imakefile,v 1.10 2001/01/17 19:43:26 dawes Exp $ +XCOMM $XFree86: xc/lib/font/bitmap/Imakefile,v 1.11 2001/04/03 17:51:59 paulo Exp $ #if BuildServer && DoLoadableServer #define IHaveSubdirs @@ -53,6 +53,8 @@ PCFDEFS=-DPCFFORMAT LibraryObjectRule() SpecialCLibObjectRule(bitmapfunc,$(ICONFIGFILES),$(GZIP_DEFS)) +SpecialCLibObjectRule(bitscale,$(ICONFIGFILES),$(GZIP_DEFS)) + SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) diff --git a/xc/lib/font/bitmap/bitmapfunc.c b/xc/lib/font/bitmap/bitmapfunc.c index fbdfc0705..e208ee525 100644 --- a/xc/lib/font/bitmap/bitmapfunc.c +++ b/xc/lib/font/bitmap/bitmapfunc.c @@ -22,7 +22,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/bitmap/bitmapfunc.c,v 3.10 2001/01/17 19:43:27 dawes Exp $ */ +/* $XFree86: xc/lib/font/bitmap/bitmapfunc.c,v 3.12 2001/04/04 00:34:28 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -83,6 +83,7 @@ static BitmapFileFunctionsRec readers[] = { #define CAPABILITIES (CAP_MATRIX | CAP_CHARSUBSETTING) static FontRendererRec renderers[] = { +#ifdef PCFFORMAT { ".pcf", 4, BitmapOpenBitmap, BitmapOpenScalable, BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, @@ -101,6 +102,8 @@ static FontRendererRec renderers[] = { BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, #endif +#endif +#ifdef SNFFORMAT { ".snf", 4, BitmapOpenBitmap, BitmapOpenScalable, BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, @@ -112,6 +115,8 @@ static FontRendererRec renderers[] = { BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, #endif +#endif +#ifdef BDFFORMAT { ".bdf", 4, BitmapOpenBitmap, BitmapOpenScalable, BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, @@ -123,9 +128,12 @@ static FontRendererRec renderers[] = { BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES }, #endif +#endif +#ifdef PCFFORMAT { ".pmf", 4, BitmapOpenBitmap, BitmapOpenScalable, BitmapGetInfoBitmap, BitmapGetInfoScalable, 0, CAPABILITIES } +#endif }; int @@ -163,10 +171,11 @@ BitmapOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags, ret = (*readers[i].ReadFont) (pFont, file, bit, byte, glyph, scan); FontFileClose (file); - if (ret != Successful) + if (ret != Successful) { xfree(pFont); - else + } else { *ppFont = pFont; + } return ret; } diff --git a/xc/lib/font/bitmap/bitscale.c b/xc/lib/font/bitmap/bitscale.c index 8b6fb53ba..a7f4e335b 100644 --- a/xc/lib/font/bitmap/bitscale.c +++ b/xc/lib/font/bitmap/bitscale.c @@ -23,7 +23,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/bitmap/bitscale.c,v 3.17 2001/01/17 19:43:27 dawes Exp $ */ +/* $XFree86: xc/lib/font/bitmap/bitscale.c,v 3.19 2001/04/05 17:42:27 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -46,6 +46,8 @@ from The Open Group. #define MAX(a,b) (((a)>(b)) ? a : b) #endif +/* Should get this from elsewhere */ +extern int serverGeneration; static void bitmapUnloadScalable (FontPtr pFont); static void ScaleBitmap ( FontPtr pFont, CharInfoPtr opci, @@ -80,6 +82,7 @@ typedef FontPtr (*ScaleFunc) ( FontPtr /* pf */, /* These next two arrays must be kept in step with the renderer array */ ScaleFunc scale[] = { +#ifdef PCFFORMAT BitmapScaleBitmaps, BitmapScaleBitmaps, #ifdef X_GZIP_FONT_COMPRESSION @@ -88,17 +91,24 @@ ScaleFunc scale[] = #ifdef __EMX__ BitmapScaleBitmaps, #endif +#endif +#ifdef SNFFORMAT BitmapScaleBitmaps, BitmapScaleBitmaps, #ifdef X_GZIP_FONT_COMPRESSION BitmapScaleBitmaps, #endif +#endif +#ifdef BDFFORMAT BitmapScaleBitmaps, BitmapScaleBitmaps, #ifdef X_GZIP_FONT_COMPRESSION BitmapScaleBitmaps, #endif +#endif +#ifdef PCFFORMAT PrinterScaleBitmaps, +#endif }; static FontEntryPtr FindBestToScale ( FontPathElementPtr fpe, @@ -714,7 +724,6 @@ ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */ char *ptr3; FontPropPtr fp; fontProp *fpt; - extern int serverGeneration; char *isStringProp; int nProps; diff --git a/xc/lib/font/bitmap/pcfread.c b/xc/lib/font/bitmap/pcfread.c index 8fbf08945..e7d6a5ca0 100644 --- a/xc/lib/font/bitmap/pcfread.c +++ b/xc/lib/font/bitmap/pcfread.c @@ -23,7 +23,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/bitmap/pcfread.c,v 1.14 2001/01/17 19:43:27 dawes Exp $ */ +/* $XFree86: xc/lib/font/bitmap/pcfread.c,v 1.16 2001/04/04 00:34:28 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -863,7 +863,7 @@ pmfReadFont(FontPtr pFont, FontFilePtr file, if (encodingOffset == 0xFFFF) { pFont->info.allExist = FALSE; encoding[i] = 0; - } else + } else { if(!encoding[SEGMENT_MAJOR(i)]) { encoding[SEGMENT_MAJOR(i)]= (CharInfoPtr*)xcalloc(BITMAP_FONT_SEGMENT_SIZE, @@ -872,6 +872,7 @@ pmfReadFont(FontPtr pFont, FontFilePtr file, goto Bail; } ACCESSENCODINGL(encoding, i) = metrics + encodingOffset; + } } if (IS_EOF(file)) goto Bail; diff --git a/xc/lib/font/bitmap/pcfwrite.c b/xc/lib/font/bitmap/pcfwrite.c index d975febd4..8e9b44886 100644 --- a/xc/lib/font/bitmap/pcfwrite.c +++ b/xc/lib/font/bitmap/pcfwrite.c @@ -23,7 +23,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/bitmap/pcfwrite.c,v 1.5 2001/01/17 19:43:27 dawes Exp $ */ +/* $XFree86: xc/lib/font/bitmap/pcfwrite.c,v 1.6 2001/04/05 17:42:27 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -36,7 +36,7 @@ from The Open Group. /* Write PCF font files */ -static int current_position; +static CARD32 current_position; static int pcfWrite(FontFilePtr file, char *b, int c) @@ -216,7 +216,7 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file) int prop_pad = 0; char *atom_name; int glyph; - int offset; + CARD32 offset; bitmapFont = (BitmapFontPtr) pFont->fontPrivate; if (bitmapFont->bitmapExtra) { @@ -349,7 +349,7 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file) cur_table++, table++) { if (current_position > table->offset) { printf("can't go backwards... %d > %d\n", - current_position, table->offset); + (int)current_position, (int)table->offset); return BadFontName; } while (current_position < table->offset) diff --git a/xc/lib/font/fc/fserve.c b/xc/lib/font/fc/fserve.c index 630f67cb3..eefb224dc 100644 --- a/xc/lib/font/fc/fserve.c +++ b/xc/lib/font/fc/fserve.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/lib/font/fc/fserve.c,v 3.18 2001/01/17 19:43:28 dawes Exp $ */ +/* $XFree86: xc/lib/font/fc/fserve.c,v 3.19 2001/04/05 17:42:27 dawes Exp $ */ /* * Copyright 1990 Network Computing Devices @@ -92,8 +92,6 @@ extern Time_t time (); (pci)->characterWidth) -extern FontPtr find_old_font(FSID id); - static int fs_read_glyphs ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); static int fs_read_list ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); static int fs_read_list_info ( FontPathElementPtr fpe, diff --git a/xc/lib/font/fc/fserve.h b/xc/lib/font/fc/fserve.h index c6cf6f91c..9d692573e 100644 --- a/xc/lib/font/fc/fserve.h +++ b/xc/lib/font/fc/fserve.h @@ -24,7 +24,7 @@ * Author: Dave Lemke, Network Computing Devices, Inc * */ -/* $XFree86: xc/lib/font/fc/fserve.h,v 1.4 2001/01/17 19:43:29 dawes Exp $ */ +/* $XFree86: xc/lib/font/fc/fserve.h,v 1.5 2001/04/05 17:42:28 dawes Exp $ */ #ifndef _FSERVE_H_ #define _FSERVE_H_ @@ -83,8 +83,6 @@ extern int fs_load_all_glyphs ( FontPtr pfont ); extern int _fs_load_glyphs ( pointer client, FontPtr pfont, Bool range_flag, unsigned int nchars, int item_size, unsigned char *data ); -extern void fs_register_fpe_functions ( void ); -extern void check_fs_register_fpe_functions ( void ); /* * These should be declared elsewhere, but I'm concerned that moving them diff --git a/xc/lib/font/fontcache/fontcache.c b/xc/lib/font/fontcache/fontcache.c index 5a6de587f..331e5b79e 100644 --- a/xc/lib/font/fontcache/fontcache.c +++ b/xc/lib/font/fontcache/fontcache.c @@ -26,7 +26,7 @@ * * Id: fontcache.c,v 1.19 1999/01/31 13:06:00 akiyama Exp $ */ -/* $XFree86: xc/lib/font/fontcache/fontcache.c,v 1.3 2000/09/26 15:57:01 tsi Exp $ */ +/* $XFree86: xc/lib/font/fontcache/fontcache.c,v 1.4 2001/04/05 17:42:28 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -61,14 +61,21 @@ static FontCacheSize_t AllocSize; static int NeedPurgeCache; static FontCacheStatistics CacheStatistics; -static void fc_assign_cache(); -static int fc_assign_entry(); -static void fc_flush_cache(); +static void fc_assign_cache(void); +static int fc_assign_entry(void); +static void fc_flush_cache(void); static int fc_get_bitmap_area(FontCacheEntryPtr, int); static void fc_free_bitmap_area(FontCacheBitmapPtr); static int fc_check_size(int); -static void fc_purge_cache(); -static void fc_purge_bitmap(); +static void fc_purge_cache(void); +static void fc_purge_bitmap(void); +static void fc_flush_cache_bitmap(void); +static void fc_flush_cache_inuse(void); +static void fc_flush_cache_free(void); +static void fc_purge_cache_entry(void); +static void fc_purge_cache_entry_pool(void); +static void fc_purge_bitmap_pool(void); + /* * FontCacheInitialize() @@ -87,7 +94,7 @@ FontCacheInitialize() * first time initialization */ #if defined(HASH_DEBUG) || defined(DEBUG) -fprintf(stderr, "FontCacheInitialize: initializing cache\n"); + fprintf(stderr, "FontCacheInitialize: initializing cache\n"); #endif InUseQueue = &InUseQueueHead; TAILQ_INIT(InUseQueue); @@ -111,8 +118,10 @@ fprintf(stderr, "FontCacheInitialize: initializing cache\n"); AllocSize.allocated = AllocSize.used = 0; fc_assign_cache(); fc_assign_entry(); -fprintf(stderr, "FontCacheInitialize: hi=%d, lo=%d, bal=%d\n", - CacheHiMark, CacheLowMark, CacheBalance); +#if defined(DEBUG) + fprintf(stderr, "FontCacheInitialize: hi=%ld, lo=%ld, bal=%d\n", + CacheHiMark, CacheLowMark, CacheBalance); +#endif CacheInitialized = 1; } else { @@ -121,7 +130,7 @@ fprintf(stderr, "FontCacheInitialize: hi=%d, lo=%d, bal=%d\n", * flush and reassign cache. */ #if defined(HASH_DEBUG) || defined(DEBUG) -fprintf(stderr, "FontCacheInitialize: initializing cache, again\n"); + fprintf(stderr, "FontCacheInitialize: initializing cache, again\n"); #endif } @@ -228,7 +237,7 @@ FontCacheOpenCache(void *arg) int size, mask; int i; - static sizes[] = { 16, 32, 64, 128, 0 }; + static int sizes[] = { 16, 32, 64, 128, 0 }; if (!CacheInitialized) { FontCacheInitialize(); diff --git a/xc/lib/font/fontcache/fontcache.h b/xc/lib/font/fontcache/fontcache.h index 06093f4c0..7f587c249 100644 --- a/xc/lib/font/fontcache/fontcache.h +++ b/xc/lib/font/fontcache/fontcache.h @@ -26,6 +26,7 @@ * * Id: fontcache.h,v 1.12 1999/01/09 06:24:30 akiyama Exp $ */ +/* $XFree86: xc/lib/font/fontcache/fontcache.h,v 1.4 2001/04/06 17:44:58 dawes Exp $ */ #ifndef _FONTCACHE_H_ #define _FONTCACHE_H_ @@ -127,10 +128,10 @@ typedef struct fc_cache_statistics FontCacheStatistics, *FontCacheStatisticsPtr; /* Function prototypes */ -int FontCacheInitialize(); +int FontCacheInitialize(void); FCCBPtr FontCacheOpenCache(void * /* arg */); void FontCacheCloseCache(FCCBPtr /* this */); -FontCacheEntryPtr FontCacheGetEntry(); +FontCacheEntryPtr FontCacheGetEntry(void); int FontCacheSearchEntry(FCCBPtr /* this */, int /* key */, FontCacheEntryPtr * /* value */); int FontCacheInsertEntry(FCCBPtr /* this */, int /* key */, diff --git a/xc/lib/font/include/fntfil.h b/xc/lib/font/include/fntfil.h index 6413436de..00ec3676e 100644 --- a/xc/lib/font/include/fntfil.h +++ b/xc/lib/font/include/fntfil.h @@ -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/include/fntfil.h,v 1.6 2001/01/17 19:43:32 dawes Exp $ */ +/* $XFree86: xc/lib/font/include/fntfil.h,v 1.7 2001/04/05 17:42:28 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -166,10 +166,4 @@ extern int FontFileMatchBitmapSource ( FontPathElementPtr fpe, extern int FontFileReadDirectory ( char *directory, FontDirectoryPtr *pdir ); extern Bool FontFileDirectoryChanged ( FontDirectoryPtr dir ); -extern void FontFileCheckRegisterFpeFunctions ( void ); - -extern void PrinterFontRegisterFpeFunctions ( void ); - -extern void FontFileRegisterFpeFunctions ( void ); - #endif /* _FONTFILE_H_ */ diff --git a/xc/lib/freetype2/freetype-def.cpp b/xc/lib/freetype2/freetype-def.cpp new file mode 100644 index 000000000..a97135600 --- /dev/null +++ b/xc/lib/freetype2/freetype-def.cpp @@ -0,0 +1,160 @@ +LIBRARY libfreetype +VERSION LIBRARY_VERSION + +EXPORTS +ah_arctan +autohint_module_class +autohinter_interface +cff_driver_class +FT_Access_Frame +FT_Add64 +FT_Add_Module +FT_Alloc +FT_Attach_File +FT_Attach_Stream +FT_Create_Extensions +FT_Destroy_Extensions +FT_Div64by32 +FT_DivFix +FT_Done_Extensions +FT_Done_Face +FT_Done_GlyphSlot +FT_Done_Library +FT_Done_Size +FT_Done_Stream +FT_Extract_Frame +FT_Forget_Frame +FT_Free +FT_Get_Char +FT_Get_Char_Index +FT_Get_Extension +FT_Get_Glyph_Name +FT_Get_Kerning +FT_Get_Long +FT_Get_LongLE +FT_Get_Module +FT_Get_Module_Interface +FT_Get_Offset +FT_Get_Renderer +FT_Get_Sfnt_Name +FT_Get_Sfnt_Name_Count +FT_Get_Sfnt_Table +FT_Get_Short +FT_Get_ShortLE +FT_GlyphLoader_Add +FT_GlyphLoader_Check_Points +FT_GlyphLoader_Check_Subglyphs +FT_GlyphLoader_Copy_Points +FT_GlyphLoader_Create_Extra +FT_GlyphLoader_Done +FT_GlyphLoader_New +FT_GlyphLoader_Prepare +FT_GlyphLoader_Reset +FT_GlyphLoader_Rewind +FT_Init_Extensions +FT_List_Add +FT_List_Finalize +FT_List_Find +FT_List_Insert +FT_List_Iterate +FT_List_Remove +FT_List_Up +FT_Load_Char +FT_Load_Glyph +FT_Lookup_Renderer +FT_MulDiv +FT_MulFix +FT_MulTo64 +FT_New_Face +FT_New_GlyphSlot +FT_New_Library +FT_New_Memory_Face +FT_New_Memory_Stream +FT_New_Size +FT_Open_Face +FT_Outline_Copy +FT_Outline_Decompose +FT_Outline_Done +FT_Outline_Done_Internal +FT_Outline_Get_Bitmap +FT_Outline_Get_CBox +FT_Outline_New +FT_Outline_New_Internal +FT_Outline_Render +FT_Outline_Reverse +FT_Outline_Transform +FT_Outline_Translate +FT_Read_Char +FT_Read_Fields +FT_Read_Long +FT_Read_LongLE +FT_Read_Offset +FT_Read_Short +FT_Read_ShortLE +FT_Read_Stream +FT_Read_Stream_At +FT_Realloc +FT_Register_Extension +FT_Release_Frame +FT_Remove_Module +FT_Render_Glyph +FT_Render_Glyph_Internal +FT_Seek_Stream +FT_Select_Charmap +FT_Set_Char_Size +FT_Set_Charmap +FT_Set_Debug_Hook +FT_Set_Pixel_Sizes +FT_Set_Renderer +FT_Set_Transform +FT_Skip_Stream +FT_Sqrt64 +FT_SqrtFixed +FT_Stream_Pos +FT_Vector_Transform +FT_Outline_Get_BBox +FT_Done_Glyph +FT_Get_Glyph +FT_Glyph_Copy +FT_Glyph_Get_CBox +FT_Glyph_To_Bitmap +FT_Glyph_Transform +FT_Matrix_Invert +FT_Matrix_Multiply +ft_bitmap_glyph_class +ft_outline_glyph_class +FT_Add_Default_Modules +FT_Done_FreeType +FT_Init_FreeType +FT_Get_Multi_Master +FT_Set_MM_Blend_Coordinates +FT_Set_MM_Design_Coordinates +FT_Done_Memory +FT_New_Memory +FT_New_Stream +_cygwin_dll_entry@12 +_cygwin_noncygwin_dll_entry@12 +dll_main@12 +ps_table_funcs +psaux_module_class +t1_builder_funcs +t1_decoder_funcs +t1_parser_funcs +psnames_module_class +ft_raster1_renderer_class +ft_raster5_renderer_class +ft_standard_raster +sbit_metrics_fields +sfnt_module_class +ft_grays_raster +ft_smooth_renderer_class +grays_raster_render +TT_New_Context +TT_RunIns +tt_default_graphics_state +tt_driver_class +t1_driver_class +t1cid_driver_class +winfnt_driver_class + +/* $XFree86: xc/lib/freetype2/freetype-def.cpp,v 1.1 2001/04/05 19:29:38 dawes Exp $ */ diff --git a/xc/lib/lbxutil/image/lbxbwcodes.h b/xc/lib/lbxutil/image/lbxbwcodes.h index 6e8418f89..c4b7c5066 100644 --- a/xc/lib/lbxutil/image/lbxbwcodes.h +++ b/xc/lib/lbxutil/image/lbxbwcodes.h @@ -23,6 +23,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +/* $XFree86: xc/lib/lbxutil/image/lbxbwcodes.h,v 1.3 2001/03/05 01:05:12 tsi Exp $ */ /* * Note that these tables are ordered such that the @@ -33,6 +34,11 @@ * during state generation (see mkg3states.c). */ +#ifdef __DARWIN__ +#ifndef TIFFaxWhiteCodes +#define TIFFFaxWhiteCodes Darwin_X_TIFFFaxWhiteCodes +#endif +#endif tableentry TIFFFaxWhiteCodes[] = { { 8, 0x35, 0 }, /* 0011 0101 */ { 6, 0x7, 1 }, /* 0001 11 */ @@ -145,6 +151,11 @@ tableentry TIFFFaxWhiteCodes[] = { { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ }; +#ifdef __DARWIN__ +#ifndef TIFFaxBlackCodes +#define TIFFFaxBlackCodes Darwin_X_TIFFFaxBlackCodes +#endif +#endif tableentry TIFFFaxBlackCodes[] = { { 10, 0x37, 0 }, /* 0000 1101 11 */ { 3, 0x2, 1 }, /* 010 */ diff --git a/xc/lib/lbxutil/image/lbxfax.h b/xc/lib/lbxutil/image/lbxfax.h index 6b0222743..b2a72cbcd 100644 --- a/xc/lib/lbxutil/image/lbxfax.h +++ b/xc/lib/lbxutil/image/lbxfax.h @@ -22,6 +22,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +/* $XFree86: xc/lib/lbxutil/image/lbxfax.h,v 1.5 2001/03/05 01:05:12 tsi Exp $ */ /* * This header file contains various constants and tables needed @@ -45,6 +46,12 @@ typedef struct tableentry { #define ROUNDUP8(x) ((x + 7) >> 3) +#ifdef __DARWIN__ +#ifndef TIFFaxWhiteCodes +#define TIFFFaxWhiteCodes Darwin_X_TIFFFaxWhiteCodes +#define TIFFFaxBlackCodes Darwin_X_TIFFFaxBlackCodes +#endif +#endif extern tableentry TIFFFaxWhiteCodes[]; extern tableentry TIFFFaxBlackCodes[]; diff --git a/xc/nls/Compose/Imakefile b/xc/nls/Compose/Imakefile index 1c4f5a259..bbe0a87b7 100644 --- a/xc/nls/Compose/Imakefile +++ b/xc/nls/Compose/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:48 cpqbld Exp $ -XCOMM $XFree86: xc/nls/Compose/Imakefile,v 1.14 2001/02/09 00:02:55 dawes Exp $ +XCOMM $XFree86: xc/nls/Compose/Imakefile,v 1.16 2001/03/06 18:03:17 dawes Exp $ #ifndef Win32Architecture #ifndef OS2Architecture @@ -57,10 +57,10 @@ ComposeTarget(koi8-u) ComposeTarget(koi8-c) ComposeTarget(mk_MK.UTF-8) ComposeTarget(mulelao-1) -ComposeTarget(th_TH) ComposeTarget(vi_VN.tcvn) ComposeTarget(vi_VN.viscii) ComposeTarget(zh) +ComposeTarget(zh_CN.gbk) ComposeTarget(zh_TW) ComposeTarget(zh_TW.big5) diff --git a/xc/nls/Compose/iso8859-7 b/xc/nls/Compose/iso8859-7 index a1b1e89cb..bf39c074b 100644 --- a/xc/nls/Compose/iso8859-7 +++ b/xc/nls/Compose/iso8859-7 @@ -3,13 +3,13 @@ # ISO 8859-7 (Greek) Compose Sequence # # -# $XFree86: xc/nls/Compose/iso8859-7,v 1.2 2000/10/27 18:30:51 dawes Exp $ +# $XFree86: xc/nls/Compose/iso8859-7,v 1.3 2001/03/23 18:25:11 paulo Exp $ # # Sequence Definition # # <Multi_key> Means <Compose> # Special Character -<Multi_key> <plus> <plus> : "#" numbersign +<Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe <Multi_key> <A> <T> : "@" at @@ -47,14 +47,6 @@ <Multi_key> <equal> <l> : "\243" sterling <Multi_key> <L> <equal> : "\243" sterling <Multi_key> <equal> <L> : "\243" sterling -<Multi_key> <y> <minus> : "\245" yen -<Multi_key> <minus> <y> : "\245" yen -<Multi_key> <Y> <minus> : "\245" yen -<Multi_key> <minus> <Y> : "\245" yen -<Multi_key> <y> <equal> : "\245" yen -<Multi_key> <equal> <y> : "\245" yen -<Multi_key> <Y> <equal> : "\245" yen -<Multi_key> <equal> <Y> : "\245" yen <Multi_key> <s> <o> : "\247" section <Multi_key> <o> <s> : "\247" section <Multi_key> <S> <O> : "\247" section @@ -67,18 +59,6 @@ <Multi_key> <0> <S> : "\247" section <Multi_key> <s> <0> : "\247" section <Multi_key> <0> <s> : "\247" section -<Multi_key> <x> <o> : "\244" currency -<Multi_key> <o> <x> : "\244" currency -<Multi_key> <X> <O> : "\244" currency -<Multi_key> <O> <X> : "\244" currency -<Multi_key> <x> <O> : "\244" currency -<Multi_key> <O> <x> : "\244" currency -<Multi_key> <X> <o> : "\244" currency -<Multi_key> <o> <X> : "\244" currency -<Multi_key> <x> <0> : "\244" currency -<Multi_key> <0> <x> : "\244" currency -<Multi_key> <X> <0> : "\244" currency -<Multi_key> <0> <X> : "\244" currency <Multi_key> <c> <o> : "\251" copyright <Multi_key> <o> <c> : "\251" copyright <Multi_key> <C> <O> : "\251" copyright @@ -92,10 +72,6 @@ <Multi_key> <C> <0> : "\251" copyright <Multi_key> <0> <C> : "\251" copyright <Multi_key> <parenleft> <c> : "\251" copyright -<Multi_key> <a> <underscore> : "\252" ordfeminine -<Multi_key> <underscore> <a> : "\252" ordfeminine -<Multi_key> <A> <underscore> : "\252" ordfeminine -<Multi_key> <underscore> <A> : "\252" ordfeminine <Multi_key> <less> <less> : "\253" guillemotleft <Multi_key> <greater> <greater> : "\273" guillemotright <Multi_key> <0> <asciicircum> : "\260" degree @@ -138,7 +114,7 @@ <Multi_key> <underscore> <underscore> : "\257" macron # should be Greek tonos but not defined in X11 <Multi_key> <apostrophe> <apostrophe> : "\264" acute -# should be Greek dialitika but not defined in X11 +# should be Greek dialytika but not defined in X11 <Multi_key> <quotedbl> <quotedbl> : "\250" diaeresis # Accented Alphabet @@ -182,11 +158,6 @@ <Multi_key> <Greek_upsilon> <quotedbl> : "\373" Greek_upsilondieresis <Multi_key> <quotedbl> <Greek_upsilon> : "\373" Greek_upsilondieresis -<Multi_key> <Greek_iota> <asciicircum> : "\300" Greek_iotaaccentdieresis -<Multi_key> <asciicircum> <Greek_iota> : "\300" Greek_iotaaccentdieresis -<Multi_key> <Greek_upsilon> <asciicircum>: "\340" Greek_upsilonaccentdieresis -<Multi_key> <asciicircum> <Greek_upsilon>: "\340" Greek_upsilonaccentdieresis - # # # dead key accent keysyms @@ -214,34 +185,42 @@ <dead_acute> <apostrophe> : "\264" acute <dead_diaeresis> <quotedbl> : "\250" diaeresis -# Accented Alphabet -<dead_acute> <Greek_ALPHA> : "\266" Greek_ALPHAaccent -<dead_acute> <Greek_EPSILON> : "\270" Greek_EPSILONaccent -<dead_acute> <Greek_ETA> : "\271" Greek_ETAaccent -<dead_acute> <Greek_IOTA> : "\272" Greek_IOTAaccent -<dead_acute> <Greek_OMICRON> : "\274" Greek_OMICRONaccent -<dead_acute> <Greek_UPSILON> : "\276" Greek_UPSILONaccent -<dead_acute> <Greek_OMEGA> : "\277" Greek_OMEGAaccent -<dead_diaeresis> <Greek_IOTA> : "\332" Greek_IOTAdiaeresis -<dead_diaeresis> <Greek_IOTA> : "\332" Greek_IOTAdieresis -<dead_diaeresis> <Greek_UPSILON> : "\333" Greek_UPSILONdieresis - -<dead_acute> <Greek_alpha> : "\334" Greek_alphaaccent -<dead_acute> <Greek_epsilon> : "\335" Greek_epsilonaccent -<dead_acute> <Greek_eta> : "\336" Greek_etaaccent -<dead_acute> <Greek_iota> : "\337" Greek_iotaaccent -<dead_acute> <Greek_omicron> : "\374" Greek_omicronaccent -<dead_acute> <Greek_upsilon> : "\375" Greek_upsilonaccent -<dead_acute> <Greek_omega> : "\376" Greek_omegaaccent -<dead_diaeresis> <Greek_iota> : "\372" Greek_iotadieresis -<dead_diaeresis> <Greek_upsilon> : "\373" Greek_upsilondieresis +# Accented Alphabet (plus some more symbols) +<dead_acute> <Greek_alpha> : "\334" Greek_alphaaccent +<dead_acute> <Greek_epsilon> : "\335" Greek_epsilonaccent +<dead_acute> <Greek_eta> : "\336" Greek_etaaccent +<dead_acute> <Greek_iota> : "\337" Greek_iotaaccent +<dead_acute> <Greek_omicron> : "\374" Greek_omicronaccent +<dead_acute> <Greek_upsilon> : "\375" Greek_upsilonaccent +<dead_acute> <Greek_omega> : "\376" Greek_omegaaccent +<dead_acute> <Greek_ALPHA> : "\266" Greek_ALPHAaccent +<dead_acute> <Greek_EPSILON> : "\270" Greek_EPSILONaccent +<dead_acute> <Greek_ETA> : "\271" Greek_ETAaccent +<dead_acute> <Greek_IOTA> : "\272" Greek_IOTAaccent +<dead_acute> <Greek_OMICRON> : "\274" Greek_OMICRONaccent +<dead_acute> <Greek_UPSILON> : "\276" Greek_UPSILONaccent +<dead_acute> <Greek_OMEGA> : "\277" Greek_OMEGAaccent +<dead_acute> <space> : "\264" acute +<dead_acute> <dead_acute> : "\264" acute +<dead_acute> <period> : "\267" periodcentered +<dead_acute> <less> : "\253" guillemotleft +<dead_acute> <greater> : "\273" guillemotright -<dead_circumflex> <Greek_iota> : "\300" Greek_iotaaccentdieresis -<dead_circumflex> <Greek_upsilon> : "\340" Greek_upsilonaccentdieresis - -<dead_acute> <dead_diaeresis> <Greek_iota> : "\300" Greek_iotaaccentdieresis -<dead_acute> <dead_diaeresis> <Greek_upsilon> : "\340" Greek_upsilonaccentdieresis +<dead_diaeresis> <Greek_iota> : "\372" Greek_iotadieresis +<dead_diaeresis> <Greek_upsilon> : "\373" Greek_upsilondieresis +<dead_diaeresis> <Greek_IOTA> : "\332" Greek_IOTAdiaeresis +<dead_diaeresis> <Greek_IOTA> : "\332" Greek_IOTAdieresis +<dead_diaeresis> <Greek_UPSILON> : "\333" Greek_UPSILONdieresis +<dead_diaeresis> <space> : "\250" diaeresis +<dead_diaeresis> <dead_diaeresis> : "\250" diaeresis +<dead_diaeresis> <period> : "\267" periodcentered +<dead_diaeresis> <less> : "\253" guillemotleft +<dead_diaeresis> <greater> : "\273" guillemotright -<dead_acute> <Greek_sigma> : "\362" Greek_finalsmallsigma -<dead_diaeresis> <Greek_sigma> : "\362" Greek_finalsmallsigma +<dead_acute> <dead_diaeresis> <Greek_iota> : "\300" Greek_iotaaccentdieresis +<dead_acute> <dead_diaeresis> <Greek_upsilon> : "\340" Greek_upsilonaccentdieresis +<dead_acute> <dead_diaeresis> <space> : "\265" Greek_accentdieresis +<dead_diaeresis> <dead_acute> <Greek_iota> : "\300" Greek_iotaaccentdieresis +<dead_diaeresis> <dead_acute> <Greek_upsilon> : "\340" Greek_upsilonaccentdieresis +<dead_diaeresis> <dead_acute> <space> : "\265" Greek_accentdieresis diff --git a/xc/nls/Compose/zh_CN.gbk b/xc/nls/Compose/zh_CN.gbk new file mode 100644 index 000000000..347c03f8d --- /dev/null +++ b/xc/nls/Compose/zh_CN.gbk @@ -0,0 +1,15 @@ +# +# zh_CN.GBK Compose Sequence +# +# Sequence Definition +# +# $XFree86: xc/nls/Compose/zh_CN.gbk,v 1.1 2001/03/06 18:03:17 dawes Exp $ +# +# This file currently has no entries. It appears that a compose file (even +# just an empty one) is required for the appropriate keysyms to work for +# this encoding. +# +# <Multi_key> Means <Compose> +# Special Character + +# End of Sequence Definition diff --git a/xc/nls/XLC_LOCALE/Imakefile b/xc/nls/XLC_LOCALE/Imakefile index 3fd83d1b9..7c020869e 100644 --- a/xc/nls/XLC_LOCALE/Imakefile +++ b/xc/nls/XLC_LOCALE/Imakefile @@ -2,7 +2,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:59 cpqbld Exp $ -XCOMM $XFree86: xc/nls/XLC_LOCALE/Imakefile,v 1.17 2001/02/09 00:02:55 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/Imakefile,v 1.19 2001/03/06 18:54:45 dawes Exp $ WCHAR32 = HasWChar32 @@ -85,6 +85,8 @@ LTarget(tscii-0) LTarget(vi_VN.tcvn) LTarget(vi_VN.viscii) LTarget(zh) +LTarget(zh_CN.gbk) +LTarget(zh_HK.big5hkscs) LTarget(zh_TW) LTarget(zh_TW.big5) LTarget(th_TH) diff --git a/xc/nls/XLC_LOCALE/zh_CN.gbk b/xc/nls/XLC_LOCALE/zh_CN.gbk new file mode 100644 index 000000000..f9b1ab1ae --- /dev/null +++ b/xc/nls/XLC_LOCALE/zh_CN.gbk @@ -0,0 +1,71 @@ +XCOMM +XCOMM X11R6 L10N for Chinese GBK Encoding. +XCOMM modified from xc/nls/XLC_LOCALE/zh_TW.Big5 +XCOMM by Sean Chen <seanc@turbolinux.com> +XCOMM +XCOMM $XFree86: xc/nls/XLC_LOCALE/zh_CN.gbk,v 1.1 2001/03/06 18:03:18 dawes Exp $ + +XCOMM +XCOMM XLC_FONTSET category +XCOMM +XLC_FONTSET +XCOMM fs0 class (7 bit ASCII) +fs0 { + charset { + name ISO8859-1:GL + } + font { + primary ISO8859-1:GL + vertical_rotate all + } +} +XCOMM fs1 class +fs1 { + charset { + name GBK-0:GLGR + } + font { + primary GBK-0:GLGR + substitute GB13000.1993-1:GLGR + } +} +END XLC_FONTSET + +XCOMM +XCOMM XLC_XLOCALE category +XCOMM +XLC_XLOCALE + +encoding_name zh_CN.GBK +mb_cur_max 2 +state_depend_encoding False + +wc_encoding_mask \x00008000 +wc_shift_bits 8 + +use_stdc_env True +force_convert_to_mb True + +XCOMM cs0 class +cs0 { + side GL:Default + length 1 + wc_encoding \x00000000 + ct_encoding ISO8859-1:GL +} + +XCOMM cs1 class +cs1 { + side none + length 2 + byte1 \x81,\xfe + byte2 \x40,\x7e;\x80,\xfe + + wc_encoding \x00008000 + ct_encoding GBK-0:GLGR:\x1b\x25\x2f\x32\x80\x88\x47\x42\x4b\x2d\x30\x02 + + mb_conversion [\x8140,\xfefe]->\x0140 + ct_conversion [\x0140,\x7efe]->\x8140 +} + +END XLC_XLOCALE diff --git a/xc/nls/XLC_LOCALE/zh_HK.big5hkscs b/xc/nls/XLC_LOCALE/zh_HK.big5hkscs new file mode 100644 index 000000000..44e32f835 --- /dev/null +++ b/xc/nls/XLC_LOCALE/zh_HK.big5hkscs @@ -0,0 +1,71 @@ +XCOMM +XCOMM (c) 1996, X11R6 L10N for Taiwan and Big5 Encoding Project +XCOMM +XCOMM modified for X11R6.3 by Hung-Chi Chu <hcchu@r350.ee.ntu.edu.tw> 1998/01/10 +XCOMM modified for Big5HKSCS by Roger So <roger.so@sw-linux.com> +XCOMM +XCOMM $XFree86: xc/nls/XLC_LOCALE/zh_HK.big5hkscs,v 1.1 2001/03/06 18:54:46 dawes Exp $ +XCOMM +XCOMM XLC_FONTSET category +XCOMM +XLC_FONTSET +XCOMM fs0 class (7 bit ASCII) +fs0 { + charset { + name ISO8859-1:GL + } + font { + primary ISO8859-1:GL + vertical_rotate all + } +} +XCOMM fs1 class +fs1 { + charset { + name BIG5HKSCS-0:GLGR + } + font { + primary BIG5HKSCS-0:GLGR + substitute BIG5HKSCS-0:GLGR + } +} +END XLC_FONTSET + +XCOMM +XCOMM XLC_XLOCALE category +XCOMM +XLC_XLOCALE + +encoding_name zh_HK.big5hkscs +mb_cur_max 2 +state_depend_encoding False + +wc_encoding_mask \x00008000 +wc_shift_bits 8 + +use_stdc_env True +force_convert_to_mb True + +XCOMM cs0 class +cs0 { + side GL:Default + length 1 + wc_encoding \x00000000 + ct_encoding ISO8859-1:GL +} + +XCOMM cs1 class +cs1 { + side none + length 2 + byte1 \x85,\xfe + byte2 \x40,\x7e;\xa1,\xfe + + wc_encoding \x00008000 + ct_encoding BIG5HKSCS-0:GLGR:\x1b\x25\x2f\x32\x80\x8c\x42\x49\x47\x35\x48\x4b\x53\x43\x53\x2d\x30\x02 + + mb_conversion [\x8540,\xfefe]->\x0540 + ct_conversion [\x0540,\x7efe]->\x8540 +} + +END XLC_XLOCALE diff --git a/xc/nls/compose.dir b/xc/nls/compose.dir index bb6362cc6..9a10a73ea 100644 --- a/xc/nls/compose.dir +++ b/xc/nls/compose.dir @@ -4,7 +4,7 @@ XCOMM This file contains compose table file name. XCOMM The first word is the compose table file name and XCOMM the second word is full locale name. XCOMM -XCOMM $XFree86: xc/nls/compose.dir,v 1.14 2001/02/09 00:02:54 dawes Exp $ +XCOMM $XFree86: xc/nls/compose.dir,v 1.16 2001/04/06 18:16:27 dawes Exp $ XCOMM #ifdef R63_COMPAT XCOMM These entries are in the old format (no ':') @@ -196,7 +196,6 @@ iso8859-15/Compose sv_SE.ISO8859-15 tscii-0/Compose ta_IN.TSCII-0 koi8-c/Compose tg_TJ.KOI8-C iso8859-1/Compose tl_PH.ISO8859-1 -th_TH/Compose th_TH.TIS620 iso8859-9/Compose tr_TR.ISO8859-9 tatar-cyr/Compose tt_RU.TATAR-CYR koi8-c/Compose tt_RU.KOI8-C @@ -208,6 +207,7 @@ iso8859-1/Compose wa_BE.ISO8859-1 microsoft-cp1255/Compose yi_US.CP1255 zh/Compose zh_CN.eucCN zh/Compose zh_CN.GB2312 +zh_CN.gbk/Compose zh_CN.GBK zh_TW.big5/Compose zh_TW.big5 zh_TW.big5/Compose zh_TW.Big5 zh_TW/Compose zh_TW.eucTW @@ -402,7 +402,6 @@ iso8859-15/Compose: sv_SE.ISO8859-15 tscii-0/Compose: ta_IN.TSCII-0 koi8-c/Compose: tg_TJ.KOI8-C iso8859-1/Compose: tl_PH.ISO8859-1 -th_TH/Compose: th_TH.TIS620 iso8859-9/Compose: tr_TR.ISO8859-9 tatar-cyr/Compose: tt_RU.TATAR-CYR koi8-c/Compose: tt_RU.KOI8-C @@ -411,9 +410,10 @@ microsoft-cp1256/Compose: ur_PK.CP1256 vi_VN.viscii/Compose: vi_VN.VISCII vi_VN.tcvn/Compose: vi_VN.TCVN iso8859-1/Compose: wa_BE.ISO8859-1 +microsoft-cp1255/Compose: yi_US.CP1256 zh/Compose: zh_CN.eucCN zh/Compose: zh_CN.GB2312 -microsoft-cp1255/Compose: yi_US.CP1256 +zh_CN.gbk/Compose: zh_CN.GBK zh_TW.big5/Compose: zh_TW.big5 zh_TW.big5/Compose: zh_TW.Big5 zh_TW/Compose: zh_TW.eucTW diff --git a/xc/nls/locale.alias b/xc/nls/locale.alias index e1a64d44c..f77c57b0a 100644 --- a/xc/nls/locale.alias +++ b/xc/nls/locale.alias @@ -5,7 +5,7 @@ XCOMM Each alias name is described within one line. XCOMM The first word is the alias name (simplified locale name) XCOMM the second word is full locale name. XCOMM -XCOMM $XFree86: xc/nls/locale.alias,v 1.36 2001/02/09 00:02:54 dawes Exp $ +XCOMM $XFree86: xc/nls/locale.alias,v 1.37 2001/03/06 18:03:16 dawes Exp $ XCOMM #ifdef R63_COMPAT XCOMM These entries are in the old format (no ':') @@ -449,6 +449,7 @@ zh_CN.Big5 zh_TW.big5 zh_CN.EUC zh_CN.eucCN zh_CN.euc zh_CN.eucCN zh_CN.gb2312 zh_CN.eucCN +zh_CN.gbk zh_CN.GBK zh_TW zh_TW.big5 zh_TW.EUC zh_TW.eucTW zh_TW.euc zh_TW.eucTW @@ -1041,6 +1042,7 @@ zh_CN.Big5: zh_TW.big5 zh_CN.EUC: zh_CN.eucCN zh_CN.euc: zh_CN.eucCN zh_CN.gb2312: zh_CN.eucCN +zh_CN.gbk: zh_CN.GBK zh_TW: zh_TW.big5 zh_TW.EUC: zh_TW.eucTW zh_TW.euc: zh_TW.eucTW diff --git a/xc/nls/locale.dir b/xc/nls/locale.dir index c7bea0bd2..ec32afb1f 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.21 2001/02/09 00:02:54 dawes Exp $ +XCOMM $XFree86: xc/nls/locale.dir,v 1.23 2001/03/06 18:54:45 dawes Exp $ XCOMM #ifdef R63_COMPAT XCOMM These entries are in the old format (no ':') @@ -198,6 +198,8 @@ iso8859-15/XLC_LOCALE wa_BE.ISO8859-15 microsoft-cp1255/XLC_LOCALE yi_US.CP1255 zh/XLC_LOCALE zh_CN.eucCN zh/XLC_LOCALE zh_CN.GB2312 +zh_CN.gbk/XLC_LOCALE zh_CN.GBK +zh_HK.big5hkscs/XLC_LOCALE zh_HK.big5hkscs zh_TW.big5/XLC_LOCALE zh_TW.big5 zh_TW.big5/XLC_LOCALE zh_TW.Big5 zh_TW/XLC_LOCALE zh_TW.eucTW @@ -532,6 +534,8 @@ iso8859-15/XLC_LOCALE: wa_BE.ISO8859-15 microsoft-cp1255/XLC_LOCALE: yi_US.CP1255 zh/XLC_LOCALE: zh_CN.eucCN zh/XLC_LOCALE: zh_CN.GB2312 +zh_CN.gbk/XLC_LOCALE: zh_CN.GBK +zh_HK.big5hkscs/XLC_LOCALE: zh_HK.big5hkscs zh_TW.big5/XLC_LOCALE: zh_TW.big5 zh_TW.big5/XLC_LOCALE: zh_TW.Big5 zh_TW/XLC_LOCALE: zh_TW.eucTW diff --git a/xc/programs/Imakefile b/xc/programs/Imakefile index ffa6039b7..be64af27a 100644 --- a/xc/programs/Imakefile +++ b/xc/programs/Imakefile @@ -2,7 +2,7 @@ XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:47:01 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Imakefile,v 3.37 2001/02/13 19:19:12 dawes Exp $ +XCOMM $XFree86: xc/programs/Imakefile,v 3.43 2001/04/02 21:12:07 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" @@ -64,27 +64,34 @@ XFINDPROXYSRCDIR = xfindproxy MKCFMSRCDIR = mkcfm #endif +/* makepsres should be considered as part of the DPS libraries */ #if BuildDPSLibraries MAKEPSRESDIR = makepsres #endif +/* on the other hand, the following are independent clients */ +#if BuildDPSClients + DPSCLIENTDIRS = dpsinfo dpsexec texteroids +#endif + XPMCLIENTDIRS = cxpm sxpm -#ifdef Freetype2Dir +#if UseFreetype2 XFTCACHEDIR = xftcache #endif -#if BuildGLXLibrary - GLXINFODIR = glxinfo +#if BuildGLXLibrary && BuildGLULibrary + GLXCLIENTDIRS = glxinfo glxgears #endif -#if BuildServersOnly +#if BuildServersOnly || !BuildClients SUBDIRS = $(XSSRCDIR) #else SUBDIRS = \ appres bdftopcf bitmap \ $(SCREENSAVESRCDIR) editres fslsfonts fstobdf iceauth \ ico listres \ - $(MAKEPSRESDIR) $(MKCFMSRCDIR) \ + $(MAKEPSRESDIR) $(DPSCLIENTDIRS) \ + $(MKCFMSRCDIR) \ mkfontdir oclock $(PROXYMGRSRCDIR) $(RGBSRCDIR) $(RSTARTSRCDIR) \ showfont \ $(SMPROXYSRCDIR) $(TWMSRCDIR) viewres x11perf xauth xbiff xcalc \ @@ -93,13 +100,13 @@ SUBDIRS = \ $(XF86DGASRCDIR) xedit xev xeyes xfd xfontsel $(XFSSRCDIR) xfsinfo \ $(XFINDPROXYSRCDIR) $(XFWPSRCDIR) $(XGAMMASRCDIR) xgc $(XHOSTSRCDIR) \ xieperf $(XINITSRCDIR) $(XKBSRCDIRS) xkill xload xlogo xlsatoms \ - xlsclients xlsfonts xmag xman xmessage xmodmap xprop xrdb \ + xlsclients xlsfonts xmag xman xmessage xmh xmodmap xprop xrdb \ xrefresh $(XRXSRCDIR) xset \ xsetroot $(XSMSRCDIR) xstdcmap xsetmode xsetpointer \ $(XTERMSRCDIR) $(XVIDTUNESRCDIR) xwd xwininfo xwud \ $(XPMCLIENTDIRS) $(XVINFOSRCDIR) \ $(XSSRCDIR) $(XASSRCDIR) $(LBXPROXYSRCDIR) $(SCRIPTSDIR) \ - $(GLXINFODIR) $(XFTCACHEDIR) + $(GLXCLIENTDIRS) $(XFTCACHEDIR) #endif MakeSubdirs($(SUBDIRS)) diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 1085aaf64..4c6467b6b 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.29 2000/12/22 02:40:00 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.30 2001/03/21 16:21:40 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -81,6 +81,7 @@ static RESTYPE DRIFullScreenResType; static RESTYPE DRIDrawablePrivResType; static RESTYPE DRIContextPrivResType; +static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv); /* Wrapper just like xf86DrvMsg, but without the verbosity level checking. @@ -145,6 +146,9 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->nrWindows = 0; pDRIPriv->fullscreen = NULL; + pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx; + pDRIPriv->createDummyCtxPriv = pDRIInfo->createDummyCtxPriv; + if (drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString) < 0) { pDRIPriv->directRenderingSupport = FALSE; pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; @@ -165,7 +169,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) 0, pDRIPriv->pDriverInfo->SAREASize, DRM_SHM, - DRM_CONTAINS_LOCK, + DRM_CONTAINS_LOCK, &pDRIPriv->hSAREA) < 0) { pDRIPriv->directRenderingSupport = FALSE; @@ -179,7 +183,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) "[drm] added %d byte SAREA at 0x%08lx\n", pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA); - if (drmMap( pDRIPriv->drmFD, + if (drmMap( pDRIPriv->drmFD, pDRIPriv->hSAREA, pDRIPriv->pDriverInfo->SAREASize, (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0) @@ -194,12 +198,12 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA 0x%08lx to %p\n", pDRIPriv->hSAREA, pDRIPriv->pSAREA); - - if (drmAddMap( pDRIPriv->drmFD, + + if (drmAddMap( pDRIPriv->drmFD, (drmHandle)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, pDRIPriv->pDriverInfo->frameBufferSize, - DRM_FRAME_BUFFER, - 0, + DRM_FRAME_BUFFER, + 0, &pDRIPriv->hFrameBuffer) < 0) { pDRIPriv->directRenderingSupport = FALSE; @@ -234,7 +238,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) /* validate max drawable table entry set by driver */ if ((pDRIPriv->pDriverInfo->maxDrawableTableEntry <= 0) || (pDRIPriv->pDriverInfo->maxDrawableTableEntry > SAREA_MAX_DRAWABLES)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "Invalid max drawable table size set by driver: %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry); } @@ -266,7 +270,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, &pDRIPriv->myContext, flags))) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to create server context\n"); return FALSE; } @@ -289,12 +293,12 @@ DRIFinishScreenInit(ScreenPtr pScreen) /* Server will handle 3D swaps, and hide 2D swaps from kernel. * Register server context as a preserved context. */ - + /* allocate memory for hidden context store */ pDRIPriv->hiddenContextStore = (void *)xcalloc(1, pDRIInfo->contextSize); if (!pDRIPriv->hiddenContextStore) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to allocate hidden context\n"); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; @@ -304,17 +308,17 @@ DRIFinishScreenInit(ScreenPtr pScreen) pDRIPriv->partial3DContextStore = (void *)xcalloc(1, pDRIInfo->contextSize); if (!pDRIPriv->partial3DContextStore) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] failed to allocate partial 3D context\n"); xfree(pDRIPriv->hiddenContextStore); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } - + /* save initial context store */ if (pDRIInfo->SwapContext) { (*pDRIInfo->SwapContext)( - pScreen, + pScreen, DRI_NO_SYNC, DRI_2D_CONTEXT, pDRIPriv->hiddenContextStore, @@ -328,7 +332,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) * setup signal handler for receiving swap requests from kernel */ if (!drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to setup DRM signal handler\n"); if (pDRIPriv->hiddenContextStore) xfree(pDRIPriv->hiddenContextStore); @@ -337,7 +341,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } else { - DRIDrvMsg(pScreen->myNum, X_INFO, + DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] installed DRM signal handler\n"); } @@ -371,7 +375,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame; } - + DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n"); return TRUE; @@ -394,13 +398,17 @@ DRICloseScreen(ScreenPtr pScreen) if (pDRIPriv->pDriverInfo->driverSwapMethod != DRI_KERNEL_SWAP) { if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to remove DRM signal handler\n"); } } + if (pDRIPriv->dummyCtxPriv && pDRIPriv->createDummyCtx) { + DRIDestroyDummyContext(pScreen, pDRIPriv->createDummyCtxPriv); + } + if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to destroy server context\n"); } @@ -434,7 +442,7 @@ DRICloseScreen(ScreenPtr pScreen) pDRIPriv->hSAREA, pDRIPriv->pSAREA); } - + drmClose(pDRIPriv->drmFD); xfree(pDRIPriv); pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; @@ -451,7 +459,7 @@ DRIExtensionInit(void) return FALSE; } - /* Allocate a window private index with a zero sized private area for + /* Allocate a window private index with a zero sized private area for * each window, then should a window become a DRI window, we'll hang * a DRIWindowPrivateRec off of this private index. */ @@ -544,7 +552,7 @@ DRIGetClientDriverName(ScreenPtr pScreen, /* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper functions that layer on drmCreateContext and drmAddContextTag. - + DRICreateContextPriv always creates a kernel drmContext and then calls DRICreateContextPrivFromHandle to create a DRIContextPriv structure for DRI tracking. For the SIGIO handler, the drmContext is associated with @@ -585,7 +593,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, pDRIContextPriv->pContextStore = (void *)(pDRIContextPriv + 1); drmAddContextTag(pDRIPriv->drmFD, hHWContext, pDRIContextPriv); - + pDRIContextPriv->hwContext = hHWContext; pDRIContextPriv->pScreen = pScreen; pDRIContextPriv->flags = flags; @@ -595,7 +603,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_2DONLY)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to set 2D context flag\n"); DRIDestroyContextPriv(pDRIContextPriv); return NULL; @@ -605,7 +613,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_PRESERVED)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to set preserved flag\n"); DRIDestroyContextPriv(pDRIContextPriv); return NULL; @@ -620,7 +628,7 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) DRIScreenPrivPtr pDRIPriv; if (!pDRIContextPriv) return TRUE; - + pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) { @@ -641,10 +649,72 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) return TRUE; } +static Bool +DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; + __GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual; + void **pVisualConfigPriv = pGLXScreen->pVisualPriv; + DRIContextPrivPtr pDRIContextPriv; + void *contextStore; + VisualPtr visual; + int visNum; + + visual = pScreen->visuals; + + /* Find the X visual that corresponds the the first GLX visual */ + for (visNum = 0; + visNum < pScreen->numVisuals; + visNum++, visual++) { + if (pGLXVis->vid == visual->vid) + break; + } + if (visNum == pScreen->numVisuals) return FALSE; + + if (!(pDRIContextPriv = + DRICreateContextPriv(pScreen, + &pDRIPriv->pSAREA->dummy_context, 0))) { + return FALSE; + } + + contextStore = DRIGetContextStore(pDRIContextPriv); + if (pDRIPriv->pDriverInfo->CreateContext && needCtxPriv) { + if (!pDRIPriv->pDriverInfo->CreateContext(pScreen, visual, + pDRIPriv->pSAREA->dummy_context, + *pVisualConfigPriv, + (DRIContextType)(long)contextStore)) { + DRIDestroyContextPriv(pDRIContextPriv); + return FALSE; + } + } + + pDRIPriv->dummyCtxPriv = pDRIContextPriv; + return TRUE; +} + +static void +DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIContextPrivPtr pDRIContextPriv = pDRIPriv->dummyCtxPriv; + void *contextStore; + + if (!pDRIContextPriv) return; + if (pDRIPriv->pDriverInfo->DestroyContext && hasCtxPriv) { + contextStore = DRIGetContextStore(pDRIContextPriv); + pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen, + pDRIContextPriv->hwContext, + (DRIContextType)(long)contextStore); + } + + DRIDestroyContextPriv(pDRIPriv->dummyCtxPriv); + pDRIPriv->dummyCtxPriv = NULL; +} + Bool DRICreateContext(ScreenPtr pScreen, VisualPtr visual, - XID context, drmContextPtr pHWContext -) + XID context, drmContextPtr pHWContext) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; @@ -654,6 +724,14 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual, void *contextStore; int visNum; + if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) { + if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) { + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] Could not create dummy context\n"); + return FALSE; + } + } + /* Find the GLX visual associated with the one requested */ for (visNum = 0; visNum < pGLXScreen->numVisuals; @@ -664,14 +742,14 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual, /* No matching GLX visual found */ return FALSE; } - + if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) { return FALSE; } - contextStore=DRIGetContextStore(pDRIContextPriv); + contextStore = DRIGetContextStore(pDRIContextPriv); if (pDRIPriv->pDriverInfo->CreateContext) { - if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, + if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, *pHWContext, *pVisualConfigPriv, (DRIContextType)(long)contextStore))) { DRIDestroyContextPriv(pDRIContextPriv); @@ -703,9 +781,10 @@ DRIContextPrivDelete(pointer pResource, XID id) pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); if (pDRIPriv->pDriverInfo->DestroyContext) { - contextStore=DRIGetContextStore(pDRIContextPriv); - (pDRIPriv->pDriverInfo->DestroyContext)(pDRIContextPriv->pScreen, - pDRIContextPriv->hwContext, (DRIContextType)(long)contextStore); + contextStore = DRIGetContextStore(pDRIContextPriv); + pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen, + pDRIContextPriv->hwContext, + (DRIContextType)(long)contextStore); } return DRIDestroyContextPriv(pDRIContextPriv); } @@ -715,9 +794,9 @@ DRIContextPrivDelete(pointer pResource, XID id) * in the case of transition from private to shared backbuffers. It's * not necessary for correctness, because DRIClipNotify gets called in * time to prevent any conflict, but the transition from - * shared->private is sometimes missed if we don't do this. + * shared->private is sometimes missed if we don't do this. */ -static void +static void DRIClipNotifyAllDrawables(ScreenPtr pScreen) { int i; @@ -725,48 +804,42 @@ DRIClipNotifyAllDrawables(ScreenPtr pScreen) for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; - } + } } -static void +static void DRITransitionToSharedBuffers(ScreenPtr pScreen) { -/* ErrorF("DRITransitionToSharedBuffers\n"); */ - DRIClipNotifyAllDrawables( pScreen ); + DRIClipNotifyAllDrawables( pScreen ); } -static void +static void DRITransitionToPrivateBuffers(ScreenPtr pScreen) { -/* ErrorF("DRITransitionToPrivateBuffers\n"); */ - DRIClipNotifyAllDrawables( pScreen ); + DRIClipNotifyAllDrawables( pScreen ); } static void DRITransitionTo3d(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - -/* ErrorF("DRITransitionTo3d\n"); */ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - if (pDRIInfo->TransitionTo3d) - pDRIInfo->TransitionTo3d( pScreen ); + if (pDRIInfo->TransitionTo3d) + pDRIInfo->TransitionTo3d( pScreen ); } static void DRITransitionTo2d(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - -/* ErrorF("DRITransitionTo2d\n"); */ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - if (pDRIInfo->TransitionTo2d) - pDRIInfo->TransitionTo2d( pScreen ); + if (pDRIInfo->TransitionTo2d) + pDRIInfo->TransitionTo2d( pScreen ); } @@ -802,7 +875,7 @@ DRICreateDrawable(ScreenPtr pScreen, Drawable id, pDRIDrawablePriv->drawableIndex = -1; /* save private off of preallocated index */ - pWin->devPrivates[DRIWindowPrivIndex].ptr = + pWin->devPrivates[DRIWindowPrivIndex].ptr = (pointer)pDRIDrawablePriv; switch (++pDRIPriv->nrWindows) { @@ -841,7 +914,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable) pDRIDrawablePriv->refCount--; if (pDRIDrawablePriv->refCount <= 0) { /* This calls back DRIDrawablePrivDelete which frees private area */ - FreeResourceByType(id, DRIDrawablePrivResType, FALSE); + FreeResourceByType(id, DRIDrawablePrivResType, FALSE); } } else { /* pixmap (or for GLX 1.3, a PBuffer) */ @@ -869,7 +942,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id) pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; } - if (drmDestroyDrawable(pDRIPriv->drmFD, + if (drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable)) { return FALSE; } @@ -931,7 +1004,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, if (!(pDRIPriv->DRIDrawables[i])) { pDRIPriv->DRIDrawables[i] = pDrawable; pDRIDrawablePriv->drawableIndex = i; - pDRIPriv->pSAREA->drawableTable[i].stamp = + pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; break; } @@ -944,10 +1017,10 @@ DRIGetDrawableInfo(ScreenPtr pScreen, int oldestIndex = 0; i = pDRIPriv->pDriverInfo->maxDrawableTableEntry; while (i--) { - if (pDRIPriv->pSAREA->drawableTable[i].stamp < + if (pDRIPriv->pSAREA->drawableTable[i].stamp < oldestStamp) { oldestIndex = i; - oldestStamp = + oldestStamp = pDRIPriv->pSAREA->drawableTable[i].stamp; } } @@ -962,15 +1035,15 @@ DRIGetDrawableInfo(ScreenPtr pScreen, pDRIPriv->DRIDrawables[oldestIndex] = pDrawable; /* validate SAREA entry */ - pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = + pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = DRIDrawableValidationStamp++; /* check for stamp wrap around */ if (oldestStamp > DRIDrawableValidationStamp) { /* walk SAREA table and invalidate all drawables */ - for( i=0; - i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; + for( i=0; + i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; @@ -986,10 +1059,10 @@ DRIGetDrawableInfo(ScreenPtr pScreen, pDRIDrawablePriv->drawableIndex); /* reinit drawable ID if window is visible */ - if ((pWin->viewable) && + if ((pWin->viewable) && (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS)) { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, + (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, &pWin->clipList, pDRIDrawablePriv->drawableIndex); } } @@ -1017,7 +1090,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, *numClipRects = 1; *pClipRects = &pDRIPriv->fullscreen_rect; } - + *backX = *X; *backY = *Y; @@ -1166,7 +1239,7 @@ DRIDoWakeupHandler(int screenNum, pointer wakeupData, } } -void +void DRIDoBlockHandler(int screenNum, pointer blockData, pointer pTimeout, pointer pReadmask) { @@ -1185,7 +1258,7 @@ DRIDoBlockHandler(int screenNum, pointer blockData, DRIUnlock(pScreen); } -void +void DRISwapContext(int drmFD, void *oldctx, void *newctx) { DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx; @@ -1228,7 +1301,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) #endif if (!pDRIPriv->pDriverInfo->SwapContext) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] DDX driver missing context swap call back\n"); return; } @@ -1244,7 +1317,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContextType = DRI_NO_CONTEXT; } newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1258,8 +1331,8 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) /* optimize 2D context swaps */ if (newContext->flags & DRI_CONTEXT_2DONLY) { - /* go from 3D context to 2D context and only save 2D - * subset of 3D state + /* go from 3D context to 2D context and only save 2D + * subset of 3D state */ oldContextStore = DRIGetContextStore(oldContext); oldContextType = DRI_2D_CONTEXT; @@ -1270,8 +1343,8 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) } else if (oldContext->flags & DRI_CONTEXT_2DONLY) { if (pDRIPriv->lastPartial3DContext == newContext) { - /* go from 2D context back to previous 3D context and - * only restore 2D subset of previous 3D state + /* go from 2D context back to previous 3D context and + * only restore 2D subset of previous 3D state */ oldContextStore = DRIGetContextStore(oldContext); oldContextType = DRI_2D_CONTEXT; @@ -1284,7 +1357,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) /* call DDX driver to do partial restore */ oldContextStore = DRIGetContextStore(oldContext); - newContextStore = + newContextStore = DRIGetContextStore(pDRIPriv->lastPartial3DContext); (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, DRI_2D_SYNC, @@ -1298,7 +1371,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1314,7 +1387,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1380,7 +1453,7 @@ DRITreeTraversal(WindowPtr pWin, pointer data) return WT_WALKCHILDREN; } -void +void DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1613,7 +1686,7 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy) } } -CARD32 +CARD32 DRIGetDrawableIndex(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1631,7 +1704,7 @@ DRIGetDrawableIndex(WindowPtr pWin) return index; } -unsigned int +unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1643,56 +1716,62 @@ void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - + ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock); } void -DRILock(ScreenPtr pScreen, int flags) { +DRILock(ScreenPtr pScreen, int flags) +{ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - + if (!lockRefCount) - DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags); + DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags); lockRefCount++; } void -DRIUnlock(ScreenPtr pScreen) { +DRIUnlock(ScreenPtr pScreen) +{ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (lockRefCount>0) lockRefCount--; + if (lockRefCount > 0) { + lockRefCount--; + } else { - ErrorF("DRIUnlock called when not locked\n"); - return; + ErrorF("DRIUnlock called when not locked\n"); + return; } if (!lockRefCount) - DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); + DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); } void * DRIGetSAREAPrivate(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (!pDRIPriv) return 0; - return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + if (!pDRIPriv) + return 0; + return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); } drmContext DRIGetContext(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - if (!pDRIPriv) return 0; - return pDRIPriv->myContext; + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + if (!pDRIPriv) + return 0; + return pDRIPriv->myContext; } - + /* This lets get at the unwrapped functions so that they can correctly * call the lowerlevel functions, and choose whether they will be - * called at every level of recursion (eg in validatetree). + * called at every level of recursion (eg in validatetree). */ DRIWrappedFuncsRec * DRIGetWrappedFuncs(ScreenPtr pScreen) { - return &(DRI_SCREEN_PRIV(pScreen)->wrap); + return &(DRI_SCREEN_PRIV(pScreen)->wrap); } void @@ -1700,9 +1779,9 @@ DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion) { - *majorVersion = XF86DRI_MAJOR_VERSION; - *minorVersion = XF86DRI_MINOR_VERSION; - *patchVersion = XF86DRI_PATCH_VERSION; + *majorVersion = XF86DRI_MAJOR_VERSION; + *minorVersion = XF86DRI_MINOR_VERSION; + *patchVersion = XF86DRI_PATCH_VERSION; } static void @@ -1774,7 +1853,7 @@ DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; WindowPtr pWin = (WindowPtr)pDrawable; XF86DRIClipRectPtr pClipRects = (void *)REGION_RECTS(&pWin->clipList); - + _DRIAdjustFrame(pScrn, pDRIPriv, pScrn->frameX0, pScrn->frameY0); if (pDrawable->type != DRAWABLE_WINDOW) return FALSE; @@ -1803,7 +1882,7 @@ DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) pScrn->vtSema = FALSE; pDRIPriv->fullscreen = pDrawable; DRIClipNotify(pWin, 0, 0); - + if (pDRIPriv->pDriverInfo->OpenFullScreen) pDRIPriv->pDriverInfo->OpenFullScreen(pScreen); @@ -1834,7 +1913,7 @@ _DRICloseFullScreen(pointer pResource, XID id) pScrn->EnableDisableFBAccess(pScreen->myNum, TRUE); pWin->eventMask = mask; pWin->optional = optional; - + xf86EnableVTSwitch(TRUE); pDRIPriv->pSAREA->frame.fullscreen = 0; return TRUE; diff --git a/xc/programs/Xserver/GL/dri/dri.h b/xc/programs/Xserver/GL/dri/dri.h index 33a11a230..db1be779d 100644 --- a/xc/programs/Xserver/GL/dri/dri.h +++ b/xc/programs/Xserver/GL/dri/dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.17 2000/12/20 19:48:44 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.18 2001/03/21 16:21:40 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -146,6 +146,8 @@ typedef struct { DRIWindowRequests bufferRequests; int devPrivateSize; void* devPrivate; + Bool createDummyCtx; + Bool createDummyCtxPriv; } DRIInfoRec, *DRIInfoPtr; diff --git a/xc/programs/Xserver/GL/dri/dristruct.h b/xc/programs/Xserver/GL/dri/dristruct.h index 54a4646f3..9add1d3bc 100644 --- a/xc/programs/Xserver/GL/dri/dristruct.h +++ b/xc/programs/Xserver/GL/dri/dristruct.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.9 2000/12/07 20:26:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.10 2001/03/21 16:21:40 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -93,6 +93,9 @@ typedef struct _DRIScreenPrivRec XF86DRIClipRectRec fullscreen_rect; /* fake rect for fullscreen mode */ DRIWrappedFuncsRec wrap; DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; + DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ + Bool createDummyCtx; + Bool createDummyCtxPriv; } DRIScreenPrivRec, *DRIScreenPrivPtr; #endif /* DRI_STRUCT_H */ diff --git a/xc/programs/Xserver/GL/dri/sarea.h b/xc/programs/Xserver/GL/dri/sarea.h index e24f44fdd..07c573875 100644 --- a/xc/programs/Xserver/GL/dri/sarea.h +++ b/xc/programs/Xserver/GL/dri/sarea.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.8 2000/12/07 20:26:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.9 2001/03/21 16:21:40 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -73,6 +73,7 @@ typedef struct _XF86DRISAREA { drmLock drawable_lock; XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; XF86DRISAREAFrameRec frame; + drmContext dummy_context; } XF86DRISAREARec, *XF86DRISAREAPtr; #endif diff --git a/xc/programs/Xserver/GL/glx/g_disptab.c b/xc/programs/Xserver/GL/glx/g_disptab.c index f05e213f3..ee187330d 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab.c +++ b/xc/programs/Xserver/GL/glx/g_disptab.c @@ -1,22 +1,32 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.3 2001/03/21 16:29:35 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "glxserver.h" @@ -166,6 +176,23 @@ __GLXdispatchSingleProcPtr __glXSingleTable[] = { __glXDisp_IsEnabled, __glXDisp_IsList, __glXDisp_Flush, + __glXDisp_AreTexturesResident, + __glXDisp_DeleteTextures, + __glXDisp_GenTextures, + __glXDisp_IsTexture, + __glXDisp_GetColorTable, + __glXDisp_GetColorTableParameterfv, + __glXDisp_GetColorTableParameteriv, + __glXDisp_GetConvolutionFilter, + __glXDisp_GetConvolutionParameterfv, + __glXDisp_GetConvolutionParameteriv, + __glXDisp_GetSeparableFilter, + __glXDisp_GetHistogram, + __glXDisp_GetHistogramParameterfv, + __glXDisp_GetHistogramParameteriv, + __glXDisp_GetMinmax, + __glXDisp_GetMinmaxParameterfv, + __glXDisp_GetMinmaxParameteriv, }; __GLXdispatchRenderProcPtr __glXRenderTable[] = { @@ -361,9 +388,28 @@ __GLXdispatchRenderProcPtr __glXRenderTable[] = { __glXDisp_Translated, __glXDisp_Translatef, __glXDisp_Viewport, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDisp_PolygonOffset, + __glXDisp_DrawArrays, __glXDisp_Indexubv, + __glXDisp_ColorSubTable, + __glXDisp_CopyColorSubTable, + __glXDisp_ActiveTextureARB, + __glXDisp_MultiTexCoord1dvARB, + __glXDisp_MultiTexCoord1fvARB, + __glXDisp_MultiTexCoord1ivARB, + __glXDisp_MultiTexCoord1svARB, + __glXDisp_MultiTexCoord2dvARB, + __glXDisp_MultiTexCoord2fvARB, + __glXDisp_MultiTexCoord2ivARB, + __glXDisp_MultiTexCoord2svARB, + __glXDisp_MultiTexCoord3dvARB, + __glXDisp_MultiTexCoord3fvARB, + __glXDisp_MultiTexCoord3ivARB, + __glXDisp_MultiTexCoord3svARB, + __glXDisp_MultiTexCoord4dvARB, + __glXDisp_MultiTexCoord4fvARB, + __glXDisp_MultiTexCoord4ivARB, + __glXDisp_MultiTexCoord4svARB, }; __GLXdispatchSingleProcPtr __glXSwapSingleTable[] = { @@ -510,6 +556,23 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[] = { __glXDispSwap_IsEnabled, __glXDispSwap_IsList, __glXDispSwap_Flush, + __glXDispSwap_AreTexturesResident, + __glXDispSwap_DeleteTextures, + __glXDispSwap_GenTextures, + __glXDispSwap_IsTexture, + __glXDispSwap_GetColorTable, + __glXDispSwap_GetColorTableParameterfv, + __glXDispSwap_GetColorTableParameteriv, + __glXDispSwap_GetConvolutionFilter, + __glXDispSwap_GetConvolutionParameterfv, + __glXDispSwap_GetConvolutionParameteriv, + __glXDispSwap_GetSeparableFilter, + __glXDispSwap_GetHistogram, + __glXDispSwap_GetHistogramParameterfv, + __glXDispSwap_GetHistogramParameteriv, + __glXDispSwap_GetMinmax, + __glXDispSwap_GetMinmaxParameterfv, + __glXDispSwap_GetMinmaxParameteriv, }; __GLXdispatchRenderProcPtr __glXSwapRenderTable[] = { @@ -705,7 +768,26 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable[] = { __glXDispSwap_Translated, __glXDispSwap_Translatef, __glXDispSwap_Viewport, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDispSwap_PolygonOffset, + __glXDispSwap_DrawArrays, __glXDispSwap_Indexubv, + __glXDispSwap_ColorSubTable, + __glXDispSwap_CopyColorSubTable, + __glXDispSwap_ActiveTextureARB, + __glXDispSwap_MultiTexCoord1dvARB, + __glXDispSwap_MultiTexCoord1fvARB, + __glXDispSwap_MultiTexCoord1ivARB, + __glXDispSwap_MultiTexCoord1svARB, + __glXDispSwap_MultiTexCoord2dvARB, + __glXDispSwap_MultiTexCoord2fvARB, + __glXDispSwap_MultiTexCoord2ivARB, + __glXDispSwap_MultiTexCoord2svARB, + __glXDispSwap_MultiTexCoord3dvARB, + __glXDispSwap_MultiTexCoord3fvARB, + __glXDispSwap_MultiTexCoord3ivARB, + __glXDispSwap_MultiTexCoord3svARB, + __glXDispSwap_MultiTexCoord4dvARB, + __glXDispSwap_MultiTexCoord4fvARB, + __glXDispSwap_MultiTexCoord4ivARB, + __glXDispSwap_MultiTexCoord4svARB, }; diff --git a/xc/programs/Xserver/GL/glx/g_disptab.h b/xc/programs/Xserver/GL/glx/g_disptab.h index 247b27ea9..a24f7a12a 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab.h +++ b/xc/programs/Xserver/GL/glx/g_disptab.h @@ -1,24 +1,34 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.3 2001/03/21 16:29:35 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifndef _GLX_g_disptab_h_ #define _GLX_g_disptab_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ extern int __glXRender(__GLXclientState*, GLbyte*); @@ -83,6 +93,23 @@ extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*); extern int __glXDisp_IsList(__GLXclientState*, GLbyte*); extern int __glXDisp_Flush(__GLXclientState*, GLbyte*); +extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*); +extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*); +extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTable(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTableParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTableParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionFilter(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetSeparableFilter(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogram(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogramParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogramParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmax(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); extern void __glXDisp_CallList(GLbyte*); extern void __glXDisp_CallLists(GLbyte*); @@ -274,7 +301,28 @@ extern void __glXDisp_Scalef(GLbyte*); extern void __glXDisp_Translated(GLbyte*); extern void __glXDisp_Translatef(GLbyte*); extern void __glXDisp_Viewport(GLbyte*); +extern void __glXDisp_PolygonOffset(GLbyte*); +extern void __glXDisp_DrawArrays(GLbyte*); extern void __glXDisp_Indexubv(GLbyte*); +extern void __glXDisp_ColorSubTable(GLbyte*); +extern void __glXDisp_CopyColorSubTable(GLbyte*); +extern void __glXDisp_ActiveTextureARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4svARB(GLbyte*); extern int __glXSwapRender(__GLXclientState*, GLbyte*); extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*); @@ -338,6 +386,23 @@ extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTable(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetSeparableFilter(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogram(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmax(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); extern void __glXDispSwap_CallList(GLbyte*); extern void __glXDispSwap_CallLists(GLbyte*); @@ -529,16 +594,37 @@ extern void __glXDispSwap_Scalef(GLbyte*); extern void __glXDispSwap_Translated(GLbyte*); extern void __glXDispSwap_Translatef(GLbyte*); extern void __glXDispSwap_Viewport(GLbyte*); +extern void __glXDispSwap_PolygonOffset(GLbyte*); +extern void __glXDispSwap_DrawArrays(GLbyte*); extern void __glXDispSwap_Indexubv(GLbyte*); +extern void __glXDispSwap_ColorSubTable(GLbyte*); +extern void __glXDispSwap_CopyColorSubTable(GLbyte*); +extern void __glXDispSwap_ActiveTextureARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*); #define __GLX_MIN_GLXCMD_OPCODE 1 #define __GLX_MAX_GLXCMD_OPCODE 20 #define __GLX_MIN_RENDER_OPCODE 1 -#define __GLX_MAX_RENDER_OPCODE 194 +#define __GLX_MAX_RENDER_OPCODE 213 #define __GLX_MIN_SINGLE_OPCODE 1 -#define __GLX_MAX_SINGLE_OPCODE 142 -#define __GLX_SINGLE_TABLE_SIZE 143 -#define __GLX_RENDER_TABLE_SIZE 195 +#define __GLX_MAX_SINGLE_OPCODE 159 +#define __GLX_SINGLE_TABLE_SIZE 160 +#define __GLX_RENDER_TABLE_SIZE 214 extern __GLXdispatchRenderProcPtr __glXRenderTable[__GLX_RENDER_TABLE_SIZE]; extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE]; extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE]; diff --git a/xc/programs/Xserver/GL/glx/g_disptab_EXT.c b/xc/programs/Xserver/GL/glx/g_disptab_EXT.c index 1ac56e678..e839afe4f 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab_EXT.c +++ b/xc/programs/Xserver/GL/glx/g_disptab_EXT.c @@ -1,31 +1,1053 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.2 1999/06/14 07:31:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.c,v 1.3 2001/03/21 16:29:35 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #include "glxserver.h" #include "glxext.h" #include "g_disptab_EXT.h" __GLXdispatchRenderProcPtr __glXRenderTable_EXT[] = { - __glXDisp_PolygonOffset, - __glXDisp_TexSubImage1D, - __glXDisp_TexSubImage2D, + __glXDisp_ColorTable, + __glXDisp_ColorTableParameterfv, + __glXDisp_ColorTableParameteriv, + __glXDisp_CopyColorTable, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -41,26 +1063,2073 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXDisp_DrawArrays, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXDisp_BlendColor, + __glXDisp_BlendEquation, + __glXNoSuchRenderOpcode, + __glXDisp_TexSubImage1D, + __glXDisp_TexSubImage2D, + __glXDisp_ConvolutionFilter1D, + __glXDisp_ConvolutionFilter2D, + __glXDisp_ConvolutionParameterf, + __glXDisp_ConvolutionParameterfv, + __glXDisp_ConvolutionParameteri, + __glXDisp_ConvolutionParameteriv, + __glXDisp_CopyConvolutionFilter1D, + __glXDisp_CopyConvolutionFilter2D, + __glXDisp_SeparableFilter2D, + __glXDisp_Histogram, + __glXDisp_Minmax, + __glXDisp_ResetHistogram, + __glXDisp_ResetMinmax, + __glXDisp_TexImage3D, + __glXDisp_TexSubImage3D, + __glXDisp_DrawArraysEXT, __glXDisp_BindTexture, __glXDisp_PrioritizeTextures, __glXDisp_CopyTexImage1D, __glXDisp_CopyTexImage2D, __glXDisp_CopyTexSubImage1D, __glXDisp_CopyTexSubImage2D, + __glXDisp_CopyTexSubImage3D, }; __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[] = { - __glXDisp_AreTexturesResident, - __glXDisp_DeleteTextures, - __glXDisp_GenTextures, - __glXDisp_IsTexture, + __glXDisp_AreTexturesResidentEXT, + __glXDisp_DeleteTexturesEXT, + __glXDisp_GenTexturesEXT, + __glXDisp_IsTextureEXT, }; __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[] = { - __glXDispSwap_PolygonOffset, - __glXDispSwap_TexSubImage1D, - __glXDispSwap_TexSubImage2D, + __glXDispSwap_ColorTable, + __glXDispSwap_ColorTableParameterfv, + __glXDispSwap_ColorTableParameteriv, + __glXDispSwap_CopyColorTable, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -76,18 +3145,1051 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXDispSwap_DrawArrays, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXNoSuchRenderOpcode, + __glXDispSwap_BlendColor, + __glXDispSwap_BlendEquation, + __glXNoSuchRenderOpcode, + __glXDispSwap_TexSubImage1D, + __glXDispSwap_TexSubImage2D, + __glXDispSwap_ConvolutionFilter1D, + __glXDispSwap_ConvolutionFilter2D, + __glXDispSwap_ConvolutionParameterf, + __glXDispSwap_ConvolutionParameterfv, + __glXDispSwap_ConvolutionParameteri, + __glXDispSwap_ConvolutionParameteriv, + __glXDispSwap_CopyConvolutionFilter1D, + __glXDispSwap_CopyConvolutionFilter2D, + __glXDispSwap_SeparableFilter2D, + __glXDispSwap_Histogram, + __glXDispSwap_Minmax, + __glXDispSwap_ResetHistogram, + __glXDispSwap_ResetMinmax, + __glXDispSwap_TexImage3D, + __glXDispSwap_TexSubImage3D, + __glXDispSwap_DrawArraysEXT, __glXDispSwap_BindTexture, __glXDispSwap_PrioritizeTextures, __glXDispSwap_CopyTexImage1D, __glXDispSwap_CopyTexImage2D, __glXDispSwap_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage2D, + __glXDispSwap_CopyTexSubImage3D, }; __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[] = { - __glXDispSwap_AreTexturesResident, - __glXDispSwap_DeleteTextures, - __glXDispSwap_GenTextures, - __glXDispSwap_IsTexture, + __glXDispSwap_AreTexturesResidentEXT, + __glXDispSwap_DeleteTexturesEXT, + __glXDispSwap_GenTexturesEXT, + __glXDispSwap_IsTextureEXT, }; diff --git a/xc/programs/Xserver/GL/glx/g_disptab_EXT.h b/xc/programs/Xserver/GL/glx/g_disptab_EXT.h index 59c7e3024..193da6ea7 100644 --- a/xc/programs/Xserver/GL/glx/g_disptab_EXT.h +++ b/xc/programs/Xserver/GL/glx/g_disptab_EXT.h @@ -1,64 +1,116 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.3 2001/03/21 16:29:35 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifndef _GLX_g_disptab_EXT_h_ #define _GLX_g_disptab_EXT_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab_EXT.h,v 1.2 1999/06/14 07:31:23 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ -extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*); -extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*); -extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*); -extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDisp_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_DeleteTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_GenTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsTextureEXT(__GLXclientState*, GLbyte*); -extern void __glXDisp_PolygonOffset(GLbyte*); +extern void __glXDisp_ColorTable(GLbyte*); +extern void __glXDisp_ColorTableParameterfv(GLbyte*); +extern void __glXDisp_ColorTableParameteriv(GLbyte*); +extern void __glXDisp_CopyColorTable(GLbyte*); +extern void __glXDisp_BlendColor(GLbyte*); +extern void __glXDisp_BlendEquation(GLbyte*); extern void __glXDisp_TexSubImage1D(GLbyte*); extern void __glXDisp_TexSubImage2D(GLbyte*); -extern void __glXDisp_DrawArrays(GLbyte*); +extern void __glXDisp_ConvolutionFilter1D(GLbyte*); +extern void __glXDisp_ConvolutionFilter2D(GLbyte*); +extern void __glXDisp_ConvolutionParameterf(GLbyte*); +extern void __glXDisp_ConvolutionParameterfv(GLbyte*); +extern void __glXDisp_ConvolutionParameteri(GLbyte*); +extern void __glXDisp_ConvolutionParameteriv(GLbyte*); +extern void __glXDisp_CopyConvolutionFilter1D(GLbyte*); +extern void __glXDisp_CopyConvolutionFilter2D(GLbyte*); +extern void __glXDisp_SeparableFilter2D(GLbyte*); +extern void __glXDisp_Histogram(GLbyte*); +extern void __glXDisp_Minmax(GLbyte*); +extern void __glXDisp_ResetHistogram(GLbyte*); +extern void __glXDisp_ResetMinmax(GLbyte*); +extern void __glXDisp_TexImage3D(GLbyte*); +extern void __glXDisp_TexSubImage3D(GLbyte*); +extern void __glXDisp_DrawArraysEXT(GLbyte*); extern void __glXDisp_BindTexture(GLbyte*); extern void __glXDisp_PrioritizeTextures(GLbyte*); extern void __glXDisp_CopyTexImage1D(GLbyte*); extern void __glXDisp_CopyTexImage2D(GLbyte*); extern void __glXDisp_CopyTexSubImage1D(GLbyte*); extern void __glXDisp_CopyTexSubImage2D(GLbyte*); +extern void __glXDisp_CopyTexSubImage3D(GLbyte*); -extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*); -extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_DeleteTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GenTexturesEXT(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsTextureEXT(__GLXclientState*, GLbyte*); -extern void __glXDispSwap_PolygonOffset(GLbyte*); +extern void __glXDispSwap_ColorTable(GLbyte*); +extern void __glXDispSwap_ColorTableParameterfv(GLbyte*); +extern void __glXDispSwap_ColorTableParameteriv(GLbyte*); +extern void __glXDispSwap_CopyColorTable(GLbyte*); +extern void __glXDispSwap_BlendColor(GLbyte*); +extern void __glXDispSwap_BlendEquation(GLbyte*); extern void __glXDispSwap_TexSubImage1D(GLbyte*); extern void __glXDispSwap_TexSubImage2D(GLbyte*); -extern void __glXDispSwap_DrawArrays(GLbyte*); +extern void __glXDispSwap_ConvolutionFilter1D(GLbyte*); +extern void __glXDispSwap_ConvolutionFilter2D(GLbyte*); +extern void __glXDispSwap_ConvolutionParameterf(GLbyte*); +extern void __glXDispSwap_ConvolutionParameterfv(GLbyte*); +extern void __glXDispSwap_ConvolutionParameteri(GLbyte*); +extern void __glXDispSwap_ConvolutionParameteriv(GLbyte*); +extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte*); +extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte*); +extern void __glXDispSwap_SeparableFilter2D(GLbyte*); +extern void __glXDispSwap_Histogram(GLbyte*); +extern void __glXDispSwap_Minmax(GLbyte*); +extern void __glXDispSwap_ResetHistogram(GLbyte*); +extern void __glXDispSwap_ResetMinmax(GLbyte*); +extern void __glXDispSwap_TexImage3D(GLbyte*); +extern void __glXDispSwap_TexSubImage3D(GLbyte*); +extern void __glXDispSwap_DrawArraysEXT(GLbyte*); extern void __glXDispSwap_BindTexture(GLbyte*); extern void __glXDispSwap_PrioritizeTextures(GLbyte*); extern void __glXDispSwap_CopyTexImage1D(GLbyte*); extern void __glXDispSwap_CopyTexImage2D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*); +extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*); -#define __GLX_MIN_RENDER_OPCODE_EXT 4098 -#define __GLX_MAX_RENDER_OPCODE_EXT 4122 +#define __GLX_MIN_RENDER_OPCODE_EXT 2053 +#define __GLX_MAX_RENDER_OPCODE_EXT 4123 #define __GLX_MIN_VENDPRIV_OPCODE_EXT 11 #define __GLX_MAX_VENDPRIV_OPCODE_EXT 14 #define __GLX_VENDPRIV_TABLE_SIZE_EXT 4 -#define __GLX_RENDER_TABLE_SIZE_EXT 25 +#define __GLX_RENDER_TABLE_SIZE_EXT 2071 extern __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT]; extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_VENDPRIV_TABLE_SIZE_EXT]; extern __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT]; diff --git a/xc/programs/Xserver/GL/glx/g_render.c b/xc/programs/Xserver/GL/glx/g_render.c index d8214d02a..52ecab5b1 100644 --- a/xc/programs/Xserver/GL/glx/g_render.c +++ b/xc/programs/Xserver/GL/glx/g_render.c @@ -1,23 +1,32 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.4 2001/03/21 16:29:35 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -1739,3 +1748,330 @@ void __glXDisp_Indexubv(GLbyte *pc) ); } +void __glXDisp_BlendColor(GLbyte *pc) +{ + glBlendColor( + *(GLclampf *)(pc + 0), + *(GLclampf *)(pc + 4), + *(GLclampf *)(pc + 8), + *(GLclampf *)(pc + 12) + ); +} + +void __glXDisp_BlendEquation(GLbyte *pc) +{ + glBlendEquation( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_ColorTableParameterfv(GLbyte *pc) +{ + glColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ColorTableParameteriv(GLbyte *pc) +{ + glColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDisp_CopyColorTable(GLbyte *pc) +{ + glCopyColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_CopyColorSubTable(GLbyte *pc) +{ + glCopyColorSubTable( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_ConvolutionParameterf(GLbyte *pc) +{ + glConvolutionParameterf( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameterfv(GLbyte *pc) +{ + glConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameteri(GLbyte *pc) +{ + glConvolutionParameteri( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ); +} + +void __glXDisp_ConvolutionParameteriv(GLbyte *pc) +{ + glConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDisp_CopyConvolutionFilter1D(GLbyte *pc) +{ + glCopyConvolutionFilter1D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDisp_CopyConvolutionFilter2D(GLbyte *pc) +{ + glCopyConvolutionFilter2D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20) + ); +} + +void __glXDisp_Histogram(GLbyte *pc) +{ + glHistogram( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLboolean *)(pc + 12) + ); +} + +void __glXDisp_Minmax(GLbyte *pc) +{ + glMinmax( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLboolean *)(pc + 8) + ); +} + +void __glXDisp_ResetHistogram(GLbyte *pc) +{ + glResetHistogram( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_ResetMinmax(GLbyte *pc) +{ + glResetMinmax( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_CopyTexSubImage3D(GLbyte *pc) +{ + glCopyTexSubImage3D( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20), + *(GLint *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLsizei *)(pc + 32) + ); +} + +void __glXDisp_ActiveTextureARB(GLbyte *pc) +{ + glActiveTextureARB( + *(GLenum *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord1dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 12); + pc -= 4; + } +#endif + glMultiTexCoord1dvARB( + *(GLenum *)(pc + 8), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord1fvARB(GLbyte *pc) +{ + glMultiTexCoord1fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord1ivARB(GLbyte *pc) +{ + glMultiTexCoord1ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord1svARB(GLbyte *pc) +{ + glMultiTexCoord1svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 20); + pc -= 4; + } +#endif + glMultiTexCoord2dvARB( + *(GLenum *)(pc + 16), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord2fvARB(GLbyte *pc) +{ + glMultiTexCoord2fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2ivARB(GLbyte *pc) +{ + glMultiTexCoord2ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord2svARB(GLbyte *pc) +{ + glMultiTexCoord2svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 28); + pc -= 4; + } +#endif + glMultiTexCoord3dvARB( + *(GLenum *)(pc + 24), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord3fvARB(GLbyte *pc) +{ + glMultiTexCoord3fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3ivARB(GLbyte *pc) +{ + glMultiTexCoord3ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord3svARB(GLbyte *pc) +{ + glMultiTexCoord3svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4dvARB(GLbyte *pc) +{ + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 36); + pc -= 4; + } +#endif + glMultiTexCoord4dvARB( + *(GLenum *)(pc + 32), + (GLdouble *)(pc + 0) + ); +} + +void __glXDisp_MultiTexCoord4fvARB(GLbyte *pc) +{ + glMultiTexCoord4fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4ivARB(GLbyte *pc) +{ + glMultiTexCoord4ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDisp_MultiTexCoord4svARB(GLbyte *pc) +{ + glMultiTexCoord4svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + diff --git a/xc/programs/Xserver/GL/glx/g_renderswap.c b/xc/programs/Xserver/GL/glx/g_renderswap.c index 5b57a07a3..0a423d4a6 100644 --- a/xc/programs/Xserver/GL/glx/g_renderswap.c +++ b/xc/programs/Xserver/GL/glx/g_renderswap.c @@ -1,23 +1,32 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.4 2001/03/21 16:29:35 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -2715,3 +2724,545 @@ void __glXDispSwap_Indexubv(GLbyte *pc) ); } +void __glXDispSwap_BlendColor(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + __GLX_SWAP_FLOAT(pc + 12); + + glBlendColor( + *(GLclampf *)(pc + 0), + *(GLclampf *)(pc + 4), + *(GLclampf *)(pc + 8), + *(GLclampf *)(pc + 12) + ); +} + +void __glXDispSwap_BlendEquation(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glBlendEquation( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_ColorTableParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + + glColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ColorTableParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + + glColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDispSwap_CopyColorTable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_CopyColorSubTable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyColorSubTable( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_ConvolutionParameterf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + + glConvolutionParameterf( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + + glConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameteri(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + + glConvolutionParameteri( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8) + ); +} + +void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + + glConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *)(pc + 8) + ); +} + +void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + + glCopyConvolutionFilter1D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16) + ); +} + +void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + + glCopyConvolutionFilter2D( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLsizei *)(pc + 16), + *(GLsizei *)(pc + 20) + ); +} + +void __glXDispSwap_Histogram(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + + glHistogram( + *(GLenum *)(pc + 0), + *(GLsizei *)(pc + 4), + *(GLenum *)(pc + 8), + *(GLboolean *)(pc + 12) + ); +} + +void __glXDispSwap_Minmax(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + + glMinmax( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLboolean *)(pc + 8) + ); +} + +void __glXDispSwap_ResetHistogram(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glResetHistogram( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_ResetMinmax(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glResetMinmax( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_CopyTexSubImage3D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_INT(pc + 28); + __GLX_SWAP_INT(pc + 32); + + glCopyTexSubImage3D( + *(GLenum *)(pc + 0), + *(GLint *)(pc + 4), + *(GLint *)(pc + 8), + *(GLint *)(pc + 12), + *(GLint *)(pc + 16), + *(GLint *)(pc + 20), + *(GLint *)(pc + 24), + *(GLsizei *)(pc + 28), + *(GLsizei *)(pc + 32) + ); +} + +void __glXDispSwap_ActiveTextureARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + + glActiveTextureARB( + *(GLenum *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 12); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); + + glMultiTexCoord1dvARB( + *(GLenum *)(pc + 8), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1); + + glMultiTexCoord1fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 1); + + glMultiTexCoord1ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 1); + + glMultiTexCoord1svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 20); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + + glMultiTexCoord2dvARB( + *(GLenum *)(pc + 16), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2); + + glMultiTexCoord2fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 2); + + glMultiTexCoord2ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); + + glMultiTexCoord2svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 28); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + + glMultiTexCoord3dvARB( + *(GLenum *)(pc + 24), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3); + + glMultiTexCoord3fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 3); + + glMultiTexCoord3ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 3); + + glMultiTexCoord3svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 36); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 32); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); + + glMultiTexCoord4dvARB( + *(GLenum *)(pc + 32), + (GLdouble *)(pc + 0) + ); +} + +void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4); + + glMultiTexCoord4fvARB( + *(GLenum *)(pc + 0), + (GLfloat *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 4); + + glMultiTexCoord4ivARB( + *(GLenum *)(pc + 0), + (GLint *)(pc + 4) + ); +} + +void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 4); + + glMultiTexCoord4svARB( + *(GLenum *)(pc + 0), + (GLshort *)(pc + 4) + ); +} + diff --git a/xc/programs/Xserver/GL/glx/g_single.c b/xc/programs/Xserver/GL/glx/g_single.c index e86d68f86..36f97e0fc 100644 --- a/xc/programs/Xserver/GL/glx/g_single.c +++ b/xc/programs/Xserver/GL/glx/g_single.c @@ -1,23 +1,32 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.3 1999/06/14 07:31:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_single.c,v 1.4 2001/03/21 16:29:35 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -431,8 +440,8 @@ int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -445,8 +454,8 @@ int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapdv_size(target,query); if (compsize < 0) compsize = 0; @@ -477,8 +486,8 @@ int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -491,8 +500,8 @@ int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapfv_size(target,query); if (compsize < 0) compsize = 0; @@ -523,8 +532,8 @@ int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -537,8 +546,8 @@ int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - query = *(GLenum *)(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapiv_size(target,query); if (compsize < 0) compsize = 0; @@ -1238,11 +1247,11 @@ int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) GLboolean answerBuffer[200]; char *answer; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); @@ -1266,11 +1275,11 @@ int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); glDeleteTextures( @@ -1289,11 +1298,11 @@ int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc) GLuint answerBuffer[200]; char *answer; - cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } - pc += __GLX_VENDPRIV_HDR_SIZE; + pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); @@ -1314,14 +1323,468 @@ int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + + retval = + glIsTexture( + *(GLuint *)(pc + 0) + ); + __GLX_PUT_RETVAL(retval); + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + return Success; +} + +int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameterfv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameteriv_size(pname); + if (compsize < 0) compsize = 0; + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_PUT_SIZE(1); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_PUT_SIZE(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLboolean answerBuffer[200]; + char *answer; + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = - glIsTexture( + glAreTexturesResidentEXT( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4), + (GLboolean *) answer + ); + __GLX_PUT_RETVAL(retval); + __GLX_BEGIN_REPLY(n); + __GLX_SEND_HEADER(); + __GLX_SEND_BYTE_ARRAY(n); + return Success; +} + +int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + + glDeleteTexturesEXT( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4) + ); + return Success; +} + +int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLuint answerBuffer[200]; + char *answer; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + n = *(GLsizei *)(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); + glGenTexturesEXT( + *(GLsizei *)(pc + 0), + (GLuint *) answer + ); + __GLX_BEGIN_REPLY(n*4); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(n); + return Success; +} + +int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + + cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_VENDPRIV_HDR_SIZE; + + retval = + glIsTextureEXT( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); diff --git a/xc/programs/Xserver/GL/glx/g_singleswap.c b/xc/programs/Xserver/GL/glx/g_singleswap.c index 98f8631a6..89f595266 100644 --- a/xc/programs/Xserver/GL/glx/g_singleswap.c +++ b/xc/programs/Xserver/GL/glx/g_singleswap.c @@ -1,23 +1,32 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.3 1999/06/14 07:31:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.4 2001/03/21 16:29:35 dawes Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* by SGI when creating the GLX sample implementation */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. */ #define NEED_REPLIES @@ -513,8 +522,8 @@ int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -529,10 +538,10 @@ int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapdv_size(target,query); if (compsize < 0) compsize = 0; @@ -569,8 +578,8 @@ int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -585,10 +594,10 @@ int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapfv_size(target,query); if (compsize < 0) compsize = 0; @@ -625,8 +634,8 @@ int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) { - GLenum query; GLenum target; + GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; @@ -641,10 +650,10 @@ int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) return error; } pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); - query = *(GLenum *)(pc + 4); + __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); + query = *(GLenum *)(pc + 4); compsize = __glGetMapiv_size(target,query); if (compsize < 0) compsize = 0; @@ -1500,6 +1509,560 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) char *answer; __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, n); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); + retval = + glAreTexturesResident( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4), + (GLboolean *) answer + ); + __GLX_PUT_RETVAL(retval); + __GLX_SWAP_REPLY_RETVAL(); + __GLX_BEGIN_REPLY(n); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + __GLX_SEND_BYTE_ARRAY(n); + return Success; +} + +int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, n); + + glDeleteTextures( + *(GLsizei *)(pc + 0), + (GLuint *)(pc + 4) + ); + return Success; +} + +int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLuint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); + glGenTextures( + *(GLsizei *)(pc + 0), + (GLuint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, n); + __GLX_BEGIN_REPLY(n*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(n); + return Success; +} + +int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) +{ + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + + retval = + glIsTexture( + *(GLuint *)(pc + 0) + ); + __GLX_PUT_RETVAL(retval); + __GLX_SWAP_REPLY_RETVAL(); + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + return Success; +} + +int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetColorTableParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetConvolutionParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetHistogramParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetHistogramParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLfloat answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameterfv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLfloat *) answer + ); + __GLX_SWAP_FLOAT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_FLOAT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_FLOAT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLint answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glGetMinmaxParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); + __glXClearErrorOccured(); + glGetMinmaxParameteriv( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + (GLint *) answer + ); + __GLX_SWAP_INT_ARRAY(answer, compsize); + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(0); + __GLX_SEND_HEADER(); + } else if (compsize == 1) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(1); + __GLX_SWAP_REPLY_SIZE(); + __GLX_PUT_INT(); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize*4); + __GLX_SWAP_REPLY_HEADER(); + __GLX_PUT_SIZE(compsize); + __GLX_SWAP_REPLY_SIZE(); + __GLX_SEND_HEADER(); + __GLX_SEND_INT_ARRAY(compsize); + } + return Success; +} + +int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) +{ + GLsizei n; + GLboolean retval; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + GLboolean answerBuffer[200]; + char *answer; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { @@ -1512,7 +2075,7 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = - glAreTexturesResident( + glAreTexturesResidentEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLboolean *) answer @@ -1526,7 +2089,7 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) return Success; } -int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; @@ -1544,14 +2107,14 @@ int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) n = *(GLsizei *)(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, n); - glDeleteTextures( + glDeleteTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4) ); return Success; } -int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; @@ -1571,7 +2134,7 @@ int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); - glGenTextures( + glGenTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *) answer ); @@ -1583,7 +2146,7 @@ int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) return Success; } -int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) +int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; @@ -1600,7 +2163,7 @@ int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(pc + 0); retval = - glIsTexture( + glIsTextureEXT( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); diff --git a/xc/programs/Xserver/GL/glx/global.c b/xc/programs/Xserver/GL/glx/global.c index 5a7ae7ff9..9cd011ec9 100644 --- a/xc/programs/Xserver/GL/glx/global.c +++ b/xc/programs/Xserver/GL/glx/global.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/global.c,v 1.2 1999/06/14 07:31:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/global.c,v 1.3 2001/03/21 16:29:35 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES diff --git a/xc/programs/Xserver/GL/glx/glxbuf.c b/xc/programs/Xserver/GL/glx/glxbuf.c index 6c42e588a..6f51aca72 100644 --- a/xc/programs/Xserver/GL/glx/glxbuf.c +++ b/xc/programs/Xserver/GL/glx/glxbuf.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.c,v 1.6 2001/03/25 05:32:01 tsi Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "glxserver.h" diff --git a/xc/programs/Xserver/GL/glx/glxbuf.h b/xc/programs/Xserver/GL/glx/glxbuf.h index 05cea4a44..a298b3471 100644 --- a/xc/programs/Xserver/GL/glx/glxbuf.h +++ b/xc/programs/Xserver/GL/glx/glxbuf.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _glxbuf_h_ #define _glxbuf_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxbuf.h,v 1.2 1999/06/14 07:31:25 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ extern void __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, diff --git a/xc/programs/Xserver/GL/glx/glxcmds.c b/xc/programs/Xserver/GL/glx/glxcmds.c index 64b28a206..d495fc8eb 100644 --- a/xc/programs/Xserver/GL/glx/glxcmds.c +++ b/xc/programs/Xserver/GL/glx/glxcmds.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.5 2000/06/17 00:03:12 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.7 2001/03/25 05:32:01 tsi Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES @@ -32,6 +46,7 @@ #include "glximports.h" #include "glxutil.h" #include "glxext.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -43,12 +58,13 @@ static __GLimports imports = { __glXImpWarning, __glXImpFatal, __glXImpGetenv, + __glXImpAtoi, __glXImpSprintf, __glXImpFopen, __glXImpFclose, __glXImpFprintf, __glXImpGetDrawablePrivate, - NULL, + NULL }; /************************************************************************/ diff --git a/xc/programs/Xserver/GL/glx/glxcmdsswap.c b/xc/programs/Xserver/GL/glx/glxcmdsswap.c index 6437c2938..2363ee0d4 100644 --- a/xc/programs/Xserver/GL/glx/glxcmdsswap.c +++ b/xc/programs/Xserver/GL/glx/glxcmdsswap.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.5 2001/03/21 16:29:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES @@ -31,6 +45,7 @@ #include <pixmapstr.h> #include <windowstr.h> #include "glxext.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -763,7 +778,7 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { - (*__glXSwapVendorPrivTable_EXT[vendorcode])(cl, (GLbyte*)req); + (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); return Success; } cl->client->errorValue = req->vendorCode; @@ -785,7 +800,7 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { - return (*__glXSwapVendorPrivTable_EXT[vendorcode])(cl, (GLbyte*)req); + return (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); } cl->client->errorValue = req->vendorCode; return __glXUnsupportedPrivateRequest; diff --git a/xc/programs/Xserver/GL/glx/glxcontext.h b/xc/programs/Xserver/GL/glx/glxcontext.h index c3e353fc7..32b4b248a 100644 --- a/xc/programs/Xserver/GL/glx/glxcontext.h +++ b/xc/programs/Xserver/GL/glx/glxcontext.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _GLX_context_h_ #define _GLX_context_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ typedef struct __GLXcontextRec __GLXcontext; diff --git a/xc/programs/Xserver/GL/glx/glxdrawable.h b/xc/programs/Xserver/GL/glx/glxdrawable.h index 89fe4dbcb..9d7ba55ba 100644 --- a/xc/programs/Xserver/GL/glx/glxdrawable.h +++ b/xc/programs/Xserver/GL/glx/glxdrawable.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _GLX_drawable_h_ #define _GLX_drawable_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ typedef struct { @@ -76,7 +90,7 @@ struct __GLXdrawablePrivateRec { GLboolean (*swapBuffers)(struct __GLXdrawablePrivateRec *); /* - ** The GL drawable (information shared between GLX and the GL core + ** The GL drawable (information shared between GLX and the GL core) */ __GLdrawablePrivate glPriv; diff --git a/xc/programs/Xserver/GL/glx/glxerror.h b/xc/programs/Xserver/GL/glx/glxerror.h index d6adf95a6..3c1e93c61 100644 --- a/xc/programs/Xserver/GL/glx/glxerror.h +++ b/xc/programs/Xserver/GL/glx/glxerror.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxerror.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _GLX_error_h_ #define _GLX_error_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxerror.h,v 1.2 1999/06/14 07:31:26 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ /* diff --git a/xc/programs/Xserver/GL/glx/glxext.c b/xc/programs/Xserver/GL/glx/glxext.c index d65dc04b8..9ab9d8973 100644 --- a/xc/programs/Xserver/GL/glx/glxext.c +++ b/xc/programs/Xserver/GL/glx/glxext.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.6 2001/02/16 13:24:05 eich Exp $ +/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.7 2001/03/21 16:29:36 dawes Exp $ ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., @@ -16,7 +16,6 @@ ** Those portions of the Subject Software created by Silicon Graphics, Inc. ** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. ** -** $SGI$ */ #define NEED_REPLIES @@ -217,7 +216,7 @@ GLboolean __glXErrorOccured(void) */ void GlxExtensionInit(void) { - ExtensionEntry *extEntry, *AddExtension(); + ExtensionEntry *extEntry; int i; #ifdef X11R5 diff --git a/xc/programs/Xserver/GL/glx/glxext.h b/xc/programs/Xserver/GL/glx/glxext.h index 543eefcd6..7dd57c1d7 100644 --- a/xc/programs/Xserver/GL/glx/glxext.h +++ b/xc/programs/Xserver/GL/glx/glxext.h @@ -1,46 +1,63 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.4 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _glxext_h_ #define _glxext_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.3 1999/06/14 07:31:27 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ +/* + * Added by VA Linux for XFree86 4.0.x + */ typedef struct { int type; void (*resetExtension)(void); Bool (*initVisuals)( - VisualPtr * visualp, - DepthPtr * depthp, - int * nvisualp, - int * ndepthp, - int * rootDepthp, - VisualID * defaultVisp, - unsigned long sizes, - int bitsPerRGB - ); + VisualPtr * visualp, + DepthPtr * depthp, + int * nvisualp, + int * ndepthp, + int * rootDepthp, + VisualID * defaultVisp, + unsigned long sizes, + int bitsPerRGB + ); void (*setVisualConfigs)( - int nconfigs, - __GLXvisualConfig *configs, - void **privates - ); + int nconfigs, + __GLXvisualConfig *configs, + void **privates + ); } __GLXextensionInfo; extern GLboolean __glXFreeContext(__GLXcontext *glxc); @@ -56,14 +73,12 @@ extern void __glXResetLargeCommandStatus(__GLXclientState*); extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc); -extern Bool __glXCoreType(void); extern void GlxExtensionInit(void); -extern void GlxSetVisualConfigs( - int nconfigs, - __GLXvisualConfig *configs, - void **privates -); + +extern Bool __glXCoreType(void); + extern int GlxInitVisuals( +#if NeedFunctionPrototypes VisualPtr * visualp, DepthPtr * depthp, int * nvisualp, @@ -73,6 +88,7 @@ extern int GlxInitVisuals( unsigned long sizes, int bitsPerRGB, int preferredVis +#endif ); #endif /* _glxext_h_ */ diff --git a/xc/programs/Xserver/GL/glx/glxfb.c b/xc/programs/Xserver/GL/glx/glxfb.c index 67ea31434..4ce952d51 100644 --- a/xc/programs/Xserver/GL/glx/glxfb.c +++ b/xc/programs/Xserver/GL/glx/glxfb.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.c,v 1.2 1999/06/14 07:31:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.c,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ /* @@ -30,7 +44,7 @@ #include <gcstruct.h> -/* can't include glmath.h */ +/* so we don't include glmath.h */ extern GLuint __glFloorLog2(GLuint); typedef struct __GLFBbufferInfoRec { diff --git a/xc/programs/Xserver/GL/glx/glxfb.h b/xc/programs/Xserver/GL/glx/glxfb.h index 9b6022591..44a72a3e2 100644 --- a/xc/programs/Xserver/GL/glx/glxfb.h +++ b/xc/programs/Xserver/GL/glx/glxfb.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _glxfb_h_ #define _glxfb_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxfb.h,v 1.2 1999/06/14 07:31:30 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ extern void __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glximports.c b/xc/programs/Xserver/GL/glx/glximports.c index 2dc836571..398c59962 100644 --- a/xc/programs/Xserver/GL/glx/glximports.c +++ b/xc/programs/Xserver/GL/glx/glximports.c @@ -1,28 +1,43 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glximports.c,v 1.5 2001/03/21 16:29:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "glxserver.h" #include "glxcontext.h" #include "glximports.h" +#include "GL/glx_ansic.h" void *__glXImpMalloc(__GLcontext *gc, size_t size) { @@ -105,6 +120,11 @@ char *__glXImpGetenv(__GLcontext *gc, const char *var) return __glXGetenv(var); } +int __glXImpAtoi(__GLcontext *gc, const char *str) +{ + return __glXAtoi(str); +} + int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) { va_list ap; diff --git a/xc/programs/Xserver/GL/glx/glximports.h b/xc/programs/Xserver/GL/glx/glximports.h index b6a1580c7..4f3513d32 100644 --- a/xc/programs/Xserver/GL/glx/glximports.h +++ b/xc/programs/Xserver/GL/glx/glximports.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glximports.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _glximports_h_ #define _glximports_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glximports.h,v 1.2 1999/06/14 07:31:30 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ extern void *__glXImpMalloc(__GLcontext *gc, size_t size); @@ -32,6 +46,7 @@ extern void __glXImpWarning(__GLcontext *gc, char *msg); extern void __glXImpFatal(__GLcontext *gc, char *msg); extern char *__glXImpGetenv(__GLcontext *gc, const char *var); +extern int __glXImpAtoi(__GLcontext *gc, const char *str); extern int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...); extern void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode); diff --git a/xc/programs/Xserver/GL/glx/glxmem.c b/xc/programs/Xserver/GL/glx/glxmem.c index 52a60f848..bc0c371e7 100644 --- a/xc/programs/Xserver/GL/glx/glxmem.c +++ b/xc/programs/Xserver/GL/glx/glxmem.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.c,v 1.5 2001/03/21 16:29:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ /* diff --git a/xc/programs/Xserver/GL/glx/glxmem.h b/xc/programs/Xserver/GL/glx/glxmem.h index 1c208a2f5..93a277559 100644 --- a/xc/programs/Xserver/GL/glx/glxmem.h +++ b/xc/programs/Xserver/GL/glx/glxmem.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _glxmem_h_ #define _glxmem_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxmem.h,v 1.2 1999/06/14 07:31:31 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ extern void __glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glxpix.c b/xc/programs/Xserver/GL/glx/glxpix.c index 8771bb0e0..b21d4ade9 100644 --- a/xc/programs/Xserver/GL/glx/glxpix.c +++ b/xc/programs/Xserver/GL/glx/glxpix.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.3 2000/09/26 15:57:02 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.c,v 1.4 2001/03/21 16:29:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ /* diff --git a/xc/programs/Xserver/GL/glx/glxpix.h b/xc/programs/Xserver/GL/glx/glxpix.h index 09a33a80a..d7a9afab0 100644 --- a/xc/programs/Xserver/GL/glx/glxpix.h +++ b/xc/programs/Xserver/GL/glx/glxpix.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.h,v 1.3 2001/03/21 16:29:36 dawes Exp $ */ #ifndef _glxpix_h_ #define _glxpix_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxpix.h,v 1.2 1999/06/14 07:31:31 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ extern void __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, diff --git a/xc/programs/Xserver/GL/glx/glxscreens.c b/xc/programs/Xserver/GL/glx/glxscreens.c index 7ccd6366f..5e98e9e1e 100644 --- a/xc/programs/Xserver/GL/glx/glxscreens.c +++ b/xc/programs/Xserver/GL/glx/glxscreens.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.5 2001/02/16 13:24:05 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.6 2001/03/21 16:29:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #ifdef IN_MODULE @@ -32,6 +46,15 @@ #include "glxserver.h" #include "glxutil.h" +static char GLServerExtensions[] = + "GL_ARB_multitexture " + "GL_ARB_imaging " + "GL_EXT_abgr " + "GL_EXT_blend_color " + "GL_EXT_blend_minmax " + "GL_EXT_blend_subtract " + ; + /* ** We have made the simplifying assuption that the same extensions are ** supported across all screens in a multi-screen system. @@ -41,7 +64,8 @@ static char GLXServerVersion[] = "1.2"; static char GLXServerExtensions[] = "GLX_EXT_visual_info " "GLX_EXT_visual_rating " - "GLX_EXT_import_context "; + "GLX_EXT_import_context " + ; /* ** This comes from the GL library that the server will link with. Right @@ -259,6 +283,7 @@ void __glXScreenInit(GLint numscreens) #else __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; #endif + __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); diff --git a/xc/programs/Xserver/GL/glx/glxscreens.h b/xc/programs/Xserver/GL/glx/glxscreens.h index 555091124..138e2eaf1 100644 --- a/xc/programs/Xserver/GL/glx/glxscreens.h +++ b/xc/programs/Xserver/GL/glx/glxscreens.h @@ -1,30 +1,46 @@ #ifndef _GLX_screens_h_ #define _GLX_screens_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.3 2001/02/16 13:24:05 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.4 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "GL/internal/glcore.h" + + /* ** Screen dependent data. These methods are the interface between the DIX ** and DDX layers of the GLX server extension. The methods provide an @@ -58,6 +74,8 @@ typedef struct { GLint numVisuals; GLint numUsableVisuals; + char *GLextensions; + char *GLXvendor; char *GLXversion; char *GLXextensions; diff --git a/xc/programs/Xserver/GL/glx/glxserver.h b/xc/programs/Xserver/GL/glx/glxserver.h index 80a23ce1a..1eb3764cc 100644 --- a/xc/programs/Xserver/GL/glx/glxserver.h +++ b/xc/programs/Xserver/GL/glx/glxserver.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ #ifndef _GLX_server_h_ #define _GLX_server_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.2 1999/06/14 07:31:32 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include <X11/X.h> @@ -42,6 +56,7 @@ #undef abs #undef fabs +#define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include <GL/gl.h> #include <GL/glxproto.h> #include <GL/glxint.h> @@ -110,7 +125,7 @@ struct __GLXclientStateRec { */ GLbyte *returnBuf; GLint returnBufSize; - + /* ** Keep track of large rendering commands, which span multiple requests. */ @@ -127,7 +142,7 @@ struct __GLXclientStateRec { */ __GLXcontext **currentContexts; GLint numCurrentContexts; - + /* Back pointer to X client record */ ClientPtr client; @@ -168,7 +183,7 @@ typedef struct { } __GLXrenderSizeData; extern __GLXrenderSizeData __glXRenderSizeTable[]; extern __GLXrenderSizeData __glXRenderSizeTable_EXT[]; - + /************************************************************************/ /* @@ -215,6 +230,15 @@ extern void glxSwapQueryServerStringReply(ClientPtr client, * Routines for computing the size of variably-sized rendering commands. */ +extern int __glXTypeSize(GLenum enm); +extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLint rowLength, GLint skipRows, GLint alignment); +extern int __glXImage3DSize(GLenum format, GLenum type, + GLsizei w, GLsizei h, GLsizei d, + GLint imageHeight, GLint rowLength, + GLint skipImages, GLint skipRows, + GLint alignment); + extern int __glXCallListsReqSize(GLbyte *pc, Bool swap); extern int __glXBitmapReqSize(GLbyte *pc, Bool swap); extern int __glXFogfvReqSize(GLbyte *pc, Bool swap); @@ -242,10 +266,28 @@ extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap); extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap); extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap); extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap); -extern int __glXTypeSize(GLenum enm); extern int __glXDrawArraysSize(GLbyte *pc, Bool swap); extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap); extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap); extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap); +extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ); +extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableReqSize(GLbyte *pc, Bool swap); +extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap); + +/* + * Routines for computing the size of returned data. + */ +extern int __glXConvolutionParameterivSize(GLenum pname); +extern int __glXConvolutionParameterfvSize(GLenum pname); +extern int __glXColorTableParameterfvSize(GLenum pname); +extern int __glXColorTableParameterivSize(GLenum pname); #endif /* !__GLX_server_h__ */ diff --git a/xc/programs/Xserver/GL/glx/glxutil.c b/xc/programs/Xserver/GL/glx/glxutil.c index c5d33d604..a32dc5e43 100644 --- a/xc/programs/Xserver/GL/glx/glxutil.c +++ b/xc/programs/Xserver/GL/glx/glxutil.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.4 1999/07/18 08:34:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES @@ -29,6 +43,7 @@ #include <windowstr.h> #include "glxutil.h" #include "glxbuf.h" +#include "GL/glx_ansic.h" /************************************************************************/ @@ -200,8 +215,12 @@ __glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config) modes->greenMask = config->greenMask; modes->blueMask = config->blueMask; modes->alphaMask = config->alphaMask; +#if 0 modes->rgbBits = modes->redBits + modes->greenBits + modes->blueBits + modes->alphaBits; +#endif + assert( !modes->rgbMode || ((config->bufferSize & 0x7) == 0) ); + modes->rgbBits = config->bufferSize; modes->indexBits = config->bufferSize; modes->accumRedBits = config->accumRedSize; @@ -234,8 +253,6 @@ LockDP(__GLdrawablePrivate *glPriv, __GLcontext *gc) /* some pending state. Deal with it */ if (glxc->pendingState & __GLX_PENDING_RESIZE) { - __GLXdrawablePrivate *glxPriv = glxc->glxPriv; - glxc->pendingState &= ~__GLX_PENDING_RESIZE; (*glci->exports.notifyResize)(gc); diff --git a/xc/programs/Xserver/GL/glx/glxutil.h b/xc/programs/Xserver/GL/glx/glxutil.h index d074d77ce..a4d40afc4 100644 --- a/xc/programs/Xserver/GL/glx/glxutil.h +++ b/xc/programs/Xserver/GL/glx/glxutil.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ #ifndef _glxcmds_h_ #define _glxcmds_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.2 1999/06/14 07:31:33 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ extern void __glXNop(void); diff --git a/xc/programs/Xserver/GL/glx/impsize.h b/xc/programs/Xserver/GL/glx/impsize.h index 597da569e..f4c2778f4 100644 --- a/xc/programs/Xserver/GL/glx/impsize.h +++ b/xc/programs/Xserver/GL/glx/impsize.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ #ifndef _impsize_h_ #define _impsize_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/impsize.h,v 1.2 1999/06/14 07:31:33 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ /* @@ -31,6 +45,10 @@ ** replicate the code in here. */ extern int __glCallLists_size(GLsizei n, GLenum type); +extern int __glColorTableParameterfv_size(GLenum pname); +extern int __glColorTableParameteriv_size(GLenum pname); +extern int __glConvolutionParameterfv_size(GLenum pname); +extern int __glConvolutionParameteriv_size(GLenum pname); extern int __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h); extern int __glFogfv_size(GLenum pname); extern int __glFogiv_size(GLenum pname); @@ -47,7 +65,6 @@ extern int __glTexGenfv_size(GLenum e); extern int __glTexGeniv_size(GLenum pname); extern int __glTexParameterfv_size(GLenum e); extern int __glTexParameteriv_size(GLenum e); - extern int __glEvalComputeK(GLenum target); #endif /* _impsize_h_ */ diff --git a/xc/programs/Xserver/GL/glx/render2.c b/xc/programs/Xserver/GL/glx/render2.c index 01a57411d..04bef0e8c 100644 --- a/xc/programs/Xserver/GL/glx/render2.c +++ b/xc/programs/Xserver/GL/glx/render2.c @@ -1,29 +1,44 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ /* #define NEED_REPLIES */ -#include "glxserver.h" +#include <glxserver.h> #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" extern GLint __glEvalComputeK(GLenum target); @@ -33,7 +48,7 @@ void __glXDisp_Map1f(GLbyte *pc) GLfloat u1, u2, *points; GLenum target; - target = *(GLenum *)(pc + 0); + target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); u1 = *(GLfloat *)(pc + 4); u2 = *(GLfloat *)(pc + 8); @@ -48,8 +63,8 @@ void __glXDisp_Map2f(GLbyte *pc) GLint uorder, vorder, ustride, vstride, k; GLfloat u1, u2, v1, v2, *points; GLenum target; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); u1 = *(GLfloat *)(pc + 4); @@ -169,7 +184,7 @@ void __glXDisp_DrawArrays(GLbyte *pc) GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; - stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); + stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); } pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); @@ -180,36 +195,36 @@ void __glXDisp_DrawArrays(GLbyte *pc) GLint numVals = compHeader[i].numVals; GLenum component = compHeader[i].component; - switch (component) { - case GL_VERTEX_ARRAY: + switch (component) { + case GL_VERTEX_ARRAY: glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(numVals, datatype, stride, pc); - break; - case GL_NORMAL_ARRAY: + break; + case GL_NORMAL_ARRAY: glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(datatype, stride, pc); - break; - case GL_COLOR_ARRAY: + break; + case GL_COLOR_ARRAY: glEnableClientState(GL_COLOR_ARRAY); glColorPointer(numVals, datatype, stride, pc); - break; - case GL_INDEX_ARRAY: + break; + case GL_INDEX_ARRAY: glEnableClientState(GL_INDEX_ARRAY); glIndexPointer(datatype, stride, pc); - break; - case GL_TEXTURE_COORD_ARRAY: + break; + case GL_TEXTURE_COORD_ARRAY: glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(numVals, datatype, stride, pc); - break; - case GL_EDGE_FLAG_ARRAY: + break; + case GL_EDGE_FLAG_ARRAY: glEnableClientState(GL_EDGE_FLAG_ARRAY); glEdgeFlagPointer(stride, (const GLboolean *)pc); - break; - default: - break; + break; + default: + break; } - pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); + pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); } glDrawArrays(primType, 0, numVertexes); @@ -222,3 +237,9 @@ void __glXDisp_DrawArrays(GLbyte *pc) glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); } + +void __glXDisp_DrawArraysEXT(GLbyte *pc) +{ +#ifdef XXX_STUB +#endif /*XXX_STUB*/ +} diff --git a/xc/programs/Xserver/GL/glx/render2swap.c b/xc/programs/Xserver/GL/glx/render2swap.c index 040a24594..25f9f3915 100644 --- a/xc/programs/Xserver/GL/glx/render2swap.c +++ b/xc/programs/Xserver/GL/glx/render2swap.c @@ -1,29 +1,44 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ /* #define NEED_REPLIES */ #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" extern GLint __glEvalComputeK(GLenum target); @@ -363,3 +378,9 @@ void __glXDispSwap_DrawArrays(GLbyte *pc) glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); } + +void __glXDispSwap_DrawArraysEXT(GLbyte *pc) +{ +#ifdef XXX_STUB +#endif /*XXX_STUB*/ +} diff --git a/xc/programs/Xserver/GL/glx/renderpix.c b/xc/programs/Xserver/GL/glx/renderpix.c index bbaab81a9..ad5625dd6 100644 --- a/xc/programs/Xserver/GL/glx/renderpix.c +++ b/xc/programs/Xserver/GL/glx/renderpix.c @@ -1,29 +1,44 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/renderpix.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/renderpix.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" void __glXDisp_PolygonStipple(GLbyte *pc) { @@ -48,12 +63,12 @@ void __glXDisp_Bitmap(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glBitmap((GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLfloat) hdr->xorig, - (GLfloat) hdr->yorig, + glBitmap((GLsizei) hdr->width, + (GLsizei) hdr->height, + (GLfloat) hdr->xorig, + (GLfloat) hdr->yorig, (GLfloat) hdr->xmove, - (GLfloat) hdr->ymove, + (GLfloat) hdr->ymove, (GLubyte *)(hdr+1)); } @@ -68,13 +83,13 @@ void __glXDisp_TexImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLint) hdr->border, - hdr->format, - hdr->type, + (GLint) hdr->border, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -89,17 +104,35 @@ void __glXDisp_TexImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLint) hdr->border, - hdr->format, + (GLsizei) hdr->height, + (GLint) hdr->border, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } +void __glXDisp_TexImage3D(GLbyte *pc) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexImage3D(hdr->target, hdr->level, hdr->internalformat, hdr->width, + hdr->height, hdr->depth, hdr->border, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + void __glXDisp_DrawPixels(GLbyte *pc) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -111,9 +144,9 @@ void __glXDisp_DrawPixels(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glDrawPixels((GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + glDrawPixels((GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } @@ -129,12 +162,12 @@ void __glXDisp_TexSubImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLsizei) hdr->width, - hdr->format, - hdr->type, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -149,13 +182,126 @@ void __glXDisp_TexSubImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLint) hdr->yoffset, - (GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + (GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } + +void __glXDisp_TexSubImage3D(GLbyte *pc) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexSubImage3D(hdr->target, hdr->level, hdr->xoffset, hdr->yoffset, + hdr->zoffset, hdr->width, hdr->height, hdr->depth, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDisp_ColorTable(GLbyte *pc) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorTable(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_ColorSubTable(GLbyte *pc) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorSubTable(hdr->target, hdr->start, hdr->count, hdr->format, + hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDisp_ConvolutionFilter1D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter1D(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_ConvolutionFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDisp_SeparableFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + GLint hdrlen, image1len; + + hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE); + + glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + /* XXX check this usage - internal code called + ** a version without the packing parameters + */ + image1len = __glXImageSize(hdr->format, hdr->type, hdr->width, 1, + hdr->rowLength, hdr->skipRows, hdr->alignment); + image1len = __GLX_PAD(image1len); + + glSeparableFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)); +} diff --git a/xc/programs/Xserver/GL/glx/renderpixswap.c b/xc/programs/Xserver/GL/glx/renderpixswap.c index 51e96844e..3b0e1f6b7 100644 --- a/xc/programs/Xserver/GL/glx/renderpixswap.c +++ b/xc/programs/Xserver/GL/glx/renderpixswap.c @@ -1,29 +1,44 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.4 1999/07/18 08:34:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" void __glXDispSwap_PolygonStipple(GLbyte *pc) { @@ -53,26 +68,26 @@ void __glXDispSwap_Bitmap(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig); __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig); __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove); __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove); - + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glBitmap((GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLfloat) hdr->xorig, - (GLfloat) hdr->yorig, + glBitmap((GLsizei) hdr->width, + (GLsizei) hdr->height, + (GLfloat) hdr->xorig, + (GLfloat) hdr->yorig, (GLfloat) hdr->xmove, - (GLfloat) hdr->ymove, + (GLfloat) hdr->ymove, (GLubyte *)(hdr+1)); } @@ -85,7 +100,7 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->components); @@ -94,7 +109,7 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -106,13 +121,13 @@ void __glXDispSwap_TexImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLint) hdr->border, - hdr->format, - hdr->type, + (GLint) hdr->border, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -125,7 +140,7 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->components); @@ -134,7 +149,7 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -146,17 +161,60 @@ void __glXDispSwap_TexImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->components, + glTexImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->components, (GLsizei) hdr->width, - (GLsizei) hdr->height, - (GLint) hdr->border, - hdr->format, + (GLsizei) hdr->height, + (GLint) hdr->border, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } +void __glXDispSwap_TexImage3D(GLbyte *pc) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); + __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); + __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->depth); + __GLX_SWAP_INT((GLbyte *)&hdr->size4d); + __GLX_SWAP_INT((GLbyte *)&hdr->border); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexImage3D(hdr->target, hdr->level, hdr->internalformat, hdr->width, + hdr->height, hdr->depth, hdr->border, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + void __glXDispSwap_DrawPixels(GLbyte *pc) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -166,12 +224,12 @@ void __glXDispSwap_DrawPixels(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -183,9 +241,9 @@ void __glXDispSwap_DrawPixels(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glDrawPixels((GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + glDrawPixels((GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } @@ -199,14 +257,14 @@ void __glXDispSwap_TexSubImage1D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -218,12 +276,12 @@ void __glXDispSwap_TexSubImage1D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage1D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage1D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLsizei) hdr->width, - hdr->format, - hdr->type, + hdr->format, + hdr->type, (GLvoid *)(hdr+1)); } @@ -236,7 +294,7 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); - + __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); @@ -245,7 +303,7 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); - + /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. @@ -257,13 +315,236 @@ void __glXDispSwap_TexSubImage2D(GLbyte *pc) glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); - glTexSubImage2D(hdr->target, - (GLint) hdr->level, - (GLint) hdr->xoffset, + glTexSubImage2D(hdr->target, + (GLint) hdr->level, + (GLint) hdr->xoffset, (GLint) hdr->yoffset, - (GLsizei) hdr->width, - (GLsizei) hdr->height, - hdr->format, + (GLsizei) hdr->width, + (GLsizei) hdr->height, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); } + +void __glXDispSwap_TexSubImage3D(GLbyte *pc) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); + __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); + __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->zoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->depth); + __GLX_SWAP_INT((GLbyte *)&hdr->size4d); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glTexSubImage3D(hdr->target, hdr->level, hdr->xoffset, hdr->yoffset, + hdr->zoffset, hdr->width, hdr->height, hdr->depth, + hdr->format, hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ColorTable(GLbyte *pc) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorTable(hdr->target, hdr->internalformat, + hdr->width, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ColorSubTable(GLbyte *pc) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->start); + __GLX_SWAP_INT((GLbyte *)&hdr->count); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glColorSubTable(hdr->target, hdr->start, hdr->count, hdr->format, + hdr->type, (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, 1, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + glConvolutionFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + (GLvoid *)(hdr+1)); +} + +void __glXDispSwap_SeparableFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + GLint hdrlen, image1len; + __GLX_DECLARE_SWAP_VARIABLES; + + hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); + glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); + glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); + glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); + glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); + + /* XXX check this usage - internal code called + ** a version without the packing parameters + */ + image1len = __glXImageSize(hdr->format, hdr->type, hdr->width, 1, + hdr->rowLength, hdr->skipRows, hdr->alignment); + image1len = __GLX_PAD(image1len); + + + glSeparableFilter2D(hdr->target, hdr->internalformat, + hdr->width, hdr->height, hdr->format, hdr->type, + ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)); +} diff --git a/xc/programs/Xserver/GL/glx/rensize.c b/xc/programs/Xserver/GL/glx/rensize.c index 484a16eab..22dace4e8 100644 --- a/xc/programs/Xserver/GL/glx/rensize.c +++ b/xc/programs/Xserver/GL/glx/rensize.c @@ -1,28 +1,42 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.2 1999/06/14 07:31:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ -#include "glxserver.h" #include <GL/gl.h> -#include <GL/glxproto.h> +#include "glxserver.h" +#include "GL/glxproto.h" #include "unpack.h" #include "impsize.h" @@ -64,7 +78,7 @@ int __glXLightfvReqSize(GLbyte *pc, Bool swap ) } return 4 * __glLightfv_size( pname ); /* defined in samplegl lib */ } - + int __glXLightivReqSize(GLbyte *pc, Bool swap ) { return __glXLightfvReqSize( pc, swap ); @@ -159,7 +173,7 @@ int __glXMap1dReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint order, k; - + target = *(GLenum*) (pc + 16); order = *(GLint*) (pc + 20); if (swap) { @@ -174,8 +188,8 @@ int __glXMap1fReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint order, k; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); if (swap) { target = SWAPL( target ); @@ -195,7 +209,7 @@ int __glXMap2dReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint uorder, vorder, k; - + target = *(GLenum *)(pc + 32); uorder = *(GLint *)(pc + 36); vorder = *(GLint *)(pc + 40); @@ -212,8 +226,8 @@ int __glXMap2fReqSize(GLbyte *pc, Bool swap ) { GLenum target; GLint uorder, vorder, k; - - target = *(GLenum *)(pc + 0); + + target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); if (swap) { @@ -250,19 +264,19 @@ int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap ) return 2 * mapsize; } -static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, - GLint rowLength, GLint skipRows, GLint alignment ) +int __glXImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, + GLint rowLength, GLint skipRows, GLint alignment ) { GLint bytesPerElement, elementsPerGroup, groupsPerRow; GLint groupSize, rowSize, padding; - + if (w < 0 || h < 0 || (type == GL_BITMAP && (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { return -1; } if (w==0 || h==0) return 0; - + if (type == GL_BITMAP) { if (rowLength > 0) { groupsPerRow = rowLength; @@ -276,23 +290,117 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, } return ((h + skipRows) * rowSize); } else { + switch(format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + elementsPerGroup = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elementsPerGroup = 1; + break; + case GL_LUMINANCE_ALPHA: + elementsPerGroup = 2; + break; + case GL_RGB: + case GL_BGR: + elementsPerGroup = 3; + break; + case GL_RGBA: + case GL_BGRA: + case GL_ABGR_EXT: + elementsPerGroup = 4; + break; + default: + return -1; + } switch(type) { case GL_UNSIGNED_BYTE: case GL_BYTE: bytesPerElement = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + bytesPerElement = 1; + elementsPerGroup = 1; + break; case GL_UNSIGNED_SHORT: case GL_SHORT: bytesPerElement = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + bytesPerElement = 2; + elementsPerGroup = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: bytesPerElement = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + bytesPerElement = 4; + elementsPerGroup = 1; + break; default: return -1; } + groupSize = bytesPerElement * elementsPerGroup; + if (rowLength > 0) { + groupsPerRow = rowLength; + } else { + groupsPerRow = w; + } + rowSize = groupsPerRow * groupSize; + padding = (rowSize % alignment); + if (padding) { + rowSize += alignment - padding; + } + return ((h + skipRows) * rowSize); + } +} + +/* XXX + * This should be folded into __glXImageSize(). + */ +int __glXImage3DSize( GLenum format, GLenum type, GLsizei w, GLsizei h, + GLsizei d, GLint imageHeight, GLint rowLength, + GLint skipImages, GLint skipRows, GLint alignment ) +{ + GLint bytesPerElement, elementsPerGroup, groupsPerRow; + GLint groupSize, rowSize, padding, imageSize; + + if (w < 0 || h < 0 || d < 0 || + (type == GL_BITMAP && + (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { + return -1; + } + if (w==0 || h==0 || d == 0) return 0; + + if (type == GL_BITMAP) { + if (rowLength > 0) { + groupsPerRow = rowLength; + } else { + groupsPerRow = w; + } + rowSize = (groupsPerRow + 7) >> 3; + padding = (rowSize % alignment); + if (padding) { + rowSize += alignment - padding; + } + return ((h + skipRows) * rowSize); + } else { switch(format) { case GL_COLOR_INDEX: case GL_STENCIL_INDEX: @@ -310,15 +418,55 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, elementsPerGroup = 2; break; case GL_RGB: + case GL_BGR: elementsPerGroup = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elementsPerGroup = 4; break; default: return -1; } + switch(type) { + case GL_UNSIGNED_BYTE: + case GL_BYTE: + bytesPerElement = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + bytesPerElement = 1; + elementsPerGroup = 1; + break; + case GL_UNSIGNED_SHORT: + case GL_SHORT: + bytesPerElement = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + bytesPerElement = 2; + elementsPerGroup = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + bytesPerElement = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + bytesPerElement = 4; + elementsPerGroup = 1; + break; + default: + return -1; + } groupSize = bytesPerElement * elementsPerGroup; if (rowLength > 0) { groupsPerRow = rowLength; @@ -330,10 +478,16 @@ static int ImageSize( GLenum format, GLenum type, GLsizei w, GLsizei h, if (padding) { rowSize += alignment - padding; } - return ((h + skipRows) * rowSize); + if (imageHeight > 0) { + imageSize = (imageHeight + skipRows) * rowSize; + } else { + imageSize = (h + skipRows) * rowSize; + } + return ((d + skipImages) * imageSize); } } + int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; @@ -350,11 +504,11 @@ int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap ) type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); - rowLength = SWAPL( rowLength ); + rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); } int __glXBitmapReqSize(GLbyte *pc, Bool swap ) @@ -369,11 +523,11 @@ int __glXBitmapReqSize(GLbyte *pc, Bool swap ) if (swap) { w = SWAPL( w ); h = SWAPL( h ); - rowLength = SWAPL( rowLength ); + rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( GL_COLOR_INDEX, GL_BITMAP, w, h, + return __glXImageSize( GL_COLOR_INDEX, GL_BITMAP, w, h, rowLength, skipRows, alignment ); } @@ -402,7 +556,7 @@ int __glXTexImage1DReqSize(GLbyte *pc, Bool swap ) } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) { return -1; } - return ImageSize( format, type, w, 1, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, 1, rowLength, skipRows, alignment ); } int __glXTexImage2DReqSize(GLbyte *pc, Bool swap ) @@ -432,20 +586,21 @@ int __glXTexImage2DReqSize(GLbyte *pc, Bool swap ) } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) { return -1; } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); } +/* XXX this is used elsewhere - should it be exported from glxserver.h? */ int __glXTypeSize(GLenum enm) { switch(enm) { - case GL_BYTE: return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: return sizeof(GLubyte); - case GL_SHORT: return sizeof(GLshort); - case GL_UNSIGNED_SHORT: return sizeof(GLushort); - case GL_INT: return sizeof(GLint); - case GL_UNSIGNED_INT: return sizeof(GLint); - case GL_FLOAT: return sizeof(GLfloat); - case GL_DOUBLE: return sizeof(GLdouble); + case GL_BYTE: return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: return sizeof(GLubyte); + case GL_SHORT: return sizeof(GLshort); + case GL_UNSIGNED_SHORT: return sizeof(GLushort); + case GL_INT: return sizeof(GLint); + case GL_UNSIGNED_INT: return sizeof(GLint); + case GL_FLOAT: return sizeof(GLfloat); + case GL_DOUBLE: return sizeof(GLdouble); default: return -1; } } @@ -478,32 +633,32 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) component = SWAPL( component ); } - switch (component) { - case GL_VERTEX_ARRAY: - case GL_COLOR_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - break; - case GL_NORMAL_ARRAY: - if (numVals != 3) { + switch (component) { + case GL_VERTEX_ARRAY: + case GL_COLOR_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + break; + case GL_NORMAL_ARRAY: + if (numVals != 3) { /* bad size */ - return -1; - } + return -1; + } break; - case GL_INDEX_ARRAY: - if (numVals != 1) { + case GL_INDEX_ARRAY: + if (numVals != 1) { /* bad size */ - return -1; - } - break; - case GL_EDGE_FLAG_ARRAY: - if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) { + return -1; + } + break; + case GL_EDGE_FLAG_ARRAY: + if ((numVals != 1) && (datatype != GL_UNSIGNED_BYTE)) { /* bad size or bad type */ return -1; - } - break; - default: - /* unknown component type */ - return -1; + } + break; + default: + /* unknown component type */ + return -1; } arrayElementSize += __GLX_PAD(numVals * __glXTypeSize(datatype)); @@ -512,7 +667,7 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) } return ((numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader)) + - (numVertexes * arrayElementSize)); + (numVertexes * arrayElementSize)); } int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap ) @@ -541,7 +696,7 @@ int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap ) skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, 1, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, 1, rowLength, skipRows, alignment ); } int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) @@ -565,5 +720,280 @@ int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap ) skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } - return ImageSize( format, type, w, h, rowLength, skipRows, alignment ); + return __glXImageSize( format, type, w, h, rowLength, skipRows, alignment ); +} + +int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint d = hdr->depth; + GLint imageHeight = hdr->imageHeight; + GLint rowLength = hdr->rowLength; + GLint skipImages = hdr->skipImages; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + GLint nullImage = hdr->nullimage; + + if (swap) { + target = SWAPL( target ); + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + d = SWAPL( d ); + imageHeight = SWAPL( imageHeight ); + rowLength = SWAPL( rowLength ); + skipImages = SWAPL( skipImages ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + if (target == GL_PROXY_TEXTURE_3D || nullImage) { + return 0; + } else { + return __glXImage3DSize( format, type, w, h, d, imageHeight, + rowLength, skipImages, skipRows, + alignment); + } +} + +int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint d = hdr->depth; + GLint imageHeight = hdr->imageHeight; + GLint rowLength = hdr->rowLength; + GLint skipImages = hdr->skipImages; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + + if (swap) { + target = SWAPL( target ); + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + d = SWAPL( d ); + imageHeight = SWAPL( imageHeight ); + rowLength = SWAPL( rowLength ); + skipImages = SWAPL( skipImages ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + if (target == GL_PROXY_TEXTURE_3D) { + return 0; + } else { + return __glXImage3DSize( format, type, w, h, d, imageHeight, + rowLength, skipImages, skipRows, + alignment); + } +} + +int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); +} + +int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint rowLength = hdr->rowLength; + GLint skipRows = hdr->skipRows; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + rowLength = SWAPL( rowLength ); + skipRows = SWAPL( skipRows ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, h, rowLength, skipRows, alignment ); +} + +int __glXConvolutionParameterivSize(GLenum pname) +{ + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + case GL_CONVOLUTION_BORDER_MODE: + return 1; + default: + return -1; + } +} + +int __glXConvolutionParameterfvSize(GLenum pname) +{ + return __glXConvolutionParameterivSize(pname); +} + +int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap ) +{ + GLenum pname = *(GLenum *)(pc + 4); + if (swap) { + pname = SWAPL( pname ); + } + return 4 * __glXConvolutionParameterivSize( pname ); +} + +int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap ) +{ + return __glXConvolutionParameterivReqSize( pc, swap ); +} + +int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + + GLint image1size, image2size; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint h = hdr->height; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + h = SWAPL( h ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + /* XXX Should rowLength be used for either or both image? */ + image1size = __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); + image1size = __GLX_PAD(image1size); + image2size = __glXImageSize ( format, type, h, 1, rowLength, 0, alignment ); + return image1size + image2size; + +} + +int __glXColorTableParameterfvSize(GLenum pname) +{ + /* currently, only scale and bias are supported; return RGBA */ + switch(pname) { + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return 0; + } +} + +int __glXColorTableParameterivSize(GLenum pname) +{ + /* fv and iv are the same in this context */ + return __glXColorTableParameterfvSize(pname); +} + +int __glXColorTableReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + + GLenum target = hdr->target; + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint w = hdr->width; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + switch (target) { + case GL_PROXY_TEXTURE_1D: + case GL_PROXY_TEXTURE_2D: + case GL_PROXY_TEXTURE_3D: + case GL_PROXY_COLOR_TABLE: + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + return 0; + } + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + w = SWAPL( w ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, w, 1, rowLength, 0, alignment ); +} + +int __glXColorSubTableReqSize(GLbyte *pc, Bool swap ) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + + GLenum format = hdr->format; + GLenum type = hdr->type; + GLint count = hdr->count; + GLint rowLength = hdr->rowLength; + GLint alignment = hdr->alignment; + + if (swap) { + format = SWAPL( format ); + type = SWAPL( type ); + count = SWAPL( count ); + rowLength = SWAPL( rowLength ); + alignment = SWAPL( alignment ); + } + + return __glXImageSize ( format, type, count, 1, rowLength, 0, alignment ); +} + +int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap ) +{ + GLenum pname = *(GLenum *)(pc + 4); + if (swap) { + pname = SWAPL( pname ); + } + return 4 * __glXColorTableParameterfvSize(pname); +} + +int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap ) +{ + /* no difference between fv and iv versions */ + return __glXColorTableParameterfvReqSize(pc, swap); } diff --git a/xc/programs/Xserver/GL/glx/rensizetab.c b/xc/programs/Xserver/GL/glx/rensizetab.c index 229fa3c30..71a96d25c 100644 --- a/xc/programs/Xserver/GL/glx/rensizetab.c +++ b/xc/programs/Xserver/GL/glx/rensizetab.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.2 1999/06/14 07:31:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/rensizetab.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include "glxserver.h" @@ -216,14 +230,2058 @@ __GLXrenderSizeData __glXRenderSizeTable[] = { /* Translatef */ { 16, 0 }, /* Viewport */ { 20, 0 }, /* PolygonOffset */ { 12, 0 }, - /* DrawArrays */ { 16, __glXDrawArraysSize }, + /* no such opcode */ { 0, 0 }, /* Indexubv */ { 8, 0 }, + /* ColorSubTable */ { 44, __glXColorSubTableReqSize }, + /* CopyColorSubTable */ { 24, 0 }, + /* ActiveTextureARB */ { 8, 0 }, + /* MultiTexCoord1dvARB */ { 16, 0 }, + /* MultiTexCoord1fvARB */ { 12, 0 }, + /* MultiTexCoord1ivARB */ { 12, 0 }, + /* MultiTexCoord1svARB */ { 12, 0 }, + /* MultiTexCoord2dvARB */ { 24, 0 }, + /* MultiTexCoord2fvARB */ { 16, 0 }, + /* MultiTexCoord2ivARB */ { 16, 0 }, + /* MultiTexCoord2svARB */ { 12, 0 }, + /* MultiTexCoord3dvARB */ { 32, 0 }, + /* MultiTexCoord3fvARB */ { 20, 0 }, + /* MultiTexCoord3ivARB */ { 20, 0 }, + /* MultiTexCoord3svARB */ { 16, 0 }, + /* MultiTexCoord4dvARB */ { 40, 0 }, + /* MultiTexCoord4fvARB */ { 24, 0 }, + /* MultiTexCoord4ivARB */ { 24, 0 }, + /* MultiTexCoord4svARB */ { 16, 0 }, }; __GLXrenderSizeData __glXRenderSizeTable_EXT[] = { - /* PolygonOffset */ { 12, 0 }, - /* TexSubImage1D */ { 60, __glXTexSubImage1DReqSize }, - /* TexSubImage2D */ { 60, __glXTexSubImage2DReqSize }, - /* no such opcode */ { 0, 0 }, + /* ColorTable */ { 44, __glXColorTableReqSize }, + /* ColorTableParameterfv */ { 12, __glXColorTableParameterfvReqSize }, + /* ColorTableParameteriv */ { 12, __glXColorTableParameterivReqSize }, + /* CopyColorTable */ { 24, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, + /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, @@ -238,11 +2296,32 @@ __GLXrenderSizeData __glXRenderSizeTable_EXT[] = { /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, + /* BlendColor */ { 20, 0 }, + /* BlendEquation */ { 8, 0 }, /* no such opcode */ { 0, 0 }, + /* TexSubImage1D */ { 60, __glXTexSubImage1DReqSize }, + /* TexSubImage2D */ { 60, __glXTexSubImage2DReqSize }, + /* ConvolutionFilter1D */ { 48, __glXConvolutionFilter1DReqSize }, + /* ConvolutionFilter2D */ { 48, __glXConvolutionFilter2DReqSize }, + /* ConvolutionParameterf */ { 16, 0 }, + /* ConvolutionParameterfv */ { 12, __glXConvolutionParameterfvReqSize }, + /* ConvolutionParameteri */ { 16, 0 }, + /* ConvolutionParameteriv */ { 12, __glXConvolutionParameterivReqSize }, + /* CopyConvolutionFilter1D */ { 24, }, + /* CopyConvolutionFilter2D */ { 28, }, + /* SeparableFilter2D */ { 48, __glXSeparableFilter2DReqSize }, + /* Histogram */ { 20, }, + /* Minmax */ { 16, }, + /* ResetHistogram */ { 8, }, + /* ResetMinmax */ { 8, }, + /* TexImage3D */ { 84, __glXTexImage3DReqSize }, + /* TexSubImage3D */ { 92, __glXTexSubImage3DReqSize }, + /* DrawArrays */ { 16, __glXDrawArraysSize }, /* BindTexture */ { 12, 0 }, /* PrioritizeTextures */ { 8, __glXPrioritizeTexturesReqSize }, /* CopyTexImage1D */ { 32, 0 }, /* CopyTexImage2D */ { 36, 0 }, /* CopyTexSubImage1D */ { 28, 0 }, /* CopyTexSubImage2D */ { 36, 0 }, + /* CopyTexSubImage3D */ { 40, 0 }, }; diff --git a/xc/programs/Xserver/GL/glx/single2.c b/xc/programs/Xserver/GL/glx/single2.c index d62c22a1b..513827593 100644 --- a/xc/programs/Xserver/GL/glx/single2.c +++ b/xc/programs/Xserver/GL/glx/single2.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES @@ -26,6 +40,7 @@ #include "glxext.h" #include "unpack.h" #include "g_disptab.h" +#include "GL/glx_ansic.h" int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { @@ -186,7 +201,6 @@ int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; - ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -282,10 +296,9 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) __GLXcontext *cx; GLenum name; const char *string; - GLint length; int error; - GLubyte *answer; - char *buf; + char *buf = NULL, *buf1 = NULL; + GLint length = 0; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -297,26 +310,32 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) string = (const char *)glGetString(name); client = cl->client; - if ((name == GL_EXTENSIONS) && (cl->GLClientextensions)) { - buf = __glXcombine_strings(string, + /* + ** Restrict extensions to those that are supported by both the + ** implementation and the connection. That is, return the + ** intersection of client, server, and core extension strings. + */ + if (name == GL_EXTENSIONS) { + buf1 = __glXcombine_strings(string, cl->GLClientextensions); - } else { - buf = __glXMalloc(__glXStrlen(string) + 2); - __glXStrcpy(buf, string); + buf = __glXcombine_strings(buf1, + cx->pGlxScreen->GLextensions); + if (buf1 != NULL) { + __glXFree(buf1); + } + string = buf; } - if (!buf) { - length = 0; - __GLX_BEGIN_REPLY(0); - __GLX_PUT_SIZE(0); - } else { - length = __glXStrlen((const char *) buf) + 1; - __GLX_BEGIN_REPLY(length); - __GLX_PUT_SIZE(length); + if (string) { + length = __glXStrlen((const char *) string) + 1; } + __GLX_BEGIN_REPLY(length); + __GLX_PUT_SIZE(length); __GLX_SEND_HEADER(); - WriteToClient(client, length, buf); - __glXFree(buf); + WriteToClient(client, length, (char *) string); + if (buf != NULL) { + __glXFree(buf); + } return Success; } diff --git a/xc/programs/Xserver/GL/glx/single2swap.c b/xc/programs/Xserver/GL/glx/single2swap.c index 3aa1af0f7..25b92d84c 100644 --- a/xc/programs/Xserver/GL/glx/single2swap.c +++ b/xc/programs/Xserver/GL/glx/single2swap.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES @@ -26,6 +40,7 @@ #include "glxext.h" #include "unpack.h" #include "g_disptab.h" +#include "GL/glx_ansic.h" int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { @@ -251,11 +266,11 @@ int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) __GLXcontext *cx; GLenum name; const char *string; - GLint length; __GLX_DECLARE_SWAP_VARIABLES; int error; GLubyte *answer; - char *buf; + char *buf = NULL, *buf1 = NULL; + GLint length = 0; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -269,28 +284,35 @@ int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) string = (const char *)glGetString(name); client = cl->client; - if ((name == GL_EXTENSIONS) && (cl->GLClientextensions)) { - buf = __glXcombine_strings(string, + /* + ** Restrict extensions to those that are supported by both the + ** implementation and the connection. That is, return the + ** intersection of client, server, and core extension strings. + */ + if (name == GL_EXTENSIONS) { + buf1 = __glXcombine_strings(string, cl->GLClientextensions); - } else { - buf = __glXMalloc(__glXStrlen(string) + 2); - __glXStrcpy(buf, string); + buf = __glXcombine_strings(buf1, + cx->pGlxScreen->GLextensions); + if (buf1 != NULL) { + __glXFree(buf1); + } + string = buf; } - if (!buf) { - length = 0; - __GLX_BEGIN_REPLY(0); - __GLX_PUT_SIZE(0); - } else { - length = __glXStrlen((const char *) buf) + 1; - __GLX_BEGIN_REPLY(length); - __GLX_PUT_SIZE(length); + if (string) { + length = __glXStrlen((const char *) string) + 1; } - + + __GLX_BEGIN_REPLY(length); + __GLX_PUT_SIZE(length); + __GLX_SWAP_REPLY_SIZE(); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); - WriteToClient(client, length, buf); - __glXFree(buf); + WriteToClient(client, length, (char *) string); + if (buf != NULL) { + __glXFree(buf); + } return Success; } diff --git a/xc/programs/Xserver/GL/glx/singlepix.c b/xc/programs/Xserver/GL/glx/singlepix.c index 830bdd50c..85be77d85 100644 --- a/xc/programs/Xserver/GL/glx/singlepix.c +++ b/xc/programs/Xserver/GL/glx/singlepix.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlepix.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/singlepix.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES @@ -26,6 +40,7 @@ #include "singlesize.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) { @@ -57,7 +72,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glReadPixels( + glReadPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), @@ -87,7 +102,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; - GLint width=0, height=0; + GLint width=0, height=0, depth=1; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { @@ -100,20 +115,23 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) type = *(GLenum *)(pc + 12); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 16); - + glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); + if ( target == GL_TEXTURE_3D) { + glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); + } /* - * The two queries above might fail if we're in a state where queries - * are illegal, but then width and height would still be zero anyway. + * The three queries above might fail if we're in a state where queries + * are illegal, but then width, height, and depth would still be zero anyway. */ - compsize = __glGetTexImage_size(target,level,format,type,width,height); + compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); if (compsize < 0) compsize = 0; - + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glGetTexImage( + glGetTexImage( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), @@ -128,6 +146,7 @@ int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) __GLX_BEGIN_REPLY(compsize); ((xGLXGetTexImageReply *)&__glXReply)->width = width; ((xGLXGetTexImageReply *)&__glXReply)->height = height; + ((xGLXGetTexImageReply *)&__glXReply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } @@ -147,17 +166,18 @@ int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) if (!cx) { return error; } + pc += __GLX_SINGLE_HDR_SIZE; lsbFirst = *(GLboolean *)(pc + 0); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,128,1); - + __glXClearErrorOccured(); - glGetPolygonStipple( + glGetPolygonStipple( (GLubyte *) answer ); - + if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); @@ -169,4 +189,270 @@ int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) return Success; } +int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize, compsize2; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + /* target must be SEPARABLE_2D, however I guess we can let the GL + barf on this one.... */ + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); + + if (compsize < 0) compsize = 0; + if (compsize2 < 0) compsize2 = 0; + compsize = __GLX_PAD(compsize); + compsize2 = __GLX_PAD(compsize2); + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __glXClearErrorOccured(); + glGetSeparableFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer, + answer + compsize, + NULL + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize + compsize2); + ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width; + ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize + compsize2); + } + + return Success; +} + +int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + if (target == GL_CONVOLUTION_1D) { + height = 1; + } else { + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + } + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,height,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetConvolutionFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width; + ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + return Success; +} + +int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetHistogram( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetHistogramReply *)&__glXReply)->width = width; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + compsize = __glGetTexImage_size(target,1,format,type,2,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetMinmax( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + target = *(GLenum *)(pc + 0); + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + swapBytes = *(GLboolean *)(pc + 12); + + glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetColorTableReply *)&__glXReply)->width = width; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} diff --git a/xc/programs/Xserver/GL/glx/singlepixswap.c b/xc/programs/Xserver/GL/glx/singlepixswap.c index 39ca57ef4..64bcc60f1 100644 --- a/xc/programs/Xserver/GL/glx/singlepixswap.c +++ b/xc/programs/Xserver/GL/glx/singlepixswap.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.4 1999/07/18 08:34:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/singlepixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES @@ -26,6 +40,7 @@ #include "singlesize.h" #include "unpack.h" #include "g_disptab.h" +#include "g_disptab_EXT.h" int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) { @@ -66,7 +81,7 @@ int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glReadPixels( + glReadPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), @@ -99,7 +114,7 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; - GLint width=0, height=0; + GLint width=0, height=0, depth=1; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); @@ -121,17 +136,20 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); + if ( target == GL_TEXTURE_3D) { + glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); + } /* - * The two queries above might fail if we're in a state where queries - * are illegal, but then width and height would still be zero anyway. + * The three queries above might fail if we're in a state where queries + * are illegal, but then width, height, and depth would still be zero anyway. */ - compsize = __glGetTexImage_size(target,level,format,type,width,height); + compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); if (compsize < 0) compsize = 0; - + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); - glGetTexImage( + glGetTexImage( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), @@ -148,8 +166,10 @@ int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); + __GLX_SWAP_INT(&depth); ((xGLXGetTexImageReply *)&__glXReply)->width = width; ((xGLXGetTexImageReply *)&__glXReply)->height = height; + ((xGLXGetTexImageReply *)&__glXReply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } @@ -176,9 +196,9 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,128,1); - + __glXClearErrorOccured(); - glGetPolygonStipple( + glGetPolygonStipple( (GLubyte *) answer ); if (__glXErrorOccured()) { @@ -193,3 +213,302 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) } return Success; } + +int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize, compsize2; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + /* target must be SEPARABLE_2D, however I guess we can let the GL + barf on this one.... */ + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); + + if (compsize < 0) compsize = 0; + if (compsize2 < 0) compsize2 = 0; + compsize = __GLX_PAD(compsize); + compsize2 = __GLX_PAD(compsize2); + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); + __glXClearErrorOccured(); + glGetSeparableFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer, + answer + compsize, + NULL + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize + compsize2); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + __GLX_SWAP_INT(&height); + ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width; + ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height; + __GLX_SEND_VOID_ARRAY(compsize + compsize2); + } + + return Success; +} + +int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0, height=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); + if (target == GL_CONVOLUTION_2D) { + height = 1; + } else { + glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); + } + /* + * The two queries above might fail if we're in a state where queries + * are illegal, but then width and height would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,height,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetConvolutionFilter( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + __GLX_SWAP_INT(&height); + ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width; + ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetHistogram( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + ((xGLXGetHistogramReply *)&__glXReply)->width = width; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes, reset; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + reset = *(GLboolean *)(pc + 13); + + compsize = __glGetTexImage_size(target,1,format,type,2,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetMinmax( target, reset, format, type, answer); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} + +int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) +{ + GLint compsize; + GLenum format, type, target; + GLboolean swapBytes; + __GLXcontext *cx; + ClientPtr client = cl->client; + int error; + __GLX_DECLARE_SWAP_VARIABLES; + char *answer, answerBuffer[200]; + GLint width=0; + + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc+0); + __GLX_SWAP_INT(pc+4); + __GLX_SWAP_INT(pc+8); + + format = *(GLenum *)(pc + 4); + type = *(GLenum *)(pc + 8); + target = *(GLenum *)(pc + 0); + swapBytes = *(GLboolean *)(pc + 12); + + glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); + /* + * The one query above might fail if we're in a state where queries + * are illegal, but then width would still be zero anyway. + */ + compsize = __glGetTexImage_size(target,1,format,type,width,1,1); + if (compsize < 0) compsize = 0; + + glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + glGetColorTable( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4), + *(GLenum *)(pc + 8), + answer + ); + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SWAP_REPLY_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SWAP_INT(&width); + ((xGLXGetColorTableReply *)&__glXReply)->width = width; + __GLX_SEND_VOID_ARRAY(compsize); + } + + return Success; +} diff --git a/xc/programs/Xserver/GL/glx/singlesize.c b/xc/programs/Xserver/GL/glx/singlesize.c index 1cff4c3a7..b7ca83245 100644 --- a/xc/programs/Xserver/GL/glx/singlesize.c +++ b/xc/programs/Xserver/GL/glx/singlesize.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.2 1999/06/14 07:31:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #include <GL/gl.h> @@ -34,8 +48,8 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) { GLint elements, esize; GLint rowsize, padding; - - if (w < 0 || h < 0) { + + if (w < 0 || h < 0) { return -1; } switch (format) { @@ -55,9 +69,11 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) elements = 2; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; @@ -71,7 +87,7 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) */ switch (type) { case GL_BITMAP: - if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { + if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { rowsize = ((w * elements)+7)/8; padding = rowsize % 4; if (padding) { @@ -85,15 +101,36 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return -1; } @@ -151,11 +188,10 @@ GLint __glGetTexParameterfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_WRAP_S: - return 1; case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: return 1; case GL_TEXTURE_MIN_FILTER: - return 1; case GL_TEXTURE_MAG_FILTER: return 1; case GL_TEXTURE_BORDER_COLOR: @@ -163,7 +199,12 @@ GLint __glGetTexParameterfv_size(GLenum pname) case GL_TEXTURE_PRIORITY: return 1; case GL_TEXTURE_RESIDENT: - return 1; + return 1; + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + return 1; default: return -1; @@ -184,7 +225,7 @@ GLint __glGetLightfv_size(GLenum pname) return 4; case GL_SPECULAR: return 4; - case GL_POSITION: + case GL_POSITION: return 4; case GL_SPOT_DIRECTION: return 3; @@ -236,7 +277,7 @@ static GLint EvalComputeK(GLenum target) } return 0; } - + GLint __glGetMap_size(GLenum target, GLenum query) { GLint k, order=0, majorMinor[2]; @@ -342,7 +383,7 @@ GLint __glGetPixelMap_size(GLenum map) { GLint size; GLenum query; - + switch (map) { case GL_PIXEL_MAP_I_TO_I: query = GL_PIXEL_MAP_I_TO_I_SIZE; @@ -454,9 +495,13 @@ GLint __glGet_size(GLenum sq) case GL_POINT_SIZE: return 1; case GL_POINT_SIZE_RANGE: + /* case GL_SMOOTH_POINT_SIZE_RANGE: */ /* alias */ return 2; case GL_POINT_SIZE_GRANULARITY: + /* case GL_SMOOTH_POINT_SIZE_GRANULARITY: */ /* alias */ return 1; + case GL_ALIASED_POINT_SIZE_RANGE: + return 2; case GL_POINT_SMOOTH: return 1; case GL_LINE_SMOOTH: @@ -464,9 +509,13 @@ GLint __glGet_size(GLenum sq) case GL_LINE_WIDTH: return 1; case GL_LINE_WIDTH_RANGE: + /* case GL_SMOOTH_LINE_WIDTH_RANGE: */ /* alias */ return 2; case GL_LINE_WIDTH_GRANULARITY: + /* case GL_SMOOTH_LINE_WIDTH_GRANULARITY: */ /* alias */ return 1; + case GL_ALIASED_LINE_WIDTH_RANGE: + return 2; case GL_LINE_STIPPLE_PATTERN: return 1; case GL_LINE_STIPPLE_REPEAT: @@ -495,6 +544,8 @@ GLint __glGet_size(GLenum sq) return 1; case GL_LIGHT_MODEL_AMBIENT: return 4; + case GL_LIGHT_MODEL_COLOR_CONTROL: + return 1; case GL_COLOR_MATERIAL: return 1; case GL_COLOR_MATERIAL_FACE: @@ -637,10 +688,14 @@ GLint __glGet_size(GLenum sq) return 1; case GL_PACK_ROW_LENGTH: return 1; + case GL_PACK_IMAGE_HEIGHT: + return 1; case GL_PACK_SKIP_ROWS: return 1; case GL_PACK_SKIP_PIXELS: return 1; + case GL_PACK_SKIP_IMAGES: + return 1; case GL_PACK_ALIGNMENT: return 1; case GL_UNPACK_SWAP_BYTES: @@ -649,10 +704,14 @@ GLint __glGet_size(GLenum sq) return 1; case GL_UNPACK_ROW_LENGTH: return 1; + case GL_UNPACK_IMAGE_HEIGHT: + return 1; case GL_UNPACK_SKIP_ROWS: return 1; case GL_UNPACK_SKIP_PIXELS: return 1; + case GL_UNPACK_SKIP_IMAGES: + return 1; case GL_UNPACK_ALIGNMENT: return 1; case GL_MAP_COLOR: @@ -678,11 +737,11 @@ GLint __glGet_size(GLenum sq) case GL_ZOOM_X: case GL_ZOOM_Y: return 1; - case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE: - case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE: - case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE: - case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE: - case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE: + case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE: + case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE: + case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE: + case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE: + case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE: return 1; case GL_MAX_EVAL_ORDER: return 1; @@ -731,17 +790,18 @@ GLint __glGet_size(GLenum sq) return 2; case GL_TEXTURE_1D: case GL_TEXTURE_2D: + case GL_TEXTURE_3D: return 1; case GL_NAME_STACK_DEPTH: return 1; case GL_MAX_VIEWPORT_DIMS: - return 2; + return 2; case GL_DOUBLEBUFFER: - return 1; + return 1; case GL_AUX_BUFFERS: - return 1; + return 1; case GL_STEREO: - return 1; + return 1; case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: @@ -774,14 +834,56 @@ GLint __glGet_size(GLenum sq) return 1; case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: return 1; - case GL_BLEND_COLOR_EXT: + case GL_BLEND_COLOR: return 4; - case GL_BLEND_EQUATION_EXT: + case GL_BLEND_EQUATION: + return 1; + case GL_COLOR_MATRIX: + return 16; + case GL_COLOR_MATRIX_STACK_DEPTH: + return 1; + case GL_COLOR_TABLE: + case GL_POST_CONVOLUTION_COLOR_TABLE: + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + case GL_CONVOLUTION_1D: + case GL_CONVOLUTION_2D: + case GL_SEPARABLE_2D: + case GL_HISTOGRAM: + case GL_MINMAX: return 1; case GL_POLYGON_OFFSET_FACTOR: case GL_POLYGON_OFFSET_UNITS: return 1; + case GL_POST_CONVOLUTION_RED_SCALE: + case GL_POST_CONVOLUTION_GREEN_SCALE: + case GL_POST_CONVOLUTION_BLUE_SCALE: + case GL_POST_CONVOLUTION_ALPHA_SCALE: + case GL_POST_CONVOLUTION_RED_BIAS: + case GL_POST_CONVOLUTION_GREEN_BIAS: + case GL_POST_CONVOLUTION_BLUE_BIAS: + case GL_POST_CONVOLUTION_ALPHA_BIAS: + return 1; + case GL_POST_COLOR_MATRIX_RED_SCALE: + case GL_POST_COLOR_MATRIX_GREEN_SCALE: + case GL_POST_COLOR_MATRIX_BLUE_SCALE: + case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + case GL_POST_COLOR_MATRIX_RED_BIAS: + case GL_POST_COLOR_MATRIX_GREEN_BIAS: + case GL_POST_COLOR_MATRIX_BLUE_BIAS: + case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + return 1; + case GL_RESCALE_NORMAL: + return 1; + case GL_ACTIVE_TEXTURE_ARB: + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + case GL_MAX_TEXTURE_UNITS_ARB: + return 1; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH: + case GL_MAX_CONVOLUTION_WIDTH: + case GL_MAX_CONVOLUTION_HEIGHT: + return 1; default: return -1; } @@ -812,6 +914,7 @@ GLint __glGetTexLevelParameterfv_size(GLenum pname) switch (pname) { case GL_TEXTURE_WIDTH: case GL_TEXTURE_HEIGHT: + case GL_TEXTURE_DEPTH: case GL_TEXTURE_COMPONENTS: case GL_TEXTURE_BORDER: case GL_TEXTURE_RED_SIZE: @@ -832,17 +935,19 @@ GLint __glGetTexLevelParameteriv_size(GLenum pname) } GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, - GLenum type, GLint width, GLint height) + GLenum type, GLint width, GLint height, GLint depth) { GLint elements, esize; GLint padding, rowsize; switch (format) { case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RED: @@ -863,15 +968,36 @@ GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, case GL_UNSIGNED_BYTE: esize = 1; break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; case GL_SHORT: case GL_UNSIGNED_SHORT: esize = 2; break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: esize = 4; break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; default: return -1; } @@ -885,5 +1011,95 @@ GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, if (padding) { rowsize += 4 - padding; } - return (rowsize * height); + return (rowsize * height * depth); } + +GLint __glGetConvolutionParameteriv_size(GLenum pname) +{ + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + case GL_CONVOLUTION_BORDER_MODE: + case GL_CONVOLUTION_FORMAT: + case GL_CONVOLUTION_WIDTH: + case GL_CONVOLUTION_HEIGHT: + case GL_MAX_CONVOLUTION_WIDTH: + case GL_MAX_CONVOLUTION_HEIGHT: + return 1; + default: + return -1; + } +} + +GLint __glGetConvolutionParameterfv_size(GLenum pname) +{ + return __glGetConvolutionParameteriv_size(pname); +} + + +GLint __glGetHistogramParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_HISTOGRAM_WIDTH: + case GL_HISTOGRAM_FORMAT: + case GL_HISTOGRAM_RED_SIZE: + case GL_HISTOGRAM_GREEN_SIZE: + case GL_HISTOGRAM_BLUE_SIZE: + case GL_HISTOGRAM_ALPHA_SIZE: + case GL_HISTOGRAM_LUMINANCE_SIZE: + case GL_HISTOGRAM_SINK: + return 1; + default: + return -1; + } +} + +GLint __glGetHistogramParameteriv_size(GLenum pname) +{ + return __glGetHistogramParameterfv_size(pname); +} + +GLint __glGetMinmaxParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_MINMAX_FORMAT: + case GL_MINMAX_SINK: + return 1; + default: + return -1; + } +} + +GLint __glGetMinmaxParameteriv_size(GLenum pname) +{ + return __glGetMinmaxParameterfv_size(pname); +} + +GLint __glGetColorTableParameterfv_size(GLenum pname) +{ + switch(pname) { + + case GL_COLOR_TABLE_SCALE: /* return RGBA */ + case GL_COLOR_TABLE_BIAS: + return 4; + case GL_COLOR_TABLE_FORMAT: + case GL_COLOR_TABLE_WIDTH: + case GL_COLOR_TABLE_RED_SIZE: + case GL_COLOR_TABLE_GREEN_SIZE: + case GL_COLOR_TABLE_BLUE_SIZE: + case GL_COLOR_TABLE_ALPHA_SIZE: + case GL_COLOR_TABLE_LUMINANCE_SIZE: + case GL_COLOR_TABLE_INTENSITY_SIZE: + return 1; + default: + return 0; + } +} + +GLint __glGetColorTableParameteriv_size(GLenum pname) +{ + return __glGetColorTableParameterfv_size(pname); +} + diff --git a/xc/programs/Xserver/GL/glx/singlesize.h b/xc/programs/Xserver/GL/glx/singlesize.h index 97381639a..829338094 100644 --- a/xc/programs/Xserver/GL/glx/singlesize.h +++ b/xc/programs/Xserver/GL/glx/singlesize.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ #ifndef _singlesize_h_ #define _singlesize_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.h,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ extern GLint __glReadPixels_size(GLenum format, GLenum type, @@ -52,7 +66,16 @@ extern GLint __glGetBooleanv_size(GLenum sq); extern GLint __glGetTexLevelParameterfv_size(GLenum pname); extern GLint __glGetTexLevelParameteriv_size(GLenum pname); extern GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, - GLenum type, GLint width, GLint height); + GLenum type, GLint width, GLint height, + GLint depth); +extern GLint __glGetColorTableParameterfv_size(GLenum pname); +extern GLint __glGetColorTableParameteriv_size(GLenum pname); +extern GLint __glGetConvolutionParameterfv_size(GLenum pname); +extern GLint __glGetConvolutionParameteriv_size(GLenum pname); +extern GLint __glGetHistogramParameterfv_size(GLenum pname); +extern GLint __glGetHistogramParameteriv_size(GLenum pname); +extern GLint __glGetMinmaxParameterfv_size(GLenum pname); +extern GLint __glGetMinmaxParameteriv_size(GLenum pname); #endif /* _singlesize_h_ */ diff --git a/xc/programs/Xserver/GL/glx/unpack.h b/xc/programs/Xserver/GL/glx/unpack.h index 80a805aab..a076d344a 100644 --- a/xc/programs/Xserver/GL/glx/unpack.h +++ b/xc/programs/Xserver/GL/glx/unpack.h @@ -1,26 +1,40 @@ +/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ #ifndef __GLX_unpack_h__ #define __GLX_unpack_h__ -/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define __GLX_PAD(s) (((s)+3) & (GLuint)~3) @@ -41,7 +55,7 @@ #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) #endif -extern void __glXMemInit(); +extern void __glXMemInit(void); extern xGLXSingleReply __glXReply; @@ -134,6 +148,7 @@ extern xGLXSingleReply __glXReply; GLbyte *swapPC; \ GLbyte *swapEnd + #define __GLX_SWAP_INT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ diff --git a/xc/programs/Xserver/GL/glx/xfont.c b/xc/programs/Xserver/GL/glx/xfont.c index 8bf6e8116..3ea767d2b 100644 --- a/xc/programs/Xserver/GL/glx/xfont.c +++ b/xc/programs/Xserver/GL/glx/xfont.c @@ -1,23 +1,37 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/xfont.c,v 1.2 1999/06/14 07:31:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/xfont.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. -** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. -** -** $SGI$ */ #define NEED_REPLIES diff --git a/xc/programs/Xserver/GL/include/GL/glx_ansic.h b/xc/programs/Xserver/GL/include/GL/glx_ansic.h index e6ccd3a2f..73820cd60 100644 --- a/xc/programs/Xserver/GL/include/GL/glx_ansic.h +++ b/xc/programs/Xserver/GL/include/GL/glx_ansic.h @@ -1,26 +1,39 @@ #ifndef _glx_ansic_h_ #define _glx_ansic_h_ -/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.3 1999/07/11 08:49:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.5 2001/03/21 20:49:08 dawes Exp $ */ /* -** The contents of this file are subject to the GLX Public License Version 1.0 -** (the "License"). You may not use this file except in compliance with the -** License. You may obtain a copy of the License at Silicon Graphics, Inc., -** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -** or at http://www.sgi.com/software/opensource/glx/license.html. +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** -** Software distributed under the License is distributed on an "AS IS" -** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY -** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR -** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific -** language governing rights and limitations under the License. +** http://oss.sgi.com/projects/FreeB ** -** The Original Software is GLX version 1.2 source code, released February, -** 1999. The developer of the Original Software is Silicon Graphics, Inc. -** Those portions of the Subject Software created by Silicon Graphics, Inc. -** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** -** $SGI$ +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. */ /* @@ -38,92 +51,25 @@ */ #ifdef XFree86Server -#include <xf86Version.h> -#define XF_Minimum_Version ( (3 * 10) + (9) ) -#define XF_Version ( (XF86_VERSION_MAJOR * 10) + (XF86_VERSION_MINOR) ) -#endif - -#if defined(XFree86LOADER) && defined(XFree86Server) && ( XF_Version >= XF_Minimum_Version) -#include "xf86_ansic.h" -#else -#endif -#if 0 && defined(XFree86LOADER) && defined(XFree86Server) && ( XF_Version >= XF_Minimum_Version) - -#include "xf86Module.h" - -/* -** I'm not sure if this is entirely correct. xf86_ansic needs to be told -** whether to include these definitions or not. Near as I can tell, a -** necessary define is included when XFree86 is built (as part of the build). -** When we build the glx server, this define isn't present. I don't recall -** having to do this before, but this seems to work. Perhaps I just need to -** include the proper header file, but I can't find it. Anyways, if need be -** this can be fixed later, but works for now... -** I'm specifically refering to NEED_XF86_TYPES being declared here. -*/ - -#define NEED_XF86_TYPES #include "xf86_ansic.h" - -#define GLX_STDOUT xf86stdout -#define GLX_STDERR xf86stderr -#define __glXPrintf xf86printf -#define __glXFprintf xf86fprintf -#define __glXSprintf xf86sprintf -#define __glXVfprintf xf86vfprintf -#define __glXVsprintf xf86vsprintf -#define __glXFopen xf86fopen -#define __glXFclose xf86fclose -#define __glXCos(x) xf86cos(x) -#define __glXSin(x) xf86sin(x) -#define __glXAtan(x) xf86atan(x) -#define __glXAbs(x) xf86abs(x) -#define __glXLog(x) xf86log(x) -#define __glXCeil(x) xf86ceil(x) -#define __glXFloor(x) xf86floor(x) -#define __glXSqrt(x) xf86sqrt(x) -#define __glXPow(x, y) xf86pow(x, y) -#define __glXMemmove(dest, src, n) xf86memmove(dest, src, n) -#define __glXMemcpy(dest, src, n) xf86memcpy(dest, src, n) -#define __glXMemset(s, c, n) xf86memset(s, c, n) -#define __glXStrdup(str) xf86strdup(str) -#define __glXStrcpy(dest, src) xf86strcpy(dest, src) -#define __glXStrncpy(dest, src, n) xf86strncpy(dest, src, n) -#define __glXStrcat(dest, src) xf86strcat(dest, src) -#define __glXStrncat(dest, src, n) xf86strncat(dest, src, n) -#define __glXStrcmp(s1, s2) xf86strcmp(s1, s2) -#define __glXStrncmp(s1, s2, n) xf86strncmp(s1, s2, n) -#define __glXStrlen(str) xf86strlen(str) -#define __glXAbort() xf86abort() -#define __glXStrtok(s, delim) xf86strtok(s, delim) -#define __glXStrcspn(s, reject) xf86strcspn(s, reject) -#define __glXGetenv(a) xf86getenv(a) - #ifndef assert #define assert(a) #endif #else -/* -** Either not a loadable module, or pre X3.9 -*/ - -/* assert() is named __assert() in the LynxOS libc. We might get - * unresolved externals if we #undef assert and include assert.h - * if assert.h was already included on our way here.... - */ #if defined(Lynx) && defined(__assert_h) #undef __assert_h #endif - #ifdef assert #undef assert #endif - #include <assert.h> +#endif + + #define GLX_STDOUT stdout #define GLX_STDERR stderr #define __glXPrintf printf @@ -157,8 +103,7 @@ #define __glXStrtok(s, delim) strtok(s, delim) #define __glXStrcspn(s, reject) strcspn(s, reject) #define __glXGetenv(a) getenv(a) - -#endif +#define __glXAtoi(a) atoi(a) #endif /* _glx_ansic_h_ */ diff --git a/xc/programs/Xserver/GL/mesa/src/Imakefile b/xc/programs/Xserver/GL/mesa/src/Imakefile index c2ead442c..eb00416b5 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.16 2000/09/24 13:51:22 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.17 2001/03/21 16:41:30 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -147,6 +147,8 @@ LinkSourceFile(state.c,$(MESASRCDIR)/src) LinkSourceFile(state.h,$(MESASRCDIR)/src) LinkSourceFile(stencil.c,$(MESASRCDIR)/src) LinkSourceFile(stencil.h,$(MESASRCDIR)/src) +LinkSourceFile(texformat.c, $(MESASRCDIR)/src) +LinkSourceFile(texformat.h, $(MESASRCDIR)/src) LinkSourceFile(texgen_tmp.h,$(MESASRCDIR)/src) LinkSourceFile(teximage.c,$(MESASRCDIR)/src) LinkSourceFile(teximage.h,$(MESASRCDIR)/src) @@ -245,6 +247,7 @@ LinkSourceFile(zoom.h,$(MESASRCDIR)/src) stages.c \ state.c \ stencil.c \ + texformat.c \ teximage.c \ texobj.c \ texstate.c \ @@ -321,6 +324,7 @@ LinkSourceFile(zoom.h,$(MESASRCDIR)/src) stages.o \ state.o \ stencil.o \ + texformat.o \ teximage.o \ texobj.o \ texstate.o \ @@ -384,4 +388,3 @@ InstallDriverSDKLibraryModule(GLcore,$(DRIVERSDKMODULEDIR),extensions) DependSubdirs($(SUBDIRS)) MakeLintLibSubdirs($(SUBDIRS)) LintSubdirs($(SUBDIRS)) - diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile index 2344ff5af..9f42af34c 100644 --- a/xc/programs/Xserver/Imakefile +++ b/xc/programs/Xserver/Imakefile @@ -2,7 +2,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:47:01 cpqbld Exp $ /* * Server Master Makefile */ -XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.211 2001/02/16 13:24:05 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.217 2001/04/05 20:13:42 dawes Exp $ #ifndef InstallXserverSetUID #define InstallXserverSetUID NO @@ -819,6 +819,37 @@ $(TRIDENTOBJS) $(TRIDENTLIBS) $(TRIDENTSYSLIBS):: $(TRIDENTDIRS) ServerTarget(Xtrident,$(TRIDENTDIRS),$(TRIDENTOBJS),$(TRIDENTLIBS),$(TRIDENTSYSLIBS)) #endif /* XTRIDENTServer */ +#if Xi810Server +XCOMM +XCOMM server with Intel i810 driver +XCOMM + + FBDEVDIR = $(KDRIVE)/fbdev + FBDEV = $(FBDEVDIR)/LibraryTargetName(fbdev) + VESADIR = $(KDRIVE)/vesa + VESA = $(VESADIR)/LibraryTargetName(vesa) + SHADOWDIR = miext/shadow + I810DIR = $(KDRIVE)/i810 + I810 = $(I810DIR)/LibraryTargetName(i810) + + KDDIRS = StdKdDirs + + I810DIRS = $(STDDIRS) $(KDDIRS) $(SHADOWDIR) $(I810DIR) + + I810LIBS = PreFbLibs $(I810) KdLibs FbPostFbLibs + I810SYSLIBS = StdKdSysLibs + +#if HasParallelMake +MakeMutex($(I810DIRS) $(I810LIBS) $(I810SYSLIBS)) +#endif +#if ForceServerRemake +$(I810OBJS) $(I810LIBS) $(I810SYSLIBS):: $(I810DIRS) + @if [ -f $@ ]; then touch $@; fi +#endif +ServerTarget(Xi810,$(I810DIRS),$(I810OBJS),$(I810LIBS),$(I810SYSLIBS)) +#endif /* Xi810Server */ + + #if XSis530Server XCOMM XCOMM server with Keith's SiS 530 driver @@ -951,7 +982,7 @@ $(VESAOBJS) $(XVESA) $(VESALIBS) $(VESASYSLIBS):: $(VESADIRS) ServerTarget(Xvesa,$(VESADIRS),$(VESAOBJS),$(VESALIBS),$(VESASYSLIBS)) #endif /* XvesaServer */ -KDRIVEDIRS=$(KDDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(SIS530DIR) \ +KDRIVEDIRS=$(KDDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(I810DIR) $(SIS530DIR) \ $(TRIODIR) $(TS300DIR) $(ITSYDIR) $(IGSDIR) $(VESADIR) #endif /* KDriveXServer */ @@ -1080,38 +1111,45 @@ ServerTarget(Xvfb,$(XVFBDIRS),$(XVFBOBJS), \ XCOMM XCOMM server with DirectX framebuffer for Windows XCOMM -MFBDIR = mfb -CFB8DIR = cfb -CFB16DIR = cfb16 -CFB24DIR = cfb24 -CFB32DIR = cfb32 XWINDDXDIR = hw/xwin -DDXDIR2 = $(XWINDDXDIR) -XWINDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(XWINDDXDIR) $(DEPDIRS) +XWIN = $(XWINDDXDIR)/LibraryTargetName(XWin) +XWINGDI32 = /lib/libgdi32.a +XWINDDRAW = /lib/libddraw.a +/* XWINOLE32 = /lib/libole32.a */ +DDXDIR1 = $(XWINDDXDIR) +XWINDIRS = $(STDDIRS) $(FB) $(SHADOW) $(XWINDDXDIR) $(DEPDIRS) + +XWINOBJSA = $(XWINDDXDIR)/stubs.o dix/main.o + #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 -#else -XWINOBJS = hw/xwin/InitInput.o hw/xwin/InitOutput.o hw/xwin/stubs.o hw/xwin/directx.o dix/main.o +XWINOBJSB = $(XWINDDXDIR)/dpmsstubs.o #endif -XWIN = hw/xwin/LibraryTargetName(XWin) -XWINLIBS = PreFbLibs $(XWIN) $(CFB) PostFbLibs $(MI) $(SURFLIB) -XWINSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS) + +XWINOBJS = $(XWINOBJSA) $(XWINOBJSB) + +XWINLIBS = PreFbLibs $(XWIN) FbPostFbLibs $(SHADOW) + +XWINSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS) \ + $(XWINGDI32) $(XWINDDRAW) + #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)) + $(XWINLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XWINSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XWin #endif #endif /* XWinServer */ -#if XDarwinServer +#if XDarwinServer XCOMM XCOMM X Darwin server for Mac OS X / Darwin XCOMM @@ -1120,22 +1158,46 @@ CFB8DIR = cfb CFB16DIR = cfb16 CFB32DIR = cfb32 DDXDIR1 = hw/darwin +DDXDIR2 = hw/darwin/bundle DARWINDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) -DARWINOBJS = -DARWINLIBS = PreFbLibs hw/darwin/libdarwin.a $(CFB16) $(CFB32) $(CFB8) PostFbLibs ../../lib/font/libXfont.a ../../lib/font/stubs/libfntstubs.a +DARWINOBJS = $(DDXDIR1)/xfIOKitStartup.o +DARWINLIBS = PreFbLibs $(DDXDIR1)/LibraryTargetName(darwin) $(CFB16) $(CFB32) $(CFB8) PostFbLibs +DARWINSYSLIBS = $(FONTLIBS) $(SYSLIBS) -framework IOKit + +/* + * IOKit X server + */ +SetUIDServerTarget(XDarwin,$(DARWINDIRS),$(DARWINOBJS), \ + $(DARWINLIBS),$(DARWINSYSLIBS)) -XCOMM We need extra link flags for IOKit. For Quartz support, we also need -XCOMM CoreGraphics in ApplicationServices and HIToolbox in Carbon. #if DarwinQuartzSupport -EXTRA_LOAD_FLAGS = -framework IOKit -framework ApplicationServices \ - -framework Carbon -#else -EXTRA_LOAD_FLAGS = -framework IOKit -#endif /* DarwinQuartzSupport */ -SetUIDServerTarget(Xdarwin,$(DARWINDIRS),$(DARWINOBJS),$(DARWINLIBS),$(SYSLIBS)) +/* + * We need the IOKit framework. For Quartz support, we also need + * CoreGraphics in ApplicationServices, HIToolbox in Carbon, CoreAudio + * and Cocoa. + */ +QUARTZSYSLIBS = -framework ApplicationServices -framework Cocoa \ + -framework CoreAudio -framework Carbon -ObjC +QUARTZOBJS = $(DDXDIR2)/quartzStartup.o +XDARWINAPPDIR = $(DESTDIR)$(BINDIR)/XDarwin.app/Contents/MacOS + +/* + * Quartz X server (installed in its application bundle) + */ +SetUIDServerTarget(XDarwinApp,$(DARWINDIRS),$(QUARTZOBJS), \ + $(DARWINLIBS) $(DDXDIR2)/LibraryTargetName(XQuartz), \ + $(DARWINSYSLIBS) $(QUARTZSYSLIBS)) + +install:: + mkdir -p $(XDARWINAPPDIR) + mv $(DESTDIR)$(BINDIR)/XDarwinApp $(XDARWINAPPDIR)/XDarwin + +#else /* !DarwinQuartzSupport */ + +#define ServerToInstall XDarwin -#define ServerToInstall Xdarwin +#endif /* DarwinQuartzSupport */ #endif /* XDarwinServer */ diff --git a/xc/programs/Xserver/Xext/Imakefile b/xc/programs/Xserver/Xext/Imakefile index c3cdfb20b..36d10aaa5 100644 --- a/xc/programs/Xserver/Xext/Imakefile +++ b/xc/programs/Xserver/Xext/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.38 2001/01/17 22:13:14 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.40 2001/03/05 04:51:55 mvojkovi Exp $ #include <Server.tmpl> @@ -36,7 +36,7 @@ SUBDIRS = extmod SCRNSAVOBJ = saver.o #endif -#if BuildXF86VidModeExt +#if BuildXF86VidModeExt && XF86Server VIDMODESRCS = xf86vmode.c VIDMODEOBJS = xf86vmode.o #endif @@ -60,8 +60,8 @@ XF86BIGFOBJS = xf86bigfont.o #endif #if BuildXvExt - XVSRCS = xvmain.c xvdisp.c - XVOBJS = xvmain.o xvdisp.o + XVSRCS = xvmain.c xvdisp.c xvmc.c + XVOBJS = xvmain.o xvdisp.o xvmc.o #endif #if BuildAppgroup diff --git a/xc/programs/Xserver/Xext/extmod/Imakefile b/xc/programs/Xserver/Xext/extmod/Imakefile index 4b2ee71d3..23750df14 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.20 2000/08/15 16:05:33 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/Xext/extmod/Imakefile,v 1.21 2001/03/05 04:51:56 mvojkovi Exp $ XCOMM This directory is only entered if DoLoadableServer is set #define IHaveModules @@ -51,11 +51,12 @@ LinkSourceFile(fontcache.c,..) #endif #if BuildXvExt - XVSRCS = xvmain.c xvdisp.c xvmod.c - XVOBJS = xvmain.o xvdisp.o xvmod.o + XVSRCS = xvmain.c xvdisp.c xvmod.c xvmc.c + XVOBJS = xvmain.o xvdisp.o xvmod.o xvmc.o LinkSourceFile(xvmain.c,..) LinkSourceFile(xvdisp.c,..) LinkSourceFile(xvmod.c,..) +LinkSourceFile(xvmc.c,..) #endif #if BuildEVI diff --git a/xc/programs/Xserver/Xext/extmod/modinit.c b/xc/programs/Xserver/Xext/extmod/modinit.c index 6d999b3b1..81e664271 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.14 2000/08/09 03:06:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/extmod/modinit.c,v 1.15 2001/03/05 04:51:56 mvojkovi Exp $ */ /* * @@ -128,8 +128,10 @@ extern void EVIExtensionInit(INITARGS); #ifdef XV extern void XvExtensionInit(INITARGS); +extern void XvMCExtensionInit(INITARGS); extern void XvRegister(INITARGS); #include "Xv.h" +#include "XvMC.h" #endif /* @@ -278,6 +280,13 @@ ExtensionModule extensionModules[] = { XvRegister, NULL }, + { + XvMCExtensionInit, + XvMCName, + NULL, + NULL, + NULL + }, #endif { /* DON'T delete this entry ! */ NULL, diff --git a/xc/programs/Xserver/Xext/xf86bigfont.c b/xc/programs/Xserver/Xext/xf86bigfont.c index 3fea6e3f8..779f510c1 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.10 2000/08/10 17:40:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86bigfont.c,v 1.11 2001/04/06 02:16:22 dawes Exp $ */ /* * BIGFONT extension for sharing font metrics between clients (if possible) * and for transmitting font metrics to clients in a compressed form. @@ -37,7 +37,8 @@ #include <sys/types.h> #ifdef HAS_SHM -#if defined(linux) && !defined(__GNU_LIBRARY__) +#if defined(linux) && (!defined(__GNU_LIBRARY__) || __GNU_LIBRARY__ < 2) +/* libc4 does not define __GNU_LIBRARY__, libc5 defines __GNU_LIBRARY__ as 1 */ /* Linux libc4 and libc5 only (because glibc doesn't include kernel headers): Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define PAGE_SIZE. It is defined in <asm/page.h>. */ diff --git a/xc/programs/Xserver/Xext/xvdisp.c b/xc/programs/Xserver/Xext/xvdisp.c index 2d58d8b50..bcc0e65ec 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.16 2000/08/10 17:40:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.19 2001/03/07 19:37:51 mvojkovi Exp $ */ /* ** File: @@ -74,11 +74,14 @@ SOFTWARE. #include "panoramiX.h" #include "panoramiXsrv.h" -XvAdaptorPtr XineramaAdaptors[MAXSCREENS]; +unsigned long XvXRTPort; + #ifdef MITSHM static int XineramaXvShmPutImage(ClientPtr); #endif static int XineramaXvPutImage(ClientPtr); +static int XineramaXvPutVideo(ClientPtr); +static int XineramaXvPutStill(ClientPtr); static int XineramaXvSetPortAttribute(ClientPtr); static int XineramaXvStopVideo(ClientPtr); #endif @@ -226,8 +229,20 @@ ProcXvDispatch(ClientPtr client) case xv_QueryExtension: return(ProcXvQueryExtension(client)); case xv_QueryAdaptors: return(ProcXvQueryAdaptors(client)); case xv_QueryEncodings: return(ProcXvQueryEncodings(client)); - case xv_PutVideo: return(ProcXvPutVideo(client)); - case xv_PutStill: return(ProcXvPutStill(client)); + case xv_PutVideo: +#ifdef PANORAMIX + if(!noPanoramiXExtension) + return(XineramaXvPutVideo(client)); + else +#endif + return(ProcXvPutVideo(client)); + case xv_PutStill: +#ifdef PANORAMIX + if(!noPanoramiXExtension) + return(XineramaXvPutStill(client)); + else +#endif + return(ProcXvPutStill(client)); case xv_GetVideo: return(ProcXvGetVideo(client)); case xv_GetStill: return(ProcXvGetStill(client)); case xv_GrabPort: return(ProcXvGrabPort(client)); @@ -1068,6 +1083,9 @@ ProcXvPutImage(ClientPtr client) pPort, pImage, &width, &height, NULL, NULL); size += sizeof(xvPutImageReq); size = (size + 3) >> 2; + + if((width < stuff->width) || (height < stuff->height)) + return BadValue; if(client->req_len < size) return BadLength; @@ -1160,6 +1178,9 @@ ProcXvShmPutImage(ClientPtr client) if((size_needed + stuff->offset) > shmdesc->size) return BadAccess; + if((width < stuff->width) || (height < stuff->height)) + return BadValue; + status = XVCALL(diPutImage)(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y, stuff->src_w, stuff->src_h, @@ -1834,45 +1855,51 @@ SWriteListImageFormatsReply( #ifdef PANORAMIX + + static int XineramaXvStopVideo(ClientPtr client) { - int result, i, portoffset; - PanoramiXRes *draw; - XvPortPtr pPort; - REQUEST(xvStopVideoReq); - REQUEST_SIZE_MATCH(xvStopVideoReq); + int result = Success, i; + PanoramiXRes *draw, *port; + REQUEST(xvStopVideoReq); + REQUEST_SIZE_MATCH(xvStopVideoReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( + if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) return BadDrawable; - portoffset = stuff->port - XineramaAdaptors[0]->base_id; + if(!(port = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->port, XvXRTPort, SecurityReadAccess))) + return _XvBadPort; - FOR_NSCREENS_BACKWARD(i) { - if(XineramaAdaptors[i]) { - stuff->drawable = draw->info[i].id; - stuff->port = XineramaAdaptors[i]->base_id + portoffset; - result = ProcXvStopVideo(client); - } - } + FOR_NSCREENS_BACKWARD(i) { + if(port->info[i].id) { + stuff->drawable = draw->info[i].id; + stuff->port = port->info[i].id; + result = ProcXvStopVideo(client); + } + } - return result; + return result; } static int XineramaXvSetPortAttribute(ClientPtr client) { REQUEST(xvSetPortAttributeReq); - int result, i, portoffset; + PanoramiXRes *port; + int result = Success, i; REQUEST_SIZE_MATCH(xvSetPortAttributeReq); - portoffset = stuff->port - XineramaAdaptors[0]->base_id; + if(!(port = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->port, XvXRTPort, SecurityReadAccess))) + return _XvBadPort; FOR_NSCREENS_BACKWARD(i) { - if(XineramaAdaptors[i]) { - stuff->port = XineramaAdaptors[i]->base_id + portoffset; + if(port->info[i].id) { + stuff->port = port->info[i].id; result = ProcXvSetPortAttribute(client); } } @@ -1885,10 +1912,10 @@ static int XineramaXvShmPutImage(ClientPtr client) { REQUEST(xvShmPutImageReq); - PanoramiXRes *draw, *gc; + PanoramiXRes *draw, *gc, *port; Bool send_event = stuff->send_event; Bool isRoot; - int result, i, x, y, portoffset; + int result = Success, i, x, y; REQUEST_SIZE_MATCH(xvShmPutImageReq); @@ -1899,6 +1926,10 @@ XineramaXvShmPutImage(ClientPtr client) if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, SecurityReadAccess))) return BadGC; + + if(!(port = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->port, XvXRTPort, SecurityReadAccess))) + return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && (stuff->drawable == WindowTable[0]->drawable.id); @@ -1906,12 +1937,10 @@ XineramaXvShmPutImage(ClientPtr client) x = stuff->drw_x; y = stuff->drw_y; - portoffset = stuff->port - XineramaAdaptors[0]->base_id; - FOR_NSCREENS_BACKWARD(i) { - if(XineramaAdaptors[i]) { + if(port->info[i].id) { stuff->drawable = draw->info[i].id; - stuff->port = XineramaAdaptors[i]->base_id + portoffset; + stuff->port = port->info[i].id; stuff->gc = gc->info[i].id; stuff->drw_x = x; stuff->drw_y = y; @@ -1922,7 +1951,6 @@ XineramaXvShmPutImage(ClientPtr client) stuff->send_event = (send_event && !i) ? 1 : 0; result = ProcXvShmPutImage(client); - if(result != Success) break; } } return result; @@ -1933,9 +1961,9 @@ static int XineramaXvPutImage(ClientPtr client) { REQUEST(xvPutImageReq); - PanoramiXRes *draw, *gc; + PanoramiXRes *draw, *gc, *port; Bool isRoot; - int result, i, x, y, portoffset; + int result = Success, i, x, y; REQUEST_AT_LEAST_SIZE(xvPutImageReq); @@ -1946,6 +1974,10 @@ XineramaXvPutImage(ClientPtr client) if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, SecurityReadAccess))) return BadGC; + + if(!(port = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->port, XvXRTPort, SecurityReadAccess))) + return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && (stuff->drawable == WindowTable[0]->drawable.id); @@ -1953,12 +1985,10 @@ XineramaXvPutImage(ClientPtr client) x = stuff->drw_x; y = stuff->drw_y; - portoffset = stuff->port - XineramaAdaptors[0]->base_id; - FOR_NSCREENS_BACKWARD(i) { - if(XineramaAdaptors[i]) { + if(port->info[i].id) { stuff->drawable = draw->info[i].id; - stuff->port = XineramaAdaptors[i]->base_id + portoffset; + stuff->port = port->info[i].id; stuff->gc = gc->info[i].id; stuff->drw_x = x; stuff->drw_y = y; @@ -1968,91 +1998,207 @@ XineramaXvPutImage(ClientPtr client) } result = ProcXvPutImage(client); - if(result != Success) break; } } return result; } - -void XineramifyXv(void) +static int +XineramaXvPutVideo(ClientPtr client) { - ScreenPtr pScreen; - XvScreenPtr pxvs; - XvAdaptorPtr pAdapt, refAdapt; - XvImagePtr refImage; - int imageHeads = 0; - Bool match, blast; - int max_w = 0, max_h = 0; - int i, j, k, n; - - /* find which heads can do images */ - for(i = 0; i < PanoramiXNumScreens; i++) { - pScreen = screenInfo.screens[i]; - XineramaAdaptors[i] = NULL; - pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; - if(pxvs) { - for(j = 0; j < pxvs->nAdaptors; j++) { - pAdapt = pxvs->pAdaptors + j; - if((pAdapt->type & XvImageMask) && (pAdapt->nImages > 0)) { - imageHeads++; - XineramaAdaptors[i] = pAdapt; - break; /* assuming only one XvImage capable adaptor per head */ + REQUEST(xvPutImageReq); + PanoramiXRes *draw, *gc, *port; + Bool isRoot; + int result = Success, i, x, y; + + REQUEST_AT_LEAST_SIZE(xvPutVideoReq); + + if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( + client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + return BadDrawable; + + if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->gc, XRT_GC, SecurityReadAccess))) + return BadGC; + + if(!(port = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->port, XvXRTPort, SecurityReadAccess))) + return _XvBadPort; + + isRoot = (draw->type == XRT_WINDOW) && + (stuff->drawable == WindowTable[0]->drawable.id); + + x = stuff->drw_x; + y = stuff->drw_y; + + FOR_NSCREENS_BACKWARD(i) { + if(port->info[i].id) { + stuff->drawable = draw->info[i].id; + stuff->port = port->info[i].id; + stuff->gc = gc->info[i].id; + stuff->drw_x = x; + stuff->drw_y = y; + if(isRoot) { + stuff->drw_x -= panoramiXdataPtr[i].x; + stuff->drw_y -= panoramiXdataPtr[i].y; } + + result = ProcXvPutVideo(client); } - } - } + } + return result; +} - if(!imageHeads || !XineramaAdaptors[0]) return; +static int +XineramaXvPutStill(ClientPtr client) +{ + REQUEST(xvPutImageReq); + PanoramiXRes *draw, *gc, *port; + Bool isRoot; + int result = Success, i, x, y; - /* filter out image types not common on all */ - refAdapt = XineramaAdaptors[0]; + REQUEST_AT_LEAST_SIZE(xvPutImageReq); - for(i = 0; i < refAdapt->nEncodings; i++) { - if(!strcmp(refAdapt->pEncodings[i].name, "XV_IMAGE")) { - max_w = refAdapt->pEncodings[i].width; - max_h = refAdapt->pEncodings[i].height; - break; - } - } + if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( + client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + return BadDrawable; + + if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->gc, XRT_GC, SecurityReadAccess))) + return BadGC; + + if(!(port = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->port, XvXRTPort, SecurityReadAccess))) + return _XvBadPort; + + isRoot = (draw->type == XRT_WINDOW) && + (stuff->drawable == WindowTable[0]->drawable.id); + + x = stuff->drw_x; + y = stuff->drw_y; - for(i = 0; i < refAdapt->nImages; i++) { - refImage = refAdapt->pImages + i; - - blast = FALSE; - for(j = 0; j < PanoramiXNumScreens; j++) { - match = FALSE; - if((pAdapt = XineramaAdaptors[j])) { - for(k = 0; k < pAdapt->nImages; k++) { - if(pAdapt->pImages[k].id == refImage->id) { - match = TRUE; - for(n = 0; n < pAdapt->nEncodings; n++) { - if(!strcmp(pAdapt->pEncodings[n].name, "XV_IMAGE")) { - if(max_w > pAdapt->pEncodings[n].width) - max_w = pAdapt->pEncodings[n].width; - if(max_h > pAdapt->pEncodings[n].height) - max_h = pAdapt->pEncodings[n].height; - break; - } - } - break; - } + FOR_NSCREENS_BACKWARD(i) { + if(port->info[i].id) { + stuff->drawable = draw->info[i].id; + stuff->port = port->info[i].id; + stuff->gc = gc->info[i].id; + stuff->drw_x = x; + stuff->drw_y = y; + if(isRoot) { + stuff->drw_x -= panoramiXdataPtr[i].x; + stuff->drw_y -= panoramiXdataPtr[i].y; } - } - if(!match) { - blast = TRUE; - break; + + result = ProcXvPutStill(client); } - } - if(blast) { - if(i < (refAdapt->nImages - 1)) - memcpy(refAdapt->pImages + i, refAdapt->pImages + i + 1, - (refAdapt->nImages - 1 - i) * sizeof(XvImageRec)); - refAdapt->nImages--; - } - } + } + return result; +} + + +void XineramifyXv(void) +{ + ScreenPtr pScreen, screen0 = screenInfo.screens[0]; + XvScreenPtr xvsp0 = (XvScreenPtr)screen0->devPrivates[XvScreenIndex].ptr; + XvAdaptorPtr refAdapt, pAdapt; + XvAttributePtr pAttr; + XvScreenPtr xvsp; + Bool isOverlay, hasOverlay; + PanoramiXRes *port; + XvAdaptorPtr MatchingAdaptors[MAXSCREENS]; + int i, j, k, l; + + XvXRTPort = CreateNewResourceType(XineramaDeleteResource); + + for(i = 0; i < xvsp0->nAdaptors; i++) { + refAdapt = xvsp0->pAdaptors + i; + + bzero(MatchingAdaptors, sizeof(XvAdaptorPtr) * MAXSCREENS); + + MatchingAdaptors[0] = refAdapt; + + if(!(refAdapt->type & XvInputMask)) continue; + + isOverlay = FALSE; + for(j = 0; j < refAdapt->nAttributes; j++) { + pAttr = refAdapt->pAttributes + j; + if(!strcmp(pAttr->name, "XV_COLORKEY")) { + isOverlay = TRUE; + break; + } + } + + for(j = 1; j < PanoramiXNumScreens; j++) { + pScreen = screenInfo.screens[j]; + xvsp = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; + + /* Do not try to go on if xv is not supported on this screen */ + if (xvsp==NULL) continue ; + + /* if the adaptor has the same name it's a perfect match */ + for(k = 0; k < xvsp->nAdaptors; k++) { + pAdapt = xvsp->pAdaptors + k; + if(!strcmp(refAdapt->name, pAdapt->name)) { + MatchingAdaptors[j] = pAdapt; + break; + } + } + if(MatchingAdaptors[j]) continue; /* found it */ + + /* otherwise we only look for XvImage adaptors */ + if(!(refAdapt->type & XvImageMask)) continue; + if(refAdapt->nImages <= 0) continue; + + /* prefer overlay/overlay non-overlay/non-overlay pairing */ + for(k = 0; k < xvsp->nAdaptors; k++) { + pAdapt = xvsp->pAdaptors + k; + if((pAdapt->type & XvImageMask) & (pAdapt->nImages > 0)) { + hasOverlay = FALSE; + for(l = 0; l < pAdapt->nAttributes; l++) { + if(!strcmp(pAdapt->name, "XV_COLORKEY")) { + hasOverlay = TRUE; + break; + } + } + if(isOverlay && hasOverlay) { + MatchingAdaptors[j] = pAdapt; + break; + } + else if(!isOverlay && !hasOverlay) { + MatchingAdaptors[j] = pAdapt; + break; + } + } + } + + if(MatchingAdaptors[j]) continue; /* found it */ + + /* but we'll take any XvImage pairing if we can get it */ + + for(k = 0; k < xvsp->nAdaptors; k++) { + pAdapt = xvsp->pAdaptors + k; + if((pAdapt->type & XvImageMask) & (pAdapt->nImages > 0)) { + MatchingAdaptors[j] = pAdapt; + break; + } + } + } - if(!refAdapt->nImages) /* no image formats in common between heads */ - refAdapt->type &= ~XvImageMask; + /* now create a resource for each port */ + for(j = 0; j < refAdapt->nPorts; j++) { + if(!(port = xalloc(sizeof(PanoramiXRes)))) + break; + port->info[0].id = MatchingAdaptors[0]->base_id + j; + AddResource(port->info[0].id, XvXRTPort, port); + + for(k = 1; k < PanoramiXNumScreens; k++) { + if(MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j)) + port->info[k].id = MatchingAdaptors[k]->base_id + j; + else + port->info[k].id = 0; + } + } + } } + #endif diff --git a/xc/programs/Xserver/Xext/xvmc.c b/xc/programs/Xserver/Xext/xvmc.c new file mode 100644 index 000000000..d94432cd1 --- /dev/null +++ b/xc/programs/Xserver/Xext/xvmc.c @@ -0,0 +1,632 @@ +/* $XFree86: xc/programs/Xserver/Xext/xvmc.c,v 1.3 2001/04/01 14:00:03 tsi Exp $ */ + +#define NEED_REPLIES +#define NEED_EVENTS +#include "X.h" +#include "Xproto.h" +#include "misc.h" +#include "os.h" +#include "dixstruct.h" +#include "resource.h" +#include "scrnintstr.h" +#include "extnsionst.h" +#include "servermd.h" +#include "Xfuncproto.h" +#include "xvdix.h" +#include "XvMC.h" +#include "Xvproto.h" +#include "XvMCproto.h" +#include "xvmc.h" + +int XvMCScreenIndex = -1; + +unsigned long XvMCGeneration = 0; + +int XvMCReqCode; +int XvMCEventBase; +int XvMCErrorBase; + +unsigned long XvMCRTContext; +unsigned long XvMCRTSurface; +unsigned long XvMCRTSubpicture; + +typedef struct { + int num_adaptors; + XvMCAdaptorPtr adaptors; + CloseScreenProcPtr CloseScreen; +} XvMCScreenRec, *XvMCScreenPtr; + +#define XVMC_GET_PRIVATE(pScreen) \ + (XvMCScreenPtr)((pScreen)->devPrivates[XvMCScreenIndex].ptr) + + +static int +XvMCDestroyContextRes(pointer data, XID id) +{ + XvMCContextPtr pContext = (XvMCContextPtr)data; + + pContext->refcnt--; + + if(!pContext->refcnt) { + XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); + (*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext)(pContext); + xfree(pContext); + } + + return Success; +} + +static int +XvMCDestroySurfaceRes(pointer data, XID id) +{ + XvMCSurfacePtr pSurface = (XvMCSurfacePtr)data; + XvMCContextPtr pContext = pSurface->context; + XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); + + (*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface)(pSurface); + xfree(pSurface); + + XvMCDestroyContextRes((pointer)pContext, pContext->context_id); + + return Success; +} + + +static int +XvMCDestroySubpictureRes(pointer data, XID id) +{ + XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr)data; + XvMCContextPtr pContext = pSubpict->context; + XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); + + (*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture)(pSubpict); + xfree(pSubpict); + + XvMCDestroyContextRes((pointer)pContext, pContext->context_id); + + return Success; +} + +static void +XvMCResetProc (ExtensionEntry *extEntry) +{ +} + + +static int +ProcXvMCQueryVersion(ClientPtr client) +{ + xvmcQueryVersionReply rep; + REQUEST(xvmcQueryVersionReq); + REQUEST_SIZE_MATCH(xvmcQueryVersionReq); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.major = XvMCVersion; + rep.minor = XvMCRevision; + WriteToClient(client, sizeof(xvmcQueryVersionReply), (char*)&rep); + return Success; +} + + +static int +ProcXvMCListSurfaceTypes(ClientPtr client) +{ + XvPortPtr pPort; + ScreenPtr pScreen; + int i; + XvMCScreenPtr pScreenPriv; + xvmcListSurfaceTypesReply rep; + xvmcSurfaceInfo info; + XvMCAdaptorPtr adaptor = NULL; + XvMCSurfaceInfoPtr surface; + REQUEST(xvmcListSurfaceTypesReq); + REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq); + + if(!(pPort = LOOKUP_PORT(stuff->port, client))) { + client->errorValue = stuff->port; + return _XvBadPort; + } + + pScreen = pPort->pAdaptor->pScreen; + pScreenPriv = XVMC_GET_PRIVATE(pScreen); + + for(i = 0; i < pScreenPriv->num_adaptors; i++) { + if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) { + adaptor = &(pScreenPriv->adaptors[i]); + break; + } + } + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.num = (adaptor) ? adaptor->num_surfaces : 0; + rep.length = rep.num * sizeof(xvmcSurfaceInfo) >> 2; + + WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), (char*)&rep); + + for(i = 0; i < rep.num; i++) { + surface = adaptor->surfaces[i]; + info.surface_type_id = surface->surface_type_id; + info.chroma_format = surface->chroma_format; + info.color_description = surface->color_description; + info.max_width = surface->max_width; + info.max_height = surface->max_height; + info.subpicture_max_width = surface->subpicture_max_width; + info.subpicture_max_height = surface->subpicture_max_height; + info.mc_type = surface->mc_type; + info.flags = surface->flags; + WriteToClient(client, sizeof(xvmcSurfaceInfo), (char*)&info); + } + + return Success; +} + +static int +ProcXvMCCreateContext(ClientPtr client) +{ + XvPortPtr pPort; + CARD32 *data = NULL; + int dwords = 0; + int i, result, adapt_num = -1; + ScreenPtr pScreen; + XvMCContextPtr pContext; + XvMCScreenPtr pScreenPriv; + XvMCAdaptorPtr adaptor = NULL; + XvMCSurfaceInfoPtr surface = NULL; + xvmcCreateContextReply rep; + REQUEST(xvmcCreateContextReq); + REQUEST_SIZE_MATCH(xvmcCreateContextReq); + + if(!(pPort = LOOKUP_PORT(stuff->port, client))) { + client->errorValue = stuff->port; + return _XvBadPort; + } + + pScreen = pPort->pAdaptor->pScreen; + pScreenPriv = XVMC_GET_PRIVATE(pScreen); + + for(i = 0; i < pScreenPriv->num_adaptors; i++) { + if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) { + adaptor = &(pScreenPriv->adaptors[i]); + adapt_num = i; + break; + } + } + + if(adapt_num < 0) /* that port doesn't support MC */ + return BadMatch; + + for(i = 0; i < adaptor->num_surfaces; i++) { + if(adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) { + surface = adaptor->surfaces[i]; + break; + } + } + + /* adaptor doesn't support this suface_type_id */ + if(!surface) return BadMatch; + + + if((stuff->width > surface->max_width) || + (stuff->height > surface->max_height)) + return BadValue; + + if(!(pContext = xalloc(sizeof(XvMCContextRec)))) { + return BadAlloc; + } + + + pContext->pScreen = pScreen; + pContext->adapt_num = adapt_num; + pContext->context_id = stuff->context_id; + pContext->surface_type_id = stuff->surface_type_id; + pContext->width = stuff->width; + pContext->height = stuff->height; + pContext->flags = stuff->flags; + pContext->refcnt = 1; + + result = (*adaptor->CreateContext)(pPort, pContext, &dwords, &data); + + if(result != Success) { + xfree(pContext); + return result; + } + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.width_actual = pContext->width; + rep.height_actual = pContext->height; + rep.flags_return = pContext->flags; + rep.length = dwords; + + WriteToClient(client, sizeof(xvmcCreateContextReply), (char*)&rep); + if(dwords) + WriteToClient(client, dwords << 2, (char*)data); + AddResource(pContext->context_id, XvMCRTContext, pContext); + + if(data) + xfree(data); + + return Success; +} + +static int +ProcXvMCDestroyContext(ClientPtr client) +{ + REQUEST(xvmcDestroyContextReq); + REQUEST_SIZE_MATCH(xvmcDestroyContextReq); + + if(!LookupIDByType(stuff->context_id, XvMCRTContext)) + return (XvMCBadContext + XvMCErrorBase); + + FreeResource(stuff->context_id, RT_NONE); + + return Success; +} + +static int +ProcXvMCCreateSurface(ClientPtr client) +{ + CARD32 *data = NULL; + int dwords = 0; + int result; + XvMCContextPtr pContext; + XvMCSurfacePtr pSurface; + XvMCScreenPtr pScreenPriv; + xvmcCreateSurfaceReply rep; + REQUEST(xvmcCreateSurfaceReq); + REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq); + + if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext))) + return (XvMCBadContext + XvMCErrorBase); + + pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); + + if(!(pSurface = xalloc(sizeof(XvMCSurfaceRec)))) + return BadAlloc; + + pSurface->surface_id = stuff->surface_id; + pSurface->surface_type_id = pContext->surface_type_id; + pSurface->context = pContext; + + result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface)( + pSurface, &dwords, &data); + + if(result != Success) { + xfree(pSurface); + return result; + } + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = dwords; + + WriteToClient(client, sizeof(xvmcCreateSurfaceReply), (char*)&rep); + if(dwords) + WriteToClient(client, dwords << 2, (char*)data); + AddResource(pSurface->surface_id, XvMCRTSurface, pSurface); + + if(data) + xfree(data); + + pContext->refcnt++; + + return Success; +} + +static int +ProcXvMCDestroySurface(ClientPtr client) +{ + REQUEST(xvmcDestroySurfaceReq); + REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq); + + if(!LookupIDByType(stuff->surface_id, XvMCRTSurface)) + return (XvMCBadSurface + XvMCErrorBase); + + FreeResource(stuff->surface_id, RT_NONE); + + return Success; +} + +static int +ProcXvMCCreateSubpicture(ClientPtr client) +{ + Bool image_supported = FALSE; + CARD32 *data = NULL; + int i, result, dwords = 0; + XvMCContextPtr pContext; + XvMCSubpicturePtr pSubpicture; + XvMCScreenPtr pScreenPriv; + xvmcCreateSubpictureReply rep; + XvMCAdaptorPtr adaptor; + XvMCSurfaceInfoPtr surface = NULL; + REQUEST(xvmcCreateSubpictureReq); + REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq); + + if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext))) + return (XvMCBadContext + XvMCErrorBase); + + pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); + + adaptor = &(pScreenPriv->adaptors[pContext->adapt_num]); + + /* find which surface this context supports */ + for(i = 0; i < adaptor->num_surfaces; i++) { + if(adaptor->surfaces[i]->surface_type_id == pContext->surface_type_id){ + surface = adaptor->surfaces[i]; + break; + } + } + + if(!surface) return BadMatch; + + /* make sure this surface supports that xvimage format */ + if(!surface->compatible_subpictures) return BadMatch; + + for(i = 0; i < surface->compatible_subpictures->num_xvimages; i++) { + if(surface->compatible_subpictures->xvimage_ids[i] == stuff->xvimage_id) { + image_supported = TRUE; + break; + } + } + + if(!image_supported) return BadMatch; + + /* make sure the size is OK */ + if((stuff->width > surface->subpicture_max_width) || + (stuff->height > surface->subpicture_max_height)) + return BadValue; + + if(!(pSubpicture = xalloc(sizeof(XvMCSubpictureRec)))) + return BadAlloc; + + pSubpicture->subpicture_id = stuff->subpicture_id; + pSubpicture->xvimage_id = stuff->xvimage_id; + pSubpicture->width = stuff->width; + pSubpicture->height = stuff->height; + pSubpicture->num_palette_entries = 0; /* overwritten by DDX */ + pSubpicture->entry_bytes = 0; /* overwritten by DDX */ + pSubpicture->component_order[0] = 0; /* overwritten by DDX */ + pSubpicture->component_order[1] = 0; + pSubpicture->component_order[2] = 0; + pSubpicture->component_order[3] = 0; + pSubpicture->context = pContext; + + result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSubpicture)( + pSubpicture, &dwords, &data); + + if(result != Success) { + xfree(pSubpicture); + return result; + } + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.width_actual = pSubpicture->width; + rep.height_actual = pSubpicture->height; + rep.num_palette_entries = pSubpicture->num_palette_entries; + rep.entry_bytes = pSubpicture->entry_bytes; + rep.component_order[0] = pSubpicture->component_order[0]; + rep.component_order[1] = pSubpicture->component_order[1]; + rep.component_order[2] = pSubpicture->component_order[2]; + rep.component_order[3] = pSubpicture->component_order[3]; + rep.length = dwords; + + WriteToClient(client, sizeof(xvmcCreateSubpictureReply), (char*)&rep); + if(dwords) + WriteToClient(client, dwords << 2, (char*)data); + AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture); + + if(data) + xfree(data); + + pContext->refcnt++; + + return Success; +} + +static int +ProcXvMCDestroySubpicture(ClientPtr client) +{ + REQUEST(xvmcDestroySubpictureReq); + REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq); + + if(!LookupIDByType(stuff->subpicture_id, XvMCRTSubpicture)) + return (XvMCBadSubpicture + XvMCErrorBase); + + FreeResource(stuff->subpicture_id, RT_NONE); + + return Success; +} + + +static int +ProcXvMCListSubpictureTypes(ClientPtr client) +{ + XvPortPtr pPort; + xvmcListSubpictureTypesReply rep; + XvMCScreenPtr pScreenPriv; + ScreenPtr pScreen; + XvMCAdaptorPtr adaptor = NULL; + XvMCSurfaceInfoPtr surface = NULL; + xvImageFormatInfo info; + XvImagePtr pImage; + int i, j; + REQUEST(xvmcListSubpictureTypesReq); + REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq); + + if(!(pPort = LOOKUP_PORT(stuff->port, client))) { + client->errorValue = stuff->port; + return _XvBadPort; + } + + pScreen = pPort->pAdaptor->pScreen; + pScreenPriv = XVMC_GET_PRIVATE(pScreen); + + for(i = 0; i < pScreenPriv->num_adaptors; i++) { + if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) { + adaptor = &(pScreenPriv->adaptors[i]); + break; + } + } + + if(!adaptor) return BadMatch; + + for(i = 0; i < adaptor->num_surfaces; i++) { + if(adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) { + surface = adaptor->surfaces[i]; + break; + } + } + + if(!surface) return BadMatch; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.num = 0; + if(surface->compatible_subpictures) + rep.num = surface->compatible_subpictures->num_xvimages; + + rep.length = rep.num * sizeof(xvImageFormatInfo) >> 2; + + WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), (char*)&rep); + + for(i = 0; i < rep.num; i++) { + pImage = NULL; + for(j = 0; j < adaptor->num_subpictures; j++) { + if(surface->compatible_subpictures->xvimage_ids[i] == + adaptor->subpictures[j]->id) + { + pImage = adaptor->subpictures[j]; + break; + } + } + if(!pImage) return BadImplementation; + + info.id = pImage->id; + info.type = pImage->type; + info.byte_order = pImage->byte_order; + memcpy(&info.guid, pImage->guid, 16); + info.bpp = pImage->bits_per_pixel; + info.num_planes = pImage->num_planes; + info.depth = pImage->depth; + info.red_mask = pImage->red_mask; + info.green_mask = pImage->green_mask; + info.blue_mask = pImage->blue_mask; + info.format = pImage->format; + info.y_sample_bits = pImage->y_sample_bits; + info.u_sample_bits = pImage->u_sample_bits; + info.v_sample_bits = pImage->v_sample_bits; + info.horz_y_period = pImage->horz_y_period; + info.horz_u_period = pImage->horz_u_period; + info.horz_v_period = pImage->horz_v_period; + info.vert_y_period = pImage->vert_y_period; + info.vert_u_period = pImage->vert_u_period; + info.vert_v_period = pImage->vert_v_period; + memcpy(&info.comp_order, pImage->component_order, 32); + info.scanline_order = pImage->scanline_order; + WriteToClient(client, sizeof(xvImageFormatInfo), (char*)&info); + } + + return Success; +} + + + +int (*ProcXvMCVector[xvmcNumRequest])(ClientPtr) = { + ProcXvMCQueryVersion, + ProcXvMCListSurfaceTypes, + ProcXvMCCreateContext, + ProcXvMCDestroyContext, + ProcXvMCCreateSurface, + ProcXvMCDestroySurface, + ProcXvMCCreateSubpicture, + ProcXvMCDestroySubpicture, + ProcXvMCListSubpictureTypes +}; + +static int +ProcXvMCDispatch (ClientPtr client) +{ + REQUEST(xReq); + + if(stuff->data < xvmcNumRequest) + return (*ProcXvMCVector[stuff->data])(client); + else + return BadRequest; +} + +static int +SProcXvMCDispatch (ClientPtr client) +{ + /* We only support local */ + return BadImplementation; +} + +void +XvMCExtensionInit() +{ + ExtensionEntry *extEntry; + + if(XvMCScreenIndex < 0) /* nobody supports it */ + return; + + if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes))) + return; + + if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes))) + return; + + if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes))) + return; + + extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors, + ProcXvMCDispatch, SProcXvMCDispatch, + XvMCResetProc, StandardMinorOpcode); + + if(!extEntry) return; + + XvMCReqCode = extEntry->base; + XvMCEventBase = extEntry->eventBase; + XvMCErrorBase = extEntry->errorBase; +} + +static Bool +XvMCCloseScreen (int i, ScreenPtr pScreen) +{ + XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen); + + pScreen->CloseScreen = pScreenPriv->CloseScreen; + + xfree(pScreenPriv); + + return (*pScreen->CloseScreen)(i, pScreen); +} + + +int +XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt) +{ + XvMCScreenPtr pScreenPriv; + + if(XvMCGeneration != serverGeneration) { + if((XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0) + return BadAlloc; + + XvMCGeneration = serverGeneration; + } + + if(!(pScreenPriv = (XvMCScreenPtr)xalloc(sizeof(XvMCScreenRec)))) + return BadAlloc; + + pScreen->devPrivates[XvMCScreenIndex].ptr = (pointer)pScreenPriv; + + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = XvMCCloseScreen; + + pScreenPriv->num_adaptors = num; + pScreenPriv->adaptors = pAdapt; + + return Success; +} diff --git a/xc/programs/Xserver/Xext/xvmc.h b/xc/programs/Xserver/Xext/xvmc.h new file mode 100644 index 000000000..ac5a7ebbe --- /dev/null +++ b/xc/programs/Xserver/Xext/xvmc.h @@ -0,0 +1,109 @@ +/* $XFree86: xc/programs/Xserver/Xext/xvmc.h,v 1.2 2001/04/01 14:00:03 tsi Exp $ */ + +#ifndef _XVMC_H +#define _XVMC_H +#include "Xv.h" +#include "xvdix.h" + +typedef struct { + int num_xvimages; + int *xvimage_ids; +} XvMCImageIDList; + +typedef struct { + int surface_type_id; + int chroma_format; + int color_description; + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; + XvMCImageIDList *compatible_subpictures; +} XvMCSurfaceInfoRec, *XvMCSurfaceInfoPtr; + +typedef struct { + XID context_id; + ScreenPtr pScreen; + int adapt_num; + int surface_type_id; + unsigned short width; + unsigned short height; + CARD32 flags; + int refcnt; + pointer port_priv; + pointer driver_priv; +} XvMCContextRec, *XvMCContextPtr; + +typedef struct { + XID surface_id; + int surface_type_id; + XvMCContextPtr context; + pointer driver_priv; +} XvMCSurfaceRec, *XvMCSurfacePtr; + + +typedef struct { + XID subpicture_id; + int xvimage_id; + unsigned short width; + unsigned short height; + int num_palette_entries; + int entry_bytes; + char component_order[4]; + XvMCContextPtr context; + pointer driver_priv; +} XvMCSubpictureRec, *XvMCSubpicturePtr; + +typedef int (*XvMCCreateContextProcPtr) ( + XvPortPtr port, + XvMCContextPtr context, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroyContextProcPtr) ( + XvMCContextPtr context +); + +typedef int (*XvMCCreateSurfaceProcPtr) ( + XvMCSurfacePtr surface, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroySurfaceProcPtr) ( + XvMCSurfacePtr surface +); + +typedef int (*XvMCCreateSubpictureProcPtr) ( + XvMCSubpicturePtr subpicture, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroySubpictureProcPtr) ( + XvMCSubpicturePtr subpicture +); + + +typedef struct { + XvAdaptorPtr xv_adaptor; + int num_surfaces; + XvMCSurfaceInfoPtr *surfaces; + int num_subpictures; + XvImagePtr *subpictures; + XvMCCreateContextProcPtr CreateContext; + XvMCDestroyContextProcPtr DestroyContext; + XvMCCreateSurfaceProcPtr CreateSurface; + XvMCDestroySurfaceProcPtr DestroySurface; + XvMCCreateSubpictureProcPtr CreateSubpicture; + XvMCDestroySubpictureProcPtr DestroySubpicture; +} XvMCAdaptorRec, *XvMCAdaptorPtr; + +void XvMCExtensionInit(void); + +int XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr adapt); + +#endif /* _XVMC_H */ diff --git a/xc/programs/Xserver/Xext/xvmod.c b/xc/programs/Xserver/Xext/xvmod.c index c8846eb8a..4a9c461f6 100644 --- a/xc/programs/Xserver/Xext/xvmod.c +++ b/xc/programs/Xserver/Xext/xvmod.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xvmod.c,v 1.1 1998/08/13 14:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvmod.c,v 1.2 2001/03/05 04:51:55 mvojkovi Exp $ */ #include "X.h" #include "misc.h" @@ -15,5 +15,6 @@ XvRegister() XvScreenInitProc = XvScreenInit; XvGetScreenIndexProc = XvGetScreenIndex; XvGetRTPortProc = XvGetRTPort; + XvMCScreenInitProc = XvMCScreenInit; } diff --git a/xc/programs/Xserver/Xext/xvmodproc.h b/xc/programs/Xserver/Xext/xvmodproc.h index 978c400f2..82b890ede 100644 --- a/xc/programs/Xserver/Xext/xvmodproc.h +++ b/xc/programs/Xserver/Xext/xvmodproc.h @@ -1,7 +1,10 @@ -/* $XFree86: xc/programs/Xserver/Xext/xvmodproc.h,v 1.1 1998/08/13 14:45:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvmodproc.h,v 1.2 2001/03/05 04:51:55 mvojkovi Exp $ */ + +#include "xvmc.h" extern int (*XvGetScreenIndexProc)(void); extern unsigned long (*XvGetRTPortProc)(void); extern int (*XvScreenInitProc)(ScreenPtr); +extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr); extern void XvRegister(void); diff --git a/xc/programs/Xserver/Xprint/ddxInit.c b/xc/programs/Xserver/Xprint/ddxInit.c index ec984f9ab..a23fafbbd 100644 --- a/xc/programs/Xserver/Xprint/ddxInit.c +++ b/xc/programs/Xserver/Xprint/ddxInit.c @@ -30,7 +30,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ -/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.11 2001/01/17 22:36:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.12 2001/03/04 17:40:04 herrb Exp $ */ #include "X.h" #include "Xproto.h" @@ -206,6 +206,13 @@ ProcessInputEvents(void) { } +#ifdef __DARWIN__ +void +DarwinHandleGUI(int argc, char *argv[]) +{ +} +#endif + #ifdef DDXOSINIT void OsVendorInit(void) diff --git a/xc/programs/Xserver/Xserver.man b/xc/programs/Xserver/Xserver.man index e04f5e21c..54ada48ea 100644 --- a/xc/programs/Xserver/Xserver.man +++ b/xc/programs/Xserver/Xserver.man @@ -18,7 +18,7 @@ .\" 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/Xserver.man,v 3.15 2001/01/27 18:20:39 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.16 2001/03/28 14:35:14 dawes Exp $ .TH XSERVER 1 __xorgversion__ .SH NAME Xserver \- X Window System display server @@ -686,7 +686,7 @@ Controlling the server once started: xset(1), xsetroot(1), xhost(1) .PP Server-specific man pages: Xdec(1), XmacII(1), Xsun(1), Xnest(1), Xvfb(1), -XFree86(1), Xdarwin(1). +XFree86(1), XDarwin(1). .PP Server internal documentation: .I "Definition of the Porting Layer for the X v11 Sample Server" diff --git a/xc/programs/Xserver/dbe/midbe.c b/xc/programs/Xserver/dbe/midbe.c index 63d71fbdc..ca1dd6701 100644 --- a/xc/programs/Xserver/dbe/midbe.c +++ b/xc/programs/Xserver/dbe/midbe.c @@ -30,7 +30,7 @@ * Machine-independent DBE code * *****************************************************************************/ -/* $XFree86: xc/programs/Xserver/dbe/midbe.c,v 3.3 2001/01/17 22:36:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/dbe/midbe.c,v 3.4 2001/03/06 17:31:34 dawes Exp $ */ /* INCLUDES */ @@ -821,17 +821,17 @@ miDbeInit(pScreen, pDbeScreenPriv) miDbeWindowPrivPrivIndex = (*pDbeScreenPriv->AllocWinPrivPrivIndex)(); - if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen, - miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec))) - { - return(FALSE); - } - /* Make sure we only do this code once. */ miDbePrivPrivGeneration = serverGeneration; } /* if -- Reset priv privs. */ + if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen, + miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec))) + { + return(FALSE); + } + /* Wrap functions. */ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = miDbePositionWindow; diff --git a/xc/programs/Xserver/dix/Imakefile b/xc/programs/Xserver/dix/Imakefile index 1007534c6..312910c4c 100644 --- a/xc/programs/Xserver/dix/Imakefile +++ b/xc/programs/Xserver/dix/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:48:16 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.12 2001/01/17 22:36:42 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.13 2001/03/04 17:40:04 herrb Exp $ #include <Server.tmpl> @@ -70,9 +70,13 @@ VENDORRELEASE = XVendorRelease K5DEFS = Krb5Defines #endif +#if DarwinQuartzSupport + QUARTZ_DEFINES = -DDARWIN_WITH_QUARTZ +#endif + SITE_DEFINES = $(SITE_FONT_PATH) $(SITE_RGB_DB) $(SITE_DISPLAY_CLASS) -VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) +VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) $(QUARTZ_DEFINES) NormalLibraryObjectRule() NormalLibraryTarget(dix,$(OBJS)) diff --git a/xc/programs/Xserver/dix/main.c b/xc/programs/Xserver/dix/main.c index 6e0404d5f..80d977c71 100644 --- a/xc/programs/Xserver/dix/main.c +++ b/xc/programs/Xserver/dix/main.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.33 2001/02/16 13:24:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.34 2001/03/04 17:40:04 herrb Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -261,6 +261,13 @@ main(argc, argv, envp) char *xauthfile; HWEventQueueType alwaysCheckForInput[2]; + /* Quartz support on Mac OS X requires that the Cocoa event loop be in + * the main thread. This allows the X server main to be called again + * from another thread. */ +#if defined(__DARWIN__) && defined(DARWIN_WITH_QUARTZ) + DarwinHandleGUI(argc, argv, envp); +#endif + /* Notice if we're restarted. Probably this is because we jumped through * an uninitialized pointer */ if (restart) diff --git a/xc/programs/Xserver/fb/fb.h b/xc/programs/Xserver/fb/fb.h index 35511b966..2226a4110 100644 --- a/xc/programs/Xserver/fb/fb.h +++ b/xc/programs/Xserver/fb/fb.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fb.h,v 1.24 2001/01/21 21:19:09 tsi Exp $ + * $XFree86: xc/programs/Xserver/fb/fb.h,v 1.26 2001/03/30 02:15:19 keithp Exp $ * * Copyright © 1998 Keith Packard * @@ -114,6 +114,10 @@ typedef unsigned long long FbBits; typedef CARD32 FbBits; #endif +#if FB_SHIFT == 4 +typedef CARD16 FbBits; +#endif + #if LOG2_BITMAP_PAD == FB_SHIFT typedef FbBits FbStip; #else @@ -1229,6 +1233,10 @@ Bool fbSetVisualTypes (int depth, int visuals, int bitsPerRGB); Bool +fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB, + Pixel redMask, Pixel greenMask, Pixel blueMask); + +Bool fbInitVisuals (VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, diff --git a/xc/programs/Xserver/fb/fbbits.h b/xc/programs/Xserver/fb/fbbits.h index 66ba69080..0fd559393 100644 --- a/xc/programs/Xserver/fb/fbbits.h +++ b/xc/programs/Xserver/fb/fbbits.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/fb/fbbits.h,v 1.9 2001/01/17 07:40:01 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/fb/fbbits.h,v 1.10 2001/03/18 08:35:30 keithp Exp $ */ /* * This file defines functions for drawing some primitives using @@ -771,7 +771,9 @@ POLYLINE (DrawablePtr pDrawable, { if (pGC->capStyle != CapNotLast && pt2 != *((INT32 *) ptsOrig)) - *bits = FbDoRRop (*bits, and, xor); + { + RROP(bits,and,xor); + } return; } pt1 = pt2; diff --git a/xc/programs/Xserver/fb/fbglyph.c b/xc/programs/Xserver/fb/fbglyph.c index 0ea8e6c9b..e1872bda6 100644 --- a/xc/programs/Xserver/fb/fbglyph.c +++ b/xc/programs/Xserver/fb/fbglyph.c @@ -1,5 +1,5 @@ /* - * Id: fbglyph.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ + * $XFree86: xc/programs/Xserver/fb/fbglyph.c,v 1.10 2001/03/03 22:14:44 tsi Exp $ * * Copyright © 1998 Keith Packard * @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/fb/fbglyph.c,v 1.9 2000/09/27 00:14:08 keithp Exp $ */ #include "fb.h" #include "fontstruct.h" @@ -81,8 +80,18 @@ fbGlyphIn (RegionPtr pRegion, * C A B C f2 f0 */ +#undef _A +#undef _B +#undef _C +#undef _AB +#undef _BC +#undef _CA +#undef _ABCA +#undef _BCAB +#undef _CABC + #if IMAGE_BYTE_ORDER == MSBFirst -#define _A f1 +#define _A f1 #define _B f2 #define _C f0 #define _AB f2 @@ -93,7 +102,7 @@ fbGlyphIn (RegionPtr pRegion, #define _CABC f0 #define CASE(a,b,c,d) ((a << 3) | (b << 2) | (c << 1) | d) #else -#define _A f0 +#define _A f0 #define _B f1 #define _C f2 #define _AB f0 diff --git a/xc/programs/Xserver/fb/fbutil.c b/xc/programs/Xserver/fb/fbutil.c index 9515074b4..54b88ad7e 100644 --- a/xc/programs/Xserver/fb/fbutil.c +++ b/xc/programs/Xserver/fb/fbutil.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/fbutil.c,v 1.4 2000/02/23 20:29:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/fb/fbutil.c,v 1.5 2001/03/28 14:37:03 alanh Exp $ */ #include "fb.h" @@ -176,6 +176,20 @@ const FbMergeRopRec FbMergeRopBits[16] = { SelMask(b,6,w) | \ SelMask(b,7,w)) +#if FB_UNIT == 16 +#define fbStipple16Bits 0 +#define fbStipple8Bits 0 +const FbBits fbStipple4Bits[16] = { + C4( 0,4), C4( 1,4), C4( 2,4), C4( 3,4), C4( 4,4), C4( 5,4), + C4( 6,4), C4( 7,4), C4( 8,4), C4( 9,4), C4( 10,4), C4( 11,4), + C4( 12,4), C4( 13,4), C4( 14,4), C4( 15,4),}; +const FbBits fbStipple2Bits[4] = { + C2( 0,8), C2( 1,8), C2( 2,8), C2( 3,8), +}; +const FbBits fbStipple1Bits[2] = { + C1( 0,16), C1( 1,16), +}; +#endif #if FB_UNIT == 32 #define fbStipple16Bits 0 const FbBits fbStipple8Bits[256] = { diff --git a/xc/programs/Xserver/hw/darwin/Imakefile b/xc/programs/Xserver/hw/darwin/Imakefile index b87053f66..b5fb675b0 100644 --- a/xc/programs/Xserver/hw/darwin/Imakefile +++ b/xc/programs/Xserver/hw/darwin/Imakefile @@ -1,23 +1,17 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/darwin/Imakefile,v 1.8 2001/02/02 21:37:59 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/darwin/Imakefile,v 1.10 2001/03/24 23:08:53 torrey Exp $ #include <Server.tmpl> #define IHaveSubdirs -XCOMM LinkSourceFile(xf86Helper.c,../xfree86/common) - -SUBDIRS = utils - SRCS = darwin.c \ darwinKeyboard.c \ xfIOKit.c \ - xfIOKitCursor.c \ - quartz.c + xfIOKitCursor.c OBJS = darwin.o \ darwinKeyboard.o \ xfIOKit.o \ - xfIOKitCursor.o \ - quartz.o + xfIOKitCursor.o INCLUDES = -I. -I$(SERVERSRC)/mi -I$(SERVERSRC)/mfb -I$(SERVERSRC)/cfb \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(SERVERSRC)/os \ @@ -29,7 +23,10 @@ CUSTOMVERDEF = -DXF86_CUSTOM_VERSION='$(CUSTOMVERSION)' #endif #if DarwinQuartzSupport +SUBDIRS = bundle utils QUARTZDEF = -DDARWIN_WITH_QUARTZ +#else +SUBDIRS = utils #endif DEFINES = $(CUSTOMVERDEF) $(QUARTZDEF) @@ -38,7 +35,9 @@ EXTRAMANDEFS = $(QUARTZDEF) NormalLibraryObjectRule() NormalLibraryTarget(darwin,$(OBJS)) -InstallManPage(Xdarwin,$(MANDIR)) +AllTarget(xfIOKitStartup.o) + +InstallManPage(XDarwin,$(MANDIR)) DependTarget() diff --git a/xc/programs/Xserver/hw/darwin/XDarwin.man b/xc/programs/Xserver/hw/darwin/XDarwin.man new file mode 100644 index 000000000..f72aee3c8 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/XDarwin.man @@ -0,0 +1,114 @@ +.\" $XFree86: xc/programs/Xserver/hw/darwin/XDarwin.man,v 1.1 2001/03/28 08:28:55 torrey Exp $ +.\" +.TH XDARWIN 1 __vendorversion__ +.SH NAME +XDarwin \- X window system server for Darwin operating system +.SH SYNOPSIS +.B XDarwin +[ options ] ... +.SH DESCRIPTION +#ifdef DARWIN_WITH_QUARTZ +.I XDarwin +is the window server for Version 11 of the X window system on the Darwin +operating system. +.I XDarwin +can be started from the Darwin text console, or while running the Mac OS X +Quartz window server. +.PP +When running from the console, +.I XDarwin +acts as the window server and uses IOKit services to accesss the display framebuffer, +mouse and keyboard and to provide a layer of hardware abstraction. In console mode, +.I XDarwin +will normally be started by the \fIxdm(1)\fP display manager or by a script +that runs the program \fIxinit(1)\fP. +.PP +When running with the Mac OS X Quartz window server, +.I XDarwin +will normally be started with the Xmaster application. This application acts an +agent for +.I XDarwin +to receive events and allows easy switching between the Mac OS X and X window +desktops. In this mode, CoreGraphics is used to capture and draw to the screen. +#else +.I XDarwin +is the window server for Version 11 of the X window system on the Darwin +operating system. This version of +.I XDarwin +can only be started from the Darwin text console. The Mac OS X Quartz window +server, if present, must be shut down. It uses IOKit services to accesss the display +framebuffer, mouse and keyboard and to provide a layer of hardware abstraction. +.I XDarwin +will normally be started by the \fIxdm(1)\fP display manager or by a script +that runs the program \fIxinit(1)\fP. +#endif +.SH OPTIONS +.PP +In addition to the normal server options described in the \fIXserver(1)\fP +manual page, \fIXDarwin\fP accepts the following command line switches: +.TP 8 +.B \-fakebuttons +Emulates a 3 button mouse using the Command and Option keys. Clicking the +first mouse button while holding down Command will act like clicking +button 2. Holding down Option will simulate button 3. +.TP 8 +.B \-nofakebuttons +Do not emulate a 3 button mouse. This is the default. +#ifdef DARWIN_WITH_QUARTZ +.TP 8 +.B "\-size \fIwidth\fP \fIheight\fP" +Sets the screeen resolution for the X server to use. +This option is ignored if \fB\-quartz\fP is specified. +.TP 8 +.B "\-depth \fIdepth\fP" +Specifies the color bit depth to use. Currently only 8, 15, and 24 color bits +per pixel are supported. +This option is ignored if \fB\-quartz\fP is specified. +.TP 8 +.B "\-refresh \fIrate\fP" +Gives the refresh rate to use in Hz. For LCD displays this should be 0. +This option is ignored if \fB\-quartz\fP is specified. +.TP 8 +.B \-quartz +Run in parallel with the Mac OS X Quartz window server. +#else +.TP 8 +.B "\-size \fIwidth\fP \fIheight\fP" +Sets the screeen resolution for the X server to use. +.TP 8 +.B "\-depth \fIdepth\fP" +Specifies the color bit depth to use. Currently only 8, 15, and 24 color bits +per pixel are supported. +.TP 8 +.B "\-refresh \fIrate\fP" +Gives the refresh rate to use in Hz. For LCD displays this should be 0. +#endif +.TP 8 +.B \-showconfig +Print out the server version and patchlevel. +.TP 8 +.B \-version +Same as \fB\-showconfig\fP. +.SH "SEE ALSO" +.PP +X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1) +.SH BUGS +.I XDarwin +and this man page still have many limitations. Some of the more obvious +ones are: +.br +- Only one display is supported. +.br +- The display mode can not be changed once the X server has started. +.br +- A screen saver is not supported. +.br +- The key repeat rate can not be changed. +.PP +.SH AUTHORS +Original Port to Mac OS X Server - John Carmack +.br +Port to Darwin 1.0 - Dave Zarzycki +.br +Improvements and bug fixes - Torrey T. Lyons + diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Credits.rtf b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Credits.rtf new file mode 100644 index 000000000..a823101ac --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Credits.rtf @@ -0,0 +1,10 @@ +{\rtf1\mac\ansicpg10000{\fonttbl\f0\fswiss\fcharset77 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\paperw9240\paperh9000 +\pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural + +\f0\fs24 \cf0 John Carmack - Original XFree86 port to Mac OS X Server\ +Dave Zarzycki - XFree86 4.0 port to Darwin 1.0\ +Torrey T. Lyons - Improvements and bug fixes\ +Gregory Robert Parker - Original Quartz implementation\ +Andreas Monitzer - Cocoa version of Xmaster} diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/InfoPlist.strings b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/InfoPlist.strings new file mode 100644 index 000000000..52b64973d --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/InfoPlist.strings @@ -0,0 +1,4 @@ +/* English localized versions of Info.plist keys. */ +/* Most of these are set in the target application settings. */ + +NSHumanReadableCopyright = "XFree86 Version 4.0.2 / X Window System"; diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings new file mode 100644 index 000000000..6e95eccc4 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings @@ -0,0 +1,14 @@ +/* English localized versions of strings used by the Mac OS X front end. */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings,v 1.1 2001/03/27 20:42:39 torrey Exp $ */ + +/* Title of alert panel */ +"Quit X server?" = "Quit X server?"; + +/* Text of alert panel */ +"Quitting the X server will terminate any running X Window programs." = "Quitting the X server will terminate any running X Window programs."; + +/* Quit */ +"Quit" = "Quit"; + +/* Cancel */ +"Cancel" = "Cancel"; diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib new file mode 100644 index 000000000..3c4afe987 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib @@ -0,0 +1,39 @@ +{ + IBClasses = ( + { + ACTIONS = {showHelp = id; }; + CLASS = FirstResponder; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + }, + { + ACTIONS = {close = id; saveChanges = id; setKey = id; }; + CLASS = Preferences; + LANGUAGE = ObjC; + OUTLETS = { + displayNumber = id; + fakeButton = id; + keyField = id; + splashStartupHelpButton = id; + startupHelpButton = id; + systemBeepButton = id; + window = id; + }; + SUPERCLASS = NSObject; + }, + { + CLASS = XApplication; + LANGUAGE = ObjC; + OUTLETS = {preferences = id; xserver = id; }; + SUPERCLASS = NSApplication; + }, + { + ACTIONS = {applicationWillResignActive = id; closeHelpAndShow = id; }; + CLASS = Xserver; + LANGUAGE = ObjC; + OUTLETS = {helpWindow = id; startupHelpButton = id; }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/info.nib b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/info.nib new file mode 100644 index 000000000..7c8a23fe9 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/info.nib @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>IBDocumentLocation</key> + <string>11 9 367 304 0 4 800 574 </string> + <key>IBMainMenuLocation</key> + <string>19 268 220 44 0 4 800 574 </string> + <key>IBUserGuides</key> + <dict> + <key>HelpPanel</key> + <dict> + <key>guideLocations</key> + <array/> + <key>guidesLocked</key> + <string>NO</string> + </dict> + <key>PrefPanel</key> + <dict> + <key>guideLocations</key> + <array/> + <key>guidesLocked</key> + <string>NO</string> + </dict> + </dict> +</dict> +</plist> diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib Binary files differnew file mode 100644 index 000000000..5a21abc46 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/XDarwinHelp.html b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/XDarwinHelp.html new file mode 100644 index 000000000..9b4024ec7 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/XDarwinHelp.html @@ -0,0 +1,60 @@ +<html> +<head> +<title>XFree86 for Mac OS X</title> +</head> +<body> +<center> + <h1>XFree86 on Darwin and Mac OS X</h1> +</center> +<h2>Contents</h2> +<ol> + <li><A HREF="#notice">Important Notice</A></li> + <li><A HREF="#usage">Usage</A></li> + <li><A HREF="#path">Setting Your Path</A></li> + <li><A HREF="#license">License</A></li> +</ol> +<center> + <h2><a NAME="notice">Important Notice</a></h2> +</center> +<blockquote>This is a pre-release version of XFree86, and is not supported in any way. This software is distributed under the terms of the <A HREF="#license">MIT X11 / X Consortium License</A> and is provided AS IS, with no warranty. Please read the <A HREF="#license">License</A> before using. Bugs may be reported and patches may be submitted to the <A HREF="http://sourceforge.net/projects/xonx/">XonX project page</A> at SourceForge. Before reporting bugs in pre-release versions, please check the latest version from <A HREF="http://sourceforge.net/projects/xonx/">XonX</A> or in the <A HREF="http://www.XFree86.Org/cvs">XFree86 CVS repository</A>.</blockquote> +<h2><a NAME="usage">Usage</a></h2> +<p>XFree86 runs on Mac OS X in full screen mode. When the X window desktop is active, it takes over the entire screen. You can switch back to the Mac OS X desktop by holding down Command-Option-A. (This key combination can be changed in the user preferences.) From the Mac OS X desktop, just click on the XDarwin icon in the dock to switch back to the X window desktop.</p> +<h3>Multi-Button Mouse Emulation</h3> +<p>Many X11 applications rely on the use of a 3-button mouse. To emulate a 3-button mouse with a single button, select "Enable emulation of multiple mouse buttons" in the Preferences. This will take effect the next time the X server is started. When emulating a 3-button mouse, holding down the left command key and clicking the mouse button will simulate clicking the second mouse button. Holding down the left option key and clicking will simulate the third button.</p> +<p>Notes:</p> +<ul> + <li>With most keyboards the left and right command and option keys are not differentiated so either will work. + <li>Even with command and/or option keys mapped to some other key with xmodmap, you still must use the original command and option keys for multibutton mouse emulation. + <li>The only way to simulate holding down the left command key and clicking the second mouse button is to map some other key to be the left command key. The same is true for simulating holding down the left option key and clicking the third mouse button. +</ul> +<h2><a NAME="path">Setting Your Path</a></h2> +<p>The X11 binaries are located in /usr/X11R6/bin, which you may need to add to your path. Your path is the list of directories to be searched for executable commands. The way to do this depends on the shell you are using. With tcsh, you can check your path by typing "printenv PATH". You should see /usr/X11R6/bin listed as one of the directories. If not, you should add it to your default path. To do so, you can add the following line to a file in your home directory called .cshrc: (Create this file if you don't have one yet.)</p> +<blockquote>setenv PATH "${PATH}:/usr/X11R6/bin"</blockquote> +<p>Note that you will need to start a new Terminal window for any changes you make in .cshrc to take effect. You may also want to add the man pages from XFree86 to the list of pages to be searched when you are looking for documentation. The X11 man pages are located in /usr/X11R6/man and the MANPATH environment variable contains the list of directories to search.</p> +<h2><a NAME="license">License</a></h2> +The XFree86 Project is commited to providing freely redistributable binary and source releases. The main license we use is one based on the traditional MIT X11 / X Consortium License, which doesn't impose any conditions on modification or redistribution of source code or binaries other than requiring that copyright/license notices are left intact. For more information and additional copyright/licensing notices covering some sections of the code, please see the <A HREF="http://www.xfree86.org/legal/licence.html">XFree86 +License page</A>. +<H3><A NAME="3"></A>X Consortium License</H3> +<p>Copyright (C) 1996 X Consortium</p> +<p>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:</p> +<p>The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software.</p> +<p>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.</p> +<p>Except as contained in this notice, the name of the X Consortium 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 X Consortium.</p> +<p>X Window System is a trademark of X Consortium, Inc.</p> +</body> +</html> diff --git a/xc/programs/Xserver/hw/darwin/bundle/Imakefile b/xc/programs/Xserver/hw/darwin/bundle/Imakefile new file mode 100644 index 000000000..a8c0416ce --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Imakefile @@ -0,0 +1,53 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/darwin/bundle/Imakefile,v 1.7 2001/04/02 05:18:50 torrey Exp $ + +#include <Server.tmpl> + +SRCS = Preferences.m \ + XApplication.m \ + Xserver.m \ + quartz.c \ + quartzAudio.c \ + quartzCocoa.m \ + quartzCursor.c \ + quartzPasteboard.c + +OBJS = Preferences.o \ + XApplication.o \ + Xserver.o \ + quartz.o \ + quartzAudio.o \ + quartzCocoa.o \ + quartzCursor.o \ + quartzPasteboard.o + +INCLUDES = -I. -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(FONTINCSRC) + +#if defined(XFree86CustomVersion) +CUSTOMVERSION = XFree86CustomVersion +CUSTOMVERDEF = -DXF86_CUSTOM_VERSION='$(CUSTOMVERSION)' +#endif + +DEFINES = $(CUSTOMVERDEF) -DXBINDIR=$(DESTDIR)$(BINDIR) +XDARWINBINDIR = $(DESTDIR)$(BINDIR)/XDarwin.app/Contents/MacOS + +NormalLibraryObjectRule() +NormalLibraryTarget(XQuartz,$(OBJS)) + +AllTarget(quartzStartup.o) + +AllTarget(XDarwinStartup) +NormalProgramTarget(XDarwinStartup,XDarwinStartup.o,NullParameter, \ + NullParameter,NullParameter) +InstallProgram(XDarwinStartup,$(DESTDIR)$(BINDIR)) +install:: + -(cd $(DESTDIR)$(BINDIR); $(RM) X; $(LN) XDarwinStartup X) + +install:: + pbxbuild install -target XDarwin DSTROOT=$(DESTDIR)$(BINDIR) + +clean:: + pbxbuild "clean" -target XDarwin + +DependTarget() + diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Credits.rtf b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Credits.rtf new file mode 100644 index 000000000..452a4a044 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Credits.rtf @@ -0,0 +1,10 @@ +{\rtf1\mac\ansicpg10000{\fonttbl\f0\fswiss\fcharset77 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural + +\f0\fs24 \cf0 John Carmack - Original XFree86 port to Mac OS X Server\ +Dave Zarzycki - XFree86 4.0 port to Darwin 1.0\ +Torrey T. Lyons - Improvements and bug fixes\ +Gregory Robert Parker - Original Quartz implementation\ +Andreas Monitzer - Cocoa version of Xmaster\ +Toshimitsu Tanaka - Japanese translation} diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/InfoPlist.strings b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..600065eb8 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/InfoPlist.strings diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..eedf1299d --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib new file mode 100644 index 000000000..3c4afe987 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib @@ -0,0 +1,39 @@ +{ + IBClasses = ( + { + ACTIONS = {showHelp = id; }; + CLASS = FirstResponder; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + }, + { + ACTIONS = {close = id; saveChanges = id; setKey = id; }; + CLASS = Preferences; + LANGUAGE = ObjC; + OUTLETS = { + displayNumber = id; + fakeButton = id; + keyField = id; + splashStartupHelpButton = id; + startupHelpButton = id; + systemBeepButton = id; + window = id; + }; + SUPERCLASS = NSObject; + }, + { + CLASS = XApplication; + LANGUAGE = ObjC; + OUTLETS = {preferences = id; xserver = id; }; + SUPERCLASS = NSApplication; + }, + { + ACTIONS = {applicationWillResignActive = id; closeHelpAndShow = id; }; + CLASS = Xserver; + LANGUAGE = ObjC; + OUTLETS = {helpWindow = id; startupHelpButton = id; }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib new file mode 100644 index 000000000..e2f8cf545 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>IBDocumentLocation</key> + <string>14 4 367 304 0 4 800 574 </string> + <key>IBMainMenuLocation</key> + <string>18 269 262 44 0 4 800 574 </string> + <key>IBUserGuides</key> + <dict> + <key>HelpPanel</key> + <dict> + <key>guideLocations</key> + <array/> + <key>guidesLocked</key> + <string>NO</string> + </dict> + <key>PrefPanel</key> + <dict> + <key>guideLocations</key> + <array/> + <key>guidesLocked</key> + <string>NO</string> + </dict> + </dict> +</dict> +</plist> diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib Binary files differnew file mode 100644 index 000000000..1d79a36c7 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html new file mode 100644 index 000000000..b4b1a4741 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html @@ -0,0 +1,126 @@ +<!-- $XFree86: xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html,v 1.2 2001/04/05 06:08:47 torrey Exp $ --> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=EUC-JP"> +<title> +XFree86 for Mac OS X</title></head> +<body> +<center> +<h1> +Darwin ¤È Mac OS X ¾å¤Î XFree86 +</h1> +</center> +<h2> +Ìܼ¡ +</h2> +<ol> +<li> +<A HREF="#notice">Ãí°Õ»ö¹à</A> +</li> +<li> +<A HREF="#usage">»ÈÍÑË¡</A> +</li> +<li> +<A HREF="#path">¥Ñ¥¹¤ÎÀßÄê</A> +</li> +<li> +<A HREF="#license">¥é¥¤¥»¥ó¥¹</A> +</li> +</ol> +<center> +<h2> +<a NAME="notice">Ãí°Õ»ö¹à</a> +</h2> +</center> +<blockquote> +¤³¤ì¤Ï¡¤XFree86 ¤Î¥×¥ì¥ê¥ê¡¼¥¹¥Ð¡¼¥¸¥ç¥ó¤Ç¤¢¤ê¡¤¤¤¤«¤Ê¤ë¾ì¹ç¤Ë¤ª¤¤¤Æ¤â¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó¡£ +ËÜ¥½¥Õ¥È¥¦¥§¥¢¤Ï¡¤<A HREF="#license">MIT X11/X Consortium License</A> ¤Î¾ò·ï¤Ë´ð¤Å¤¡¤ÊݾÚ̵¤·¤Ç¡¤¡Ö¤½¤Î¤Þ¤Þ¡×¤Î·Á¤Ç¶¡µë¤µ¤ì¤Þ¤¹¡£ +¤´»ÈÍѤˤʤëÁ°¤Ë¡¤<A HREF="#license">¥é¥¤¥»¥ó¥¹</A>¤òÆÉ¤ó¤Ç²¼¤µ¤¤¡£ +¥Ð¥°¤ÎÊó¹ð¤ä¥Ñ¥Ã¥Á¤¬ SourceForge ¤Î <A HREF="http://sourceforge.net/projects/xonx/">XonX ¥×¥í¥¸¥§¥¯¥È¥Ú¡¼¥¸</A>¤ËÄó½Ð¤µ¤ì¤Æ¤¤¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£ +¥×¥ì¥ê¥ê¡¼¥¹¥Ð¡¼¥¸¥ç¥ó¤Î¥Ð¥°¤òÊó¹ð¤¹¤ëÁ°¤Ë¡¤<A HREF="http://sourceforge.net/projects/xonx/">XonX</A> ¥×¥í¥¸¥§¥¯¥È¥Ú¡¼¥¸¤Þ¤¿¤Ï <A HREF="http://www.XFree86.Org/cvs">XFree86 CVS ÁÒ¸Ë</A>¤ÇºÇ¿·ÈǤΥÁ¥§¥Ã¥¯¤ò¤·¤Æ²¼¤µ¤¤¡£ +</blockquote> +<h2> +<a NAME="usage">»ÈÍÑË¡</a> +</h2> +<p> +Mac OS X ¾å¤Ç¡¤XFree86¤Ï¥Õ¥ë¥¹¥¯¥ê¡¼¥ó¥â¡¼¥É¤Çưºî¤·¤Þ¤¹¡£ +X Window ¥Ç¥¹¥¯¥È¥Ã¥×¤¬¥¢¥¯¥Æ¥£¥Ö¤Ê»þ¡¤¤½¤ì¤ÏÁ´²èÌ̤òÀêͤ·¤Þ¤¹¡£ +¤¢¤Ê¤¿¤Ï¡¤Command-Option-A ¥¡¼¤ò²¡¤¹¤³¤È¤Ë¤è¤Ã¤Æ Mac OS X ¥Ç¥¹¥¯¥È¥Ã¥×¤ØÀÚ¤êÂØ¤¨¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ +¡Ê¤³¤Î¥¡¼¤ÎÁȤ߹ç¤ï¤»¤Ï¡¤´Ä¶ÀßÄê¤ÇÊѹ¹²Äǽ¤Ç¤¹¡Ë +Mac OS X ¥Ç¥¹¥¯¥È¥Ã¥×¤«¤é¡¤X Window ¥Ç¥¹¥¯¥È¥Ã¥×¤ØÀÚ¤êÂØ¤¨¤ë¾ì¹ç¤Ï¡¤¥É¥Ã¥¯¤Ëɽ¼¨¤µ¤ì¤¿ XDarwin ¥¢¥¤¥³¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ²¼¤µ¤¤¡£ +</p> +<h3> +Ê£¿ô¥Ü¥¿¥ó¥Þ¥¦¥¹¤Î¥¨¥ß¥å¥ì¡¼¥·¥ç¥ó +</h3> +<p> +¿¤¯¤Î X11 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¤3 ¥Ü¥¿¥ó¥Þ¥¦¥¹¤òɬÍפȤ·¤Þ¤¹¡£ +1 ¥Ü¥¿¥ó¥Þ¥¦¥¹¤Ç 3 ¥Ü¥¿¥ó¥Þ¥¦¥¹¤ò¥¨¥ß¥å¥ì¡¼¥·¥ç¥ó¤¹¤ë¤Ë¤Ï¡¤´Ä¶ÀßÄê¤Ç¡ÖÊ£¿ô¥Ü¥¿¥ó¥Þ¥¦¥¹¤Î¥¨¥ß¥å¥ì¡¼¥·¥ç¥ó¤ò͸ú¤Ë¤¹¤ë¡×¤òÁªÂò¤·¤Þ¤¹¡£ +¤³¤ì¤Ï¡¤¼¡²ó¤Î X ¥µ¡¼¥Ð¡¼¤Îµ¯Æ°»þ¤è¤ê͸ú¤È¤Ê¤ê¤Þ¤¹¡£ + +3 ¥Ü¥¿¥ó¥Þ¥¦¥¹¤ò¥¨¥ß¥å¥ì¡¼¥·¥ç¥ó¤¹¤ë»þ¡¤º¸¤Î¥³¥Þ¥ó¥É¥¡¼¤ò²¡¤·¤Ê¤¬¤é¥Þ¥¦¥¹¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤³¤È¤ÏÂè 2 ¥Þ¥¦¥¹¥Ü¥¿¥ó¤Î¥¯¥ê¥Ã¥¯¤ËÁêÅö¤·¤Þ¤¹¡£º¸¤Î¥ª¥×¥·¥ç¥ó¥¡¼¤ò²¡¤·¤Ê¤¬¤é¥¯¥ê¥Ã¥¯¤¹¤ë¤³¤È¤ÏÂè 3 ¥Þ¥¦¥¹¥Ü¥¿¥ó¤Î¥¯¥ê¥Ã¥¯¤ËÁêÅö¤·¤Þ¤¹¡£ +</p> +<p> +Ãí¡§ +</p> +<ul> +<li> +¿¤¯¤Î¥¡¼¥Ü¡¼¥É¤Ç¤Ï¡¤º¸±¦¤Î¥³¥Þ¥ó¥É¥¡¼¤È¥ª¥×¥·¥ç¥ó¥¡¼¤Ï¶èÊ̤µ¤ì¤º¡¤Æ±¤¸Æ°ºî¤ò¤·¤Þ¤¹¡£ +<li> +xmodmap ¤Ç¥³¥Þ¥ó¥É¥¡¼¤ä¥ª¥×¥·¥ç¥ó¥¡¼¤ò¾¤Î¥¡¼¤Ë³ä¤êÅö¤Æ¤Æ¤¤¤ë¾ì¹ç¤Ç¤â¡¤Ê£¿ô¥Ü¥¿¥ó¥Þ¥¦¥¹¤Î¥¨¥ß¥å¥ì¡¼¥·¥ç¥ó¤Ç¤ÏËÜÍè¤Î¥³¥Þ¥ó¥É¥¡¼¤ä¥ª¥×¥·¥ç¥ó¥¡¼¤ò»È¤ï¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ +<li> +º¸¤Î¥³¥Þ¥ó¥É¥¡¼¤ò²¡¤·¤Ê¤¬¤éÂè 2 ¥Þ¥¦¥¹¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤³¤È¤ò¼Â¸½¤¹¤ë¤Ë¤Ï¡¤º¸¤Î¥³¥Þ¥ó¥É¥¡¼¤ò¾¤Î¥¡¼¤Ë³ä¤êÅö¤Æ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£º¸¤Î¥ª¥×¥·¥ç¥ó¥¡¼¤ò²¡¤·¤Ê¤¬¤éÂè 3 ¥Þ¥¦¥¹¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¾ì¹ç¤âƱÍͤǤ¹¡£ +</ul> +<h2> +<a NAME="path">¥Ñ¥¹¤ÎÀßÄê</a> +</h2> +<p> +X11 ¥Ð¥¤¥Ê¥ê¤Ï¡¤/usr/X11R6/bin ¤ËÃÖ¤«¤ì¤Þ¤¹¡£¤¢¤Ê¤¿¤Ï¤½¤ì¤ò¥Ñ¥¹¤Ë²Ã¤¨¤ëɬÍפ¬¤¢¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£ +¥Ñ¥¹¤Ï¡¤ ¼Â¹Ô²Äǽ¤Ê¥³¥Þ¥ó¥É¤ò¸¡º÷¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Î¥ê¥¹¥È¤Ç¤¹¡£ +¤³¤ì¤ò³Îǧ¤¹¤ëÊýË¡¤Ï¡¤»ÈÍѤ·¤Æ¤¤¤ë¥·¥§¥ë¤Ë°Í¸¤·¤Þ¤¹¡£ +tcsh ¤Ç¤Ï¡¤¡Öprintenv PATH¡×¤È¥¿¥¤¥×¤¹¤ë¤³¤È¤Ç¥Ñ¥¹¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ +¥Ñ¥¹¤ò¥Á¥§¥Ã¥¯¤·¤¿»þ¡¤/usr/X11R6/bin ¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Î¤Ò¤È¤Ä¤È¤·¤ÆÉ½¼¨¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ +¤â¤·¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¤¤¢¤Ê¤¿¤Ï¤½¤ì¤ò¥Ç¥Õ¥©¥ë¥È¤Î¥Ñ¥¹¤ËÄɲ乤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ +¤½¤Î¤¿¤á¤Ë¡¤¤¢¤Ê¤¿¤Î¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ë¡Ö.cshrc¡×¤È¤¤¤¦Ì¾¾Î¤Î¥Õ¥¡¥¤¥ë¤Ë¼¡¤Î¹Ô¤òÄɲ䷤Ʋ¼¤µ¤¤¡£ +¡Ê¤â¤·¤³¤Î¥Õ¥¡¥¤¥ë¤¬¤Þ¤À̵¤±¤ì¤ÐºîÀ®¤·¤Æ²¼¤µ¤¤¡Ë +</p> +<blockquote> +setenv PATH "${PATH}:/usr/X11R6/bin" +</blockquote> +<p> +¡Ö.cshrc¡×¥Õ¥¡¥¤¥ë¤Ø¤ÎÊѹ¹¤ò͸ú¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¡¤¿·¤¿¤Ë Terminal ¥¦¥£¥ó¥É¥¦¤ò³«»Ï¤¹¤ëɬÍפ¬¤¢¤ë¤³¤È¤ËÃí°Õ¤·¤Æ²¼¤µ¤¤¡£ +¤Þ¤¿¡¤¤¢¤Ê¤¿¤Ï¥É¥¥å¥á¥ó¥È¤òõ¤·¤Æ¤¤¤ë»þ¡¤XFree86 ¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤ò¸¡º÷¤µ¤ì¤ë¥Ú¡¼¥¸¤Î¥ê¥¹¥È¤ËÄɲä·¤¿¤¤¤È»×¤¦¤«¤â¤·¤ì¤Þ¤»¤ó¡£ +X11 ¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ï /usr/X11R6/man ¤ËÃÖ¤«¤ì¤Þ¤¹¡£¤½¤·¤Æ MANPATH ´Ä¶ÊÑ¿ô¤Ï¸¡º÷¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Î¥ê¥¹¥È¤ò´Þ¤ó¤Ç¤¤¤Þ¤¹¡£ +</p> +<h2> +<a NAME="license">¥é¥¤¥»¥ó¥¹</a> +</h2> +XFree86 Project ¤Ï¡¤¼«Í³¤ËºÆÇÛÉÛ²Äǽ¤Ê¥Ð¥¤¥Ê¥ê¤È¥½¡¼¥¹¥³¡¼¥É¤òÄ󶡤¹¤ë¤³¤È¤òÌ󫤷¤Þ¤¹¡£ +»ä¤¿¤Á¤¬»ÈÍѤ¹¤ë¼ç¤Ê¥é¥¤¥»¥ó¥¹¤Ï¡¤ÅÁÅýŪ¤Ê MIT X11/X Consortium License ¤Ë´ð¤Å¤¯¤â¤Î¤Ç¤¹¡£ +¤½¤·¤Æ¡¤¤½¤ì¤Ï½¤Àµ¤Þ¤¿¤ÏºÆÇÛÉÛ¤µ¤ì¤ë¥½¡¼¥¹¥³¡¼¥É¤Þ¤¿¤Ï¥Ð¥¤¥Ê¥ê¤Ë¡¤¤½¤Î Copyright/¥é¥¤¥»¥ó¥¹¹ð¼¨¤¬¤½¤Î¤Þ¤Þ»Ä¤µ¤ì¤ë¤³¤È¤òÍ׵᤹¤ë°Ê³°¤Î¾ò·ï¤ò¶¯À©¤·¤Þ¤»¤ó¡£ +¤è¤ê¿¤¯¤Î¾ðÊó¤È¡¤¥³¡¼¥É¤Î°ìÉô¤ò¥«¥Ð¡¼¤¹¤ëÄɲäΠCopyright/¥é¥¤¥»¥ó¥¹¹ð¼¨¤Î¤¿¤á¤Ë¡¤<A HREF="http://www.xfree86.org/legal/licence.html">XFree86 ¤Î License ¥Ú¡¼¥¸</A>¤ò»²¾È¤·¤Æ²¼¤µ¤¤¡£ +<H3> +<A NAME="3"></A> +X Consortium License</H3> +<p>Copyright (C) 1996 X Consortium</p> +<p>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:</p> +<p>The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software.</p> +<p>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.</p> +<p>Except as contained in this notice, the name of the X Consortium 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 X Consortium.</p> +<p>X Window System is a trademark of X Consortium, Inc.</p> +</body> +</html> diff --git a/xc/programs/Xserver/hw/darwin/bundle/Preferences.h b/xc/programs/Xserver/hw/darwin/bundle/Preferences.h new file mode 100644 index 000000000..f2a6ba724 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Preferences.h @@ -0,0 +1,44 @@ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Preferences.h,v 1.2 2001/04/05 06:08:46 torrey Exp $ */ + +#import <Cocoa/Cocoa.h> + +@interface Preferences : NSObject +{ + IBOutlet NSPanel *window; + IBOutlet id keyField; + IBOutlet id fakeButton; + IBOutlet id displayNumber; + IBOutlet id startupHelpButton; + IBOutlet id systemBeepButton; + IBOutlet id splashStartupHelpButton; + + BOOL isGettingKeyCode; + int keyCode; + int modifiers; + NSMutableString *switchString; +} +- (IBAction)close:(id)sender; +- (IBAction)saveChanges:(id)sender; +- (IBAction)setKey:(id)sender; + +- (BOOL)sendEvent:(NSEvent*)anEvent; + +- (void)awakeFromNib; + ++ (void)setSwitchString:(NSString*)newString; ++ (void)setKeyCode:(int)newKeyCode; ++ (void)setModifiers:(int)newModifiers; ++ (void)setDisplay:(int)newDisplay; ++ (void)setFakeButtons:(BOOL)newFakeButtons; ++ (void)setStartupHelp:(BOOL)newStartupHelp; ++ (void)setSystemBeep:(BOOL)newSystemBeep; + ++ (NSString*)switchString; ++ (unsigned int)keyCode; ++ (unsigned int)modifiers; ++ (int)display; ++ (BOOL)fakeButtons; ++ (BOOL)startupHelp; ++ (BOOL)systemBeep; + +@end diff --git a/xc/programs/Xserver/hw/darwin/bundle/Preferences.m b/xc/programs/Xserver/hw/darwin/bundle/Preferences.m new file mode 100644 index 000000000..968f9aff7 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Preferences.m @@ -0,0 +1,177 @@ +// +// Preferences.m +// +// This class keeps track of the user preferences. +// +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Preferences.m,v 1.2 2001/04/05 06:08:46 torrey Exp $ */ + +#import "Preferences.h" +#import "quartzShared.h" + +@implementation Preferences + +// Initialize internal state info of switch key button +- (void)initSwitchKey { + keyCode = [Preferences keyCode]; + modifiers = [Preferences modifiers]; + [switchString setString:[Preferences switchString]]; +} + +- (id)init { + self=[super init]; + + isGettingKeyCode=NO; + switchString=[[NSMutableString alloc] init]; + + // Provide user defaults if needed + if([[NSUserDefaults standardUserDefaults] stringForKey:@"SwitchKeyCode"]==nil) { + [Preferences setKeyCode:0]; + [Preferences setModifiers:(NSCommandKeyMask | NSAlternateKeyMask)]; + [Preferences setSwitchString:@"Cmd-Opt-a"]; + [Preferences setDisplay:0]; + [Preferences setFakeButtons:YES]; + [Preferences setStartupHelp:YES]; + [Preferences setSystemBeep:NO]; + } + + [self initSwitchKey]; + + return self; +} + +// Set the window controls to the state in user defaults +- (void)resetWindow { + [keyField setTitle:[Preferences switchString]]; + [displayNumber setIntValue:[Preferences display]]; + [fakeButton setIntValue:[Preferences fakeButtons]]; + [startupHelpButton setIntValue:[Preferences startupHelp]]; + [systemBeepButton setIntValue:[Preferences systemBeep]]; +} + +- (void)awakeFromNib { + [self resetWindow]; + [splashStartupHelpButton setIntValue:[Preferences startupHelp]]; +} + +// User cancelled the changes +- (IBAction)close:(id)sender +{ + [window orderOut:nil]; + [self resetWindow]; // reset window controls + [self initSwitchKey]; // reset switch key state +} + +// User saved changes +- (IBAction)saveChanges:(id)sender +{ + [Preferences setKeyCode:keyCode]; + [Preferences setModifiers:modifiers]; + [Preferences setSwitchString:switchString]; + [Preferences setDisplay:[displayNumber intValue]]; + [Preferences setFakeButtons:[fakeButton intValue]]; + [Preferences setStartupHelp:[startupHelpButton intValue]]; + [Preferences setSystemBeep:[systemBeepButton intValue]]; + + // Update the settings used by the X server thread + quartzUseSysBeep = [Preferences systemBeep]; + darwinFakeButtons = [Preferences fakeButton]; + + [window orderOut:nil]; +} + +- (IBAction)setKey:(id)sender +{ + [keyField setTitle:@"Press key"]; + isGettingKeyCode=YES; + [switchString setString:@""]; +} + +- (BOOL)sendEvent:(NSEvent*)anEvent { + if(isGettingKeyCode) { + if([anEvent type]==NSKeyDown) //wait for keyup + return YES; + if([anEvent type]!=NSKeyUp) + return NO; + + if([anEvent modifierFlags] & NSCommandKeyMask) + [switchString appendString:@"Cmd-"]; + if([anEvent modifierFlags] & NSControlKeyMask) + [switchString appendString:@"Ctrl-"]; + if([anEvent modifierFlags] & NSAlternateKeyMask) + [switchString appendString:@"Opt-"]; + if([anEvent modifierFlags] & NSNumericPadKeyMask) // doesn't work + [switchString appendString:@"Num-"]; + if([anEvent modifierFlags] & NSHelpKeyMask) + [switchString appendString:@"Help-"]; + if([anEvent modifierFlags] & NSFunctionKeyMask) // powerbooks only + [switchString appendString:@"Fn-"]; + + [switchString appendString:[anEvent charactersIgnoringModifiers]]; + [keyField setTitle:switchString]; + + keyCode = [anEvent keyCode]; + modifiers = [anEvent modifierFlags]; + isGettingKeyCode=NO; + + return YES; + } + return NO; +} + ++ (void)setSwitchString:(NSString*)newString { + [[NSUserDefaults standardUserDefaults] setObject:newString forKey:@"SwitchString"]; +} + ++ (void)setKeyCode:(int)newKeyCode { + [[NSUserDefaults standardUserDefaults] setInteger:newKeyCode forKey:@"SwitchKeyCode"]; +} + ++ (void)setModifiers:(int)newModifiers { + [[NSUserDefaults standardUserDefaults] setInteger:newModifiers forKey:@"SwitchModifiers"]; +} + ++ (void)setDisplay:(int)newDisplay { + [[NSUserDefaults standardUserDefaults] setInteger:newDisplay forKey:@"Display"]; +} + ++ (void)setFakeButtons:(BOOL)newFakeButtons { + [[NSUserDefaults standardUserDefaults] setBool:newFakeButtons forKey:@"FakeButtons"]; +} + ++ (void)setStartupHelp:(BOOL)newStartupHelp { + [[NSUserDefaults standardUserDefaults] setBool:newStartupHelp forKey:@"ShowStartupHelp"]; +} + ++ (void)setSystemBeep:(BOOL)newSystemBeep { + [[NSUserDefaults standardUserDefaults] setBool:newSystemBeep forKey:@"UseSystemBeep"]; +} + ++ (NSString*)switchString { + return [[NSUserDefaults standardUserDefaults] stringForKey:@"SwitchString"]; +} + ++ (unsigned int)keyCode { + return [[NSUserDefaults standardUserDefaults] integerForKey:@"SwitchKeyCode"]; +} + ++ (unsigned int)modifiers { + return [[NSUserDefaults standardUserDefaults] integerForKey:@"SwitchModifiers"]; +} + ++ (int)display { + return [[NSUserDefaults standardUserDefaults] integerForKey:@"Display"]; +} + ++ (BOOL)fakeButtons { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"FakeButtons"]; +} + ++ (BOOL)startupHelp { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"ShowStartupHelp"]; +} + ++ (BOOL)systemBeep { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"UseSystemBeep"]; +} + +@end diff --git a/xc/programs/Xserver/hw/darwin/bundle/XApplication.h b/xc/programs/Xserver/hw/darwin/bundle/XApplication.h new file mode 100644 index 000000000..40b2046eb --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/XApplication.h @@ -0,0 +1,20 @@ +// +// NSXApplication.h +// Xmaster project +// +// Created by Andreas Monitzer on January 6, 2001. +// + +#import <Cocoa/Cocoa.h> + +#import "Xserver.h" +#import "Preferences.h" + +@interface XApplication : NSApplication { + IBOutlet Xserver *xserver; + IBOutlet Preferences *preferences; +} + +- (void)sendEvent:(NSEvent *)anEvent; + +@end diff --git a/xc/programs/Xserver/hw/darwin/bundle/XApplication.m b/xc/programs/Xserver/hw/darwin/bundle/XApplication.m new file mode 100644 index 000000000..4920e0688 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/XApplication.m @@ -0,0 +1,20 @@ +// +// XApplication.m +// Xmaster project +// +// Created by Andreas Monitzer on January 6, 2001. +// + +#import "XApplication.h" + + +@implementation XApplication + +- (void)sendEvent:(NSEvent*)anEvent { + if(![xserver translateEvent:anEvent]) { + if(![preferences sendEvent:anEvent]) + [super sendEvent:anEvent]; + } +} + +@end diff --git a/xc/programs/Xserver/hw/darwin/bundle/XDarwin.icns b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.icns Binary files differnew file mode 100644 index 000000000..36b0c834d --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.icns diff --git a/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj new file mode 100644 index 000000000..877e20104 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj @@ -0,0 +1,735 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 32; + objects = { + 01279092000747AA0A000002 = { + isa = PBXFileReference; + path = Xserver.m; + refType = 4; + }; + 0127909600074AF60A000002 = { + isa = PBXFileReference; + path = XApplication.m; + refType = 4; + }; + 0127909800074B1A0A000002 = { + isa = PBXFileReference; + path = XApplication.h; + refType = 4; + }; + 015698ED003DF345CE6F79C2 = { + isa = PBXFileReference; + path = XDarwin.icns; + refType = 4; + }; + 0157A37D002CF6D7CE6F79C2 = { + children = ( + 0157A37E002CF6D7CE6F79C2, + 43B962E200617B93416877C2, + ); + isa = PBXVariantGroup; + name = Credits.rtf; + path = ""; + refType = 4; + }; + 0157A37E002CF6D7CE6F79C2 = { + isa = PBXFileReference; + name = English; + path = English.lproj/Credits.rtf; + refType = 4; + }; + 015EDCC000420083CE6F79C2 = { + isa = PBXFileReference; + name = libdix.a; + path = dix/libdix.a; + refType = 4; + }; + 015EDCC20042012ACE6F79C2 = { + isa = PBXFileReference; + name = libos.a; + path = os/libos.a; + refType = 4; + }; + 015EDCC400420160CE6F79C2 = { + isa = PBXFileReference; + name = libXau.a; + path = ../../lib/Xau/libXau.a; + refType = 4; + }; + 015EDCC60042017CCE6F79C2 = { + isa = PBXFileReference; + name = libXdmcp.a; + path = ../../lib/Xdmcp/libXdmcp.a; + refType = 4; + }; + 015EDCC8004201A8CE6F79C2 = { + isa = PBXFileReference; + name = libdarwin.a; + path = hw/darwin/libdarwin.a; + refType = 4; + }; + 015EDCCA004201C1CE6F79C2 = { + isa = PBXFileReference; + name = libcfb.a; + path = cfb/libcfb.a; + refType = 4; + }; + 015EDCCC004201E4CE6F79C2 = { + isa = PBXFileReference; + name = libcfb16.a; + path = cfb16/libcfb16.a; + refType = 4; + }; + 015EDCCE004201F2CE6F79C2 = { + isa = PBXFileReference; + name = libcfb.a; + path = cfb/libcfb.a; + refType = 4; + }; + 015EDCD0004201FCCE6F79C2 = { + isa = PBXFileReference; + name = libcfb32.a; + path = cfb32/libcfb32.a; + refType = 4; + }; + 015EDCD20042020BCE6F79C2 = { + isa = PBXFileReference; + name = libcfb.a; + path = cfb/libcfb.a; + refType = 4; + }; + 015EDCD400420227CE6F79C2 = { + isa = PBXFileReference; + name = libmfb.a; + path = mfb/libmfb.a; + refType = 4; + }; + 015EDCD60042023DCE6F79C2 = { + isa = PBXFileReference; + name = libxpstubs.a; + path = dix/libxpstubs.a; + refType = 4; + }; + 015EDCD80042024ECE6F79C2 = { + isa = PBXFileReference; + name = libmi.a; + path = mi/libmi.a; + refType = 4; + }; + 015EDCDA00420266CE6F79C2 = { + isa = PBXFileReference; + name = libext.a; + path = Xext/libext.a; + refType = 4; + }; + 015EDCDC00420279CE6F79C2 = { + isa = PBXFileReference; + name = libxkb.a; + path = xkb/libxkb.a; + refType = 4; + }; + 015EDCDE00420295CE6F79C2 = { + isa = PBXFileReference; + name = liblbx.a; + path = lbx/liblbx.a; + refType = 4; + }; + 015EDCE0004202BACE6F79C2 = { + isa = PBXFileReference; + name = liblbxutil.a; + path = ../../lib/lbxutil/liblbxutil.a; + refType = 4; + }; + 015EDCE2004202DECE6F79C2 = { + isa = PBXFileReference; + name = libdbe.a; + path = dbe/libdbe.a; + refType = 4; + }; + 015EDCE4004202F2CE6F79C2 = { + isa = PBXFileReference; + name = librecord.a; + path = record/librecord.a; + refType = 4; + }; + 015EDCE600420319CE6F79C2 = { + isa = PBXFileReference; + name = libXfont.a; + path = ../../lib/font/libXfont.a; + refType = 4; + }; + 015EDCE800420346CE6F79C2 = { + isa = PBXFileReference; + name = libxpstubs.a; + path = dix/libxpstubs.a; + refType = 4; + }; + 015EDCEA004203A8CE6F79C2 = { + isa = PBXFrameworkReference; + name = IOKit.framework; + path = /System/Library/Frameworks/IOKit.framework; + refType = 0; + }; + 018F40F2003E1902CE6F79C2 = { + children = ( + 018F40F3003E1916CE6F79C2, + 021D6BA9003E1BACCE6F79C2, + 018F40F6003E1974CE6F79C2, + ); + isa = PBXGroup; + name = "X Server"; + path = ..; + refType = 2; + }; + 018F40F3003E1916CE6F79C2 = { + isa = PBXFileReference; + path = darwin.c; + refType = 4; + }; + 018F40F6003E1974CE6F79C2 = { + isa = PBXFileReference; + path = darwinKeyboard.c; + refType = 4; + }; + 018F40F8003E1979CE6F79C2 = { + isa = PBXFileReference; + path = quartz.c; + refType = 4; + }; + 018F40FA003E197ECE6F79C2 = { + isa = PBXFileReference; + path = quartz.h; + refType = 4; + }; + 018F40FC003E1983CE6F79C2 = { + isa = PBXFileReference; + path = xfIOKit.c; + refType = 4; + }; + 018F40FE003E1988CE6F79C2 = { + isa = PBXFileReference; + path = xfIOKit.h; + refType = 4; + }; + 018F4100003E19E4CE6F79C2 = { + isa = PBXFileReference; + path = xfIOKitCursor.c; + refType = 4; + }; + 021D6BA9003E1BACCE6F79C2 = { + isa = PBXFileReference; + path = darwin.h; + refType = 4; + }; + 02A1FEA6006D34BE416877C2 = { + isa = PBXFileReference; + path = xfIOKitStartup.c; + refType = 4; + }; + 02A1FEA8006D38F0416877C2 = { + isa = PBXFileReference; + path = quartzStartup.c; + refType = 4; + }; + 02E03CA000348209CE6F79C2 = { + children = ( + 02E03CA100348209CE6F79C2, + 43B962E300617B93416877C2, + ); + isa = PBXVariantGroup; + name = XDarwinHelp.html; + path = ""; + refType = 4; + }; + 02E03CA100348209CE6F79C2 = { + isa = PBXFileReference; + name = English; + path = English.lproj/XDarwinHelp.html; + refType = 4; + }; + 04329610000763920A000002 = { + isa = PBXFileReference; + path = Preferences.m; + refType = 4; + }; + 04329611000763920A000002 = { + isa = PBXFileReference; + path = Preferences.h; + refType = 4; + }; + 06EB6C3B004099E7CE6F79C2 = { + isa = PBXFileReference; + path = quartzShared.h; + refType = 4; + }; + 080E96DDFE201D6D7F000001 = { + children = ( + 01279092000747AA0A000002, + 1C4A3109004D8F24CE6F79C2, + 0127909600074AF60A000002, + 0127909800074B1A0A000002, + 04329610000763920A000002, + 04329611000763920A000002, + ); + isa = PBXGroup; + name = Classes; + refType = 4; + }; + 089C165CFE840E0CC02AAC07 = { + children = ( + 089C165DFE840E0CC02AAC07, + 43B962E100617B49416877C2, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + }; + 089C165DFE840E0CC02AAC07 = { + isa = PBXFileReference; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + }; + 0A79E19E004499A1CE6F79C2 = { + isa = PBXApplicationReference; + path = XDarwin.app; + refType = 3; + }; + 0A79E19F004499A1CE6F79C2 = { + buildPhases = ( + 0A79E1A0004499A1CE6F79C2, + 0A79E1A1004499A1CE6F79C2, + 0A79E1A2004499A1CE6F79C2, + 0A79E1A3004499A1CE6F79C2, + 0A79E1A4004499A1CE6F79C2, + ); + buildSettings = { + INSTALL_PATH = ""; + OPTIMIZATION_CFLAGS = ""; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = XDarwin; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + WRAPPER_EXTENSION = app; + }; + conditionalBuildSettings = { + }; + dependencies = ( + ); + isa = PBXApplicationTarget; + name = XDarwin; + productInstallPath = ""; + productName = XDarwin; + productReference = 0A79E19E004499A1CE6F79C2; + productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> +<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\"> +<plist version=\"0.9\"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>XDarwin</string> + <key>CFBundleGetInfoString</key> + <string>XFree86 Version 4.1</string> + <key>CFBundleIconFile</key> + <string>XDarwin.icns</string> + <key>CFBundleIdentifier</key> + <string>org.xfree86.XDarwin</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>XDarwin</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>XDarwin (v0.5)</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>0.5</string> + <key>NSHelpFile</key> + <string>XDarwinHelp.html</string> + <key>NSMainNibFile</key> + <string>MainMenu</string> + <key>NSPrincipalClass</key> + <string>XApplication</string> +</dict> +</plist> +"; + shouldUseHeadermap = 0; + }; + 0A79E1A0004499A1CE6F79C2 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXHeadersBuildPhase; + name = Headers; + }; + 0A79E1A1004499A1CE6F79C2 = { + buildActionMask = 2147483647; + files = ( + 0A79E1A600449EB2CE6F79C2, + 0A79E1A700449EB2CE6F79C2, + 0A79E1A800449EB2CE6F79C2, + 0A79E1A900449EB2CE6F79C2, + 0A79E1AA00449EB2CE6F79C2, + 1220774500712D2D416877C2, + ); + isa = PBXResourcesBuildPhase; + name = "Bundle Resources"; + }; + 0A79E1A2004499A1CE6F79C2 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXSourcesBuildPhase; + name = Sources; + }; + 0A79E1A3004499A1CE6F79C2 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + name = "Frameworks & Libraries"; + }; + 0A79E1A4004499A1CE6F79C2 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + name = "ResourceManager Resources"; + }; + 0A79E1A600449EB2CE6F79C2 = { + fileRef = 29B97318FDCFA39411CA2CEA; + isa = PBXBuildFile; + settings = { + }; + }; + 0A79E1A700449EB2CE6F79C2 = { + fileRef = 089C165CFE840E0CC02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 0A79E1A800449EB2CE6F79C2 = { + fileRef = 0157A37D002CF6D7CE6F79C2; + isa = PBXBuildFile; + settings = { + }; + }; + 0A79E1A900449EB2CE6F79C2 = { + fileRef = 02E03CA000348209CE6F79C2; + isa = PBXBuildFile; + settings = { + }; + }; + 0A79E1AA00449EB2CE6F79C2 = { + fileRef = 015698ED003DF345CE6F79C2; + isa = PBXBuildFile; + settings = { + }; + }; + 1058C7A0FEA54F0111CA2CBB = { + children = ( + 1058C7A1FEA54F0111CA2CBB, + 1BE4F84D0006C9890A000002, + 015EDCEA004203A8CE6F79C2, + ); + isa = PBXGroup; + name = "Linked Frameworks"; + refType = 4; + }; + 1058C7A1FEA54F0111CA2CBB = { + isa = PBXFrameworkReference; + name = Cocoa.framework; + path = /System/Library/Frameworks/Cocoa.framework; + refType = 0; + }; + 1058C7A2FEA54F0111CA2CBB = { + children = ( + 29B97325FDCFA39411CA2CEA, + 29B97324FDCFA39411CA2CEA, + ); + isa = PBXGroup; + name = "Other Frameworks"; + refType = 4; + }; + 1220774300712D2D416877C2 = { + children = ( + 1220774400712D2D416877C2, + 1220774600712D75416877C2, + ); + isa = PBXVariantGroup; + name = Localizable.strings; + path = ""; + refType = 4; + }; + 1220774400712D2D416877C2 = { + isa = PBXFileReference; + name = English; + path = English.lproj/Localizable.strings; + refType = 4; + }; + 1220774500712D2D416877C2 = { + fileRef = 1220774300712D2D416877C2; + isa = PBXBuildFile; + settings = { + }; + }; + 1220774600712D75416877C2 = { + isa = PBXFileReference; + name = Japanese; + path = Japanese.lproj/Localizable.strings; + refType = 4; + }; + 170DFAFF00729A35416877C2 = { + isa = PBXFileReference; + path = XDarwinStartup.c; + refType = 4; + }; + 170DFB0000729C86416877C2 = { + children = ( + 018F40FC003E1983CE6F79C2, + 018F40FE003E1988CE6F79C2, + 018F4100003E19E4CE6F79C2, + 02A1FEA6006D34BE416877C2, + ); + isa = PBXGroup; + name = "IOKit Support"; + path = ..; + refType = 2; + }; + 19C28FACFE9D520D11CA2CBB = { + children = ( + 0A79E19E004499A1CE6F79C2, + ); + isa = PBXGroup; + name = Products; + refType = 4; + }; + 1BE4F84D0006C9890A000002 = { + isa = PBXFrameworkReference; + name = Carbon.framework; + path = /System/Library/Frameworks/Carbon.framework; + refType = 0; + }; + 1C4A3109004D8F24CE6F79C2 = { + isa = PBXFileReference; + path = Xserver.h; + refType = 4; + }; + 237A34C10076E37E7F000001 = { + isa = PBXFileReference; + path = quartzAudio.c; + refType = 4; + }; + 237A34C20076E37E7F000001 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = NO; + }; + isa = PBXBuildStyle; + name = Development; + }; + 237A34C30076E37E7F000001 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = YES; + }; + isa = PBXBuildStyle; + name = Deployment; + }; + 237A34C40076F4F07F000001 = { + isa = PBXFileReference; + path = quartzAudio.h; + refType = 4; + }; + 29B97313FDCFA39411CA2CEA = { + buildStyles = ( + 237A34C20076E37E7F000001, + 237A34C30076E37E7F000001, + ); + isa = PBXProject; + mainGroup = 29B97314FDCFA39411CA2CEA; + targets = ( + 0A79E19F004499A1CE6F79C2, + ); + }; + 29B97314FDCFA39411CA2CEA = { + children = ( + 080E96DDFE201D6D7F000001, + 29B97315FDCFA39411CA2CEA, + 29B97317FDCFA39411CA2CEA, + 618092480041B0E4CE6F79C2, + 29B97323FDCFA39411CA2CEA, + 19C28FACFE9D520D11CA2CBB, + ); + isa = PBXGroup; + name = "Xmaster-Cocoa"; + path = ""; + refType = 4; + }; + 29B97315FDCFA39411CA2CEA = { + children = ( + 170DFAFF00729A35416877C2, + 018F40F2003E1902CE6F79C2, + 170DFB0000729C86416877C2, + 43B962CE00617089416877C2, + ); + isa = PBXGroup; + name = "Other Sources"; + path = ""; + refType = 2; + }; + 29B97317FDCFA39411CA2CEA = { + children = ( + 29B97318FDCFA39411CA2CEA, + 089C165CFE840E0CC02AAC07, + 1220774300712D2D416877C2, + 0157A37D002CF6D7CE6F79C2, + 02E03CA000348209CE6F79C2, + 015698ED003DF345CE6F79C2, + ); + isa = PBXGroup; + name = Resources; + path = ""; + refType = 4; + }; + 29B97318FDCFA39411CA2CEA = { + children = ( + 29B97319FDCFA39411CA2CEA, + 43B962E000617B49416877C2, + ); + isa = PBXVariantGroup; + name = MainMenu.nib; + path = ""; + refType = 4; + }; + 29B97319FDCFA39411CA2CEA = { + isa = PBXFileReference; + name = English; + path = English.lproj/MainMenu.nib; + refType = 4; + }; + 29B97323FDCFA39411CA2CEA = { + children = ( + 1058C7A0FEA54F0111CA2CBB, + 1058C7A2FEA54F0111CA2CBB, + ); + isa = PBXGroup; + name = Frameworks; + path = ""; + refType = 4; + }; + 29B97324FDCFA39411CA2CEA = { + isa = PBXFrameworkReference; + name = AppKit.framework; + path = /System/Library/Frameworks/AppKit.framework; + refType = 0; + }; + 29B97325FDCFA39411CA2CEA = { + isa = PBXFrameworkReference; + name = Foundation.framework; + path = /System/Library/Frameworks/Foundation.framework; + refType = 0; + }; + 3576829A0077B8F17F000001 = { + isa = PBXFileReference; + path = quartzCursor.c; + refType = 4; + }; + 43B962CE00617089416877C2 = { + children = ( + 018F40F8003E1979CE6F79C2, + 018F40FA003E197ECE6F79C2, + 237A34C10076E37E7F000001, + 237A34C40076F4F07F000001, + 3576829A0077B8F17F000001, + 43B962D000617089416877C2, + 43B962CF00617089416877C2, + 43B962D100617089416877C2, + 06EB6C3B004099E7CE6F79C2, + 02A1FEA8006D38F0416877C2, + ); + isa = PBXGroup; + name = "Quartz Support"; + refType = 4; + }; + 43B962CF00617089416877C2 = { + isa = PBXFileReference; + path = quartzCocoa.m; + refType = 4; + }; + 43B962D000617089416877C2 = { + isa = PBXFileReference; + path = quartzPasteboard.c; + refType = 4; + }; + 43B962D100617089416877C2 = { + isa = PBXFileReference; + path = quartzPasteboard.h; + refType = 4; + }; + 43B962E000617B49416877C2 = { + isa = PBXFileReference; + name = Japanese; + path = Japanese.lproj/MainMenu.nib; + refType = 4; + }; + 43B962E100617B49416877C2 = { + isa = PBXFileReference; + name = Japanese; + path = Japanese.lproj/InfoPlist.strings; + refType = 4; + }; + 43B962E200617B93416877C2 = { + isa = PBXFileReference; + name = Japanese; + path = Japanese.lproj/Credits.rtf; + refType = 4; + }; + 43B962E300617B93416877C2 = { + isa = PBXFileReference; + name = Japanese; + path = Japanese.lproj/XDarwinHelp.html; + refType = 4; + }; + 618092480041B0E4CE6F79C2 = { + children = ( + 015EDCC000420083CE6F79C2, + 015EDCC20042012ACE6F79C2, + 015EDCC400420160CE6F79C2, + 015EDCC60042017CCE6F79C2, + 015EDCC8004201A8CE6F79C2, + 015EDCCA004201C1CE6F79C2, + 015EDCCC004201E4CE6F79C2, + 015EDCCE004201F2CE6F79C2, + 015EDCD0004201FCCE6F79C2, + 015EDCD20042020BCE6F79C2, + 015EDCD400420227CE6F79C2, + 015EDCD60042023DCE6F79C2, + 015EDCD80042024ECE6F79C2, + 015EDCDA00420266CE6F79C2, + 015EDCDC00420279CE6F79C2, + 015EDCDE00420295CE6F79C2, + 015EDCE0004202BACE6F79C2, + 015EDCE2004202DECE6F79C2, + 015EDCE4004202F2CE6F79C2, + 015EDCE600420319CE6F79C2, + 015EDCE800420346CE6F79C2, + ); + isa = PBXGroup; + name = Libraries; + path = ../../..; + refType = 2; + }; + }; + rootObject = 29B97313FDCFA39411CA2CEA; +} diff --git a/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c b/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c new file mode 100644 index 000000000..f321cb0be --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c @@ -0,0 +1,71 @@ +/************************************************************** + * + * Startup program for Darwin X servers + * + * This program selects the appropriate X server to launch: + * XDarwin IOKit X server (default) + * XDarwin.app Quartz X server (-quartz option) + * + * If told to idle, the program will simply pause and not + * launch any X server. This is to support startx being + * run by XDarwin.app. + * + **************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c,v 1.1 2001/03/29 02:06:51 torrey Exp $ */ + +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> + +extern int errno; + +// Macros to build the path name +#ifndef XBINDIR +#define XBINDIR /usr/X11R6/bin +#endif +#define STR(s) #s +#define XSTRPATH(s) STR(s) "/" +#define XPATH(file) XSTRPATH(XBINDIR) STR(file) + +int main( + int argc, + char *argv[] ) +{ + int i, j; + char **newargv; + + // Check if we are going to run in Quartz mode or idle + // to support startx from the Quartz server. The last + // parameter in the list is the one used. + for (i = argc-1; i; i--) { + if (!strcmp(argv[i], "-idle")) { + pause(); + return 0; + + } else if (!strcmp(argv[i], "-quartz")) { + // Build the new argument list + newargv = (char **) malloc((argc+2) + sizeof(char *)); + for (j = argc; j; j--) + newargv[j] = argv[j]; + newargv[0] = XPATH(XDarwin.app/Contents/MacOS/XDarwin); + newargv[argc] = "-nostartx"; + newargv[argc+1] = NULL; + + execv(newargv[0], newargv); + fprintf(stderr, "Could not start XDarwin Quartz X server.\n"); + return errno; + } + } + + // Build the new argument list + newargv = (char **) malloc((argc+1) + sizeof(char *)); + for (j = argc; j; j--) + newargv[j] = argv[j]; + newargv[0] = XPATH(XDarwin); + newargv[argc] = NULL; + + // Launch the IOKit X server + execv(newargv[0], newargv); + fprintf(stderr, "Could not start XDarwin IOKit X server.\n"); + return errno; +} diff --git a/xc/programs/Xserver/hw/darwin/bundle/Xserver.h b/xc/programs/Xserver/hw/darwin/bundle/Xserver.h new file mode 100644 index 000000000..87d4ae09a --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Xserver.h @@ -0,0 +1,57 @@ +// +// Xserver.h +// +// Created by Andreas Monitzer on January 6, 2001. +// +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Xserver.h,v 1.4 2001/04/02 08:50:56 torrey Exp $ */ + +#import <Cocoa/Cocoa.h> + +#include <drivers/event_status_driver.h> // for NXEvent +#include <unistd.h> +#include <stdlib.h> + +@interface Xserver : NSObject { + // server state + NSLock *serverLock; + BOOL serverVisible; + BOOL appQuitting; + UInt32 mouseState; + + // communication + int eventWriteFD; + + // Aqua interface + IBOutlet NSPanel *helpWindow; + IBOutlet id startupHelpButton; +} + +- (id)init; + +- (BOOL)translateEvent:(NSEvent *)anEvent; + +- (void)getNXMouse:(NXEvent*)ev; ++ (void)append:(NSString*)value toEnv:(NSString*)name; + +- (void)run; +- (void)startClients; +- (void)toggle; +- (void)show; +- (void)hide; +- (void)kill; +- (void)readPasteboard; +- (void)writePasteboard; +- (void)sendNXEvent:(NXEvent*)ev; +- (void)sendShowHide:(BOOL)show; + +- (IBAction)closeHelpAndShow:(id)sender; + +// NSApplication delegate +- (BOOL)applicationShouldTerminate:(NSApplication *)sender; +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; +- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag; +- (void)applicationWillResignActive:(NSNotification *)aNotification; +- (void)applicationWillBecomeActive:(NSNotification *)aNotification; + +@end + diff --git a/xc/programs/Xserver/hw/darwin/bundle/Xserver.m b/xc/programs/Xserver/hw/darwin/bundle/Xserver.m new file mode 100644 index 000000000..e0f86790f --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/Xserver.m @@ -0,0 +1,301 @@ +// +// Xserver.m +// +// This class handles the interaction between the Cocoa front-end +// and the Darwin X server thread. +// +// Created by Andreas Monitzer on January 6, 2001. +// +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Xserver.m,v 1.7 2001/04/05 06:08:46 torrey Exp $ */ + +#import "Xserver.h" +#import "Preferences.h" +#import "quartzShared.h" + +// Macros to build the path name +#ifndef XBINDIR +#define XBINDIR /usr/X11R6/bin +#endif +#define STR(s) #s +#define XSTRPATH(s) STR(s) +#define XPATH(file) XSTRPATH(XBINDIR) "/" STR(file) + +extern int argcGlobal; +extern char **argvGlobal; +extern char **envpGlobal; + +@implementation Xserver + +- (id)init { + self=[super init]; + + serverLock = [[NSLock alloc] init]; + serverVisible = NO; + appQuitting = NO; + mouseState = 0; + eventWriteFD = quartzEventWriteFD; + + return self; +} + +- (BOOL)applicationShouldTerminate:(NSApplication *)sender { + int but; + + if ([serverLock tryLock]) + return YES; + if (serverVisible) + [self hide]; + + but = NSRunAlertPanel(NSLocalizedString(@"Quit X server?",@""), + NSLocalizedString(@"Quitting the X server will terminate any running X Window programs.",@""), + NSLocalizedString(@"Quit",@""), + NSLocalizedString(@"Cancel",@""), + nil); + + switch (but) { + case NSAlertDefaultReturn: // quit + appQuitting = YES; + [self kill]; + // Try to wait until the X server shuts down + [serverLock lockBeforeDate:[NSDate dateWithTimeIntervalSinceNow:10]]; + return YES; + case NSAlertAlternateReturn: // cancel + break; + } + return NO; +} + +// returns YES when event was handled +- (BOOL)translateEvent:(NSEvent *)anEvent { + NXEvent ev; + + if(([anEvent type]==NSKeyDown) && (![anEvent isARepeat]) && + ([anEvent keyCode]==[Preferences keyCode]) && + ([anEvent modifierFlags]==[Preferences modifiers])) { + [self toggle]; + return YES; + } + + if(!serverVisible) + return NO; + + [self getNXMouse:&ev]; + ev.type=[anEvent type]; + ev.flags=[anEvent modifierFlags]; + switch(ev.type) { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSMouseMoved: + break; + case NSLeftMouseDragged: + case NSRightMouseDragged: + ev.type=NSMouseMoved; + break; + case NSSystemDefined: + if(([anEvent subtype]==7) && ([anEvent data1] & 1)) + return YES; // skip mouse button 1 events + if(mouseState==[anEvent data2]) + return YES; // ignore double events + ev.data.compound.subType=[anEvent subtype]; + ev.data.compound.misc.L[0]=[anEvent data1]; + ev.data.compound.misc.L[1]=mouseState=[anEvent data2]; + break; + case NSScrollWheel: + ev.data.scrollWheel.deltaAxis1=[anEvent deltaY]; + break; + case NSKeyDown: + case NSKeyUp: + ev.data.key.keyCode = [anEvent keyCode]; + ev.data.key.repeat = [anEvent isARepeat]; + break; + case NSFlagsChanged: + ev.data.key.keyCode = [anEvent keyCode]; + break; + default: + return YES; + } + + [self sendNXEvent:&ev]; + + return YES; +} + +- (void)getNXMouse:(NXEvent*)ev { + NSPoint pt=[NSEvent mouseLocation]; + ev->location.x=(int)(pt.x); + ev->location.y=[[NSScreen mainScreen] frame].size.height-(int)(pt.y); // invert mouse +} + +// Append a string to the given enviroment variable ++ (void)append:(NSString*)value toEnv:(NSString*)name { + setenv([name cString], + [[[NSString stringWithCString:getenv([name cString])] + stringByAppendingString:value] cString],1); +} + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Start the X server thread + [NSThread detachNewThreadSelector:@selector(run) toTarget:self withObject:nil]; + + // Start the X clients if started from GUI + if (quartzStartClients) + [NSThread detachNewThreadSelector:@selector(startClients) toTarget:self withObject:nil]; + + // Make sure the menu bar gets drawn + [NSApp setWindowsNeedUpdate:YES]; + + // Display the help splash screen or show the X server + if ([Preferences startupHelp]) { + [self sendShowHide:NO]; + [helpWindow makeKeyAndOrderFront:self]; + } else { + [self closeHelpAndShow:self]; + } +} + +// Run the X server thread +- (void)run { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + [serverLock lock]; + main(argcGlobal, argvGlobal, envpGlobal); + serverVisible = NO; + [serverLock unlock]; + [pool release]; + if (!appQuitting) + [NSApp terminate:nil]; // quit if we aren't already +} + +// Start the X clients in a separate thread +- (void)startClients { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + char *home; + + // Change to user's home directory (so xterms etc. start there) + home = getenv("HOME"); + if (home) chdir(home); + + [Xserver append:@":" toEnv:@"PATH"]; + [Xserver append:@XSTRPATH(XBINDIR) toEnv:@"PATH"]; + system(XPATH(startx -- -idle &)); + // FIXME: quit when startx dies + [pool release]; +} + +// Close the help splash screen and show the X server +- (IBAction)closeHelpAndShow:(id)sender { + int helpVal; + + helpVal = [startupHelpButton intValue]; + [Preferences setStartupHelp:helpVal]; + [helpWindow close]; + serverVisible = YES; + [self sendShowHide:YES]; + [NSApp activateIgnoringOtherApps:YES]; +} + +// Show or hide the X server +- (void)toggle { + if (serverVisible) + [self hide]; + else + [self show]; +} + +// Show the X server on screen +- (void)show { + if (!serverVisible) { + [self sendShowHide:YES]; + } +} + +// Hide the X server from the screen +- (void)hide { + if (serverVisible) { + [self sendShowHide:NO]; + } +} + +// Kill the Xserver process +- (void)kill { + NXEvent ev; + + if (serverVisible) + [self hide]; + + ev.type = NX_APPDEFINED; + ev.data.compound.subType = kXDarwinQuit; + [self sendNXEvent:&ev]; +} + +// Tell the X server to show or hide itself. +// This ignores the current X server visible state. +- (void)sendShowHide:(BOOL)show { + NXEvent ev; + + [self getNXMouse:&ev]; + ev.type = NX_APPDEFINED; + + if (show) { + ev.data.compound.subType = kXDarwinShow; + [self sendNXEvent:&ev]; + + // inform the X server of the current modifier state + ev.flags = [[NSApp currentEvent] modifierFlags]; + ev.data.compound.subType = kXDarwinUpdateModifiers; + [self sendNXEvent:&ev]; + + // put the pasteboard into the X cut buffer + [self readPasteboard]; + } else { + // put the X cut buffer on the pasteboard + [self writePasteboard]; + + ev.data.compound.subType = kXDarwinHide; + [self sendNXEvent:&ev]; + } + + serverVisible = show; +} + +// Tell the X server to read from the pasteboard into the X cut buffer +- (void)readPasteboard +{ + NXEvent ev; + + ev.type = NX_APPDEFINED; + ev.data.compound.subType = kXDarwinReadPasteboard; + [self sendNXEvent:&ev]; +} + +// Tell the X server to write the X cut buffer into the pasteboard +- (void)writePasteboard +{ + NXEvent ev; + + ev.type = NX_APPDEFINED; + ev.data.compound.subType = kXDarwinWritePasteboard; + [self sendNXEvent:&ev]; +} + +- (void)sendNXEvent:(NXEvent*)ev { + if (write(eventWriteFD, ev, sizeof(*ev)) == sizeof(*ev)) + return; + ErrorF("Bad write to event pipe.\n"); + // FIXME: handle bad writes better? +} + +- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag { + [self show]; + return NO; +} + +- (void)applicationWillResignActive:(NSNotification *)aNotification { + [self hide]; +} + +- (void)applicationWillBecomeActive:(NSNotification *)aNotification { + [self readPasteboard]; +} + +@end diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartz.c b/xc/programs/Xserver/hw/darwin/bundle/quartz.c new file mode 100644 index 000000000..f3965d55e --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartz.c @@ -0,0 +1,234 @@ +/************************************************************** + * + * Quartz-specific support for the Darwin X Server + * + * By Gregory Robert Parker + * + **************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartz.c,v 1.4 2001/04/02 05:18:50 torrey Exp $ */ + +// X headers +#include "scrnintstr.h" + +// System headers +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <IOKit/pwr_mgt/IOPMLib.h> + +// We need CoreGraphics in ApplicationServices, but we leave out +// QuickDraw, which has symbol conflicts with the basic X includes. +#define __QD__ +#define __PRINTCORE__ +#include <ApplicationServices/ApplicationServices.h> + +#include "../darwin.h" +#include "quartz.h" +#include "quartzAudio.h" + +#define kDarwinMaxScreens 100 +static ScreenPtr darwinScreens[kDarwinMaxScreens]; +static int darwinNumScreens = 0; +static BOOL xhidden = FALSE; + + +/* + * QuartzStoreColors + * FIXME: need to implement if Quartz supports PsuedoColor + */ +static void QuartzStoreColors( + ColormapPtr pmap, + int numEntries, + xColorItem *pdefs) +{ +} + +/* +=========================================================================== + + Screen functions + +=========================================================================== +*/ + +/* + * QuartzPMThread + * Handle power state notifications, FIXME + */ +#if 0 +static void *QuartzPMThread(void *arg) +{ + for (;;) { + mach_msg_return_t kr; + mach_msg_empty_rcv_t msg; + + kr = mach_msg((mach_msg_header_t*) &msg, MACH_RCV_MSG, 0, + sizeof(msg), pmNotificationPort, 0, MACH_PORT_NULL); + kern_assert(kr); + + // computer just woke up + if (msg.header.msgh_id == 1) { + if (!xhidden) { + int i; + + for (i = 0; i < darwinNumScreens; i++) { + if (darwinScreens[i]) + xf86SetRootClip(darwinScreens[i], true); + } + } + } + } + return NULL; +} +#endif + + +/* + * QuartzAddScreen + * Quartz keeps a list of all screens for QuartzShow and QuartzHide. + * FIXME: So does ddx, use that instead. + */ +Bool QuartzAddScreen(ScreenPtr pScreen) +{ + if (darwinNumScreens == kDarwinMaxScreens) { + return FALSE; + } + + darwinScreens[darwinNumScreens++] = pScreen; + + // setup cursor support + if (! QuartzInitCursor(pScreen)) { + return FALSE; + } + + // initialize colormap handling as needed + if (dfb.pixelInfo.pixelType == kIOCLUTPixels) { + pScreen->StoreColors = QuartzStoreColors; + } + + return TRUE; +} + + +/* + * QuartzCapture + * Capture the screen so we can draw and hide the Aqua cursor. + */ +static void QuartzCapture(void) +{ + if (! CGDisplayIsCaptured(kCGDirectMainDisplay)) { + CGDisplayCapture(kCGDirectMainDisplay); +// FIXME: Properly initialize X cursor +#if 0 + CGDisplayHideCursor(kCGDirectMainDisplay); +#endif + HideMenuBar(); + } +} + + +/* + * QuartzRelease + * Release the screen so others can draw and restore the Aqua cursor. + */ +static void QuartzRelease(void) +{ + if (CGDisplayIsCaptured(kCGDirectMainDisplay)) { + InitCursor(); + CGDisplayRelease(kCGDirectMainDisplay); + ShowMenuBar(); + } +} + + +/* + * QuartzDisplayInit + * Init the framebuffer and claim the display from CoreGraphics. + */ +static void QuartzDisplayInit(void) +{ + dfb.pixelInfo.pixelType = kIORGBDirectPixels; + dfb.pixelInfo.bitsPerComponent=CGDisplayBitsPerSample(kCGDirectMainDisplay); + dfb.pixelInfo.componentCount=CGDisplaySamplesPerPixel(kCGDirectMainDisplay); +#if FALSE + // FIXME: endian and 24 bit color specific + dfb.pixelInfo.componentMasks[0] = 0x00ff0000; + dfb.pixelInfo.componentMasks[1] = 0x0000ff00; + dfb.pixelInfo.componentMasks[2] = 0x000000ff; +#endif + + dfb.width = CGDisplayPixelsWide(kCGDirectMainDisplay); + dfb.height = CGDisplayPixelsHigh(kCGDirectMainDisplay); + dfb.pitch = CGDisplayBytesPerRow(kCGDirectMainDisplay); + dfb.bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay); + dfb.colorBitsPerPixel = (dfb.pixelInfo.componentCount * + dfb.pixelInfo.bitsPerComponent); + + dfb.framebuffer = CGDisplayBaseAddress(kCGDirectMainDisplay); + + // need to capture because X doesn't like read-only framebuffer... + QuartzCapture(); + atexit(QuartzRelease); +} + + +/* + * QuartzOsVendorInit + * Quartz display initialization. + */ +void QuartzOsVendorInit(void) +{ + QuartzAudioInit(); + QuartzDisplayInit(); +} + + +/* + * QuartzShow + * Show the X server on screen. Does nothing if already shown. + * recapture the screen, restore the X clip regions. + */ +void QuartzShow(void) { + int i; + + QuartzCapture(); + if (xhidden) { + for (i = 0; i < darwinNumScreens; i++) { + if (darwinScreens[i]) + xf86SetRootClip(darwinScreens[i], true); + } + } + xhidden = false; +} + + +/* + * QuartzHide + * Remove the X server display from the screen. Does nothing if already hidden. + * Release the screen, set X clip regions to prevent drawing. + */ +void QuartzHide(void) +{ + int i; + + if (!xhidden) { + for (i = 0; i < darwinNumScreens; i++) { + if (darwinScreens[i]) + xf86SetRootClip(darwinScreens[i], false); + } + } + QuartzRelease(); + xhidden = true; +} + + +/* + * QuartzGiveUp + * Cleanup before X server shutdown + * Release the screen + */ +void QuartzGiveUp(void) +{ + QuartzRelease(); +} + diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartz.h b/xc/programs/Xserver/hw/darwin/bundle/quartz.h new file mode 100644 index 000000000..01c52eaae --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartz.h @@ -0,0 +1,23 @@ +/* + quartz.h + + Quartz-specific functions and definitions +*/ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartz.h,v 1.2 2001/04/02 05:18:50 torrey Exp $ */ + +#ifndef _QUARTZ_H +#define _QUARTZ_H + +#include "X11/Xproto.h" +#include "screenint.h" +#include "quartzShared.h" +#include "quartzPasteboard.h" + +void QuartzOsVendorInit(void); +Bool QuartzAddScreen(ScreenPtr screen); +Bool QuartzInitCursor(ScreenPtr pScreen); +void QuartzGiveUp(void); +void QuartzHide(void); +void QuartzShow(void); + +#endif diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c new file mode 100644 index 000000000..a794a2b35 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c @@ -0,0 +1,316 @@ +// +// QuartzAudio.m +// +// X Window bell support using CoreAudio or AppKit. +// Greg Parker gparker@cs.stanford.edu 19 Feb 2001 +// +// Info about sine wave sound playback: +// CoreAudio code derived from macosx-dev posting by Tim Wood +// http://www.omnigroup.com/mailman/archive/macosx-dev/2000-May/002004.html +// Smoothing transitions between sounds +// http://www.wam.umd.edu/~mphoenix/dss/dss.html +// +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c,v 1.2 2001/04/05 06:08:46 torrey Exp $ */ + +#include <CoreAudio/AudioHardware.h> +#include <pthread.h> + +#include "inputstr.h" +#include "extensions/XI.h" + +#include "quartzAudio.h" +#include "quartzShared.h" + +typedef struct QuartzAudioRec { + double frequency; + double amplitude; + + UInt32 curFrame; + UInt32 remainingFrames; + UInt32 totalFrames; + UInt32 bytesPerFrame; + double sampleRate; + UInt32 fadeLength; + + UInt32 bufferByteCount; + Boolean playing; + pthread_mutex_t lock; + + // used to fade out interrupted sound and avoid 'pop' + double prevFrequency; + double prevAmplitude; + UInt32 prevFrame; +} QuartzAudioRec; + +static AudioDeviceID quartzAudioDevice = kAudioDeviceUnknown; +static QuartzAudioRec data; + + +/* + * QuartzAudioEnvelope + * Fade sound in and out to avoid pop. + * Sounds with shorter duration will never reach full amplitude. Deal. + */ +static double QuartzAudioEnvelope( + UInt32 curFrame, + UInt32 totalFrames, + UInt32 fadeLength ) +{ + double fadeFrames = min(fadeLength, totalFrames / 2); + if (fadeFrames < 1) return 0; + + if (curFrame < fadeFrames) { + return curFrame / fadeFrames; + } else if (curFrame > totalFrames - fadeFrames) { + return (totalFrames-curFrame) / fadeFrames; + } else { + return 1.0; + } +} + + +/* + * QuartzFillBuffer + * Fill this buffer with data and update the data position. + * FIXME: this is ugly + */ +static void QuartzFillBuffer( + AudioBuffer *audiobuffer, + QuartzAudioRec *data ) +{ + float *buffer, *b; + unsigned int frame, frameCount; + unsigned int bufferFrameCount; + float multiplier, v; + int i; + + buffer = (float *)audiobuffer->mData; + bufferFrameCount = audiobuffer->mDataByteSize / data->bytesPerFrame; + + frameCount = min(bufferFrameCount, data->remainingFrames); + + // Fade out previous sine wave, if any. + b = buffer; + if (data->prevFrame) { + multiplier = 2*M_PI*(data->prevFrequency/data->sampleRate); + for (frame = 0; frame < data->fadeLength; frame++) { + v = data->prevAmplitude * + QuartzAudioEnvelope(frame+data->fadeLength, + 2*data->fadeLength, + data->fadeLength) * + sin(multiplier * (data->prevFrame+frame)); + for (i = 0; i < audiobuffer->mNumberChannels; i++) { + *b++ = v; + } + } + // no more prev fade + data->prevFrame = 0; + + // adjust for space eaten by prev fade + buffer += audiobuffer->mNumberChannels*frame; + bufferFrameCount -= frame; + frameCount = min(bufferFrameCount, data->remainingFrames); + } + + // Write a sine wave with the specified frequency and amplitude + multiplier = 2*M_PI*(data->frequency/data->sampleRate); + for (frame = 0; frame < frameCount; frame++) { + v = data->amplitude * + QuartzAudioEnvelope(data->curFrame+frame, data->totalFrames, + data->fadeLength) * + sin(multiplier * (data->curFrame+frame)); + for (i = 0; i < audiobuffer->mNumberChannels; i++) { + *b++ = v; + } + } + + // Zero out the rest of the buffer, if any + memset(b, 0, sizeof(float) * audiobuffer->mNumberChannels * + (bufferFrameCount-frame)); + + data->curFrame += frameCount; + data->remainingFrames -= frameCount; + if (data->remainingFrames == 0) { + data->playing = FALSE; + data->curFrame = 0; + } +} + + +/* + * QuartzAudioIOProc + * Callback function for audio playback. + * FIXME: use inOutputTime to correct for skipping + */ +static OSStatus +QuartzAudioIOProc( + AudioDeviceID inDevice, + const AudioTimeStamp *inNow, + const AudioBufferList *inInputData, + const AudioTimeStamp *inInputTime, + AudioBufferList *outOutputData, + const AudioTimeStamp *inOutputTime, + void *inClientData ) +{ + QuartzAudioRec *data = (QuartzAudioRec *)inClientData; + int i; + Boolean wasPlaying; + + pthread_mutex_lock(&data->lock); + wasPlaying = data->playing; + for (i = 0; i < outOutputData->mNumberBuffers; i++) { + if (data->playing) { + QuartzFillBuffer(outOutputData->mBuffers+i, data); + } + else { + memset(outOutputData->mBuffers[i].mData, 0, + outOutputData->mBuffers[i].mDataByteSize); + } + } + if (wasPlaying && !data->playing) { + OSStatus err; + err = AudioDeviceStop(inDevice, QuartzAudioIOProc); + } + pthread_mutex_unlock(&data->lock); + return 0; +} + + +/* + * QuartzCoreAudioBell + * Play a tone using the CoreAudio API + */ +static void QuartzCoreAudioBell( + int volume, // volume is % of max + int pitch, // pitch is Hz + int duration ) // duration is milliseconds +{ + if (quartzAudioDevice == kAudioDeviceUnknown) return; + + pthread_mutex_lock(&data.lock); + + // fade previous sound, if any + data.prevFrequency = data.frequency; + data.prevAmplitude = data.amplitude; + data.prevFrame = data.curFrame; + + // set new sound + data.frequency = pitch; + data.amplitude = volume / 100.0; + data.curFrame = 0; + data.totalFrames = (int)(data.sampleRate * duration / 1000.0); + data.remainingFrames = data.totalFrames; + + if (! data.playing) { + OSStatus status; + status = AudioDeviceStart(quartzAudioDevice, QuartzAudioIOProc); + if (status) { + ErrorF("QuartzAudioBell: AudioDeviceStart returned %d\n", status); + } else { + data.playing = TRUE; + } + } + pthread_mutex_unlock(&data.lock); +} + + +/* + * QuartzBell + * Ring the bell + */ +void QuartzBell( + int volume, // volume in percent of max + DeviceIntPtr pDevice, + pointer ctrl, + int class ) +{ + int pitch; // pitch in Hz + int duration; // duration in milliseconds + + if (class == BellFeedbackClass) { + pitch = ((BellCtrl*)ctrl)->pitch; + duration = ((BellCtrl*)ctrl)->duration; + } else if (class == KbdFeedbackClass) { + pitch = ((KeybdCtrl*)ctrl)->bell_pitch; + duration = ((KeybdCtrl*)ctrl)->bell_duration; + } else { + ErrorF("QuartzBell: bad bell class %d\n", class); + return; + } + + // FIXME: how is NSBeep volume set? + if (quartzUseSysBeep) { + NSBeep(); + return; + } else { + QuartzCoreAudioBell(volume, pitch, duration); + } +} + + +/* + * QuartzAudioInit + * Prepare to play the bell with the CoreAudio API + */ +void QuartzAudioInit(void) +{ + UInt32 propertySize; + OSStatus status; + AudioDeviceID outputDevice; + AudioStreamBasicDescription outputStreamDescription; + double sampleRate; + + // Get the default output device + propertySize = sizeof(outputDevice); + status = AudioHardwareGetProperty( + kAudioHardwarePropertyDefaultOutputDevice, + &propertySize, &outputDevice); + if (status) { + ErrorF("QuartzAudioInit: AudioHardwareGetProperty returned %d\n", + status); + return; + } + if (outputDevice == kAudioDeviceUnknown) { + ErrorF("QuartzAudioInit: No audio output devices available.\n"); + return; + } + + // Get the basic device description + propertySize = sizeof(outputStreamDescription); + status = AudioDeviceGetProperty(outputDevice, 0, FALSE, + kAudioDevicePropertyStreamFormat, + &propertySize, &outputStreamDescription); + if (status) { + ErrorF("QuartzAudioInit: GetProperty(stream format) returned %d\n", + status); + return; + } + sampleRate = outputStreamDescription.mSampleRate; + + // Fill in the playback data + data.frequency = 0; + data.amplitude = 0; + data.curFrame = 0; + data.remainingFrames = 0; + data.bytesPerFrame = outputStreamDescription.mBytesPerFrame; + data.sampleRate = sampleRate; + // data.bufferByteCount = bufferByteCount; + data.playing = FALSE; + data.prevAmplitude = 0; + data.prevFrame = 0; + data.prevFrequency = 0; + data.fadeLength = data.sampleRate / 200; + pthread_mutex_init(&data.lock, NULL); // fixme error check + + // fixme assert fadeLength<framesPerBuffer + + // Prepare for playback + status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data); + if (status) { + ErrorF("QuartzAudioInit: AddIOProc returned %d\n", status); + return; + } + + // success! + quartzAudioDevice = outputDevice; +} diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h new file mode 100644 index 000000000..4edd87ce4 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h @@ -0,0 +1,16 @@ +// +// QuartzAudio.h +// +// X Window bell support using CoreAudio or AppKit. +// Greg Parker gparker@cs.stanford.edu 19 Feb 2001 +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h,v 1.2 2001/04/01 20:45:43 tsi Exp $ */ + +#ifndef _QUARTZAUDIO_H +#define _QUARTZAUDIO_H + +#include "input.h" + +void QuartzAudioInit(void); +void QuartzBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class); + +#endif diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m b/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m new file mode 100644 index 000000000..d9168df75 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m @@ -0,0 +1,78 @@ +/************************************************************** + * + * Quartz-specific support for the Darwin X Server + * that requires Cocoa and Objective-C. + * + * This file is separate from the parts of Quartz support + * that use X include files to avoid symbol collisions. + * + **************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m,v 1.2 2001/04/05 06:08:46 torrey Exp $ */ + +#include <Cocoa/Cocoa.h> + +#import "Preferences.h" +#include "quartzShared.h" + +static NSArray *pasteboardTypes = nil; + +// Read the user preferences from the Cocoa front end +void QuartzReadPreferences(void) +{ + darwinFakeButtons = [Preferences fakeButtons]; + quartzUseSysBeep = [Preferences systemBeep]; +} + +// Write text to the Mac OS X pasteboard. +void QuartzWriteCocoaPasteboard(char *text) +{ + NSPasteboard *pasteboard; + NSString *string; + + if (! text) return; + pasteboard = [NSPasteboard generalPasteboard]; + if (! pasteboard) return; + string = [NSString stringWithCString:text]; + if (! string) return; + if (! pasteboardTypes) { + pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType]; + [pasteboardTypes retain]; + } + + // nil owner because we don't provide type translations + [pasteboard declareTypes:pasteboardTypes owner:nil]; + [pasteboard setString:string forType:NSStringPboardType]; + [string release]; +} + +// Read text from the Mac OS X pasteboard and return it as a heap string. +// The caller must free the string. +char *QuartzReadCocoaPasteboard(void) +{ + NSPasteboard *pasteboard; + NSString *existingType; + char *text = NULL; + + if (! pasteboardTypes) { + pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType]; + [[pasteboardTypes retain] autorelease]; + } + + pasteboard = [NSPasteboard generalPasteboard]; + if (! pasteboard) return NULL; + + existingType = [pasteboard availableTypeFromArray:pasteboardTypes]; + if (existingType) { + NSString *string = [pasteboard stringForType:existingType]; + char *buffer; + + if (! string) return NULL; + buffer = [string lossyCString]; + text = (char *) malloc(strlen(buffer)); + if (text) + strcpy(text, buffer); + [string release]; + } + + return text; +} diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c new file mode 100644 index 000000000..9435d96e9 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c @@ -0,0 +1,310 @@ +/************************************************************** + * + * Support for using the Quartz Window Manager cursor + * + **************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c,v 1.1 2001/04/02 05:18:50 torrey Exp $ */ + +#include "mi.h" +#include "scrnintstr.h" +#include "cursorstr.h" +#include "mipointrst.h" + +#undef AllocCursor +#define Cursor QD_Cursor +#define WindowPtr QD_WindowPtr +#include <ApplicationServices/ApplicationServices.h> + +// Size of the QuickDraw cursor +#define CURSORWIDTH 16 +#define CURSORHEIGHT 16 + +typedef struct { + int cursorMode; + QueryBestSizeProcPtr QueryBestSize; + miPointerSpriteFuncPtr spriteFuncs; +} QuartzCursorScreenRec, *QuartzCursorScreenPtr; + +static int darwinCursorScreenIndex = -1; +static unsigned long darwinCursorGeneration = 0; + +/* +=========================================================================== + + Pointer sprite functions + +=========================================================================== +*/ + +/* + * QuartzRealizeCursor + * Convert the X cursor representation to QuickDraw format if possible. + */ +Bool +QuartzRealizeCursor( + ScreenPtr pScreen, + CursorPtr pCursor ) +{ + int i; + QD_Cursor *curs; + QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) + pScreen->devPrivates[darwinCursorScreenIndex].ptr; + + if(!pCursor || !pCursor->bits) + return FALSE; + + // if the cursor is too big we use a software cursor + if ((pCursor->bits->height > CURSORHEIGHT) || + (pCursor->bits->width > CURSORWIDTH)) + return (*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCursor); + + // allocate memory for new cursor image + curs = xalloc( sizeof(QD_Cursor) ); + if (!curs) + return FALSE; + + // X cursor max size is 32x32 (rowbytes 4). + // Copy top left 16x16 for now. + for (i = 0; i < 16; i++) + { + curs->data[i] = (pCursor->bits->source[i*4]<<8) | + pCursor->bits->source[i*4+1]; + curs->mask[i] = (pCursor->bits->mask[i*4]<<8) | + pCursor->bits->mask[i*4+1]; + } + curs->hotSpot.h = pCursor->bits->xhot; + if(curs->hotSpot.h >= 16) + curs->hotSpot.h = 15; + curs->hotSpot.v = pCursor->bits->yhot; + if(curs->hotSpot.v >= 16) + curs->hotSpot.v = 15; + + // save the result + pCursor->devPriv[pScreen->myNum] = (pointer) curs; + return TRUE; +} + + +/* + * QuartzUnrealizeCursor + * Free the storage space associated with a realized cursor. + */ +Bool +QuartzUnrealizeCursor( + ScreenPtr pScreen, + CursorPtr pCursor ) +{ + QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) + pScreen->devPrivates[darwinCursorScreenIndex].ptr; + + if ((pCursor->bits->height > CURSORHEIGHT) || + (pCursor->bits->width > CURSORWIDTH)) { + return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCursor); + } else { + xfree( pCursor->devPriv[pScreen->myNum] ); + return TRUE; + } +} + + +/* + * QuartzSetCursor + * Set the cursor sprite and position. + * Use QuickDraw cursor if possible. + */ +static void +QuartzSetCursor( + ScreenPtr pScreen, + CursorPtr pCursor, + int x, + int y) +{ + QD_Cursor *curs; + QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) + pScreen->devPrivates[darwinCursorScreenIndex].ptr; + + // are we supposed to remove the cursor? + if (!pCursor) { + if (ScreenPriv->cursorMode == 0) + (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); + else + CGDisplayHideCursor(kCGDirectMainDisplay); + return; + } + + // can we use QuickDraw cursor? + if ((pCursor->bits->height <= CURSORHEIGHT) && + (pCursor->bits->width <= CURSORWIDTH)) { + + if (ScreenPriv->cursorMode == 0) // remove the X cursor + (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); + + ScreenPriv->cursorMode = 1; + curs = (QD_Cursor *) pCursor->devPriv[pScreen->myNum]; + SetCursor(curs); + return; + } + + // otherwise we use a software cursor + if (ScreenPriv->cursorMode) { + // remove the QuickDraw cursor + QuartzSetCursor(pScreen, 0, x, y); + } + + ScreenPriv->cursorMode = 0; + (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y); +} + + +/* + * QuartzMoveCursor + * Move the cursor. This is a noop for QuickDraw. + */ +static void +QuartzMoveCursor( + ScreenPtr pScreen, + int x, + int y) +{ + QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) + pScreen->devPrivates[darwinCursorScreenIndex].ptr; + + // only the X cursor needs to be explicitly moved + if (!ScreenPriv->cursorMode) + (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y); +} + + +static miPointerSpriteFuncRec quartzSpriteFuncsRec = { + QuartzRealizeCursor, + QuartzUnrealizeCursor, + QuartzSetCursor, + QuartzMoveCursor +}; + +/* +=========================================================================== + + Pointer screen functions + +=========================================================================== +*/ + +/* + * QuartzCursorOffScreen + */ +static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y) +{ + return FALSE; +} + + +/* + * QuartzCrossScreen + */ +static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering) +{ + return; +} + + +/* + * QuartzWarpCursor + * Change the cursor position without generating an event or motion history + */ +static void +QuartzWarpCursor( + ScreenPtr pScreen, + int x, + int y) +{ + CGDisplayErr cgErr; + CGPoint cgPoint; + + cgPoint = CGPointMake(x, y); + cgErr = CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgPoint); + if (cgErr != CGDisplayNoErr) { + ErrorF("Could not set cursor position with error code 0x%x.\n", cgErr); + } + miPointerWarpCursor(pScreen, x, y); +} + + +static miPointerScreenFuncRec quartzScreenFuncsRec = { + QuartzCursorOffScreen, + QuartzCrossScreen, + QuartzWarpCursor, +}; + +/* +=========================================================================== + + Other screen functions + +=========================================================================== +*/ + +/* + * QuartzCursorQueryBestSize + * Handle queries for best cursor size + */ +static void +QuartzCursorQueryBestSize( + int class, + unsigned short *width, + unsigned short *height, + ScreenPtr pScreen) +{ + QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) + pScreen->devPrivates[darwinCursorScreenIndex].ptr; + + if (class == CursorShape) { + *width = CURSORWIDTH; + *height = CURSORHEIGHT; + } else + (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); +} + + +/* + * QuartzInitCursor + * Initialize cursor support + */ +Bool +QuartzInitCursor( + ScreenPtr pScreen ) +{ + QuartzCursorScreenPtr ScreenPriv; + miPointerScreenPtr PointPriv; + + // initialize software cursor handling (always needed as backup) + if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) { + return FALSE; + } + + // allocate private storage for this screen's QuickDraw cursor info + if (darwinCursorGeneration != serverGeneration) { + if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0) + return FALSE; + darwinCursorGeneration = serverGeneration; + } + + ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) ); + if (!ScreenPriv) return FALSE; + + pScreen->devPrivates[darwinCursorScreenIndex].ptr = (pointer) ScreenPriv; + + // override some screen procedures + ScreenPriv->QueryBestSize = pScreen->QueryBestSize; + pScreen->QueryBestSize = QuartzCursorQueryBestSize; + + // initialize QuickDraw cursor handling + PointPriv = (miPointerScreenPtr) + pScreen->devPrivates[miPointerScreenIndex].ptr; + + ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; + PointPriv->spriteFuncs = &quartzSpriteFuncsRec; + + ScreenPriv->cursorMode = 1; + return TRUE; +} diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c b/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c new file mode 100644 index 000000000..d387d8a73 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c @@ -0,0 +1,56 @@ +/************************************************************** + * quartzPasteboard.c + * + * Aqua pasteboard <-> X cut buffer + * Greg Parker gparker@cs.stanford.edu March 8, 2001 + **************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c,v 1.1 2001/03/15 22:24:27 torrey Exp $ */ + +#include "quartzPasteboard.h" + +#include "Xatom.h" +#include "windowstr.h" +#include "propertyst.h" + +// fixme is there a GetRootWindow() anywhere? +// fixme wrong for multiple screens +extern WindowPtr *WindowTable; + +// Write X cut buffer to Mac OS X pasteboard +// Called by ProcessInputEvents() in response to request from X server thread. +void QuartzWritePasteboard(void) +{ + PropertyPtr pProp; + char *text = NULL; + + pProp = wUserProps (WindowTable[0]); + while (pProp) { + if (pProp->propertyName == XA_CUT_BUFFER0) + break; + pProp = pProp->next; + } + if (! pProp) return; + if (pProp->type != XA_STRING) return; + if (pProp->format != 8) return; + + text = xalloc(1 + pProp->size); + if (! text) return; + memcpy(text, pProp->data, pProp->size); + text[pProp->size] = '\0'; + QuartzWriteCocoaPasteboard(text); + free(text); +} + + +// Read Mac OS X pasteboard into X cut buffer +// Called by ProcessInputEvents() in response to request from X server thread. +void QuartzReadPasteboard(void) +{ + char *text = QuartzReadCocoaPasteboard(); + if (text) { + ChangeWindowProperty(WindowTable[0], XA_CUT_BUFFER0, XA_STRING, 8, + PropModeReplace, strlen(text), (pointer)text,TRUE); + free(text); + // fixme erase any current X selections + } +} diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h b/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h new file mode 100644 index 000000000..048de532d --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h @@ -0,0 +1,20 @@ +/* + QuartzPasteboard.h + + Mac OS X pasteboard <-> X cut buffer + Greg Parker gparker@cs.stanford.edu March 8, 2001 +*/ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h,v 1.1 2001/03/15 22:24:27 torrey Exp $ */ + +#ifndef _QUARTZPASTEBOARD_H +#define _QUARTZPASTEBOARD_H + +// Aqua->X +void QuartzReadPasteboard(); +char * QuartzReadCocoaPasteboard(void); // caller must free string + +// X->Aqua +void QuartzWritePasteboard(); +void QuartzWriteCocoaPasteboard(char *text); + +#endif /* _QUARTZPASTEBOARD_H */
\ No newline at end of file diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h b/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h new file mode 100644 index 000000000..9a69295ce --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h @@ -0,0 +1,38 @@ +/* + * Shared definitions between the Darwin X Server + * and the Cocoa front end. + */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzShared.h,v 1.3 2001/04/05 06:08:46 torrey Exp $ */ + +#ifndef _QUARTZSHARED_H +#define _QUARTZSHARED_H + +// Data stored at startup for Cocoa front end +extern int quartzEventWriteFD; +extern int quartzStartClients; + +// User preferences used by X server +extern int quartzUseSysBeep; +extern int darwinFakeButtons; + +void QuartzReadPreferences(void); + +// NX_APPDEFINED event subtypes for special commands to the X server +// update modifiers: update all modifier keys +// show: vt switch to X server; recapture screen and restore X drawing +// hide: vt switch away from X server; release screen and clip X drawing +// quit: kill the X server and release the display +// read pasteboard: copy Mac OS X pasteboard into X cut buffer +// write pasteboard: copy X cut buffer onto Mac OS X pasteboard + +enum { + kXDarwinUpdateModifiers, + kXDarwinShow, + kXDarwinHide, + kXDarwinQuit, + kXDarwinReadPasteboard, + kXDarwinWritePasteboard +}; + +#endif /* _QUARTZSHARED_H */ + diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c b/xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c new file mode 100644 index 000000000..28bc1489f --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c @@ -0,0 +1,61 @@ +/************************************************************** + * + * Startup code for the Quartz Darwin X Server + * + **************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c,v 1.3 2001/04/05 06:08:46 torrey Exp $ */ + +#include <fcntl.h> +#include "opaque.h" +#include "../darwin.h" +#include "quartzShared.h" + +char **envpGlobal; // argcGlobal and argvGlobal + // are from dix/globals.c + +/* + * DarwinHandleGUI + * This function is called first from main(). The first time + * it is called we start the Mac OS X front end. The front end + * will call main() again from another thread to run the X + * server. On the second call this function loads the user + * preferences set by the Mac OS X front end. + */ +void DarwinHandleGUI( + int argc, + char *argv[], + char *envp[] ) +{ + static Bool been_here = FALSE; + int main_exit, i; + int fd[2]; + + if (been_here) { + QuartzReadPreferences(); + return; + } + been_here = TRUE; + + // Make a pipe to pass events + assert( pipe(fd) == 0 ); + darwinEventFD = fd[0]; + quartzEventWriteFD = fd[1]; + fcntl(darwinEventFD, F_SETFL, O_NONBLOCK); + + // Store command line arguments to pass back to main() + argcGlobal = argc; + argvGlobal = argv; + envpGlobal = envp; + + // Determine if we need to start X clients + quartzStartClients = 1; + for (i = argc-1; i; i--) { + if (!strcmp(argv[i], "-nostartx")) { + quartzStartClients = 0; + } + } + + quartz = TRUE; + main_exit = NSApplicationMain(argc, argv); + exit(main_exit); +} diff --git a/xc/programs/Xserver/hw/darwin/darwin.c b/xc/programs/Xserver/hw/darwin/darwin.c index 45cf36ef5..fe019c3e1 100644 --- a/xc/programs/Xserver/hw/darwin/darwin.c +++ b/xc/programs/Xserver/hw/darwin/darwin.c @@ -4,7 +4,7 @@ * running with Quartz or the IOKit * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.8 2001/02/08 23:36:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.17 2001/04/05 06:08:45 torrey Exp $ */ #include "X.h" #include "Xproto.h" @@ -21,6 +21,7 @@ #include <sys/types.h> #include <sys/time.h> +#include <fcntl.h> #define NO_CFPLUGIN #include <IOKit/IOKitLib.h> @@ -28,20 +29,25 @@ #include <IOKit/hidsystem/ev_keymap.h> #include "darwin.h" -#include "quartz.h" +#include "bundle/quartz.h" #include "xfIOKit.h" -// Shared global variables +// X server shared global variables DarwinFramebufferRec dfb; -int darwinEventFD; +int darwinEventFD = -1; Bool quartz = FALSE; +int quartzEventWriteFD = -1; +int quartzStartClients = 1; +int quartzUseSysBeep = 0; +int darwinFakeButtons = 0; UInt32 darwinDesiredWidth = 0, darwinDesiredHeight = 0; IOIndex darwinDesiredDepth = -1; SInt32 darwinDesiredRefresh = -1; +UInt32 darwinScreenNumber = 0; // Quit after this many seconds if no quartz event poster is found. // Leave undefined for no safety quit. -#define QUARTZ_SAFETY_DELAY 10 +#undef QUARTZ_SAFETY_DELAY /* Fake button press/release for scroll wheel move. */ #define SCROLLWHEELUPFAKE 4 @@ -49,7 +55,6 @@ SInt32 darwinDesiredRefresh = -1; static DeviceIntPtr darwinPointer; static DeviceIntPtr darwinKeyboard; -static Bool fake3Buttons = FALSE; static unsigned char darwinKeyCommandL = 0, darwinKeyOptionL = 0; // Common pixmap formats @@ -108,6 +113,7 @@ DarwinPrintBanner() #endif } + /* * DarwinSaveScreen * X screensaver support. Not implemented. @@ -362,24 +368,24 @@ void DarwinSimulateMouseClick( // first fool X into forgetting about the keys for (i = 0; i < numKeycodes; i++) { - xe.u.u.type = KeyRelease; - xe.u.u.detail = keycodesUsed[i]; - (darwinKeyboard->public.processInputProc) - ( &xe, darwinKeyboard, 1 ); + xe.u.u.type = KeyRelease; + xe.u.u.detail = keycodesUsed[i]; + (darwinKeyboard->public.processInputProc) + ( &xe, darwinKeyboard, 1 ); } // push the mouse button xe.u.u.type = whichEvent; xe.u.u.detail = whichButton; (darwinPointer->public.processInputProc) - ( &xe, darwinPointer, 1 ); + ( &xe, darwinPointer, 1 ); // reset the keys for (i = 0; i < numKeycodes; i++) { - xe.u.u.type = KeyPress; - xe.u.u.detail = keycodesUsed[i]; - (darwinKeyboard->public.processInputProc) - ( &xe, darwinKeyboard, 1 ); + xe.u.u.type = KeyPress; + xe.u.u.detail = keycodesUsed[i]; + (darwinKeyboard->public.processInputProc) + ( &xe, darwinKeyboard, 1 ); } } @@ -429,7 +435,7 @@ void DarwinUpdateModifiers( /* * ProcessInputEvents - * Read events from the event queue + * Read and process events from the event pipe until it is empty. */ void ProcessInputEvents(void) { @@ -456,241 +462,267 @@ void ProcessInputEvents(void) } #endif - // try to read from our pipe - // FIXME: safely handle SIGPIPE in quartz mode - r = read( darwinEventFD, &ev, sizeof(ev)); - if ((r == -1) && (errno != EAGAIN)) { - ErrorF("read(darwinEventFD) failed, errno=%d: %s\n", errno, strerror(errno)); - return; - } else if ((r == -1) && (errno == EAGAIN)) { - return; - } else if ( r != sizeof( ev ) ) { - ErrorF( "Only read %i bytes from darwinPipe!\n", r ); - return; - } - - gotread = true; - gettimeofday(&tv, &tz); + while (TRUE) { - // translate it to an X event and post it - memset(&xe, 0, sizeof(xe)); - - xe.u.keyButtonPointer.rootX = ev.location.x; - xe.u.keyButtonPointer.rootY = ev.location.y; - //xe.u.keyButtonPointer.time = ev.time; - xe.u.keyButtonPointer.time = tv.tv_sec * 1000 + tv.tv_usec / 1000; - - /* A newer kernel generates multi-button events by NX_SYSDEFINED. - See iokit/Families/IOHIDSystem/IOHIDSystem.cpp version 1.1.1.7, - 2000/08/10 00:23:37 or later. */ - - switch( ev.type ) { - case NX_MOUSEMOVED: - xe.u.u.type = MotionNotify; - (darwinPointer->public.processInputProc)( &xe, darwinPointer, 1 ); + // try to read from our pipe + r = read( darwinEventFD, &ev, sizeof(ev)); + + if ((r == -1) && (errno == EAGAIN)) { + // no event available break; - - case NX_LMOUSEDOWN: - // Mimic multi-button mouse with Command and Option - if (fake3Buttons && ev.flags & (NX_COMMANDMASK | NX_ALTERNATEMASK)) { - int button; - int keycode; - if (ev.flags & NX_COMMANDMASK) { - button = 2; - keycode = darwinKeyCommandL; + } else if (r == -1) { + // FIXME: FatalError here? Reading may be permanently broken. + ErrorF( "Event pipe read failed, errno=%d: %s\n", + errno, strerror(errno) ); + break; + } else if ( r == 0 ) { + FatalError("Darwin ProcessInputEvents: EOF on event pipe!\n"); + } else if ( r != sizeof( ev ) ) { + ErrorF( "Only read %i bytes from event pipe!\n", r ); + break; + } + + gotread = true; + gettimeofday(&tv, &tz); + + // translate it to an X event and post it + memset(&xe, 0, sizeof(xe)); + + xe.u.keyButtonPointer.rootX = ev.location.x; + xe.u.keyButtonPointer.rootY = ev.location.y; + //xe.u.keyButtonPointer.time = ev.time; + xe.u.keyButtonPointer.time = tv.tv_sec * 1000 + tv.tv_usec / 1000; + + /* A newer kernel generates multi-button events by NX_SYSDEFINED. + See iokit/Families/IOHIDSystem/IOHIDSystem.cpp version 1.1.1.7, + 2000/08/10 00:23:37 or later. */ + + switch( ev.type ) { + case NX_MOUSEMOVED: + xe.u.u.type = MotionNotify; + (darwinPointer->public.processInputProc) + ( &xe, darwinPointer, 1 ); + break; + + case NX_LMOUSEDOWN: + // Mimic multi-button mouse with Command and Option + if (darwinFakeButtons && + ev.flags & (NX_COMMANDMASK | NX_ALTERNATEMASK)) { + int button; + int keycode; + if (ev.flags & NX_COMMANDMASK) { + button = 2; + keycode = darwinKeyCommandL; + } else { + button = 3; + keycode = darwinKeyOptionL; + } + DarwinSimulateMouseClick(xe, button, ButtonPress, + &keycode, 1); } else { - button = 3; - keycode = darwinKeyOptionL; + xe.u.u.detail = 1; + xe.u.u.type = ButtonPress; + (darwinPointer->public.processInputProc) + ( &xe, darwinPointer, 1 ); } - DarwinSimulateMouseClick(xe, button, ButtonPress, &keycode, 1); - } else { - xe.u.u.detail = 1; //de.key = button 1; - xe.u.u.type = ButtonPress; - (darwinPointer->public.processInputProc) - ( &xe, darwinPointer, 1 ); - } - break; - - case NX_LMOUSEUP: - // Mimic multi-button mouse with Command and Option - if (fake3Buttons && ev.flags & (NX_COMMANDMASK | NX_ALTERNATEMASK)) { - int button; - int keycode; - if (ev.flags & NX_COMMANDMASK) { - button = 2; - keycode = darwinKeyCommandL; + break; + + case NX_LMOUSEUP: + // Mimic multi-button mouse with Command and Option + if (darwinFakeButtons && + ev.flags & (NX_COMMANDMASK | NX_ALTERNATEMASK)) { + int button; + int keycode; + if (ev.flags & NX_COMMANDMASK) { + button = 2; + keycode = darwinKeyCommandL; + } else { + button = 3; + keycode = darwinKeyOptionL; + } + DarwinSimulateMouseClick(xe, button, ButtonRelease, + &keycode, 1); } else { - button = 3; - keycode = darwinKeyOptionL; + xe.u.u.detail = 1; + xe.u.u.type = ButtonRelease; + (darwinPointer->public.processInputProc) + ( &xe, darwinPointer, 1 ); } - DarwinSimulateMouseClick(xe, button, ButtonRelease, &keycode, 1); - } else { - xe.u.u.detail = 1; //de.key = button 1; - xe.u.u.type = ButtonRelease; + break; + + // Button 2 isn't handled correctly by older kernels anyway. + // Just let NX_SYSDEFINED events handle these. + case NX_RMOUSEDOWN: +#if 0 + xe.u.u.detail = 2; + xe.u.u.type = ButtonPress; (darwinPointer->public.processInputProc) ( &xe, darwinPointer, 1 ); - } - break; - -// Button 2 isn't handled correctly by older kernels anyway. Just let -// NX_SYSDEFINED events handle these. - case NX_RMOUSEDOWN: -#if 0 - xe.u.u.detail = 2; //de.key; - xe.u.u.type = ButtonPress; - (darwinPointer->public.processInputProc)( &xe, darwinPointer, 1 ); #endif - break; - - case NX_RMOUSEUP: + break; + + case NX_RMOUSEUP: #if 0 - xe.u.u.detail = 2; //de.key; - xe.u.u.type = ButtonRelease; - (darwinPointer->public.processInputProc)( &xe, darwinPointer, 1 ); + xe.u.u.detail = 2; + xe.u.u.type = ButtonRelease; + (darwinPointer->public.processInputProc) + ( &xe, darwinPointer, 1 ); #endif - break; - - case NX_KEYDOWN: - xe.u.u.type = KeyPress; - xe.u.u.detail = ev.data.key.keyCode + MIN_KEYCODE; - (darwinKeyboard->public.processInputProc)( &xe, darwinKeyboard, 1 ); - break; - - case NX_KEYUP: - xe.u.u.type = KeyRelease; - xe.u.u.detail = ev.data.key.keyCode + MIN_KEYCODE; - (darwinKeyboard->public.processInputProc)(&xe, darwinKeyboard, 1); - break; - - case NX_FLAGSCHANGED: - { - // Assumes only one flag has changed. In quartz mode, - // this restriction must be enforced by the quartz event feeder. - int new_on_flags = ~old_state & ev.flags; - int new_off_flags = old_state & ~ev.flags; - old_state = ev.flags; - xe.u.u.detail = ev.data.key.keyCode + MIN_KEYCODE; - - // alphalock is toggled rather than held on, - // so we have to handle it differently - if (new_on_flags & NX_ALPHASHIFTMASK || - new_off_flags & NX_ALPHASHIFTMASK) { + break; + + case NX_KEYDOWN: xe.u.u.type = KeyPress; + xe.u.u.detail = ev.data.key.keyCode + MIN_KEYCODE; (darwinKeyboard->public.processInputProc) - (&xe, darwinKeyboard, 1); + ( &xe, darwinKeyboard, 1 ); + break; + + case NX_KEYUP: xe.u.u.type = KeyRelease; + xe.u.u.detail = ev.data.key.keyCode + MIN_KEYCODE; (darwinKeyboard->public.processInputProc) (&xe, darwinKeyboard, 1); break; - } - - if (new_on_flags) { - xe.u.u.type = KeyPress; - } else if (new_off_flags) { - xe.u.u.type = KeyRelease; - } else { + + case NX_FLAGSCHANGED: + { + // Assumes only one flag has changed. In Quartz mode, this + // restriction must be enforced by the Quartz event feeder. + int new_on_flags = ~old_state & ev.flags; + int new_off_flags = old_state & ~ev.flags; + old_state = ev.flags; + xe.u.u.detail = ev.data.key.keyCode + MIN_KEYCODE; + + // Alphalock is toggled rather than held on, + // so we have to handle it differently. + if (new_on_flags & NX_ALPHASHIFTMASK || + new_off_flags & NX_ALPHASHIFTMASK) { + xe.u.u.type = KeyPress; + (darwinKeyboard->public.processInputProc) + (&xe, darwinKeyboard, 1); + xe.u.u.type = KeyRelease; + (darwinKeyboard->public.processInputProc) + (&xe, darwinKeyboard, 1); + break; + } + + if (new_on_flags) { + xe.u.u.type = KeyPress; + } else if (new_off_flags) { + xe.u.u.type = KeyRelease; + } else { + break; + } + (darwinKeyboard->public.processInputProc) + (&xe, darwinKeyboard, 1); break; } - (darwinKeyboard->public.processInputProc)(&xe, darwinKeyboard, 1); - break; - } - - case NX_SYSDEFINED: - if (ev.data.compound.subType == 7) { - long hwDelta = ev.data.compound.misc.L[0]; - long hwButtons = ev.data.compound.misc.L[1]; - int i; - - for (i = 1; i < 4; i++) { - if (hwDelta & (1 << i)) { - xe.u.u.detail = i + 1; - if (hwButtons & (1 << i)) { - xe.u.u.type = ButtonPress; - } else { - xe.u.u.type = ButtonRelease; + + case NX_SYSDEFINED: + if (ev.data.compound.subType == 7) { + long hwDelta = ev.data.compound.misc.L[0]; + long hwButtons = ev.data.compound.misc.L[1]; + int i; + + for (i = 1; i < 4; i++) { + if (hwDelta & (1 << i)) { + xe.u.u.detail = i + 1; + if (hwButtons & (1 << i)) { + xe.u.u.type = ButtonPress; + } else { + xe.u.u.type = ButtonRelease; + } + (darwinPointer->public.processInputProc) + ( &xe, darwinPointer, 1 ); } - (darwinPointer->public.processInputProc) - ( &xe, darwinPointer, 1 ); } } - } - break; - - case NX_SCROLLWHEELMOVED: - { - short count = ev.data.scrollWheel.deltaAxis1; - - if (count > 0) { - xe.u.u.detail = SCROLLWHEELUPFAKE; - } else { - xe.u.u.detail = SCROLLWHEELDOWNFAKE; - count = -count; - } - - for (; count; --count) { - xe.u.u.type = ButtonPress; - (darwinPointer->public.processInputProc) - ( &xe, darwinPointer, 1 ); - xe.u.u.type = ButtonRelease; - (darwinPointer->public.processInputProc) - ( &xe, darwinPointer, 1 ); - } - break; - } - - // Special events for Quartz support - case NX_APPDEFINED: - if (quartz) { - switch (ev.data.compound.subType) { - - // Update modifier state. As opposed to NX_FLAGSCHANGED, - // in this case any amount of modifiers may have changed. - case kXServerUpdateModifiers: - xe.u.u.type = KeyRelease; - DarwinUpdateModifiers(xe, old_state & ~ev.flags); - xe.u.u.type = KeyPress; - DarwinUpdateModifiers(xe, ~old_state & ev.flags); - old_state = ev.flags; - break; - - case kXServerShow: - QuartzShow(); break; - - case kXServerHide: - QuartzHide(); - break; - - case kXServerQuit: - // FIXME: is there a better way to quit? - FatalError("Terminated by Xmaster.\n"); + + case NX_SCROLLWHEELMOVED: + { + short count = ev.data.scrollWheel.deltaAxis1; + + if (count > 0) { + xe.u.u.detail = SCROLLWHEELUPFAKE; + } else { + xe.u.u.detail = SCROLLWHEELDOWNFAKE; + count = -count; + } + + for (; count; --count) { + xe.u.u.type = ButtonPress; + (darwinPointer->public.processInputProc) + ( &xe, darwinPointer, 1 ); + xe.u.u.type = ButtonRelease; + (darwinPointer->public.processInputProc) + ( &xe, darwinPointer, 1 ); + } break; - - default: - ErrorF("Unknown event from Xmaster.\n"); - } // switch (ev.data.compound.subType) - } // if (quartz) - break; - - default: - ErrorF("Unknown event caught: %d\n", ev.type); - ErrorF("\tev.type = %d\n", ev.type); - ErrorF("\tev.location.x,y = %d,%d\n", ev.location.x, ev.location.y); - ErrorF("\tev.time = %ld\n", ev.time); - ErrorF("\tev.flags = 0x%x\n", ev.flags); - ErrorF("\tev.window = %d\n", ev.window); - ErrorF("\tev.data.key.origCharSet = %d\n", ev.data.key.origCharSet); - ErrorF("\tev.data.key.charSet = %d\n", ev.data.key.charSet); - ErrorF("\tev.data.key.charCode = %d\n", ev.data.key.charCode); - ErrorF("\tev.data.key.keyCode = %d\n", ev.data.key.keyCode); - ErrorF("\tev.data.key.origCharCode = %d\n", ev.data.key.origCharCode); + } + + // Special events for Quartz support + case NX_APPDEFINED: + if (quartz) { + switch (ev.data.compound.subType) { + + // Update modifier state. As opposed to NX_FLAGSCHANGED, + // in this case any amount of modifiers may have changed. + case kXDarwinUpdateModifiers: + xe.u.u.type = KeyRelease; + DarwinUpdateModifiers(xe, old_state & ~ev.flags); + xe.u.u.type = KeyPress; + DarwinUpdateModifiers(xe, ~old_state & ev.flags); + old_state = ev.flags; + break; + + case kXDarwinShow: + QuartzShow(); + break; + + case kXDarwinHide: + QuartzHide(); + break; + + case kXDarwinQuit: + GiveUp(0); + break; + + case kXDarwinReadPasteboard: + QuartzReadPasteboard(); + break; + + case kXDarwinWritePasteboard: + QuartzWritePasteboard(); + break; + + default: + ErrorF("Unknown application defined event.\n"); + } // switch (ev.data.compound.subType) + } // if (quartz) break; + + default: + ErrorF("Unknown event caught: %d\n", ev.type); + ErrorF("\tev.type = %d\n", ev.type); + ErrorF("\tev.location.x,y = %d,%d\n", ev.location.x, ev.location.y); + ErrorF("\tev.time = %ld\n", ev.time); + ErrorF("\tev.flags = 0x%x\n", ev.flags); + ErrorF("\tev.window = %d\n", ev.window); + ErrorF("\tev.data.key.origCharSet = %d\n", ev.data.key.origCharSet); + ErrorF("\tev.data.key.charSet = %d\n", ev.data.key.charSet); + ErrorF("\tev.data.key.charCode = %d\n", ev.data.key.charCode); + ErrorF("\tev.data.key.keyCode = %d\n", ev.data.key.keyCode); + ErrorF("\tev.data.key.origCharCode = %d\n", ev.data.key.origCharCode); + break; + } + + // why isn't this handled automatically by X??? + //miPointerAbsoluteCursor( ev.location.x, ev.location.y, ev.time ); + miPointerAbsoluteCursor( ev.location.x, ev.location.y, + tv.tv_sec * 1000 + tv.tv_usec / 1000 ); } - // why isn't this handled automatically by X??? - //miPointerAbsoluteCursor( ev.location.x, ev.location.y, ev.time ); - miPointerAbsoluteCursor( ev.location.x, ev.location.y, - tv.tv_sec * 1000 + tv.tv_usec / 1000 ); miPointerUpdate(); } @@ -741,7 +773,7 @@ void OsVendorFatalError( void ) /* * OsVendorInit - * One-time initialization of Darwin support. + * Initialization of Darwin support. * Initialize display and event handling. */ void OsVendorInit(void) @@ -763,7 +795,6 @@ void OsVendorInit(void) */ int ddxProcessArgument( int argc, char *argv[], int i ) { -#if 0 if ( !strcmp( argv[i], "-screen" ) ) { if ( i == argc-1 ) { FatalError( "-screen must be followed by a number\n" ); @@ -772,16 +803,15 @@ int ddxProcessArgument( int argc, char *argv[], int i ) ErrorF( "Attempting to use screen number %i\n", darwinScreenNumber ); return 2; } -#endif if ( !strcmp( argv[i], "-fakebuttons" ) ) { - fake3Buttons = TRUE; + darwinFakeButtons = TRUE; ErrorF( "Faking a three button mouse\n" ); return 1; } if ( !strcmp( argv[i], "-nofakebuttons" ) ) { - fake3Buttons = FALSE; + darwinFakeButtons = FALSE; ErrorF( "Not faking a three button mouse\n" ); return 1; } @@ -791,11 +821,21 @@ int ddxProcessArgument( int argc, char *argv[], int i ) quartz = TRUE; ErrorF( "Running in parallel with Mac OS X Quartz window server.\n" ); #ifdef QUARTZ_SAFETY_DELAY - ErrorF( "Quitting in %d seconds if no controller application is found.\n", + ErrorF( "Quitting in %d seconds if no controller is found.\n", QUARTZ_SAFETY_DELAY ); #endif return 1; } + + // The Mac OS X front end uses this argument, which we just ignore here. + if ( !strcmp( argv[i], "-nostartx" ) ) { + return 1; + } + + // This command line arg is passed when launched from the Aqua GUI. + if ( !strncmp( argv[i], "-psn_", 5 ) ) { + return 1; + } #endif if ( !strcmp( argv[i], "-size" ) ) { @@ -867,9 +907,6 @@ void ddxUseMsg( void ) ErrorF("\n"); ErrorF("Device Dependent Usage:\n"); ErrorF("\n"); -#if 0 - ErrorF("-screen <0,1,...> : use this mac screen num.\n" ); -#endif ErrorF("-fakebuttons : fake a three button mouse with Command and Option keys.\n"); ErrorF("-nofakebuttons : don't fake a three button mouse.\n"); ErrorF("-version : show the server version\n"); @@ -878,6 +915,7 @@ void ddxUseMsg( void ) ErrorF("\n"); ErrorF("IOKit specific options (ignored with -quartz):\n"); #endif + ErrorF("-screen <0,1,...> : use this screen number.\n"); ErrorF("-size <height> <width> : use a screen resolution of <height> x <width>.\n"); ErrorF("-depth <8,15,24> : use this bit depth.\n"); ErrorF("-refresh <rate> : use a monitor refresh rate of <rate> Hz.\n"); @@ -891,6 +929,7 @@ void ddxUseMsg( void ) void ddxGiveUp( void ) { ErrorF( " ddxGiveUp\n" ); + close(darwinEventFD); if (quartz) { QuartzGiveUp(); diff --git a/xc/programs/Xserver/hw/darwin/darwin.h b/xc/programs/Xserver/hw/darwin/darwin.h index 385142e3a..95a1720f9 100644 --- a/xc/programs/Xserver/hw/darwin/darwin.h +++ b/xc/programs/Xserver/hw/darwin/darwin.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.h,v 1.3 2001/01/23 21:14:26 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.h,v 1.5 2001/04/02 05:39:36 torrey Exp $ */ #ifndef _DARWIN_H #define _DARWIN_H @@ -44,5 +44,6 @@ extern Bool quartz; extern UInt32 darwinDesiredWidth, darwinDesiredHeight; extern IOIndex darwinDesiredDepth; extern SInt32 darwinDesiredRefresh; +extern UInt32 darwinScreenNumber; #endif /* _DARWIN_H */ diff --git a/xc/programs/Xserver/hw/darwin/darwinKeyboard.c b/xc/programs/Xserver/hw/darwin/darwinKeyboard.c index 99f540332..1f466db01 100644 --- a/xc/programs/Xserver/hw/darwin/darwinKeyboard.c +++ b/xc/programs/Xserver/hw/darwin/darwinKeyboard.c @@ -36,7 +36,7 @@ // //============================================================================= -/* $XFree86: xc/programs/Xserver/hw/darwin/darwinKeyboard.c,v 1.3 2001/01/24 07:19:55 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwinKeyboard.c,v 1.4 2001/04/01 07:12:13 torrey Exp $ */ /* =========================================================================== @@ -62,6 +62,8 @@ #include <drivers/event_status_driver.h> #include <IOKit/hidsystem/ev_keymap.h> #include "darwin.h" +#include "xfIOKit.h" +#include "bundle/quartzAudio.h" #define XK_TECHNICAL // needed to get XK_Escape #include "keysym.h" @@ -189,10 +191,6 @@ static darwinKeyPad_t const normal_to_keypad[] = { }; int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]); -static void DarwinBell( int loud, DeviceIntPtr pDevice, pointer ctrl, int fbclass) { - // FIXME -} - static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl ) { // keyclick, bell volume / pitch, autorepead, LED's } @@ -322,6 +320,7 @@ void DarwinKeyboardInit( NXKeyMapping keyMap; DataStream *keyMapStream; unsigned char const *numPadStart = 0; + BellProcPtr bellProc; memset( modMap, NoSymbol, sizeof( modMap ) ); memset( map, 0, sizeof( map ) ); @@ -489,8 +488,13 @@ void DarwinKeyboardInit( keySyms.minKeyCode = MIN_KEYCODE; keySyms.maxKeyCode = MAX_KEYCODE; + if (quartz) + bellProc = QuartzBell; + else + bellProc = XFIOKitBell; + assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms, modMap, - DarwinBell, + bellProc, DarwinChangeKeyboardControl )); } diff --git a/xc/programs/Xserver/hw/darwin/xfIOKit.c b/xc/programs/Xserver/hw/darwin/xfIOKit.c index 1507f5052..5f6f93c90 100644 --- a/xc/programs/Xserver/hw/darwin/xfIOKit.c +++ b/xc/programs/Xserver/hw/darwin/xfIOKit.c @@ -8,7 +8,7 @@ * Significantly rewritten for XFree86 4.0.1 by Torrey Lyons * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/xfIOKit.c,v 1.2 2001/01/23 21:14:26 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/xfIOKit.c,v 1.5 2001/04/02 05:39:36 torrey Exp $ */ #define NDEBUG 1 @@ -87,6 +87,18 @@ static void XFIOKitStoreColors( } /* + * XFIOKitBell + * FIXME + */ +void XFIOKitBell( + int loud, + DeviceIntPtr pDevice, + pointer ctrl, + int fbclass) +{ +} + +/* * XFIOKitGiveUp * FIXME: Crashes kernel if used */ @@ -200,12 +212,23 @@ static void SetupFBandHID(void) &iter ); kern_assert( kr ); + // find the requested screen assert(service = IOIteratorNext(iter)); + for (i = 0; i < darwinScreenNumber; i++) { + service = IOIteratorNext(iter); + if (service == 0) + FatalError("Could not find the requested screen number %i.\n", + darwinScreenNumber); + } kr = IOServiceOpen( service, mach_task_self(), kIOFBServerConnectType, &dfb.fbService ); if (kr != KERN_SUCCESS) - FatalError("failed to connect as window server!\nMake sure you have quit the Mac OS X window server.\n"); +#ifdef DARWIN_WITH_QUARTZ + FatalError("Failed to connect as window server!\nQuit the Mac OS X window server or use the -quartz option.\n"); +#else + FatalError("Failed to connect as window server!\nMake sure you have quit the Mac OS X window server.\n"); +#endif IOObjectRelease( service ); IOObjectRelease( iter ); diff --git a/xc/programs/Xserver/hw/darwin/xfIOKit.h b/xc/programs/Xserver/hw/darwin/xfIOKit.h index 3d9a073c0..f53d3ba58 100644 --- a/xc/programs/Xserver/hw/darwin/xfIOKit.h +++ b/xc/programs/Xserver/hw/darwin/xfIOKit.h @@ -3,6 +3,7 @@ IOKit specific functions and definitions */ +/* $XFree86: xc/programs/Xserver/hw/darwin/xfIOKit.h,v 1.3 2001/04/01 07:12:13 torrey Exp $ */ #ifndef _XFIOKIT_H #define _XFIOKIT_H @@ -14,5 +15,6 @@ Bool XFIOKitAddScreen(ScreenPtr pScreen); Bool XFIOKitInitCursor(ScreenPtr pScreen); void XFIOKitOsVendorInit(void); void XFIOKitGiveUp(void); +void XFIOKitBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class); #endif diff --git a/xc/programs/Xserver/hw/darwin/xfIOKitStartup.c b/xc/programs/Xserver/hw/darwin/xfIOKitStartup.c new file mode 100644 index 000000000..284d97c87 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/xfIOKitStartup.c @@ -0,0 +1,56 @@ +/************************************************************** + * + * Startup code for the IOKit Darwin X Server + * + **************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/darwin/xfIOKitStartup.c,v 1.2 2001/04/01 07:12:13 torrey Exp $ */ + +#include "mi.h" +#include "mipointer.h" +#include "scrnintstr.h" + +/* + * DarwinHandleGUI + * This function is called first from main(). + * It does nothing for the IOKit X server. + */ +void DarwinHandleGUI( + int argc, + char *argv[], + char *envp[] ) +{ +} + +// No Quartz support. All Quartz functions are no-ops. + +BOOL QuartzAddScreen(ScreenPtr pScreen) { + FatalError("QuartzAddScreen called without Quartz support.\n"); +} + +void QuartzOsVendorInit(void) { + FatalError("QuartzOsVendorInit called without Quartz support.\n"); +} + +void QuartzGiveUp(void) { + FatalError("QuartzGiveUp called without Quartz support.\n"); +} + +void QuartzHide(void) { + FatalError("QuartzHide called without Quartz support.\n"); +} + +void QuartzShow(void) { + FatalError("QuartzShow called without Quartz support.\n"); +} + +void QuartzReadPasteboard(void) { + FatalError("QuartzReadPasteboard called without Quartz support.\n"); +} + +void QuartzWritePasteboard(void) { + FatalError("QuartzWritePasteboard called without Quartz support.\n"); +} + +void QuartzBell(void) { + FatalError("QuartzBell called without Quartz support.\n"); +} diff --git a/xc/programs/Xserver/hw/kdrive/Imakefile b/xc/programs/Xserver/hw/kdrive/Imakefile index 96f45c2e8..fd7488492 100644 --- a/xc/programs/Xserver/hw/kdrive/Imakefile +++ b/xc/programs/Xserver/hw/kdrive/Imakefile @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.5 2000/12/01 00:01:30 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.6 2001/03/30 02:15:19 keithp Exp $ KDRIVE=. #include "Kdrive.tmpl" @@ -8,11 +8,16 @@ RENDERSRCS=kpict.c RENDEROBJS=kpict.o #endif +#if BuildXvExt +XVSRCS=kxv.c +XVOBJS=kxv.o +#endif + SRCS = kcmap.c kcolor.c kdrive.c kinfo.c kinput.c kmap.c knoop.c ktest.c \ - vga.c kasync.c kmode.c kcurscol.c kshadow.c $(RENDERSRCS) + vga.c kasync.c kmode.c kcurscol.c kshadow.c $(RENDERSRCS) $(XVSRCS) OBJS = kcmap.o kcolor.o kdrive.o kinfo.o kinput.o kmap.o knoop.o ktest.o \ - vga.o kasync.o kmode.o kcurscol.o kshadow.o $(RENDEROBJS) + vga.o kasync.o kmode.o kcurscol.o kshadow.o $(RENDEROBJS) $(XVOBJS) INCLUDES = $(KDINCS) diff --git a/xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c b/xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c index df001dbf5..f5225ca22 100644 --- a/xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c +++ b/xc/programs/Xserver/hw/kdrive/fbdev/fbdev.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/fbdev/fbdev.c,v 1.10 2000/10/03 17:22:14 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/fbdev/fbdev.c,v 1.11 2001/03/30 02:15:20 keithp Exp $ */ #include "fbdev.h" @@ -119,6 +119,11 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv) screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length); screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length); screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length); +#ifdef ITSY + screen->fb[0].redMask = 0xf800; + screen->fb[0].greenMask = 0x07e0; + screen->fb[0].blueMask = 0x001f; +#endif allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask; depth = 32; while (depth && !(allbits & (1 << (depth - 1)))) diff --git a/xc/programs/Xserver/hw/kdrive/i810/Imakefile b/xc/programs/Xserver/hw/kdrive/i810/Imakefile new file mode 100644 index 000000000..c49e14e56 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/Imakefile @@ -0,0 +1,21 @@ +XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ +XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/i810/Imakefile,v 1.1 2001/03/30 02:18:41 keithp Exp $ +KDRIVE=.. +#include "../Kdrive.tmpl" + +#if BuildXvExt +XVSRCS = i810_video.c +XVOBJS = i810_video.o +#endif + +SRCS = i810.c i810stub.c i810draw.c i810_cursor.c $(XVSRCS) + +OBJS = i810.o i810stub.o i810draw.o i810_cursor.o $(XVOBJS) + +DEFINES = XvExtensionDefines /* -DI810CFG_SHOW_OVERSCAN */ + +INCLUDES = -I. $(KDINCS) + +NormalLibraryObjectRule() +NormalLibraryTarget(i810,$(OBJS)) +DependTarget() diff --git a/xc/programs/Xserver/hw/kdrive/i810/i810.c b/xc/programs/Xserver/hw/kdrive/i810/i810.c new file mode 100644 index 000000000..2ad214f8d --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/i810.c @@ -0,0 +1,2096 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + + +/* $XFree86: xc/programs/Xserver/hw/kdrive/i810/i810.c,v 1.1 2001/03/30 02:18:41 keithp Exp $ */ + +/* + * i810.c - KDrive driver for the i810 chipset + * + * Authors: + * Pontus Lidman <pontus.lidman@nokia.com> + * + */ + +#include "kdrive.h" +#include "kxv.h" + +#include "i810.h" +#include "linux/agp.h" + +#include "i810draw.h" + +Bool i810InitVideo(ScreenPtr pScreen); + +#ifndef I810_DEBUG +int I810_DEBUG = (0 +/* | DEBUG_ALWAYS_SYNC */ +/* | DEBUG_VERBOSE_ACCEL */ +/* | DEBUG_VERBOSE_SYNC */ +/* | DEBUG_VERBOSE_VGA */ +/* | DEBUG_VERBOSE_RING */ +/* | DEBUG_VERBOSE_OUTREG */ +/* | DEBUG_VERBOSE_MEMORY */ +/* | DEBUG_VERBOSE_CURSOR */ + ); +#endif + + +static Bool +i810ModeInit(KdScreenInfo *screen, const KdMonitorTiming *t); + +static void +i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode ); + +Bool +i810CardInit (KdCardInfo *card) +{ + int i; + + I810CardInfo *i810c; + +/* fprintf(stderr,"i810CardInit\n"); */ + + i810c = (I810CardInfo *) xalloc (sizeof (I810CardInfo)); + + if (!i810c) + return FALSE; + + /* 2MB Video RAM */ + i810c->videoRam=2048; + + /* Find FB address */ + + if (card->attr.address[1] != 0) { + i810c->LinearAddr = card->attr.address[0] & 0xFF000000; + + if (!i810c->LinearAddr) { + fprintf(stderr,"No valid FB address in PCI config space(1)\n"); + xfree(i810c); + return FALSE; + } else { +/* fprintf(stderr,"Linear framebuffer at %lx\n",i810c->LinearAddr); */ + } + } else { + fprintf(stderr,"No valid FB address in PCI config space(2)\n"); + xfree(i810c); + return FALSE; + } + + if (card->attr.address[1]) { + + i810c->MMIOAddr = card->attr.address[1] & 0xFFF80000; + + i810c->MMIOBase = + KdMapDevice (i810c->MMIOAddr, I810_REG_SIZE); + if (!i810c->MMIOBase) { + fprintf(stderr,"No valid MMIO address in PCI config space(1)\n"); + xfree(i810c); + return FALSE; + } else { + + } + } else { + fprintf(stderr,"No valid MMIO address in PCI config space(2)\n"); + xfree(i810c); + return FALSE; + } + +/* fprintf(stderr,"Mapped 0x%x bytes of MMIO regs at phys 0x%lx virt %p\n", */ +/* I810_REG_SIZE,i810c->MMIOAddr,i810c->MMIOBase); */ + + /* Find out memory bus frequency. + */ + + { + unsigned long *p; + unsigned char *LinuxGetPciCfg(KdCardAttr *attr); + + + if (!(p= (unsigned long *) LinuxGetPciCfg(&card->attr))) + return FALSE; + +/* fprintf(stderr,"Frequency long %lx\n",p[WHTCFG_PAMR_DRP]); */ + + if ( (p[WHTCFG_PAMR_DRP] & LM_FREQ_MASK) == LM_FREQ_133 ) + i810c->LmFreqSel = 133; + else + i810c->LmFreqSel = 100; + + xfree(p); + +/* fprintf(stderr,"Selected frequency %d\n",i810c->LmFreqSel); */ + } + +/* fprintf(stderr,"Will alloc AGP framebuffer: %d kByte\n",i810c->videoRam); */ + + /* Since we always want write combining on first 32 mb of framebuffer + * we pass a mapsize of 32 mb */ + i810c->FbMapSize = 32*1024*1024; + + for (i = 2 ; i < i810c->FbMapSize ; i <<= 1); + i810c->FbMapSize = i; + + i810c->FbBase = + KdMapDevice (i810c->LinearAddr, i810c->FbMapSize); + + if (!i810c->FbBase) return FALSE; +/* fprintf(stderr,"Mapped 0x%lx bytes of framebuffer at %p\n", */ +/* i810c->FbMapSize,i810c->FbBase); */ + + card->driver=i810c; + + return TRUE; +} + +void +i810ScreenFini (KdScreenInfo *screen) +{ + I810ScreenInfo *i810s = (I810ScreenInfo *) screen->driver; + + xfree (i810s); + screen->driver = 0; +} + +Bool +i810InitScreen (ScreenPtr pScreen) { + +#ifdef XV + i810InitVideo(pScreen); +#endif + return TRUE; +} + +void +i810CardFini (KdCardInfo *card) +{ + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + KdUnmapDevice (i810c->FbBase, i810c->FbMapSize); + KdUnmapDevice (i810c->MMIOBase, I810_REG_SIZE); + xfree (i810c); + card->driver = 0; +} + +struct wm_info { + double freq; + unsigned int wm; +}; + +struct wm_info i810_wm_8_100[] = { + { 0, 0x22003000 }, + { 25.2, 0x22003000 }, + { 28.0, 0x22003000 }, + { 31.5, 0x22003000 }, + { 36.0, 0x22007000 }, + { 40.0, 0x22007000 }, + { 45.0, 0x22007000 }, + { 49.5, 0x22008000 }, + { 50.0, 0x22008000 }, + { 56.3, 0x22008000 }, + { 65.0, 0x22008000 }, + { 75.0, 0x22008000 }, + { 78.8, 0x22008000 }, + { 80.0, 0x22008000 }, + { 94.0, 0x22008000 }, + { 96.0, 0x22107000 }, + { 99.0, 0x22107000 }, + { 108.0, 0x22107000 }, + { 121.0, 0x22107000 }, + { 128.9, 0x22107000 }, + { 132.0, 0x22109000 }, + { 135.0, 0x22109000 }, + { 157.5, 0x2210b000 }, + { 162.0, 0x2210b000 }, + { 175.5, 0x2210b000 }, + { 189.0, 0x2220e000 }, + { 202.5, 0x2220e000 } +}; + +struct wm_info i810_wm_16_100[] = { + { 0, 0x22004000 }, + { 25.2, 0x22006000 }, + { 28.0, 0x22006000 }, + { 31.5, 0x22007000 }, + { 36.0, 0x22007000 }, + { 40.0, 0x22007000 }, + { 45.0, 0x22007000 }, + { 49.5, 0x22009000 }, + { 50.0, 0x22009000 }, + { 56.3, 0x22108000 }, + { 65.0, 0x2210e000 }, + { 75.0, 0x2210e000 }, + { 78.8, 0x2210e000 }, + { 80.0, 0x22210000 }, + { 94.5, 0x22210000 }, + { 96.0, 0x22210000 }, + { 99.0, 0x22210000 }, + { 108.0, 0x22210000 }, + { 121.0, 0x22210000 }, + { 128.9, 0x22210000 }, + { 132.0, 0x22314000 }, + { 135.0, 0x22314000 }, + { 157.5, 0x22415000 }, + { 162.0, 0x22416000 }, + { 175.5, 0x22416000 }, + { 189.0, 0x22416000 }, + { 195.0, 0x22416000 }, + { 202.5, 0x22416000 } +}; + + +struct wm_info i810_wm_24_100[] = { + { 0, 0x22006000 }, + { 25.2, 0x22009000 }, + { 28.0, 0x22009000 }, + { 31.5, 0x2200a000 }, + { 36.0, 0x2210c000 }, + { 40.0, 0x2210c000 }, + { 45.0, 0x2210c000 }, + { 49.5, 0x22111000 }, + { 50.0, 0x22111000 }, + { 56.3, 0x22111000 }, + { 65.0, 0x22214000 }, + { 75.0, 0x22214000 }, + { 78.8, 0x22215000 }, + { 80.0, 0x22216000 }, + { 94.5, 0x22218000 }, + { 96.0, 0x22418000 }, + { 99.0, 0x22418000 }, + { 108.0, 0x22418000 }, + { 121.0, 0x22418000 }, + { 128.9, 0x22419000 }, + { 132.0, 0x22519000 }, + { 135.0, 0x4441d000 }, + { 157.5, 0x44419000 }, + { 162.0, 0x44419000 }, + { 175.5, 0x44419000 }, + { 189.0, 0x44419000 }, + { 195.0, 0x44419000 }, + { 202.5, 0x44419000 } +}; + +struct wm_info i810_wm_32_100[] = { + { 0, 0x2210b000 }, + { 60, 0x22415000 }, /* 0x314000 works too */ + { 80, 0x22419000 } /* 0x518000 works too */ +}; + + +struct wm_info i810_wm_8_133[] = { + { 0, 0x22003000 }, + { 25.2, 0x22003000 }, + { 28.0, 0x22003000 }, + { 31.5, 0x22003000 }, + { 36.0, 0x22007000 }, + { 40.0, 0x22007000 }, + { 45.0, 0x22007000 }, + { 49.5, 0x22008000 }, + { 50.0, 0x22008000 }, + { 56.3, 0x22008000 }, + { 65.0, 0x22008000 }, + { 75.0, 0x22008000 }, + { 78.8, 0x22008000 }, + { 80.0, 0x22008000 }, + { 94.0, 0x22008000 }, + { 96.0, 0x22107000 }, + { 99.0, 0x22107000 }, + { 108.0, 0x22107000 }, + { 121.0, 0x22107000 }, + { 128.9, 0x22107000 }, + { 132.0, 0x22109000 }, + { 135.0, 0x22109000 }, + { 157.5, 0x2210b000 }, + { 162.0, 0x2210b000 }, + { 175.5, 0x2210b000 }, + { 189.0, 0x2220e000 }, + { 202.5, 0x2220e000 } +}; + + +struct wm_info i810_wm_16_133[] = { + { 0, 0x22004000 }, + { 25.2, 0x22006000 }, + { 28.0, 0x22006000 }, + { 31.5, 0x22007000 }, + { 36.0, 0x22007000 }, + { 40.0, 0x22007000 }, + { 45.0, 0x22007000 }, + { 49.5, 0x22009000 }, + { 50.0, 0x22009000 }, + { 56.3, 0x22108000 }, + { 65.0, 0x2210e000 }, + { 75.0, 0x2210e000 }, + { 78.8, 0x2210e000 }, + { 80.0, 0x22210000 }, + { 94.5, 0x22210000 }, + { 96.0, 0x22210000 }, + { 99.0, 0x22210000 }, + { 108.0, 0x22210000 }, + { 121.0, 0x22210000 }, + { 128.9, 0x22210000 }, + { 132.0, 0x22314000 }, + { 135.0, 0x22314000 }, + { 157.5, 0x22415000 }, + { 162.0, 0x22416000 }, + { 175.5, 0x22416000 }, + { 189.0, 0x22416000 }, + { 195.0, 0x22416000 }, + { 202.5, 0x22416000 } +}; + +struct wm_info i810_wm_24_133[] = { + { 0, 0x22006000 }, + { 25.2, 0x22009000 }, + { 28.0, 0x22009000 }, + { 31.5, 0x2200a000 }, + { 36.0, 0x2210c000 }, + { 40.0, 0x2210c000 }, + { 45.0, 0x2210c000 }, + { 49.5, 0x22111000 }, + { 50.0, 0x22111000 }, + { 56.3, 0x22111000 }, + { 65.0, 0x22214000 }, + { 75.0, 0x22214000 }, + { 78.8, 0x22215000 }, + { 80.0, 0x22216000 }, + { 94.5, 0x22218000 }, + { 96.0, 0x22418000 }, + { 99.0, 0x22418000 }, + { 108.0, 0x22418000 }, + { 121.0, 0x22418000 }, + { 128.9, 0x22419000 }, + { 132.0, 0x22519000 }, + { 135.0, 0x4441d000 }, + { 157.5, 0x44419000 }, + { 162.0, 0x44419000 }, + { 175.5, 0x44419000 }, + { 189.0, 0x44419000 }, + { 195.0, 0x44419000 }, + { 202.5, 0x44419000 } +}; + +static void +i810WriteControlMMIO(I810CardInfo *i810c, int addr, CARD8 index, CARD8 val) { + moutb(addr, index); + moutb(addr+1, val); +} + +static CARD8 +i810ReadControlMMIO(I810CardInfo *i810c, int addr, CARD8 index) { + moutb(addr, index); + return minb(addr+1); +} + +Bool +i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) +{ + /* This is just a guess. */ + if (t->horizontal > 1600 || t->horizontal < 640) return FALSE; + if (t->vertical > 1200 || t->horizontal < 350) return FALSE; + return TRUE; +} + +Bool +i810ModeUsable (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + int byte_width, pixel_width, screen_size; + +/* fprintf(stderr,"i810ModeUsable\n"); */ + + 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 + { + screen->fb[0].depth = 8; + screen->fb[0].bitsPerPixel = 8; + } + 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 <= (i810c->videoRam * 1024); +} + +int i810AllocateGARTMemory( KdScreenInfo *screen ) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + unsigned long size = i810c->videoRam * 1024; + + int key; + long tom = 0; + unsigned long physical; + + if (!KdAgpGARTSupported()) + return FALSE; + + if (!KdAcquireGART(screen->mynum)) + return FALSE; + + /* This allows the 2d only Xserver to regen */ + i810c->agpAcquired2d = TRUE; + + /* Treat the gart like video memory - we assume we own all that is + * there, so ignore EBUSY errors. Don't try to remove it on + * failure, either, as other X server may be using it. + */ + + if ((key = KdAllocateGARTMemory(screen->mynum, size, 0, NULL)) == -1) + return FALSE; + + i810c->VramOffset = 0; + i810c->VramKey = key; + + if (!KdBindGARTMemory(screen->mynum, key, 0)) + return FALSE; + + + i810c->SysMem.Start = 0; + i810c->SysMem.Size = size; + i810c->SysMem.End = size; + i810c->SavedSysMem = i810c->SysMem; + + tom = i810c->SysMem.End; + + i810c->DcacheMem.Start = 0; + i810c->DcacheMem.End = 0; + i810c->DcacheMem.Size = 0; + i810c->CursorPhysical = 0; + + /* Dcache - half the speed of normal ram, so not really useful for + * a 2d server. Don't bother reporting its presence. This is + * mapped in addition to the requested amount of system ram. + */ + size = 1024 * 4096; + + /* Keep it 512K aligned for the sake of tiled regions. + */ + tom += 0x7ffff; + tom &= ~0x7ffff; + + if ((key = KdAllocateGARTMemory(screen->mynum, size, AGP_DCACHE_MEMORY, NULL)) != -1) { + i810c->DcacheOffset= tom; + i810c->DcacheKey = key; + if (!KdBindGARTMemory(screen->mynum, key, tom)) { + fprintf(stderr,"Allocation of %ld bytes for DCACHE failed\n", size); + i810c->DcacheKey = -1; + } else { + i810c->DcacheMem.Start = tom; + i810c->DcacheMem.Size = size; + i810c->DcacheMem.End = i810c->DcacheMem.Start + i810c->DcacheMem.Size; + tom = i810c->DcacheMem.End; + } + } else { + fprintf(stderr, + "No physical memory available for %ld bytes of DCACHE\n", + size); + i810c->DcacheKey = -1; + } + + /* Mouse cursor -- The i810 (crazy) needs a physical address in + * 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 + */ + + size = 4096; + + if ((key = KdAllocateGARTMemory(screen->mynum, size, AGP_PHYS_MEMORY, + &physical)) == -1) { + fprintf(stderr, + "No physical memory available for HW cursor\n"); + i810c->HwcursKey = -1; + } else { + i810c->HwcursOffset= tom; + i810c->HwcursKey = key; + if (!KdBindGARTMemory(screen->mynum, key, tom)) { + fprintf(stderr, + "Allocation of %ld bytes for HW cursor failed\n", + size); + i810c->HwcursKey = -1; + } else { + i810c->CursorPhysical = physical; + i810c->CursorStart = tom; + tom += size; + } + } + + /* Overlay register buffer -- Just like the cursor, the i810 needs a + * physical address in system memory from which to upload the overlay + * registers. + */ + if (i810c->CursorStart != 0) { + i810c->OverlayPhysical = i810c->CursorPhysical + 1024; + i810c->OverlayStart = i810c->CursorStart + 1024; + } + + + i810c->GttBound = 1; + + return TRUE; +} + +/* Allocate from a memrange, returns success */ + +int i810AllocLow( I810MemRange *result, I810MemRange *pool, int size ) +{ + if (size > pool->Size) return FALSE; + + pool->Size -= size; + result->Size = size; + result->Start = pool->Start; + result->End = pool->Start += size; + return TRUE; +} + +int i810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ) +{ + if (size > pool->Size) return 0; + + pool->Size -= size; + result->Size = size; + result->End = pool->End; + result->Start = pool->End -= size; + return 1; +} + +Bool +i810AllocateFront(KdScreenInfo *screen) { + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + int cache_lines = -1; + + if(i810c->DoneFrontAlloc) + return TRUE; + + memset(&(i810c->FbMemBox), 0, sizeof(BoxRec)); + /* Alloc FrontBuffer/Ring/Accel memory */ + i810c->FbMemBox.x1=0; + i810c->FbMemBox.x2=screen->width; + i810c->FbMemBox.y1=0; + i810c->FbMemBox.y2=screen->height; + + /* This could be made a command line option */ + cache_lines = 0; + + if(cache_lines >= 0) + i810c->FbMemBox.y2 += cache_lines; + else { + /* make sure there is enough for two DVD sized YUV buffers */ + i810c->FbMemBox.y2 += (screen->fb[0].depth == 24) ? 256 : 384; + if (screen->width <= 1024) + i810c->FbMemBox.y2 += (screen->fb[0].depth == 24) ? 256 : 384; + cache_lines = i810c->FbMemBox.y2 - screen->height; + } + + if (I810_DEBUG) + ErrorF("Adding %i scanlines for pixmap caching\n", cache_lines); + + /* Reserve room for the framebuffer and pixcache. Put at the top + * of memory so we can have nice alignment for the tiled regions at + * the start of memory. + */ + i810AllocLow( &(i810c->FrontBuffer), + &(i810c->SysMem), + ((i810c->FbMemBox.x2 * + i810c->FbMemBox.y2 * + i810c->cpp) + 4095) & ~4095); + + memset( &(i810c->LpRing), 0, sizeof( I810RingBuffer ) ); + if(i810AllocLow( &(i810c->LpRing.mem), &(i810c->SysMem), 16*4096 )) { + if (I810_DEBUG & DEBUG_VERBOSE_MEMORY) + ErrorF( "ring buffer at local %lx\n", + i810c->LpRing.mem.Start); + + i810c->LpRing.tail_mask = i810c->LpRing.mem.Size - 1; + i810c->LpRing.virtual_start = i810c->FbBase + i810c->LpRing.mem.Start; + i810c->LpRing.head = 0; + i810c->LpRing.tail = 0; + i810c->LpRing.space = 0; + } + + if ( i810AllocLow( &i810c->Scratch, &(i810c->SysMem), 64*1024 ) || + i810AllocLow( &i810c->Scratch, &(i810c->SysMem), 16*1024 ) ) { + if (I810_DEBUG & DEBUG_VERBOSE_MEMORY) + ErrorF("Allocated Scratch Memory\n"); + } + +#ifdef XV + /* 720x720 is just how much memory the mpeg player needs for overlays */ + + if ( i810AllocHigh( &i810c->XvMem, &(i810c->SysMem), 720*720*2 )) { + if (I810_DEBUG & DEBUG_VERBOSE_MEMORY) + ErrorF("Allocated overlay Memory\n"); + } +#endif + + i810c->DoneFrontAlloc = TRUE; + return TRUE; +} + +static Bool +i810MapMem(KdScreenInfo *screen) +{ + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + i810c->LpRing.virtual_start = i810c->FbBase + i810c->LpRing.mem.Start; + + return TRUE; +} + + +Bool +i810ScreenInit (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + I810ScreenInfo *i810s; + + int i; + + const KdMonitorTiming *t; + +/* fprintf(stderr,"i810ScreenInit\n"); */ + + i810s = (I810ScreenInfo *) xalloc (sizeof (I810ScreenInfo)); + if (!i810s) + return FALSE; + + memset (i810s, '\0', sizeof (I810ScreenInfo)); + + /* Default dimensions */ + if (!screen->width || !screen->height) + { + screen->width = 720; + screen->height = 576; + screen->rate = 52; +#if 0 + screen->width = 1024; + screen->height = 768; + screen->rate = 72; +#endif + } + + if (!screen->fb[0].depth) + screen->fb[0].depth = 16; + + t = KdFindMode (screen, i810ModeSupported); + + screen->rate = t->rate; + screen->width = t->horizontal; + screen->height = t->vertical; + + if (!KdTuneMode (screen, i810ModeUsable, i810ModeSupported)) + { + xfree (i810c); + return FALSE; + } + +/* fprintf(stderr,"Screen rate %d horiz %d vert %d\n",t->rate,t->horizontal,t->vertical); */ + + switch (screen->fb[0].depth) { + case 8: + screen->fb[0].visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor) | + (1 << PseudoColor) | + (1 << TrueColor) | + (1 << DirectColor)); + screen->fb[0].blueMask = 0x00; + screen->fb[0].greenMask = 0x00; + screen->fb[0].redMask = 0x00; + break; + case 15: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x001f; + screen->fb[0].greenMask = 0x03e0; + screen->fb[0].redMask = 0x7c00; + + i810c->colorKey = 0x043f; + + break; + case 16: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x001f; + screen->fb[0].greenMask = 0x07e0; + screen->fb[0].redMask = 0xf800; + + i810c->colorKey = 0x083f; + + break; + case 24: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x0000ff; + screen->fb[0].greenMask = 0x00ff00; + screen->fb[0].redMask = 0xff0000; + + i810c->colorKey = 0x0101ff; + + break; + default: + fprintf(stderr,"Unsupported depth %d\n",screen->fb[0].depth); + return FALSE; + } + + + + /* Set all colours to black */ + for (i=0; i<768; i++) i810c->vga.ModeReg.DAC[i] = 0x00; + + /* ... and the overscan */ + if (screen->fb[0].depth >= 4) + i810c->vga.ModeReg.Attribute[OVERSCAN] = 0xFF; + + /* Could be made a command-line option */ + +#ifdef I810CFG_SHOW_OVERSCAN + i810c->vga.ModeReg.DAC[765] = 0x3F; + i810c->vga.ModeReg.DAC[766] = 0x00; + i810c->vga.ModeReg.DAC[767] = 0x3F; + i810c->vga.ModeReg.Attribute[OVERSCAN] = 0xFF; + i810c->vga.ShowOverscan = TRUE; +#else + i810c->vga.ShowOverscan = FALSE; +#endif + + i810c->vga.paletteEnabled = FALSE; + i810c->vga.cmapSaved = FALSE; + i810c->vga.MMIOBase = i810c->MMIOBase; + + i810c->cpp = screen->fb[0].bitsPerPixel/8; + + /* move to initscreen? */ + + switch (screen->fb[0].bitsPerPixel) { + case 8: + i810c->MaxClock = 203000; + break; + case 16: + i810c->MaxClock = 163000; + break; + case 24: + i810c->MaxClock = 136000; + break; + case 32: /* not supported */ + i810c->MaxClock = 86000; + default: + fprintf(stderr,"Unsupported bpp %d\n",screen->fb[0].bitsPerPixel); + return FALSE; + } + + if (!i810AllocateGARTMemory( screen )) { + return FALSE; + } + + i810AllocateFront(screen); + + /* Map LpRing memory */ + if (!i810MapMem(screen)) return FALSE; + + screen->fb[0].frameBuffer = i810c->FbBase; + + screen->driver = i810s; + + return TRUE; +} + +/* + * I810Save -- + * + * This function saves the video state. It reads all of the SVGA registers + * into the vgaI810Rec data structure. There is in general no need to + * mask out bits here - just read the registers. + */ +static void +DoSave(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg, Bool saveFonts) +{ + + I810CardInfo *i810c = card->driver; + i810VGAPtr vgap = &i810c->vga; + + int i; + + /* Save VGA registers */ + + vgaReg->MiscOutReg = mmioReadMiscOut(vgap); + if (vgaReg->MiscOutReg & 0x01) + vgap->IOBase = VGA_IOBASE_COLOR; + else + vgap->IOBase = VGA_IOBASE_MONO; + + for (i = 0; i < VGA_NUM_CRTC; i++) { + vgaReg->CRTC[i] = mmioReadCrtc(vgap, i); + } + + mmioEnablePalette(vgap); + for (i = 0; i < VGA_NUM_ATTR; i++) { + vgaReg->Attribute[i] = mmioReadAttr(vgap, i); + } + mmioDisablePalette(vgap); + + for (i = 0; i < VGA_NUM_GFX; i++) { + vgaReg->Graphics[i] = mmioReadGr(vgap, i); + } + + for (i = 1; i < VGA_NUM_SEQ; i++) { + vgaReg->Sequencer[i] = mmioReadSeq(vgap, i); + } + + /* + * The port I/O code necessary to read in the extended registers + * into the fields of the I810Rec structure goes here. + */ + i810Reg->IOControl = mmioReadCrtc(vgap, IO_CTNL); + i810Reg->AddressMapping = i810ReadControlMMIO(i810c, GRX, ADDRESS_MAPPING); + i810Reg->BitBLTControl = INREG8(BITBLT_CNTL); + i810Reg->VideoClk2_M = INREG16(VCLK2_VCO_M); + i810Reg->VideoClk2_N = INREG16(VCLK2_VCO_N); + i810Reg->VideoClk2_DivisorSel = INREG8(VCLK2_VCO_DIV_SEL); + + i810Reg->ExtVertTotal=mmioReadCrtc(vgap, EXT_VERT_TOTAL); + i810Reg->ExtVertDispEnd=mmioReadCrtc(vgap, EXT_VERT_DISPLAY); + i810Reg->ExtVertSyncStart=mmioReadCrtc(vgap, EXT_VERT_SYNC_START); + i810Reg->ExtVertBlankStart=mmioReadCrtc(vgap, EXT_VERT_BLANK_START); + i810Reg->ExtHorizTotal=mmioReadCrtc(vgap, EXT_HORIZ_TOTAL); + i810Reg->ExtHorizBlank=mmioReadCrtc(vgap, EXT_HORIZ_BLANK); + i810Reg->ExtOffset=mmioReadCrtc(vgap, EXT_OFFSET); + i810Reg->InterlaceControl=mmioReadCrtc(vgap, INTERLACE_CNTL); + + i810Reg->PixelPipeCfg0 = INREG8(PIXPIPE_CONFIG_0); + i810Reg->PixelPipeCfg1 = INREG8(PIXPIPE_CONFIG_1); + i810Reg->PixelPipeCfg2 = INREG8(PIXPIPE_CONFIG_2); + i810Reg->DisplayControl = INREG8(DISPLAY_CNTL); + i810Reg->LMI_FIFO_Watermark = INREG(FWATER_BLC); + + for (i = 0 ; i < 8 ; i++) + i810Reg->Fence[i] = INREG(FENCE+i*4); + + i810Reg->LprbTail = INREG(LP_RING + RING_TAIL); + i810Reg->LprbHead = INREG(LP_RING + RING_HEAD); + i810Reg->LprbStart = INREG(LP_RING + RING_START); + i810Reg->LprbLen = INREG(LP_RING + RING_LEN); + + if ((i810Reg->LprbTail & TAIL_ADDR) != (i810Reg->LprbHead & HEAD_ADDR) && + i810Reg->LprbLen & RING_VALID) { + i810PrintErrorState( card ); + FatalError( "Active ring not flushed\n"); + } + + if (I810_DEBUG) { + fprintf(stderr,"Got mode in I810Save:\n"); + i810PrintMode( vgaReg, i810Reg ); + } +} + +void i810Preserve(KdCardInfo *card) { + I810CardInfo *i810c = card->driver; + i810VGAPtr vgap = &i810c->vga; + +/* fprintf(stderr,"i810Preserve\n"); */ + DoSave(card, &vgap->SavedReg, &i810c->SavedReg, TRUE); +} + +/* Famous last words + */ +void +i810PrintErrorState(KdCardInfo *card) +{ + + I810CardInfo *i810c = card->driver; + + fprintf(stderr, "pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", + INREG(PGETBL_CTL), + INREG(PGE_ERR)); + + fprintf(stderr, "ipeir: %lx iphdr: %lx\n", + INREG(IPEIR), + INREG(IPEHR)); + + fprintf(stderr, "LP ring tail: %lx head: %lx len: %lx start %lx\n", + INREG(LP_RING + RING_TAIL), + INREG(LP_RING + RING_HEAD) & HEAD_ADDR, + INREG(LP_RING + RING_LEN), + INREG(LP_RING + RING_START)); + + fprintf(stderr, "eir: %x esr: %x emr: %x\n", + INREG16(EIR), + INREG16(ESR), + INREG16(EMR)); + + fprintf(stderr, "instdone: %x instpm: %x\n", + INREG16(INST_DONE), + INREG8(INST_PM)); + + fprintf(stderr, "memmode: %lx instps: %lx\n", + INREG(MEMMODE), + INREG(INST_PS)); + + fprintf(stderr, "hwstam: %x ier: %x imr: %x iir: %x\n", + INREG16(HWSTAM), + INREG16(IER), + INREG16(IMR), + INREG16(IIR)); +} + +Bool +i810BindGARTMemory( KdScreenInfo *screen ) +{ + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = card->driver; + + if (!i810c->GttBound) { + if (!KdAcquireGART(screen->mynum)) + return FALSE; + if (!KdBindGARTMemory(screen->mynum, i810c->VramKey, + i810c->VramOffset)) + + return FALSE; + if (i810c->DcacheKey != -1) { + if (!KdBindGARTMemory(screen->mynum, i810c->DcacheKey, + i810c->DcacheOffset)) + return FALSE; + } + if (i810c->HwcursKey != -1) { + if (!KdBindGARTMemory(screen->mynum, i810c->HwcursKey, + i810c->HwcursOffset)) + return FALSE; + } + i810c->GttBound = 1; + } + return TRUE; +} + +Bool +i810UnbindGARTMemory(KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = card->driver; + + + if (KdAgpGARTSupported() && i810c->GttBound) { + if (!KdUnbindGARTMemory(screen->mynum, i810c->VramKey)) + return FALSE; + if (i810c->DcacheKey != -1) { + if (!KdUnbindGARTMemory(screen->mynum, i810c->DcacheKey)) + return FALSE; + } + if (i810c->HwcursKey != -1) { + if (!KdUnbindGARTMemory(screen->mynum, i810c->HwcursKey)) + return FALSE; + } + if (!KdReleaseGART(screen->mynum)) + return FALSE; + i810c->GttBound = 0; + } + return TRUE; +} + +/* + * I810CalcVCLK -- + * + * Determine the closest clock frequency to the one requested. + */ + +#define MAX_VCO_FREQ 600.0 +#define TARGET_MAX_N 30 +#define REF_FREQ 24.0 + +#define CALC_VCLK(m,n,p) \ + (double)m / ((double)n * (1 << p)) * 4 * REF_FREQ + +static void +i810CalcVCLK( KdScreenInfo *screen, double freq ) +{ + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = card->driver; + I810RegPtr i810Reg = &i810c->ModeReg; + + int m, n, p; + double f_out, f_best; + double f_err; + double f_vco; + int m_best = 0, n_best = 0, p_best = 0; + double f_target = freq; + double err_max = 0.005; + double err_target = 0.001; + double err_best = 999999.0; + + p_best = p = log(MAX_VCO_FREQ/f_target)/log((double)2); + f_vco = f_target * (1 << p); + + n = 2; + do { + n++; + m = f_vco / (REF_FREQ / (double)n) / (double)4.0 + 0.5; + if (m < 3) m = 3; + f_out = CALC_VCLK(m,n,p); + f_err = 1.0 - (f_target/f_out); + if (fabs(f_err) < err_max) { + m_best = m; + n_best = n; + f_best = f_out; + err_best = f_err; + } + } while ((fabs(f_err) >= err_target) && + ((n <= TARGET_MAX_N) || (fabs(err_best) > err_max))); + + if (fabs(f_err) < err_target) { + m_best = m; + n_best = n; + } + + i810Reg->VideoClk2_M = (m_best-2) & 0x3FF; + i810Reg->VideoClk2_N = (n_best-2) & 0x3FF; + i810Reg->VideoClk2_DivisorSel = (p_best << 4); + +/* fprintf(stderr, "Setting dot clock to %.1f MHz " */ +/* "[ 0x%x 0x%x 0x%x ] " */ +/* "[ %d %d %d ]\n", */ +/* CALC_VCLK(m_best,n_best,p_best), */ +/* i810Reg->VideoClk2_M, */ +/* i810Reg->VideoClk2_N, */ +/* i810Reg->VideoClk2_DivisorSel, */ +/* m_best, n_best, p_best); */ +} + +/* + * I810CalcFIFO -- + * + * Calculate burst length and FIFO watermark. + */ + +#define Elements(x) (sizeof(x)/sizeof(*x)) + +unsigned int +i810CalcWatermark( KdScreenInfo *screen, double freq, Bool dcache ) +{ + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = card->driver; + + + struct wm_info *tab; + int nr; + int i; + + if (i810c->LmFreqSel == 100) { + switch(screen->fb[0].bitsPerPixel) { + case 8: + tab = i810_wm_8_100; + nr = Elements(i810_wm_8_100); + break; + case 16: + tab = i810_wm_16_100; + nr = Elements(i810_wm_16_100); + break; + case 24: + tab = i810_wm_24_100; + nr = Elements(i810_wm_24_100); + break; + default: + return 0; + } + } else { + switch(screen->fb[0].bitsPerPixel) { + case 8: + tab = i810_wm_8_133; + nr = Elements(i810_wm_8_133); + break; + case 16: + tab = i810_wm_16_133; + nr = Elements(i810_wm_16_133); + break; + case 24: + tab = i810_wm_24_133; + nr = Elements(i810_wm_24_133); + break; + default: + return 0; + } + } + + for (i = 0 ; i < nr && tab[i].freq < freq ; i++); + + if (i == nr) + i--; + +/* fprintf(stderr,"chose watermark 0x%x: (tab.freq %.1f)\n", */ +/* tab[i].wm, tab[i].freq); */ + + /* None of these values (sourced from intel) have watermarks for + * the dcache memory. Fake it for now by using the same watermark + * for both... + * + * Update: this is probably because dcache isn't real useful as + * framebuffer memory, so intel's drivers don't need watermarks + * for that memory because they never use it to feed the ramdacs. + * We do use it in the fallback mode, so keep the watermarks for + * now. + */ + if (dcache) + return (tab[i].wm & ~0xffffff) | ((tab[i].wm>>12) & 0xfff); + else + return tab[i].wm; +} + +static void i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode ) +{ + int i; + + fprintf(stderr," MiscOut: %x\n", vgaReg->MiscOutReg); + + + fprintf(stderr,"SEQ: "); + for (i = 0 ; i < VGA_NUM_SEQ ; i++) { + if ((i&7)==0) fprintf(stderr,"\n"); + fprintf(stderr," %d: %x", i, vgaReg->Sequencer[i]); + } + fprintf(stderr,"\n"); + + fprintf(stderr,"CRTC: "); + for (i = 0 ; i < VGA_NUM_CRTC ; i++) { + if ((i&3)==0) fprintf(stderr,"\n"); + fprintf(stderr," CR%02x: %2x", i, vgaReg->CRTC[i]); + } + fprintf(stderr,"\n"); + + fprintf(stderr,"GFX: "); + for (i = 0 ; i < VGA_NUM_GFX ; i++) { + if ((i&3)==0) fprintf(stderr,"\n"); + fprintf(stderr," GR%02x: %02x", i, vgaReg->Graphics[i]); + } + fprintf(stderr,"\n"); + + fprintf(stderr,"ATTR: "); + for (i = 0 ; i < VGA_NUM_ATTR ; i++) { + if ((i&7)==0) fprintf(stderr,"\n"); + fprintf(stderr," %d: %x", i, vgaReg->Attribute[i]); + } + fprintf(stderr,"\n"); + + + fprintf(stderr," DisplayControl: %x\n", mode->DisplayControl); + fprintf(stderr," PixelPipeCfg0: %x\n", mode->PixelPipeCfg0); + fprintf(stderr," PixelPipeCfg1: %x\n", mode->PixelPipeCfg1); + fprintf(stderr," PixelPipeCfg2: %x\n", mode->PixelPipeCfg2); + fprintf(stderr," VideoClk2_M: %x\n", mode->VideoClk2_M); + fprintf(stderr," VideoClk2_N: %x\n", mode->VideoClk2_N); + fprintf(stderr," VideoClk2_DivisorSel: %x\n", mode->VideoClk2_DivisorSel); + fprintf(stderr," AddressMapping: %x\n", mode->AddressMapping); + fprintf(stderr," IOControl: %x\n", mode->IOControl); + fprintf(stderr," BitBLTControl: %x\n", mode->BitBLTControl); + fprintf(stderr," ExtVertTotal: %x\n", mode->ExtVertTotal); + fprintf(stderr," ExtVertDispEnd: %x\n", mode->ExtVertDispEnd); + fprintf(stderr," ExtVertSyncStart: %x\n", mode->ExtVertSyncStart); + fprintf(stderr," ExtVertBlankStart: %x\n", mode->ExtVertBlankStart); + fprintf(stderr," ExtHorizTotal: %x\n", mode->ExtHorizTotal); + fprintf(stderr," ExtHorizBlank: %x\n", mode->ExtHorizBlank); + fprintf(stderr," ExtOffset: %x\n", mode->ExtOffset); + fprintf(stderr," InterlaceControl: %x\n", mode->InterlaceControl); + fprintf(stderr," LMI_FIFO_Watermark: %x\n", mode->LMI_FIFO_Watermark); + fprintf(stderr," LprbTail: %x\n", mode->LprbTail); + fprintf(stderr," LprbHead: %x\n", mode->LprbHead); + fprintf(stderr," LprbStart: %x\n", mode->LprbStart); + fprintf(stderr," LprbLen: %x\n", mode->LprbLen); + fprintf(stderr," OverlayActiveStart: %x\n", mode->OverlayActiveStart); + fprintf(stderr," OverlayActiveEnd: %x\n", mode->OverlayActiveEnd); +} + + +/* + * i810VGASeqReset + * perform a sequencer reset. + * + * The i815 documentation states that these bits are not used by the + * HW, but still warns about not programming them... + */ + +void +i810VGASeqReset(i810VGAPtr vgap, Bool start) +{ + if (start) + { + mmioWriteSeq(vgap, 0x00, 0x01); /* Synchronous Reset */ + } + else + { + mmioWriteSeq(vgap, 0x00, 0x03); /* End Reset */ + } +} + +void +i810VGAProtect(KdCardInfo *card, Bool on) +{ + + I810CardInfo *i810c = card->driver; + i810VGAPtr vgap = &i810c->vga; + + unsigned char tmp; + + if (on) { + /* + * Turn off screen and disable sequencer. + */ + tmp = mmioReadSeq(vgap, 0x01); + + i810VGASeqReset(vgap, TRUE); /* start synchronous reset */ + mmioWriteSeq(vgap, 0x01, tmp | 0x20); /* disable the display */ + + mmioEnablePalette(vgap); + } else { + /* + * Reenable sequencer, then turn on screen. + */ + + tmp = mmioReadSeq(vgap, 0x01); + + mmioWriteSeq(vgap, 0x01, tmp & ~0x20); /* reenable display */ + i810VGASeqReset(vgap, FALSE); /* clear synchronousreset */ + + mmioDisablePalette(vgap); + } +} + +/* + * i810VGABlankScreen -- blank the screen. + */ + +void +i810VGABlankScreen(KdCardInfo *card, Bool on) +{ + I810CardInfo *i810c = card->driver; + i810VGAPtr vgap = &i810c->vga; + + unsigned char scrn; + + scrn = mmioReadSeq(vgap, 0x01); + + if (on) { + scrn &= ~0x20; /* enable screen */ + } else { + scrn |= 0x20; /* blank screen */ + } + + mmioWriteSeq(vgap,0x00,0x01); + mmioWriteSeq(vgap, 0x01, scrn); /* change mode */ + mmioWriteSeq(vgap,0x00,0x03); +} + +/* Restore hardware state */ + +static void +DoRestore(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg, + Bool restoreFonts) { + + + I810CardInfo *i810c = card->driver; + + i810VGAPtr vgap = &i810c->vga; + + unsigned char temp; + unsigned int itemp; + int i; + + if (I810_DEBUG & DEBUG_VERBOSE_VGA) { + fprintf(stderr,"Setting mode in DoRestore:\n"); + i810PrintMode( vgaReg, i810Reg ); + } + + /* Blank screen (i810vgaprotect) */ + i810VGAProtect(card, TRUE); + + /* Should wait for at least two hsync and no more than two vsync + before writing PIXCONF and turning the display on (?) */ + usleep(50000); + + /* Turn off DRAM Refresh */ + temp = INREG8( DRAM_ROW_CNTL_HI ); + temp &= ~DRAM_REFRESH_RATE; + temp |= DRAM_REFRESH_DISABLE; + OUTREG8( DRAM_ROW_CNTL_HI, temp ); + + usleep(1000); /* Wait 1 ms */ + + /* Write the M, N and P values */ + OUTREG16( VCLK2_VCO_M, i810Reg->VideoClk2_M); + OUTREG16( VCLK2_VCO_N, i810Reg->VideoClk2_N); + OUTREG8( VCLK2_VCO_DIV_SEL, i810Reg->VideoClk2_DivisorSel); + + /* + * Turn on 8 bit dac mode, if requested. This is needed to make + * sure that vgaHWRestore writes the values into the DAC properly. + * The problem occurs if 8 bit dac mode is requested and the HW is + * in 6 bit dac mode. If this happens, all the values are + * automatically shifted left twice by the HW and incorrect colors + * will be displayed on the screen. The only time this can happen + * is at server startup time and when switching back from a VT. + */ + temp = INREG8(PIXPIPE_CONFIG_0); + temp &= 0x7F; /* Save all but the 8 bit dac mode bit */ + temp |= (i810Reg->PixelPipeCfg0 & DAC_8_BIT); + OUTREG8( PIXPIPE_CONFIG_0, temp ); + + /* + * Code to restore any SVGA registers that have been saved/modified + * goes here. Note that it is allowable, and often correct, to + * only modify certain bits in a register by a read/modify/write cycle. + * + * A special case - when using an external clock-setting program, + * this function must not change bits associated with the clock + * selection. This condition can be checked by the condition: + * + * if (i810Reg->std.NoClock >= 0) + * restore clock-select bits. + */ + + /* VGA restore */ + if (vgaReg->MiscOutReg & 0x01) + vgap->IOBase = VGA_IOBASE_COLOR; + else + vgap->IOBase = VGA_IOBASE_MONO; + + mmioWriteMiscOut(vgap, vgaReg->MiscOutReg); + + for (i = 1; i < VGA_NUM_SEQ; i++) + mmioWriteSeq(vgap, i, vgaReg->Sequencer[i]); + + /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 or CRTC[17] */ + /* = CR11 */ + mmioWriteCrtc(vgap, 17, vgaReg->CRTC[17] & ~0x80); + + for (i = 0; i < VGA_NUM_CRTC; i++) { + mmioWriteCrtc(vgap, i, vgaReg->CRTC[i]); + } + + for (i = 0; i < VGA_NUM_GFX; i++) + mmioWriteGr(vgap, i, vgaReg->Graphics[i]); + + mmioEnablePalette(vgap); + for (i = 0; i < VGA_NUM_ATTR; i++) + mmioWriteAttr(vgap, i, vgaReg->Attribute[i]); + mmioDisablePalette(vgap); + + + mmioWriteCrtc(vgap, EXT_VERT_TOTAL, i810Reg->ExtVertTotal); + mmioWriteCrtc(vgap, EXT_VERT_DISPLAY, i810Reg->ExtVertDispEnd); + mmioWriteCrtc(vgap, EXT_VERT_SYNC_START, i810Reg->ExtVertSyncStart); + mmioWriteCrtc(vgap, EXT_VERT_BLANK_START, i810Reg->ExtVertBlankStart); + mmioWriteCrtc(vgap, EXT_HORIZ_TOTAL, i810Reg->ExtHorizTotal); + mmioWriteCrtc(vgap, EXT_HORIZ_BLANK, i810Reg->ExtHorizBlank); + + /* write CR40, CR42 first etc to get CR13 written as described in PRM */ + + mmioWriteCrtc(vgap, EXT_START_ADDR_HI, 0); + mmioWriteCrtc(vgap, EXT_START_ADDR, EXT_START_ADDR_ENABLE); + + mmioWriteCrtc(vgap, EXT_OFFSET, i810Reg->ExtOffset); + mmioWriteCrtc(vgap, 0x13, vgaReg->CRTC[0x13]); + + temp=mmioReadCrtc(vgap, INTERLACE_CNTL); + temp &= ~INTERLACE_ENABLE; + temp |= i810Reg->InterlaceControl; + mmioWriteCrtc(vgap, INTERLACE_CNTL, temp); + + temp=i810ReadControlMMIO(i810c, GRX, ADDRESS_MAPPING); + temp &= 0xE0; /* Save reserved bits 7:5 */ + temp |= i810Reg->AddressMapping; + i810WriteControlMMIO(i810c, GRX, ADDRESS_MAPPING, temp); + + /* Setting the OVRACT Register for video overlay*/ + OUTREG(0x6001C, (i810Reg->OverlayActiveEnd << 16) | i810Reg->OverlayActiveStart); + + /* Turn on DRAM Refresh */ + temp = INREG8( DRAM_ROW_CNTL_HI ); + temp &= ~DRAM_REFRESH_RATE; + temp |= DRAM_REFRESH_60HZ; + OUTREG8( DRAM_ROW_CNTL_HI, temp ); + + temp = INREG8( BITBLT_CNTL ); + temp &= ~COLEXP_MODE; + temp |= i810Reg->BitBLTControl; + OUTREG8( BITBLT_CNTL, temp ); + + temp = INREG8( DISPLAY_CNTL ); + temp &= ~(VGA_WRAP_MODE | GUI_MODE); + temp |= i810Reg->DisplayControl; + OUTREG8( DISPLAY_CNTL, temp ); + + + temp = INREG8( PIXPIPE_CONFIG_0 ); + temp &= 0x64; /* Save reserved bits 6:5,2 */ + temp |= i810Reg->PixelPipeCfg0; + OUTREG8( PIXPIPE_CONFIG_0, temp ); + + temp = INREG8( PIXPIPE_CONFIG_2 ); + temp &= 0xF3; /* Save reserved bits 7:4,1:0 */ + temp |= i810Reg->PixelPipeCfg2; + OUTREG8( PIXPIPE_CONFIG_2, temp ); + + temp = INREG8( PIXPIPE_CONFIG_1 ); + temp &= ~DISPLAY_COLOR_MODE; + temp &= 0xEF; /* Restore the CRT control bit */ + temp |= i810Reg->PixelPipeCfg1; + OUTREG8( PIXPIPE_CONFIG_1, temp ); + + OUTREG16(EIR, 0); + + itemp = INREG(FWATER_BLC); + itemp &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK | + MM_BURST_LENGTH | MM_FIFO_WATERMARK ); + itemp |= i810Reg->LMI_FIFO_Watermark; + OUTREG(FWATER_BLC, itemp); + + + for (i = 0 ; i < 8 ; i++) { + OUTREG( FENCE+i*4, i810Reg->Fence[i] ); + if (I810_DEBUG & DEBUG_VERBOSE_VGA) + fprintf(stderr,"Fence Register : %x\n", i810Reg->Fence[i]); + } + + /* First disable the ring buffer (Need to wait for empty first?, if so + * should probably do it before entering this section) + */ + itemp = INREG(LP_RING + RING_LEN); + itemp &= ~RING_VALID_MASK; + OUTREG(LP_RING + RING_LEN, itemp ); + + /* Set up the low priority ring buffer. + */ + OUTREG(LP_RING + RING_TAIL, 0 ); + OUTREG(LP_RING + RING_HEAD, 0 ); + + i810c->LpRing.head = 0; + i810c->LpRing.tail = 0; + + itemp = INREG(LP_RING + RING_START); + itemp &= ~(START_ADDR); + itemp |= i810Reg->LprbStart; + OUTREG(LP_RING + RING_START, itemp ); + + itemp = INREG(LP_RING + RING_LEN); + itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); + itemp |= i810Reg->LprbLen; + OUTREG(LP_RING + RING_LEN, itemp ); + + i810VGAProtect(card, FALSE); + + temp=mmioReadCrtc(vgap, IO_CTNL); + temp &= ~(EXTENDED_ATTR_CNTL | EXTENDED_CRTC_CNTL); + temp |= i810Reg->IOControl; + mmioWriteCrtc(vgap, IO_CTNL, temp); + /* Protect CRTC[0-7] */ + mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) | 0x80); +} + + +static Bool +i810SetMode(KdScreenInfo *screen, const KdMonitorTiming *t) +{ + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = card->driver; + i810VGAPtr vgap = &i810c->vga; + + I810RegPtr i810Reg = &i810c->ModeReg; + vgaRegPtr pVga = &vgap->ModeReg; + + double dclk = t->clock/1000.0; + + switch (screen->fb[0].bitsPerPixel) { + case 8: + pVga->CRTC[0x13] = screen->width >> 3; + i810Reg->ExtOffset = screen->width >> 11; + i810Reg->PixelPipeCfg1 = DISPLAY_8BPP_MODE; + i810Reg->BitBLTControl = COLEXP_8BPP; + break; + case 16: + i810Reg->PixelPipeCfg1 = DISPLAY_16BPP_MODE; + pVga->CRTC[0x13] = screen->width >> 2; + i810Reg->ExtOffset = screen->width >> 10; + i810Reg->BitBLTControl = COLEXP_16BPP; + break; + case 24: + pVga->CRTC[0x13] = (screen->width * 3) >> 3; + i810Reg->ExtOffset = (screen->width * 3) >> 11; + + i810Reg->PixelPipeCfg1 = DISPLAY_24BPP_MODE; + i810Reg->BitBLTControl = COLEXP_24BPP; + break; + default: + break; + } + + 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; + + /* Turn on linear and page mapping */ + i810Reg->AddressMapping = (LINEAR_MODE_ENABLE | + GTT_MEM_MAP_ENABLE); + + /* Turn on GUI mode */ + i810Reg->DisplayControl = HIRES_MODE; + + i810Reg->OverlayActiveStart = t->horizontal + t->hblank - 32; + i810Reg->OverlayActiveEnd = t->horizontal - 32; + + /* Turn on interlaced mode if necessary (it's not) */ + i810Reg->InterlaceControl = INTERLACE_DISABLE; + + /* + * Set the overscan color to 0. + * NOTE: This only affects >8bpp mode. + */ + pVga->Attribute[0x11] = 0; + + /* + * Calculate the VCLK that most closely matches the requested dot + * clock. + */ + i810CalcVCLK(screen, dclk); + + /* Since we program the clocks ourselves, always use VCLK2. */ + pVga->MiscOutReg |= 0x0C; + + /* Calculate the FIFO Watermark and Burst Length. */ + i810Reg->LMI_FIFO_Watermark = i810CalcWatermark(screen, dclk, FALSE); + + /* Setup the ring buffer */ + i810Reg->LprbTail = 0; + i810Reg->LprbHead = 0; + i810Reg->LprbStart = i810c->LpRing.mem.Start; + + if (i810Reg->LprbStart) + i810Reg->LprbLen = ((i810c->LpRing.mem.Size-4096) | + RING_NO_REPORT | RING_VALID); + else + i810Reg->LprbLen = RING_INVALID; + + return TRUE; +} + +static Bool +i810ModeInit(KdScreenInfo *screen, const KdMonitorTiming *t) +{ + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = card->driver; + i810VGAPtr vgap = &i810c->vga; + vgaRegPtr pVga; + +/* fprintf(stderr,"i810ModeInit\n"); */ + + i810VGAUnlock(vgap); + + if (!i810VGAInit(screen, t)) return FALSE; + pVga = &vgap->ModeReg; + + if (!i810SetMode(screen, t)) return FALSE; + + DoRestore(screen->card, &vgap->ModeReg, &i810c->ModeReg, FALSE); + + return TRUE; +} + +Bool +i810VGAInit(KdScreenInfo *screen, const KdMonitorTiming *t) +{ + unsigned int i; + + int hactive, hblank, hbp, hfp; + int vactive, vblank, vbp, vfp; + int h_screen_off, h_adjust, h_total, h_display_end, h_blank_start; + int h_blank_end, h_sync_start, h_sync_end, v_total, v_retrace_start; + int v_retrace_end, v_display_end, v_blank_start, v_blank_end; + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = card->driver; + + i810VGAPtr vgap = &i810c->vga; + I810RegPtr ireg = &i810c->ModeReg; + + + vgaRegPtr regp; + int depth = screen->fb[0].depth; + + regp = &vgap->ModeReg; + + /* + * compute correct Hsync & Vsync polarity + */ + + regp->MiscOutReg = 0x23; + if (t->vpol == KdSyncNegative) regp->MiscOutReg |= 0x40; + if (t->hpol == KdSyncNegative) regp->MiscOutReg |= 0x80; + + /* + * Time Sequencer + */ + if (depth == 4) + regp->Sequencer[0] = 0x02; + else + regp->Sequencer[0] = 0x00; + /* No support for 320 or 360 x resolution */ + regp->Sequencer[1] = 0x01; + + if (depth == 1) + regp->Sequencer[2] = 1 << BIT_PLANE; + else + regp->Sequencer[2] = 0x0F; + + regp->Sequencer[3] = 0x00; /* Font select */ + + if (depth < 8) + regp->Sequencer[4] = 0x06; /* Misc */ + else + regp->Sequencer[4] = 0x0E; /* Misc */ + + hactive = t->horizontal; + hblank = t->hblank; + hbp = t->hbp; + hfp = t->hfp; + + vactive = t->vertical; + vblank = t->vblank; + vbp = t->vbp; + vfp = t->vfp; + + switch (screen->fb[0].bitsPerPixel) { + case 8: + hactive /= 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + h_screen_off = hactive; + h_adjust = 1; + break; + case 16: + hactive /= 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + + h_screen_off = hactive * 2; + h_adjust = 1; + break; + case 24: + hactive /= 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + + h_screen_off = hactive * 3; + h_adjust = 1; + break; + case 32: + hactive /= 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + + h_screen_off = hactive * 4; + h_adjust = 1; + break; + } + + /* + * Compute horizontal register values from timings + */ + h_total = hactive + hblank - 5; + h_display_end = hactive - 1; + h_blank_start = h_display_end; + h_blank_end = h_blank_start + hblank; + + h_sync_start = hactive + hfp + h_adjust; + h_sync_end = h_sync_start + hblank - hbp - hfp; + + /* Set CRTC regs for horizontal timings */ + regp->CRTC[0x0] = h_total; + ireg->ExtHorizTotal=(h_total & 0x100) >> 8; + + regp->CRTC[0x1] = h_display_end; + + regp->CRTC[0x2] = h_blank_start; + + regp->CRTC[0x3] = 0x80 | (h_blank_end & 0x1f); + regp->CRTC[0x5] = (h_blank_end & 0x20) << 2; + + regp->CRTC[0x4] = h_sync_start; + + regp->CRTC[0x5] |= h_sync_end & 0x1f; + + regp->CRTC[0x13] = h_screen_off; + ireg->ExtOffset = h_screen_off >> 8; + + /* Compute vertical timings */ + v_total = vactive + vblank - 2; + v_retrace_start = vactive + vfp - 1; + v_retrace_end = v_retrace_start + vblank - vbp - vfp; + v_display_end = vactive - 1; + v_blank_start = vactive - 1; + v_blank_end = v_blank_start + vblank /* - 1 */; + + regp->CRTC[0x6] = v_total; + ireg->ExtVertTotal = v_total >> 8; + + regp->CRTC[0x10] = v_retrace_start; + ireg->ExtVertSyncStart = v_retrace_start >> 8; + + regp->CRTC[0x11] = v_retrace_end; + + regp->CRTC[0x12] = v_display_end; + ireg->ExtVertDispEnd = v_display_end >> 8; + + regp->CRTC[0x15] = v_blank_start; + ireg->ExtVertBlankStart = v_blank_start >> 8; + + regp->CRTC[0x16] = v_blank_end; + + if (depth < 8) + regp->CRTC[23] = 0xE3; + else + regp->CRTC[23] = 0xC3; + regp->CRTC[24] = 0xFF; + + /* + * Graphics Display Controller + */ + regp->Graphics[0] = 0x00; + regp->Graphics[1] = 0x00; + regp->Graphics[2] = 0x00; + regp->Graphics[3] = 0x00; + if (depth == 1) { + regp->Graphics[4] = BIT_PLANE; + regp->Graphics[5] = 0x00; + } else { + regp->Graphics[4] = 0x00; + if (depth == 4) + regp->Graphics[5] = 0x02; + else + regp->Graphics[5] = 0x40; + } + regp->Graphics[6] = 0x05; + regp->Graphics[7] = 0x0F; + regp->Graphics[8] = 0xFF; + + if (depth == 1) { + /* Initialise the Mono map according to which bit-plane gets used */ + + Bool flipPixels = FALSE; /* maybe support this in the future? */ + + for (i=0; i<16; i++) + if (((i & (1 << BIT_PLANE)) != 0) != flipPixels) + regp->Attribute[i] = WHITE_VALUE; + else + regp->Attribute[i] = BLACK_VALUE; + + regp->Attribute[16] = 0x01; /* -VGA2- */ + if (!vgap->ShowOverscan) + regp->Attribute[OVERSCAN] = OVERSCAN_VALUE; /* -VGA2- */ + } else { + regp->Attribute[0] = 0x00; /* standard colormap translation */ + regp->Attribute[1] = 0x01; + regp->Attribute[2] = 0x02; + regp->Attribute[3] = 0x03; + regp->Attribute[4] = 0x04; + regp->Attribute[5] = 0x05; + regp->Attribute[6] = 0x06; + regp->Attribute[7] = 0x07; + regp->Attribute[8] = 0x08; + regp->Attribute[9] = 0x09; + regp->Attribute[10] = 0x0A; + regp->Attribute[11] = 0x0B; + regp->Attribute[12] = 0x0C; + regp->Attribute[13] = 0x0D; + regp->Attribute[14] = 0x0E; + regp->Attribute[15] = 0x0F; + if (depth == 4) + regp->Attribute[16] = 0x81; + else + regp->Attribute[16] = 0x41; + /* Attribute[17] (overscan) was initialised earlier */ + } + regp->Attribute[18] = 0x0F; + regp->Attribute[19] = 0x00; + regp->Attribute[20] = 0x00; + + return(TRUE); +} + +void +i810VGALock(i810VGAPtr vgap) +{ + /* Protect CRTC[0-7] */ + mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) & ~0x80); +} + +void +i810VGAUnlock(i810VGAPtr vgap) +{ + /* Unprotect CRTC[0-7] */ + mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) | 0x80); +} + +static void +i810Restore(KdCardInfo *card) { + + I810CardInfo *i810c = card->driver; + + i810VGAPtr vgap = &i810c->vga; + + if (I810_DEBUG) + fprintf(stderr,"i810Restore\n"); + + DoRestore(card, &vgap->SavedReg, &i810c->SavedReg, TRUE); +} + +Bool +i810Enable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = pScreenPriv->card; + I810CardInfo *i810c = card->driver; + i810VGAPtr vgap = &i810c->vga; + const KdMonitorTiming *t; + + if (I810_DEBUG) + fprintf(stderr,"i810Enable\n"); + + vgap->IOBase = (mmioReadMiscOut(vgap) & 0x01) ? + VGA_IOBASE_COLOR : VGA_IOBASE_MONO; + + { + I810RegPtr i810Reg = &i810c->ModeReg; + int i; + + for (i = 0 ; i < 8 ; i++) + i810Reg->Fence[i] = 0; + } + + t = KdFindMode (screen, i810ModeSupported); + + if (!i810BindGARTMemory(screen)) + return FALSE; + + if (!i810ModeInit(screen, t)) return FALSE; + + { + /* DPMS power on state */ + + unsigned char SEQ01=0; + int DPMSSyncSelect=0; + + SEQ01 = 0x00; + DPMSSyncSelect = HSYNC_ON | VSYNC_ON; + + SEQ01 |= i810ReadControlMMIO(i810c, SRX, 0x01) & ~0x20; + i810WriteControlMMIO(i810c, SRX, 0x01, SEQ01); + + /* Set the DPMS mode */ + OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect); + } + + return TRUE; +} + + +void +i810Disable(ScreenPtr pScreen) { + + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = pScreenPriv->card; + I810CardInfo *i810c = card->driver; + + i810VGAPtr vgap = &i810c->vga; + + if (I810_DEBUG) + fprintf(stderr,"i810Disable\n"); + + i810Restore(screen->card); + + if (!i810UnbindGARTMemory(screen)) + return; + + i810VGALock(vgap); +} + + +static Bool +i810DPMS(ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + I810CardInfo *i810c = card->driver; + + unsigned char SEQ01=0; + int DPMSSyncSelect=0; + + if (I810_DEBUG) + fprintf(stderr,"i810DPMS: %d\n",mode); + + switch (mode) { + case KD_DPMS_NORMAL: + /* Screen: On; HSync: On, VSync: On */ + SEQ01 = 0x00; + DPMSSyncSelect = HSYNC_ON | VSYNC_ON; + break; + case KD_DPMS_STANDBY: + /* Screen: Off; HSync: Off, VSync: On */ + SEQ01 = 0x20; + DPMSSyncSelect = HSYNC_OFF | VSYNC_ON; + break; + case KD_DPMS_SUSPEND: + /* Screen: Off; HSync: On, VSync: Off */ + SEQ01 = 0x20; + DPMSSyncSelect = HSYNC_ON | VSYNC_OFF; + break; + case KD_DPMS_POWERDOWN: + /* Screen: Off; HSync: Off, VSync: Off */ + SEQ01 = 0x20; + DPMSSyncSelect = HSYNC_OFF | VSYNC_OFF; + break; + } + + /* Turn the screen on/off */ + SEQ01 |= i810ReadControlMMIO(i810c, SRX, 0x01) & ~0x20; + i810WriteControlMMIO(i810c, SRX, 0x01, SEQ01); + + /* Set the DPMS mode */ + OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect); + return TRUE; +} + + +void i810GetColors (ScreenPtr pScreen, int fb, int ndefs, xColorItem *c) { + + if (I810_DEBUG) + fprintf(stderr,"i810GetColors (NOT IMPLEMENTED)\n"); +} + +#define DACDelay(hw) \ + do { \ + unsigned char temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ + temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ + } while (0) + +void i810PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) { + + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + i810VGAPtr vgap = &i810c->vga; + + if (I810_DEBUG) + fprintf(stderr,"i810PutColors\n"); + + while (ndef--) + { + mmioWriteDacWriteAddr(vgap, pdefs->pixel); + DACDelay(vgap); + mmioWriteDacData(vgap, pdefs->red); + DACDelay(vgap); + mmioWriteDacData(vgap, pdefs->green); + DACDelay(vgap); + mmioWriteDacData(vgap, pdefs->blue); + DACDelay(vgap); + + pdefs++; + } +} + + +KdCardFuncs i810Funcs = { + i810CardInit, /* cardinit */ + i810ScreenInit, /* scrinit */ + i810InitScreen, /* initScreen */ + i810Preserve, /* preserve */ + i810Enable, /* enable */ + i810DPMS, /* dpms */ + i810Disable, /* disable */ + i810Restore, /* restore */ + i810ScreenFini, /* scrfini */ + i810CardFini, /* cardfini */ + + i810CursorInit, /* initCursor */ + i810CursorEnable, /* enableCursor */ + i810CursorDisable, /* disableCursor */ + i810CursorFini, /* finiCursor */ + NULL, /* recolorCursor */ + + i810InitAccel, /* initAccel */ + i810EnableAccel, /* enableAccel */ + i810SyncAccel, /* syncAccel */ + i810DisableAccel, /* disableAccel */ + i810FiniAccel, /* finiAccel */ + + i810GetColors, /* getColors */ + i810PutColors, /* putColors */ +}; diff --git a/xc/programs/Xserver/hw/kdrive/i810/i810.h b/xc/programs/Xserver/hw/kdrive/i810/i810.h new file mode 100644 index 000000000..1e3d6dedd --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/i810.h @@ -0,0 +1,503 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + +/* $XFree86: xc/programs/Xserver/hw/kdrive/i810/i810.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */ + +/* + * Author: + * Pontus Lidman <pontus.lidman@nokia.com> + */ + +#ifndef _I810_H_ +#define _I810_H_ + +#include "i810_reg.h" + +/* Globals */ + +typedef struct _I810Rec *I810Ptr; + +/* Linear region allocated in framebuffer. + */ +typedef struct { + unsigned long Start; + unsigned long End; + unsigned long Size; +} I810MemRange; + +typedef struct { + int tail_mask; + I810MemRange mem; + unsigned char *virtual_start; + int head; + int tail; + int space; +} I810RingBuffer; + +typedef struct { + unsigned char DisplayControl; + unsigned char PixelPipeCfg0; + unsigned char PixelPipeCfg1; + unsigned char PixelPipeCfg2; + unsigned short VideoClk2_M; + unsigned short VideoClk2_N; + unsigned char VideoClk2_DivisorSel; + unsigned char AddressMapping; + unsigned char IOControl; + unsigned char BitBLTControl; + unsigned char ExtVertTotal; + unsigned char ExtVertDispEnd; + unsigned char ExtVertSyncStart; + unsigned char ExtVertBlankStart; + unsigned char ExtHorizTotal; + unsigned char ExtHorizBlank; + unsigned char ExtOffset; + unsigned char InterlaceControl; + unsigned int LMI_FIFO_Watermark; + + unsigned int LprbTail; + unsigned int LprbHead; + unsigned int LprbStart; + unsigned int LprbLen; + + unsigned int Fence[8]; + + unsigned short OverlayActiveStart; + unsigned short OverlayActiveEnd; + + +} I810RegRec, *I810RegPtr; + +#define minb(p) *(volatile CARD8 *)(i810c->MMIOBase + (p)) +#define moutb(p,v) *(volatile CARD8 *)(i810c->MMIOBase + (p)) = (v) + +#define OUT_RING(n) { \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + ErrorF( "OUT_RING %x: %x\n", outring, n); \ + *(volatile unsigned int *)(virt + outring) = n; \ + outring += 4; \ + outring &= ringmask; \ +} + +#define ADVANCE_LP_RING() { \ + i810c->LpRing.tail = outring; \ + OUTREG(LP_RING + RING_TAIL, outring); \ +} + +#ifdef __GNUC__ +#define LP_RING_MESSAGE(n) \ + ErrorF("BEGIN_LP_RING %d in %s\n", n, __FUNCTION__) +#else +#define LP_RING_MESSAGE(n) \ + ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__) +#endif + +#define BEGIN_LP_RING(n) \ + unsigned int outring, ringmask; \ + volatile unsigned char *virt; \ + if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) i810Sync( screen ); \ + if (i810c->LpRing.space < n*4) i810WaitLpRing( screen, n*4, 0); \ + i810c->LpRing.space -= n*4; \ + if (I810_DEBUG & DEBUG_VERBOSE_RING) \ + LP_RING_MESSAGE(n); \ + outring = i810c->LpRing.tail; \ + ringmask = i810c->LpRing.tail_mask; \ + virt = i810c->LpRing.virtual_start; + +/* Memory mapped register access macros */ +#define INREG8(addr) *(volatile CARD8 *)(i810c->MMIOBase + (addr)) +#define INREG16(addr) *(volatile CARD16 *)(i810c->MMIOBase + (addr)) +#define INREG(addr) *(volatile CARD32 *)(i810c->MMIOBase + (addr)) + +#define OUTREG8(addr, val) do { \ + *(volatile CARD8 *)(i810c->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ + ErrorF( "OUTREG8(%x, %x)\n", addr, val); \ +} while (0) + +#define OUTREG16(addr, val) do { \ + *(volatile CARD16 *)(i810c->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ + ErrorF( "OUTREG16(%x, %x)\n", addr, val); \ +} while (0) + +#define OUTREG(addr, val) do { \ + *(volatile CARD32 *)(i810c->MMIOBase + (addr)) = (val); \ + if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ + ErrorF( "OUTREG(%x, %x)\n", addr, val); \ +} while (0) + +/* To remove all debugging, make sure I810_DEBUG is defined as a + * preprocessor symbol, and equal to zero. + */ + +#define I810_DEBUG 0 + +#ifndef I810_DEBUG +#warning "Debugging enabled - expect reduced performance" +extern int I810_DEBUG; +#endif + +#define DEBUG_VERBOSE_ACCEL 0x1 +#define DEBUG_VERBOSE_SYNC 0x2 +#define DEBUG_VERBOSE_VGA 0x4 +#define DEBUG_VERBOSE_RING 0x8 +#define DEBUG_VERBOSE_OUTREG 0x10 +#define DEBUG_VERBOSE_MEMORY 0x20 +#define DEBUG_VERBOSE_CURSOR 0x40 +#define DEBUG_ALWAYS_SYNC 0x80 +#define DEBUG_VERBOSE_DRI 0x100 + + +/* Size of the mmio region. + */ +#define I810_REG_SIZE 0x80000 + +/* PCI identifiers */ +#ifndef PCI_CHIP_I810 +#define PCI_CHIP_I810 0x7121 +#define PCI_CHIP_I810_DC100 0x7123 +#define PCI_CHIP_I810_E 0x7125 +#define PCI_CHIP_I815 0x1132 +#define PCI_CHIP_I810_BRIDGE 0x7120 +#define PCI_CHIP_I810_DC100_BRIDGE 0x7122 +#define PCI_CHIP_I810_E_BRIDGE 0x7124 +#define PCI_CHIP_I815_BRIDGE 0x1130 +#endif + + +#define IS_I810(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I810 || \ + i810c->PciInfo->chipType == PCI_CHIP_I810_DC100 || \ + i810c->PciInfo->chipType == PCI_CHIP_I810_E) +#define IS_I815(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I815) + + +/* default number of VGA registers stored internally */ +#define VGA_NUM_CRTC 25 /* 0x19 */ +#define VGA_NUM_SEQ 5 +#define VGA_NUM_GFX 9 +#define VGA_NUM_ATTR 21 + +/* + * Settings of standard VGA registers. + */ +typedef struct { + unsigned char MiscOutReg; /* */ + unsigned char CRTC[VGA_NUM_CRTC]; /* Crtc Controller */ + unsigned char Sequencer[VGA_NUM_SEQ]; /* Video Sequencer */ + unsigned char Graphics[VGA_NUM_GFX]; /* Video Graphics */ + unsigned char Attribute[VGA_NUM_ATTR]; /* Video Atribute */ + unsigned char DAC[768]; /* Internal Colorlookuptable */ +} vgaRegRec, *vgaRegPtr; + + +typedef struct _i810VGARec *i810VGAPtr; + +/* VGA registers */ +typedef struct _i810VGARec { + int IOBase; /* I/O Base address */ + CARD8 * MMIOBase; /* Pointer to MMIO start */ + vgaRegRec SavedReg; /* saved registers */ + vgaRegRec ModeReg; /* register settings for + current mode */ + Bool ShowOverscan; + Bool paletteEnabled; + Bool cmapSaved; +} i810VGARec; + +typedef struct _i810CardInfo { + int videoRam; + int MaxClock; + long FbMapSize; + int cpp; /* chars per pixel */ + + unsigned long LinearAddr; + unsigned long MMIOAddr; + + unsigned char *MMIOBase; + unsigned char *FbBase; + + Bool GttBound; + Bool agpAcquired2d; + int VramKey; + unsigned long VramOffset; + int DcacheKey; + unsigned long DcacheOffset; + int HwcursKey; + unsigned long HwcursOffset; + + I810MemRange DcacheMem; + I810MemRange SysMem; + + I810MemRange SavedDcacheMem; + I810MemRange SavedSysMem; + + unsigned int bufferOffset; /* for I810SelectBuffer */ + Bool DoneFrontAlloc; + BoxRec FbMemBox; + I810MemRange FrontBuffer; + I810MemRange Scratch; + I810MemRange XvMem; + + int LmFreqSel; + + i810VGARec vga; + + I810RegRec SavedReg; + I810RegRec ModeReg; + I810RingBuffer LpRing; + + unsigned int BR[20]; + + int CursorOffset; + unsigned long CursorPhysical; + unsigned long CursorStart; + unsigned long OverlayPhysical; + unsigned long OverlayStart; + int colorKey; + + Bool NeedToSync; /* Need to sync accel stuff */ + + int nextColorExpandBuf; + + ScreenBlockHandlerProcPtr BlockHandler; + +#ifdef XV + KdVideoAdaptorPtr adaptor; +#endif + +} I810CardInfo; + +#define getI810CardInfo(kd) ((I810CardInfo *) ((kd)->card->driver)) +#define i810CardInfo(kd) I810CardInfo *i810c = getI810CardInfo(kd) + +#define getI810ScreenInfo(kd) ((I810ScreenInfo *) ((kd)->screen->driver)) +#define i810ScreenInfo(kd) I810ScreenInfo *i810s = getI810ScreenInfo(kd) + +typedef struct _i810Cursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; +} i810Cursor, *i810CursorPtr; + +typedef struct _i810ScreenInfo { + i810Cursor cursor; +} I810ScreenInfo; + +#define I810_CURSOR_HEIGHT 64 +#define I810_CURSOR_WIDTH 64 + +/* init functions (i810.c) */ + +Bool +i810CardInit (KdCardInfo *card); + +Bool +i810ScreenInit (KdScreenInfo *screen); + +/* The cursor functions (i810_cursor.c) */ + +Bool +i810CursorInit(ScreenPtr pScreen); + +void +i810CursorEnable (ScreenPtr pScreen); + +void +i810CursorDisable (ScreenPtr pScreen); + +void +i810CursorFini (ScreenPtr pScreen); + +/* Accel functions (i810draw.c) */ + +Bool +i810InitAccel(ScreenPtr); + +void +i810EnableAccel (ScreenPtr); + +void +i810SyncAccel (ScreenPtr); + +void +i810DisableAccel (ScreenPtr); + +void +i810FiniAccel (ScreenPtr); + +void +i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox, + unsigned long pixel, int alu, unsigned long planemask); + + +extern KdCardFuncs i810Funcs; + +/* Standard VGA registers */ + +#define VGA_ATTR_INDEX 0x3C0 +#define VGA_ATTR_DATA_W 0x3C0 +#define VGA_ATTR_DATA_R 0x3C1 +#define VGA_IN_STAT_0 0x3C2 /* read */ +#define VGA_MISC_OUT_W 0x3C2 /* write */ +#define VGA_ENABLE 0x3C3 +#define VGA_SEQ_INDEX 0x3C4 +#define VGA_SEQ_DATA 0x3C5 +#define VGA_DAC_MASK 0x3C6 +#define VGA_DAC_READ_ADDR 0x3C7 +#define VGA_DAC_WRITE_ADDR 0x3C8 +#define VGA_DAC_DATA 0x3C9 +#define VGA_FEATURE_R 0x3CA /* read */ +#define VGA_MISC_OUT_R 0x3CC /* read */ +#define VGA_GRAPH_INDEX 0x3CE +#define VGA_GRAPH_DATA 0x3CF + +#define VGA_IOBASE_MONO 0x3B0 +#define VGA_IOBASE_COLOR 0x3D0 + +#define VGA_CRTC_INDEX_OFFSET 0x04 +#define VGA_CRTC_DATA_OFFSET 0x05 +#define VGA_IN_STAT_1_OFFSET 0x0A /* read */ +#define VGA_FEATURE_W_OFFSET 0x0A /* write */ + +/* VGA stuff */ +#define BIT_PLANE 3 /* Which plane we write to in mono mode */ + +/* DAC indices for white and black */ +#define WHITE_VALUE 0x3F +#define BLACK_VALUE 0x00 +#define OVERSCAN_VALUE 0x01 + +#define OVERSCAN 0x11 /* Index of OverScan register */ + +void +i810VGAUnlock(i810VGAPtr vgap); + +void +i810VGALock(i810VGAPtr vgap); + +Bool +i810VGAInit(KdScreenInfo *scrninfp, const KdMonitorTiming *t); + +void +i810VGABlankScreen(KdCardInfo *card, Bool on); + +void +i810AdjustFrame(KdScreenInfo *screen, int x, int y, int flags); + +Bool +i810VGAMapMem(KdCardInfo *card); + +void +i810VGASave(KdCardInfo *card, vgaRegPtr save, int flags); + +void +i810PrintErrorState(KdCardInfo *card); + +void +i810VGAGetIOBase(i810VGAPtr vgap); + +/* + * MMIO versions of the register access functions. These require + * hwp->MemBase to be set in such a way that when the standard VGA port + * address is added the correct memory address results. + */ + +#define Vminb(p) ( *(volatile CARD8 *)(vgap->MMIOBase + (p))) +#define Vmoutb(p,v) ( *(volatile CARD8 *)(vgap->MMIOBase + (p)) = (v)) + +#define mmioWriteCrtc(vgap, index, value) { \ + Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index); \ + Vmoutb(vgap->IOBase + VGA_CRTC_DATA_OFFSET, value); \ +} + +#define mmioReadCrtc(vgap, index) ( \ + Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index), \ + Vminb(vgap->IOBase + VGA_CRTC_DATA_OFFSET) \ +) + +#define mmioWriteGr(vgap, index, value) { \ + Vmoutb(VGA_GRAPH_INDEX, index); \ + Vmoutb(VGA_GRAPH_DATA, value); \ +} + +#define mmioReadGr(vgap, index) ( \ + Vmoutb(VGA_GRAPH_INDEX, index), \ + Vminb(VGA_GRAPH_DATA) \ +) + +#define mmioWriteSeq(vgap, index, value) {\ + Vmoutb(VGA_SEQ_INDEX, index); \ + Vmoutb(VGA_SEQ_DATA, value); \ +} + +#define mmioReadSeq(vgap, index) ( \ + Vmoutb(VGA_SEQ_INDEX, index), \ + Vminb(VGA_SEQ_DATA) \ +) + +#define mmioWriteAttr(vgap, index, value) { \ + (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \ + Vmoutb(VGA_ATTR_INDEX, index); \ + Vmoutb(VGA_ATTR_DATA_W, value); \ +} + +#define mmioReadAttr(vgap, index) ( \ + (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET), \ + Vmoutb(VGA_ATTR_INDEX, index), \ + Vminb(VGA_ATTR_DATA_R) \ +) + +#define mmioWriteMiscOut(vgap, value) Vmoutb(VGA_MISC_OUT_W, value) + + +#define mmioReadMiscOut(vgap) Vminb(VGA_MISC_OUT_R) + +#define mmioEnablePalette(vgap) { \ + (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \ + Vmoutb(VGA_ATTR_INDEX, 0x00); \ + vgap->paletteEnabled = TRUE; \ +} + +#define mmioDisablePalette(vgap) { \ + (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \ + Vmoutb(VGA_ATTR_INDEX, 0x20); \ + vgap->paletteEnabled = FALSE; \ +} + +#define mmioWriteDacWriteAddr(vgap, value) Vmoutb(VGA_DAC_WRITE_ADDR, value) + +#define mmioWriteDacData(vgap, value) Vmoutb(VGA_DAC_DATA, value) + +#endif /* _I810_H_ */ diff --git a/xc/programs/Xserver/hw/kdrive/i810/i810_cursor.c b/xc/programs/Xserver/hw/kdrive/i810/i810_cursor.c new file mode 100644 index 000000000..a850708c8 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/i810_cursor.c @@ -0,0 +1,409 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + +/************************************************************************** + +Copyright 1998-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, 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 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. + +**************************************************************************/ + + + +/* $XFree86: xc/programs/Xserver/hw/kdrive/i810/i810_cursor.c,v 1.1 2001/03/30 02:18:41 keithp Exp $ */ + +/* i810_cursor.c: KDrive hardware cursor routines for the i810 chipset */ + +/* + * Authors: + * Keith Whitwell <keithw@precisioninsight.com> + * Pontus Lidman <pontus.lidman@nokia.com> + * + */ + +#include "kdrive.h" +#include "kxv.h" +#include "i810.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + i810CardInfo(pScreenPriv); \ + i810ScreenInfo(pScreenPriv); \ + i810Cursor *pCurPriv = &i810s->cursor + + +static void +writeStandardMMIO(I810CardInfo *i810c, int addr, CARD8 val) { + moutb(addr, val); +} + +void +_i810MoveCursor(ScreenPtr pScreen, int x, int y) { + SetupCursor(pScreen); + int flag; + + if (I810_DEBUG & DEBUG_VERBOSE_CURSOR) + ErrorF( "I810SetCursorPosition %d %d\n", x, y); + + x += i810c->CursorOffset; + + if (x >= 0) flag = CURSOR_X_POS; + else { + flag = CURSOR_X_NEG; + x=-x; + } + + OUTREG8( CURSOR_X_LO, x&0xFF); + OUTREG8( CURSOR_X_HI, (((x >> 8) & 0x07) | flag)); + + if (y >= 0) flag = CURSOR_Y_POS; + else { + flag = CURSOR_Y_NEG; + y=-y; + } + OUTREG8( CURSOR_Y_LO, y&0xFF); + OUTREG8( CURSOR_Y_HI, (((y >> 8) & 0x07) | flag)); + + /* Enable cursor */ + OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical); + OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C); + +} + +static void i810LoadCursor(ScreenPtr pScreen, int x, int y); + +static void +i810MoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + _i810MoveCursor (pScreen, x, y); + + i810LoadCursor(pScreen, x, y); +} + +static void +_i810SetCursorColors(ScreenPtr pScreen) { /* int bg, int fg */ + + SetupCursor(pScreen); + int tmp; + + int bg = 0xffffff; + int fg = 0x000000; + + tmp=INREG8(PIXPIPE_CONFIG_0); + tmp |= EXTENDED_PALETTE; + OUTREG8( PIXPIPE_CONFIG_0, tmp); + + writeStandardMMIO(i810c, DACMASK, 0xFF); + writeStandardMMIO(i810c, DACWX, 0x04); + + writeStandardMMIO(i810c, DACDATA, (bg & 0x00FF0000) >> 16); + writeStandardMMIO(i810c, DACDATA, (bg & 0x0000FF00) >> 8); + writeStandardMMIO(i810c, DACDATA, (bg & 0x000000FF)); + + writeStandardMMIO(i810c, DACDATA, (fg & 0x00FF0000) >> 16); + writeStandardMMIO(i810c, DACDATA, (fg & 0x0000FF00) >> 8); + writeStandardMMIO(i810c, DACDATA, (fg & 0x000000FF)); + + tmp=INREG8( PIXPIPE_CONFIG_0 ); + tmp &= ~EXTENDED_PALETTE; + OUTREG8( PIXPIPE_CONFIG_0, tmp ); +} + +static void i810LoadCursor(ScreenPtr pScreen, int x, int y) { + + SetupCursor(pScreen); + + int w, h; + unsigned short r; + unsigned char *msk, *mskLine, *src, *srcLine; + + int i, j; + int src_stride, src_width; + + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + CARD8 tmp; + unsigned char *ram, *ramLine; + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + ramLine = (unsigned char *)(i810c->FbBase + i810c->CursorStart); + mskLine = (unsigned char *) bits->mask; + srcLine = (unsigned char *) bits->source; + + h = bits->height; + if (h > I810_CURSOR_HEIGHT) + h = I810_CURSOR_HEIGHT; + + + src_stride = BitmapBytePad(bits->width); /* bytes per line */ + src_width = (bits->width + 7) >> 3; + + for (i = 0; i < I810_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + ram = ramLine; + mskLine += src_stride; + srcLine += src_stride; + ramLine += I810_CURSOR_WIDTH / 4; + + for (j = 0; j < I810_CURSOR_WIDTH / 8; j++) { + + unsigned short m, s, b1, b2; + + if (i < h && j < src_width) + { + m = *msk++; + s = *src++ & m; + m = ~m; + /* mask off right side */ + if (j == src_width - 1 && (bits->width & 7)) + { + m |= 0xff << (bits->width & 7); + } + } + else + { + m = 0xff; + s = 0x00; + } + + /* The i810 stores the cursor in an interleaved bitmap format, + in reverse byte order */ + /* Not tested with cursors bigger than 16x16 !!! */ + + ram[8+(j ^ 1)] = s; /* b2 */ + ram[0+(j ^ 1)] = m; /* b1 */ + } + } + /* Set new color */ + _i810SetCursorColors (pScreen); + + /* Move to new position */ + _i810MoveCursor (pScreen, x, y); + + /* Enable cursor */ + OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical); + OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C); + + tmp = INREG8( PIXPIPE_CONFIG_0 ); + tmp |= HW_CURSOR_ENABLE; + OUTREG8( PIXPIPE_CONFIG_0, tmp); +} + +static void +i810UnloadCursor(ScreenPtr pScreen) { + + SetupCursor(pScreen); + + unsigned char tmp; + + tmp=INREG8( PIXPIPE_CONFIG_0 ); + tmp &= ~HW_CURSOR_ENABLE; + OUTREG8( PIXPIPE_CONFIG_0, tmp); +} + + +static Bool +i810RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + i810LoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +i810UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +i810SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + i810LoadCursor (pScreen, x, y); + else + i810UnloadCursor (pScreen); +} + +miPointerSpriteFuncRec i810PointerSpriteFuncs = { + i810RealizeCursor, + i810UnrealizeCursor, + i810SetCursor, + i810MoveCursor, +}; + +static void +i810QueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +i810CursorInit(ScreenPtr pScreen) +{ + + SetupCursor(pScreen); + + if (!i810c->CursorStart) { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = I810_CURSOR_WIDTH; + pCurPriv->height= I810_CURSOR_HEIGHT; + pScreen->QueryBestSize = i810QueryBestSize; + miPointerInitialize (pScreen, + &i810PointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +i810CursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + i810LoadCursor (pScreen, x, y); + } + else + i810UnloadCursor (pScreen); + } +} + +void +i810CursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + i810UnloadCursor (pScreen); + } + } +} + +void +i810CursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} + diff --git a/xc/programs/Xserver/hw/kdrive/i810/i810_reg.h b/xc/programs/Xserver/hw/kdrive/i810/i810_reg.h new file mode 100644 index 000000000..adf84fb80 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/i810_reg.h @@ -0,0 +1,696 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + +/************************************************************************** + +Copyright 1998-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, 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 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. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/kdrive/i810/i810_reg.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */ + +/* + * Authors: + * Keith Whitwell <keithw@precisioninsight.com> + * Pontus Lidman <pontus.lidman@nokia.com> + * + * based on the i740 driver by + * Kevin E. Martin <kevin@precisioninsight.com> + * + * + */ + +/* I/O register offsets + */ +#define SRX 0x3C4 /* p208 */ +#define GRX 0x3CE /* p213 */ +#define ARX 0x3C0 /* p224 */ + +/* VGA Color Palette Registers */ +#define DACMASK 0x3C6 /* p232 */ +#define DACSTATE 0x3C7 /* p232 */ +#define DACRX 0x3C7 /* p233 */ +#define DACWX 0x3C8 /* p233 */ +#define DACDATA 0x3C9 /* p233 */ + +/* CRT Controller Registers (CRX) */ +#define START_ADDR_HI 0x0C /* p246 */ +#define START_ADDR_LO 0x0D /* p247 */ +#define VERT_SYNC_END 0x11 /* p249 */ +#define EXT_VERT_TOTAL 0x30 /* p257 */ +#define EXT_VERT_DISPLAY 0x31 /* p258 */ +#define EXT_VERT_SYNC_START 0x32 /* p259 */ +#define EXT_VERT_BLANK_START 0x33 /* p260 */ +#define EXT_HORIZ_TOTAL 0x35 /* p261 */ +#define EXT_HORIZ_BLANK 0x39 /* p261 */ +#define EXT_START_ADDR 0x40 /* p262 */ +#define EXT_START_ADDR_ENABLE 0x80 +#define EXT_OFFSET 0x41 /* p263 */ +#define EXT_START_ADDR_HI 0x42 /* p263 */ +#define INTERLACE_CNTL 0x70 /* p264 */ +#define INTERLACE_ENABLE 0x80 +#define INTERLACE_DISABLE 0x00 + +/* Miscellaneous Output Register + */ +#define MSR_R 0x3CC /* p207 */ +#define MSR_W 0x3C2 /* p207 */ +#define IO_ADDR_SELECT 0x01 + +#define MDA_BASE 0x3B0 /* p207 */ +#define CGA_BASE 0x3D0 /* p207 */ + +/* CR80 - IO Control, p264 + */ +#define IO_CTNL 0x80 +#define EXTENDED_ATTR_CNTL 0x02 +#define EXTENDED_CRTC_CNTL 0x01 + +/* GR10 - Address mapping, p221 + */ +#define ADDRESS_MAPPING 0x10 +#define PAGE_TO_LOCAL_MEM_ENABLE 0x10 +#define GTT_MEM_MAP_ENABLE 0x08 +#define PACKED_MODE_ENABLE 0x04 +#define LINEAR_MODE_ENABLE 0x02 +#define PAGE_MAPPING_ENABLE 0x01 + +/* Blitter control, p378 + */ +#define BITBLT_CNTL 0x7000c +#define COLEXP_MODE 0x30 +#define COLEXP_8BPP 0x00 +#define COLEXP_16BPP 0x10 +#define COLEXP_24BPP 0x20 +#define COLEXP_RESERVED 0x30 +#define BITBLT_STATUS 0x01 + +/* p375. + */ +#define DISPLAY_CNTL 0x70008 +#define VGA_WRAP_MODE 0x02 +#define VGA_WRAP_AT_256KB 0x00 +#define VGA_NO_WRAP 0x02 +#define GUI_MODE 0x01 +#define STANDARD_VGA_MODE 0x00 +#define HIRES_MODE 0x01 + +/* p375 + */ +#define PIXPIPE_CONFIG_0 0x70009 +#define DAC_8_BIT 0x80 +#define DAC_6_BIT 0x00 +#define HW_CURSOR_ENABLE 0x10 +#define EXTENDED_PALETTE 0x01 + +/* p375 + */ +#define PIXPIPE_CONFIG_1 0x7000a +#define DISPLAY_COLOR_MODE 0x0F +#define DISPLAY_VGA_MODE 0x00 +#define DISPLAY_8BPP_MODE 0x02 +#define DISPLAY_15BPP_MODE 0x04 +#define DISPLAY_16BPP_MODE 0x05 +#define DISPLAY_24BPP_MODE 0x06 +#define DISPLAY_32BPP_MODE 0x07 + +/* p375 + */ +#define PIXPIPE_CONFIG_2 0x7000b +#define DISPLAY_GAMMA_ENABLE 0x08 +#define DISPLAY_GAMMA_DISABLE 0x00 +#define OVERLAY_GAMMA_ENABLE 0x04 +#define OVERLAY_GAMMA_DISABLE 0x00 + + +/* p380 + */ +#define DISPLAY_BASE 0x70020 +#define DISPLAY_BASE_MASK 0x03fffffc + + +/* Cursor control registers, pp383-384 + */ +#define CURSOR_CONTROL 0x70080 +#define CURSOR_ORIGIN_SCREEN 0x00 +#define CURSOR_ORIGIN_DISPLAY 0x10 +#define CURSOR_MODE 0x07 +#define CURSOR_MODE_DISABLE 0x00 +#define CURSOR_MODE_32_4C_AX 0x01 +#define CURSOR_MODE_64_3C 0x04 +#define CURSOR_MODE_64_4C_AX 0x05 +#define CURSOR_MODE_64_4C 0x06 +#define CURSOR_MODE_RESERVED 0x07 +#define CURSOR_BASEADDR 0x70084 +#define CURSOR_BASEADDR_MASK 0x1FFFFF00 +#define CURSOR_X_LO 0x70088 +#define CURSOR_X_HI 0x70089 +#define CURSOR_X_POS 0x00 +#define CURSOR_X_NEG 0x80 +#define CURSOR_Y_LO 0x7008A +#define CURSOR_Y_HI 0x7008B +#define CURSOR_Y_POS 0x00 +#define CURSOR_Y_NEG 0x80 + + + +/* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm + * not sure they refer to local (graphics) memory. + * + * These details are for the local memory control registers, + * (pp301-310). The test machines are not equiped with local memory, + * so nothing is tested. Only a single row seems to be supported. + */ +#define DRAM_ROW_TYPE 0x3000 +#define DRAM_ROW_0 0x01 +#define DRAM_ROW_0_SDRAM 0x01 +#define DRAM_ROW_0_EMPTY 0x00 +#define DRAM_ROW_CNTL_LO 0x3001 +#define DRAM_PAGE_MODE_CTRL 0x10 +#define DRAM_RAS_TO_CAS_OVRIDE 0x08 +#define DRAM_CAS_LATENCY 0x04 +#define DRAM_RAS_TIMING 0x02 +#define DRAM_RAS_PRECHARGE 0x01 +#define DRAM_ROW_CNTL_HI 0x3002 +#define DRAM_REFRESH_RATE 0x18 +#define DRAM_REFRESH_DISABLE 0x00 +#define DRAM_REFRESH_60HZ 0x08 +#define DRAM_REFRESH_FAST_TEST 0x10 +#define DRAM_REFRESH_RESERVED 0x18 +#define DRAM_SMS 0x07 +#define DRAM_SMS_NORMAL 0x00 +#define DRAM_SMS_NOP_ENABLE 0x01 +#define DRAM_SMS_ABPCE 0x02 +#define DRAM_SMS_MRCE 0x03 +#define DRAM_SMS_CBRCE 0x04 + +/* p307 + */ +#define DPMS_SYNC_SELECT 0x5002 +#define VSYNC_CNTL 0x08 +#define VSYNC_ON 0x00 +#define VSYNC_OFF 0x08 +#define HSYNC_CNTL 0x02 +#define HSYNC_ON 0x00 +#define HSYNC_OFF 0x02 + + + +/* p317, 319 + */ +#define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */ +#define VCLK2_VCO_N 0x600a +#define VCLK2_VCO_DIV_SEL 0x6012 +#define POST_DIV_SELECT 0x70 +#define POST_DIV_1 0x00 +#define POST_DIV_2 0x10 +#define POST_DIV_4 0x20 +#define POST_DIV_8 0x30 +#define POST_DIV_16 0x40 +#define POST_DIV_32 0x50 +#define VCO_LOOP_DIV_BY_4M 0x00 +#define VCO_LOOP_DIV_BY_16M 0x04 + + +/* Instruction Parser Mode Register + * - p281 + * - 2 new bits. + */ +#define INST_PM 0x20c0 +#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */ +#define SYNC_PACKET_FLUSH_ENABLE 0x10 +#define TWO_D_INST_DISABLE 0x08 +#define THREE_D_INST_DISABLE 0x04 +#define STATE_VAR_UPDATE_DISABLE 0x02 +#define PAL_STIP_DISABLE 0x01 + +#define INST_DONE 0x2090 +#define INST_PS 0x20c4 + +#define MEMMODE 0x20dc + + +/* Instruction parser error register. p279 + */ +#define IPEIR 0x2088 +#define IPEHR 0x208C + + +/* General error reporting regs, p296 + */ +#define EIR 0x20B0 +#define EMR 0x20B4 +#define ESR 0x20B8 +#define IP_ERR 0x0001 +#define ERROR_RESERVED 0xffc6 + + +/* Interrupt Control Registers + * - new bits for i810 + * - new register hwstam (mask) + */ +#define HWSTAM 0x2098 /* p290 */ +#define IER 0x20a0 /* p291 */ +#define IIR 0x20a4 /* p292 */ +#define IMR 0x20a8 /* p293 */ +#define ISR 0x20ac /* p294 */ +#define HW_ERROR 0x8000 +#define SYNC_STATUS_TOGGLE 0x1000 +#define DPY_0_FLIP_PENDING 0x0800 +#define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */ +#define OVL_0_FLIP_PENDING 0x0200 +#define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */ +#define DPY_0_VBLANK 0x0080 +#define DPY_0_EVENT 0x0040 +#define DPY_1_VBLANK 0x0020 /* not implemented on i810 */ +#define DPY_1_EVENT 0x0010 /* not implemented on i810 */ +#define HOST_PORT_EVENT 0x0008 /* */ +#define CAPTURE_EVENT 0x0004 /* */ +#define USER_DEFINED 0x0002 +#define BREAKPOINT 0x0001 + + +#define INTR_RESERVED (0x6000 | \ + DPY_1_FLIP_PENDING | \ + OVL_1_FLIP_PENDING | \ + DPY_1_VBLANK | \ + DPY_1_EVENT | \ + HOST_PORT_EVENT | \ + CAPTURE_EVENT ) + +/* FIFO Watermark and Burst Length Control Register + * + * - different offset and contents on i810 (p299) (fewer bits per field) + * - some overlay fields added + * - what does it all mean? + */ +#define FWATER_BLC 0x20d8 +#define MM_BURST_LENGTH 0x00700000 +#define MM_FIFO_WATERMARK 0x0001F000 +#define LM_BURST_LENGTH 0x00000700 +#define LM_FIFO_WATERMARK 0x0000001F + + +/* Fence/Tiling ranges [0..7] + */ +#define FENCE 0x2000 +#define FENCE_NR 8 + +#define FENCE_START_MASK 0x03F80000 +#define FENCE_X_MAJOR 0x00000000 +#define FENCE_Y_MAJOR 0x00001000 +#define FENCE_SIZE_MASK 0x00000700 +#define FENCE_SIZE_512K 0x00000000 +#define FENCE_SIZE_1M 0x00000100 +#define FENCE_SIZE_2M 0x00000200 +#define FENCE_SIZE_4M 0x00000300 +#define FENCE_SIZE_8M 0x00000400 +#define FENCE_SIZE_16M 0x00000500 +#define FENCE_SIZE_32M 0x00000600 +#define FENCE_PITCH_MASK 0x00000070 +#define FENCE_PITCH_1 0x00000000 +#define FENCE_PITCH_2 0x00000010 +#define FENCE_PITCH_4 0x00000020 +#define FENCE_PITCH_8 0x00000030 +#define FENCE_PITCH_16 0x00000040 +#define FENCE_PITCH_32 0x00000050 +#define FENCE_VALID 0x00000001 + + +/* Registers to control page table, p274 + */ +#define PGETBL_CTL 0x2020 +#define PGETBL_ADDR_MASK 0xFFFFF000 +#define PGETBL_ENABLE_MASK 0x00000001 +#define PGETBL_ENABLED 0x00000001 + +/* Register containing pge table error results, p276 + */ +#define PGE_ERR 0x2024 +#define PGE_ERR_ADDR_MASK 0xFFFFF000 +#define PGE_ERR_ID_MASK 0x00000038 +#define PGE_ERR_CAPTURE 0x00000000 +#define PGE_ERR_OVERLAY 0x00000008 +#define PGE_ERR_DISPLAY 0x00000010 +#define PGE_ERR_HOST 0x00000018 +#define PGE_ERR_RENDER 0x00000020 +#define PGE_ERR_BLITTER 0x00000028 +#define PGE_ERR_MAPPING 0x00000030 +#define PGE_ERR_CMD_PARSER 0x00000038 +#define PGE_ERR_TYPE_MASK 0x00000007 +#define PGE_ERR_INV_TABLE 0x00000000 +#define PGE_ERR_INV_PTE 0x00000001 +#define PGE_ERR_MIXED_TYPES 0x00000002 +#define PGE_ERR_PAGE_MISS 0x00000003 +#define PGE_ERR_ILLEGAL_TRX 0x00000004 +#define PGE_ERR_LOCAL_MEM 0x00000005 +#define PGE_ERR_TILED 0x00000006 + + + +/* Page table entries loaded via mmio region, p323 + */ +#define PTE_BASE 0x10000 +#define PTE_ADDR_MASK 0x3FFFF000 +#define PTE_TYPE_MASK 0x00000006 +#define PTE_LOCAL 0x00000002 +#define PTE_MAIN_UNCACHED 0x00000000 +#define PTE_MAIN_CACHED 0x00000006 +#define PTE_VALID_MASK 0x00000001 +#define PTE_VALID 0x00000001 + + +/* Ring buffer registers, p277, overview p19 + */ +#define LP_RING 0x2030 +#define HP_RING 0x2040 + +#define RING_TAIL 0x00 +#define TAIL_ADDR 0x000FFFF8 + +#define RING_HEAD 0x04 +#define HEAD_WRAP_COUNT 0xFFE00000 +#define HEAD_WRAP_ONE 0x00200000 +#define HEAD_ADDR 0x001FFFFC + +#define RING_START 0x08 +#define START_ADDR 0x00FFFFF8 + +#define RING_LEN 0x0C +#define RING_NR_PAGES 0x000FF000 +#define RING_REPORT_MASK 0x00000006 +#define RING_REPORT_64K 0x00000002 +#define RING_REPORT_128K 0x00000004 +#define RING_NO_REPORT 0x00000000 +#define RING_VALID_MASK 0x00000001 +#define RING_VALID 0x00000001 +#define RING_INVALID 0x00000000 + + + +/* BitBlt Instructions + * + * There are many more masks & ranges yet to add. + */ +#define BR00_BITBLT_CLIENT 0x40000000 +#define BR00_OP_COLOR_BLT 0x10000000 +#define BR00_OP_SRC_COPY_BLT 0x10C00000 +#define BR00_OP_FULL_BLT 0x11400000 +#define BR00_OP_MONO_SRC_BLT 0x11800000 +#define BR00_OP_MONO_SRC_COPY_BLT 0x11000000 +#define BR00_OP_MONO_PAT_BLT 0x11C00000 +#define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22) +#define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000 + + +#define BR00_TPCY_DISABLE 0x00000000 +#define BR00_TPCY_ENABLE 0x00000010 + +#define BR00_TPCY_ROP 0x00000000 +#define BR00_TPCY_NO_ROP 0x00000020 +#define BR00_TPCY_EQ 0x00000000 +#define BR00_TPCY_NOT_EQ 0x00000040 + +#define BR00_PAT_MSB_FIRST 0x00000000 /* ? */ + +#define BR00_PAT_VERT_ALIGN 0x000000e0 + +#define BR00_LENGTH 0x0000000F + +#define BR09_DEST_ADDR 0x03FFFFFF + +#define BR11_SOURCE_PITCH 0x00003FFF + +#define BR12_SOURCE_ADDR 0x03FFFFFF + +#define BR13_SOLID_PATTERN 0x80000000 +#define BR13_RIGHT_TO_LEFT 0x40000000 +#define BR13_LEFT_TO_RIGHT 0x00000000 +#define BR13_MONO_TRANSPCY 0x20000000 +#define BR13_USE_DYN_DEPTH 0x04000000 +#define BR13_DYN_8BPP 0x00000000 +#define BR13_DYN_16BPP 0x01000000 +#define BR13_DYN_24BPP 0x02000000 +#define BR13_ROP_MASK 0x00FF0000 +#define BR13_DEST_PITCH 0x0000FFFF +#define BR13_PITCH_SIGN_BIT 0x00008000 + +#define BR14_DEST_HEIGHT 0xFFFF0000 +#define BR14_DEST_WIDTH 0x0000FFFF + +#define BR15_PATTERN_ADDR 0x03FFFFFF + +#define BR16_SOLID_PAT_COLOR 0x00FFFFFF +#define BR16_BACKGND_PAT_CLR 0x00FFFFFF + +#define BR17_FGND_PAT_CLR 0x00FFFFFF + +#define BR18_SRC_BGND_CLR 0x00FFFFFF +#define BR19_SRC_FGND_CLR 0x00FFFFFF + + +/* Instruction parser instructions + */ + +#define INST_PARSER_CLIENT 0x00000000 +#define INST_OP_FLUSH 0x02000000 +#define INST_FLUSH_MAP_CACHE 0x00000001 + +#define INST_DEST_BUFFER_INFO 0x06800000 + +#define INST_FRONT_BUFFER_INFO 0x06000000 +#define FRONT_INFO_ASYNC_FLIP 1<<6 +#define FRONT_INFO_PITCH_B 8 + +#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) + + +/* Registers in the i810 host-pci bridge pci config space which affect + * the i810 graphics operations. + */ +#define SMRAM_MISCC 0x70 +#define GMS 0x000000c0 +#define GMS_DISABLE 0x00000000 +#define GMS_ENABLE_BARE 0x00000040 +#define GMS_ENABLE_512K 0x00000080 +#define GMS_ENABLE_1M 0x000000c0 +#define USMM 0x00000030 +#define USMM_DISABLE 0x00000000 +#define USMM_TSEG_ZERO 0x00000010 +#define USMM_TSEG_512K 0x00000020 +#define USMM_TSEG_1M 0x00000030 +#define GFX_MEM_WIN_SIZE 0x00010000 +#define GFX_MEM_WIN_32M 0x00010000 +#define GFX_MEM_WIN_64M 0x00000000 + +/* Overkill? I don't know. Need to figure out top of mem to make the + * SMRAM calculations come out. Linux seems to have problems + * detecting it all on its own, so this seems a reasonable double + * check to any user supplied 'mem=...' boot param. + * + * ... unfortunately this reg doesn't work according to spec on the + * test hardware. + */ +#define WHTCFG_PAMR_DRP 0x50 +#define SYS_DRAM_ROW_0_SHIFT 16 +#define SYS_DRAM_ROW_1_SHIFT 20 +#define DRAM_MASK 0x0f +#define DRAM_VALUE_0 0 +#define DRAM_VALUE_1 8 +/* No 2 value defined */ +#define DRAM_VALUE_3 16 +#define DRAM_VALUE_4 16 +#define DRAM_VALUE_5 24 +#define DRAM_VALUE_6 32 +#define DRAM_VALUE_7 32 +#define DRAM_VALUE_8 48 +#define DRAM_VALUE_9 64 +#define DRAM_VALUE_A 64 +#define DRAM_VALUE_B 96 +#define DRAM_VALUE_C 128 +#define DRAM_VALUE_D 128 +#define DRAM_VALUE_E 192 +#define DRAM_VALUE_F 256 /* nice one, geezer */ +#define LM_FREQ_MASK 0x10 +#define LM_FREQ_133 0x10 +#define LM_FREQ_100 0x00 + + + + +/* These are 3d state registers, but the state is invarient, so we let + * the X server handle it: + */ + + + +/* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135 + */ +#define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1) +#define CC1_UPDATE_KILL_WRITE (1<<28) +#define CC1_ENABLE_KILL_WRITE (1<<27) +#define CC1_DISABLE_KILL_WRITE 0 +#define CC1_UPDATE_COLOR_IDX (1<<26) +#define CC1_UPDATE_CHROMA_LOW (1<<25) +#define CC1_UPDATE_CHROMA_HI (1<<24) +#define CC1_CHROMA_LOW_MASK ((1<<24)-1) +#define CC2_COLOR_IDX_SHIFT 24 +#define CC2_COLOR_IDX_MASK (0xff<<24) +#define CC2_CHROMA_HI_MASK ((1<<24)-1) + + +#define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23)) +#define CS_UPDATE_LOAD (1<<17) +#define CS_UPDATE_USE (1<<16) +#define CS_UPDATE_LOAD (1<<17) +#define CS_LOAD_CTX0 0 +#define CS_LOAD_CTX1 (1<<8) +#define CS_USE_CTX0 0 +#define CS_USE_CTX1 (1<<0) + +/* 3D Rendering Engine */ + +#define RENDER_CLIENT 0x60000000 + +/* Primitive rendering instruction */ + +#define GFX_PRIMITIVE 0x1f000000 +#define PRIMITIVE_TRIANGLE 0 << 18 +#define PRIMITIVE_TRI_STRIP 1 << 18 +#define PRIMITIVE_TRI_REV_STRIP 2 << 18 +#define PRIMITIVE_TRI_FAN 3 << 18 +#define PRIMITIVE_POLYGON 4 << 18 +#define PRIMITIVE_LINE 5 << 18 +#define PRIMITIVE_LINE_STRIP 6 << 18 +#define PRIMITIVE_RECTANGLE 7 << 18 + +/* Vertex format instruction */ +#define GFX_VERTEX_FORMAT 0x05000000 +#define VERTEX_0_TEXCOORDS 0 << 8 +#define VERTEX_1_TEXCOORDS 1 << 8 +#define VERTEX_2_TEXCOORDS 2 << 8 +#define VERTEX_SPECULAR_FOG 1 << 7 +#define VERTEX_DIFFUSE_ALPHA 1 << 6 +#define VERTEX_Z_OFFSET 1 << 5 +#define VERTEX_POS_XYZ 1 << 1 +#define VERTEX_POS_XYZ_RHW 2 << 1 +#define VERTEX_POS_XY 3 << 1 +#define VERTEX_POS_XY_RHW 4 << 1 + +/* Drawing Rectangle Info instruction */ + +#define GFX_DRAWING_RECTANGLE_INFO 0x1d800003 +#define GFX_DRAWING_CLIP_DISABLE 1<<31 + +/* Boolean enable 1 */ +#define GFX_BOOLEAN_ENA_1 0x03000000 +#define BOOL1_ALPHA_SETUP_MASK 1<<17 +#define BOOL1_ALPHA_SETUP_BIT 1<<16 +#define BOOL1_FOG_ENABLE_MASK 1<<7 +#define BOOL1_FOG_ENABLE_BIT 1<<6 +#define BOOL1_ALPHA_TEST_MASK 1<<5 +#define BOOL1_ALPHA_TEST_BIT 1<<4 +#define BOOL1_BLEND_ENABLE_MASK 1<<3 +#define BOOL1_BLEND_ENABLE_BIT 1<<2 +#define BOOL1_Z_ENABLE_MASK 1<<1 +#define BOOL1_Z_ENABLE_BIT 1<<0 + +/* Boolean enable 2 */ +#define GFX_BOOLEAN_ENA_2 0x04000000 +#define BOOL2_MAPPING_CACHE_MASK 1<<17 +#define BOOL2_MAPPING_CACHE_BIT 1<<16 +#define BOOL2_ALPHA_DITHER_MASK 1<<15 +#define BOOL2_ALPHA_DITHER_BIT 1<<14 +#define BOOL2_FOG_DITHER_MASK 1<<13 +#define BOOL2_FOG_DITHER_BIT 1<<12 +#define BOOL2_SPECULAR_DITHER_MASK 1<<11 +#define BOOL2_SPECULAR_DITHER_BIT 1<<10 +#define BOOL2_COLOR_DITHER_MASK 1<<9 +#define BOOL2_COLOR_DITHER_BIT 1<<8 +#define BOOL2_FB_WRITE_MASK 1<<3 +#define BOOL2_FB_WRITE_BIT 1<<2 +#define BOOL2_Z_WRITE_MASK 1<<1 +#define BOOL2_Z_WRITE_BIT 1<<0 + +/* Dest buffer variables */ + +#define GFX_DEST_BUFFER_VARIABLES 0x1d850000 + +#define DEST_BUF_VAR_8BIT 0 << 8 +#define DEST_BUF_VAR_555 1 << 8 +#define DEST_BUF_VAR_565 2 << 8 + +/* map color blend stages */ + +#define GFX_MAP_COLOR_BLEND_STAGES 0 + +#define MAP_BLEND_STAGE_B 20 +#define MAP_BLEND_ACC_SEL_MASK 1<<19 +#define MAP_BLEND_ACC_SEL_BIT 1<<18 +#define MAP_BLEND_ARG1_MASK 1<<17 +#define MAP_BLEND_ARG1_B 14 +#define MAP_BLEND_REPLICATE_ARG1 1<<13 +#define MAP_BLEND_INVERT_ARG1 1<<12 + +#define MAP_BLEND_ARG2_MASK 1<<11 +#define MAP_BLEND_ARG2_B 8 +#define MAP_BLEND_REPLICATE_ARG2 1<<7 +#define MAP_BLEND_INVERT_ARG2 1<<6 + +#define MAP_BLEND_COLOR_OP_MASK 1<<5 +#define MAP_BLEND_COLOR_OP_B 0 + +#define GFX_SCISSOR_ENABLE 0x1c800000 + +#define SCISSOR_ENABLE_MASK 1<<1 +#define SCISSOR_ENABLE_BIT 1<<0 diff --git a/xc/programs/Xserver/hw/kdrive/i810/i810_video.c b/xc/programs/Xserver/hw/kdrive/i810/i810_video.c new file mode 100644 index 000000000..42eeb83fd --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/i810_video.c @@ -0,0 +1,1165 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + +/*************************************************************************** + +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/kdrive/i810/i810_video.c,v 1.1 2001/03/30 02:18:41 keithp Exp $ */ + +/* + * i810_video.c: i810 KDrive Xv driver. + * Based on the XFree86 i810 Xv driver by Jonathan Bian. + * + * Authors: + * Jonathan Bian <jonathan.bian@intel.com> + * Pontus Lidman <pontus.lidman@nokia.com> + * + */ + +#include "kdrive.h" +#include "kxv.h" +#include "i810.h" + +#include "Xv.h" + +#include "../../xfree86/common/fourcc.h" + +typedef struct { + CARD32 size; + CARD32 offset; +} FBLinearRec, *FBLinearPtr; + +#define OFF_DELAY 250 /* milliseconds */ +#define FREE_DELAY 15000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +static KdVideoAdaptorPtr i810SetupImageVideo(ScreenPtr); +static void i810StopVideo(KdScreenInfo *, pointer, Bool); +static int i810SetPortAttribute(KdScreenInfo *, Atom, int, pointer); +static int i810GetPortAttribute(KdScreenInfo *, Atom, int *, pointer); +static void i810QueryBestSize(KdScreenInfo *, Bool, + short, short, short, short, unsigned int *, unsigned int *, pointer); +static int i810PutImage( KdScreenInfo *, + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static int i810QueryImageAttributes(KdScreenInfo *, + 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 OV_BYTE_ORDER 0x0000C000 +#define UV_SWAP 0x00004000 +#define Y_SWAP 0x00008000 +#define Y_AND_UV_SWAP 0x0000C000 +#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 + +#define RGB16ToColorKey(c) \ + (((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3)) + +#define RGB15ToColorKey(c) \ + (((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3)) + +Bool i810InitVideo(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; + KdVideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + +/* fprintf(stderr,"i810InitVideo\n"); */ + + if (screen->fb[0].bitsPerPixel != 8) + { + newAdaptor = i810SetupImageVideo(pScreen); + } + + num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); + + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(KdVideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(KdVideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + KdXVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); + return TRUE; +} + +/* client libraries expect an encoding */ +static KdVideoEncodingRec DummyEncoding[1] = +{ + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } +}; + +#define NUM_FORMATS 3 + +static KdVideoFormatRec Formats[NUM_FORMATS] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 3 + +static KdAttributeRec 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 4 + +static KdImageRec Images[NUM_IMAGES] = +{ + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + XVIMAGE_UYVY +}; + +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 YBuf0offset; + CARD32 UBuf0offset; + CARD32 VBuf0offset; + + CARD32 YBuf1offset; + CARD32 UBuf1offset; + CARD32 VBuf1offset; + + unsigned char currentBuf; + + unsigned char brightness; + unsigned char contrast; + + RegionRec clip; + CARD32 colorKey; + + CARD32 videoStatus; + Time offTime; + Time freeTime; + FBLinearPtr linear; +} I810PortPrivRec, *I810PortPrivPtr; + +#define GET_PORT_PRIVATE(screen) \ + (I810PortPrivPtr)(((I810CardInfo *) (screen->card->driver))->adaptor->pPortPrivates[0].ptr) + +static void i810ResetVideo(KdScreenInfo *screen) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr; + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); + + /* + * Default to maximum image size in 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 */ + + /* + * Enable destination color keying + */ + switch(screen->fb[0].depth) { + case 16: overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); + overlay->DCLRKM = 0x80070307; + break; + case 15: overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); + overlay->DCLRKM = 0x80070707; + break; + default: overlay->DCLRKV = pPriv->colorKey; + overlay->DCLRKM = 0x80000000; + break; + } + + 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(i810c->OverlayPhysical); +} + + +static KdVideoAdaptorPtr +i810SetupImageVideo(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = pScreenPriv->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + + KdVideoAdaptorPtr adapt; + I810PortPrivPtr pPriv; + +/* fprintf(stderr,"i810SetupImageVideo\n"); */ + + if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + + 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 = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + 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 = i810c->colorKey & ((1 << screen->fb[0].depth) - 1); + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 128; + pPriv->linear = NULL; + pPriv->currentBuf = 0; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + i810c->adaptor = adapt; + + i810c->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = i810BlockHandler; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + i810ResetVideo(screen); + + 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(KdScreenInfo *screen, pointer data, Bool exit) +{ + I810PortPrivPtr pPriv = (I810PortPrivPtr)data; + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); + + REGION_EMPTY(screen->pScreen, &pPriv->clip); + + if(exit) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + overlay->OV0CMD &= 0xFFFFFFFE; + OVERLAY_UPDATE(i810c->OverlayPhysical); + } + if(pPriv->linear) { + xfree(pPriv->linear); + pPriv->linear = NULL; + } + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } + +} + +static int +i810SetPortAttribute( + KdScreenInfo *screen, + Atom attribute, + int value, + pointer data +){ + I810PortPrivPtr pPriv = (I810PortPrivPtr)data; + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); + + if(attribute == xvBrightness) { + if((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + overlay->OV0CLRC0 &= 0xFFFFFF00; + overlay->OV0CLRC0 |= value; + OVERLAY_UPDATE(i810c->OverlayPhysical); + } else + if(attribute == xvContrast) { + if((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; + overlay->OV0CLRC0 &= 0xFFFE00FF; + overlay->OV0CLRC0 |= value << 9; + OVERLAY_UPDATE(i810c->OverlayPhysical); + } else + if(attribute == xvColorKey) { + pPriv->colorKey = value; + switch(screen->fb[0].depth) { + case 16: overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); + break; + case 15: overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); + break; + default: overlay->DCLRKV = pPriv->colorKey; + break; + } + OVERLAY_UPDATE(i810c->OverlayPhysical); + REGION_EMPTY(screen->pScreen, &pPriv->clip); + } else return BadMatch; + + return Success; +} + +static int +i810GetPortAttribute( + KdScreenInfo *screen, + Atom attribute, + int *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( + KdScreenInfo *screen, + 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; +} + + +static void +I810CopyPackedData( + KdScreenInfo *screen, + unsigned char *buf, + int srcPitch, + int dstPitch, + int top, + int left, + int h, + int w + ) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr; + unsigned char *src, *dst; + + src = buf + (top*srcPitch) + (left<<1); + + if (pPriv->currentBuf == 0) + dst = i810c->FbBase + pPriv->YBuf0offset; + else + dst = i810c->FbBase + pPriv->YBuf1offset; + + w <<= 1; + while(h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + +static void +i810CopyPlanarData( + KdScreenInfo *screen, + unsigned char *buf, + int srcPitch, + int dstPitch, /* of chroma */ + int srcH, + int top, + int left, + int h, + int w, + int id + ) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + I810PortPrivPtr pPriv = i810c->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 = i810c->FbBase + pPriv->YBuf0offset; + else + dst1 = i810c->FbBase + pPriv->YBuf1offset; + + for (i = 0; i < h; i++) { + memcpy(dst1, src1, w); + src1 += srcPitch; + dst1 += dstPitch << 1; + } + + /* Copy V data for YV12, or U data for I420 */ + src2 = buf + (srcH*srcPitch) + ((top*srcPitch)>>2) + (left>>1); + if (pPriv->currentBuf == 0) { + if (id == FOURCC_I420) + dst2 = i810c->FbBase + pPriv->UBuf0offset; + else + dst2 = i810c->FbBase + pPriv->VBuf0offset; + } else { + if (id == FOURCC_I420) + dst2 = i810c->FbBase + pPriv->UBuf1offset; + else + dst2 = i810c->FbBase + pPriv->VBuf1offset; + } + + for (i = 0; i < h/2; i++) { + memcpy(dst2, src2, w/2); + src2 += srcPitch>>1; + dst2 += dstPitch; + } + + /* Copy U data for YV12, or V data for I420 */ + src3 = buf + (srcH*srcPitch) + ((srcH*srcPitch)>>2) + ((top*srcPitch)>>2) + (left>>1); + if (pPriv->currentBuf == 0) { + if (id == FOURCC_I420) + dst3 = i810c->FbBase + pPriv->VBuf0offset; + else + dst3 = i810c->FbBase + pPriv->UBuf0offset; + } else { + if (id == FOURCC_I420) + dst3 = i810c->FbBase + pPriv->VBuf1offset; + else + dst3 = i810c->FbBase + pPriv->UBuf1offset; + } + + for (i = 0; i < h/2; i++) { + memcpy(dst3, src3, w/2); + src3 += srcPitch>>1; + dst3 += dstPitch; + } +} + +static void +i810DisplayVideo( + KdScreenInfo *screen, + int id, + short width, short height, + int dstPitch, /* of chroma for 4:2:0 */ + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr; + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); + int xscaleInt, xscaleFract, yscaleInt, yscaleFract; + int xscaleIntUV = 0, xscaleFractUV = 0, yscaleIntUV = 0, yscaleFractUV = 0; + unsigned int swidth; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + swidth = (width + 7) & ~7; + overlay->SWID = (swidth << 15) | swidth; + overlay->SWIDQW = (swidth << 12) | (swidth >> 3); + break; + case FOURCC_UYVY: + case FOURCC_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); + + /* buffer locations */ + overlay->OBUF_0Y = pPriv->YBuf0offset; + overlay->OBUF_1Y = pPriv->YBuf1offset; + overlay->OBUF_0U = pPriv->UBuf0offset; + overlay->OBUF_0V = pPriv->VBuf0offset; + overlay->OBUF_1U = pPriv->UBuf1offset; + overlay->OBUF_1V = pPriv->VBuf1offset; + + /* + * 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 FOURCC_YV12: + case FOURCC_I420: + overlay->OV0STRIDE = (dstPitch << 1) | (dstPitch << 16); + overlay->OV0CMD &= ~SOURCE_FORMAT; + overlay->OV0CMD |= YUV_420; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + overlay->OV0STRIDE = dstPitch; + overlay->OV0CMD &= ~SOURCE_FORMAT; + overlay->OV0CMD |= YUV_422; + overlay->OV0CMD &= ~OV_BYTE_ORDER; + if (id == FOURCC_UYVY) + overlay->OV0CMD |= Y_SWAP; + break; + } + + overlay->OV0CMD &= ~BUFFER_AND_FIELD; + if (pPriv->currentBuf == 0) + overlay->OV0CMD |= BUFFER0_FIELD0; + else + overlay->OV0CMD |= BUFFER1_FIELD0; + + OVERLAY_UPDATE(i810c->OverlayPhysical); + +} + +static FBLinearPtr +i810AllocateMemory( + KdScreenInfo *screen, + FBLinearPtr linear, + int size +){ + KdCardInfo *card=screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + FBLinearPtr new_linear; + + if(linear) { + if(linear->size >= size) + return linear; + else + ErrorF("Ran out of memory for overlay buffer, requested size = %d\n",size); + } + + new_linear = xalloc(sizeof(FBLinearRec)); + new_linear->size = i810c->XvMem.Size; + new_linear->offset = i810c->XvMem.Start; + +/* fprintf(stderr,"Overlay mem offset %lx\n",new_linear->offset); */ + + return new_linear; +} + +static int +i810PutImage( + KdScreenInfo *screen, + 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 +){ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + I810PortPrivPtr pPriv = (I810PortPrivPtr)data; + INT32 x1, x2, y1, y2; + int srcPitch, dstPitch; + int top, left, npixels, nlines, size; + BoxRec dstBox; + + /* 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; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + dstPitch = ((width >> 1) + 7) & ~7; /* of chroma */ + size = dstPitch * height * 3; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + srcPitch = (width << 1); + dstPitch = (srcPitch + 7) & ~7; + size = dstPitch * height; + break; + } + + if(!(pPriv->linear = i810AllocateMemory(screen, pPriv->linear, + (screen->fb[0].bitsPerPixel == 16) ? size : (size >> 1)))) + return BadAlloc; + + /* fixup pointers */ + pPriv->YBuf0offset = pPriv->linear->offset; + pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * height); + pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * height >> 1); + + pPriv->YBuf1offset = pPriv->linear->offset + size; + pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * height); + pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * height >> 1); + + /* wait for the last rendered buffer to be flipped in */ + while (((INREG(DOV0STA)&0x00100000)>>20) != pPriv->currentBuf); + + /* buffer swap */ + if (pPriv->currentBuf == 0) + pPriv->currentBuf = 1; + else + pPriv->currentBuf = 0; + + /* copy data */ + top = y1 >> 16; + left = (x1 >> 16) & ~1; + npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + i810CopyPlanarData(screen, buf, srcPitch, dstPitch, height, top, left, + nlines, npixels, id); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + nlines = ((y2 + 0xffff) >> 16) - top; + I810CopyPackedData(screen, buf, srcPitch, dstPitch, top, left, nlines, + npixels); + break; + } + + /* update cliplist */ + if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + i810FillBoxSolid(screen, REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes), + pPriv->colorKey, GXcopy, ~0); + /* + XAAFillSolidRects(screen, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + */ + } + + + i810DisplayVideo(screen, id, width, height, dstPitch, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; +} + + +static int +i810QueryImageAttributes( + KdScreenInfo *screen, + 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 FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + + return size; +} + +static void +i810BlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +){ + ScreenPtr pScreen = screenInfo.screens[i]; + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + I810PortPrivPtr pPriv = GET_PORT_PRIVATE(screen); + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); + + pScreen->BlockHandler = i810c->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(i810c->OverlayPhysical); + + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < currentTime.milliseconds) { + if(pPriv->linear) { + xfree(pPriv->linear); + pPriv->linear = NULL; + } + pPriv->videoStatus = 0; + } + } + } +} diff --git a/xc/programs/Xserver/hw/kdrive/i810/i810draw.c b/xc/programs/Xserver/hw/kdrive/i810/i810draw.c new file mode 100644 index 000000000..3f8a836cf --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/i810draw.c @@ -0,0 +1,603 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + +/* Hardware accelerated drawing for KDrive i810 driver. + Author: Pontus Lidman <pontus.lidman@nokia.com> +*/ + +#include "kdrive.h" +#ifdef XV +#include "kxv.h" +#endif +#include "i810.h" +#include "i810_reg.h" + +#include "Xmd.h" +#include "gcstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "regionstr.h" +#include "mistruct.h" +#include "fontstruct.h" +#include "dixfontstr.h" +#include "fb.h" +#include "migc.h" +#include "miline.h" +#include "picturestr.h" + +#define NUM_STACK_RECTS 1024 + +void +i810Sync( KdScreenInfo *screen ); +int +i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ); + +void +i810EmitInvarientState(KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + BEGIN_LP_RING( 10 ); + + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 ); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); + OUT_RING( 0 ); + + + OUT_RING( GFX_OP_COLOR_CHROMA_KEY ); + OUT_RING( CC1_UPDATE_KILL_WRITE | + CC1_DISABLE_KILL_WRITE | + CC1_UPDATE_COLOR_IDX | + CC1_UPDATE_CHROMA_LOW | + CC1_UPDATE_CHROMA_HI | + 0); + OUT_RING( 0 ); + OUT_RING( 0 ); + + /* No depth buffer in KDrive yet */ + /* OUT_RING( CMD_OP_Z_BUFFER_INFO ); */ + /* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */ + + ADVANCE_LP_RING(); +} + +static unsigned int i810PatternRop[16] = { + 0x00, /* GXclear */ + 0xA0, /* GXand */ + 0x50, /* GXandReverse */ + 0xF0, /* GXcopy */ + 0x0A, /* GXandInvert */ + 0xAA, /* GXnoop */ + 0x5A, /* GXxor */ + 0xFA, /* GXor */ + 0x05, /* GXnor */ + 0xA5, /* GXequiv */ + 0x55, /* GXinvert */ + 0xF5, /* GXorReverse */ + 0x0F, /* GXcopyInvert */ + 0xAF, /* GXorInverted */ + 0x5F, /* GXnand */ + 0xFF /* GXset */ +}; + +void +i810SetupForSolidFill(KdScreenInfo *screen, int color, int rop, + unsigned int planemask) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "i810SetupForFillRectSolid color: %x rop: %x mask: %x\n", + color, rop, planemask); + + /* Color blit, p166 */ + i810c->BR[13] = (BR13_SOLID_PATTERN | + (i810PatternRop[rop] << 16) | + (screen->width * i810c->cpp)); + i810c->BR[16] = color; +} + + +void +i810SubsequentSolidFillRect(KdScreenInfo *screen, int x, int y, int w, int h) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) + ErrorF( "i810SubsequentFillRectSolid %d,%d %dx%d\n", + x,y,w,h); + + { + BEGIN_LP_RING(6); + + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); + OUT_RING( i810c->BR[13] ); + OUT_RING( (h << 16) | (w * i810c->cpp)); + OUT_RING( i810c->bufferOffset + + (y * screen->width + x) * i810c->cpp); + + OUT_RING( i810c->BR[16]); + OUT_RING( 0 ); /* pad to quadword */ + + ADVANCE_LP_RING(); + } +} + + +BOOL +i810FillOk (GCPtr pGC) +{ + FbBits depthMask; + + switch (pGC->fillStyle) { + case FillSolid: + return TRUE; + /* More cases later... */ + } + return FALSE; +} + +void +i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox, + unsigned long pixel, int alu, unsigned long planemask) +{ + i810SetupForSolidFill(screen, pixel, alu, planemask); + while (nBox--) + { + i810SubsequentSolidFillRect(screen, pBox->x1, pBox->y1, + pBox->x2-pBox->x1, pBox->y2-pBox->y1); + pBox++; + } + KdMarkSync(screen->pScreen); +} + + +void +i810PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit) +{ + + + xRectangle *prect; + RegionPtr prgnClip; + register BoxPtr pbox; + register BoxPtr pboxClipped; + BoxPtr pboxClippedBase; + BoxPtr pextent; + BoxRec stackRects[NUM_STACK_RECTS]; + FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); + int numRects; + int n; + int xorg, yorg; + int x, y; + KdScreenPriv(pDrawable->pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + + if (!i810FillOk (pGC)) + { + KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); + return; + } + prgnClip = fbGetCompositeClip(pGC); + xorg = pDrawable->x; + yorg = pDrawable->y; + + if (xorg || yorg) + { + prect = prectInit; + n = nrectFill; + while(n--) + { + prect->x += xorg; + prect->y += yorg; + prect++; + } + } + + prect = prectInit; + + numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; + if (numRects > NUM_STACK_RECTS) + { + pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec)); + if (!pboxClippedBase) + return; + } + else + pboxClippedBase = stackRects; + + pboxClipped = pboxClippedBase; + + if (REGION_NUM_RECTS(prgnClip) == 1) + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_RECTS(prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + if ((pboxClipped->x1 = prect->x) < x1) + pboxClipped->x1 = x1; + + if ((pboxClipped->y1 = prect->y) < y1) + pboxClipped->y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + pboxClipped->x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + pboxClipped->y2 = by2; + + prect++; + if ((pboxClipped->x1 < pboxClipped->x2) && + (pboxClipped->y1 < pboxClipped->y2)) + { + pboxClipped++; + } + } + } + else + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + BoxRec box; + + if ((box.x1 = prect->x) < x1) + box.x1 = x1; + + if ((box.y1 = prect->y) < y1) + box.y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + box.x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + box.y2 = by2; + + prect++; + + if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) + continue; + + n = REGION_NUM_RECTS (prgnClip); + pbox = REGION_RECTS(prgnClip); + + /* clip the rectangle to each box in the clip region + this is logically equivalent to calling Intersect() + */ + while(n--) + { + pboxClipped->x1 = max(box.x1, pbox->x1); + pboxClipped->y1 = max(box.y1, pbox->y1); + pboxClipped->x2 = min(box.x2, pbox->x2); + pboxClipped->y2 = min(box.y2, pbox->y2); + pbox++; + + /* see if clipping left anything */ + if(pboxClipped->x1 < pboxClipped->x2 && + pboxClipped->y1 < pboxClipped->y2) + { + pboxClipped++; + } + } + } + } + if (pboxClipped != pboxClippedBase) + { + switch (pGC->fillStyle) { + case FillSolid: + i810FillBoxSolid(screen, + pboxClipped-pboxClippedBase, pboxClippedBase, + pGC->fgPixel, pGC->alu, pGC->planemask); + break; + /* More cases later... */ + } + } + if (pboxClippedBase != stackRects) + xfree(pboxClippedBase); +} + +void +i810RefreshRing(KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + i810c->LpRing.head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; + i810c->LpRing.tail = INREG(LP_RING + RING_TAIL); + i810c->LpRing.space = i810c->LpRing.head - (i810c->LpRing.tail+8); + if (i810c->LpRing.space < 0) + i810c->LpRing.space += i810c->LpRing.mem.Size; + + i810c->NeedToSync = TRUE; +} + +int +i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + I810RingBuffer *ring = &(i810c->LpRing); + int iters = 0; + int start = 0; + int now = 0; + int last_head = 0; + int first = 0; + + /* If your system hasn't moved the head pointer in 2 seconds, I'm going to + * call it crashed. + */ + if (timeout_millis == 0) + timeout_millis = 2000; + + if (I810_DEBUG) { + fprintf(stderr, "i810WaitLpRing %d\n", n); + first = GetTimeInMillis(); + } + + while (ring->space < n) + { + int i; + + ring->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; + ring->space = ring->head - (ring->tail+8); + + if (ring->space < 0) + ring->space += ring->mem.Size; + + iters++; + now = GetTimeInMillis(); + if ( start == 0 || now < start || ring->head != last_head) { + if (I810_DEBUG) + if (now > start) + fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); + start = now; + last_head = ring->head; + } else if ( now - start > timeout_millis ) { + + i810PrintErrorState( screen->card ); + fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); + FatalError("lockup\n"); + } + + for (i = 0 ; i < 2000 ; i++) + ; + } + + if (I810_DEBUG) + { + now = GetTimeInMillis(); + if (now - first) { + fprintf(stderr,"Elapsed %d ms\n", now - first); + fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); + } + } + + return iters; +} + +void +i810Sync( KdScreenInfo *screen ) +{ + KdCardInfo *card = screen->card; + I810CardInfo *i810c = card->driver; + + if (I810_DEBUG) + fprintf(stderr, "i810Sync\n"); + + /* Send a flush instruction and then wait till the ring is empty. + * This is stronger than waiting for the blitter to finish as it also + * flushes the internal graphics caches. + */ + { + BEGIN_LP_RING(2); + OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); + OUT_RING( 0 ); /* pad to quadword */ + ADVANCE_LP_RING(); + } + + i810WaitLpRing(screen, i810c->LpRing.mem.Size - 8, 0 ); + + i810c->LpRing.space = i810c->LpRing.mem.Size - 8; + i810c->nextColorExpandBuf = 0; +} + +static const GCOps i810Ops = { + KdCheckFillSpans, + KdCheckSetSpans, + KdCheckPutImage, + KdCheckCopyArea, + KdCheckCopyPlane, + KdCheckPolyPoint, + KdCheckPolylines, + KdCheckPolySegment, + miPolyRectangle, + KdCheckPolyArc, + miFillPolygon, + i810PolyFillRect, + miPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + KdCheckImageGlyphBlt, + KdCheckPolyGlyphBlt, + KdCheckPushPixels, +#ifdef NEED_LINEHELPER + ,NULL +#endif +}; + +void +i810ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) +{ + FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); + + fbValidateGC (pGC, changes, pDrawable); + + if (pDrawable->type == DRAWABLE_WINDOW) + pGC->ops = (GCOps *) &i810Ops; + else + pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; +} + +GCFuncs i810GCFuncs = { + i810ValidateGC, + miChangeGC, + miCopyGC, + miDestroyGC, + miChangeClip, + miDestroyClip, + miCopyClip +}; + +int +i810CreateGC (GCPtr pGC) +{ + if (!fbCreateGC (pGC)) + return FALSE; + + if (pGC->depth != 1) + pGC->funcs = &i810GCFuncs; + + return TRUE; +} + +static void +i810SetRingRegs( KdScreenInfo *screen ) { + unsigned int itemp; + + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + + OUTREG(LP_RING + RING_TAIL, 0 ); + OUTREG(LP_RING + RING_HEAD, 0 ); + + itemp = INREG(LP_RING + RING_START); + itemp &= ~(START_ADDR); + itemp |= i810c->LpRing.mem.Start; + OUTREG(LP_RING + RING_START, itemp ); + + itemp = INREG(LP_RING + RING_LEN); + itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); + itemp |= ((i810c->LpRing.mem.Size-4096) | RING_NO_REPORT | RING_VALID); + OUTREG(LP_RING + RING_LEN, itemp ); +} + +Bool +i810InitAccel(ScreenPtr pScreen) +{ + +/* fprintf(stderr,"i810InitAccel\n"); */ + + /* + * Hook up asynchronous drawing + */ + KdScreenInitAsync (pScreen); + /* + * Replace various fb screen functions + */ + pScreen->CreateGC = i810CreateGC; + + return TRUE; +} + +void +i810EnableAccel(ScreenPtr pScreen) +{ + + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = screen->card; + I810CardInfo *i810c = (I810CardInfo *) card->driver; + +/* fprintf(stderr,"i810EnableAccel\n"); */ + + if (i810c->LpRing.mem.Size == 0) { + ErrorF("No memory for LpRing!! Acceleration not functional!!\n"); + } + + i810SetRingRegs( screen ); + + KdMarkSync (pScreen); +} + + +void +i810SyncAccel(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + + i810Sync(screen); +} + +void +i810DisableAccel(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + +/* fprintf(stderr,"i810DisableAccel\n"); */ + i810RefreshRing( screen ); + i810Sync( screen ); +} + +void +i810FiniAccel(ScreenPtr pScreen) +{ +/* fprintf(stderr,"i810FiniAccel\n"); */ + +} diff --git a/xc/programs/Xserver/hw/kdrive/i810/i810draw.h b/xc/programs/Xserver/hw/kdrive/i810/i810draw.h new file mode 100644 index 000000000..7c8c04489 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/i810draw.h @@ -0,0 +1,46 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + +/* Hardware accelerated drawing for KDrive i810 driver, header file. + Author: Pontus Lidman <pontus.lidman@nokia.com> +*/ + + +#ifndef _I810DRAW_H_ +#define _I810DRAW_H_ + +void i810RefreshRing(KdScreenInfo *screen); +int i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ); +void i810Sync( KdScreenInfo *screen ); + +#endif /* _I810DRAW_H_ */ diff --git a/xc/programs/Xserver/hw/kdrive/i810/i810stub.c b/xc/programs/Xserver/hw/kdrive/i810/i810stub.c new file mode 100644 index 000000000..f7097c7d8 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/i810/i810stub.c @@ -0,0 +1,80 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + +/* Stub functions for the i810 KDrive driver + Author: Pontus Lidman <pontus.lidman@nokia.com> +*/ + +#include "kdrive.h" +#include "kxv.h" +#include "i810.h" + +static const int i810Cards[]={ PCI_CHIP_I810, PCI_CHIP_I810_DC100, PCI_CHIP_I810_E }; + +#define numI810Cards (sizeof(i810Cards) / sizeof(i810Cards[0])) + +void +InitCard (char *name) +{ + KdCardAttr attr; + int i; + + Bool LinuxFindPci(CARD16, CARD16, CARD32, KdCardAttr *); + + for (i = 0; i < numI810Cards; i++) + if (LinuxFindPci (0x8086, i810Cards[i], 0, &attr)) + KdCardInfoAdd (&i810Funcs, &attr, (void *) i810Cards[i]); +} + + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdInitInput (&Ps2MouseFuncs, &LinuxKeyboardFuncs); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + int ret; + int KdProcessArgument(int, char **, int); + + ret = KdProcessArgument(argc, argv, i); + return ret; +} diff --git a/xc/programs/Xserver/hw/kdrive/igs/igsreg.h b/xc/programs/Xserver/hw/kdrive/igs/igsreg.h index 85a31d26d..0fb4cda66 100644 --- a/xc/programs/Xserver/hw/kdrive/igs/igsreg.h +++ b/xc/programs/Xserver/hw/kdrive/igs/igsreg.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/kdrive/igs/igsreg.h,v 1.1 2000/05/24 23:52:48 keithp Exp $ + * $XFree86: xc/programs/Xserver/hw/kdrive/igs/igsreg.h,v 1.2 2001/03/30 17:35:55 keithp Exp $ * * Copyright © 2000 Keith Packard * @@ -46,7 +46,94 @@ #define IGS_INPUT_STATUS_1 (IGS_MISC_OUT+1) #define IGS_NREG (IGS_INPUT_STATUS_1+1) -#include "igsregs.t" +extern VgaReg igs_h_total[]; +extern VgaReg igs_h_de_end[]; +extern VgaReg igs_h_bstart[]; +extern VgaReg igs_h_bend[]; +extern VgaReg igs_de_skew[]; +extern VgaReg igs_ena_vr_access[]; +extern VgaReg igs_h_rstart[]; +extern VgaReg igs_h_rend[]; +extern VgaReg igs_h_rdelay[]; +extern VgaReg igs_v_total[]; +extern VgaReg igs_v_rstart[]; +extern VgaReg igs_v_rend[]; +extern VgaReg igs_clear_v_int[]; +extern VgaReg igs_disable_v_int[]; +extern VgaReg igs_bandwidth[]; +extern VgaReg igs_crt_protect[]; +extern VgaReg igs_v_de_end[]; +extern VgaReg igs_offset[]; +extern VgaReg igs_v_bstart[]; +extern VgaReg igs_v_bend[]; +extern VgaReg igs_linecomp[]; +extern VgaReg igs_ivideo[]; +extern VgaReg igs_num_fetch[]; +extern VgaReg igs_wcrt0[]; +extern VgaReg igs_wcrt1[]; +extern VgaReg igs_rcrts1[]; +extern VgaReg igs_selwk[]; +extern VgaReg igs_dot_clock_8[]; +extern VgaReg igs_screen_off[]; +extern VgaReg igs_enable_write_plane[]; +extern VgaReg igs_mexhsyn[]; +extern VgaReg igs_mexvsyn[]; +extern VgaReg igs_pci_burst_write[]; +extern VgaReg igs_pci_burst_read[]; +extern VgaReg igs_iow_retry[]; +extern VgaReg igs_mw_retry[]; +extern VgaReg igs_mr_retry[]; +extern VgaReg igs_biga22en[]; +extern VgaReg igs_biga24en[]; +extern VgaReg igs_biga22force[]; +extern VgaReg igs_bigswap[]; +#define IGS_BIGSWAP_8 0x3f +#define IGS_BIGSWAP_16 0x2a +#define IGS_BIGSWAP_32 0x00 +extern VgaReg igs_sprite_x[]; +extern VgaReg igs_sprite_preset_x[]; +extern VgaReg igs_sprite_y[]; +extern VgaReg igs_sprite_preset_y[]; +extern VgaReg igs_sprite_visible[]; +extern VgaReg igs_sprite_64x64[]; +extern VgaReg igs_mgrext[]; +extern VgaReg igs_hcshf[]; +extern VgaReg igs_mbpfix[]; +extern VgaReg igs_overscan_red[]; +extern VgaReg igs_overscan_green[]; +extern VgaReg igs_overscan_blue[]; +extern VgaReg igs_memgopg[]; +extern VgaReg igs_memr2wpg[]; +extern VgaReg igs_crtff16[]; +extern VgaReg igs_fifomust[]; +extern VgaReg igs_fifogen[]; +extern VgaReg igs_mode_sel[]; +#define IGS_MODE_TEXT 0 +#define IGS_MODE_8 1 +#define IGS_MODE_565 2 +#define IGS_MODE_5551 6 +#define IGS_MODE_8888 3 +#define IGS_MODE_888 4 +#define IGS_MODE_332 9 +#define IGS_MODE_4444 10 +extern VgaReg igs_sprite_addr[]; +extern VgaReg igs_fastmpie[]; +extern VgaReg igs_vclk_m[]; +extern VgaReg igs_vclk_n[]; +extern VgaReg igs_vfsel[]; +extern VgaReg igs_vclk_p[]; +extern VgaReg igs_frqlat[]; +extern VgaReg igs_dac_mask[]; +extern VgaReg igs_dac_read_index[]; +extern VgaReg igs_dac_write_index[]; +extern VgaReg igs_dac_data[]; +extern VgaReg igs_rampwdn[]; +extern VgaReg igs_dac6_8[]; +extern VgaReg igs_ramdacbypass[]; +extern VgaReg igs_dacpwdn[]; +extern VgaReg igs_cursor_read_index[]; +extern VgaReg igs_cursor_write_index[]; +extern VgaReg igs_cursor_data[]; #define igsGet(sv,r) VgaGet(&(sv)->card, (r)) #define igsGetImm(sv,r) VgaGetImm(&(sv)->card, (r)) diff --git a/xc/programs/Xserver/hw/kdrive/kasync.c b/xc/programs/Xserver/hw/kdrive/kasync.c index e8c197989..4f016ed90 100644 --- a/xc/programs/Xserver/hw/kdrive/kasync.c +++ b/xc/programs/Xserver/hw/kdrive/kasync.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/kasync.c,v 1.7 2000/09/22 06:25:29 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kasync.c,v 1.8 2001/03/30 02:15:19 keithp Exp $ */ #include "kdrive.h" @@ -287,12 +287,12 @@ const GCOps kdAsyncPixmapGCOps = { KdCheckCopyPlane, fbPolyPoint, fbPolyLine, - miPolySegment, - miPolyRectangle, + fbPolySegment, + fbPolyRectangle, fbPolyArc, - miFillPolygon, + fbFillPolygon, fbPolyFillRect, - miPolyFillArc, + fbPolyFillArc, miPolyText8, miPolyText16, miImageText8, diff --git a/xc/programs/Xserver/hw/kdrive/kcolor.c b/xc/programs/Xserver/hw/kdrive/kcolor.c index c0f1ccafe..3d305a78e 100644 --- a/xc/programs/Xserver/hw/kdrive/kcolor.c +++ b/xc/programs/Xserver/hw/kdrive/kcolor.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/kcolor.c,v 1.3 2000/02/23 20:29:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kcolor.c,v 1.4 2001/03/30 02:15:19 keithp Exp $ */ #include "kdrive.h" #include <stdio.h> @@ -73,758 +73,758 @@ typedef struct _kdNamedColor { #define C 0x101 const KdNamedColor KdColors[] = { -240*C, 248*C, 255*C, "alice blue", -240*C, 248*C, 255*C, "AliceBlue", -250*C, 235*C, 215*C, "antique white", -250*C, 235*C, 215*C, "AntiqueWhite", -255*C, 239*C, 219*C, "AntiqueWhite1", -238*C, 223*C, 204*C, "AntiqueWhite2", -205*C, 192*C, 176*C, "AntiqueWhite3", -139*C, 131*C, 120*C, "AntiqueWhite4", -127*C, 255*C, 212*C, "aquamarine", -127*C, 255*C, 212*C, "aquamarine1", -118*C, 238*C, 198*C, "aquamarine2", -102*C, 205*C, 170*C, "aquamarine3", - 69*C, 139*C, 116*C, "aquamarine4", -240*C, 255*C, 255*C, "azure", -240*C, 255*C, 255*C, "azure1", -224*C, 238*C, 238*C, "azure2", -193*C, 205*C, 205*C, "azure3", -131*C, 139*C, 139*C, "azure4", -245*C, 245*C, 220*C, "beige", -255*C, 228*C, 196*C, "bisque", -255*C, 228*C, 196*C, "bisque1", -238*C, 213*C, 183*C, "bisque2", -205*C, 183*C, 158*C, "bisque3", -139*C, 125*C, 107*C, "bisque4", - 0*C, 0*C, 0*C, "black", -255*C, 235*C, 205*C, "blanched almond", -255*C, 235*C, 205*C, "BlanchedAlmond", - 0*C, 0*C, 255*C, "blue", -138*C, 43*C, 226*C, "blue violet", - 0*C, 0*C, 255*C, "blue1", - 0*C, 0*C, 238*C, "blue2", - 0*C, 0*C, 205*C, "blue3", - 0*C, 0*C, 139*C, "blue4", -138*C, 43*C, 226*C, "BlueViolet", -165*C, 42*C, 42*C, "brown", -255*C, 64*C, 64*C, "brown1", -238*C, 59*C, 59*C, "brown2", -205*C, 51*C, 51*C, "brown3", -139*C, 35*C, 35*C, "brown4", -222*C, 184*C, 135*C, "burlywood", -255*C, 211*C, 155*C, "burlywood1", -238*C, 197*C, 145*C, "burlywood2", -205*C, 170*C, 125*C, "burlywood3", -139*C, 115*C, 85*C, "burlywood4", - 95*C, 158*C, 160*C, "cadet blue", - 95*C, 158*C, 160*C, "CadetBlue", -152*C, 245*C, 255*C, "CadetBlue1", -142*C, 229*C, 238*C, "CadetBlue2", -122*C, 197*C, 205*C, "CadetBlue3", - 83*C, 134*C, 139*C, "CadetBlue4", -127*C, 255*C, 0*C, "chartreuse", -127*C, 255*C, 0*C, "chartreuse1", -118*C, 238*C, 0*C, "chartreuse2", -102*C, 205*C, 0*C, "chartreuse3", -69*C, 139*C, 0*C, "chartreuse4", -210*C, 105*C, 30*C, "chocolate", -255*C, 127*C, 36*C, "chocolate1", -238*C, 118*C, 33*C, "chocolate2", -205*C, 102*C, 29*C, "chocolate3", -139*C, 69*C, 19*C, "chocolate4", -255*C, 127*C, 80*C, "coral", -255*C, 114*C, 86*C, "coral1", -238*C, 106*C, 80*C, "coral2", -205*C, 91*C, 69*C, "coral3", -139*C, 62*C, 47*C, "coral4", -100*C, 149*C, 237*C, "cornflower blue", -100*C, 149*C, 237*C, "CornflowerBlue", -255*C, 248*C, 220*C, "cornsilk", -255*C, 248*C, 220*C, "cornsilk1", -238*C, 232*C, 205*C, "cornsilk2", -205*C, 200*C, 177*C, "cornsilk3", -139*C, 136*C, 120*C, "cornsilk4", - 0*C, 255*C, 255*C, "cyan", - 0*C, 255*C, 255*C, "cyan1", - 0*C, 238*C, 238*C, "cyan2", - 0*C, 205*C, 205*C, "cyan3", - 0*C, 139*C, 139*C, "cyan4", -0*C, 0*C, 139*C, "dark blue", -0*C, 139*C, 139*C, "dark cyan", -184*C, 134*C, 11*C, "dark goldenrod", -169*C, 169*C, 169*C, "dark gray", - 0*C, 100*C, 0*C, "dark green", -169*C, 169*C, 169*C, "dark grey", -189*C, 183*C, 107*C, "dark khaki", -139*C, 0*C, 139*C, "dark magenta", - 85*C, 107*C, 47*C, "dark olive green", -255*C, 140*C, 0*C, "dark orange", -153*C, 50*C, 204*C, "dark orchid", -139*C, 0*C, 0*C, "dark red", -233*C, 150*C, 122*C, "dark salmon", -143*C, 188*C, 143*C, "dark sea green", - 72*C, 61*C, 139*C, "dark slate blue", - 47*C, 79*C, 79*C, "dark slate gray", - 47*C, 79*C, 79*C, "dark slate grey", - 0*C, 206*C, 209*C, "dark turquoise", -148*C, 0*C, 211*C, "dark violet", -0*C, 0*C, 139*C, "DarkBlue", -0*C, 139*C, 139*C, "DarkCyan", -184*C, 134*C, 11*C, "DarkGoldenrod", -255*C, 185*C, 15*C, "DarkGoldenrod1", -238*C, 173*C, 14*C, "DarkGoldenrod2", -205*C, 149*C, 12*C, "DarkGoldenrod3", -139*C, 101*C, 8*C, "DarkGoldenrod4", -169*C, 169*C, 169*C, "DarkGray", - 0*C, 100*C, 0*C, "DarkGreen", -169*C, 169*C, 169*C, "DarkGrey", -189*C, 183*C, 107*C, "DarkKhaki", -139*C, 0*C, 139*C, "DarkMagenta", - 85*C, 107*C, 47*C, "DarkOliveGreen", -202*C, 255*C, 112*C, "DarkOliveGreen1", -188*C, 238*C, 104*C, "DarkOliveGreen2", -162*C, 205*C, 90*C, "DarkOliveGreen3", -110*C, 139*C, 61*C, "DarkOliveGreen4", -255*C, 140*C, 0*C, "DarkOrange", -255*C, 127*C, 0*C, "DarkOrange1", -238*C, 118*C, 0*C, "DarkOrange2", -205*C, 102*C, 0*C, "DarkOrange3", -139*C, 69*C, 0*C, "DarkOrange4", -153*C, 50*C, 204*C, "DarkOrchid", -191*C, 62*C, 255*C, "DarkOrchid1", -178*C, 58*C, 238*C, "DarkOrchid2", -154*C, 50*C, 205*C, "DarkOrchid3", -104*C, 34*C, 139*C, "DarkOrchid4", -139*C, 0*C, 0*C, "DarkRed", -233*C, 150*C, 122*C, "DarkSalmon", -143*C, 188*C, 143*C, "DarkSeaGreen", -193*C, 255*C, 193*C, "DarkSeaGreen1", -180*C, 238*C, 180*C, "DarkSeaGreen2", -155*C, 205*C, 155*C, "DarkSeaGreen3", -105*C, 139*C, 105*C, "DarkSeaGreen4", - 72*C, 61*C, 139*C, "DarkSlateBlue", - 47*C, 79*C, 79*C, "DarkSlateGray", -151*C, 255*C, 255*C, "DarkSlateGray1", -141*C, 238*C, 238*C, "DarkSlateGray2", -121*C, 205*C, 205*C, "DarkSlateGray3", - 82*C, 139*C, 139*C, "DarkSlateGray4", - 47*C, 79*C, 79*C, "DarkSlateGrey", - 0*C, 206*C, 209*C, "DarkTurquoise", -148*C, 0*C, 211*C, "DarkViolet", -255*C, 20*C, 147*C, "deep pink", - 0*C, 191*C, 255*C, "deep sky blue", -255*C, 20*C, 147*C, "DeepPink", -255*C, 20*C, 147*C, "DeepPink1", -238*C, 18*C, 137*C, "DeepPink2", -205*C, 16*C, 118*C, "DeepPink3", -139*C, 10*C, 80*C, "DeepPink4", - 0*C, 191*C, 255*C, "DeepSkyBlue", - 0*C, 191*C, 255*C, "DeepSkyBlue1", - 0*C, 178*C, 238*C, "DeepSkyBlue2", - 0*C, 154*C, 205*C, "DeepSkyBlue3", - 0*C, 104*C, 139*C, "DeepSkyBlue4", -105*C, 105*C, 105*C, "dim gray", -105*C, 105*C, 105*C, "dim grey", -105*C, 105*C, 105*C, "DimGray", -105*C, 105*C, 105*C, "DimGrey", - 30*C, 144*C, 255*C, "dodger blue", - 30*C, 144*C, 255*C, "DodgerBlue", - 30*C, 144*C, 255*C, "DodgerBlue1", - 28*C, 134*C, 238*C, "DodgerBlue2", - 24*C, 116*C, 205*C, "DodgerBlue3", - 16*C, 78*C, 139*C, "DodgerBlue4", -178*C, 34*C, 34*C, "firebrick", -255*C, 48*C, 48*C, "firebrick1", -238*C, 44*C, 44*C, "firebrick2", -205*C, 38*C, 38*C, "firebrick3", -139*C, 26*C, 26*C, "firebrick4", -255*C, 250*C, 240*C, "floral white", -255*C, 250*C, 240*C, "FloralWhite", - 34*C, 139*C, 34*C, "forest green", - 34*C, 139*C, 34*C, "ForestGreen", -220*C, 220*C, 220*C, "gainsboro", -248*C, 248*C, 255*C, "ghost white", -248*C, 248*C, 255*C, "GhostWhite", -255*C, 215*C, 0*C, "gold", -255*C, 215*C, 0*C, "gold1", -238*C, 201*C, 0*C, "gold2", -205*C, 173*C, 0*C, "gold3", -139*C, 117*C, 0*C, "gold4", -218*C, 165*C, 32*C, "goldenrod", -255*C, 193*C, 37*C, "goldenrod1", -238*C, 180*C, 34*C, "goldenrod2", -205*C, 155*C, 29*C, "goldenrod3", -139*C, 105*C, 20*C, "goldenrod4", -190*C, 190*C, 190*C, "gray", - 0*C, 0*C, 0*C, "gray0", - 3*C, 3*C, 3*C, "gray1", - 26*C, 26*C, 26*C, "gray10", -255*C, 255*C, 255*C, "gray100", - 28*C, 28*C, 28*C, "gray11", - 31*C, 31*C, 31*C, "gray12", - 33*C, 33*C, 33*C, "gray13", - 36*C, 36*C, 36*C, "gray14", - 38*C, 38*C, 38*C, "gray15", - 41*C, 41*C, 41*C, "gray16", - 43*C, 43*C, 43*C, "gray17", - 46*C, 46*C, 46*C, "gray18", - 48*C, 48*C, 48*C, "gray19", - 5*C, 5*C, 5*C, "gray2", - 51*C, 51*C, 51*C, "gray20", - 54*C, 54*C, 54*C, "gray21", - 56*C, 56*C, 56*C, "gray22", - 59*C, 59*C, 59*C, "gray23", - 61*C, 61*C, 61*C, "gray24", - 64*C, 64*C, 64*C, "gray25", - 66*C, 66*C, 66*C, "gray26", - 69*C, 69*C, 69*C, "gray27", - 71*C, 71*C, 71*C, "gray28", - 74*C, 74*C, 74*C, "gray29", - 8*C, 8*C, 8*C, "gray3", - 77*C, 77*C, 77*C, "gray30", - 79*C, 79*C, 79*C, "gray31", - 82*C, 82*C, 82*C, "gray32", - 84*C, 84*C, 84*C, "gray33", - 87*C, 87*C, 87*C, "gray34", - 89*C, 89*C, 89*C, "gray35", - 92*C, 92*C, 92*C, "gray36", - 94*C, 94*C, 94*C, "gray37", - 97*C, 97*C, 97*C, "gray38", - 99*C, 99*C, 99*C, "gray39", - 10*C, 10*C, 10*C, "gray4", -102*C, 102*C, 102*C, "gray40", -105*C, 105*C, 105*C, "gray41", -107*C, 107*C, 107*C, "gray42", -110*C, 110*C, 110*C, "gray43", -112*C, 112*C, 112*C, "gray44", -115*C, 115*C, 115*C, "gray45", -117*C, 117*C, 117*C, "gray46", -120*C, 120*C, 120*C, "gray47", -122*C, 122*C, 122*C, "gray48", -125*C, 125*C, 125*C, "gray49", - 13*C, 13*C, 13*C, "gray5", -127*C, 127*C, 127*C, "gray50", -130*C, 130*C, 130*C, "gray51", -133*C, 133*C, 133*C, "gray52", -135*C, 135*C, 135*C, "gray53", -138*C, 138*C, 138*C, "gray54", -140*C, 140*C, 140*C, "gray55", -143*C, 143*C, 143*C, "gray56", -145*C, 145*C, 145*C, "gray57", -148*C, 148*C, 148*C, "gray58", -150*C, 150*C, 150*C, "gray59", - 15*C, 15*C, 15*C, "gray6", -153*C, 153*C, 153*C, "gray60", -156*C, 156*C, 156*C, "gray61", -158*C, 158*C, 158*C, "gray62", -161*C, 161*C, 161*C, "gray63", -163*C, 163*C, 163*C, "gray64", -166*C, 166*C, 166*C, "gray65", -168*C, 168*C, 168*C, "gray66", -171*C, 171*C, 171*C, "gray67", -173*C, 173*C, 173*C, "gray68", -176*C, 176*C, 176*C, "gray69", - 18*C, 18*C, 18*C, "gray7", -179*C, 179*C, 179*C, "gray70", -181*C, 181*C, 181*C, "gray71", -184*C, 184*C, 184*C, "gray72", -186*C, 186*C, 186*C, "gray73", -189*C, 189*C, 189*C, "gray74", -191*C, 191*C, 191*C, "gray75", -194*C, 194*C, 194*C, "gray76", -196*C, 196*C, 196*C, "gray77", -199*C, 199*C, 199*C, "gray78", -201*C, 201*C, 201*C, "gray79", - 20*C, 20*C, 20*C, "gray8", -204*C, 204*C, 204*C, "gray80", -207*C, 207*C, 207*C, "gray81", -209*C, 209*C, 209*C, "gray82", -212*C, 212*C, 212*C, "gray83", -214*C, 214*C, 214*C, "gray84", -217*C, 217*C, 217*C, "gray85", -219*C, 219*C, 219*C, "gray86", -222*C, 222*C, 222*C, "gray87", -224*C, 224*C, 224*C, "gray88", -227*C, 227*C, 227*C, "gray89", - 23*C, 23*C, 23*C, "gray9", -229*C, 229*C, 229*C, "gray90", -232*C, 232*C, 232*C, "gray91", -235*C, 235*C, 235*C, "gray92", -237*C, 237*C, 237*C, "gray93", -240*C, 240*C, 240*C, "gray94", -242*C, 242*C, 242*C, "gray95", -245*C, 245*C, 245*C, "gray96", -247*C, 247*C, 247*C, "gray97", -250*C, 250*C, 250*C, "gray98", -252*C, 252*C, 252*C, "gray99", - 0*C, 255*C, 0*C, "green", -173*C, 255*C, 47*C, "green yellow", -0*C, 255*C, 0*C, "green1", -0*C, 238*C, 0*C, "green2", -0*C, 205*C, 0*C, "green3", -0*C, 139*C, 0*C, "green4", -173*C, 255*C, 47*C, "GreenYellow", -190*C, 190*C, 190*C, "grey", - 0*C, 0*C, 0*C, "grey0", - 3*C, 3*C, 3*C, "grey1", - 26*C, 26*C, 26*C, "grey10", -255*C, 255*C, 255*C, "grey100", - 28*C, 28*C, 28*C, "grey11", - 31*C, 31*C, 31*C, "grey12", - 33*C, 33*C, 33*C, "grey13", - 36*C, 36*C, 36*C, "grey14", - 38*C, 38*C, 38*C, "grey15", - 41*C, 41*C, 41*C, "grey16", - 43*C, 43*C, 43*C, "grey17", - 46*C, 46*C, 46*C, "grey18", - 48*C, 48*C, 48*C, "grey19", - 5*C, 5*C, 5*C, "grey2", - 51*C, 51*C, 51*C, "grey20", - 54*C, 54*C, 54*C, "grey21", - 56*C, 56*C, 56*C, "grey22", - 59*C, 59*C, 59*C, "grey23", - 61*C, 61*C, 61*C, "grey24", - 64*C, 64*C, 64*C, "grey25", - 66*C, 66*C, 66*C, "grey26", - 69*C, 69*C, 69*C, "grey27", - 71*C, 71*C, 71*C, "grey28", - 74*C, 74*C, 74*C, "grey29", - 8*C, 8*C, 8*C, "grey3", - 77*C, 77*C, 77*C, "grey30", - 79*C, 79*C, 79*C, "grey31", - 82*C, 82*C, 82*C, "grey32", - 84*C, 84*C, 84*C, "grey33", - 87*C, 87*C, 87*C, "grey34", - 89*C, 89*C, 89*C, "grey35", - 92*C, 92*C, 92*C, "grey36", - 94*C, 94*C, 94*C, "grey37", - 97*C, 97*C, 97*C, "grey38", - 99*C, 99*C, 99*C, "grey39", - 10*C, 10*C, 10*C, "grey4", -102*C, 102*C, 102*C, "grey40", -105*C, 105*C, 105*C, "grey41", -107*C, 107*C, 107*C, "grey42", -110*C, 110*C, 110*C, "grey43", -112*C, 112*C, 112*C, "grey44", -115*C, 115*C, 115*C, "grey45", -117*C, 117*C, 117*C, "grey46", -120*C, 120*C, 120*C, "grey47", -122*C, 122*C, 122*C, "grey48", -125*C, 125*C, 125*C, "grey49", - 13*C, 13*C, 13*C, "grey5", -127*C, 127*C, 127*C, "grey50", -130*C, 130*C, 130*C, "grey51", -133*C, 133*C, 133*C, "grey52", -135*C, 135*C, 135*C, "grey53", -138*C, 138*C, 138*C, "grey54", -140*C, 140*C, 140*C, "grey55", -143*C, 143*C, 143*C, "grey56", -145*C, 145*C, 145*C, "grey57", -148*C, 148*C, 148*C, "grey58", -150*C, 150*C, 150*C, "grey59", - 15*C, 15*C, 15*C, "grey6", -153*C, 153*C, 153*C, "grey60", -156*C, 156*C, 156*C, "grey61", -158*C, 158*C, 158*C, "grey62", -161*C, 161*C, 161*C, "grey63", -163*C, 163*C, 163*C, "grey64", -166*C, 166*C, 166*C, "grey65", -168*C, 168*C, 168*C, "grey66", -171*C, 171*C, 171*C, "grey67", -173*C, 173*C, 173*C, "grey68", -176*C, 176*C, 176*C, "grey69", - 18*C, 18*C, 18*C, "grey7", -179*C, 179*C, 179*C, "grey70", -181*C, 181*C, 181*C, "grey71", -184*C, 184*C, 184*C, "grey72", -186*C, 186*C, 186*C, "grey73", -189*C, 189*C, 189*C, "grey74", -191*C, 191*C, 191*C, "grey75", -194*C, 194*C, 194*C, "grey76", -196*C, 196*C, 196*C, "grey77", -199*C, 199*C, 199*C, "grey78", -201*C, 201*C, 201*C, "grey79", - 20*C, 20*C, 20*C, "grey8", -204*C, 204*C, 204*C, "grey80", -207*C, 207*C, 207*C, "grey81", -209*C, 209*C, 209*C, "grey82", -212*C, 212*C, 212*C, "grey83", -214*C, 214*C, 214*C, "grey84", -217*C, 217*C, 217*C, "grey85", -219*C, 219*C, 219*C, "grey86", -222*C, 222*C, 222*C, "grey87", -224*C, 224*C, 224*C, "grey88", -227*C, 227*C, 227*C, "grey89", - 23*C, 23*C, 23*C, "grey9", -229*C, 229*C, 229*C, "grey90", -232*C, 232*C, 232*C, "grey91", -235*C, 235*C, 235*C, "grey92", -237*C, 237*C, 237*C, "grey93", -240*C, 240*C, 240*C, "grey94", -242*C, 242*C, 242*C, "grey95", -245*C, 245*C, 245*C, "grey96", -247*C, 247*C, 247*C, "grey97", -250*C, 250*C, 250*C, "grey98", -252*C, 252*C, 252*C, "grey99", -240*C, 255*C, 240*C, "honeydew", -240*C, 255*C, 240*C, "honeydew1", -224*C, 238*C, 224*C, "honeydew2", -193*C, 205*C, 193*C, "honeydew3", -131*C, 139*C, 131*C, "honeydew4", -255*C, 105*C, 180*C, "hot pink", -255*C, 105*C, 180*C, "HotPink", -255*C, 110*C, 180*C, "HotPink1", -238*C, 106*C, 167*C, "HotPink2", -205*C, 96*C, 144*C, "HotPink3", -139*C, 58*C, 98*C, "HotPink4", -205*C, 92*C, 92*C, "indian red", -205*C, 92*C, 92*C, "IndianRed", -255*C, 106*C, 106*C, "IndianRed1", -238*C, 99*C, 99*C, "IndianRed2", -205*C, 85*C, 85*C, "IndianRed3", -139*C, 58*C, 58*C, "IndianRed4", -255*C, 255*C, 240*C, "ivory", -255*C, 255*C, 240*C, "ivory1", -238*C, 238*C, 224*C, "ivory2", -205*C, 205*C, 193*C, "ivory3", -139*C, 139*C, 131*C, "ivory4", -240*C, 230*C, 140*C, "khaki", -255*C, 246*C, 143*C, "khaki1", -238*C, 230*C, 133*C, "khaki2", -205*C, 198*C, 115*C, "khaki3", -139*C, 134*C, 78*C, "khaki4", -230*C, 230*C, 250*C, "lavender", -255*C, 240*C, 245*C, "lavender blush", -255*C, 240*C, 245*C, "LavenderBlush", -255*C, 240*C, 245*C, "LavenderBlush1", -238*C, 224*C, 229*C, "LavenderBlush2", -205*C, 193*C, 197*C, "LavenderBlush3", -139*C, 131*C, 134*C, "LavenderBlush4", -124*C, 252*C, 0*C, "lawn green", -124*C, 252*C, 0*C, "LawnGreen", -255*C, 250*C, 205*C, "lemon chiffon", -255*C, 250*C, 205*C, "LemonChiffon", -255*C, 250*C, 205*C, "LemonChiffon1", -238*C, 233*C, 191*C, "LemonChiffon2", -205*C, 201*C, 165*C, "LemonChiffon3", -139*C, 137*C, 112*C, "LemonChiffon4", -173*C, 216*C, 230*C, "light blue", -240*C, 128*C, 128*C, "light coral", -224*C, 255*C, 255*C, "light cyan", -238*C, 221*C, 130*C, "light goldenrod", -250*C, 250*C, 210*C, "light goldenrod yellow", -211*C, 211*C, 211*C, "light gray", -144*C, 238*C, 144*C, "light green", -211*C, 211*C, 211*C, "light grey", -255*C, 182*C, 193*C, "light pink", -255*C, 160*C, 122*C, "light salmon", - 32*C, 178*C, 170*C, "light sea green", -135*C, 206*C, 250*C, "light sky blue", -132*C, 112*C, 255*C, "light slate blue", -119*C, 136*C, 153*C, "light slate gray", -119*C, 136*C, 153*C, "light slate grey", -176*C, 196*C, 222*C, "light steel blue", -255*C, 255*C, 224*C, "light yellow", -173*C, 216*C, 230*C, "LightBlue", -191*C, 239*C, 255*C, "LightBlue1", -178*C, 223*C, 238*C, "LightBlue2", -154*C, 192*C, 205*C, "LightBlue3", -104*C, 131*C, 139*C, "LightBlue4", -240*C, 128*C, 128*C, "LightCoral", -224*C, 255*C, 255*C, "LightCyan", -224*C, 255*C, 255*C, "LightCyan1", -209*C, 238*C, 238*C, "LightCyan2", -180*C, 205*C, 205*C, "LightCyan3", -122*C, 139*C, 139*C, "LightCyan4", -238*C, 221*C, 130*C, "LightGoldenrod", -255*C, 236*C, 139*C, "LightGoldenrod1", -238*C, 220*C, 130*C, "LightGoldenrod2", -205*C, 190*C, 112*C, "LightGoldenrod3", -139*C, 129*C, 76*C, "LightGoldenrod4", -250*C, 250*C, 210*C, "LightGoldenrodYellow", -211*C, 211*C, 211*C, "LightGray", -144*C, 238*C, 144*C, "LightGreen", -211*C, 211*C, 211*C, "LightGrey", -255*C, 182*C, 193*C, "LightPink", -255*C, 174*C, 185*C, "LightPink1", -238*C, 162*C, 173*C, "LightPink2", -205*C, 140*C, 149*C, "LightPink3", -139*C, 95*C, 101*C, "LightPink4", -255*C, 160*C, 122*C, "LightSalmon", -255*C, 160*C, 122*C, "LightSalmon1", -238*C, 149*C, 114*C, "LightSalmon2", -205*C, 129*C, 98*C, "LightSalmon3", -139*C, 87*C, 66*C, "LightSalmon4", - 32*C, 178*C, 170*C, "LightSeaGreen", -135*C, 206*C, 250*C, "LightSkyBlue", -176*C, 226*C, 255*C, "LightSkyBlue1", -164*C, 211*C, 238*C, "LightSkyBlue2", -141*C, 182*C, 205*C, "LightSkyBlue3", - 96*C, 123*C, 139*C, "LightSkyBlue4", -132*C, 112*C, 255*C, "LightSlateBlue", -119*C, 136*C, 153*C, "LightSlateGray", -119*C, 136*C, 153*C, "LightSlateGrey", -176*C, 196*C, 222*C, "LightSteelBlue", -202*C, 225*C, 255*C, "LightSteelBlue1", -188*C, 210*C, 238*C, "LightSteelBlue2", -162*C, 181*C, 205*C, "LightSteelBlue3", -110*C, 123*C, 139*C, "LightSteelBlue4", -255*C, 255*C, 224*C, "LightYellow", -255*C, 255*C, 224*C, "LightYellow1", -238*C, 238*C, 209*C, "LightYellow2", -205*C, 205*C, 180*C, "LightYellow3", -139*C, 139*C, 122*C, "LightYellow4", - 50*C, 205*C, 50*C, "lime green", - 50*C, 205*C, 50*C, "LimeGreen", -250*C, 240*C, 230*C, "linen", -255*C, 0*C, 255*C, "magenta", -255*C, 0*C, 255*C, "magenta1", -238*C, 0*C, 238*C, "magenta2", -205*C, 0*C, 205*C, "magenta3", -139*C, 0*C, 139*C, "magenta4", -176*C, 48*C, 96*C, "maroon", -255*C, 52*C, 179*C, "maroon1", -238*C, 48*C, 167*C, "maroon2", -205*C, 41*C, 144*C, "maroon3", -139*C, 28*C, 98*C, "maroon4", -102*C, 205*C, 170*C, "medium aquamarine", - 0*C, 0*C, 205*C, "medium blue", -186*C, 85*C, 211*C, "medium orchid", -147*C, 112*C, 219*C, "medium purple", - 60*C, 179*C, 113*C, "medium sea green", -123*C, 104*C, 238*C, "medium slate blue", - 0*C, 250*C, 154*C, "medium spring green", - 72*C, 209*C, 204*C, "medium turquoise", -199*C, 21*C, 133*C, "medium violet red", -102*C, 205*C, 170*C, "MediumAquamarine", - 0*C, 0*C, 205*C, "MediumBlue", -186*C, 85*C, 211*C, "MediumOrchid", -224*C, 102*C, 255*C, "MediumOrchid1", -209*C, 95*C, 238*C, "MediumOrchid2", -180*C, 82*C, 205*C, "MediumOrchid3", -122*C, 55*C, 139*C, "MediumOrchid4", -147*C, 112*C, 219*C, "MediumPurple", -171*C, 130*C, 255*C, "MediumPurple1", -159*C, 121*C, 238*C, "MediumPurple2", -137*C, 104*C, 205*C, "MediumPurple3", - 93*C, 71*C, 139*C, "MediumPurple4", - 60*C, 179*C, 113*C, "MediumSeaGreen", -123*C, 104*C, 238*C, "MediumSlateBlue", - 0*C, 250*C, 154*C, "MediumSpringGreen", - 72*C, 209*C, 204*C, "MediumTurquoise", -199*C, 21*C, 133*C, "MediumVioletRed", - 25*C, 25*C, 112*C, "midnight blue", - 25*C, 25*C, 112*C, "MidnightBlue", -245*C, 255*C, 250*C, "mint cream", -245*C, 255*C, 250*C, "MintCream", -255*C, 228*C, 225*C, "misty rose", -255*C, 228*C, 225*C, "MistyRose", -255*C, 228*C, 225*C, "MistyRose1", -238*C, 213*C, 210*C, "MistyRose2", -205*C, 183*C, 181*C, "MistyRose3", -139*C, 125*C, 123*C, "MistyRose4", -255*C, 228*C, 181*C, "moccasin", -255*C, 222*C, 173*C, "navajo white", -255*C, 222*C, 173*C, "NavajoWhite", -255*C, 222*C, 173*C, "NavajoWhite1", -238*C, 207*C, 161*C, "NavajoWhite2", -205*C, 179*C, 139*C, "NavajoWhite3", -139*C, 121*C, 94*C, "NavajoWhite4", - 0*C, 0*C, 128*C, "navy", - 0*C, 0*C, 128*C, "navy blue", - 0*C, 0*C, 128*C, "NavyBlue", -253*C, 245*C, 230*C, "old lace", -253*C, 245*C, 230*C, "OldLace", -107*C, 142*C, 35*C, "olive drab", -107*C, 142*C, 35*C, "OliveDrab", -192*C, 255*C, 62*C, "OliveDrab1", -179*C, 238*C, 58*C, "OliveDrab2", -154*C, 205*C, 50*C, "OliveDrab3", -105*C, 139*C, 34*C, "OliveDrab4", -255*C, 165*C, 0*C, "orange", -255*C, 69*C, 0*C, "orange red", -255*C, 165*C, 0*C, "orange1", -238*C, 154*C, 0*C, "orange2", -205*C, 133*C, 0*C, "orange3", -139*C, 90*C, 0*C, "orange4", -255*C, 69*C, 0*C, "OrangeRed", -255*C, 69*C, 0*C, "OrangeRed1", -238*C, 64*C, 0*C, "OrangeRed2", -205*C, 55*C, 0*C, "OrangeRed3", -139*C, 37*C, 0*C, "OrangeRed4", -218*C, 112*C, 214*C, "orchid", -255*C, 131*C, 250*C, "orchid1", -238*C, 122*C, 233*C, "orchid2", -205*C, 105*C, 201*C, "orchid3", -139*C, 71*C, 137*C, "orchid4", -238*C, 232*C, 170*C, "pale goldenrod", -152*C, 251*C, 152*C, "pale green", -175*C, 238*C, 238*C, "pale turquoise", -219*C, 112*C, 147*C, "pale violet red", -238*C, 232*C, 170*C, "PaleGoldenrod", -152*C, 251*C, 152*C, "PaleGreen", -154*C, 255*C, 154*C, "PaleGreen1", -144*C, 238*C, 144*C, "PaleGreen2", -124*C, 205*C, 124*C, "PaleGreen3", -84*C, 139*C, 84*C, "PaleGreen4", -175*C, 238*C, 238*C, "PaleTurquoise", -187*C, 255*C, 255*C, "PaleTurquoise1", -174*C, 238*C, 238*C, "PaleTurquoise2", -150*C, 205*C, 205*C, "PaleTurquoise3", -102*C, 139*C, 139*C, "PaleTurquoise4", -219*C, 112*C, 147*C, "PaleVioletRed", -255*C, 130*C, 171*C, "PaleVioletRed1", -238*C, 121*C, 159*C, "PaleVioletRed2", -205*C, 104*C, 137*C, "PaleVioletRed3", -139*C, 71*C, 93*C, "PaleVioletRed4", -255*C, 239*C, 213*C, "papaya whip", -255*C, 239*C, 213*C, "PapayaWhip", -255*C, 218*C, 185*C, "peach puff", -255*C, 218*C, 185*C, "PeachPuff", -255*C, 218*C, 185*C, "PeachPuff1", -238*C, 203*C, 173*C, "PeachPuff2", -205*C, 175*C, 149*C, "PeachPuff3", -139*C, 119*C, 101*C, "PeachPuff4", -205*C, 133*C, 63*C, "peru", -255*C, 192*C, 203*C, "pink", -255*C, 181*C, 197*C, "pink1", -238*C, 169*C, 184*C, "pink2", -205*C, 145*C, 158*C, "pink3", -139*C, 99*C, 108*C, "pink4", -221*C, 160*C, 221*C, "plum", -255*C, 187*C, 255*C, "plum1", -238*C, 174*C, 238*C, "plum2", -205*C, 150*C, 205*C, "plum3", -139*C, 102*C, 139*C, "plum4", -176*C, 224*C, 230*C, "powder blue", -176*C, 224*C, 230*C, "PowderBlue", -160*C, 32*C, 240*C, "purple", -155*C, 48*C, 255*C, "purple1", -145*C, 44*C, 238*C, "purple2", -125*C, 38*C, 205*C, "purple3", - 85*C, 26*C, 139*C, "purple4", -255*C, 0*C, 0*C, "red", -255*C, 0*C, 0*C, "red1", -238*C, 0*C, 0*C, "red2", -205*C, 0*C, 0*C, "red3", -139*C, 0*C, 0*C, "red4", -188*C, 143*C, 143*C, "rosy brown", -188*C, 143*C, 143*C, "RosyBrown", -255*C, 193*C, 193*C, "RosyBrown1", -238*C, 180*C, 180*C, "RosyBrown2", -205*C, 155*C, 155*C, "RosyBrown3", -139*C, 105*C, 105*C, "RosyBrown4", - 65*C, 105*C, 225*C, "royal blue", - 65*C, 105*C, 225*C, "RoyalBlue", - 72*C, 118*C, 255*C, "RoyalBlue1", - 67*C, 110*C, 238*C, "RoyalBlue2", - 58*C, 95*C, 205*C, "RoyalBlue3", - 39*C, 64*C, 139*C, "RoyalBlue4", -139*C, 69*C, 19*C, "saddle brown", -139*C, 69*C, 19*C, "SaddleBrown", -250*C, 128*C, 114*C, "salmon", -255*C, 140*C, 105*C, "salmon1", -238*C, 130*C, 98*C, "salmon2", -205*C, 112*C, 84*C, "salmon3", -139*C, 76*C, 57*C, "salmon4", -244*C, 164*C, 96*C, "sandy brown", -244*C, 164*C, 96*C, "SandyBrown", - 46*C, 139*C, 87*C, "sea green", - 46*C, 139*C, 87*C, "SeaGreen", - 84*C, 255*C, 159*C, "SeaGreen1", - 78*C, 238*C, 148*C, "SeaGreen2", - 67*C, 205*C, 128*C, "SeaGreen3", -46*C, 139*C, 87*C, "SeaGreen4", -255*C, 245*C, 238*C, "seashell", -255*C, 245*C, 238*C, "seashell1", -238*C, 229*C, 222*C, "seashell2", -205*C, 197*C, 191*C, "seashell3", -139*C, 134*C, 130*C, "seashell4", -160*C, 82*C, 45*C, "sienna", -255*C, 130*C, 71*C, "sienna1", -238*C, 121*C, 66*C, "sienna2", -205*C, 104*C, 57*C, "sienna3", -139*C, 71*C, 38*C, "sienna4", -135*C, 206*C, 235*C, "sky blue", -135*C, 206*C, 235*C, "SkyBlue", -135*C, 206*C, 255*C, "SkyBlue1", -126*C, 192*C, 238*C, "SkyBlue2", -108*C, 166*C, 205*C, "SkyBlue3", - 74*C, 112*C, 139*C, "SkyBlue4", -106*C, 90*C, 205*C, "slate blue", -112*C, 128*C, 144*C, "slate gray", -112*C, 128*C, 144*C, "slate grey", -106*C, 90*C, 205*C, "SlateBlue", -131*C, 111*C, 255*C, "SlateBlue1", -122*C, 103*C, 238*C, "SlateBlue2", -105*C, 89*C, 205*C, "SlateBlue3", - 71*C, 60*C, 139*C, "SlateBlue4", -112*C, 128*C, 144*C, "SlateGray", -198*C, 226*C, 255*C, "SlateGray1", -185*C, 211*C, 238*C, "SlateGray2", -159*C, 182*C, 205*C, "SlateGray3", -108*C, 123*C, 139*C, "SlateGray4", -112*C, 128*C, 144*C, "SlateGrey", -255*C, 250*C, 250*C, "snow", -255*C, 250*C, 250*C, "snow1", -238*C, 233*C, 233*C, "snow2", -205*C, 201*C, 201*C, "snow3", -139*C, 137*C, 137*C, "snow4", - 0*C, 255*C, 127*C, "spring green", - 0*C, 255*C, 127*C, "SpringGreen", - 0*C, 255*C, 127*C, "SpringGreen1", - 0*C, 238*C, 118*C, "SpringGreen2", - 0*C, 205*C, 102*C, "SpringGreen3", -0*C, 139*C, 69*C, "SpringGreen4", - 70*C, 130*C, 180*C, "steel blue", - 70*C, 130*C, 180*C, "SteelBlue", - 99*C, 184*C, 255*C, "SteelBlue1", - 92*C, 172*C, 238*C, "SteelBlue2", - 79*C, 148*C, 205*C, "SteelBlue3", - 54*C, 100*C, 139*C, "SteelBlue4", -210*C, 180*C, 140*C, "tan", -255*C, 165*C, 79*C, "tan1", -238*C, 154*C, 73*C, "tan2", -205*C, 133*C, 63*C, "tan3", -139*C, 90*C, 43*C, "tan4", -216*C, 191*C, 216*C, "thistle", -255*C, 225*C, 255*C, "thistle1", -238*C, 210*C, 238*C, "thistle2", -205*C, 181*C, 205*C, "thistle3", -139*C, 123*C, 139*C, "thistle4", -255*C, 99*C, 71*C, "tomato", -255*C, 99*C, 71*C, "tomato1", -238*C, 92*C, 66*C, "tomato2", -205*C, 79*C, 57*C, "tomato3", -139*C, 54*C, 38*C, "tomato4", - 64*C, 224*C, 208*C, "turquoise", - 0*C, 245*C, 255*C, "turquoise1", - 0*C, 229*C, 238*C, "turquoise2", - 0*C, 197*C, 205*C, "turquoise3", - 0*C, 134*C, 139*C, "turquoise4", -238*C, 130*C, 238*C, "violet", -208*C, 32*C, 144*C, "violet red", -208*C, 32*C, 144*C, "VioletRed", -255*C, 62*C, 150*C, "VioletRed1", -238*C, 58*C, 140*C, "VioletRed2", -205*C, 50*C, 120*C, "VioletRed3", -139*C, 34*C, 82*C, "VioletRed4", -245*C, 222*C, 179*C, "wheat", -255*C, 231*C, 186*C, "wheat1", -238*C, 216*C, 174*C, "wheat2", -205*C, 186*C, 150*C, "wheat3", -139*C, 126*C, 102*C, "wheat4", -255*C, 255*C, 255*C, "white", -245*C, 245*C, 245*C, "white smoke", -245*C, 245*C, 245*C, "WhiteSmoke", -255*C, 255*C, 0*C, "yellow", -154*C, 205*C, 50*C, "yellow green", -255*C, 255*C, 0*C, "yellow1", -238*C, 238*C, 0*C, "yellow2", -205*C, 205*C, 0*C, "yellow3", -139*C, 139*C, 0*C, "yellow4", -154*C, 205*C, 50*C, "YellowGreen", + { 240*C, 248*C, 255*C, "alice blue" }, + { 240*C, 248*C, 255*C, "AliceBlue" }, + { 250*C, 235*C, 215*C, "antique white" }, + { 250*C, 235*C, 215*C, "AntiqueWhite" }, + { 255*C, 239*C, 219*C, "AntiqueWhite1" }, + { 238*C, 223*C, 204*C, "AntiqueWhite2" }, + { 205*C, 192*C, 176*C, "AntiqueWhite3" }, + { 139*C, 131*C, 120*C, "AntiqueWhite4" }, + { 127*C, 255*C, 212*C, "aquamarine" }, + { 127*C, 255*C, 212*C, "aquamarine1" }, + { 118*C, 238*C, 198*C, "aquamarine2" }, + { 102*C, 205*C, 170*C, "aquamarine3" }, + { 69*C, 139*C, 116*C, "aquamarine4" }, + { 240*C, 255*C, 255*C, "azure" }, + { 240*C, 255*C, 255*C, "azure1" }, + { 224*C, 238*C, 238*C, "azure2" }, + { 193*C, 205*C, 205*C, "azure3" }, + { 131*C, 139*C, 139*C, "azure4" }, + { 245*C, 245*C, 220*C, "beige" }, + { 255*C, 228*C, 196*C, "bisque" }, + { 255*C, 228*C, 196*C, "bisque1" }, + { 238*C, 213*C, 183*C, "bisque2" }, + { 205*C, 183*C, 158*C, "bisque3" }, + { 139*C, 125*C, 107*C, "bisque4" }, + { 0*C, 0*C, 0*C, "black" }, + { 255*C, 235*C, 205*C, "blanched almond" }, + { 255*C, 235*C, 205*C, "BlanchedAlmond" }, + { 0*C, 0*C, 255*C, "blue" }, + { 138*C, 43*C, 226*C, "blue violet" }, + { 0*C, 0*C, 255*C, "blue1" }, + { 0*C, 0*C, 238*C, "blue2" }, + { 0*C, 0*C, 205*C, "blue3" }, + { 0*C, 0*C, 139*C, "blue4" }, + { 138*C, 43*C, 226*C, "BlueViolet" }, + { 165*C, 42*C, 42*C, "brown" }, + { 255*C, 64*C, 64*C, "brown1" }, + { 238*C, 59*C, 59*C, "brown2" }, + { 205*C, 51*C, 51*C, "brown3" }, + { 139*C, 35*C, 35*C, "brown4" }, + { 222*C, 184*C, 135*C, "burlywood" }, + { 255*C, 211*C, 155*C, "burlywood1" }, + { 238*C, 197*C, 145*C, "burlywood2" }, + { 205*C, 170*C, 125*C, "burlywood3" }, + { 139*C, 115*C, 85*C, "burlywood4" }, + { 95*C, 158*C, 160*C, "cadet blue" }, + { 95*C, 158*C, 160*C, "CadetBlue" }, + { 152*C, 245*C, 255*C, "CadetBlue1" }, + { 142*C, 229*C, 238*C, "CadetBlue2" }, + { 122*C, 197*C, 205*C, "CadetBlue3" }, + { 83*C, 134*C, 139*C, "CadetBlue4" }, + { 127*C, 255*C, 0*C, "chartreuse" }, + { 127*C, 255*C, 0*C, "chartreuse1" }, + { 118*C, 238*C, 0*C, "chartreuse2" }, + { 102*C, 205*C, 0*C, "chartreuse3" }, + { 69*C, 139*C, 0*C, "chartreuse4" }, + { 210*C, 105*C, 30*C, "chocolate" }, + { 255*C, 127*C, 36*C, "chocolate1" }, + { 238*C, 118*C, 33*C, "chocolate2" }, + { 205*C, 102*C, 29*C, "chocolate3" }, + { 139*C, 69*C, 19*C, "chocolate4" }, + { 255*C, 127*C, 80*C, "coral" }, + { 255*C, 114*C, 86*C, "coral1" }, + { 238*C, 106*C, 80*C, "coral2" }, + { 205*C, 91*C, 69*C, "coral3" }, + { 139*C, 62*C, 47*C, "coral4" }, + { 100*C, 149*C, 237*C, "cornflower blue" }, + { 100*C, 149*C, 237*C, "CornflowerBlue" }, + { 255*C, 248*C, 220*C, "cornsilk" }, + { 255*C, 248*C, 220*C, "cornsilk1" }, + { 238*C, 232*C, 205*C, "cornsilk2" }, + { 205*C, 200*C, 177*C, "cornsilk3" }, + { 139*C, 136*C, 120*C, "cornsilk4" }, + { 0*C, 255*C, 255*C, "cyan" }, + { 0*C, 255*C, 255*C, "cyan1" }, + { 0*C, 238*C, 238*C, "cyan2" }, + { 0*C, 205*C, 205*C, "cyan3" }, + { 0*C, 139*C, 139*C, "cyan4" }, + { 0*C, 0*C, 139*C, "dark blue" }, + { 0*C, 139*C, 139*C, "dark cyan" }, + { 184*C, 134*C, 11*C, "dark goldenrod" }, + { 169*C, 169*C, 169*C, "dark gray" }, + { 0*C, 100*C, 0*C, "dark green" }, + { 169*C, 169*C, 169*C, "dark grey" }, + { 189*C, 183*C, 107*C, "dark khaki" }, + { 139*C, 0*C, 139*C, "dark magenta" }, + { 85*C, 107*C, 47*C, "dark olive green" }, + { 255*C, 140*C, 0*C, "dark orange" }, + { 153*C, 50*C, 204*C, "dark orchid" }, + { 139*C, 0*C, 0*C, "dark red" }, + { 233*C, 150*C, 122*C, "dark salmon" }, + { 143*C, 188*C, 143*C, "dark sea green" }, + { 72*C, 61*C, 139*C, "dark slate blue" }, + { 47*C, 79*C, 79*C, "dark slate gray" }, + { 47*C, 79*C, 79*C, "dark slate grey" }, + { 0*C, 206*C, 209*C, "dark turquoise" }, + { 148*C, 0*C, 211*C, "dark violet" }, + { 0*C, 0*C, 139*C, "DarkBlue" }, + { 0*C, 139*C, 139*C, "DarkCyan" }, + { 184*C, 134*C, 11*C, "DarkGoldenrod" }, + { 255*C, 185*C, 15*C, "DarkGoldenrod1" }, + { 238*C, 173*C, 14*C, "DarkGoldenrod2" }, + { 205*C, 149*C, 12*C, "DarkGoldenrod3" }, + { 139*C, 101*C, 8*C, "DarkGoldenrod4" }, + { 169*C, 169*C, 169*C, "DarkGray" }, + { 0*C, 100*C, 0*C, "DarkGreen" }, + { 169*C, 169*C, 169*C, "DarkGrey" }, + { 189*C, 183*C, 107*C, "DarkKhaki" }, + { 139*C, 0*C, 139*C, "DarkMagenta" }, + { 85*C, 107*C, 47*C, "DarkOliveGreen" }, + { 202*C, 255*C, 112*C, "DarkOliveGreen1" }, + { 188*C, 238*C, 104*C, "DarkOliveGreen2" }, + { 162*C, 205*C, 90*C, "DarkOliveGreen3" }, + { 110*C, 139*C, 61*C, "DarkOliveGreen4" }, + { 255*C, 140*C, 0*C, "DarkOrange" }, + { 255*C, 127*C, 0*C, "DarkOrange1" }, + { 238*C, 118*C, 0*C, "DarkOrange2" }, + { 205*C, 102*C, 0*C, "DarkOrange3" }, + { 139*C, 69*C, 0*C, "DarkOrange4" }, + { 153*C, 50*C, 204*C, "DarkOrchid" }, + { 191*C, 62*C, 255*C, "DarkOrchid1" }, + { 178*C, 58*C, 238*C, "DarkOrchid2" }, + { 154*C, 50*C, 205*C, "DarkOrchid3" }, + { 104*C, 34*C, 139*C, "DarkOrchid4" }, + { 139*C, 0*C, 0*C, "DarkRed" }, + { 233*C, 150*C, 122*C, "DarkSalmon" }, + { 143*C, 188*C, 143*C, "DarkSeaGreen" }, + { 193*C, 255*C, 193*C, "DarkSeaGreen1" }, + { 180*C, 238*C, 180*C, "DarkSeaGreen2" }, + { 155*C, 205*C, 155*C, "DarkSeaGreen3" }, + { 105*C, 139*C, 105*C, "DarkSeaGreen4" }, + { 72*C, 61*C, 139*C, "DarkSlateBlue" }, + { 47*C, 79*C, 79*C, "DarkSlateGray" }, + { 151*C, 255*C, 255*C, "DarkSlateGray1" }, + { 141*C, 238*C, 238*C, "DarkSlateGray2" }, + { 121*C, 205*C, 205*C, "DarkSlateGray3" }, + { 82*C, 139*C, 139*C, "DarkSlateGray4" }, + { 47*C, 79*C, 79*C, "DarkSlateGrey" }, + { 0*C, 206*C, 209*C, "DarkTurquoise" }, + { 148*C, 0*C, 211*C, "DarkViolet" }, + { 255*C, 20*C, 147*C, "deep pink" }, + { 0*C, 191*C, 255*C, "deep sky blue" }, + { 255*C, 20*C, 147*C, "DeepPink" }, + { 255*C, 20*C, 147*C, "DeepPink1" }, + { 238*C, 18*C, 137*C, "DeepPink2" }, + { 205*C, 16*C, 118*C, "DeepPink3" }, + { 139*C, 10*C, 80*C, "DeepPink4" }, + { 0*C, 191*C, 255*C, "DeepSkyBlue" }, + { 0*C, 191*C, 255*C, "DeepSkyBlue1" }, + { 0*C, 178*C, 238*C, "DeepSkyBlue2" }, + { 0*C, 154*C, 205*C, "DeepSkyBlue3" }, + { 0*C, 104*C, 139*C, "DeepSkyBlue4" }, + { 105*C, 105*C, 105*C, "dim gray" }, + { 105*C, 105*C, 105*C, "dim grey" }, + { 105*C, 105*C, 105*C, "DimGray" }, + { 105*C, 105*C, 105*C, "DimGrey" }, + { 30*C, 144*C, 255*C, "dodger blue" }, + { 30*C, 144*C, 255*C, "DodgerBlue" }, + { 30*C, 144*C, 255*C, "DodgerBlue1" }, + { 28*C, 134*C, 238*C, "DodgerBlue2" }, + { 24*C, 116*C, 205*C, "DodgerBlue3" }, + { 16*C, 78*C, 139*C, "DodgerBlue4" }, + { 178*C, 34*C, 34*C, "firebrick" }, + { 255*C, 48*C, 48*C, "firebrick1" }, + { 238*C, 44*C, 44*C, "firebrick2" }, + { 205*C, 38*C, 38*C, "firebrick3" }, + { 139*C, 26*C, 26*C, "firebrick4" }, + { 255*C, 250*C, 240*C, "floral white" }, + { 255*C, 250*C, 240*C, "FloralWhite" }, + { 34*C, 139*C, 34*C, "forest green" }, + { 34*C, 139*C, 34*C, "ForestGreen" }, + { 220*C, 220*C, 220*C, "gainsboro" }, + { 248*C, 248*C, 255*C, "ghost white" }, + { 248*C, 248*C, 255*C, "GhostWhite" }, + { 255*C, 215*C, 0*C, "gold" }, + { 255*C, 215*C, 0*C, "gold1" }, + { 238*C, 201*C, 0*C, "gold2" }, + { 205*C, 173*C, 0*C, "gold3" }, + { 139*C, 117*C, 0*C, "gold4" }, + { 218*C, 165*C, 32*C, "goldenrod" }, + { 255*C, 193*C, 37*C, "goldenrod1" }, + { 238*C, 180*C, 34*C, "goldenrod2" }, + { 205*C, 155*C, 29*C, "goldenrod3" }, + { 139*C, 105*C, 20*C, "goldenrod4" }, + { 190*C, 190*C, 190*C, "gray" }, + { 0*C, 0*C, 0*C, "gray0" }, + { 3*C, 3*C, 3*C, "gray1" }, + { 26*C, 26*C, 26*C, "gray10" }, + { 255*C, 255*C, 255*C, "gray100" }, + { 28*C, 28*C, 28*C, "gray11" }, + { 31*C, 31*C, 31*C, "gray12" }, + { 33*C, 33*C, 33*C, "gray13" }, + { 36*C, 36*C, 36*C, "gray14" }, + { 38*C, 38*C, 38*C, "gray15" }, + { 41*C, 41*C, 41*C, "gray16" }, + { 43*C, 43*C, 43*C, "gray17" }, + { 46*C, 46*C, 46*C, "gray18" }, + { 48*C, 48*C, 48*C, "gray19" }, + { 5*C, 5*C, 5*C, "gray2" }, + { 51*C, 51*C, 51*C, "gray20" }, + { 54*C, 54*C, 54*C, "gray21" }, + { 56*C, 56*C, 56*C, "gray22" }, + { 59*C, 59*C, 59*C, "gray23" }, + { 61*C, 61*C, 61*C, "gray24" }, + { 64*C, 64*C, 64*C, "gray25" }, + { 66*C, 66*C, 66*C, "gray26" }, + { 69*C, 69*C, 69*C, "gray27" }, + { 71*C, 71*C, 71*C, "gray28" }, + { 74*C, 74*C, 74*C, "gray29" }, + { 8*C, 8*C, 8*C, "gray3" }, + { 77*C, 77*C, 77*C, "gray30" }, + { 79*C, 79*C, 79*C, "gray31" }, + { 82*C, 82*C, 82*C, "gray32" }, + { 84*C, 84*C, 84*C, "gray33" }, + { 87*C, 87*C, 87*C, "gray34" }, + { 89*C, 89*C, 89*C, "gray35" }, + { 92*C, 92*C, 92*C, "gray36" }, + { 94*C, 94*C, 94*C, "gray37" }, + { 97*C, 97*C, 97*C, "gray38" }, + { 99*C, 99*C, 99*C, "gray39" }, + { 10*C, 10*C, 10*C, "gray4" }, + { 102*C, 102*C, 102*C, "gray40" }, + { 105*C, 105*C, 105*C, "gray41" }, + { 107*C, 107*C, 107*C, "gray42" }, + { 110*C, 110*C, 110*C, "gray43" }, + { 112*C, 112*C, 112*C, "gray44" }, + { 115*C, 115*C, 115*C, "gray45" }, + { 117*C, 117*C, 117*C, "gray46" }, + { 120*C, 120*C, 120*C, "gray47" }, + { 122*C, 122*C, 122*C, "gray48" }, + { 125*C, 125*C, 125*C, "gray49" }, + { 13*C, 13*C, 13*C, "gray5" }, + { 127*C, 127*C, 127*C, "gray50" }, + { 130*C, 130*C, 130*C, "gray51" }, + { 133*C, 133*C, 133*C, "gray52" }, + { 135*C, 135*C, 135*C, "gray53" }, + { 138*C, 138*C, 138*C, "gray54" }, + { 140*C, 140*C, 140*C, "gray55" }, + { 143*C, 143*C, 143*C, "gray56" }, + { 145*C, 145*C, 145*C, "gray57" }, + { 148*C, 148*C, 148*C, "gray58" }, + { 150*C, 150*C, 150*C, "gray59" }, + { 15*C, 15*C, 15*C, "gray6" }, + { 153*C, 153*C, 153*C, "gray60" }, + { 156*C, 156*C, 156*C, "gray61" }, + { 158*C, 158*C, 158*C, "gray62" }, + { 161*C, 161*C, 161*C, "gray63" }, + { 163*C, 163*C, 163*C, "gray64" }, + { 166*C, 166*C, 166*C, "gray65" }, + { 168*C, 168*C, 168*C, "gray66" }, + { 171*C, 171*C, 171*C, "gray67" }, + { 173*C, 173*C, 173*C, "gray68" }, + { 176*C, 176*C, 176*C, "gray69" }, + { 18*C, 18*C, 18*C, "gray7" }, + { 179*C, 179*C, 179*C, "gray70" }, + { 181*C, 181*C, 181*C, "gray71" }, + { 184*C, 184*C, 184*C, "gray72" }, + { 186*C, 186*C, 186*C, "gray73" }, + { 189*C, 189*C, 189*C, "gray74" }, + { 191*C, 191*C, 191*C, "gray75" }, + { 194*C, 194*C, 194*C, "gray76" }, + { 196*C, 196*C, 196*C, "gray77" }, + { 199*C, 199*C, 199*C, "gray78" }, + { 201*C, 201*C, 201*C, "gray79" }, + { 20*C, 20*C, 20*C, "gray8" }, + { 204*C, 204*C, 204*C, "gray80" }, + { 207*C, 207*C, 207*C, "gray81" }, + { 209*C, 209*C, 209*C, "gray82" }, + { 212*C, 212*C, 212*C, "gray83" }, + { 214*C, 214*C, 214*C, "gray84" }, + { 217*C, 217*C, 217*C, "gray85" }, + { 219*C, 219*C, 219*C, "gray86" }, + { 222*C, 222*C, 222*C, "gray87" }, + { 224*C, 224*C, 224*C, "gray88" }, + { 227*C, 227*C, 227*C, "gray89" }, + { 23*C, 23*C, 23*C, "gray9" }, + { 229*C, 229*C, 229*C, "gray90" }, + { 232*C, 232*C, 232*C, "gray91" }, + { 235*C, 235*C, 235*C, "gray92" }, + { 237*C, 237*C, 237*C, "gray93" }, + { 240*C, 240*C, 240*C, "gray94" }, + { 242*C, 242*C, 242*C, "gray95" }, + { 245*C, 245*C, 245*C, "gray96" }, + { 247*C, 247*C, 247*C, "gray97" }, + { 250*C, 250*C, 250*C, "gray98" }, + { 252*C, 252*C, 252*C, "gray99" }, + { 0*C, 255*C, 0*C, "green" }, + { 173*C, 255*C, 47*C, "green yellow" }, + { 0*C, 255*C, 0*C, "green1" }, + { 0*C, 238*C, 0*C, "green2" }, + { 0*C, 205*C, 0*C, "green3" }, + { 0*C, 139*C, 0*C, "green4" }, + { 173*C, 255*C, 47*C, "GreenYellow" }, + { 190*C, 190*C, 190*C, "grey" }, + { 0*C, 0*C, 0*C, "grey0" }, + { 3*C, 3*C, 3*C, "grey1" }, + { 26*C, 26*C, 26*C, "grey10" }, + { 255*C, 255*C, 255*C, "grey100" }, + { 28*C, 28*C, 28*C, "grey11" }, + { 31*C, 31*C, 31*C, "grey12" }, + { 33*C, 33*C, 33*C, "grey13" }, + { 36*C, 36*C, 36*C, "grey14" }, + { 38*C, 38*C, 38*C, "grey15" }, + { 41*C, 41*C, 41*C, "grey16" }, + { 43*C, 43*C, 43*C, "grey17" }, + { 46*C, 46*C, 46*C, "grey18" }, + { 48*C, 48*C, 48*C, "grey19" }, + { 5*C, 5*C, 5*C, "grey2" }, + { 51*C, 51*C, 51*C, "grey20" }, + { 54*C, 54*C, 54*C, "grey21" }, + { 56*C, 56*C, 56*C, "grey22" }, + { 59*C, 59*C, 59*C, "grey23" }, + { 61*C, 61*C, 61*C, "grey24" }, + { 64*C, 64*C, 64*C, "grey25" }, + { 66*C, 66*C, 66*C, "grey26" }, + { 69*C, 69*C, 69*C, "grey27" }, + { 71*C, 71*C, 71*C, "grey28" }, + { 74*C, 74*C, 74*C, "grey29" }, + { 8*C, 8*C, 8*C, "grey3" }, + { 77*C, 77*C, 77*C, "grey30" }, + { 79*C, 79*C, 79*C, "grey31" }, + { 82*C, 82*C, 82*C, "grey32" }, + { 84*C, 84*C, 84*C, "grey33" }, + { 87*C, 87*C, 87*C, "grey34" }, + { 89*C, 89*C, 89*C, "grey35" }, + { 92*C, 92*C, 92*C, "grey36" }, + { 94*C, 94*C, 94*C, "grey37" }, + { 97*C, 97*C, 97*C, "grey38" }, + { 99*C, 99*C, 99*C, "grey39" }, + { 10*C, 10*C, 10*C, "grey4" }, + { 102*C, 102*C, 102*C, "grey40" }, + { 105*C, 105*C, 105*C, "grey41" }, + { 107*C, 107*C, 107*C, "grey42" }, + { 110*C, 110*C, 110*C, "grey43" }, + { 112*C, 112*C, 112*C, "grey44" }, + { 115*C, 115*C, 115*C, "grey45" }, + { 117*C, 117*C, 117*C, "grey46" }, + { 120*C, 120*C, 120*C, "grey47" }, + { 122*C, 122*C, 122*C, "grey48" }, + { 125*C, 125*C, 125*C, "grey49" }, + { 13*C, 13*C, 13*C, "grey5" }, + { 127*C, 127*C, 127*C, "grey50" }, + { 130*C, 130*C, 130*C, "grey51" }, + { 133*C, 133*C, 133*C, "grey52" }, + { 135*C, 135*C, 135*C, "grey53" }, + { 138*C, 138*C, 138*C, "grey54" }, + { 140*C, 140*C, 140*C, "grey55" }, + { 143*C, 143*C, 143*C, "grey56" }, + { 145*C, 145*C, 145*C, "grey57" }, + { 148*C, 148*C, 148*C, "grey58" }, + { 150*C, 150*C, 150*C, "grey59" }, + { 15*C, 15*C, 15*C, "grey6" }, + { 153*C, 153*C, 153*C, "grey60" }, + { 156*C, 156*C, 156*C, "grey61" }, + { 158*C, 158*C, 158*C, "grey62" }, + { 161*C, 161*C, 161*C, "grey63" }, + { 163*C, 163*C, 163*C, "grey64" }, + { 166*C, 166*C, 166*C, "grey65" }, + { 168*C, 168*C, 168*C, "grey66" }, + { 171*C, 171*C, 171*C, "grey67" }, + { 173*C, 173*C, 173*C, "grey68" }, + { 176*C, 176*C, 176*C, "grey69" }, + { 18*C, 18*C, 18*C, "grey7" }, + { 179*C, 179*C, 179*C, "grey70" }, + { 181*C, 181*C, 181*C, "grey71" }, + { 184*C, 184*C, 184*C, "grey72" }, + { 186*C, 186*C, 186*C, "grey73" }, + { 189*C, 189*C, 189*C, "grey74" }, + { 191*C, 191*C, 191*C, "grey75" }, + { 194*C, 194*C, 194*C, "grey76" }, + { 196*C, 196*C, 196*C, "grey77" }, + { 199*C, 199*C, 199*C, "grey78" }, + { 201*C, 201*C, 201*C, "grey79" }, + { 20*C, 20*C, 20*C, "grey8" }, + { 204*C, 204*C, 204*C, "grey80" }, + { 207*C, 207*C, 207*C, "grey81" }, + { 209*C, 209*C, 209*C, "grey82" }, + { 212*C, 212*C, 212*C, "grey83" }, + { 214*C, 214*C, 214*C, "grey84" }, + { 217*C, 217*C, 217*C, "grey85" }, + { 219*C, 219*C, 219*C, "grey86" }, + { 222*C, 222*C, 222*C, "grey87" }, + { 224*C, 224*C, 224*C, "grey88" }, + { 227*C, 227*C, 227*C, "grey89" }, + { 23*C, 23*C, 23*C, "grey9" }, + { 229*C, 229*C, 229*C, "grey90" }, + { 232*C, 232*C, 232*C, "grey91" }, + { 235*C, 235*C, 235*C, "grey92" }, + { 237*C, 237*C, 237*C, "grey93" }, + { 240*C, 240*C, 240*C, "grey94" }, + { 242*C, 242*C, 242*C, "grey95" }, + { 245*C, 245*C, 245*C, "grey96" }, + { 247*C, 247*C, 247*C, "grey97" }, + { 250*C, 250*C, 250*C, "grey98" }, + { 252*C, 252*C, 252*C, "grey99" }, + { 240*C, 255*C, 240*C, "honeydew" }, + { 240*C, 255*C, 240*C, "honeydew1" }, + { 224*C, 238*C, 224*C, "honeydew2" }, + { 193*C, 205*C, 193*C, "honeydew3" }, + { 131*C, 139*C, 131*C, "honeydew4" }, + { 255*C, 105*C, 180*C, "hot pink" }, + { 255*C, 105*C, 180*C, "HotPink" }, + { 255*C, 110*C, 180*C, "HotPink1" }, + { 238*C, 106*C, 167*C, "HotPink2" }, + { 205*C, 96*C, 144*C, "HotPink3" }, + { 139*C, 58*C, 98*C, "HotPink4" }, + { 205*C, 92*C, 92*C, "indian red" }, + { 205*C, 92*C, 92*C, "IndianRed" }, + { 255*C, 106*C, 106*C, "IndianRed1" }, + { 238*C, 99*C, 99*C, "IndianRed2" }, + { 205*C, 85*C, 85*C, "IndianRed3" }, + { 139*C, 58*C, 58*C, "IndianRed4" }, + { 255*C, 255*C, 240*C, "ivory" }, + { 255*C, 255*C, 240*C, "ivory1" }, + { 238*C, 238*C, 224*C, "ivory2" }, + { 205*C, 205*C, 193*C, "ivory3" }, + { 139*C, 139*C, 131*C, "ivory4" }, + { 240*C, 230*C, 140*C, "khaki" }, + { 255*C, 246*C, 143*C, "khaki1" }, + { 238*C, 230*C, 133*C, "khaki2" }, + { 205*C, 198*C, 115*C, "khaki3" }, + { 139*C, 134*C, 78*C, "khaki4" }, + { 230*C, 230*C, 250*C, "lavender" }, + { 255*C, 240*C, 245*C, "lavender blush" }, + { 255*C, 240*C, 245*C, "LavenderBlush" }, + { 255*C, 240*C, 245*C, "LavenderBlush1" }, + { 238*C, 224*C, 229*C, "LavenderBlush2" }, + { 205*C, 193*C, 197*C, "LavenderBlush3" }, + { 139*C, 131*C, 134*C, "LavenderBlush4" }, + { 124*C, 252*C, 0*C, "lawn green" }, + { 124*C, 252*C, 0*C, "LawnGreen" }, + { 255*C, 250*C, 205*C, "lemon chiffon" }, + { 255*C, 250*C, 205*C, "LemonChiffon" }, + { 255*C, 250*C, 205*C, "LemonChiffon1" }, + { 238*C, 233*C, 191*C, "LemonChiffon2" }, + { 205*C, 201*C, 165*C, "LemonChiffon3" }, + { 139*C, 137*C, 112*C, "LemonChiffon4" }, + { 173*C, 216*C, 230*C, "light blue" }, + { 240*C, 128*C, 128*C, "light coral" }, + { 224*C, 255*C, 255*C, "light cyan" }, + { 238*C, 221*C, 130*C, "light goldenrod" }, + { 250*C, 250*C, 210*C, "light goldenrod yellow" }, + { 211*C, 211*C, 211*C, "light gray" }, + { 144*C, 238*C, 144*C, "light green" }, + { 211*C, 211*C, 211*C, "light grey" }, + { 255*C, 182*C, 193*C, "light pink" }, + { 255*C, 160*C, 122*C, "light salmon" }, + { 32*C, 178*C, 170*C, "light sea green" }, + { 135*C, 206*C, 250*C, "light sky blue" }, + { 132*C, 112*C, 255*C, "light slate blue" }, + { 119*C, 136*C, 153*C, "light slate gray" }, + { 119*C, 136*C, 153*C, "light slate grey" }, + { 176*C, 196*C, 222*C, "light steel blue" }, + { 255*C, 255*C, 224*C, "light yellow" }, + { 173*C, 216*C, 230*C, "LightBlue" }, + { 191*C, 239*C, 255*C, "LightBlue1" }, + { 178*C, 223*C, 238*C, "LightBlue2" }, + { 154*C, 192*C, 205*C, "LightBlue3" }, + { 104*C, 131*C, 139*C, "LightBlue4" }, + { 240*C, 128*C, 128*C, "LightCoral" }, + { 224*C, 255*C, 255*C, "LightCyan" }, + { 224*C, 255*C, 255*C, "LightCyan1" }, + { 209*C, 238*C, 238*C, "LightCyan2" }, + { 180*C, 205*C, 205*C, "LightCyan3" }, + { 122*C, 139*C, 139*C, "LightCyan4" }, + { 238*C, 221*C, 130*C, "LightGoldenrod" }, + { 255*C, 236*C, 139*C, "LightGoldenrod1" }, + { 238*C, 220*C, 130*C, "LightGoldenrod2" }, + { 205*C, 190*C, 112*C, "LightGoldenrod3" }, + { 139*C, 129*C, 76*C, "LightGoldenrod4" }, + { 250*C, 250*C, 210*C, "LightGoldenrodYellow" }, + { 211*C, 211*C, 211*C, "LightGray" }, + { 144*C, 238*C, 144*C, "LightGreen" }, + { 211*C, 211*C, 211*C, "LightGrey" }, + { 255*C, 182*C, 193*C, "LightPink" }, + { 255*C, 174*C, 185*C, "LightPink1" }, + { 238*C, 162*C, 173*C, "LightPink2" }, + { 205*C, 140*C, 149*C, "LightPink3" }, + { 139*C, 95*C, 101*C, "LightPink4" }, + { 255*C, 160*C, 122*C, "LightSalmon" }, + { 255*C, 160*C, 122*C, "LightSalmon1" }, + { 238*C, 149*C, 114*C, "LightSalmon2" }, + { 205*C, 129*C, 98*C, "LightSalmon3" }, + { 139*C, 87*C, 66*C, "LightSalmon4" }, + { 32*C, 178*C, 170*C, "LightSeaGreen" }, + { 135*C, 206*C, 250*C, "LightSkyBlue" }, + { 176*C, 226*C, 255*C, "LightSkyBlue1" }, + { 164*C, 211*C, 238*C, "LightSkyBlue2" }, + { 141*C, 182*C, 205*C, "LightSkyBlue3" }, + { 96*C, 123*C, 139*C, "LightSkyBlue4" }, + { 132*C, 112*C, 255*C, "LightSlateBlue" }, + { 119*C, 136*C, 153*C, "LightSlateGray" }, + { 119*C, 136*C, 153*C, "LightSlateGrey" }, + { 176*C, 196*C, 222*C, "LightSteelBlue" }, + { 202*C, 225*C, 255*C, "LightSteelBlue1" }, + { 188*C, 210*C, 238*C, "LightSteelBlue2" }, + { 162*C, 181*C, 205*C, "LightSteelBlue3" }, + { 110*C, 123*C, 139*C, "LightSteelBlue4" }, + { 255*C, 255*C, 224*C, "LightYellow" }, + { 255*C, 255*C, 224*C, "LightYellow1" }, + { 238*C, 238*C, 209*C, "LightYellow2" }, + { 205*C, 205*C, 180*C, "LightYellow3" }, + { 139*C, 139*C, 122*C, "LightYellow4" }, + { 50*C, 205*C, 50*C, "lime green" }, + { 50*C, 205*C, 50*C, "LimeGreen" }, + { 250*C, 240*C, 230*C, "linen" }, + { 255*C, 0*C, 255*C, "magenta" }, + { 255*C, 0*C, 255*C, "magenta1" }, + { 238*C, 0*C, 238*C, "magenta2" }, + { 205*C, 0*C, 205*C, "magenta3" }, + { 139*C, 0*C, 139*C, "magenta4" }, + { 176*C, 48*C, 96*C, "maroon" }, + { 255*C, 52*C, 179*C, "maroon1" }, + { 238*C, 48*C, 167*C, "maroon2" }, + { 205*C, 41*C, 144*C, "maroon3" }, + { 139*C, 28*C, 98*C, "maroon4" }, + { 102*C, 205*C, 170*C, "medium aquamarine" }, + { 0*C, 0*C, 205*C, "medium blue" }, + { 186*C, 85*C, 211*C, "medium orchid" }, + { 147*C, 112*C, 219*C, "medium purple" }, + { 60*C, 179*C, 113*C, "medium sea green" }, + { 123*C, 104*C, 238*C, "medium slate blue" }, + { 0*C, 250*C, 154*C, "medium spring green" }, + { 72*C, 209*C, 204*C, "medium turquoise" }, + { 199*C, 21*C, 133*C, "medium violet red" }, + { 102*C, 205*C, 170*C, "MediumAquamarine" }, + { 0*C, 0*C, 205*C, "MediumBlue" }, + { 186*C, 85*C, 211*C, "MediumOrchid" }, + { 224*C, 102*C, 255*C, "MediumOrchid1" }, + { 209*C, 95*C, 238*C, "MediumOrchid2" }, + { 180*C, 82*C, 205*C, "MediumOrchid3" }, + { 122*C, 55*C, 139*C, "MediumOrchid4" }, + { 147*C, 112*C, 219*C, "MediumPurple" }, + { 171*C, 130*C, 255*C, "MediumPurple1" }, + { 159*C, 121*C, 238*C, "MediumPurple2" }, + { 137*C, 104*C, 205*C, "MediumPurple3" }, + { 93*C, 71*C, 139*C, "MediumPurple4" }, + { 60*C, 179*C, 113*C, "MediumSeaGreen" }, + { 123*C, 104*C, 238*C, "MediumSlateBlue" }, + { 0*C, 250*C, 154*C, "MediumSpringGreen" }, + { 72*C, 209*C, 204*C, "MediumTurquoise" }, + { 199*C, 21*C, 133*C, "MediumVioletRed" }, + { 25*C, 25*C, 112*C, "midnight blue" }, + { 25*C, 25*C, 112*C, "MidnightBlue" }, + { 245*C, 255*C, 250*C, "mint cream" }, + { 245*C, 255*C, 250*C, "MintCream" }, + { 255*C, 228*C, 225*C, "misty rose" }, + { 255*C, 228*C, 225*C, "MistyRose" }, + { 255*C, 228*C, 225*C, "MistyRose1" }, + { 238*C, 213*C, 210*C, "MistyRose2" }, + { 205*C, 183*C, 181*C, "MistyRose3" }, + { 139*C, 125*C, 123*C, "MistyRose4" }, + { 255*C, 228*C, 181*C, "moccasin" }, + { 255*C, 222*C, 173*C, "navajo white" }, + { 255*C, 222*C, 173*C, "NavajoWhite" }, + { 255*C, 222*C, 173*C, "NavajoWhite1" }, + { 238*C, 207*C, 161*C, "NavajoWhite2" }, + { 205*C, 179*C, 139*C, "NavajoWhite3" }, + { 139*C, 121*C, 94*C, "NavajoWhite4" }, + { 0*C, 0*C, 128*C, "navy" }, + { 0*C, 0*C, 128*C, "navy blue" }, + { 0*C, 0*C, 128*C, "NavyBlue" }, + { 253*C, 245*C, 230*C, "old lace" }, + { 253*C, 245*C, 230*C, "OldLace" }, + { 107*C, 142*C, 35*C, "olive drab" }, + { 107*C, 142*C, 35*C, "OliveDrab" }, + { 192*C, 255*C, 62*C, "OliveDrab1" }, + { 179*C, 238*C, 58*C, "OliveDrab2" }, + { 154*C, 205*C, 50*C, "OliveDrab3" }, + { 105*C, 139*C, 34*C, "OliveDrab4" }, + { 255*C, 165*C, 0*C, "orange" }, + { 255*C, 69*C, 0*C, "orange red" }, + { 255*C, 165*C, 0*C, "orange1" }, + { 238*C, 154*C, 0*C, "orange2" }, + { 205*C, 133*C, 0*C, "orange3" }, + { 139*C, 90*C, 0*C, "orange4" }, + { 255*C, 69*C, 0*C, "OrangeRed" }, + { 255*C, 69*C, 0*C, "OrangeRed1" }, + { 238*C, 64*C, 0*C, "OrangeRed2" }, + { 205*C, 55*C, 0*C, "OrangeRed3" }, + { 139*C, 37*C, 0*C, "OrangeRed4" }, + { 218*C, 112*C, 214*C, "orchid" }, + { 255*C, 131*C, 250*C, "orchid1" }, + { 238*C, 122*C, 233*C, "orchid2" }, + { 205*C, 105*C, 201*C, "orchid3" }, + { 139*C, 71*C, 137*C, "orchid4" }, + { 238*C, 232*C, 170*C, "pale goldenrod" }, + { 152*C, 251*C, 152*C, "pale green" }, + { 175*C, 238*C, 238*C, "pale turquoise" }, + { 219*C, 112*C, 147*C, "pale violet red" }, + { 238*C, 232*C, 170*C, "PaleGoldenrod" }, + { 152*C, 251*C, 152*C, "PaleGreen" }, + { 154*C, 255*C, 154*C, "PaleGreen1" }, + { 144*C, 238*C, 144*C, "PaleGreen2" }, + { 124*C, 205*C, 124*C, "PaleGreen3" }, + { 84*C, 139*C, 84*C, "PaleGreen4" }, + { 175*C, 238*C, 238*C, "PaleTurquoise" }, + { 187*C, 255*C, 255*C, "PaleTurquoise1" }, + { 174*C, 238*C, 238*C, "PaleTurquoise2" }, + { 150*C, 205*C, 205*C, "PaleTurquoise3" }, + { 102*C, 139*C, 139*C, "PaleTurquoise4" }, + { 219*C, 112*C, 147*C, "PaleVioletRed" }, + { 255*C, 130*C, 171*C, "PaleVioletRed1" }, + { 238*C, 121*C, 159*C, "PaleVioletRed2" }, + { 205*C, 104*C, 137*C, "PaleVioletRed3" }, + { 139*C, 71*C, 93*C, "PaleVioletRed4" }, + { 255*C, 239*C, 213*C, "papaya whip" }, + { 255*C, 239*C, 213*C, "PapayaWhip" }, + { 255*C, 218*C, 185*C, "peach puff" }, + { 255*C, 218*C, 185*C, "PeachPuff" }, + { 255*C, 218*C, 185*C, "PeachPuff1" }, + { 238*C, 203*C, 173*C, "PeachPuff2" }, + { 205*C, 175*C, 149*C, "PeachPuff3" }, + { 139*C, 119*C, 101*C, "PeachPuff4" }, + { 205*C, 133*C, 63*C, "peru" }, + { 255*C, 192*C, 203*C, "pink" }, + { 255*C, 181*C, 197*C, "pink1" }, + { 238*C, 169*C, 184*C, "pink2" }, + { 205*C, 145*C, 158*C, "pink3" }, + { 139*C, 99*C, 108*C, "pink4" }, + { 221*C, 160*C, 221*C, "plum" }, + { 255*C, 187*C, 255*C, "plum1" }, + { 238*C, 174*C, 238*C, "plum2" }, + { 205*C, 150*C, 205*C, "plum3" }, + { 139*C, 102*C, 139*C, "plum4" }, + { 176*C, 224*C, 230*C, "powder blue" }, + { 176*C, 224*C, 230*C, "PowderBlue" }, + { 160*C, 32*C, 240*C, "purple" }, + { 155*C, 48*C, 255*C, "purple1" }, + { 145*C, 44*C, 238*C, "purple2" }, + { 125*C, 38*C, 205*C, "purple3" }, + { 85*C, 26*C, 139*C, "purple4" }, + { 255*C, 0*C, 0*C, "red" }, + { 255*C, 0*C, 0*C, "red1" }, + { 238*C, 0*C, 0*C, "red2" }, + { 205*C, 0*C, 0*C, "red3" }, + { 139*C, 0*C, 0*C, "red4" }, + { 188*C, 143*C, 143*C, "rosy brown" }, + { 188*C, 143*C, 143*C, "RosyBrown" }, + { 255*C, 193*C, 193*C, "RosyBrown1" }, + { 238*C, 180*C, 180*C, "RosyBrown2" }, + { 205*C, 155*C, 155*C, "RosyBrown3" }, + { 139*C, 105*C, 105*C, "RosyBrown4" }, + { 65*C, 105*C, 225*C, "royal blue" }, + { 65*C, 105*C, 225*C, "RoyalBlue" }, + { 72*C, 118*C, 255*C, "RoyalBlue1" }, + { 67*C, 110*C, 238*C, "RoyalBlue2" }, + { 58*C, 95*C, 205*C, "RoyalBlue3" }, + { 39*C, 64*C, 139*C, "RoyalBlue4" }, + { 139*C, 69*C, 19*C, "saddle brown" }, + { 139*C, 69*C, 19*C, "SaddleBrown" }, + { 250*C, 128*C, 114*C, "salmon" }, + { 255*C, 140*C, 105*C, "salmon1" }, + { 238*C, 130*C, 98*C, "salmon2" }, + { 205*C, 112*C, 84*C, "salmon3" }, + { 139*C, 76*C, 57*C, "salmon4" }, + { 244*C, 164*C, 96*C, "sandy brown" }, + { 244*C, 164*C, 96*C, "SandyBrown" }, + { 46*C, 139*C, 87*C, "sea green" }, + { 46*C, 139*C, 87*C, "SeaGreen" }, + { 84*C, 255*C, 159*C, "SeaGreen1" }, + { 78*C, 238*C, 148*C, "SeaGreen2" }, + { 67*C, 205*C, 128*C, "SeaGreen3" }, + { 46*C, 139*C, 87*C, "SeaGreen4" }, + { 255*C, 245*C, 238*C, "seashell" }, + { 255*C, 245*C, 238*C, "seashell1" }, + { 238*C, 229*C, 222*C, "seashell2" }, + { 205*C, 197*C, 191*C, "seashell3" }, + { 139*C, 134*C, 130*C, "seashell4" }, + { 160*C, 82*C, 45*C, "sienna" }, + { 255*C, 130*C, 71*C, "sienna1" }, + { 238*C, 121*C, 66*C, "sienna2" }, + { 205*C, 104*C, 57*C, "sienna3" }, + { 139*C, 71*C, 38*C, "sienna4" }, + { 135*C, 206*C, 235*C, "sky blue" }, + { 135*C, 206*C, 235*C, "SkyBlue" }, + { 135*C, 206*C, 255*C, "SkyBlue1" }, + { 126*C, 192*C, 238*C, "SkyBlue2" }, + { 108*C, 166*C, 205*C, "SkyBlue3" }, + { 74*C, 112*C, 139*C, "SkyBlue4" }, + { 106*C, 90*C, 205*C, "slate blue" }, + { 112*C, 128*C, 144*C, "slate gray" }, + { 112*C, 128*C, 144*C, "slate grey" }, + { 106*C, 90*C, 205*C, "SlateBlue" }, + { 131*C, 111*C, 255*C, "SlateBlue1" }, + { 122*C, 103*C, 238*C, "SlateBlue2" }, + { 105*C, 89*C, 205*C, "SlateBlue3" }, + { 71*C, 60*C, 139*C, "SlateBlue4" }, + { 112*C, 128*C, 144*C, "SlateGray" }, + { 198*C, 226*C, 255*C, "SlateGray1" }, + { 185*C, 211*C, 238*C, "SlateGray2" }, + { 159*C, 182*C, 205*C, "SlateGray3" }, + { 108*C, 123*C, 139*C, "SlateGray4" }, + { 112*C, 128*C, 144*C, "SlateGrey" }, + { 255*C, 250*C, 250*C, "snow" }, + { 255*C, 250*C, 250*C, "snow1" }, + { 238*C, 233*C, 233*C, "snow2" }, + { 205*C, 201*C, 201*C, "snow3" }, + { 139*C, 137*C, 137*C, "snow4" }, + { 0*C, 255*C, 127*C, "spring green" }, + { 0*C, 255*C, 127*C, "SpringGreen" }, + { 0*C, 255*C, 127*C, "SpringGreen1" }, + { 0*C, 238*C, 118*C, "SpringGreen2" }, + { 0*C, 205*C, 102*C, "SpringGreen3" }, + { 0*C, 139*C, 69*C, "SpringGreen4" }, + { 70*C, 130*C, 180*C, "steel blue" }, + { 70*C, 130*C, 180*C, "SteelBlue" }, + { 99*C, 184*C, 255*C, "SteelBlue1" }, + { 92*C, 172*C, 238*C, "SteelBlue2" }, + { 79*C, 148*C, 205*C, "SteelBlue3" }, + { 54*C, 100*C, 139*C, "SteelBlue4" }, + { 210*C, 180*C, 140*C, "tan" }, + { 255*C, 165*C, 79*C, "tan1" }, + { 238*C, 154*C, 73*C, "tan2" }, + { 205*C, 133*C, 63*C, "tan3" }, + { 139*C, 90*C, 43*C, "tan4" }, + { 216*C, 191*C, 216*C, "thistle" }, + { 255*C, 225*C, 255*C, "thistle1" }, + { 238*C, 210*C, 238*C, "thistle2" }, + { 205*C, 181*C, 205*C, "thistle3" }, + { 139*C, 123*C, 139*C, "thistle4" }, + { 255*C, 99*C, 71*C, "tomato" }, + { 255*C, 99*C, 71*C, "tomato1" }, + { 238*C, 92*C, 66*C, "tomato2" }, + { 205*C, 79*C, 57*C, "tomato3" }, + { 139*C, 54*C, 38*C, "tomato4" }, + { 64*C, 224*C, 208*C, "turquoise" }, + { 0*C, 245*C, 255*C, "turquoise1" }, + { 0*C, 229*C, 238*C, "turquoise2" }, + { 0*C, 197*C, 205*C, "turquoise3" }, + { 0*C, 134*C, 139*C, "turquoise4" }, + { 238*C, 130*C, 238*C, "violet" }, + { 208*C, 32*C, 144*C, "violet red" }, + { 208*C, 32*C, 144*C, "VioletRed" }, + { 255*C, 62*C, 150*C, "VioletRed1" }, + { 238*C, 58*C, 140*C, "VioletRed2" }, + { 205*C, 50*C, 120*C, "VioletRed3" }, + { 139*C, 34*C, 82*C, "VioletRed4" }, + { 245*C, 222*C, 179*C, "wheat" }, + { 255*C, 231*C, 186*C, "wheat1" }, + { 238*C, 216*C, 174*C, "wheat2" }, + { 205*C, 186*C, 150*C, "wheat3" }, + { 139*C, 126*C, 102*C, "wheat4" }, + { 255*C, 255*C, 255*C, "white" }, + { 245*C, 245*C, 245*C, "white smoke" }, + { 245*C, 245*C, 245*C, "WhiteSmoke" }, + { 255*C, 255*C, 0*C, "yellow" }, + { 154*C, 205*C, 50*C, "yellow green" }, + { 255*C, 255*C, 0*C, "yellow1" }, + { 238*C, 238*C, 0*C, "yellow2" }, + { 205*C, 205*C, 0*C, "yellow3" }, + { 139*C, 139*C, 0*C, "yellow4" }, + { 154*C, 205*C, 50*C, "YellowGreen" } }; #undef C diff --git a/xc/programs/Xserver/hw/kdrive/kdrive.c b/xc/programs/Xserver/hw/kdrive/kdrive.c index e3bcb9665..d88e95d9f 100644 --- a/xc/programs/Xserver/hw/kdrive/kdrive.c +++ b/xc/programs/Xserver/hw/kdrive/kdrive.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/kdrive.c,v 1.11 2000/12/08 22:59:37 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.12 2001/03/30 02:15:20 keithp Exp $ */ #include "kdrive.h" #ifdef PSEUDO8 @@ -30,6 +30,10 @@ #include <mivalidate.h> #include <dixstruct.h> +#ifdef XV +#include "kxv.h" +#endif + CARD8 kdBpp[] = { 1, 4, 8, 16, 24, 32 }; #define NUM_KD_BPP (sizeof (kdBpp) / sizeof (kdBpp[0])) @@ -243,6 +247,7 @@ KdEnableScreen (ScreenPtr pScreen) KdSetRootClip (pScreen, TRUE); if (pScreenPriv->card->cfuncs->dpms) (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState); + return TRUE; } void @@ -755,6 +760,8 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) miInitializeBackingStore (pScreen); #endif #endif + + /* * Wrap CloseScreen, the order now is: * KdCloseScreen @@ -811,7 +818,6 @@ KdInitScreen (ScreenInfo *pScreenInfo, char **argv) { KdCardInfo *card = screen->card; - int i; (*card->cfuncs->scrinit) (screen); @@ -927,6 +933,8 @@ KdAddScreen (ScreenInfo *pScreenInfo, AddScreen (KdScreenInit, argc, argv); } +#if 0 /* This function is not used currently */ + int KdDepthToFb (ScreenPtr pScreen, int depth) { @@ -938,12 +946,13 @@ KdDepthToFb (ScreenPtr pScreen, int depth) return fb; } +#endif + void KdInitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) { - int i; KdCardInfo *card; KdScreenInfo *screen; diff --git a/xc/programs/Xserver/hw/kdrive/kdrive.h b/xc/programs/Xserver/hw/kdrive/kdrive.h index d46bbe179..1d4690213 100644 --- a/xc/programs/Xserver/hw/kdrive/kdrive.h +++ b/xc/programs/Xserver/hw/kdrive/kdrive.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/kdrive.h,v 1.12 2000/12/08 22:59:37 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.13 2001/03/30 02:15:20 keithp Exp $ */ #include <stdio.h> #include "X.h" @@ -67,6 +67,7 @@ typedef struct _KdCardAttr { CARD32 io; CARD32 address[KD_MAX_CARD_ADDRESS]; int naddr; + int bus; } KdCardAttr; typedef struct _KdCardInfo { @@ -612,3 +613,6 @@ KdFrameBufferValid (CARD8 *base, int size); int KdFrameBufferSize (CARD8 *base, int max); +/* function prototypes to be imlpemented by the drivers */ +void +InitCard (char *name); diff --git a/xc/programs/Xserver/hw/kdrive/kinput.c b/xc/programs/Xserver/hw/kdrive/kinput.c index f2dfdb25b..4582b5ca7 100644 --- a/xc/programs/Xserver/hw/kdrive/kinput.c +++ b/xc/programs/Xserver/hw/kdrive/kinput.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/kinput.c,v 1.12 2001/01/23 06:25:05 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.13 2001/03/30 02:15:20 keithp Exp $ */ #include "kdrive.h" #include "inputstr.h" @@ -48,8 +48,8 @@ static Bool kdInputEnabled; static Bool kdOffScreen; static unsigned long kdOffScreenTime; static KdMouseMatrix kdMouseMatrix = { - 1, 0, 0, - 0, 1, 0 + { { 1, 0, 0 }, + { 0, 1, 0 } } }; #ifdef TOUCHSCREEN @@ -403,29 +403,29 @@ KdInitAutoRepeats (void) } const KdKeySymModsRec kdKeySymMods[] = { - XK_Control_L, ControlMask, - XK_Control_R, ControlMask, - XK_Shift_L, ShiftMask, - XK_Shift_R, ShiftMask, - XK_Caps_Lock, LockMask, - XK_Shift_Lock, LockMask, - XK_Alt_L, Mod1Mask, - XK_Alt_R, Mod1Mask, - XK_Meta_L, Mod1Mask, - XK_Meta_R, Mod1Mask, - XK_Num_Lock, Mod2Mask, - XK_Super_L, Mod3Mask, - XK_Super_R, Mod3Mask, - XK_Hyper_L, Mod3Mask, - XK_Hyper_R, Mod3Mask, - XK_Mode_switch, Mod4Mask, + { XK_Control_L, ControlMask }, + { XK_Control_R, ControlMask }, + { XK_Shift_L, ShiftMask }, + { XK_Shift_R, ShiftMask }, + { XK_Caps_Lock, LockMask }, + { XK_Shift_Lock, LockMask }, + { XK_Alt_L, Mod1Mask }, + { XK_Alt_R, Mod1Mask }, + { XK_Meta_L, Mod1Mask }, + { XK_Meta_R, Mod1Mask }, + { XK_Num_Lock, Mod2Mask }, + { XK_Super_L, Mod3Mask }, + { XK_Super_R, Mod3Mask }, + { XK_Hyper_L, Mod3Mask }, + { XK_Hyper_R, Mod3Mask }, + { XK_Mode_switch, Mod4Mask }, #ifdef TOUCHSCREEN /* PDA specific hacks */ - XF86XK_Start, ControlMask, - XK_Menu, ShiftMask, - XK_telephone, Mod1Mask, - XF86XK_AudioRecord, Mod2Mask, - XF86XK_Calendar, Mod3Mask, + { XF86XK_Start, ControlMask }, + { XK_Menu, ShiftMask }, + { XK_telephone, Mod1Mask }, + { XF86XK_AudioRecord, Mod2Mask }, + { XF86XK_Calendar, Mod3Mask } #endif }; @@ -787,6 +787,7 @@ int kdEmulationDx, kdEmulationDy; #define EventX(e) ((e)->u.keyButtonPointer.rootX) #define EventY(e) ((e)->u.keyButtonPointer.rootY) +int KdInsideEmulationWindow (xEvent *ev) { if (ev->u.keyButtonPointer.pad1) @@ -829,6 +830,7 @@ KdClassifyInput (xEvent *ev) default: return keyboard; } + return keyboard; } #ifndef NDEBUG diff --git a/xc/programs/Xserver/hw/kdrive/kmap.c b/xc/programs/Xserver/hw/kdrive/kmap.c index 37c56501b..0f96cca96 100644 --- a/xc/programs/Xserver/hw/kdrive/kmap.c +++ b/xc/programs/Xserver/hw/kdrive/kmap.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/kmap.c,v 1.6 2000/12/13 18:06:54 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kmap.c,v 1.7 2001/03/30 02:15:20 keithp Exp $ */ #include "kdrive.h" @@ -38,6 +38,8 @@ #include <asm/mtrr.h> #endif +#include <sys/ioctl.h> + void * KdMapDevice (CARD32 addr, CARD32 size) { diff --git a/xc/programs/Xserver/hw/kdrive/kmode.c b/xc/programs/Xserver/hw/kdrive/kmode.c index e6cba64e8..60e282542 100644 --- a/xc/programs/Xserver/hw/kdrive/kmode.c +++ b/xc/programs/Xserver/hw/kdrive/kmode.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/kdrive/kmode.c,v 1.5 2000/05/24 23:57:56 keithp Exp $ + * $XFree86: xc/programs/Xserver/hw/kdrive/kmode.c,v 1.6 2001/03/30 02:15:20 keithp Exp $ * * Copyright 1999 SuSE, Inc. * @@ -41,6 +41,14 @@ const KdMonitorTiming kdMonitorTimings[] = { 36, 108, 216, KdSyncNegative, /* 37.927 */ 1, 42, 46, KdSyncPositive, /* 85.039 */ }, + + + /* Modeline "720x576" 29.000 720 736 800 880 576 577 580 625 */ + { + 720, 576, 52, 32954, /* PAL Video */ + 16, 80, 160, KdSyncPositive, /* 32.954 */ + 1, 45, 49, KdSyncPositive, /* 52.727 */ + }, /* 640x480 modes */ { 640, 480, 85, 36000, /* VESA */ diff --git a/xc/programs/Xserver/hw/kdrive/kxv.c b/xc/programs/Xserver/hw/kdrive/kxv.c new file mode 100644 index 000000000..27eb7ddb5 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/kxv.c @@ -0,0 +1,1784 @@ +/* + + XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) + Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com> + + Copyright (C) 2000, 2001 - Nokia Home Communications + Copyright (C) 1998, 1999 - The XFree86 Project Inc. + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +*/ + +/* $XFree86: xc/programs/Xserver/hw/kdrive/kxv.c,v 1.1 2001/03/30 02:18:41 keithp Exp $ */ + +#include "kdrive.h" + +#include "scrnintstr.h" +#include "regionstr.h" +#include "windowstr.h" +#include "pixmapstr.h" +#include "mivalidate.h" +#include "validate.h" +#include "resource.h" +#include "gcstruct.h" +#include "dixstruct.h" + +#include "Xv.h" +#include "Xvproto.h" + +#include "kxv.h" + + +/* XvScreenRec fields */ + +static Bool KdXVCloseScreen(int, ScreenPtr); +static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *); + +/* XvAdaptorRec fields */ + +static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*); +static int KdXVFreePort(XvPortPtr); +static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, + INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16); +static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, + INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16); +static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, + INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16); +static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, + INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16); +static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr); +static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32); +static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *); +static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8, + CARD16, CARD16,CARD16, CARD16, + unsigned int*, unsigned int*); +static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, + INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, + XvImagePtr, unsigned char*, Bool, + CARD16, CARD16); +static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, + CARD16*, CARD16*, int*, int*); + + +/* ScreenRec fields */ + +static Bool KdXVCreateWindow(WindowPtr pWin); +static Bool KdXVDestroyWindow(WindowPtr pWin); +static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2); +static void KdXVClipNotify(WindowPtr pWin, int dx, int dy); + +/* KdCardInfo functions */ +static Bool KdXVEnable(ScreenPtr); +static void KdXVDisable(ScreenPtr); + +/* misc */ + +static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int); + + +int KdXVWindowIndex = -1; +int KdXvScreenIndex = -1; +static unsigned long KdXVGeneration = 0; +static unsigned long PortResource = 0; + +int (*XvGetScreenIndexProc)(void) = XvGetScreenIndex; +unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort; +int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit; + +#define GET_XV_SCREEN(pScreen) \ + ((XvScreenPtr)((pScreen)->devPrivates[KdXvScreenIndex].ptr)) + +#define GET_KDXV_SCREEN(pScreen) \ + ((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) + +#define GET_KDXV_WINDOW(pWin) \ + ((KdXVWindowPtr)((pWin)->devPrivates[KdXVWindowIndex].ptr)) + +static KdXVInitGenericAdaptorPtr *GenDrivers = NULL; +static int NumGenDrivers = 0; + +int +KdXVRegisterGenericAdaptorDriver( + KdXVInitGenericAdaptorPtr InitFunc +){ + KdXVInitGenericAdaptorPtr *newdrivers; + +/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */ + + newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * + (1 + NumGenDrivers)); + if (!newdrivers) + return 0; + GenDrivers = newdrivers; + + GenDrivers[NumGenDrivers++] = InitFunc; + + return 1; +} + +int +KdXVListGenericAdaptors( + KdScreenInfo * screen, + KdVideoAdaptorPtr **adaptors +){ + int i,j,n,num; + KdVideoAdaptorPtr *DrivAdap,*new; + + num = 0; + *adaptors = NULL; + for (i = 0; i < NumGenDrivers; i++) { + n = GenDrivers[i](screen,&DrivAdap); + if (0 == n) + continue; + new = xrealloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num+n)); + if (NULL == new) + continue; + *adaptors = new; + for (j = 0; j < n; j++, num++) + (*adaptors)[num] = DrivAdap[j]; + } + return num; +} + +KdVideoAdaptorPtr +KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen) +{ + return xcalloc(1, sizeof(KdVideoAdaptorRec)); +} + +void +KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr) +{ + xfree(ptr); +} + + +Bool +KdXVScreenInit( + ScreenPtr pScreen, + KdVideoAdaptorPtr *adaptors, + int num +){ + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + KdXVScreenPtr ScreenPriv; + XvScreenPtr pxvs; + +/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */ + + if(KdXVGeneration != serverGeneration) { + if((KdXVWindowIndex = AllocateWindowPrivateIndex()) < 0) + return FALSE; + KdXVGeneration = serverGeneration; + } + + if(!AllocateWindowPrivate(pScreen,KdXVWindowIndex,sizeof(KdXVWindowRec))) + return FALSE; + + if(!XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc) + return FALSE; + + if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; + + KdXvScreenIndex = (*XvGetScreenIndexProc)(); + PortResource = (*XvGetRTPortProc)(); + + pxvs = GET_XV_SCREEN(pScreen); + + + /* Anyone initializing the Xv layer must provide these two. + The Xv di layer calls them without even checking if they exist! */ + + pxvs->ddCloseScreen = KdXVCloseScreen; + pxvs->ddQueryAdaptors = KdXVQueryAdaptors; + + /* The Xv di layer provides us with a private hook so that we don't + have to allocate our own screen private. They also provide + a CloseScreen hook so that we don't have to wrap it. I'm not + sure that I appreciate that. */ + + ScreenPriv = xalloc(sizeof(KdXVScreenRec)); + pxvs->devPriv.ptr = (pointer)ScreenPriv; + + if(!ScreenPriv) return FALSE; + + + ScreenPriv->CreateWindow = pScreen->CreateWindow; + ScreenPriv->DestroyWindow = pScreen->DestroyWindow; + ScreenPriv->WindowExposures = pScreen->WindowExposures; + ScreenPriv->ClipNotify = pScreen->ClipNotify; + +/* fprintf(stderr,"XV: Wrapping screen & card funcs\n"); */ + + ScreenPriv->enable = card->cfuncs->enable; + ScreenPriv->disable = card->cfuncs->disable; + + pScreen->CreateWindow = KdXVCreateWindow; + pScreen->DestroyWindow = KdXVDestroyWindow; + pScreen->WindowExposures = KdXVWindowExposures; + pScreen->ClipNotify = KdXVClipNotify; + + card->cfuncs->disable = KdXVDisable; + card->cfuncs->enable = KdXVEnable; + + if(!KdXVInitAdaptors(pScreen, adaptors, num)) + return FALSE; + + return TRUE; +} + +static void +KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) +{ + int i; + + if(pAdaptor->name) + xfree(pAdaptor->name); + + if(pAdaptor->pEncodings) { + XvEncodingPtr pEncode = pAdaptor->pEncodings; + + for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) { + if(pEncode->name) xfree(pEncode->name); + } + xfree(pAdaptor->pEncodings); + } + + if(pAdaptor->pFormats) + xfree(pAdaptor->pFormats); + + if(pAdaptor->pPorts) { + XvPortPtr pPort = pAdaptor->pPorts; + XvPortRecPrivatePtr pPriv; + + for(i = 0; i < pAdaptor->nPorts; i++, pPort++) { + pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; + if(pPriv) { + if(pPriv->clientClip) + REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip); + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) + REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip); + xfree(pPriv); + } + } + xfree(pAdaptor->pPorts); + } + + if(pAdaptor->nAttributes) { + XvAttributePtr pAttribute = pAdaptor->pAttributes; + + for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) { + if(pAttribute->name) xfree(pAttribute->name); + } + + xfree(pAdaptor->pAttributes); + } + + if(pAdaptor->nImages) + xfree(pAdaptor->pImages); + + if(pAdaptor->devPriv.ptr) + xfree(pAdaptor->devPriv.ptr); +} + +static Bool +KdXVInitAdaptors( + ScreenPtr pScreen, + KdVideoAdaptorPtr *infoPtr, + int number +) { + KdScreenPriv(pScreen); + KdScreenInfo * screen = pScreenPriv->screen; + + XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); + KdVideoAdaptorPtr adaptorPtr; + XvAdaptorPtr pAdaptor, pa; + XvAdaptorRecPrivatePtr adaptorPriv; + int na, numAdaptor; + XvPortRecPrivatePtr portPriv; + XvPortPtr pPort, pp; + int numPort; + KdAttributePtr attributePtr; + XvAttributePtr pAttribute, pat; + KdVideoFormatPtr formatPtr; + XvFormatPtr pFormat, pf; + int numFormat, totFormat; + KdVideoEncodingPtr encodingPtr; + XvEncodingPtr pEncode, pe; + KdImagePtr imagePtr; + XvImagePtr pImage, pi; + int numVisuals; + VisualPtr pVisual; + int i; + + pxvs->nAdaptors = 0; + pxvs->pAdaptors = NULL; + + if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) + return FALSE; + + for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) { + adaptorPtr = infoPtr[na]; + + if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute || + !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize) + continue; + + /* client libs expect at least one encoding */ + if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings) + continue; + + pa->type = adaptorPtr->type; + + if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo) + pa->type &= ~XvVideoMask; + + if(!adaptorPtr->PutStill && !adaptorPtr->GetStill) + pa->type &= ~XvStillMask; + + if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes) + pa->type &= ~XvImageMask; + + if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && + !adaptorPtr->PutStill) + pa->type &= ~XvInputMask; + + if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill) + pa->type &= ~XvOutputMask; + + if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) + continue; + if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) + continue; + + pa->pScreen = pScreen; + pa->ddAllocatePort = KdXVAllocatePort; + pa->ddFreePort = KdXVFreePort; + pa->ddPutVideo = KdXVPutVideo; + pa->ddPutStill = KdXVPutStill; + pa->ddGetVideo = KdXVGetVideo; + pa->ddGetStill = KdXVGetStill; + pa->ddStopVideo = KdXVStopVideo; + pa->ddPutImage = KdXVPutImage; + pa->ddSetPortAttribute = KdXVSetPortAttribute; + pa->ddGetPortAttribute = KdXVGetPortAttribute; + pa->ddQueryBestSize = KdXVQueryBestSize; + pa->ddQueryImageAttributes = KdXVQueryImageAttributes; + if((pa->name = xalloc(strlen(adaptorPtr->name) + 1))) + strcpy(pa->name, adaptorPtr->name); + + if(adaptorPtr->nEncodings && + (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { + + for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; + i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) + { + pe->id = encodingPtr->id; + pe->pScreen = pScreen; + if((pe->name = xalloc(strlen(encodingPtr->name) + 1))) + strcpy(pe->name, encodingPtr->name); + pe->width = encodingPtr->width; + pe->height = encodingPtr->height; + pe->rate.numerator = encodingPtr->rate.numerator; + pe->rate.denominator = encodingPtr->rate.denominator; + } + pa->nEncodings = adaptorPtr->nEncodings; + pa->pEncodings = pEncode; + } + + if(adaptorPtr->nImages && + (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { + + for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; + i < adaptorPtr->nImages; i++, pi++, imagePtr++) + { + pi->id = imagePtr->id; + pi->type = imagePtr->type; + pi->byte_order = imagePtr->byte_order; + memcpy(pi->guid, imagePtr->guid, 16); + pi->bits_per_pixel = imagePtr->bits_per_pixel; + pi->format = imagePtr->format; + pi->num_planes = imagePtr->num_planes; + pi->depth = imagePtr->depth; + pi->red_mask = imagePtr->red_mask; + pi->green_mask = imagePtr->green_mask; + pi->blue_mask = imagePtr->blue_mask; + pi->y_sample_bits = imagePtr->y_sample_bits; + pi->u_sample_bits = imagePtr->u_sample_bits; + pi->v_sample_bits = imagePtr->v_sample_bits; + pi->horz_y_period = imagePtr->horz_y_period; + pi->horz_u_period = imagePtr->horz_u_period; + pi->horz_v_period = imagePtr->horz_v_period; + pi->vert_y_period = imagePtr->vert_y_period; + pi->vert_u_period = imagePtr->vert_u_period; + pi->vert_v_period = imagePtr->vert_v_period; + memcpy(pi->component_order, imagePtr->component_order, 32); + pi->scanline_order = imagePtr->scanline_order; + } + pa->nImages = adaptorPtr->nImages; + pa->pImages = pImage; + } + + if(adaptorPtr->nAttributes && + (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) + { + for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; + i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) + { + pat->flags = attributePtr->flags; + pat->min_value = attributePtr->min_value; + pat->max_value = attributePtr->max_value; + if((pat->name = xalloc(strlen(attributePtr->name) + 1))) + strcpy(pat->name, attributePtr->name); + } + pa->nAttributes = adaptorPtr->nAttributes; + pa->pAttributes = pAttribute; + } + + + totFormat = adaptorPtr->nFormats; + + if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) { + KdXVFreeAdaptor(pa); + continue; + } + for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; + i < adaptorPtr->nFormats; i++, formatPtr++) + { + numVisuals = pScreen->numVisuals; + pVisual = pScreen->visuals; + + while(numVisuals--) { + if((pVisual->class == formatPtr->class) && + (pVisual->nplanes == formatPtr->depth)) { + + if(numFormat >= totFormat) { + void *moreSpace; + totFormat *= 2; + moreSpace = xrealloc(pFormat, + totFormat * sizeof(XvFormatRec)); + if(!moreSpace) break; + pFormat = moreSpace; + pf = pFormat + numFormat; + } + + pf->visual = pVisual->vid; + pf->depth = formatPtr->depth; + + pf++; + numFormat++; + } + pVisual++; + } + } + pa->nFormats = numFormat; + pa->pFormats = pFormat; + if(!numFormat) { + KdXVFreeAdaptor(pa); + continue; + } + + if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) { + KdXVFreeAdaptor(pa); + continue; + } + + adaptorPriv->flags = adaptorPtr->flags; + adaptorPriv->PutVideo = adaptorPtr->PutVideo; + adaptorPriv->PutStill = adaptorPtr->PutStill; + adaptorPriv->GetVideo = adaptorPtr->GetVideo; + adaptorPriv->GetStill = adaptorPtr->GetStill; + adaptorPriv->StopVideo = adaptorPtr->StopVideo; + adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute; + adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute; + adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize; + adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes; + adaptorPriv->PutImage = adaptorPtr->PutImage; + adaptorPriv->ReputImage = adaptorPtr->ReputImage; + + pa->devPriv.ptr = (pointer)adaptorPriv; + + if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) { + KdXVFreeAdaptor(pa); + continue; + } + for(pp = pPort, i = 0, numPort = 0; + i < adaptorPtr->nPorts; i++) { + + if(!(pp->id = FakeClientID(0))) + continue; + + if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) + continue; + + if(!AddResource(pp->id, PortResource, pp)) { + xfree(portPriv); + continue; + } + + pp->pAdaptor = pa; + pp->pNotify = (XvPortNotifyPtr)NULL; + pp->pDraw = (DrawablePtr)NULL; + pp->client = (ClientPtr)NULL; + pp->grab.client = (ClientPtr)NULL; + pp->time = currentTime; + pp->devPriv.ptr = portPriv; + + portPriv->screen = screen; + portPriv->AdaptorRec = adaptorPriv; + portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr; + + pp++; + numPort++; + } + pa->nPorts = numPort; + pa->pPorts = pPort; + if(!numPort) { + KdXVFreeAdaptor(pa); + continue; + } + + pa->base_id = pPort->id; + + pa++; + numAdaptor++; + } + + if(numAdaptor) { + pxvs->nAdaptors = numAdaptor; + pxvs->pAdaptors = pAdaptor; + } else { + xfree(pAdaptor); + return FALSE; + } + + return TRUE; +} + +/* Video should be clipped to the intersection of the window cliplist + and the client cliplist specified in the GC for which the video was + initialized. When we need to reclip a window, the GC that started + the video may not even be around anymore. That's why we save the + client clip from the GC when the video is initialized. We then + use KdXVUpdateCompositeClip to calculate the new composite clip + when we need it. This is different from what DEC did. They saved + the GC and used it's clip list when they needed to reclip the window, + even if the client clip was different from the one the video was + initialized with. If the original GC was destroyed, they had to stop + the video. I like the new method better (MArk). + + This function only works for windows. Will need to rewrite when + (if) we support pixmap rendering. +*/ + +static void +KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) +{ + RegionPtr pregWin, pCompositeClip; + WindowPtr pWin; + Bool freeCompClip = FALSE; + + if(portPriv->pCompositeClip) + return; + + pWin = (WindowPtr)portPriv->pDraw; + + /* get window clip list */ + if(portPriv->subWindowMode == IncludeInferiors) { + pregWin = NotClippedByChildren(pWin); + freeCompClip = TRUE; + } else + pregWin = &pWin->clipList; + + if(!portPriv->clientClip) { + portPriv->pCompositeClip = pregWin; + portPriv->FreeCompositeClip = freeCompClip; + return; + } + + pCompositeClip = REGION_CREATE(pWin->pScreen, NullBox, 1); + REGION_COPY(pWin->pScreen, pCompositeClip, portPriv->clientClip); + REGION_TRANSLATE(pWin->pScreen, pCompositeClip, + portPriv->pDraw->x + portPriv->clipOrg.x, + portPriv->pDraw->y + portPriv->clipOrg.y); + REGION_INTERSECT(pWin->pScreen, pCompositeClip, pregWin, pCompositeClip); + + portPriv->pCompositeClip = pCompositeClip; + portPriv->FreeCompositeClip = TRUE; + + if(freeCompClip) { + REGION_DESTROY(pWin->pScreen, pregWin); + } +} + +/* Save the current clientClip and update the CompositeClip whenever + we have a fresh GC */ + +static void +KdXVCopyClip( + XvPortRecPrivatePtr portPriv, + GCPtr pGC +){ + /* copy the new clip if it exists */ + if((pGC->clientClipType == CT_REGION) && pGC->clientClip) { + if(!portPriv->clientClip) + portPriv->clientClip = REGION_CREATE(pGC->pScreen, NullBox, 1); + /* Note: this is in window coordinates */ + REGION_COPY(pGC->pScreen, portPriv->clientClip, pGC->clientClip); + } else if(portPriv->clientClip) { /* free the old clientClip */ + REGION_DESTROY(pGC->pScreen, portPriv->clientClip); + portPriv->clientClip = NULL; + } + + /* get rid of the old clip list */ + if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) { + REGION_DESTROY(pWin->pScreen, portPriv->pCompositeClip); + } + + portPriv->clipOrg = pGC->clipOrg; + portPriv->pCompositeClip = pGC->pCompositeClip; + portPriv->FreeCompositeClip = FALSE; + portPriv->subWindowMode = pGC->subWindowMode; +} + +static int +KdXVRegetVideo(XvPortRecPrivatePtr portPriv) +{ + RegionRec WinRegion; + RegionRec ClipRegion; + BoxRec WinBox; + ScreenPtr pScreen = portPriv->pDraw->pScreen; + int ret = Success; + Bool clippedAway = FALSE; + + KdXVUpdateCompositeClip(portPriv); + + /* translate the video region to the screen */ + WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; + WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; + WinBox.x2 = WinBox.x1 + portPriv->drw_w; + WinBox.y2 = WinBox.y1 + portPriv->drw_h; + + /* clip to the window composite clip */ + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); + REGION_INIT(pScreen, &ClipRegion, NullBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + + /* that's all if it's totally obscured */ + if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { + clippedAway = TRUE; + goto CLIP_VIDEO_BAILOUT; + } + + if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { + REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); + } + + ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, + portPriv->vid_x, portPriv->vid_y, + WinBox.x1, WinBox.y1, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, + &ClipRegion, portPriv->DevPriv.ptr); + + if(ret == Success) + portPriv->isOn = XV_ON; + +CLIP_VIDEO_BAILOUT: + + if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) { + (*portPriv->AdaptorRec->StopVideo)( + portPriv->screen, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; + } + + /* This clip was copied and only good for one shot */ + if(!portPriv->FreeCompositeClip) + portPriv->pCompositeClip = NULL; + + REGION_UNINIT(pScreen, &WinRegion); + REGION_UNINIT(pScreen, &ClipRegion); + + return ret; +} + + +static int +KdXVReputVideo(XvPortRecPrivatePtr portPriv) +{ + RegionRec WinRegion; + RegionRec ClipRegion; + BoxRec WinBox; + ScreenPtr pScreen = portPriv->pDraw->pScreen; + KdScreenPriv(pScreen); + KdScreenInfo *screen=pScreenPriv->screen; + int ret = Success; + Bool clippedAway = FALSE; + + KdXVUpdateCompositeClip(portPriv); + + /* translate the video region to the screen */ + WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; + WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; + WinBox.x2 = WinBox.x1 + portPriv->drw_w; + WinBox.y2 = WinBox.y1 + portPriv->drw_h; + + /* clip to the window composite clip */ + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); + REGION_INIT(pScreen, &ClipRegion, NullBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + + /* clip and translate to the viewport */ + if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { + RegionRec VPReg; + BoxRec VPBox; + + VPBox.x1 = 0; + VPBox.y1 = 0; + VPBox.x2 = screen->width; + VPBox.y2 = screen->height; + + REGION_INIT(pScreen, &VPReg, &VPBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_UNINIT(pScreen, &VPReg); + } + + /* that's all if it's totally obscured */ + if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { + clippedAway = TRUE; + goto CLIP_VIDEO_BAILOUT; + } + + /* bailout if we have to clip but the hardware doesn't support it */ + if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { + BoxPtr clipBox = REGION_RECTS(&ClipRegion); + if( (REGION_NUM_RECTS(&ClipRegion) != 1) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + { + clippedAway = TRUE; + goto CLIP_VIDEO_BAILOUT; + } + } + + if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { + REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); + } + + ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, + portPriv->vid_x, portPriv->vid_y, + WinBox.x1, WinBox.y1, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, + &ClipRegion, portPriv->DevPriv.ptr); + + if(ret == Success) portPriv->isOn = XV_ON; + +CLIP_VIDEO_BAILOUT: + + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { + (*portPriv->AdaptorRec->StopVideo)( + portPriv->screen, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; + } + + /* This clip was copied and only good for one shot */ + if(!portPriv->FreeCompositeClip) + portPriv->pCompositeClip = NULL; + + REGION_UNINIT(pScreen, &WinRegion); + REGION_UNINIT(pScreen, &ClipRegion); + + return ret; +} + +static int +KdXVReputImage(XvPortRecPrivatePtr portPriv) +{ + RegionRec WinRegion; + RegionRec ClipRegion; + BoxRec WinBox; + ScreenPtr pScreen = portPriv->pDraw->pScreen; + KdScreenPriv(pScreen); + KdScreenInfo *screen=pScreenPriv->screen; + int ret = Success; + Bool clippedAway = FALSE; + + KdXVUpdateCompositeClip(portPriv); + + /* translate the video region to the screen */ + WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; + WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; + WinBox.x2 = WinBox.x1 + portPriv->drw_w; + WinBox.y2 = WinBox.y1 + portPriv->drw_h; + + /* clip to the window composite clip */ + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); + REGION_INIT(pScreen, &ClipRegion, NullBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + + /* clip and translate to the viewport */ + if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { + RegionRec VPReg; + BoxRec VPBox; + + VPBox.x1 = 0; + VPBox.y1 = 0; + VPBox.x2 = screen->width; + VPBox.y2 = screen->height; + + REGION_INIT(pScreen, &VPReg, &VPBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_UNINIT(pScreen, &VPReg); + } + + /* that's all if it's totally obscured */ + if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { + clippedAway = TRUE; + goto CLIP_VIDEO_BAILOUT; + } + + /* bailout if we have to clip but the hardware doesn't support it */ + if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { + BoxPtr clipBox = REGION_RECTS(&ClipRegion); + if( (REGION_NUM_RECTS(&ClipRegion) != 1) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + { + clippedAway = TRUE; + goto CLIP_VIDEO_BAILOUT; + } + } + + if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { + REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); + } + + ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->screen, + WinBox.x1, WinBox.y1, + &ClipRegion, portPriv->DevPriv.ptr); + + portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF; + +CLIP_VIDEO_BAILOUT: + + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { + (*portPriv->AdaptorRec->StopVideo)( + portPriv->screen, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; + } + + /* This clip was copied and only good for one shot */ + if(!portPriv->FreeCompositeClip) + portPriv->pCompositeClip = NULL; + + REGION_UNINIT(pScreen, &WinRegion); + REGION_UNINIT(pScreen, &ClipRegion); + + return ret; +} + + +static int +KdXVReputAllVideo(WindowPtr pWin, pointer data) +{ + KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin); + + while(WinPriv) { + if(WinPriv->PortRec->type == XvInputMask) + KdXVReputVideo(WinPriv->PortRec); + else + KdXVRegetVideo(WinPriv->PortRec); + WinPriv = WinPriv->next; + } + + return WT_WALKCHILDREN; +} + +static int +KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) +{ + KdXVWindowPtr winPriv, PrivRoot; + + winPriv = PrivRoot = GET_KDXV_WINDOW(pWin); + + /* Enlist our port in the window private */ + while(winPriv) { + if(winPriv->PortRec == portPriv) /* we're already listed */ + break; + winPriv = winPriv->next; + } + + if(!winPriv) { + winPriv = xalloc(sizeof(KdXVWindowRec)); + if(!winPriv) return BadAlloc; + winPriv->PortRec = portPriv; + winPriv->next = PrivRoot; + pWin->devPrivates[KdXVWindowIndex].ptr = (pointer)winPriv; + } + return Success; +} + + +static void +KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) +{ + KdXVWindowPtr winPriv, prevPriv = NULL; + + winPriv = GET_KDXV_WINDOW(pWin); + + while(winPriv) { + if(winPriv->PortRec == portPriv) { + if(prevPriv) + prevPriv->next = winPriv->next; + else + pWin->devPrivates[KdXVWindowIndex].ptr = + (pointer)winPriv->next; + xfree(winPriv); + break; + } + prevPriv = winPriv; + winPriv = winPriv->next; + } + portPriv->pDraw = NULL; +} + +/**** ScreenRec fields ****/ + + +static Bool +KdXVCreateWindow(WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen); + int ret; + + pScreen->CreateWindow = ScreenPriv->CreateWindow; + ret = (*pScreen->CreateWindow)(pWin); + pScreen->CreateWindow = KdXVCreateWindow; + + if(ret) pWin->devPrivates[KdXVWindowIndex].ptr = NULL; + + return ret; +} + + +static Bool +KdXVDestroyWindow(WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen); + KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin); + int ret; + + while(WinPriv) { + XvPortRecPrivatePtr pPriv = WinPriv->PortRec; + + if(pPriv->isOn > XV_OFF) { + (*pPriv->AdaptorRec->StopVideo)( + pPriv->screen, pPriv->DevPriv.ptr, TRUE); + pPriv->isOn = XV_OFF; + } + + pPriv->pDraw = NULL; + tmp = WinPriv; + WinPriv = WinPriv->next; + xfree(tmp); + } + + pWin->devPrivates[KdXVWindowIndex].ptr = NULL; + + pScreen->DestroyWindow = ScreenPriv->DestroyWindow; + ret = (*pScreen->DestroyWindow)(pWin); + pScreen->DestroyWindow = KdXVDestroyWindow; + + return ret; +} + + +static void +KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen); + KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin); + KdXVWindowPtr pPrev; + XvPortRecPrivatePtr pPriv; + Bool AreasExposed; + + AreasExposed = (WinPriv && reg1 && REGION_NOTEMPTY(pScreen, reg1)); + + pScreen->WindowExposures = ScreenPriv->WindowExposures; + (*pScreen->WindowExposures)(pWin, reg1, reg2); + pScreen->WindowExposures = KdXVWindowExposures; + + /* filter out XClearWindow/Area */ + if (!pWin->valdata) return; + + pPrev = NULL; + + while(WinPriv) { + pPriv = WinPriv->PortRec; + + /* Reput anyone with a reput function */ + + switch(pPriv->type) { + case XvInputMask: + KdXVReputVideo(pPriv); + break; + case XvOutputMask: + KdXVRegetVideo(pPriv); + break; + default: /* overlaid still/image*/ + if (pPriv->AdaptorRec->ReputImage) + KdXVReputImage(pPriv); + else if(AreasExposed) { + KdXVWindowPtr tmp; + + if (pPriv->isOn == XV_ON) { + (*pPriv->AdaptorRec->StopVideo)( + pPriv->screen, pPriv->DevPriv.ptr, FALSE); + pPriv->isOn = XV_PENDING; + } + pPriv->pDraw = NULL; + + if(!pPrev) + pWin->devPrivates[KdXVWindowIndex].ptr = + (pointer)(WinPriv->next); + else + pPrev->next = WinPriv->next; + tmp = WinPriv; + WinPriv = WinPriv->next; + xfree(tmp); + continue; + } + break; + } + pPrev = WinPriv; + WinPriv = WinPriv->next; + } +} + + +static void +KdXVClipNotify(WindowPtr pWin, int dx, int dy) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen); + KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin); + KdXVWindowPtr tmp, pPrev = NULL; + XvPortRecPrivatePtr pPriv; + Bool visible = (pWin->visibility == VisibilityUnobscured) || + (pWin->visibility == VisibilityPartiallyObscured); + + while(WinPriv) { + pPriv = WinPriv->PortRec; + + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) + REGION_DESTROY(pScreen, pPriv->pCompositeClip); + + pPriv->pCompositeClip = NULL; + + /* Stop everything except images, but stop them too if the + window isn't visible. But we only remove the images. */ + + if(pPriv->type || !visible) { + if(pPriv->isOn == XV_ON) { + (*pPriv->AdaptorRec->StopVideo)( + pPriv->screen, pPriv->DevPriv.ptr, FALSE); + pPriv->isOn = XV_PENDING; + } + + if(!pPriv->type) { /* overlaid still/image */ + pPriv->pDraw = NULL; + + if(!pPrev) + pWin->devPrivates[KdXVWindowIndex].ptr = + (pointer)(WinPriv->next); + else + pPrev->next = WinPriv->next; + tmp = WinPriv; + WinPriv = WinPriv->next; + xfree(tmp); + continue; + } + } + + pPrev = WinPriv; + WinPriv = WinPriv->next; + } + + if(ScreenPriv->ClipNotify) { + pScreen->ClipNotify = ScreenPriv->ClipNotify; + (*pScreen->ClipNotify)(pWin, dx, dy); + pScreen->ClipNotify = KdXVClipNotify; + } +} + + + +/**** Required XvScreenRec fields ****/ + +static Bool +KdXVCloseScreen(int i, ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + KdScreenInfo *screen=pScreenPriv->screen; + XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); + KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen); + XvAdaptorPtr pa; + int c; + + if(!ScreenPriv) return TRUE; + + pScreen->CreateWindow = ScreenPriv->CreateWindow; + pScreen->DestroyWindow = ScreenPriv->DestroyWindow; + pScreen->WindowExposures = ScreenPriv->WindowExposures; + pScreen->ClipNotify = ScreenPriv->ClipNotify; + +/* fprintf(stderr,"XV: Unwrapping screen & card funcs\n"); */ + + card->cfuncs->enable = ScreenPriv->enable; + card->cfuncs->disable = ScreenPriv->disable; + + for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { + KdXVFreeAdaptor(pa); + } + + if(pxvs->pAdaptors) + xfree(pxvs->pAdaptors); + + xfree(ScreenPriv); + + + return TRUE; +} + + +static int +KdXVQueryAdaptors( + ScreenPtr pScreen, + XvAdaptorPtr *p_pAdaptors, + int *p_nAdaptors +){ + XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); + + *p_nAdaptors = pxvs->nAdaptors; + *p_pAdaptors = pxvs->pAdaptors; + + return (Success); +} + +static Bool +KdXVEnable(ScreenPtr pScreen) +{ + static int count=0; + KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen); + Bool ret; + + ret = (*ScreenPriv->enable)(pScreen); + + if(ret) WalkTree(pScreen, KdXVReputAllVideo, 0); + + return ret; +} + +static void +KdXVDisable(ScreenPtr pScreen) +{ + XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); + KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen); + XvAdaptorPtr pAdaptor; + XvPortPtr pPort; + XvPortRecPrivatePtr pPriv; + int i, j; + + for(i = 0; i < pxvs->nAdaptors; i++) { + pAdaptor = &pxvs->pAdaptors[i]; + for(j = 0; j < pAdaptor->nPorts; j++) { + pPort = &pAdaptor->pPorts[j]; + pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; + if(pPriv->isOn > XV_OFF) { + + (*pPriv->AdaptorRec->StopVideo)( + pPriv->screen, pPriv->DevPriv.ptr, TRUE); + pPriv->isOn = XV_OFF; + + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) + REGION_DESTROY(pScreen, pPriv->pCompositeClip); + + pPriv->pCompositeClip = NULL; + + if(!pPriv->type && pPriv->pDraw) { /* still */ + KdXVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv); + } + } + } + } + + (*ScreenPriv->disable)(pScreen); +} + +/**** XvAdaptorRec fields ****/ + +static int +KdXVAllocatePort( + unsigned long port, + XvPortPtr pPort, + XvPortPtr *ppPort +){ + *ppPort = pPort; + return Success; +} + +static int +KdXVFreePort(XvPortPtr pPort) +{ + return Success; +} + +static int +KdXVPutVideo( + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, + GCPtr pGC, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, + INT16 drw_x, INT16 drw_y, + CARD16 drw_w, CARD16 drw_h +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + KdScreenPriv(portPriv->screen->pScreen); + int result; + + /* No dumping video to pixmaps... For now anyhow */ + if(pDraw->type != DRAWABLE_WINDOW) { + pPort->pDraw = (DrawablePtr)NULL; + return BadAlloc; + } + + /* If we are changing windows, unregister our port in the old window */ + if(portPriv->pDraw && (portPriv->pDraw != pDraw)) + KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); + + /* Register our port with the new window */ + result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv); + if(result != Success) return result; + + portPriv->pDraw = pDraw; + portPriv->type = XvInputMask; + + /* save a copy of these parameters */ + portPriv->vid_x = vid_x; portPriv->vid_y = vid_y; + portPriv->vid_w = vid_w; portPriv->vid_h = vid_h; + portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; + portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; + + /* make sure we have the most recent copy of the clientClip */ + KdXVCopyClip(portPriv, pGC); + + /* To indicate to the DI layer that we were successful */ + pPort->pDraw = pDraw; + + if (!pScreenPriv->enabled) return Success; + + return(KdXVReputVideo(portPriv)); +} + +static int +KdXVPutStill( + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, + GCPtr pGC, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, + INT16 drw_x, INT16 drw_y, + CARD16 drw_w, CARD16 drw_h +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + ScreenPtr pScreen = pDraw->pScreen; + KdScreenPriv(pScreen); + KdScreenInfo *screen=pScreenPriv->screen; + RegionRec WinRegion; + RegionRec ClipRegion; + BoxRec WinBox; + int ret = Success; + Bool clippedAway = FALSE; + + if (pDraw->type != DRAWABLE_WINDOW) + return BadAlloc; + + if (!pScreenPriv->enabled) return Success; + + WinBox.x1 = pDraw->x + drw_x; + WinBox.y1 = pDraw->y + drw_y; + WinBox.x2 = WinBox.x1 + drw_w; + WinBox.y2 = WinBox.y1 + drw_h; + + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); + REGION_INIT(pScreen, &ClipRegion, NullBox, 1); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + + if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { + RegionRec VPReg; + BoxRec VPBox; + + VPBox.x1 = 0; + VPBox.y1 = 0; + VPBox.x2 = screen->width; + VPBox.y2 = screen->height; + + REGION_INIT(pScreen, &VPReg, &VPBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_UNINIT(pScreen, &VPReg); + } + + if(portPriv->pDraw) { + KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); + } + + if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { + clippedAway = TRUE; + goto PUT_STILL_BAILOUT; + } + + if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { + BoxPtr clipBox = REGION_RECTS(&ClipRegion); + if( (REGION_NUM_RECTS(&ClipRegion) != 1) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + { + clippedAway = TRUE; + goto PUT_STILL_BAILOUT; + } + } + + if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { + REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); + } + + ret = (*portPriv->AdaptorRec->PutStill)(portPriv->screen, + vid_x, vid_y, WinBox.x1, WinBox.y1, + vid_w, vid_h, drw_w, drw_h, + &ClipRegion, portPriv->DevPriv.ptr); + + if((ret == Success) && + (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) { + + KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv); + 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; + portPriv->type = 0; /* no mask means it's transient and should + not be reput once it's removed */ + pPort->pDraw = pDraw; /* make sure we can get stop requests */ + } + +PUT_STILL_BAILOUT: + + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { + (*portPriv->AdaptorRec->StopVideo)( + portPriv->screen, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; + } + + REGION_UNINIT(pScreen, &WinRegion); + REGION_UNINIT(pScreen, &ClipRegion); + + return ret; +} + +static int +KdXVGetVideo( + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, + GCPtr pGC, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, + INT16 drw_x, INT16 drw_y, + CARD16 drw_w, CARD16 drw_h +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + int result; + KdScreenPriv(portPriv->screen->pScreen); + + /* No pixmaps... For now anyhow */ + if(pDraw->type != DRAWABLE_WINDOW) { + pPort->pDraw = (DrawablePtr)NULL; + return BadAlloc; + } + + /* If we are changing windows, unregister our port in the old window */ + if(portPriv->pDraw && (portPriv->pDraw != pDraw)) + KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); + + /* Register our port with the new window */ + result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv); + if(result != Success) return result; + + portPriv->pDraw = pDraw; + portPriv->type = XvOutputMask; + + /* save a copy of these parameters */ + portPriv->vid_x = vid_x; portPriv->vid_y = vid_y; + portPriv->vid_w = vid_w; portPriv->vid_h = vid_h; + portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; + portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; + + /* make sure we have the most recent copy of the clientClip */ + KdXVCopyClip(portPriv, pGC); + + /* To indicate to the DI layer that we were successful */ + pPort->pDraw = pDraw; + + if(!pScreenPriv->enabled) return Success; + + return(KdXVRegetVideo(portPriv)); +} + +static int +KdXVGetStill( + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, + GCPtr pGC, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, + INT16 drw_x, INT16 drw_y, + CARD16 drw_w, CARD16 drw_h +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + ScreenPtr pScreen = pDraw->pScreen; + KdScreenPriv(pScreen); + RegionRec WinRegion; + RegionRec ClipRegion; + BoxRec WinBox; + int ret = Success; + Bool clippedAway = FALSE; + + if (pDraw->type != DRAWABLE_WINDOW) + return BadAlloc; + + if(!pScreenPriv->enabled) return Success; + + WinBox.x1 = pDraw->x + drw_x; + WinBox.y1 = pDraw->y + drw_y; + WinBox.x2 = WinBox.x1 + drw_w; + WinBox.y2 = WinBox.y1 + drw_h; + + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); + REGION_INIT(pScreen, &ClipRegion, NullBox, 1); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + + if(portPriv->pDraw) { + KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); + } + + if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { + clippedAway = TRUE; + goto GET_STILL_BAILOUT; + } + + if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { + REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); + } + + ret = (*portPriv->AdaptorRec->GetStill)(portPriv->screen, + vid_x, vid_y, WinBox.x1, WinBox.y1, + vid_w, vid_h, drw_w, drw_h, + &ClipRegion, portPriv->DevPriv.ptr); + +GET_STILL_BAILOUT: + + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { + (*portPriv->AdaptorRec->StopVideo)( + portPriv->screen, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; + } + + REGION_UNINIT(pScreen, &WinRegion); + REGION_UNINIT(pScreen, &ClipRegion); + + return ret; +} + + + +static int +KdXVStopVideo( + ClientPtr client, + XvPortPtr pPort, + DrawablePtr pDraw +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + KdScreenPriv(portPriv->screen->pScreen); + + if(pDraw->type != DRAWABLE_WINDOW) + return BadAlloc; + + KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv); + + if(!pScreenPriv->enabled) return Success; + + /* Must free resources. */ + + if(portPriv->isOn > XV_OFF) { + (*portPriv->AdaptorRec->StopVideo)( + portPriv->screen, portPriv->DevPriv.ptr, TRUE); + portPriv->isOn = XV_OFF; + } + + return Success; +} + +static int +KdXVSetPortAttribute( + ClientPtr client, + XvPortPtr pPort, + Atom attribute, + INT32 value +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + + return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen, + attribute, value, portPriv->DevPriv.ptr)); +} + + +static int +KdXVGetPortAttribute( + ClientPtr client, + XvPortPtr pPort, + Atom attribute, + INT32 *p_value +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + + return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen, + attribute, (int *) p_value, portPriv->DevPriv.ptr)); +} + + + +static int +KdXVQueryBestSize( + ClientPtr client, + XvPortPtr pPort, + CARD8 motion, + CARD16 vid_w, CARD16 vid_h, + CARD16 drw_w, CARD16 drw_h, + unsigned int *p_w, unsigned int *p_h +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + + (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen, + (Bool)motion, vid_w, vid_h, drw_w, drw_h, + p_w, p_h, portPriv->DevPriv.ptr); + + return Success; +} + + +static int +KdXVPutImage( + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, + GCPtr pGC, + INT16 src_x, INT16 src_y, + CARD16 src_w, CARD16 src_h, + INT16 drw_x, INT16 drw_y, + CARD16 drw_w, CARD16 drw_h, + XvImagePtr format, + unsigned char* data, + Bool sync, + CARD16 width, CARD16 height +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + ScreenPtr pScreen = pDraw->pScreen; + KdScreenPriv(pScreen); + KdScreenInfo *screen=pScreenPriv->screen; + RegionRec WinRegion; + RegionRec ClipRegion; + BoxRec WinBox; + int ret = Success; + Bool clippedAway = FALSE; + + if (pDraw->type != DRAWABLE_WINDOW) + return BadAlloc; + + if(!pScreenPriv->enabled) return Success; + + WinBox.x1 = pDraw->x + drw_x; + WinBox.y1 = pDraw->y + drw_y; + WinBox.x2 = WinBox.x1 + drw_w; + WinBox.y2 = WinBox.y1 + drw_h; + + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); + REGION_INIT(pScreen, &ClipRegion, NullBox, 1); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + + if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { + RegionRec VPReg; + BoxRec VPBox; + + VPBox.x1 = 0; + VPBox.y1 = 0; + VPBox.x2 = screen->width; + VPBox.y2 = screen->height; + + REGION_INIT(pScreen, &VPReg, &VPBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_UNINIT(pScreen, &VPReg); + } + + if(portPriv->pDraw) { + KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); + } + + if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { + clippedAway = TRUE; + goto PUT_IMAGE_BAILOUT; + } + + if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { + BoxPtr clipBox = REGION_RECTS(&ClipRegion); + if( (REGION_NUM_RECTS(&ClipRegion) != 1) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + { + clippedAway = TRUE; + goto PUT_IMAGE_BAILOUT; + } + } + + if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { + REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); + } + + ret = (*portPriv->AdaptorRec->PutImage)(portPriv->screen, + src_x, src_y, WinBox.x1, WinBox.y1, + src_w, src_h, drw_w, drw_h, format->id, data, width, height, + sync, &ClipRegion, portPriv->DevPriv.ptr); + + if((ret == Success) && + (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) { + + KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv); + 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; + portPriv->type = 0; /* no mask means it's transient and should + not be reput once it's removed */ + pPort->pDraw = pDraw; /* make sure we can get stop requests */ + } + +PUT_IMAGE_BAILOUT: + + if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { + (*portPriv->AdaptorRec->StopVideo)( + portPriv->screen, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; + } + + REGION_UNINIT(pScreen, &WinRegion); + REGION_UNINIT(pScreen, &ClipRegion); + + return ret; +} + + +static int +KdXVQueryImageAttributes( + ClientPtr client, + XvPortPtr pPort, + XvImagePtr format, + CARD16 *width, + CARD16 *height, + int *pitches, + int *offsets +){ + XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + + return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen, + format->id, width, height, pitches, offsets); +} + + +/**************** Offscreen surface stuff *******************/ + +typedef struct { + KdOffscreenImagePtr images; + int num; +} OffscreenImageRec; + +static OffscreenImageRec OffscreenImages[MAXSCREENS]; +static Bool offscreenInited = FALSE; + +Bool +KdXVRegisterOffscreenImages( + ScreenPtr pScreen, + KdOffscreenImagePtr images, + int num +){ + if(!offscreenInited) { + bzero(OffscreenImages, sizeof(OffscreenImages[MAXSCREENS])); + offscreenInited = TRUE; + } + + OffscreenImages[pScreen->myNum].num = num; + OffscreenImages[pScreen->myNum].images = images; + + return TRUE; +} + +KdOffscreenImagePtr +KdXVQueryOffscreenImages( + ScreenPtr pScreen, + int *num +){ + if(!offscreenInited) { + *num = 0; + return NULL; + } + + *num = OffscreenImages[pScreen->myNum].num; + return OffscreenImages[pScreen->myNum].images; +} diff --git a/xc/programs/Xserver/hw/kdrive/kxv.h b/xc/programs/Xserver/hw/kdrive/kxv.h new file mode 100644 index 000000000..a75bd529c --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/kxv.h @@ -0,0 +1,302 @@ +/* + + XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) + Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com> + + Copyright (C) 2000, 2001 - Nokia Home Communications + Copyright (C) 1998, 1999 - The XFree86 Project Inc. + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +*/ + +/* $XFree86: xc/programs/Xserver/hw/kdrive/kxv.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */ + +#ifndef _XVDIX_H_ +#define _XVDIX_H_ + +#include "scrnintstr.h" +#include "regionstr.h" +#include "windowstr.h" +#include "pixmapstr.h" +#include "mivalidate.h" +#include "validate.h" +#include "resource.h" +#include "gcstruct.h" +#include "dixstruct.h" + +#include "../../Xext/xvdix.h" + +#define VIDEO_NO_CLIPPING 0x00000001 +#define VIDEO_INVERT_CLIPLIST 0x00000002 +#define VIDEO_OVERLAID_IMAGES 0x00000004 +#define VIDEO_OVERLAID_STILLS 0x00000008 +#define VIDEO_CLIP_TO_VIEWPORT 0x00000010 + +typedef struct { + int id; + int type; + int byte_order; + unsigned char guid[16]; + int bits_per_pixel; + int format; + int num_planes; + + /* for RGB formats only */ + int depth; + unsigned int red_mask; + unsigned int green_mask; + unsigned int blue_mask; + + /* for YUV formats only */ + unsigned int y_sample_bits; + unsigned int u_sample_bits; + unsigned int v_sample_bits; + unsigned int horz_y_period; + unsigned int horz_u_period; + unsigned int horz_v_period; + unsigned int vert_y_period; + unsigned int vert_u_period; + unsigned int vert_v_period; + char component_order[32]; + int scanline_order; +} KdImageRec, *KdImagePtr; + + +typedef struct { + KdScreenInfo * screen; + int id; + unsigned short width, height; + int *pitches; /* bytes */ + int *offsets; /* in bytes from start of framebuffer */ + DevUnion devPrivate; +} KdSurfaceRec, *KdSurfacePtr; + + +typedef int (* PutVideoFuncPtr)( KdScreenInfo * screen, + short vid_x, short vid_y, short drw_x, short drw_y, + short vid_w, short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data ); +typedef int (* PutStillFuncPtr)( KdScreenInfo * screen, + short vid_x, short vid_y, short drw_x, short drw_y, + short vid_w, short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data ); +typedef int (* GetVideoFuncPtr)( KdScreenInfo * screen, + short vid_x, short vid_y, short drw_x, short drw_y, + short vid_w, short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data ); +typedef int (* GetStillFuncPtr)( KdScreenInfo * screen, + short vid_x, short vid_y, short drw_x, short drw_y, + short vid_w, short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data ); +typedef void (* StopVideoFuncPtr)(KdScreenInfo * screen, pointer data, Bool Exit); +typedef int (* SetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute, + int value, pointer data); +typedef int (* GetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute, + int *value, pointer data); +typedef void (* QueryBestSizeFuncPtr)(KdScreenInfo * screen, Bool motion, + short vid_w, short vid_h, short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data); +typedef int (* PutImageFuncPtr)( KdScreenInfo * screen, + 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 image, unsigned char* buf, short width, short height, Bool Sync, + RegionPtr clipBoxes, pointer data ); +typedef int (* ReputImageFuncPtr)( KdScreenInfo * screen, short drw_x, short drw_y, + RegionPtr clipBoxes, pointer data ); +typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen, + 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 { + int id; + char *name; + unsigned short width, height; + XvRationalRec rate; +} KdVideoEncodingRec, *KdVideoEncodingPtr; + +typedef struct { + char depth; + short class; +} KdVideoFormatRec, *KdVideoFormatPtr; + +typedef struct { + int flags; + int min_value; + int max_value; + char *name; +} KdAttributeRec, *KdAttributePtr; + +typedef struct { + unsigned int type; + int flags; + char *name; + int nEncodings; + KdVideoEncodingPtr pEncodings; + int nFormats; + KdVideoFormatPtr pFormats; + int nPorts; + DevUnion *pPortPrivates; + int nAttributes; + KdAttributePtr pAttributes; + int nImages; + KdImagePtr pImages; + PutVideoFuncPtr PutVideo; + PutStillFuncPtr PutStill; + GetVideoFuncPtr GetVideo; + GetStillFuncPtr GetStill; + StopVideoFuncPtr StopVideo; + SetPortAttributeFuncPtr SetPortAttribute; + GetPortAttributeFuncPtr GetPortAttribute; + QueryBestSizeFuncPtr QueryBestSize; + PutImageFuncPtr PutImage; + ReputImageFuncPtr ReputImage; + QueryImageAttributesFuncPtr QueryImageAttributes; +} KdVideoAdaptorRec, *KdVideoAdaptorPtr; + +typedef struct { + KdImagePtr image; + int flags; + int (*alloc_surface)(KdScreenInfo * screen, + int id, + unsigned short width, + unsigned short height, + KdSurfacePtr surface); + int (*free_surface)(KdSurfacePtr surface); + int (*display) (KdSurfacePtr surface, + short vid_x, short vid_y, + short drw_x, short drw_y, + short vid_w, short vid_h, + short drw_w, short drw_h, + RegionPtr clipBoxes); + int (*stop) (KdSurfacePtr surface); + int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value); + int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value); + int max_width; + int max_height; + int num_attributes; + KdAttributePtr attributes; +} KdOffscreenImageRec, *KdOffscreenImagePtr; + +Bool +KdXVScreenInit( + ScreenPtr pScreen, + KdVideoAdaptorPtr *Adaptors, + int num +); + +typedef int (* KdXVInitGenericAdaptorPtr)(KdScreenInfo * screen, + KdVideoAdaptorPtr **Adaptors); + +int +KdXVRegisterGenericAdaptorDriver( + KdXVInitGenericAdaptorPtr InitFunc +); + +int +KdXVListGenericAdaptors( + KdScreenInfo * screen, + KdVideoAdaptorPtr **Adaptors +); + +Bool +KdXVRegisterOffscreenImages( + ScreenPtr pScreen, + KdOffscreenImagePtr images, + int num +); + +KdOffscreenImagePtr +KdXVQueryOffscreenImages( + ScreenPtr pScreen, + int *num +); + +KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen); + +void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr); + +/*** These are DDX layer privates ***/ + + +typedef struct { + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; + ClipNotifyProcPtr ClipNotify; + WindowExposuresProcPtr WindowExposures; + void (*disable) (ScreenPtr); /* turn off rendering */ + Bool (*enable) (ScreenPtr); /* set up for rendering */ +} KdXVScreenRec, *KdXVScreenPtr; + +typedef struct { + int flags; + PutVideoFuncPtr PutVideo; + PutStillFuncPtr PutStill; + GetVideoFuncPtr GetVideo; + GetStillFuncPtr GetStill; + StopVideoFuncPtr StopVideo; + SetPortAttributeFuncPtr SetPortAttribute; + GetPortAttributeFuncPtr GetPortAttribute; + QueryBestSizeFuncPtr QueryBestSize; + PutImageFuncPtr PutImage; + ReputImageFuncPtr ReputImage; + QueryImageAttributesFuncPtr QueryImageAttributes; +} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr; + +typedef struct { + KdScreenInfo * screen; + DrawablePtr pDraw; + unsigned char type; + unsigned int subWindowMode; + DDXPointRec clipOrg; + RegionPtr clientClip; + RegionPtr pCompositeClip; + Bool FreeCompositeClip; + XvAdaptorRecPrivatePtr AdaptorRec; + XvStatus isOn; + Bool moved; + int vid_x, vid_y, vid_w, vid_h; + int drw_x, drw_y, drw_w, drw_h; + DevUnion DevPriv; +} XvPortRecPrivate, *XvPortRecPrivatePtr; + +typedef struct _KdXVWindowRec{ + XvPortRecPrivatePtr PortRec; + struct _KdXVWindowRec *next; +} KdXVWindowRec, *KdXVWindowPtr; + +#endif /* _XVDIX_H_ */ + diff --git a/xc/programs/Xserver/hw/kdrive/linux/Imakefile b/xc/programs/Xserver/hw/kdrive/linux/Imakefile index 53dd15d8e..c4d080a0e 100644 --- a/xc/programs/Xserver/hw/kdrive/linux/Imakefile +++ b/xc/programs/Xserver/hw/kdrive/linux/Imakefile @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/linux/Imakefile,v 1.4 2000/09/26 04:27:49 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/linux/Imakefile,v 1.5 2001/03/30 02:15:20 keithp Exp $ KDRIVE=.. #include "../Kdrive.tmpl" @@ -8,9 +8,9 @@ TSSRCS = ts.c TSOBJS = ts.o #endif -SRCS = keyboard.c linux.c ps2.c bus.c $(TSSRCS) +SRCS = keyboard.c linux.c ps2.c bus.c agp.c $(TSSRCS) -OBJS = keyboard.o linux.o ps2.o bus.o $(TSOBJS) +OBJS = keyboard.o linux.o ps2.o bus.o agp.o $(TSOBJS) INCLUDES = -I. $(KDINCS) diff --git a/xc/programs/Xserver/hw/kdrive/linux/agp.c b/xc/programs/Xserver/hw/kdrive/linux/agp.c new file mode 100644 index 000000000..ea34e7c40 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/linux/agp.c @@ -0,0 +1,348 @@ +/* + * Abstraction of the AGP GART interface. + * + * This version is for both Linux and FreeBSD. + * + * Copyright © 2000-2001 Nokia Home Communications + * Copyright © 2000 VA Linux Systems, Inc. + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + + */ + +/* $XFree86: xc/programs/Xserver/hw/kdrive/linux/agp.c,v 1.1 2001/03/30 02:18:41 keithp Exp $ */ + +/* + * Author: Pontus Lidman <pontus.lidman@nokia.com> (adaption to KDrive) and others + */ + +#include "X.h" + +#include "Xdefs.h" +#include "Xmd.h" + +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/ioctl.h> + +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +#include "agp.h" + +#if defined(linux) +#include <asm/ioctl.h> + +#include "../../xfree86/os-support/linux/agpgart.h" + +#elif defined(__FreeBSD__) +#include <sys/ioctl.h> +#include <sys/agpio.h> +#endif + +#ifndef AGP_DEVICE +#define AGP_DEVICE "/dev/agpgart" +#endif +/* AGP page size is independent of the host page size. */ +#ifndef AGP_PAGE_SIZE +#define AGP_PAGE_SIZE 4096 +#endif +#define AGPGART_MAJOR_VERSION 0 +#define AGPGART_MINOR_VERSION 99 + +static int gartFd = -1; +static int acquiredScreen = -1; + +/* + * Open /dev/agpgart. Keep it open until server exit. + */ + +static Bool +GARTInit() +{ + static Bool initDone = FALSE; + struct _agp_info agpinf; + + if (initDone) + return (gartFd != -1); + + initDone = TRUE; + + if (gartFd == -1) + gartFd = open(AGP_DEVICE, O_RDWR, 0); + else + return FALSE; + + if (gartFd == -1) { + fprintf(stderr, "Unable to open " AGP_DEVICE " (%s)\n", + strerror(errno)); + return FALSE; + } + + KdAcquireGART(-1); + /* Check the kernel driver version. */ + if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { + fprintf(stderr, "GARTInit: AGPIOC_INFO failed (%s)\n", + strerror(errno)); + close(gartFd); + gartFd = -1; + return FALSE; + } + KdReleaseGART(-1); + +#if defined(linux) + /* Should this look for version >= rather than version == ? */ + if (agpinf.version.major != AGPGART_MAJOR_VERSION && + agpinf.version.minor != AGPGART_MINOR_VERSION) { + fprintf(stderr, + "Kernel agpgart driver version is not current" + " (%d.%d vs %d.%d)\n", + agpinf.version.major, agpinf.version.minor, + AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION); + close(gartFd); + gartFd = -1; + return FALSE; + } +#endif + + return TRUE; +} + +Bool +KdAgpGARTSupported() +{ + return GARTInit(); +} + +AgpInfoPtr +KdGetAGPInfo(int screenNum) +{ + struct _agp_info agpinf; + AgpInfoPtr info; + + if (!GARTInit()) + return NULL; + + + if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) { + fprintf(stderr, "Failed to allocate AgpInfo\n"); + return NULL; + } + + if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { + fprintf(stderr, + "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n", + strerror(errno)); + return NULL; + } + + info->bridgeId = agpinf.bridge_id; + info->agpMode = agpinf.agp_mode; + info->base = agpinf.aper_base; + info->size = agpinf.aper_size; + info->totalPages = agpinf.pg_total; + info->systemPages = agpinf.pg_system; + info->usedPages = agpinf.pg_used; + + return info; +} + +/* + * XXX If multiple screens can acquire the GART, should we have a reference + * count instead of using acquiredScreen? + */ + +Bool +KdAcquireGART(int screenNum) +{ + if (screenNum != -1 && !GARTInit()) + return FALSE; + + if (screenNum == -1 || acquiredScreen != screenNum) { + if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) { + fprintf(stderr, + "AGPIOC_ACQUIRE failed (%s)\n", + strerror(errno)); + return FALSE; + } + acquiredScreen = screenNum; + } + + return TRUE; +} + +Bool +KdReleaseGART(int screenNum) +{ + if (screenNum != -1 && !GARTInit()) + return FALSE; + + if (acquiredScreen == screenNum) { + if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) { + fprintf(stderr, + "AGPIOC_RELEASE failed (%s)\n", + strerror(errno)); + return FALSE; + } + acquiredScreen = -1; + return TRUE; + } + return FALSE; +} + +int +KdAllocateGARTMemory(int screenNum, unsigned long size, int type, + unsigned long *physical) +{ + struct _agp_allocate alloc; + int pages; + + /* + * Allocates "size" bytes of GART memory (rounds up to the next + * page multiple) or type "type". A handle (key) for the allocated + * memory is returned. On error, the return value is -1. + */ + + if (!GARTInit() || acquiredScreen != screenNum) + return -1; + + pages = (size / AGP_PAGE_SIZE); + if (size % AGP_PAGE_SIZE != 0) + pages++; + + /* XXX check for pages == 0? */ + + alloc.pg_count = pages; + alloc.type = type; + + if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) { + fprintf(stderr, "KdAllocateGARTMemory: " + "allocation of %d pages failed\n\t(%s)\n", pages, + strerror(errno)); + return -1; + } + + if (physical) + *physical = alloc.physical; + + return alloc.key; +} + + +/* Bind GART memory with "key" at "offset" */ +Bool +KdBindGARTMemory(int screenNum, int key, unsigned long offset) +{ + struct _agp_bind bind; + int pageOffset; + + if (!GARTInit() || acquiredScreen != screenNum) + return FALSE; + + if (acquiredScreen != screenNum) { + fprintf(stderr, + "AGP not acquired by this screen\n"); + return FALSE; + } + + if (offset % AGP_PAGE_SIZE != 0) { + fprintf(stderr, "KdBindGARTMemory: " + "offset (0x%lx) is not page-aligned (%d)\n", + offset, AGP_PAGE_SIZE); + return FALSE; + } + pageOffset = offset / AGP_PAGE_SIZE; + + bind.pg_start = pageOffset; + bind.key = key; + + if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) { + fprintf(stderr, "KdBindGARTMemory: " + "binding of gart memory with key %d\n" + "\tat offset 0x%lx failed (%s)\n", + key, offset, strerror(errno)); + return FALSE; + } + + return TRUE; +} + + +/* Unbind GART memory with "key" */ +Bool +KdUnbindGARTMemory(int screenNum, int key) +{ + struct _agp_unbind unbind; + + if (!GARTInit() || acquiredScreen != screenNum) + return FALSE; + + if (acquiredScreen != screenNum) { + fprintf(stderr, + "AGP not acquired by this screen\n"); + return FALSE; + } + + unbind.priority = 0; + unbind.key = key; + + if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) { + fprintf(stderr, "KdUnbindGARTMemory: " + "unbinding of gart memory with key %d " + "failed (%s)\n", key, strerror(errno)); + return FALSE; + } + + return TRUE; +} + + +/* XXX Interface may change. */ +Bool +KdEnableAGP(int screenNum, CARD32 mode) +{ + agp_setup setup; + + if (!GARTInit() || acquiredScreen != screenNum) + return FALSE; + + setup.agp_mode = mode; + if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) { + fprintf(stderr, "KdEnableAGP: " + "AGPIOC_SETUP with mode %ld failed (%s)\n", + mode, strerror(errno)); + return FALSE; + } + + return TRUE; +} + diff --git a/xc/programs/Xserver/hw/kdrive/linux/agp.h b/xc/programs/Xserver/hw/kdrive/linux/agp.h new file mode 100644 index 000000000..9146f3c39 --- /dev/null +++ b/xc/programs/Xserver/hw/kdrive/linux/agp.h @@ -0,0 +1,70 @@ +/* COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 2000, 2001 Nokia Home Communications + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group */ + +/* agp.h - header file for KDrive AGP GART interface + * + * Author: Pontus Lidman <pontus.lidman@nokia.com> + * + */ + +#ifndef _AGP_H_ +#define _AGP_H_ + +#include "Xdefs.h" + +/* These two definitions must be consistent with the kernel's, + but using 1 or 2 in driver code is even uglier */ +#define AGP_DCACHE_MEMORY 1 +#define AGP_PHYS_MEMORY 2 + +typedef struct _AgpInfo { + CARD32 bridgeId; + CARD32 agpMode; + unsigned long base; + unsigned long size; + unsigned long totalPages; + unsigned long systemPages; + unsigned long usedPages; +} AgpInfo, *AgpInfoPtr; + +extern Bool KdAgpGARTSupported(void); +extern AgpInfoPtr KdGetAGPInfo(int screenNum); +extern Bool KdAcquireGART(int screenNum); +extern Bool KdReleaseGART(int screenNum); +extern int KdAllocateGARTMemory(int screenNum, unsigned long size, int type, + unsigned long *physical); +extern Bool KdBindGARTMemory(int screenNum, int key, unsigned long offset); +extern Bool KdUnbindGARTMemory(int screenNum, int key); +extern Bool KdEnableAGP(int screenNum, CARD32 mode); + +#endif /* _AGP_H_ */ diff --git a/xc/programs/Xserver/hw/kdrive/linux/keyboard.c b/xc/programs/Xserver/hw/kdrive/linux/keyboard.c index 081a49913..687d36240 100644 --- a/xc/programs/Xserver/hw/kdrive/linux/keyboard.c +++ b/xc/programs/Xserver/hw/kdrive/linux/keyboard.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/kdrive/linux/keyboard.c,v 1.5 2000/12/08 23:04:57 keithp Exp $ + * $XFree86: xc/programs/Xserver/hw/kdrive/linux/keyboard.c,v 1.6 2001/03/30 02:15:20 keithp Exp $ * * Copyright © 1999 Keith Packard * @@ -29,6 +29,7 @@ #define XK_PUBLISHING #include <X11/keysym.h> #include <termios.h> +#include <sys/ioctl.h> extern int LinuxConsoleFd; diff --git a/xc/programs/Xserver/hw/kdrive/linux/linux.c b/xc/programs/Xserver/hw/kdrive/linux/linux.c index cd89aa266..2c5e0d0be 100644 --- a/xc/programs/Xserver/hw/kdrive/linux/linux.c +++ b/xc/programs/Xserver/hw/kdrive/linux/linux.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/kdrive/linux/linux.c,v 1.4 2000/08/28 02:43:14 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/kdrive/linux/linux.c,v 1.5 2001/03/30 02:15:20 keithp Exp $ * * Copyright © 1999 Keith Packard * @@ -28,6 +28,7 @@ #include <linux/vt.h> #include <linux/kd.h> #include <sys/stat.h> +#include <sys/ioctl.h> #include <keysym.h> static int vtno; @@ -174,6 +175,7 @@ LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr) n--; } attr->naddr = n; + attr->bus = bus; ret = TRUE; break; } @@ -181,6 +183,37 @@ LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr) return ret; } +unsigned char * +LinuxGetPciCfg(KdCardAttr *attr) { + char filename[256]; + FILE *f; + unsigned char *cfg; + int r; + + snprintf(filename, 255, "/proc/bus/pci/%02x/%02x.%x", + attr->bus >> 8, (attr->bus & 0xff) >> 3, attr->bus & 7); +/* fprintf(stderr,"Find card on path %s\n",filename); */ + + if (!(f=fopen(filename,"r"))) + return NULL; + + if (!(cfg=xalloc(256))) + { + fclose(f); + return NULL; + } + + if (256 != (r=fread(cfg, 1, 256, f))) + { + fprintf(stderr,"LinuxGetPciCfg: read %d, expected 256\n",r); + free(cfg); + cfg=NULL; + } + fclose(f); +/* fprintf(stderr,"LinuxGetPciCfg: success, returning %p\n",cfg); */ + return cfg; +} + void LinuxSetSwitchMode (int mode) { diff --git a/xc/programs/Xserver/hw/kdrive/linux/ps2.c b/xc/programs/Xserver/hw/kdrive/linux/ps2.c index 9ab1d59ac..386bf23ad 100644 --- a/xc/programs/Xserver/hw/kdrive/linux/ps2.c +++ b/xc/programs/Xserver/hw/kdrive/linux/ps2.c @@ -1,5 +1,5 @@ /* - * Id: ps2.c,v 1.1 1999/11/02 03:54:46 keithp Exp $ + * $XFree86: xc/programs/Xserver/hw/kdrive/linux/ps2.c,v 1.4 2001/04/01 14:00:04 tsi Exp $ * * Copyright © 1999 Keith Packard * @@ -115,6 +115,7 @@ Ps2Init (void) if (ps2Port >= 0) return ps2Port; } + return -1; } void diff --git a/xc/programs/Xserver/hw/kdrive/trident/trident.c b/xc/programs/Xserver/hw/kdrive/trident/trident.c index 6f7e8ae7d..c2d3eae00 100644 --- a/xc/programs/Xserver/hw/kdrive/trident/trident.c +++ b/xc/programs/Xserver/hw/kdrive/trident/trident.c @@ -1,6 +1,4 @@ /* - * $Id: trident.c,v 1.1.1.8 2000/11/30 23:14:52 dawes Exp $ - * * Copyright © 1999 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -21,7 +19,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.15 2000/11/29 08:42:25 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.16 2001/03/21 16:43:16 dawes Exp $ */ #include "trident.h" #define extern diff --git a/xc/programs/Xserver/hw/vfb/Imakefile b/xc/programs/Xserver/hw/vfb/Imakefile index 3ed521e97..07303d096 100644 --- a/xc/programs/Xserver/hw/vfb/Imakefile +++ b/xc/programs/Xserver/hw/vfb/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.5 2000/08/17 19:48:38 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/vfb/Imakefile,v 3.26 2001/01/24 00:06:11 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/vfb/Imakefile,v 3.27 2001/03/04 17:40:10 herrb Exp $ #include <Server.tmpl> @@ -12,7 +12,7 @@ SHMDEF = -DHAS_SHM #endif XCOMM add more architectures here as we discover them -#if defined(HPArchitecture) || (defined(SparcArchitecture) && !defined(LynxOSArchitecture)) || SystemV4 || defined(OSF1Architecture) || defined(i386BsdArchitecture) || defined(LinuxArchitecture) +#if defined(HPArchitecture) || (defined(SparcArchitecture) && !defined(LynxOSArchitecture)) || SystemV4 || defined(OSF1Architecture) || defined(i386BsdArchitecture) || defined(LinuxArchitecture) || defined(DarwinArchitecture) MMAPDEF = -DHAS_MMAP #endif diff --git a/xc/programs/Xserver/hw/vfb/InitOutput.c b/xc/programs/Xserver/hw/vfb/InitOutput.c index 2903fc096..f42d86587 100644 --- a/xc/programs/Xserver/hw/vfb/InitOutput.c +++ b/xc/programs/Xserver/hw/vfb/InitOutput.c @@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/vfb/InitOutput.c,v 3.15 2001/01/17 22:36:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/vfb/InitOutput.c,v 3.16 2001/03/04 17:40:10 herrb Exp $ */ #if defined(WIN32) && !defined(__CYGWIN__) #include <X11/Xwinsock.h> @@ -229,6 +229,13 @@ AbortDDX() ddxGiveUp(); } +#ifdef __DARWIN__ +void +DarwinHandleGUI(int argc, char *argv[]) +{ +} +#endif + void OsVendorInit() { diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG b/xc/programs/Xserver/hw/xfree86/CHANGELOG index d69aa53b2..0befffcb7 100644 --- a/xc/programs/Xserver/hw/xfree86/CHANGELOG +++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG @@ -1,3 +1,343 @@ +XFree86 4.0.99.2 (6 April 2001) + 360. Fbdev driver updates, including: + - Switch from shadowfb to mishadow. + - Add RENDER extension support. + - Add DGA support. + - Fix SaveScreen function + - Blank screen in ScreenInit so the former framebuffer contents aren't + visible + (#4544, Michel Dänzer). + 359. Remove references to th_TH compose file from compose.dir (#4543, + Theppitak Karoonboonyanan). + 358. Fix for improper setting of the maxHValue limit in the tseng driver. + This makes modes like 1152x864@24bpp possible (#A.355, Stanislav Brabec). + 357. Fix a hw cursor related lockup that shows up with some mga G400 + 16MB OEM single head cards (#A.351, Ewald Snel). + 356. Fix the XKB macintosh/it mapping (the accent-related keys were wrong) + (#A.349, Andrea Ghirardini). + 355. Add XKB descriptions for the extra keys on a Chicony internet + keyboard (#A.356, John Gladkih). + 354. Add support for the internal input device interface to mice on + Solaris 8, and make it the default protocol ("VUID") (#A.340, + Marcus Comstedt). + 353. Add XKB descriptions for the extra keys on an IBM Rapid Access II + keyboard (#A.332, Patrick D'Cruze). + 352. Fix a typo in xvidtune (#A.327, Peter Breitenlohner). + 351. Fix Linux/libc5 build problem in the bigfont extension code (#A.327, + Peter Breitenlohner). + 350. Fix typo in Chooser.ad (#A.327, Peter Breitenlohner). + 349. Big endian and PowerPC support for the mga driver (#4540, Ani Joshi). + 348. Big endian support for the tdfx driver (#4539, Ani Joshi, + Nicolas Dimitrijevic). + 347. Build the tdfx and imstt drivers on PowerPC platforms (#4538, Ani Joshi). + 346. Add IMS (Integrated Micro Solutions) PCI data for the TwinTurbo128 + and TwinTurbo3D (#4537, Ani Joshi). + 345. Fix some color and accel glitches in the imstt driver (#4536, Ani Joshi). + 344. Add ISA I/O support for PowerPC Linux using the __NR_pciconfig_iobase + syscall (#4535, Ani Joshi). + 343. New Xwin server code from the Cygwin/XFree86 project. This version + is more portable across Win32 platforms. Changes include: + - Use fb and shadowfb, and use the faster of GDI blitter, + DirectDraw blitter and DirectDraw4 blitter to update damaged + regions. The video card's framebuffer is no longer mapped. + - Works correctly at depths > 8, but colors are not correct at depth 8. + - Uses the standard Win32 API messages for processing keyboard and + mouse input rather than using DirectInput. This is more reliable. + - Improved internal structure and coding conventions. + - Builds completely from the XFree86 tree using gcc (the Visual C++ + compiled xf_dx.dll is no longer used). + - The new server can run on machines that don't have DirectDraw/DirectX + installed (or installed but not operable) by falling back to the + GDI blitter. The best drawing interface is determined at startup, + but this can be overriden with the -engine command line option. + - The Xrender extension is now supported. + - Command line option is available to run in full screen mode. + (#4531, 4532, 4534, Cygwin/XFree86 project including Harold L Hunt II, + Suhaib M Siddiqi, Dakshinamurthy Karra, Peter Busch). + 342. v4l driver bug fixs: catch xalloc() failures, and set the depth + correctly for the VIDIOCSPICT ioctl (#4530, Gerd Knorr). + 341. Add a driver for VMware virtual SVGA devices. This is for use + by X servers running under a VMware guest OS (#4529, VMware, Inc). + 340. Remove Cygwin-specific #ifdef in Xserver/os/Waitfor.c, which fixes + a crash (#4528, Suhaib Siddiqi). + 339. Cygwin build fixes (#4527, Suhaib Siddiqi). + 338. Updates to the "citron" input driver. It includes compatibility + with the Winbond SIO chip (83977EF), and some new commands to + communicate to the touch driver from an application program + (via XChangeFeedbackControl) (#4526, Peter Kunzmann, Citron). + 337. Updates to the "summa" input driver, including: + - "Resolution" replaces "LPI" as option for setting resolution. + - Fixed device reporting to give the actual tablet area size and + resolution. + - Tested and working with: SummaSketch3, Hitachi_1217D, a couple of + others emulating the Summa protocol. + - Reduce debug message verbosity. + - Various cleanups. + (#4525, Huver). + 336. SunFFB driver bug fixes, including: + - Be smarter about restoring Kernel framebuffer state. + - Cure build errors when debug defines are enabled. + - Do not enable DRI or DGA acceleration if NoAccel option is specified. + (#4524, David S. Miller). + 335. Mga G450 dual head support, (#4523, Luugi Marsan (Matrox) and + David Woodhouse). + 334. Fix missing xfree -> Xfree mapping in the Type1 font library code (#4521, + Juliusz Chroboczek). + 333. Make sure that an initialization assumption in parse_fontdata() in + lib/X11/omGeneric.c is met (#4520, Jonathan Kamens). + 332. Add checksum verification to detect monitors that give incorrect EDID + data (#4517, Andrew C Aitchison). + 331. Fix checking of LD_ELFDLOBJECT on big-endian systems (#4514, + Guido Guenter). + 330. Add an update.fonts target/rule for maintainer use to update + the latin1 fonts in the source tree that are derived from the + ISO10646-1 masters (David Dawes). + 329. Update UCS misc fonts, which includes the addition of the missing + 4 DEC VT100 graphics characters from Unicode 3.2 (#4533, Markus Kuhn). + 328. Handle build-time generation of 8 bit fonts from the UCS versions, + rework the way this is organised, and allow some better control over + which fonts are built/installed (David Dawes). + 327. Add UCS versions of most of the 75dpi and 100dpi bdf fonts, and generate + 8-bit subsets of them. Also, remove the now-redundant latin2 + bdf font directories (#4512 Markus Kuhn). + 326. Add support for Trident CyberBladeXP and CyberBladeXPm (mobile) + (Alan Hourihane, Robert V Fleisig). + 325. Add XKB descriptions for the extra keys on an IBM Rapid Access keyboard + (#4510, Dennis Bjorklund). + 324. Update Status and i810 docs to mention i815 support and FreeBSD support + (#4509, Andrew C Aitchison, David Dawes). + 323. Xprt fixes to make it closer to X.org version (Danny Backx). + 322. Fix for reading PCI resource data on Linux/alpha (#4508, + Ivan Kokshaysky). + 321. Add XKB descriptions for the extra keys on a "Logitech Internet Keyboard" + (#4505, Matthew Hand). + 320. Build shared libGL and DRI client modules on Linux without PIC for + performance reasons. + 319. Updates to glxinfo (Brian Paul). + 318. Add glxgears (Brian Paul). + 317. glxinfo needs libGLU (Marc La France). + 316. Rage128 fix to Cards database (Marc La France). + 315. Minor fix to PCI resource overlap handling (Marc La France). + 314. Loader code simplification and IA-64 cache flushes (Marc La France). + 313. Workaround in the ATI driver for troublesome interaction between loader + and compiler optimisation (Marc La France). + 312. Warning fixes for `gcc -fno-builtin`, which appears to be the default on + some systems (Marc La France). + 311. Add glyph transformations to Xft (Tuomas J. Lukka) + 310. Add XftCache creation to fonts/Type1 (Keith Packard) + 309. Add Xmuu library for non-Xt/Xaw dependent applications (Jim Gettys) + 308. Add i810 and Xv support to kdrive (Pontus Lidman) + 307. Fix Radeon CPUToScreen acceleration on Alpha platforms (Jay Estabrook). + 306. Fix bug in ServerLayout option handling when there's no ServerFlags + section present (David Dawes). + 305. Allow fb to access 16bit devices (Alan Hourihane). + 304. XvImage support for GeForce chips in the nv driver (Mark Vojkovich). + 303. XvMC build fix (Marc La France). + 302. Fix recently introduced bug in xf86cfg (Marc La France). + 301. Re-instate warning fixes clobbered by DRI merge (Marc La France). + 300. Ignore disabled non-video PCI ROMs (Marc La France). + 299. Hardware cursor implementation for Mach64 variants (William Blew, + Ani Joshi, Marc La France). + 298. Some endianness fixes in the ATI driver (incomplete) (Marc La France). + 297. Fix MMIO ordering problems for Mach64 acceleration (Marc La France). + 296. Fix ATI driver behaviour when it finds the LCD panel has been disabled + on entry (Marc La France). + 295. Fix ECP clock for GATOS (Vladimir Dergachev). + 294. Undo part of CHANGELOG 36 (Marc La France). + 293. Rework the building of libGL and the DRI drivers (David Dawes). + 292. Update greek keyboard layout and compose map. + (#4513, Katsaloulis Panagiotis) + 291. Fix problems in Xnest when MouseKeys is enabled and patched it to + use XKB to allow clients to change keyboard description and + configuration whithout interfering with the "real" X server + (Paulo César Pereira de Andrade). + 290. Dvorak keymap fix (#A.343, J Phillips). + 289. Some vesa driver updates, including: + - Wrap CloseScreen(). + - Call xf86PrintModes(). + - Add error messages for when PreInit bails out for lack of modes. + - Rework how the debugging information is printed. + _ Avoid some build warnings. + (David Dawes) + 288. Make it possible to call xf86PrintModes() when there is no hsync or + refresh data available, like from the vesa drivers (David Dawes). + 287. Add a "cleanlinks" script for cleaning up dangling links in lndir-created + shadow trees (David Dawes). + 286. Resync with DRI CVS trunk (VA Linux Systems). + 285. Make extension headers available when the extension is enabled but the + extension's client library is disabled (David Dawes). + 284. Make it possible to enable building selected extension libraries + when BuildServersOnly is set, and allow independent control of + building docs and clients (David Dawes). + 283. Import latest Mesa 3.4.x branch. + 282. Lower the default fifo threshold for PM3 chips (Alan Hourihane, + Rafael Barbalho, 3DLabs). + 281. Fix 3DLabs GLINT driver for use the Flat Panels, use the UseFlatPanel + option. Tested with the SGI 1600SW and Permedia3 board (Alan Hourihane). + 280. Fix glxinfo to query default display (Alan Hourihane). + 279. Convert TGA driver to use fb (Alan Hourihane). + 278. Fix XTRAP typo in miinitext.c (Damien Touraine). + 277. Major updates to the XFree86(1) man page (David Dawes). + 276. A new (perl) version of the mkhtmlindex script that works better than + the shell version (David Dawes). + 275. Fix the `make depend` scripts to accept -U flags and not require a blank + in their -f flag (Marc La France). + 274. Bump the video and input driver ABI minor numbers. + 273. Add xf86SetRealOption() (Huver). + 272. Change Xdarwin do that it processes all pending events instead of + just the oldest one on ProcessInputEvents() call , + Quit Xdarwin cleanly, wether from the Xserve or from Cocoa front end, + Fix a case typp which cases the Xdarwin server not to start if + installed on a case sensitive file system like UFS. + (#4504, #4507, #45011, Gegory Parker, Torrey T. Lyons). + 271. Move Section DRI/Endsection into the DRI function to be consistant with + all of the other sections. (Quentin Neill) + 270. Made xf4bpp code moer 64bit clean (still doesn't work on Alphas) + (Egbert Eich). + 269. Removed disable/enable interrupt call on ia64 platforms. + The machine instruction is privileged and not permitted in user space + (Egbert Eich). + 268. Improved mode setting in Trident driver; added code to ValidMode + to reject any modes whose size is larger than the physical LCD + size if LCD is enabled (Egbert Eich). + 267. Modified error message in TDFX driver to give user a clue how + to avoid error (Stefan Dirsch). + 266. Fixed appearant typo in SMI driver (Egbert Eich). + 265. Changed Savage driver to unmap memory when exiting PreInit() and + maps it on every call to ScreenInit() (Egbert Eich). + 264. Changed handling of failed vbe call in rage 128 driver. + No the driver doesn't fail any more (Egbert Eich). + 263. Integrate the currently Panix-specific keycodes into atKeynames.h, + since they're not really Panix-specific (David Dawes). + 262. Fix problem with a NULL pointer in Xv Xineramification (Benjamin Monate). + 261. Bug fixes and improvements for mouse 3 button emulation state machine + (Andrew Pimlott). + 260. Updates for Hurd support (#A.324, Marcus Brinkmann). + 259. Add call to setlocale() in xev (#A.322, Eugene B. Byrganov). + 258. Add support fo the charset Big5HKSCS to the X-TrueType module, as + well as some basic XLocale support for it (#A.321, Roger So). + 257. Fix core dump in XqueueMousePreInit (#A.317, Fiel Cabral). + 256. Allow the mga driver's "DigitalScreen" option to work for the first + head (#A.297, Niels Gram Jeppesen). + 255. Add zh_CN.GBK locale support (#A.293, Yong Li). + 254. Fix a problem with the ThinkingMousePS/2 protocol handling of left + movement (#A.292, Ian Remmler). (This has been in 3.3.x since 3.3.4.) + 253. Make xdm Xinerama-aware so that it can avoid splitting login and + chooser windows across physical screens (#A.276, + Dmitry Yu. Bolkhovityanov). + 252. Fix a resource allocation bug in the DBE code (#A.271, Bill Rugolsky). + 251. Only enable Xv support for the 630 in the sis driver (#A.263, Nick Lamb). + 250. Modify the sis driver to prefer 24bpp framebuffer layout. Perhaps not + all support 32bpp? (#A.263, Nick Lamb). + 249. Add missing byte to Intellimouse init string, which fixes problems + that show up with some KVM switches (#A.258, Seung-Hyeon Rhee). + 248. Some DRM module fixes for FreeBSD 5-current (#A.242, Andrew Atrens). + 247. Fix xterm build on Solaris 2.5.1 (based on #A.282 from mark at zang.com). + 246. Make the Linux/PPC "custom keycodes" choice a run-time option instead + of a build-time option (#A.240, Franz Sirl). + 245. Add support to splitting WC MTRR regions on Linux when the regions is + not aligned on a size boudary (#A.238, _Usul John Obscurant). + 244. Add Acecad support to the "summa" input driver (#A.237, Arpad Gereoffy). + 243. Don't try to map 64K blit window aperture on older trident chips + (Alan Hourihane). + 242. V4L driver cleanups and Xineramification (#4502, Gerd Knorr). + 241. Make the X server and the Mac OS X front end run in a single process. + Other build fixes for Darwin (#4500, #4501, the XonX team). + 240. Don't build xf86config under BuildServersOnly (Marc La France). + 239. Potential fix for DGA apps that set colourmaps the normal way rather than + through DGA (Mark Vojkovich, Marc La France, Pontus Lidman). + 238. Make fstobdf generate correct ATTRIBUTES fields (Ishikawa Mutsumi). + 237. Xt man page updates (Paul Vojta). + 236. Plug kernel security hole in Linux int10 (Marc La France). + 235. Fix Xnest build for newest gcc versions (Marc La France). + 234. Fix typo in Xv Xinerama support (Gerd Knorr). + 233. Fix a problem with multi-thread support on OpenBSD (released OpenBSD + versions don't have getpwuid_r) (Matthieu Herrb) + 232. Allow to compile on OpenBSD-current which has completly removed PCVT + from its installation. (Matthieu Herrb) + 231. Support for ThreadedX on FreeBSD (FreeBSD ports patch-xthread). + 230. Updates for console-related FreeBSD system header changes as of 4.1-REL + (FreeBSD ports patch-r, patch-s). + 229. Don't leave free'd vrotate uninitialised in lib/X11/omGeneric.c + (FreeBSD ports patch-q). + 228. Protect #define HasPam in FreeBSD.cf (FreeBSD ports patch-d). + 227. Fix border garbage for the G400 second head by backing out #4205 + (David Dawes). + 227. Fix a typo in fonts/util/Imakefile (#4499, Juliusz Chroboczek). + 226. Add a document describing the DPS code included in the tree, and + pointers to web resources (#4498, Juliusz Chroboczek). + 225. Use VBE to add runtime DDC support to the i810 driver (#4496, + Andrew C. Aitchison). + 224. DRM kernel module updates for FreeBSD (#4493, joe at cracktown.org). + 223. Add support for the "Internet" keys of the Genius Comfy KB-16M keyboard + (#4491, Kamil Toman). + 222. Include three DPS sample clients: + - dpsinfo: random info about the DPS extension; + - dpsexec: interactive DPS ``executive'' (command-line); + - texteroids: a demo of font support. + (#4489, 4497, Juliusz Chroboczek). + 221. Don't build the GLU library when not building GLX. This fixes + a build failure when GLX is disabled (#4488, Juliusz Chroboczek). + 220. Make the stub files that pswrap generates contain the same set of + includes as the Adobe version, which fixes problems building + standalone DPS clients (#4487, Juliusz Chroboczek). + 219. Fix setxkbmap bugs, including: + - Continue working if the appropriate root window property where the + current xkb settings are saved can't be read or interpreted. + - Make the -keymap option work. + - Update the man page to explain how the "-option" option works. + - Add primitive sanity checking for 'map name'. + (#4482, Ivan Pascal). + 218. Fix a server crash while reading DDC data from EDID2 capable monitors + (#4481, Andrew C Aitchison). + 217. Updates to Thai support, including: + - Fix a bug combining characterw with Shift keys. + - Remove the th_TH Compose file so that Thai XIM is/can be(?) activated + without needing XSetLocaleModifiers(). + - A more precise context-sensitive input sequence check using + XNStringConversionCallback added. This has been tested with + xiterm+thai-1.04pre2. The implementation detail might be changed + if found inconsistent with the X11 specification. + (#4478, Theppitak Karoonboonyanan). + 216. Update ucs2any.pl, and replace the special map-* files with the + original mapping files from ftp.unicode.org. Changes include: + - A bug has been fixed that caused sometimes the FONT property not + to be updated correctly. + - The FONTBOUNDINGBOX is now recalculated, which makes the script + also suitable for proportional fonts. + - The mapping table for the DEC VT100 graphic characters is now built + into the script. This means the special map-* files are not necessary + any more and they could be replaced with the original mapping files + found on ftp://ftp.unicode.org/Public/MAPPINGS/ + - Whether the DEC VT100 graphic characters are added can be controlled + with options +d/-d. Default is to add them for upright charcell fonts + only. + - Slightly improved warning messages. + (#4472, Markus Kuhn). + 215. Fix libGLU build problem on Cygwin (#4467, Suhaib M. Siddiqi). + 214. Fix missing libX11 exported symbols for Cygwin (#4467, + Suhaib M. Siddiqi). + 213. Updates for Hurd support (#A.209, Marcus Brinkmann). + 212. Fix some mis-placed mem_barrier's for Alpha platforms (Jay Estabrook). + 211. Fix a Index/DAC register access in glint PM2v, PM3 driver. + (#A.319, Romain Dolbeau). + 210. Add Xv support to Permedia3 driver (#4480, #4486 Sven Luther). + 209. Support for NVIDIA GeForce3 (Mark Vojkovich). + 208. Allow GccWarningFlags overrides on Linux (Marc La France). + 207. Fix a problem with xvinfo's listing of image formats + (Giridhar Pemmasani). + 206. Fix bug in XkbSetNamedDeviceIndicator (XkbSetNamedIndicator). This + function can be used both for change state of specified indicator + (on/off) and for change description (and so behavior) of indicator. + Fix bug (in XkbGetPerClientControls). Typo where subroutine apply bit + mask (that consist of bitwise OR of three separate masks) to value + that have to be returned (#4474, Ivan Pascal). + 205. Setxkbmap can crash X server if one specify some illegal string as + 'xkb variant' name (#4471, Ivan Pascal). + 204. In Grab mode XKB sends 'state' in key events without 'group info' + (keyboard map layout) (#4469-4470, Ivan Pascal). + 203. Rewrite the X-Video extension's Xineramification (Mark Vojkovich). + XFree86 4.0.99.1 (19 February 2001) 202. Gamma correction and DirectColor visual support for NVIDIA RIVA TNT and newer chipsets (Mark Vojkovich). @@ -80,7 +420,7 @@ XFree86 4.0.99.1 (19 February 2001) 154. Fixed acceleration on Alpine (Cirrus) driver. PIO and MMIO versions of the accelerator driver now support the same functionality (Egbert Eich). 153. Removed unneededed call to xfree() in ddc code (Egbert Eich). - 152. Fix NV, Glint, ati and mga drivers for Alpha EV56 machines + 152. - 151. Siliconmotion driver updates, including: - Color change/flash at 8bpp when switch back to desktop in rotation mode. @@ -170,10 +510,8 @@ XFree86 4.0.99.1 (19 February 2001) improving detection of them and forcing them to be relocated (Marc La France). 118. Make lndir ignore finder data files on Mac OS X (Matthieu Herrb). - 117. [SECURITY] complete fix for /tmp race in gccmakedep and makedepend. - (Branden Robinson). - 116. [SECURITY] fix possible buffer overflow (NOT on stack) in xdm - xdmcp code (patch69 from Red Hat SRPMS). + 117. - + 116. - 115. Undo s3virge changes in 4.0.2 for Xv support on ViRGE chipsets since they caused problems with plain ViRGE cards. Xv is still supported for the ViRGE DX (#4414, 4430, Kevin Brosius). @@ -215,11 +553,11 @@ XFree86 4.0.99.1 (19 February 2001) 100. Add XaaNoWriteBitmap and XaaNoWritePixmap options to XAA (Alan Hourihane). 99. Improve determination of primary adapter (Marc La France). 98. Fix PPC xf86sym.c compile problems (Marc La France). - 97. Fix int10 option handling for drivers that cann xf86CollectOptions() + 97. Fix int10 option handling for drivers that call xf86CollectOptions() before calling int10 (Marc La France). 96. Properly detect unassigned MMIO address in ATI driver (Marc La France). 95. Fix default compilation on Sparc/Solaris (Marc La France). - 94. Fix typo in Linux/Arm configuretion (Marc La France). + 94. Fix typo in Linux/Arm configuration (Marc La France). 93. By default, don't build libGLU on libc5 systems (Marc La France). 92. Fix HW cursor colors for pm2v/pm3 in the glint driver (Alan Hourihane). 91. Rework the memory detection code for Permedia3, now correctly detects @@ -390,7 +728,7 @@ XFree86 4.0.99.1 (19 February 2001) retrieval attempt fails (Marc La France). 30. Temporary kludge to not consider any adapter as primary if more than one candidate can be found (Marc La France). - 29. Make deleted mode message less fearsome (Marc La France). + 29. Make deleted mode messages less fearsome (Marc La France). 28. Fix -configure to retrieve the correct set of options for ATI, C&T, Cirrus and NeoMagic adapters (Marc La France). 27. When removing PCI resource overlaps, always consider resources whose size @@ -679,7 +1017,7 @@ XFree86 4.0.1h (4 December 2000) 1087. Status doc updates for Neomagic an NVIDIA (#4334, Andrew C. Aitchison, Mark Vojkovich). 1086. Updated Rage 128 DRI support from the DRI CVS (Gareth Hughes, VA Linux). -1085. Updates for Hurd support (#A.209, Marcus Brinkmann). +1085. - 1084. Bump the minor revisions of libXmu (UTF8_STRING) and libX11 (Xutf8LookupString). 1083. Fixes for all known bugs in the CompoundText parser and generator, @@ -12559,4 +12897,4 @@ XFree86 3.0a (28 April 1994) XFree86 3.0 (26 April 1994) -$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1586 2001/02/19 20:20:58 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1671 2001/04/06 18:16:27 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/Imakefile b/xc/programs/Xserver/hw/xfree86/Imakefile index 0a4116607..cd00fd573 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.71 2001/01/24 00:06:13 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.74 2001/04/03 22:51:00 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -89,15 +89,15 @@ INPUTDIR = input DRIVERSDK = sdk #endif -#if !BuildServersOnly -XF86CFGDIR = xf86cfg +#if !BuildServersOnly || BuildXFree86ConfigTools +XF86CFGDIRS = xf86cfg xf86config #endif SUBDIRS = os-support common $(XAADIR) $(XF1BPPDIR) $(XF4BPPDIR) \ $(XF8_32BPPDIR) $(XF8_16BPPDIR) $(XF24_32BPPDIR) $(SHADOWFBDIR) \ drivers $(LOADERDIR) $(VGAHWDIR) $(FBDEVHWDIR) $(RAMDACDIR) \ $(RACDIR) $(I2CDIR) $(DDCDIR) $(INPUTDIR) $(INT10DIR) parser \ - scanpci doc xf86config dummylib $(XF86CFGDIR) $(XF86SETUPDIR) etc \ + scanpci doc dummylib $(XF86CFGDIRS) $(XF86SETUPDIR) etc \ $(SUPERPROBE) $(DRIVERSDK) $(XF8_32WIDDIR) #if !defined(OS2Architecture) && !defined(cygwinArchitecture) @@ -196,7 +196,7 @@ InstallDriverSDKNonExecFile($(XF86CONFIG),$(DRIVERSDKDIR)) InstallDriverSDKNonExecFile($(XF98CONFIG),$(DRIVERSDKDIR)) #endif -EXTRAMANCPPDEFS=-D__logdir__=$(LOGDIRECTORY) +EXTRAMANDEFS=-D__logdir__=$(LOGDIRECTORY) InstallManPage(XFree86,$(MANDIR)) InstallGenManPage(XF86Config,$(FILEMANDIR),$(FILEMANSUFFIX)) diff --git a/xc/programs/Xserver/hw/xfree86/Registry b/xc/programs/Xserver/hw/xfree86/Registry index d1a6e0dae..c6dfe6c1a 100644 --- a/xc/programs/Xserver/hw/xfree86/Registry +++ b/xc/programs/Xserver/hw/xfree86/Registry @@ -29,6 +29,7 @@ tseng type1 vga vgahw +vmware xaa xf1bpp xf4bpp @@ -52,6 +53,7 @@ permedia tseng vga vgahw +vmware xaa xf1bpp xf4bpp @@ -318,4 +320,4 @@ and underscores removed. -$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.16 1999/09/25 14:36:55 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.17 2001/04/05 19:29:41 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h b/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h index 2c3ef8232..93d459456 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h @@ -57,10 +57,16 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h,v 3.17 2000/09/29 08:59:44 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h,v 3.18 2001/04/01 14:00:07 tsi Exp $ */ #if defined(__GNUC__) #if defined(linux) && (defined(__alpha__) || defined(__ia64__)) +#undef inb +#undef inw +#undef inl +#undef outb +#undef outw +#undef outl #define inb _inb #define inw _inw #define inl _inl diff --git a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c index 01adde304..f2a4b8769 100644 --- a/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c +++ b/xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c,v 3.17 2000/06/23 22:42:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c,v 3.19 2001/03/03 09:53:00 herrb Exp $ */ /* * (c) Copyright 1993,1994 by David Dawes <dawes@xfree86.org> * @@ -78,12 +78,26 @@ /* NetBSD's wscons has a PCVT compatibility module. */ # include <dev/wscons/wsdisplay_usl_io.h> # else -# include <machine/pcvt_ioctl.h> +# if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) +# include <dev/wscons/wsdisplay_usl_io.h> +# else +# include <machine/pcvt_ioctl.h> +# endif # endif # endif # ifdef SYSCONS_SUPPORT /* both, Free and NetBSD have syscons */ -# include <machine/console.h> +# if defined(__FreeBSD__) +# include <osreldate.h> +# if __FreeBSD_version >= 410000 +# include <sys/consio.h> +# include <sys/kbio.h> +# else +# include <machine/console.h> +# endif +# else +# include <machine/console.h> +# endif # endif # else # ifdef CODRV_SUPPORT diff --git a/xc/programs/Xserver/hw/xfree86/XF86Config.man b/xc/programs/Xserver/hw/xfree86/XF86Config.man index c4e897ba4..b37bece20 100644 --- a/xc/programs/Xserver/hw/xfree86/XF86Config.man +++ b/xc/programs/Xserver/hw/xfree86/XF86Config.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.3 2001/02/13 21:15:17 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.4 2001/04/05 19:29:41 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH XF86Config __filemansuffix__ __vendorversion__ @@ -1589,6 +1589,7 @@ tseng(__drivermansuffix__), v4l(__drivermansuffix__), vesa(__drivermansuffix__), vga(__drivermansuffix__), +vmware(__drivermansuffix__), .br README .IR <http://www.xfree86.org/current/README.html> , diff --git a/xc/programs/Xserver/hw/xfree86/XFree86.man b/xc/programs/Xserver/hw/xfree86/XFree86.man index b6b43af69..2a2ea232c 100644 --- a/xc/programs/Xserver/hw/xfree86/XFree86.man +++ b/xc/programs/Xserver/hw/xfree86/XFree86.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.48 2001/01/27 18:20:44 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.52 2001/04/05 19:29:41 dawes Exp $ .TH XFree86 1 __vendorversion__ .SH NAME XFree86 - X11R6 X server @@ -6,91 +6,42 @@ XFree86 - X11R6 X server .B XFree86 [:display] [option ...] .SH DESCRIPTION -XFree86 is an X servers for UNIX-like OSs on Intel x86 and other platforms. +XFree86 is an X server that was originally designed for UNIX and UNIX-like +operating systems running on Intel x86 hardware. It now runs on a wider +range of hardware and OS platforms. +.PP This work is derived from .I "X386\ 1.2" which was contributed to X11R5 by Snitily Graphics Consulting Service. -The current XFree86 release is based on X11R6.3. -The XFree86 X server architecture was redesigned for the 4.0 release, and -it includes among other things a loadable module system donated by -Metro Link, Inc. +The current XFree86 release is based on X11R6.3. The XFree86 X server +architecture was redesigned for the 4.0 release, and it includes among +other things a loadable module system donated by Metro Link, Inc. .SH CONFIGURATIONS .PP .I XFree86 -operates under the following operating systems: -.RS .5i -.na -.PP --- SVR3.2: SCO 3.2.2, 3.2.4, ISC 3.x, 4.x -.br --- SVR4.0: ESIX, Microport, Dell, UHC, Consensys, MST, ISC, AT&T, NCR -.br --- SVR4.2: Consensys, Univel (UnixWare) -.br --- Solaris (x86) 2.5, 2.6 -.br --- FreeBSD 2.1.x, 2.2.x, 3.0-current -.br --- NetBSD 1.2, 1.3 -.br --- OpenBSD -.ig -.br --- BSD/386 version 1.1 and BSD/OS 2.0 -.br --- Mach (from CMU) -.. -.br --- Linux -.ig -.br --- Amoeba version 5.1 -.br --- Minix-386vm version 1.6.25.1 -.. -.br --- LynxOS AT versions 2.2.1, 2.3.0 and 2.4.0, LynxOS microSPARC 2.4.0 -.ad -.RE +operates under a wide range of operating systems and hardware platforms. +The Intel x86 (IA32) architecture is the most widely supported hardware +platform. Other hardware platforms include Compaq Alpha, Intel IA64, +SPARC and PowerPC. The most widely supported operating systems are the +free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD and +OpenBSD. Commercial UNIX operating systems such as Solaris (x86) and +UnixWare are also supported. Other supported operating systems include +LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the +XDarwin(1) X server. Win32/Cygwin is supported with the XWin X server. .PP .SH "NETWORK CONNECTIONS" \fIXFree86\fP supports connections made using the following reliable byte-streams: .TP 4 .I "Local" -\fIXFree86\fP supports local connections via Streams pipe via various mechanisms, -using the following paths (\fIn\fP represents the display number): -.sp .5v -.in 8 -.nf -/dev/X/server.\fBn\fR (SVR3 and SVR4) -/dev/X/Nserver.\fBn\fR (SVR4) -.ig -/tmp/.X11-unix/X\fBn\fR (ISC SVR3) -.. -/dev/X\fBn\fRS and /dev/X\fBn\fRR (SCO SVR3) -.fi -.in -.sp .5v -On SVR4.0.4, if the \fIAdvanced Compatibility Package\fP -is installed, and in SVR4.2, \fIXFree86\fP supports local connections -from clients for SCO XSight/ODT, and (with modifications to the binary) -clients for ISC SVR3. -.TP 4 -.I "Unix Domain" -\fIXFree86\fP uses \fI/tmp/.X11-unix/X\fBn\fR as the filename for the socket, -where \fIn\fP is the display number. +On most platforms, the "Local" connection type is a UNIX-domain socket. +On some System V platforms, the "local" connection types also include +STREAMS pipes, named pipes, and some other mechanisms. .TP 4 .I TCP\/IP -\fIXFree86\fP listens on port htons(6000+\fIn\fP), where \fIn\fP is the display -number. -.ig -.TP 4 -.I "Amoeba RPC" -This is the default communication medium used under native Amoeba. -Note that under Amoeba, the server should be started -with a ``\fIhostname\fP:\fIdisplaynumber\fP'' argument. -.. +\fIXFree86\fP listens on port 6000+\fIn\fP, where \fIn\fP is the display +number. This connection type can be disabled with the \fB\-nolisten\fP +option (see the Xserver(1) man page for details). .SH "ENVIRONMENT VARIABLES" For operating systems that support local connections other than Unix Domain sockets (SVR3 and SVR4), there is a compiled-in list specifying the order @@ -104,16 +55,16 @@ To use it the connection must be made to \fIunix:0.0\fP. .PP The \fIXLOCAL\fP environment variable should contain a list of one more more of the following: -.sp .5v -.in 8 +.PP +.RS 8 .nf NAMED PTS SCO ISC .fi -.in -.sp .5v +.RE +.PP which represent SVR4 Named Streams pipe, Old-style USL Streams pipe, SCO XSight Streams pipe, and ISC Streams pipe, respectively. You can select a single mechanism (e.g. \fIXLOCAL=NAMED\fP), or an ordered @@ -132,195 +83,425 @@ In addition to the normal server options described in the \fIXserver(1)\fP manual page, \fIXFree86\fP accepts the following command line switches: .TP 8 .B vt\fIXX\fP -\fIXX\fP specifies the Virtual Terminal device number which -\fIXFree86\fP will use. Without this option, \fIXFree86\fP will pick the first +\fIXX\fP specifies the Virtual Terminal device number which \fIXFree86\fP +will use. Without this option, \fIXFree86\fP will pick the first available Virtual Terminal that it can locate. This option applies only -to SVR3, SVR4, Linux, and BSD OSs with the `syscons' or `pcvt' driver. +to platforms such as Linux, BSD, SVR3 and SVR4, that have virtual terminal +support. +.TP +.B \-allowMouseOpenFail +Allow the server to start up even if the mouse device can't be opened +or initialised. This is equivalent to the +.B AllowMouseOpenFail +XF86Config(__filemansuffix__) file option. .TP 8 -.B -crt /dev/tty\fIXX\fP -SCO only. This is the same as the \fBvt\fP option, and is provided for -compatibility with the native SCO X server. +.B \-allowNonLocalModInDev +Allow changes to keyboard and mouse settings from non-local clients. +By default, connections from non-local clients are not allowed to do +this. This is equivalent to the +.B AllowNonLocalModInDev +XF86Config(__filemansuffix__) file option. .TP 8 -.B \-probeonly -Causes the server to exit after the device probing stage. The XF86Config file -is still used when this option is given, so information that can be -auto-detected should be commented out. +.B \-allowNonLocalXvidtune +Make the VidMode extension available to remote clients. This allows +the xvidtune client to connect from another host. This is equivalent +to the +.B AllowNonLocalXvidtune +XF86Config(__filemansuffix__) file option. By default non-local +connections are not allowed. .TP 8 -.B \-quiet -Suppress most informational messages at startup. +.B \-bgamma \fIvalue\fP +Set the blue gamma correction. \fIvalue\fP must be between 0.1 and 10. +The default is 1.0. Not all drivers support this. See also the +.BR \-gamma , +.BR \-rgamma , +and +.B \-ggamma +options. .TP 8 .B \-bpp \fIn\fP -No longer supported. Use \fB\-depth\fP to set the color depth, and -use \fB\-fbbpp\fP if you really need to force a non-default -framebuffer (hardware) pixel format. +No longer supported. Use \fB\-depth\fP to set the color depth, and use +\fB\-fbbpp\fP if you really need to force a non-default framebuffer +(hardware) pixel format. +.TP +.B \-configure +When this option is specified, the X server loads all video driver +modules, probes for available hardware, and writes out an initial +XF86Config(__filemansuffix__) file based on what was detected. This +option currently has some problems on some platforms, but in most cases +it is a good way to bootstrap the configuration process. This option +is only available when the server is run as root (i.e, with real-uid +0). +.TP 8 +.B \-crt /dev/tty\fIXX\fP +SCO only. This is the same as the \fBvt\fP option, and is provided for +compatibility with the native SCO X server. .TP 8 .B \-depth \fIn\fP -Sets the default color depth. Legal values are 8, 15, 16, and 24. -Not all servers support all values. +Sets the default color depth. Legal values are 1, 4, 8, 15, 16, and +24. Not all drivers support all values. .TP 8 -.B \-fbbpp \fIn\fP -Sets the number of framebuffer bits per pixel. You should only set -this if you're sure it's necessary; normally the server can deduce the -correct value from \fB\-depth\fP above. Useful if you want to run a -depth 24 configuration with a 24 bpp framebuffer rather than the -(possibly default) 32 bpp framebuffer. Legal values are 8, 16, 24, -32. Not all servers support all values. +.B \-disableModInDev +Disable dynamic modification of input device settings. This is equivalent +to the +.B DisableModInDev +XF86Config(__filemansuffix__) file option. .TP 8 -.B \-weight \fInnn\fP -Set RGB weighting at 16 bpp. The default is 565. This applies -only to those servers which support 16 bpp. +.B \-disableVidMode +Disable the the parts of the VidMode extension (used by the xvidtune +client) that can be used to change the video modes. This is equivalent +to the +.B DisableVidModeExtension +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-fbbpp \fIn\fP +Sets the number of framebuffer bits per pixel. You should only set this +if you're sure it's necessary; normally the server can deduce the correct +value from \fB\-depth\fP above. Useful if you want to run a depth 24 +configuration with a 24 bpp framebuffer rather than the (possibly default) +32 bpp framebuffer (or vice versa). Legal values are 1, 8, 16, 24, 32. +Not all drivers support all values. .TP 8 .B \-flipPixels Swap the default values for the black and white pixels. .TP 8 -.B \-disableVidMode -Disable the the parts of the VidMode extension used by the xvidtune client -that can be used to change the video modes. +.B \-gamma \fIvalue\fP +Set the gamma correction. \fIvalue\fP must be between 0.1 and 10. The +default is 1.0. This value is applied equally to the R, G and B values. +Those values can be set independently with the +.BR \-rgamma , +.BR \-bgamma , +and +.B \-ggamma +options. Not all drivers support this. .TP 8 -.B \-allowNonLocalXvidtune -Allow the xvidtune client to connect from another host. By default non-local -connections are not allowed. +.B \-ggamma \fIvalue\fP +Set the green gamma correction. \fIvalue\fP must be between 0.1 and +10. The default is 1.0. Not all drivers support this. See also the +.BR \-gamma , +.BR \-rgamma , +and +.B \-bgamma +options. +.TP 8 +.B \-ignoreABI +The X server checks the ABI revision levels of each module that it loads. +It will normally refuse to load modules with ABI revisions that are newer +than the server's. This is because such modules might use interfaces that +the server does not have. When this option is specified, mismatches like +this are downgraded from fatal errors to warnings. This option should +be used with care. .TP 8 -.B \-disableModInDev -Disable dynamic modification of input device settings. +.B \-keeptty +Prevent the server from detaching its initial controlling terminal. +This option is only useful when debugging the server. Not all platforms +support (or can use) this option. +.TP 8 +.B \-keyboard \fIkeyboard-name\fP +Use the XF86Config(__filemansuffix__) file +.B InputDevice +section called +.I keyboard-name +as the core keyboard. +By default the core keyboard input device referenced by the default +.B Layout +section are used, or the first relevant +.B InputDevice +section when there are no +.B Layout +sections. +.TP 8 +.B \-layout \fIlayout-name\fP +Use the XF86Config(__filemansuffix__) file +.B Layout +section called +.IR layout-name . +By default the first +.B Layout +section is used. +.TP 8 +.B \-logfile \fIfilename\fP +Use the file called +.I filename +as the X server log file. The default log file is +.B __logdir__/XFree86.\fIn\fP.log +on most platforms, where +.I n +is the display number of the X server. The default may be in a different +directory on some platforms. This option is only available when the +server is run as root (i.e, with real-uid 0). +.TP 8 +.BR \-logverbose " [\fIn\fP]" +Sets the verbosity level for information printed to the X server log +file. If the +.I n +value isn't supplied, each occurrance of this option increments the log +file verbosity level. When the +.I n +value is supplied, the log file verbosity level is set to that value. +The default log file verbosity level is 3. +.TP 8 +.B \-modulepath \fIsearchpath\fP +Set the module search path to +.IR searchpath . +.I searchpath +is a comma separated list of directories to search for X server modules. +This option is only available when the server is run as root (i.e, with +real-uid 0). +.TP 8 +.B \-nosilk +Disable Silken Mouse support. +.TP 8 +.B \-pixmap24 +Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel. +The default is usually 32 bits per pixel. There is normally little +reason to use this option. Some client applications don't like this +pixmap format, even though it is a perfectly legal format. +This is equvalent to the +.B Pixmap +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-pixmap32 +Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel. +This is usually the default. +This is equvalent to the +.B Pixmap +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-pointer \fIpointer-name\fP +Use the XF86Config(__filemansuffix__) file +.B InputDevice +section called +.I pointer-name +as the core pointer. +By default the core pointer input device referenced by the default +.B Layout +section are used, or the first relevant +.B InputDevice +section when there are no +.B Layout +sections. .TP 8 -.B \-allowNonLocalModInDev -Allow changes to keyboard and mouse settings from non-local clients. -By default, connections from non-local clients are not allowed to do this. -.TP -.B \-allowMouseOpenFail -Allow the server to start up even if the mouse device can't be opened or -initialised. +.B \-probeonly +Causes the server to exit after the device probing stage. The XF86Config +file is still used when this option is given, so information that can +be auto-detected should be commented out. .TP 8 -.B \-gamma \fIvalue\fP -Set the gamma correction. \fIvalue\fP must be between 0.1 and 10. The -default is 1.0 -This value is applied equally to the R, G and B values. Not all servers -support this. +.B \-quiet +Suppress most informational messages at startup. The verbosity level +is set to zero. .TP 8 .B \-rgamma \fIvalue\fP -Set the red gamma correction. \fIvalue\fP must be between 0.1 and 10. The -default is 1.0 -Not all servers support this. -.TP 8 -.B \-ggamma \fIvalue\fP -Set the green gamma correction. \fIvalue\fP must be between 0.1 and 10. The -default is 1.0 -Not all servers support this. -.TP 8 -.B \-bgamma \fIvalue\fP -Set the blue gamma correction. \fIvalue\fP must be between 0.1 and 10. The -default is 1.0 -Not all servers support this. +Set the red gamma correction. \fIvalue\fP must be between 0.1 and 10. +The default is 1.0. Not all drivers support this. See also the +.BR \-gamma , +.BR \-bgamma , +and +.B \-ggamma +options. +.TP 8 +.B \-scanpci +When this option is specified, the X server scans the PCI bus, and prints +out some information about each device that was detected. See also +scanpci(1) and pcitweak(1). +.TP 8 +.B \-screen \fIscreen-name\fP +Use the XF86Config(__filemansuffix__) file +.B Screen +section called +.IR screen-name . +By default the screens referenced by the default +.B Layout +section are used, or the first +.B Screen +section when there are no +.B Layout +sections. .TP 8 .B \-showconfig -Print out the server version, patchlevel, and a list of screen drivers -configured in the server. +This is the same as the +.B \-version +option, and is included for compatibilty reasons. It may be removed in +a future release, so the +.B \-version +options hould be used instead. .TP 8 -.B \-verbose -Multiple occurrences of this flag increase the amount of information printed on -stderr (more than the default). +.B \-weight \fInnn\fP +Set RGB weighting at 16 bpp. The default is 565. This applies only to +those drivers which support 16 bpp. +.TP 8 +.BR \-verbose " [\fIn\fP]" +Sets the verbosity level for information printed on stderr. If the +.I n +value isn't supplied, each occurrance of this option increments the +verbosity level. When the +.I n +value is supplied, the verbosity level is set to that value. The default +verbosity level is 1. .TP 8 .B \-version -Same as \fB\-showconfig\fP. +Print out the server version, patchlevel, release date, the operating +system/platform it was built on, and whether it includes module loader +support. .TP 8 .B \-xf86config \fIfile\fP Read the server configuration from \fIfile\fP. This option will work for any file when the server is run as root (i.e, with real-uid 0), or for files relative to a directory in the config search path for all -other users. -.TP 8 -.B \-keeptty -Prevent the server from detaching its initial controlling terminal. This -option is only useful when debugging the server. +other users. .SH "KEYBOARD" Multiple key presses recognized directly by \fIXFree86\fP are: .TP 8 .B Ctrl+Alt+Backspace -Immediately kills the server -- no questions asked. (Can be disabled by -specifying "DontZap" in the \fBServerFlags\fP section of the XF86Config file.) +Immediately kills the server -- no questions asked. This can be disabled +with the +.B DontZap +XF86Config(__filemansuffix__) file option. .TP 8 .B Ctrl+Alt+Keypad-Plus -Change video mode to next one specified in the configuration file, -(increasing video resolution order). +Change video mode to next one specified in the configuration file. +This can be disabled with the +.B DontZoom +XF86Config(__filemansuffix__) file option. .TP 8 .B Ctrl+Alt+Keypad-Minus -Change video mode to previous one specified in the configuration file, -(decreasing video resolution order). +Change video mode to previous one specified in the configuration file. +This can be disabled with the +.B DontZoom +XF86Config(__filemansuffix__) file option. .TP 8 .B Ctrl+Alt+F1...F12 -For BSD systems using the syscons driver and Linux, these keystroke -combinations are used to switch to Virtual -Console 1 through 12. +For BSD and Linux systems with virtual terminal support, these keystroke +combinations are used to switch to Virtual Console 1 through 12. .SH SETUP .I XFree86 uses a configuration file called \fBXF86Config\fP for its initial setup. Refer to the -.I XF86Config(4/5) -manual page for more information. +.I XF86Config(__filemansuffix__) +manual page for information about the +format of this file. .SH FILES +The X server config file can be found in a range of locations. These +are documented fully in the +.I XF86Config(__filemansuffix__) +manual page. The most commonly used locations are shown here. .TP 30 -/etc/XF86Config +/etc/X11/XF86Config Server configuration file .TP 30 -/etc/X11/XF86Config +/etc/X11/XF86Config-4 Server configuration file .TP 30 -/usr/X11R6/etc/XF86Config +/etc/XF86Config Server configuration file .TP 30 -<XRoot>/lib/X11/XF86Config.\fIhostname\fP +__projectroot__/etc/XF86Config Server configuration file .TP 30 -<XRoot>/lib/X11/XF86Config +__projectroot__/lib/X11/XF86Config Server configuration file .TP 30 -<XRoot>/bin/\(** +__logdir__/XFree86.\fIn\fP.log +Server log file for display \fIn\fP. +.TP 30 +__projectroot__/bin/\(** Client binaries .TP 30 -<XRoot>/include/\(** +__projectroot__/include/\(** Header files .TP 30 -<XRoot>/lib/\(** +__projectroot__/lib/\(** Libraries .TP 30 -<XRoot>/lib/X11/fonts/\(** +__projectroot__/lib/X11/fonts/\(** Fonts .TP 30 -<XRoot>/lib/X11/rgb.txt +__projectroot__/lib/X11/rgb.txt Color names to RGB mapping .TP 30 -<XRoot>/lib/X11/XErrorDB +__projectroot__/lib/X11/XErrorDB Client error message database .TP 30 -<XRoot>/lib/X11/app-defaults/\(** +__projectroot__/lib/X11/app-defaults/\(** Client resource specifications .TP 30 -<XRoot>/man/man?/\(** +__projectroot__/man/man?/\(** Manual pages .TP 30 /etc/X\fIn\fP.hosts Initial access control list for display \fIn\fP -.LP -Note: <XRoot> refers to the root of the X11 install tree. .SH "SEE ALSO" X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), -XF86Config(__filemansuffix__), xf86config(1), xf86cfg(1), xvidtune(1) +XF86Config(__filemansuffix__), xf86config(1), xf86cfg(1), xvidtune(1), +apm(__drivermansuffix__), +ati(__drivermansuffix__), +chips(__drivermansuffix__), +cirrus(__drivermansuffix__), +cyrix(__drivermansuffix__), +fbdev(__drivermansuffix__), +glide(__drivermansuffix__), +glint(__drivermansuffix__), +i128(__drivermansuffix__), +i740(__drivermansuffix__), +i810(__drivermansuffix__), +imstt(__drivermansuffix__), +mga(__drivermansuffix__), +neomagic(__drivermansuffix__), +nv(__drivermansuffix__), +r128(__drivermansuffix__), +rendition(__drivermansuffix__), +s3virge(__drivermansuffix__), +siliconmotion(__drivermansuffix__), +sis(__drivermansuffix__), +sunbw2(__drivermansuffix__), +suncg14(__drivermansuffix__), +suncg3(__drivermansuffix__), +suncg6(__drivermansuffix__), +sunffb(__drivermansuffix__), +sunleo(__drivermansuffix__), +suntcx(__drivermansuffix__), +tdfx(__drivermansuffix__), +tga(__drivermansuffix__), +trident(__drivermansuffix__), +tseng(__drivermansuffix__), +v4l(__drivermansuffix__), +vesa(__drivermansuffix__), +vga(__drivermansuffix__), +vmware(__drivermansuffix__), +.br +README +.IR <http://www.xfree86.org/current/README.html> , +.br +RELNOTES +.IR <http://www.xfree86.org/current/RELNOTES.html> , +.br +README.mouse +.IR <http://www.xfree86.org/current/mouse.html> , +.br +README.DRI +.IR <http://www.xfree86.org/current/DRI.html> , +.br +Status +.IR <http://www.xfree86.org/current/Status.html> , +.br +Install +.IR <http://www.xfree86.org/current/Install.html> . + .SH AUTHORS +XFree86 has many contributors world wide. The names of most of them +can be found in the documentation, CHANGELOG files in the source tree, +and in the actual source code. .PP -For X11R5, \fIXF86 1.2\fP was provided by: -.TP 8 -Thomas Roell, \fIroell@informatik.tu-muenchen.de\fP -TU-Muenchen: Server and SVR4 stuff -.TP 8 -Mark W. Snitily, \fImark@sgcs.com\fP -SGCS: SVR3 support, X Consortium Sponsor +XFree86 was originally based on \fIX386 1.2\fP by Thomas Roell, which +was contributed to the then X Consortium's X11R5 distribution by SGCS. .PP - ... and many more people out there on the net who helped with ideas and -bug-fixes. +The project that became XFree86 was originally founded in 1992 by +David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. .PP -XFree86 was integrated into X11R6 by the following team: +XFree86 was later integrated in the then X Consortium's X11R6 release +by a group of dedicated XFree86 developers, including the following: .PP +.RS 4 .nf Stuart Anderson \fIanderson@metrolink.com\fP Doug Anson \fIdanson@lgc.com\fP @@ -350,228 +531,33 @@ Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP Orest Zborowski \fIorestz@eskimo.com\fP .fi +.RE .PP -The \fIXFree86\fP enhancement package was provided by: -.TP 8 -David Dawes, \fIdawes@XFree86.org\fP -Release coordination, administration of FTP repository and mailing lists. -Source tree management -and integration, accelerated server integration, fixing, and coding. -.TP 8 -Glenn Lai, \fIglenn@cs.utexas.edu\fP -The SpeedUp code for ET4000 based SVGA cards, and ET4000/W32 accelerated -server. -.TP 8 -Jim Tsillas, \fIjtsilla@ccs.neu.edu\fP -Many server speedups from the fX386 series of enhancements. -.TP 8 -David Wexelblat, \fIdwex@XFree86.org\fP -Integration of the fX386 code into the default server, -many driver fixes, and driver documentation, assembly of the VGA -card/monitor database, development of the generic video mode listing. -Accelerated server integration, fixing, and coding. -.TP 8 -Dirk Hohndel, \fIhohndel@XFree86.org\fP -Linux shared libraries and release coordination. Accelerated server -integration and fixing. Generic administrivia and documentation. +The current XFree86 core team consists of: .PP -.TP 8 -Amancio Hasty Jr., \fIhasty@netcom.com\fP -Porting to \fB386BSD\fP version 0.1 and XS3 development. -.TP 8 -Rich Murphey, \fIrich@XFree86.org\fP -Ported to \fB386BSD\fP version 0.1 based on the original port by Pace Willison. -Support for \fB386BSD\fP, \fBFreeBSD\fP, and \fBNetBSD\fP. -.TP 8 -Robert Baron, \fIRobert.Baron@ernst.mach.cs.cmu.edu\fP -Ported to \fBMach\fP. -.TP 8 -Orest Zborowski, \fIorestz@eskimo.com\fP -Ported to \fBLinux\fP. -.TP 8 -Doug Anson, \fIdanson@lgc.com\fP -Ported to \fBSolaris x86\fP. -.TP 8 -David Holland, \fIdavidh@use.com\fP -Ported to \fBSolaris x86\fP. -.TP 8 -David McCullough, \fIdavidm@stallion.oz.au\fP -Ported to \fBSCO SVR3\fP. -.TP 8 -Michael Rohleder, \fImichael.rohleder@stadt-frankfurt.de\fP -Ported to \fBISC SVR3\fP. -.TP 8 -Kees Verstoep, \fIversto@cs.vu.nl\fP -Ported to \fBAmoeba\fP based on Leendert van Doorn's original Amoeba port of -X11R5. -.TP 8 -Marc Evans, \fIMarc@XFree86.org\fP -Ported to \fBOSF/1\fP. -.TP 8 -Philip Homburg, \fIphilip@cs.vu.nl\fP -Ported to \fBMinix-386vm\fP. -.TP 8 -Thomas Mueller, \fItm@systrix.de\fP -Ported to \fBLynxOS\fP. -.TP 8 -Jon Tombs, \fItombs@XFree86.org\fP -S3 server and accelerated server coordination. -.TP 8 -Harald Koenig, \fIkoenig@tat.physik.uni-tuebingen.de\fP -S3 server development. -.TP 8 -Bernhard Bender, \fIbr@elsa.mhs.compuserve.com\fP -S3 server development. -.TP 8 -Kevin Martin, \fImartin@cs.unc.edu\fP -Overall work on the base accelerated servers (ATI and 8514/A), and Mach64 -server. -.TP 8 -Rik Faith, \fIfaith@cs.unc.edu\fP -Overall work on the base accelerated servers (ATI and 8514/A). -.TP 8 -Tiago Gons, \fItiago@comosjn.hobby.nl\fP -Mach8 and 8514/A server development -.TP 8 -Hans Nasten, \fInasten@everyware.se\fP -Mach8, 8514/A, and S3 server development and BSD/386 support -.TP 8 -Mike Bernson, \fImike@mbsun.mlb.org\fP -Mach32 server development. -.TP 8 -Mark Weaver, \fIMark_Weaver@brown.edu\fP -Mach32 server development. -.TP 8 -Craig Groeschel, \fIcraig@metrolink.com\fP -Mach32 server development. -.TP 8 -Henry Worth, \fIHenry.Worth@amail.amdahl.com\fP -AGX server. -.TP 8 -Erik Nygren, \fInygren@mit.edu\fP -P9000 server. -.TP 8 -Harry Langenbacher \fIharry@brain.jpl.nasa.gov\fP -P9000 server. -.TP 8 -Chris Mason, \fImason@mail.csh.rit.edu\fP -P9000 server. -.TP 8 -Henrik Harmsen \fIharmsen@eritel.se\fP -P9000 server. -.TP 8 -Simon Cooper, \fIscooper@vizlab.rutgers.edu\fP -Cirrus accelerated code (based on work by Bill Reynolds). -.TP 8 -Harm Hanemaayer, \fIhhanemaa@cs.ruu.nl\fP -Cirrus accelerated code, and ARK driver. -.TP 8 -Thomas Zerucha, \fIzerucha@shell.portal.com\fP -Support for Cirrus CL-GD7543. -.TP 8 -Leon Bottou, \fIbottou@laforia.ibp.fr\fP -ARK driver. -.TP 8 -Mike Tierney, \fIfloyd@eng.umd.edu\fP -WD accelerated code. -.TP 8 -Bill Conn, \fIconn@bnr.ca\fP -WD accelerated code. -.TP 8 -Brad Bosch, \fIbrad@lachman.com\fP -WD 90C24A support. -.TP 8 -Alan Hourihane, \fIalanh@fairlite.demon.co.uk\fP -Trident SVGA driver, SiS SVGA driver and DEC 21030 server. -.TP 8 -Marc Aurele La France, \fItsi@xfree86.org\fP -ATI SVGA driver -.TP 8 -Steve Goldman, \fIsgoldman@encore.com\fP -Oak 067/077 SVGA driver. -.TP 8 -Jorge Delgado, \fIernar@dit.upm.es\fP -Oak SVGA driver, and 087 accelerated code. -.TP 8 -Bill Conn, \fIconn@bnr.ca\fP -WD accelerated code. -.TP 8 -Paolo Severini, \fIlendl@dist.dist.unige.it\fP -AL2101 SVGA driver -.TP 8 -Ching-Tai Chiu, \fIcchiu@netcom.com\fP -Avance Logic ALI SVGA driver -.TP 8 -Manfred Brands, \fImb@oceonics.nl\fP -Cirrus 64xx SVGA driver -.TP 8 -Randy Hendry, \fIrandy@sgi.com\fP -Cirrus 6440 support in the cl64xx SVGA driver -.TP 8 -Frank Dikker, \fIdikker@cs.utwente.nl\fP -MX SVGA driver -.TP 8 -Regis Cridlig, \fIcridlig@dmi.ens.fr\fP -Chips & Technologies driver -.TP 8 -Jon Block, \fIblock@frc.com\fP -Chips & Technologies driver -.TP 8 -Mike Hollick, \fIhollick@graphics.cis.upenn.edu\fP -Chips & Technologies driver -.TP 8 -Nozomi Ytow -Chips & Technologies driver -.TP 8 -Egbert Eich, \fIEgbert.Eich@Physik.TH-Darmstadt.DE\fP -Chips & Technologies driver -.TP 8 -David Bateman, \fIdbateman@ee.uts.edu.au\fP -Chips & Technologies driver -.TP 8 -Xavier Ducoin, \fIxavier@rd.lectra.fr\fP -Chips & Technologies driver -.TP 8 -Peter Trattler, \fIpeter@sbox.tu-graz.ac.at\fP -RealTek SVGA driver -.TP 8 -Craig Struble, \fIcstruble@acm.vt.edu\fP -Video7 SVGA driver -.TP 8 -Gertjan Akkerman, \fIakkerman@dutiba.twi.tudelft.nl\fP -16 colour VGA server, and XF86Config parser. -.TP 8 -Davor Matic, \fIdmatic@Athena.MIT.EDU\fP -Hercules driver. -.TP 8 -Pascal Haible, \fIhaible@izfm.uni-stuttgart.de\fP -Banked monochrome VGA support, Hercules support, and mono frame buffer -support for dumb monochrome devices -.TP 8 -Martin Schaller, -.TP 8 -Geert Uytterhoeven,\fIGeert.Uytterhoeven@cs.kuleuven.ac.be\fP -Linux/m68k Frame Buffer Device driver -.TP 8 -Andreas Schwab, \fIschwab@issan.informatik.uni-dortmund.de\fP -Linux/m68k Frame Buffer Device driver -.TP 8 -Guenther Kelleter, \fIguenther@Pool.Informatik.RWTH-Aachen.de\fP -Linux/m68k Frame Buffer Device driver -.TP 8 -Frederic Lepied, \fILepied@XFree86.Org\fP -XInput extension integration. Wacom, joystick and extended mouse drivers. -.TP 8 -Patrick Lecoanet, \fIlecoanet@cena.dgac.fr\fP -Elographics touchscreen driver. -.TP 8 -Steven Lang, \fItiger@tyger.org\fP -SummaSketch tablet driver. -.PP - ... and many more people out there on the net who helped with beta-testing -this enhancement. +.RS 4 +.nf +Stuart Anderson \fIanderson@metrolink.com\fP +Preston Brown \fIpbrown@redhat.com\fP +Robin Cutshaw \fIrobin@xfree86.org\fP +David Dawes \fIdawes@xfree86.org\fP +Egbert Eich \fIeich@xfree86.org\fP +Marc Evans \fImarc@xfree86.org\fP +Dirk Hohndel \fIhohndel@xfree86.org\fP +Alan Hourihane \fIalanh@xfree86.org\fP +Harald Koenig \fIkoenig@xfree86.org\fP +Marc La France \fItsi@xfree86.org\fP +Kevin Martin \fImartin@xfree86.org\fP +Rich Murphey \fIrich@xfree86.org\fP +Takaaki Nomura \fIamadeus@yk.rim.or.jp\fP +Keith Packard \fIkeithp@xfree86.org\fP +Jon Tombs \fIjon@gtex02.us.es\fP +Mark Vojkovich \fImarkv@xfree86.org\fP +David Wexelblat \fIdwex@xfree86.org\fP +.fi +.RE .PP \fIXFree86\fP source is available from the FTP server -\fIftp.XFree86.org\fP, among others. Send email to -\fIXFree86@XFree86.org\fP for details. -.\" $XConsortium: XFree86.man /main/25 1996/12/09 17:33:22 kaleb $ +\fI<ftp://ftp.XFree86.org/pub/XFree86/>\fP, among others. Documentation +and other information can be found from the XFree86 web site +\fI<http://www.xfree86.org/>\fP. diff --git a/xc/programs/Xserver/hw/xfree86/common/Imakefile b/xc/programs/Xserver/hw/xfree86/common/Imakefile index 1e34a5749..d72ac7aba 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.126 2001/02/15 18:20:33 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.130 2001/03/24 16:32:41 herrb Exp $ @@ -17,7 +17,8 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.126 2001/02/ KBD = xf86KbdMach #endif /* GNUMachArchitecture */ #else -# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) +# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \ + || defined(OpenBSDArchitecture) && defined(PpcArchitecture) KBD = xf86KbdBSD # else # ifdef LinuxArchitecture @@ -59,10 +60,6 @@ LOGDEFINES = -DDEFAULT_LOGPREFIX=\"$(LOGDIRECTORY)/XLogFile.\" EXT_MODULES_DEFINES = $(GLX_DEFINES) #endif -#if defined(LinuxArchitecture) && defined(PpcArchitecture) - KBDDEFINES = -DASSUME_CUSTOM_KEYCODES -#endif - #ifndef XF86ExpireServer #define XF86ExpireServer NO #endif @@ -109,6 +106,7 @@ SRCS = \ xf86VidMode.c \ xf86fbman.c \ xf86xv.c \ + xf86xvmc.c \ xf86cmap.c\ xf86PM.c \ $(DEBUGSRC) \ @@ -143,6 +141,7 @@ OBJS = \ xf86VidMode.o \ xf86fbman.o \ xf86xv.o \ + xf86xvmc.o \ xf86cmap.o\ xf86PM.o \ $(DEBUGOBJ) \ @@ -180,7 +179,6 @@ CUSTOMVERSION = XFree86CustomVersion #endif CONSDEFINES = XFree86ConsoleDefines EXP_DEFINES = -DEXPIRY_TIME=XF86ServerExpiry $(EXP_FORCE_DEFINES) -PROJECTROOT = ProjectRoot DRIVERS = XF86CardDrivers IDRIVERS = XInputDrivers XCONFIGDEFINES = -DPROJECTROOT='"$(PROJECTROOT)"' \ diff --git a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h index 134136122..bfaa57499 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.15 2000/08/11 23:59:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.16 2001/03/07 19:53:16 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -189,9 +189,14 @@ #define KEY_F13 /* F13 0x6e */ 110 #define KEY_F14 /* F14 0x6f */ 111 #define KEY_F15 /* F15 0x70 */ 112 +#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112 #define KEY_F16 /* F16 0x71 */ 113 #define KEY_F17 /* F17 0x72 */ 114 #define KEY_KP_DEC /* KP_DEC 0x73 */ 115 +#define KEY_BSlash2 /* \ _ 0x73 */ 115 +#define KEY_XFER /* Kanji Transfer 0x79 */ 121 +#define KEY_NFER /* No Kanji Transfer 0x7b */ 123 +#define KEY_Yen /* Yen 0x7d */ 125 /* These are for "notused" and "uknown" entries in translation maps. */ #define KEY_NOTUSED 0 diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h index d9e17bfdc..0e93aac95 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.77 2001/01/06 21:29:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.79 2001/04/01 14:00:07 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -429,6 +429,19 @@ __ustw (unsigned long r5, unsigned short * r11) #define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") #define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") +/* + * This is overkill, but for different reasons depending on where it is used. + * This is thus general enough to be used everywhere cache flushes are needed. + * It doesn't handle memory access serialisation by other processors, though. + */ +#define ia64_flush_cache(Addr) \ + __asm__ __volatile__ ( \ + "fc %0;;;" \ + "sync.i;;;" \ + "mf;;;" \ + "srlz.i;;;" \ + :: "r"(Addr) : "memory") + #undef outb #undef outw #undef outl @@ -1510,27 +1523,28 @@ extern void xf86JensenMemToBus(char *, long, long, int); extern void xf86JensenBusToMem(char *, char *, unsigned long, int); extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int); extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); + /* Some macros to hide the system dependencies for MMIO accesses */ /* Changed to kill noise generated by gcc's -Wcast-align */ #define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset) #define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset) -# if defined (JENSEN_SUPPORT) #define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset) + +# if defined (JENSEN_SUPPORT) #define MMIO_OUT32(base, offset, val) \ (*xf86WriteMmio32)((CARD32)(val), base, offset) #define MMIO_ONB32(base, offset, val) \ (*xf86WriteMmioNB32)((CARD32)(val), base, offset) # else -#define MMIO_IN32(base, offset) \ - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) #define MMIO_OUT32(base, offset, val) \ do { \ - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ write_mem_barrier(); \ + *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ } while (0) #define MMIO_ONB32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) # endif + #define MMIO_OUT8(base, offset, val) \ (*xf86WriteMmio8)((CARD8)(val), base, offset) #define MMIO_OUT16(base, offset, val) \ @@ -1539,6 +1553,7 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); (*xf86WriteMmioNB8)((CARD8)(val), base, offset) #define MMIO_ONB16(base, offset, val) \ (*xf86WriteMmioNB16)((CARD16)(val), base, offset) + #elif defined(__powerpc__) /* * we provide byteswapping and no byteswapping functions here @@ -1550,6 +1565,7 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); xf86WriteMmio8(base, offset, (CARD8)(val)) # define MMIO_ONB8(base, offset, val) \ xf86WriteMmioNB8(base, offset, (CARD8)(val)) + # if defined(PPC_MMIO_IS_BE) /* No byteswapping */ # define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) # define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) @@ -1573,6 +1589,7 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); # define MMIO_ONB32(base, offset, val) \ xf86WriteMmioNB32Le(base, offset, (CARD32)(val)) # endif + static __inline__ void ppc_flush_icache(char *addr) { __asm__ volatile ( @@ -1597,6 +1614,7 @@ static __inline__ void ppc_flush_icache(char *addr) xf86WriteMmio8(base, offset, (CARD8)(val)) # define MMIO_ONB8(base, offset, val) \ xf86WriteMmio8NB(base, offset, (CARD8)(val)) + # if defined(SPARC_MMIO_IS_BE) /* No byteswapping */ # define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) # define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) @@ -1620,7 +1638,9 @@ static __inline__ void ppc_flush_icache(char *addr) # define MMIO_ONB32(base, offset, val) \ xf86WriteMmio32LeNB(base, offset, (CARD32)(val)) # endif + #else /* !__alpha__ && !__powerpc__ && !__sparc__ */ + #define MMIO_IN8(base, offset) \ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) #define MMIO_IN16(base, offset) \ @@ -1636,6 +1656,7 @@ static __inline__ void ppc_flush_icache(char *addr) #define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val) #define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val) #define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val) + #endif /* __alpha__ */ /* diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h index 3abc4cf8f..0835d874c 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.147 2000/12/07 20:26:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.150 2001/04/05 17:42:31 dawes Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -42,6 +42,8 @@ extern Bool fbSlotClaimed; #ifdef __sparc__ extern Bool sbusSlotClaimed; #endif +extern confDRIRec xf86ConfigDRI; + #define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr)) #define XF86FLIP_PIXELS() \ @@ -134,6 +136,7 @@ pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID, char n, pciVideoPtr pvp_exclude); pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, char n, pciVideoPtr pvp_exclude); +void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable); void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg); Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func); #ifdef async diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c index 79b9925f1..3533bb7d4 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.60 2001/02/15 20:31:44 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.61 2001/04/01 14:00:07 tsi Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -1413,23 +1413,21 @@ RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated /* Possibly ignore estimated resources */ if (!useEstimated && (pRes->res_type & ResEstimated)) continue; /* - * target should be a larger region than pRes. If pRes fully + * Target should be a larger region than pRes. If pRes fully * contains target, don't do anything. */ if (pRes->block_begin <= target->block_begin && pRes->block_end >= target->block_end) continue; /* - * cases where the target and pRes have the same starting address - * cannot be resolved, so skip them (with a warning). + * In cases where the target and pRes have the same starting + * address, reduce the size of the target (given it's an estimate). */ if (pRes->block_begin == target->block_begin) { - xf86MsgVerb(X_WARNING, 3, "Unresolvable overlap at 0x%08x\n", - pRes->block_begin); - continue; + target->block_end = pRes->block_end; } /* Otherwise, trim target to remove the overlap */ - if (pRes->block_begin <= target->block_end) { + else if (pRes->block_begin <= target->block_end) { target->block_end = pRes->block_begin - 1; } else if (!pow2Alignment && pRes->block_end >= target->block_begin) { diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c index 676190b55..4f524be61 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.239 2001/02/15 20:31:46 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.241 2001/03/28 17:58:39 dawes Exp $ */ /* @@ -774,14 +774,12 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) Bool value; MessageType from; - if(flagsconf == NULL) - return TRUE; /* * Merge the ServerLayout and ServerFlags options. The former have * precedence over the latter. */ optp = NULL; - if (flagsconf->flg_option_lst) + if (flagsconf && flagsconf->flg_option_lst) optp = xf86optionListDup(flagsconf->flg_option_lst); if (layoutopts) { tmp = xf86optionListDup(layoutopts); @@ -938,9 +936,9 @@ static Bool configInputKbd(IDevPtr inputp) { char *s; -#ifdef XKB MessageType from = X_DEFAULT; -#endif + Bool customKeycodesDefault = FALSE; + int verb = 0; /* Initialize defaults */ xf86Info.xleds = 0L; @@ -953,6 +951,7 @@ configInputKbd(IDevPtr inputp) #if defined(SVR4) && defined(i386) xf86Info.panix106 = FALSE; #endif + xf86Info.kbdCustomKeycodes = FALSE; #ifdef XKB if (!xf86IsPc98()) { xf86Info.xkbrules = "xfree86"; @@ -1135,6 +1134,39 @@ configInputKbd(IDevPtr inputp) } #endif + /* + * This was once a compile time option (ASSUME_CUSTOM_KEYCODES) + * defaulting to 1 on Linux/PPC. It is no longer necessary, but for + * backwards compatibility we provide 'Option "CustomKeycodes"' + * and try to autoprobe on Linux/PPC. + */ + from = X_DEFAULT; + verb = 2; +#if defined(__linux__) && defined(__powerpc__) + { + FILE *f; + + f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r"); + if (f) { + if (fgetc(f) == '0') { + customKeycodesDefault = TRUE; + from = X_PROBED; + verb = 1; + } + fclose(f); + } + } +#endif + if (xf86FindOption(inputp->commonOptions, "CustomKeycodes")) { + from = X_CONFIG; + verb = 1; + } + xf86Info.kbdCustomKeycodes = + xf86SetBoolOption(inputp->commonOptions, "CustomKeycodes", + customKeycodesDefault); + xf86MsgVerb(from, verb, "Keyboard: CustomKeycode %s\n", + xf86Info.kbdCustomKeycodes ? "enabled" : "disabled"); + return TRUE; } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c b/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c index 3557c9948..24bd7ada2 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c @@ -3,7 +3,7 @@ Written by Mark Vojkovich */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.39 2001/02/15 20:31:50 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.40 2001/03/04 01:29:03 tsi Exp $ */ #include "xf86.h" #include "xf86str.h" @@ -228,7 +228,7 @@ DGAInstallColormap(ColormapPtr pmap) ScreenPtr pScreen = pmap->pScreen; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - if(pScreenPriv->current) { + if(pScreenPriv->current && pScreenPriv->dgaColormap) { if (pmap != pScreenPriv->dgaColormap) { pScreenPriv->savedColormap = pmap; pmap = pScreenPriv->dgaColormap; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c index 76b15f4fd..75badb64b 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.104 2000/12/07 20:32:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.107 2001/03/08 00:40:42 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -295,9 +295,9 @@ ProcessInputEvents () * ifdefs further (hv). */ -#ifdef ASSUME_CUSTOM_KEYCODES +#ifdef __linux__ extern u_char SpecialServerMap[]; -#endif /* ASSUME_CUSTOM_KEYCODES */ +#endif #if !defined(__EMX__) && !defined(__SOL8__) && !defined(__CYGWIN__) void @@ -347,30 +347,27 @@ xf86PostKbdEvent(unsigned key) * PANIX returns DICOP standards based keycodes in using 106jp * keyboard. We need to remap some keys. */ -#define KEY_P_UP 0x5A -#define KEY_P_PGUP 0x5B -#define KEY_P_LEFT 0x5C -#define KEY_P_BKSL 0x73 -#define KEY_P_YEN 0x7D -#define KEY_P_NFER 0x7B -#define KEY_P_XFER 0x79 - if(xf86Info.panix106 == TRUE){ switch (scanCode) { - /* case 0x78: scanCode = KEY_P_UP; break; not needed*/ - case 0x56: scanCode = KEY_P_BKSL; break; /* Backslash */ - case 0x5A: scanCode = KEY_P_NFER; break; /* No Kanji Transfer*/ - case 0x5B: scanCode = KEY_P_XFER; break; /* Kanji Tranfer */ - case 0x5C: scanCode = KEY_P_YEN; break; /* Yen curs pgup */ - case 0x6B: scanCode = KEY_P_LEFT; break; /* Cur Left */ - case 0x6F: scanCode = KEY_P_PGUP; break; /* Cur PageUp */ + case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */ + case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/ + case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */ + case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */ + case 0x6B: scanCode = KEY_Left; break; /* Cur Left */ + case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */ case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */ case 0x73: scanCode = KEY_RCtrl; break; /* not needed */ } } #endif /* i386 && SVR4 */ -#ifndef ASSUME_CUSTOM_KEYCODES +#ifdef __linux__ + if (xf86Info.kbdCustomKeycodes) { + specialkey = SpecialServerMap[scanCode]; + goto customkeycodes; + } +#endif + /* * First do some special scancode remapping ... */ @@ -457,18 +454,14 @@ xf86PostKbdEvent(unsigned key) if (scanCode != KEY_NumLock) return; scanCode = KEY_Pause; /* pause */ } -#endif /* !ASSUME_CUSTOM_KEYCODES */ /* * and now get some special keysequences */ -#ifdef ASSUME_CUSTOM_KEYCODES - specialkey = SpecialServerMap[scanCode]; -#else /* ASSUME_CUSTOM_KEYCODES */ specialkey = scanCode; -#endif /* ASSUME_CUSTOM_KEYCODES */ +customkeycodes: if (xf86IsPc98()) { switch (scanCode) { case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ @@ -859,25 +852,25 @@ special: updateLeds = TRUE; } -#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__) && !defined(__CYGWIN__) + if (!xf86Info.kbdCustomKeycodes) { /* - * magic ALT_L key on AT84 keyboards for multilingual support + * normal, non-keypad keys */ - if (xf86Info.kbdType == KB_84 && - ModifierDown(AltMask) && - keysym[2] != NoSymbol) - { - UsePrefix = TRUE; - Direction = TRUE; - } + if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { +#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) + /* + * magic ALT_L key on AT84 keyboards for multilingual support + */ + if (xf86Info.kbdType == KB_84 && + ModifierDown(AltMask) && + keysym[2] != NoSymbol) + { + UsePrefix = TRUE; + Direction = TRUE; + } #endif /* !CSRG_BASED && !MACH386 && !MINIX && !__OSF__ */ + } } -#endif /* !ASSUME_CUSTOM_KEYCODES */ if (updateLeds) xf86KbdLeds(); #ifdef XKB } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c b/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c index 4ce0bd06a..19a8bc4a0 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.28 2000/03/08 05:38:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.29 2001/03/05 20:18:19 dawes Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -137,6 +137,7 @@ xf86InfoRec xf86Info = { #if defined(i386) || defined(__i386__) FALSE, /* pc98 */ #endif + FALSE, /* kbdCustomKeycodes */ TRUE, /* pmFlag */ 0 /* estimateSizesAggressively */ }; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c index 375cf8391..ba740e464 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.14 2000/08/11 17:27:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.15 2001/03/08 23:23:32 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,7 @@ #define KD_GET_ENTRY(i,n) \ eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] -static unsigned char remap[128] = { +static unsigned char remap[NUM_KEYCODES] = { 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 */ @@ -131,6 +131,74 @@ static KeySym eascii_to_x[512] = { * special marked entries (256 + x) */ +#if 1 + /* This has been checked against what syscons actually does */ + NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, + XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, + XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, XK_F1, + XK_F2, XK_F3, XK_F4, XK_F5, + XK_F6, XK_F7, XK_F8, XK_F9, + XK_F10, XK_F11, XK_F12, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol +#else + /* The old table, supposedly for pcvt. */ NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R, @@ -194,6 +262,8 @@ static KeySym eascii_to_x[512] = { NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol +#endif }; #ifdef __OpenBSD__ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c index 5a6d1df28..1f97c0b15 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.15 1999/04/29 05:12:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.16 2001/03/05 20:18:20 dawes Exp $ */ /* * Linux version of keymapping setup. The kernel (since 0.99.14) has support * for fully remapping the keyboard, but there are some differences between @@ -205,8 +205,6 @@ static KeySym linux_to_x[256] = { XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis }; -#ifndef ASSUME_CUSTOM_KEYCODES - /* * Maps the AT keycodes to Linux keycodes */ @@ -279,19 +277,16 @@ static unsigned char at2lnx[NUM_KEYCODES] = }; #define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) -#else /* !ASSUME_CUSTOM_KEYCODES */ - -#define NUM_AT2LNX NR_KEYS - -u_char SpecialServerMap[NR_KEYS]; +#define NUM_CUSTOMKEYS NR_KEYS -#endif /* !ASSUME_CUSTOM_KEYCODES */ +u_char SpecialServerMap[NUM_CUSTOMKEYS]; static void readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap) { KeySym *k; int i; + int maxkey; static unsigned char tbl[GLYPHS_PER_KEY] = { 0, /* unshifted */ @@ -312,20 +307,24 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap) tbl[2] = 8; /* alt */ tbl[3] = tbl[2] | 1; -#ifndef ASSUME_CUSTOM_KEYCODES - for (i = 0, k = map+GLYPHS_PER_KEY; i < NUM_AT2LNX; ++i) -#else /* !ASSUME_CUSTOM_KEYCODES */ - for (i = 0, k = map; i < NUM_AT2LNX; ++i) -#endif /* !ASSUME_CUSTOM_KEYCODES */ + if (xf86Info.kbdCustomKeycodes) { + k = map; + maxkey = NUM_CUSTOMKEYS; + } + else { + k = map+GLYPHS_PER_KEY; + maxkey = NUM_AT2LNX; + } + + for (i = 0; i < maxkey; ++i) { struct kbentry kbe; int j; -#ifndef ASSUME_CUSTOM_KEYCODES - kbe.kb_index = at2lnx[i]; -#else /* !ASSUME_CUSTOM_KEYCODES */ - kbe.kb_index = i; -#endif /* !ASSUME_CUSTOM_KEYCODES */ + if (xf86Info.kbdCustomKeycodes) + kbe.kb_index = i; + else + kbe.kb_index = at2lnx[i]; for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) { @@ -335,9 +334,7 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap) kbe.kb_table = tbl[j]; if ( -#ifndef ASSUME_CUSTOM_KEYCODES - kbe.kb_index == 0 || -#endif /* !ASSUME_CUSTOM_KEYCODES */ + (!xf86Info.kbdCustomKeycodes && kbe.kb_index == 0) || ioctl(xf86Info.consoleFd, KDGKBENT, &kbe)) continue; @@ -549,11 +546,14 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap) if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol; if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol; } -#ifdef ASSUME_CUSTOM_KEYCODES + + if (!xf86Info.kbdCustomKeycodes) + return; + /* * Find the Mapping for the special server functions */ - for (i = 0; i < NR_KEYS; ++i) { + for (i = 0; i < NUM_CUSTOMKEYS; ++i) { struct kbentry kbe; int special = 0; @@ -618,5 +618,4 @@ readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap) } SpecialServerMap[i] = special; } -#endif /* ASSUME_CUSTOM_KEYCODES */ } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h b/xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h index d53e0f916..71883403b 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.13 2000/08/11 17:27:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.14 2001/03/08 23:23:32 dawes Exp $ */ /* * * For Scancodes see notes in atKeynames.h !!!! @@ -22,7 +22,7 @@ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { /* 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, + /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol, /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, @@ -118,23 +118,24 @@ static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { /* 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, + /* 0x6e */ XK_F13, NoSymbol, NoSymbol, NoSymbol, + /* 0x6f */ XK_F14, NoSymbol, NoSymbol, NoSymbol, + /* 0x70 */ XK_F15, NoSymbol, NoSymbol, NoSymbol, + /* 0x71 */ XK_F16, NoSymbol, NoSymbol, NoSymbol, + /* 0x72 */ XK_F17, NoSymbol, NoSymbol, NoSymbol, + /* 0x73 */ XK_backslash, XK_underscore, 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, + /* 0x79 */ XK_Henkan, XK_Mode_switch, NoSymbol, NoSymbol, /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7b */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol, /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7d */ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, }; #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/xf86Mode.c b/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c index 13ef6379e..a16bed340 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Mode.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.38 2001/02/15 20:31:51 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.39 2001/03/22 03:51:39 dawes Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -1736,9 +1736,12 @@ xf86PrintModes(ScrnInfoPtr scrp) desc = desc2 = ""; if (p->HSync > 0.0) hsync = p->HSync; - else + else if (p->HTotal > 0) hsync = (float)p->Clock / (float)p->HTotal; - refresh = hsync * 1000.0 / p->VTotal; + else + hsync = 0.0; + if (p->VTotal > 0) + refresh = hsync * 1000.0 / p->VTotal; if (p->Flags & V_INTERLACE) { refresh *= 2.0; desc = " (I)"; @@ -1759,7 +1762,10 @@ xf86PrintModes(ScrnInfoPtr scrp) prefix = "Default mode"; else prefix = "Mode"; - if (p->Clock == p->SynthClock) { + if (hsync == 0 || refresh == 0) { + xf86DrvMsg(scrp->scrnIndex, X_CONFIG, + "%s \"%s\"\n", prefix, p->name); + } else if (p->Clock == p->SynthClock) { xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n", prefix, p->name, p->Clock / 1000.0, hsync, refresh, @@ -1771,7 +1777,8 @@ xf86PrintModes(ScrnInfoPtr scrp) prefix, p->name, p->Clock / 1000.0, p->SynthClock / 1000.0, hsync, refresh, desc, desc2); } - PrintModeline(scrp->scrnIndex,p); + if (hsync != 0 && refresh != 0) + PrintModeline(scrp->scrnIndex,p); p = p->next; } while (p != NULL && p != scrp->modes); } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h index 41c86c6bb..8e02cd11a 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.27 2000/11/14 16:54:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.28 2001/03/13 16:03:36 dawes Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -62,8 +62,8 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 1) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 3) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 1) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 4) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 2) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 1) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 2) diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h b/xc/programs/Xserver/hw/xfree86/common/xf86Opt.h index 4bb128eaa..85c47b5ba 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.10 2000/08/04 16:13:25 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.11 2001/03/13 16:03:36 dawes Exp $ */ /* Option handling things that ModuleSetup procs can use */ @@ -43,6 +43,7 @@ typedef struct { } OptionInfoRec, *OptionInfoPtr; int xf86SetIntOption(pointer optlist, const char *name, int deflt); +double xf86SetRealOption(pointer optlist, const char *name, double deflt); char *xf86SetStrOption(pointer optlist, const char *name, char *deflt); int xf86SetBoolOption(pointer list, const char *name, int deflt ); pointer xf86AddNewOption(pointer head, char *name, char *val ); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Option.c b/xc/programs/Xserver/hw/xfree86/common/xf86Option.c index a3ceb5800..4944d8062 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.21 2000/10/20 14:58:59 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.22 2001/03/13 16:03:36 dawes Exp $ */ /* * Copyright (c) 1998 by The XFree86 Project, Inc. @@ -155,6 +155,19 @@ xf86SetIntOption(pointer optlist, const char *name, int deflt) } +double +xf86SetRealOption(pointer optlist, const char *name, double deflt) +{ + OptionInfoRec o; + + o.name = name; + o.type = OPTV_REAL; + if (ParseOptionValue(-1, optlist, &o)) + deflt = o.value.realnum; + return deflt; +} + + char * xf86SetStrOption(pointer optlist, const char *name, char *deflt) { diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h index 048a6d887..a1aa5ecdc 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.88 2001/02/17 23:19:51 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.94 2001/04/05 21:29:13 dawes Exp $ */ /* * PCI Probe * @@ -150,6 +150,7 @@ #define PCI_VENDOR_TRITECH 0x1292 #define PCI_VENDOR_NVIDIA_SGS 0x12d2 #define PCI_VENDOR_NETGEAR 0x1385 +#define PCI_VENDOR_VMWARE 0x15AD #define PCI_VENDOR_SYMPHONY 0x1C1C #define PCI_VENDOR_TEKRAM_2 0x1DE1 #define PCI_VENDOR_3DLABS 0x3D3D @@ -341,6 +342,8 @@ #define PCI_CHIP_9750 0x9750 #define PCI_CHIP_9850 0x9850 #define PCI_CHIP_9880 0x9880 +#define PCI_CHIP_9910 0x9910 +#define PCI_CHIP_9930 0x9930 /* ALI */ #define PCI_CHIP_M1435 0x1435 @@ -489,21 +492,25 @@ #define PCI_CHIP_GEFORCE2GTS_1 0x0151 #define PCI_CHIP_GEFORCE2ULTRA 0x0152 #define PCI_CHIP_QUADRO2PRO 0x0153 -#define PCI_CHIP_0200 0x0200 -#define PCI_CHIP_0201 0x0201 -#define PCI_CHIP_0202 0x0202 -#define PCI_CHIP_0203 0x0203 +#define PCI_CHIP_GEFORCE3 0x0200 +#define PCI_CHIP_GEFORCE3_1 0x0201 +#define PCI_CHIP_GEFORCE3_2 0x0202 +#define PCI_CHIP_GEFORCE3_3 0x0203 /* NVIDIA & SGS */ #define PCI_CHIP_RIVA128 0x0018 +/* IMS */ +#define PCI_CHIP_IMSTT128 0x9128 +#define PCI_CHIP_IMSTT3D 0x9135 + /* Alliance Semiconductor */ #define PCI_CHIP_AP6410 0x3210 #define PCI_CHIP_AP6422 0x6422 #define PCI_CHIP_AT24 0x6424 #define PCI_CHIP_AT3D 0x643D -/* 3Dfx Interactive */ +/* 3dfx Interactive */ #define PCI_CHIP_VOODOO_GRAPHICS 0x0001 #define PCI_CHIP_VOODOO2 0x0002 #define PCI_CHIP_BANSHEE 0x0003 @@ -524,6 +531,10 @@ #define PCI_CHIP_GAMMA 0x0008 #define PCI_CHIP_PERMEDIA2V 0x0009 #define PCI_CHIP_PERMEDIA3 0x000A +#define PCI_CHIP_PERMEDIA4 0x000C +#define PCI_CHIP_R4 0x000D +#define PCI_CHIP_GAMMA2 0x000E +#define PCI_CHIP_R4ALT 0x0011 /* S3 */ #define PCI_CHIP_PLATO 0x0551 @@ -598,6 +609,10 @@ #define PCI_CHIP_SMI712 0x712 #define PCI_CHIP_SMI720 0x720 +/* VMware */ +#define PCI_CHIP_VMWARE0405 0x0405 +#define PCI_CHIP_VMWARE0710 0x0710 + /* * first the VendorId - VendorName mapping */ @@ -699,7 +714,7 @@ static SymTabRec xf86PCIVendorNameInfoData[] = { {PCI_VENDOR_RICOH, "Ricoh"}, {PCI_VENDOR_ZEINET, "Zeinet"}, {PCI_VENDOR_LITEON, "Lite-On"}, - {PCI_VENDOR_3DFX, "3Dfx Interactive"}, + {PCI_VENDOR_3DFX, "3dfx Interactive"}, {PCI_VENDOR_SIGMADESIGNS, "Sigma Designs"}, {PCI_VENDOR_ENSONIQ, "Ensoniq"}, {PCI_VENDOR_ROCKWELL, "Rockwell"}, @@ -718,6 +733,7 @@ static SymTabRec xf86PCIVendorNameInfoData[] = { {PCI_VENDOR_ARK, "ARK Logic"}, {PCI_VENDOR_YAMAHA, "Yamaha"}, {PCI_VENDOR_SMI, "Silicon Motion Inc."}, + {PCI_VENDOR_VMWARE, "VMware"}, {0,NULL} }; #endif @@ -854,7 +870,7 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_VENDOR_DIGITAL, { {PCI_CHIP_DEC21030, "21030/TGA",0}, {0x0001, "DC21050 PCI-PCI Bridge" - /* print_pcibridge} */,0 }, + /* print_pcibridge */,0 }, {0x0002, "DC21040 10Mb/s Ethernet",0 }, {0x0009, "DC21140 10/100 Mb/s Ethernet",0 }, {0x000D, "TGA2",0 }, @@ -919,6 +935,8 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_9750, "3DImage975",0}, {PCI_CHIP_9850, "3DImage985",0}, {PCI_CHIP_9880, "Blade3D",0}, + {PCI_CHIP_9910, "Cyber/BladeXP",0}, + {PCI_CHIP_9930, "CyberBlade/XPm",0}, {PCI_CHIP_8400, "CyberBlade/i7",0}, {PCI_CHIP_8420, "CyberBlade/DSTN/i7",0}, {PCI_CHIP_8500, "CyberBlade/i1",0}, @@ -1228,11 +1246,19 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)",0}, {PCI_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra",0}, {PCI_CHIP_QUADRO2PRO, "Quadro 2 Pro",0}, + {PCI_CHIP_GEFORCE3, "GeForce3",0}, + {PCI_CHIP_GEFORCE3_1, "GeForce3 (rev 1)",0}, + {PCI_CHIP_GEFORCE3_2, "GeForce3 (rev 2)",0}, + {PCI_CHIP_GEFORCE3_3, "GeForce3 (rev 3)",0}, {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_IMS, { + {PCI_CHIP_IMSTT128, "TwinTurbo 128", 0}, + {PCI_CHIP_IMSTT3D, "TwinTurbo 3D", 0}, +#ifdef VENDOR_INCLUDE_NONVIDEO {0x8849, "8849",0 }, +#endif {0x0000, NULL,0}}}, +#ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_TEKRAM, { {0x690C, "DC690C",0 }, {0x0000, NULL,0}}}, @@ -1388,6 +1414,10 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_GAMMA, "GLINT Gamma",0}, {PCI_CHIP_PERMEDIA2V, "GLINT Permedia 2v",0}, {PCI_CHIP_PERMEDIA3, "GLINT Permedia 3",0}, + {PCI_CHIP_PERMEDIA4, "GLINT Permedia 4",0}, + {PCI_CHIP_R4, "GLINT R4",0}, + {PCI_CHIP_R4ALT, "GLINT R4 (Alt)",0}, + {PCI_CHIP_GAMMA2, "GLINT Gamma 2",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_AVANCE_2, { {PCI_CHIP_ALG2064, "ALG2064",0}, @@ -1521,6 +1551,10 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_SMI712, "LynxEM+",0}, {PCI_CHIP_SMI720, "Lynx3DM",0}, {0x0000, NULL,0}}}, + {PCI_VENDOR_VMWARE, { + {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0}, + {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0}, + {0x0000, NULL,0}}}, {0x0000, { {0x0000, NULL,0}}}, }; @@ -1578,14 +1612,14 @@ static pciVendorCardInfo xf86PCICardInfoData[] = { { 0x0000, (char *)NULL,0, NF } } }, #endif { PCI_VENDOR_SONY, { - { 0x8051, "Vaio Video",0,NF }, + { 0x8051, "Vaio Video",0,NF }, #ifdef VENDOR_INCLUDE_NONVIDEO - { 0x8052, "Vaio Audio",0,NF }, - { 0x8054, "Vaio Firewire",0,NF }, - { 0x8056, "Vaio Modem",0,NF }, - { 0x8057, "Vaio Ethernet",0,NF }, + { 0x8052, "Vaio Audio",0,NF }, + { 0x8054, "Vaio Firewire",0,NF }, + { 0x8056, "Vaio Modem",0,NF }, + { 0x8057, "Vaio Ethernet",0,NF }, #endif - { 0x0000, (char *)NULL,0, NF } } }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_DIAMOND, { { 0x0003, "Monster Fusion",0, NF }, { 0x00b8, "Fire GL1",0, NF }, @@ -1609,8 +1643,25 @@ static pciVendorCardInfo xf86PCICardInfoData[] = { { 0x3db3, "Jeronimo Pro",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_3DLABS, { - { 0x0106, "GMX2000",0, NF }, - { 0x0116, "GVX1",0, NF }, + { 0x0096, "Permedia",0, NF }, + { 0x0098, "PermediaNT",0, NF }, + { 0x0099, "PermediaLC",0, NF }, + { 0x0100, "Permedia2 PCI",0, NF }, + { 0x0101, "Permedia2 AGP",0, NF }, + { 0x0102, "Oxygen GMX2000 PCI",0, NF }, + { 0x0106, "Oxygen GMX2000 AGP",0, NF }, + { 0x0116, "Oxygen GVX1 AGP",0, NF }, + { 0x0121, "Oxygen VX1 PCI",0, NF }, + { 0x0122, "Oxygen ACX AGP",0, NF }, + { 0x0123, "Oxygen ACX PCI",0, NF }, + { 0x0125, "Oxygen VX1 AGP",0, NF }, + { 0x0127, "Permedia3 Create!",0, NF }, + { 0x0134, "Oxygen GVX1 PCI",0, NF }, + { 0x0136, "Oxygen GVX210 AGP",0, NF }, + { 0x0140, "Oxygen VX1-16 AGP",0, NF }, + { 0x0144, "Oxygen VX1-4X AGP",0, NF }, + { 0x0400, "Oxygen GVX420 AGP",0, NF }, + { 0x0800, "Oxygen VX1-1600SW PCI",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_ELSA, { { 0x0914, "Winner 1000",0, NF }, @@ -1732,6 +1783,12 @@ static pciVendorCardInfo xf86PCICardInfoData[] = { { 0xf004, "FA310-TX Rev. D2",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, #endif +#if 0 + { PCI_VENDOR_VMWARE, { + {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0, NF }, + {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0, NF }, + {0x0000, NULL,0, NF } } }, +#endif {0x0000, { {0x0000, NULL,0, NF } } }, }; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h index 9bd5beb7e..8a8d22ea2 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.69 2000/12/07 15:43:40 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.70 2001/04/05 17:42:32 dawes Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -63,7 +63,6 @@ extern const char *xf86LogFile; extern MessageType xf86LogFileFrom; extern serverLayoutRec xf86ConfigLayout; extern Pix24Flags xf86ConfigPix24; -extern confDRIRec xf86ConfigDRI; extern unsigned short xf86MouseCflags[]; extern Bool xf86SupportedMouseTypes[]; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h index f1e486434..08b8e2d85 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.22 2001/01/06 20:19:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.23 2001/03/05 20:18:21 dawes Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -124,6 +124,7 @@ typedef struct { #endif Bool pmFlag; int estimateSizesAggressively; + Bool kbdCustomKeycodes; } xf86InfoRec, *xf86InfoPtr; #ifdef DPMSExtension diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c index 745ff0f9d..6e1224dc4 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.62 2000/09/22 23:41:01 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.63 2001/04/01 14:00:08 tsi Exp $ */ #include "Xfuncproto.h" #include "Xmd.h" @@ -31,7 +31,6 @@ #include "XIproto.h" #endif #include "xf86.h" -#include "Xpoll.h" #include "xf86Priv.h" #include "xf86Xinput.h" #ifdef XINPUT @@ -61,7 +60,7 @@ #include <stdarg.h> #include "osdep.h" /* EnabledDevices */ - +#include "Xpoll.h" #include "xf86_OSproc.h" /* sigio stuff */ /****************************************************************************** diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h index bd3287834..c8a7fb00b 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.32 2000/11/29 15:51:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.33 2001/03/04 01:37:09 tsi Exp $ */ #ifndef _xf86Xinput_h #define _xf86Xinput_h @@ -30,8 +30,7 @@ #ifndef NEED_EVENTS #define NEED_EVENTS #endif -#include "X.h" -#include "Xproto.h" +#include "xf86str.h" #include "inputstr.h" #ifdef XINPUT #include "extensions/XI.h" diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c index 7206af98b..f74d0d8b3 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.34 2001/02/16 21:38:38 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.39 2001/04/01 14:00:08 tsi Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -211,6 +211,7 @@ FindPCIVideoInfo(void) if (PCINONSYSTEMCLASSES(baseclass, subclass)) { info->size[j] = pciGetBaseSize(pcrp->tag, j, TRUE, &info->validSize); + pcrp->minBasesize = info->validSize; } else { info->size[j] = pcrp->basesize[j]; info->validSize = pcrp->minBasesize; @@ -844,7 +845,9 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) { resPtr *res; - if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) + if (PCIINFOCLASSES((pcrp->listed_class & 0xffff) ? + ((pcrp->listed_class >> 8) & 0x0ff) : + pcrp->pci_base_class, pcrp->pci_sub_class)) continue; /* Only process devices with type 0 headers */ @@ -886,7 +889,9 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) } } } - if (pcrp->pci_baserom) { + /* Ignore disabled non-video ROMs */ + if ((res == activeRes) && + (pcrp->pci_baserom & PCI_MAP_ROM_DECODE_ENABLE)) { P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom), pcrp->basesize[6], ResExcMemBlock | resMisc); if (range.rBegin) { @@ -2985,3 +2990,20 @@ pciConvertRange2Host(int entityIndex, resRange *pRange) pciTagConvertRange2Host(tag, pRange); } + +void +xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable) +{ + CARD32 temp; + PCITAG tag; + + if (!pPci) return; + + tag = pciTag(pPci->bus, pPci->device, pPci->func); + temp = pciReadLong(tag, PCI_CMD_STAT_REG); + if (enable) + pciWriteLong(tag, PCI_CMD_STAT_REG, temp | PCI_CMD_MASTER_ENABLE); + else + pciWriteLong(tag, PCI_CMD_STAT_REG, temp & ~PCI_CMD_MASTER_ENABLE); +} + diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c index 3c7be73ab..c2a5a1e0c 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c @@ -20,7 +20,7 @@ * 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/common/xf86sbusBus.c,v 3.5 2000/12/06 15:35:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.6 2001/03/03 22:16:35 tsi Exp $ */ #include <ctype.h> #include <stdio.h> @@ -276,7 +276,7 @@ xf86ParseSbusBusString(const char *busID, int *fbNum) for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) { len = strlen(sbusDeviceTable[i].promName); if (!strncmp (sbusDeviceTable[i].promName, id, len) - && isdigit(id + len)) + && isdigit(id[len])) break; } devId = sbusDeviceTable[i].devId; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xv.h b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h index bc0996c56..45fd72540 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.19 2000/11/02 16:33:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.20 2001/03/05 04:48:22 mvojkovi Exp $ */ #ifndef _XVDIX_H_ #define _XVDIX_H_ @@ -205,6 +205,7 @@ void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr); /*** These are DDX layer privates ***/ +extern int XF86XvScreenIndex; typedef struct { CreateWindowProcPtr CreateWindow; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c new file mode 100644 index 000000000..4559359ec --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c @@ -0,0 +1,201 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c,v 1.3 2001/04/01 14:00:08 tsi Exp $ */ + +#include "misc.h" +#include "xf86.h" +#include "xf86_OSproc.h" + +#include "X.h" +#include "Xproto.h" +#include "scrnintstr.h" +#include "resource.h" +#include "dixstruct.h" + +#ifdef XFree86LOADER +#include "xvmodproc.h" +#endif + +#include "xf86xvmc.h" + +#ifdef XFree86LOADER +int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL; +#else +int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = XvMCScreenInit; +#endif + + +typedef struct { + CloseScreenProcPtr CloseScreen; + int num_adaptors; + XF86MCAdaptorPtr *adaptors; + XvMCAdaptorPtr dixinfo; +} xf86XvMCScreenRec, *xf86XvMCScreenPtr; + +static unsigned long XF86XvMCGeneration = 0; +static int XF86XvMCScreenIndex = -1; + +#define XF86XVMC_GET_PRIVATE(pScreen) \ + (xf86XvMCScreenPtr)((pScreen)->devPrivates[XF86XvMCScreenIndex].ptr) + + +static int +xf86XvMCCreateContext ( + XvPortPtr pPort, + XvMCContextPtr pContext, + int *num_priv, + CARD32 **priv +) +{ + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + pContext->port_priv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + + return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext)( + pScrn, pContext, num_priv, priv); +} + +static void +xf86XvMCDestroyContext ( XvMCContextPtr pContext) +{ + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext)( + pScrn, pContext); +} + +static int +xf86XvMCCreateSurface ( + XvMCSurfacePtr pSurface, + int *num_priv, + CARD32 **priv +) +{ + XvMCContextPtr pContext = pSurface->context; + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface)( + pScrn, pSurface, num_priv, priv); +} + +static void +xf86XvMCDestroySurface (XvMCSurfacePtr pSurface) +{ + XvMCContextPtr pContext = pSurface->context; + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface)( + pScrn, pSurface); +} + +static int +xf86XvMCCreateSubpicture ( + XvMCSubpicturePtr pSubpicture, + int *num_priv, + CARD32 **priv +) +{ + XvMCContextPtr pContext = pSubpicture->context; + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSubpicture)( + pScrn, pSubpicture, num_priv, priv); +} + +static void +xf86XvMCDestroySubpicture (XvMCSubpicturePtr pSubpicture) +{ + XvMCContextPtr pContext = pSubpicture->context; + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture)( + pScrn, pSubpicture); +} + + +static Bool +xf86XvMCCloseScreen (int i, ScreenPtr pScreen) +{ + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen); + + pScreen->CloseScreen = pScreenPriv->CloseScreen; + + xfree(pScreenPriv->dixinfo); + xfree(pScreenPriv); + + return (*pScreen->CloseScreen)(i, pScreen); +} + +Bool xf86XvMCScreenInit( + ScreenPtr pScreen, + int num_adaptors, + XF86MCAdaptorPtr *adaptors +) +{ + XvMCAdaptorPtr pAdapt; + xf86XvMCScreenPtr pScreenPriv; + XvScreenPtr pxvs = + (XvScreenPtr)(pScreen->devPrivates[XF86XvScreenIndex].ptr); + + int i, j; + + if(!XvMCScreenInitProc) return FALSE; + + if(XF86XvMCGeneration != serverGeneration) { + if((XF86XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0) + return FALSE; + XF86XvMCGeneration = serverGeneration; + } + + if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors))) + return FALSE; + + if(!(pScreenPriv = xalloc(sizeof(xf86XvMCScreenRec)))) { + xfree(pAdapt); + return FALSE; + } + + pScreen->devPrivates[XF86XvMCScreenIndex].ptr = (pointer)pScreenPriv; + + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = xf86XvMCCloseScreen; + + pScreenPriv->num_adaptors = num_adaptors; + pScreenPriv->adaptors = adaptors; + pScreenPriv->dixinfo = pAdapt; + + for(i = 0; i < num_adaptors; i++) { + pAdapt[i].xv_adaptor = NULL; + for(j = 0; j < pxvs->nAdaptors; j++) { + if(!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) { + pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]); + break; + } + } + if(!pAdapt[i].xv_adaptor) { + /* no adaptor by that name */ + xfree(pAdapt); + return FALSE; + } + pAdapt[i].num_surfaces = (*adaptors)->num_surfaces; + pAdapt[i].surfaces = (XvMCSurfaceInfoPtr*)((*adaptors)->surfaces); + pAdapt[i].num_subpictures = (*adaptors)->num_subpictures; + pAdapt[i].subpictures = (XvImagePtr*)((*adaptors)->subpictures); + pAdapt[i].CreateContext = xf86XvMCCreateContext; + pAdapt[i].DestroyContext = xf86XvMCDestroyContext; + pAdapt[i].CreateSurface = xf86XvMCCreateSurface; + pAdapt[i].DestroySurface = xf86XvMCDestroySurface; + pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture; + pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture; + adaptors++; + } + + if(Success != (*XvMCScreenInitProc)(pScreen, num_adaptors, pAdapt)) + return FALSE; + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h new file mode 100644 index 000000000..fe3320607 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h @@ -0,0 +1,134 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.3 2001/04/01 14:00:08 tsi Exp $ */ + +#ifndef _XF86XVMC_H +#define _XF86XVMC_H + +#include "xvmc.h" +#include "xf86xv.h" + +typedef struct { + int num_xvimages; + int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */ +} XF86MCImageIDList; + +typedef struct { + int surface_type_id; /* Driver generated. Must be unique on the port */ + int chroma_format; + int color_description; + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; + XF86MCImageIDList *compatible_subpictures; /* can be null, if none */ +} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr; + + +/* + xf86XvMCCreateContextProc + + DIX will fill everything out in the context except the driver_priv. + The port_priv holds the private data specified for the port when + Xv was initialized by the driver. + The driver may store whatever it wants in driver_priv and edit + the width, height and flags. If the driver wants to return something + to the client it can allocate space in priv and specify the number + of 32 bit words in num_priv. This must be dynamically allocated + space because DIX will free it after it passes it to the client. +*/ + + +typedef int (*xf86XvMCCreateContextProcPtr) ( + ScrnInfoPtr pScrn, + XvMCContextPtr context, + int *num_priv, + CARD32 **priv +); + +typedef void (*xf86XvMCDestroyContextProcPtr) ( + ScrnInfoPtr pScrn, + XvMCContextPtr context +); + +/* + xf86XvMCCreateSurfaceProc + + DIX will fill everything out in the surface except the driver_priv. + The driver may store whatever it wants in driver_priv. The driver + may pass data back to the client in the same manner as the + xf86XvMCCreateContextProc. +*/ + + +typedef int (*xf86XvMCCreateSurfaceProcPtr) ( + ScrnInfoPtr pScrn, + XvMCSurfacePtr surface, + int *num_priv, + CARD32 **priv +); + +typedef void (*xf86XvMCDestroySurfaceProcPtr) ( + ScrnInfoPtr pScrn, + XvMCSurfacePtr surface +); + +/* + xf86XvMCCreateSubpictureProc + + DIX will fill everything out in the subpicture except the driver_priv, + num_palette_entries, entry_bytes and component_order. The driver may + store whatever it wants in driver_priv and edit the width and height. + If it is a paletted subpicture the driver needs to fill out the + num_palette_entries, entry_bytes and component_order. These are + not communicated to the client until the time the surface is + created. + + The driver may pass data back to the client in the same manner as the + xf86XvMCCreateContextProc. +*/ + + +typedef int (*xf86XvMCCreateSubpictureProcPtr) ( + ScrnInfoPtr pScrn, + XvMCSubpicturePtr subpicture, + int *num_priv, + CARD32 **priv +); + +typedef void (*xf86XvMCDestroySubpictureProcPtr) ( + ScrnInfoPtr pScrn, + XvMCSubpicturePtr subpicture +); + + +typedef struct { + char *name; + int num_surfaces; + XF86MCSurfaceInfoPtr *surfaces; + int num_subpictures; + XF86ImagePtr *subpictures; + xf86XvMCCreateContextProcPtr CreateContext; + xf86XvMCDestroyContextProcPtr DestroyContext; + xf86XvMCCreateSurfaceProcPtr CreateSurface; + xf86XvMCDestroySurfaceProcPtr DestroySurface; + xf86XvMCCreateSubpictureProcPtr CreateSubpicture; + xf86XvMCDestroySubpictureProcPtr DestroySubpicture; +} XF86MCAdaptorRec, *XF86MCAdaptorPtr; + +/* + xf86XvMCScreenInit + + Unlike Xv, the adaptor data is not copied from this structure. + This structure's data is used so it must stick around for the + life of the server. Note that it's an array of pointers not + an array of structures. +*/ + +Bool xf86XvMCScreenInit( + ScreenPtr pScreen, + int num_adaptors, + XF86MCAdaptorPtr *adaptors +); + +#endif /* _XF86XVMC_H */ diff --git a/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c b/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c index 2d6ea31ca..3df992941 100644 --- a/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c +++ b/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c @@ -3,7 +3,7 @@ * * Copyright 1999 by Andrew C Aitchison <A.C.Aitchison@dpmms.cam.ac.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.5 2001/02/15 17:31:45 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.7 2001/04/05 17:42:32 dawes Exp $ */ #include "misc.h" #include "xf86.h" @@ -26,6 +26,8 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC) CARD8 *EDID2rawdata = NULL; CARD8 *VDIFrawdata = NULL; int i, ret; + Bool makeEDID1prop = FALSE; + Bool makeEDID2prop = FALSE; #ifdef DEBUG ErrorF("xf86SetDDCproperties(%p, %p)\n", pScrnInfo, DDC); @@ -44,7 +46,36 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC) pScrnInfo->monitor->DDC = DDC; if (DDC->ver.version == 1) { + makeEDID1prop = TRUE; + } else if (DDC->ver.version == 2) { + int checksum1 = 0; + int checksum2 = 0; + makeEDID2prop = TRUE; + + /* Some monitors (eg Panasonic PanaSync4) + * report version==2 because they used EDID v2 spec document, + * although they use EDID v1 data structure :-( + * + * Try using checksum to determine when we have such a monitor. + */ + for (i=0; i<256; i++) { checksum2 += DDC->rawData[i]; } + if ( (checksum2 % 256) != 0 ) { + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v2 checksum failed\n"); + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property may be bad\n"); + for (i=0; i<128; i++) { checksum1 += DDC->rawData[i]; } + if ( (checksum1 % 256) == 0 ) { + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v1 checksum passed,\n"); + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property created\n"); + makeEDID1prop = TRUE; + } + } + } else { + xf86DrvMsg(pScrnInfo->scrnIndex, X_PROBED, + "unexpected EDID version %d revision %d\n", + DDC->ver.version, DDC->ver.revision ); + } + if (makeEDID1prop) { if ( (EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL ) { return FALSE; } @@ -72,7 +103,9 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC) ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret ); #endif - } else if (DDC->ver.version == 2) { + } + + if (makeEDID2prop) { if ( (EDID2rawdata = xalloc(256*sizeof(CARD8)))==NULL ) { return FALSE; } @@ -91,21 +124,11 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC) #endif ret = xf86RegisterRootWindowProperty(pScrnInfo->scrnIndex, EDID2Atom, XA_INTEGER, 8, -#if 1 - 256, (unsigned char *)EDID1rawdata -#else -#define EDID2_DUMMY_STRING "Dummy EDID2 property - please insert correct values" - strlen(EDID2_DUMMY_STRING), - EDID2_DUMMY_STRING -#endif + 256, (unsigned char *)EDID2rawdata ); #ifdef DEBUG ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret ); #endif - } else { - xf86DrvMsg(pScrnInfo->scrnIndex, X_PROBED, - "unexpected EDID version %d revision %d\n", - DDC->ver.version, DDC->ver.revision ); } if (DDC->vdif) { diff --git a/xc/programs/Xserver/hw/xfree86/doc/Imakefile b/xc/programs/Xserver/hw/xfree86/doc/Imakefile index 0291db948..a0ffbbf17 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/doc/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/33 1996/10/28 05:12:24 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.74 2001/02/07 18:52:27 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.75 2001/03/02 02:45:37 dawes Exp $ #include <Server.tmpl> #include <lnxdoc.rules> @@ -81,7 +81,7 @@ MAINDOCS = LICENSE README /*ReadmeFile(Config)*/ /*BUILD*/ RELNOTES \ OTHERDOCS = /*VideoModes.doc*/ /*QuickStart.doc*/ /*xinput*/ \ ReadmeFile(fonts) ReadmeFile(mouse) ReadmeFile(DRI) \ - ReadmeFile(DRIcomp) + ReadmeFile(DRIcomp) ReadmeFile(dps) #endif MISCDOCS = ServersOnly /*LbxproxyOnly*/ $(REPORTFORM) ReadmeFile(DGA) \ diff --git a/xc/programs/Xserver/hw/xfree86/doc/Install b/xc/programs/Xserver/hw/xfree86/doc/Install index 205f8d56a..7846ad0f2 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Install +++ b/xc/programs/Xserver/hw/xfree86/doc/Install @@ -179,7 +179,7 @@ you don't need these features, then you can safely answer "no" if you don't want them moved. When installing over an existing version, you will be prompted before each -set of configuration files is installed. If you haven't made any customisa- +set of configuration files is installed. If you haven't made any Customisa- tions to your existing configuration files, then you can safely answer "yes" for each of these. If you have made customisations, you can try answering "no". If you run into problems later, you may need to manually merge your @@ -351,7 +351,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.10 2000/12/15 19:09:06 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11 2001/03/02 17:40:48 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.10 2000/12/15 19:38:06 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.11 2001/03/02 17:47:52 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/LICENSE b/xc/programs/Xserver/hw/xfree86/doc/LICENSE index a16673c84..c6890edc3 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/LICENSE +++ b/xc/programs/Xserver/hw/xfree86/doc/LICENSE @@ -2,14 +2,14 @@ The XFree86 Project - 1999 + March 2001 1. XFree86 License XFree86 code without an explicit copyright is covered by the following copy- right/license: -Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. +Copyright (C) 1994-2001 The XFree86 Project, Inc. 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 @@ -592,7 +592,7 @@ For further information, contact: <sales@yandy.com> or <design@bigelowandholmes.com> - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.7 2000/03/06 22:59:23 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.8 2001/03/16 22:13:19 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.11 2000/12/01 19:47:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.12 2001/03/25 05:42:43 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README b/xc/programs/Xserver/hw/xfree86/doc/README index d0403f5ed..ffc669ceb 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README +++ b/xc/programs/Xserver/hw/xfree86/doc/README @@ -40,6 +40,9 @@ whether your hardware is supported before upgrading to the 4.x series. Specific release enhancements can be viewed in the Release Notes. +The XFree86 version numbering system has had some changes as of the 4.0.2 +release. Information about this can be found in the Versions Document. + Information about binary distributions and the attendant installation instructions can be found in the Installation Document. @@ -158,7 +161,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.110 2000/12/15 16:11:57 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.113 2001/03/16 22:13:19 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.109 2000/12/15 18:14:32 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.111 2001/03/25 05:42:43 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRI b/xc/programs/Xserver/hw/xfree86/doc/README.DRI index ff5b44c52..15794df56 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DRI +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRI @@ -2,13 +2,13 @@ VA Linux Systems, Inc. Professional Services - Graphics. - 5 January 2001 + 15 March 2001 1. Preamble 1.1 Copyright -Copyright 2000 by VA Linux Systems, Inc. All Rights Reserved. +Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all @@ -71,32 +71,8 @@ functions in the Mesa-based DRI drivers. 3DNow! is supported in most ver- sions of Linux. Like the SSE optimizations, a runtime check is made to determine if the CPU can execute 3DNow! instructions. -The build environment for both of these new architectures have a pre-build -environment that will correctly build the DRI drivers and Mesa meaning no -extra configuration is necessary to build the DRI for these architectures. - -3.1.1 Alpha Features - - " - -On newer Alpha processors, it should be noted that a significant performance -increase can be seen with the addition of the -mcpu= command that should be -passed to GCC upon compilation. Dependent of the architecture of the proces- -sor, for example -mcpu=ev6 will build specifically for the EV6 based AXP's, -giving both byte and word alignment access to the DRI/Mesa drivers. - -Use this as an example of compiling with this extra speed. In your host.def -file that should reside in the xc/config directory, add the line. - -#define DefaultGcc2AxpOpt -O2 -mcpu=ev6 - -Additional speed improvements to 3D rendering can be achieved by installing -Compaq's Math Libraries (CPML) which can be obtained from the following URL. - -http://www.support.compaq.com/alpha-tools/software/index.html - -Alpha systems can benefit from several compile-time optimizations which are -described in the DRI Compile Guide. +Alpha-based systems can use Compaq's optimized math library for improved 3D +performance. See the DRI Compilation Guide for details. 3.2 Graphics Hardware @@ -231,10 +207,13 @@ First, the XF86Config file must load the GLX and DRI modules: Load "dri" EndSection -Next, the DRI section can be used to restrict access to direct rendering. +Next, the DRI section can be used to restrict access to direct rendering. A +client can only use direct rendering if it has permission to open the +/dev/dri/card? file(s). The permissions on these DRI device files is con- +trolled by the "DRI" section in the XF86Config file. If you want all of the users on your system to be able to use direct-render- -ing, then use a simple DRI section: +ing, then use a simple DRI section like this: Section "DRI" Mode 0666 @@ -420,7 +399,57 @@ MESA_DEBUG and MESA_INFO variables. This section contains information to help you diagnose general problems. See below for additional information for specific hardware. -9.1 The X Server +9.1 Bus Mastering + +DMA-based DRI drivers (that's most DRI drivers) cannot function unless bus +mastering is enabled for your graphics card. By default, some systems don't +having bus mastering on. You should enable it in your BIOS. + +Alternately, you can check the status of bus mastering and change the setting +from within Linux. There may be similar procedures for other operating sys- +tems. + +Run lspci (as root) and find the information describing your graphics +adapter. For example: + + 00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03) + 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03) + 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02) + 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01) + 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) + 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02) + 00:11.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08) + 00:12.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR) 53c895 (rev 02) + 00:14.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 08) + 01:00.0 VGA compatible controller: 3Dfx Interactive, Inc.: Unknown device 0009 (rev 01) + +The bus, device, and function number comprise the device id, which is conven- +tionally written in the form bus:dev.func, or in this case 01:00.0. + +Use the setpci command to examine bit two of register 4 for your graphics +card. This will indicate whether or not bus mastering is enabled. + + setpci -s 01:00.0 4.w + +A hexidecimal value will be printed. Convert the least significant digit to +binary. For example, if you see 3, that's 0011 in binary (bit two is 0). If +you see 7, that's 0111 in binary (bit two is 1). In the first example, bus +mastering is disabled. It's enabled in the second example. + +The following shell script will enabled bus mastering for your graphics card +and host bridge. Run it as root. + + #!/bin/bash + dev=01:00.0 # change as appropriate + echo Enabling bus mastering on device $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + dev=00:00.0 + echo Enabling bus mastering on host bridge $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + +You can check if this worked by running the first setpci command again. + +9.2 The X Server 1. Before you start the X server, verify the appropriate 3D kernel module is installed. Type lsmod and look for the appropriate kernel module. @@ -474,7 +503,7 @@ below for additional information for specific hardware. SGI-GLX XFree86-DRI -9.2 Linking, running and verifying 3D acceleration +9.3 Linking, running and verifying 3D acceleration After you've verified that the X server and DRI have started correctly it's time to verify that the GL library and hardware drivers are working cor- @@ -602,13 +631,20 @@ Or, EndSubsection EndSection -The kernel module for the Voodoo3 is named tdfx.o and should be installed in -/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded -by the Xserver if needed. +The kernel module for 3dfx hardware is named tdfx.o and should be installed +in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically +loaded by the Xserver if needed. -The DRI 3D driver for the Voodoo3 should be in /usr/X11R6/lib/mod- +The DRI 3D driver for 3dfx hardware should be in /usr/X11R6/lib/mod- ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. +The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. When running in +32bpp mode an 8-bit stencil buffer and 24-bit Z (depth) buffer are offered. +When running in 16bpp mode only a 16-bit Z (depth) buffer is offered and +stencil is implemented in software. + +A software-based accumulation buffer is available in both 16 and 32bpp modes. + 10.1.3 Troubleshooting o If you try to run an OpenGL application and see an error message similar @@ -626,12 +662,19 @@ ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. o The /dev/3dfx device is not used for DRI; it's only for Glide on older 3dfx hardware. + o Different versions of Glide are needed for Voodoo3 and Voodoo5. See the + DRI website's resources page to download the right version of Glide. + + o Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) but 3D + acceleration is not supported in that mode. 32bpp mode is fully 3D + accelerated. + 10.1.4 Performance o Normally, buffer swapping in double-buffered applications is synchro- nized to your monitor's refresh rate. This may be overridden by setting - the FX_GLIDE_SWAPINTERNVAL environment variable. The value of this - variable indicates the maximum number of swap buffer commands can be + the FX_GLIDE_SWAPINTERVAL environment variable. The value of this vari- + able indicates the maximum number of swap buffer commands can be buffered. Zero allows maximum frame rate. o On Voodoo4/5, rendering with 16-bits/texel textures is faster than using @@ -677,80 +720,6 @@ ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. o Using glColorMask(r, g, b, a) when r!=g or g!=b. - o The lowest mipmap level is sometimes miscolored in trilinear- sampled - polygons. - -10.2 3dfx Voodoo5 Series - -10.2.1 Dependencies - -The Voodoo5 DRI driver requires a special versions of the 3dfx Glide library, -different than that used for Voodoo3 hardware. It can be downloaded from the -DRI website. - -10.2.2 Configuration - -Your XF86Config file's device section must specify the tdfx device: - - Section "Device" - Identifier "Voodoo5" - VendorName "3dfx" - Driver "tdfx" - EndSection - -The Screen section should then reference the Voodoo3 device: - - Section "Screen" - Identifier "Screen 1" - Device "Voodoo5" - Monitor "High Res Monitor" - DefaultDepth 24 - Subsection "Display" - Depth 16 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - Subsection "Display" - Depth 24 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - EndSection - -The kernel module for the Voodoo5 is named tdfx.o and should be installed in -/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded -by the Xserver if needed. - -The DRI 3D driver for the Voodoo5 should be in /usr/X11R6/lib/mod- -ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. - -The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. When running in -32bpp mode an 8-bit stencil buffer and 24-bit Z (depth) buffer are offered. -When running in 16bpp mode only a 16-bit Z (depth) buffer is offered and -stencil is implemented in software. - -A software-based accumulation buffer is available in both 16 and 32bpp modes. - -10.2.3 Troubleshooting - - o The /dev/3dfx device is not used for DRI; it's only for Glide on older - 3dfx hardware. - - o Different versions of Glide are needed for Voodoo3 and Voodoo5. See the - DRI website's resources page to download the right version of Glide. - -10.2.4 Performance - - o Normally, buffer swapping in double-buffered applications is synchro- - nized to your monitor's refresh rate. This may be overridden by setting - the FX_GLIDE_SWAPINTERNVAL environment variable. The value of this - variable indicates the maximum number of swap buffer commands can be - buffered. Zero allows maximum frame rate. - - o Rendering with 16-bit per texel textures is faster than using 32-bit per - texel textures. The internalFormat parameter to glTexImage2D can be - used to control texel size. - o The Voodoo5 driver reverts to software rendering under the same condi- tions Voodoo3 with three exceptions. First, stencil operations are implemented in hardware when the screen is configured for 32 bits/pixel. @@ -758,38 +727,37 @@ A software-based accumulation buffer is available in both 16 and 32bpp modes. Third, glColorMask is fully supported in hardware when the screen is configured for 32 bits/pixel. -10.2.5 Known Problems + o As of January, 2001 the second VSA-100 chip on the Voodoo5 is not yet + operational. Therefore, the board isn't being used to its full capac- + ity. The second VSA-100 chip will allow Scan-Line Interleave (SLI) mode + for full-screen applications and games, potentially doubling the sys- + tem's fill rate. When the second VSA-100 chip is activated glGet- + String(GL_RENDERER) will report Voodoo5 instead of Voodoo4. o The lowest mipmap level is sometimes miscolored in trilinear- sampled - polygons (Voodoo3/Banshee). + polygons. - o Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) but 3D - acceleration is not supported in that mode. 32bpp mode is fully 3D - accelerated. +10.1.5 Known Problems + + o The lowest mipmap level is sometimes miscolored in trilinear- sampled + polygons (Voodoo3/Banshee). o Fog doesn't work with orthographic projections. o The accuracy of blending operations on Voodoo4/5 isn't always very good. If you run Glean, you'll find some test failures. - o As of October, 2000 the second VSA-100 chip on the Voodoo5 is not yet - operational. Therefore, the board isn't being used to its full capac- - ity. The second VSA-100 chip will allow Scan-Line Interleave (SLI) mode - for full-screen applications and games, potentially doubling the sys- - tem's fill rate. When the second VSA-100 chip is activated glGet- - String(GL_RENDERER) will report Voodoo5 instead of Voodoo4. - o The Glide library cannot be used directly; it's only meant to be used via the tdfx DRI driver. o SSystem has problems because of poorly set near and far clipping planes. The office.unc Performer model also suffers from this problem. -10.3 Intel i810 +10.2 Intel i810 " -10.3.1 Dependencies +10.2.1 Dependencies " @@ -797,7 +765,7 @@ A Linux kernel with AGP GART support is required. The 2.2.x kernel series does not have AGP GART support. The 2.4.x test kernels have AGP GART and have been tested with the i810. -10.3.2 Configuration +10.2.2 Configuration " @@ -808,6 +776,7 @@ ify a usable amount of video ram to reserve. Identifier "i810" VendorName "Intel" Driver "i810" + Option "AGPMode" "1" VideoRam 10000 EndSection @@ -832,7 +801,7 @@ by the Xserver if needed. The DRI 3D driver for the i810 should be in /usr/X11R6/lib/mod- ules/dri/i810_dri.so. This will be automatically loaded by libGL.so. -10.3.3 Troubleshooting +10.2.3 Troubleshooting o 3D acceleration for the i810 is only available in the 16 bit/pixel screen mode at this time. 32bpp acceleration is not supported by this @@ -847,18 +816,18 @@ ules/dri/i810_dri.so. This will be automatically loaded by libGL.so. too little memory is available for DMA buffers, back and depth buffers and textures, direct rendering will be disabled. -10.4 Matrox G200 and G400 +10.3 Matrox G200 and G400 " -10.4.1 Dependencies +10.3.1 Dependencies " A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. -10.4.2 Configuration +10.3.2 Configuration " @@ -868,6 +837,7 @@ Your XF86Config file's device section must specify the mga device: Identifier "MGA" VendorName "Matrox" Driver "mga" + Option "AGPMode" "1" VideoRam 32768 EndSection @@ -907,7 +877,7 @@ by the Xserver if needed. The DRI 3D driver for the G200/G400 should be in /usr/X11R6/lib/mod- ules/dri/mga_dri.so. This will be automatically loaded by libGL.so. -10.4.3 Performance +10.3.3 Performance Software rendering will be used under any of the following conditions: @@ -921,9 +891,16 @@ Software rendering will be used under any of the following conditions: o Using 1D or 3D textures. + o Using texture borders. + + o Using glDepthFunc(GL_NEVER). + o Using the accumulation buffer. -10.4.4 IRQ Assignment +The AGP mode may be set to 1, 2, or 4. One is used by default. Higher AGP +speeds may result in unreliable performance depending on your motherboard. + +10.3.4 IRQ Assignment There have been problems in the past with the MGA driver being very sluggish when the DRI is enabled (to the point of being unusable.) This is caused by @@ -935,7 +912,7 @@ card. This is something you must turn on in your system BIOS configuration. Please consult your system BIOS manual for instructions on how to enable an interrupt for your graphics card. -10.4.5 MGA HAL lib +10.3.5 MGA HAL lib MGAHALlib.a is a binary library Matrox has provided for use under Linux to expose functionality for which they can not provide documentation. (For @@ -960,22 +937,22 @@ will be "PCI:1:0:0". Configure your screen section as you would normally configure XFree86 4.x Multihead. It should be noted that currently the sec- ond head does not support direct rendering. -10.4.6 Known Problems +10.3.6 Known Problems None. -10.5 ATI Rage 128 +10.4 ATI Rage 128 " -10.5.1 Dependencies +10.4.1 Dependencies " A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. -10.5.2 Configuration +10.4.2 Configuration " @@ -985,6 +962,8 @@ Your XF86Config file's device section must specify the ati device: Identifier "Rage128" VendorName "ATI" Driver "ati" + Option "AGPMode" "1" + Option "UseCCEFor2D" "false" EndSection The Screen section should then reference the Rage 128 device: @@ -1015,27 +994,33 @@ ules/dri/r128_dri.so. This will be automatically loaded by libGL.so. You may also set your screen depth to 32 for 32bpp mode. -10.5.3 Performance +10.4.3 Performance While PCI Rage 128 based cards are supported, they do not yet support PCI GART, so they will not perform as well as their AGP counterparts. -10.5.4 Known Problems +For AGP cards, the AGP mode may be set to 1, 2, or 4. One is used by +default. Higher AGP speeds may result in unreliable performance depending on +your motherboard. -None. +10.4.4 Known Problems -10.6 ATI Radeon +If you experience stability problems you may try setting the UseCCEFor2D +option to true. This will effectively disable 2D hardware acceleration. +Performance will be degraded, of course. + +10.5 ATI Radeon " -10.6.1 Dependencies +10.5.1 Dependencies " A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. -10.6.2 Configuration +10.5.2 Configuration " @@ -1045,6 +1030,7 @@ Your XF86Config file's device section must specify the ati device: Identifier "Radeon" VendorName "ATI" Driver "ati" + Option "AGPMode" "1" EndSection The Screen section should then reference the Radeon device: @@ -1075,17 +1061,20 @@ ules/dri/radeon_dri.so. This will be automatically loaded by libGL.so. You may also set your screen depth to 32 for 32bpp mode. -10.6.3 Performance +10.5.3 Performance While this driver supports many of the features of ATI Radeon cards, we do not yet fully support the card's TCL features. This work is progressing, but is not yet ready. -10.6.4 Known Problems +The AGP mode may be set to 1, 2, or 4. One is used by default. Higher AGP +speeds may result in unreliable performance depending on your motherboard. + +10.5.4 Known Problems None. -10.7 3DLabs Oxygen GMX 2000 +10.6 3DLabs Oxygen GMX 2000 The driver for this hardware was experimental and is no longer being devel- oped or supported. @@ -1198,7 +1187,7 @@ forge.net/resources/resources.html o In the future there may be IHV and Linux vendor support resources for the DRI. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.16 2001/01/08 01:07:33 martin Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.17 2001/03/21 16:56:18 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.13 2001/01/21 21:19:14 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.14 2001/03/25 05:42:43 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp index e2f847291..921d53457 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp @@ -2,13 +2,13 @@ VA Linux Systems, Inc. Professional Services - Graphics. - 5 January 2001 + 15 March 2001 1. Preamble 1.1 Copyright -Copyright 2000 by VA Linux Systems, Inc. All Rights Reserved. +Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all @@ -55,7 +55,7 @@ You'll need the following: o FreeBSD support is not currently being maintained and may not work. The DRI 3D drivers generally work on systems with Intel or AMD CPUs. How- -ever, there is limited support for Alpha and Sparc. +ever, there is limited support for Alpha and PowerPC support is underway. For 3dfx Voodoo3 hardware, you'll also need: @@ -80,8 +80,9 @@ For ATI Rage 128 and Radeon hardware, you'll also need: The DRI project closely tracks Linux kernel development. Since the internal Linux data structures might change in the 2.4 Linux kernel, it's important to -have use the most recent Linux kernel. As of this writing (Jan 2001), 2.4.0 -is the most recent version of Linux which the DRI is synchronized to. +use the most recent Linux kernel and not an old, intermediate development +release. As of this writing (Jan 2001), 2.4.0 is the most recent version of +Linux which the DRI is synchronized to. Most of the DRI drivers require AGP support and using Intel Pentium III SSE optimizations also requires an up-to-date Linux kernel. Configuring your @@ -214,7 +215,7 @@ the DRI/Mesa drivers. To enable this optimization edit your xc/config/host.def file and add the line: -#define DefaultCCOptions -ansi GccWarningOptions -pipe -mcpu=ev6 +#define DefaultGcc2AxpOpt -O2 -mcpu=ev6 Additional speed improvements to 3D rendering can be achieved by installing Compaq's Math Libraries (CPML) which can be obtained from http://www.sup- @@ -444,7 +445,8 @@ grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/. To load the appropriate DRI module in your running kernel you can either use ismod and restart your X server or copy the kernel module to /lib/mod- -ules/2.4.x/kernel/driver/char/drm/ then run depmod and restart your X server. +ules/2.4.x/kernel/drivers/char/drm/ then run depmod and restart your X +server. Make sure you first unload any older DRI kernel modules that might be already loaded. @@ -599,7 +601,7 @@ At this point your X server should be up and running with hardware-acceler- ated direct rendering. Please read the DRI User Guide for information about trouble shooting and how to use the DRI-enabled X server for 3D applications. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.10 2001/01/08 01:07:34 martin Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.11 2001/03/21 16:56:18 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.7 2001/01/21 21:19:14 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.8 2001/03/25 05:42:43 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD b/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD index eb704992a..da9b9dafc 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD +++ b/xc/programs/Xserver/hw/xfree86/doc/README.NetBSD @@ -2,14 +2,13 @@ Rich Murphey, David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb - Last modified on: 7 December 2000 + Last modified on: 3 March 2001 1. What and Where is XFree86? -XFree86 is a port of X11R6.4 that supports several versions of Intel-based -Unix. It is derived from X386 1.2, which was the X server distributed with -X11R5. This release consists of many new features and performance improve- -ments as well as many bug fixes. +XFree86 is the Open Source port of X.Org's X11R6.4 release that supports sev- +eral UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operat- +ing systems on Intel and other platforms. See the Copyright Notice. @@ -17,7 +16,7 @@ The sources for XFree86 are available by anonymous ftp from: ftp://ftp.XFree86.org/pub/XFree86/4.0.2 -Binaries for NetBSD 1.3 and later are available from: +Binaries for NetBSD 1.4 and later are available from: ftp://ftp.XFree86.org/pub/XFree86/4.0.2/binaries/NetBSD A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml @@ -77,8 +76,8 @@ Refer to the Installation Document for detailed installation instructions. 5. Configuring X for Your Hardware -The /etc/XF86Config file tells the X server what kind of monitor, video card -and mouse you have. You must create it to tell the server what specific +The /etc/X11/XF86Config file tells the X server what kind of monitor, video +card and mouse you have. You must create it to tell the server what specific hardware you have. You'll need info on your hardware: @@ -89,6 +88,11 @@ You'll need info on your hardware: o Your monitor's sync frequencies. +The recommended way to generate an XF86Config file is to use the xf86cfg +utility. The xf86config text utility is still there for the (few) cases +where xf86cfg can't be used. Also, there is a sample file installed as +/usr/X11R6/lib/X11/XF86Config.eg, which can be used as a starting point. + For details about the XF86Config file format, refer to the XF86Config(5) man- ual page. @@ -97,18 +101,19 @@ the xvidtune utility. 5.1 About mouse configuration -The NetBSD pms mouse driver handles PS/2 style mice as Busmouse. Specify the -protocol as ``busmouse'' in the mouse section of your XF86Config file if -you're using a PS/2 mouse. +XFree86 4.0.2 has support for the mouse driver included in the wscons console +driver introduced by NetBSD 1.4. Specify ``wsmouse'' as the protocol and +``/dev/wsmouse0'' as the device in /etc/X11/XF86Config if you're using NetBSD +1.4 or later with a PS/2 mouse. + +For older releases, the NetBSD pms mouse driver handles PS/2 style mice as +Busmouse. Specify the protocol as ``busmouse'' in the mouse section of your +XF86Config file if you're using a PS/2 mouse with NetBSD 1.3 or former +releases. Only standard PS/2 mice are supported by this driver. Newest PS/2 mice that send more than three bytes at a time (especially Intellimouse, or MouseMan+ -with a ``3D'' roller) are not supported yet. - -XFree86 4.0.2 also has support for the mouse driver included in the new -wscons console driver introduced by NetBSD 1.4. Specify ``wsmouse'' as the -protocol and ``/dev/wsmouse0'' as the device in /etc/XF86Config if you're -using NetBSD 1.4 with wscons. +with a wheel) are not supported by NetBSD 1.3 and former releases. See README.mouse for general instruction on mouse configuration in XFree86. @@ -140,8 +145,8 @@ to: in /etc/rc.conf. -Under NetBSD 1.4 with the wscons console driver, you must enable a virtual -console for the X server first. To do this follow these steps: +Under NetBSD 1.4 and later with the wscons console driver, you must enable a +virtual console for the X server first. To do this follow these steps: o Make sure the device file exists. If not, ``cd /dev ; ./MAKEDEV wscons''. @@ -182,9 +187,10 @@ configuration of the server itself is required. The pccons driver is the most widely tested and is the console driver con- tained in the NetBSD binary distribution's kernels. -The pcvt console driver is bundled with NetBSD. The pcvt X mode is compatible -with the pccons driver X mode. It offers several virtual consoles and inter- -national keyboard support. In order to use this driver, change the line: +The pcvt console driver was bundled with NetBSD until 1.4. The pcvt X mode is +compatible with the pccons driver X mode. It offers several virtual consoles +and international keyboard support. In order to use this driver, change the +line: device pc0 at isa? port "IO_KBD" irq 1 @@ -194,8 +200,9 @@ to in your kernel config file, and rebuild and install your kernel. -XFree86 will also run with the wscons console driver in NetBSD 1.4. For now, -it uses the pcvt compatibility mode, so be sure to have the lines: +Wscons is the current console driver, included in NetBSD 1.4 and later. For +now, XFree86 supports wscons using the pcvt compatibility mode, so be sure to +have the lines: options WSDISPLAY_COMPAT_PCVT # emulate some ioctls options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls @@ -318,6 +325,11 @@ adding: to xc/config/host.def before rebuilding the server. This has not been thor- oughly tested, except on the macppc. +For the i386, you should include both pcvt and wscons support in order to use +the pcvt compatibility mode of wscons: + + #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT + 8.4 Building on other architectures Note that the NetBSD project has now its own source tree, based on the @@ -358,7 +370,7 @@ Many thanks to all people who contributed to make XFree86 work on *BSD, in particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, Nate Williams, Rod Grimes, Jack Velte and Michael Smith. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.59 2000/12/12 18:54:29 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.60 2001/03/04 09:47:34 herrb Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.75 2000/12/12 19:04:02 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.76 2001/03/04 09:48:47 herrb Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD index 23617eb9b..452164dda 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD +++ b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD @@ -2,14 +2,13 @@ Matthieu Herrb - Last modified on: 2 December 2000 + Last modified on: 3 March 2000 1. What and Where is XFree86? -XFree86 is a port of X11R6.4 that supports several versions of Intel-based -Unix. It is derived from X386 1.2, which was the X server distributed with -X11R5. This release consists of many new features and performance improve- -ments as well as many bug fixes. +XFree86 is the Open Source port of X.Org's X11R6.4 release that supports sev- +eral UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operat- +ing systems on Intel and other platforms. See the Copyright Notice. @@ -35,7 +34,13 @@ if you have comments or suggestions about this file and we'll revise it. See the Release Notes for non-OS dependent new features in XFree86 4.0.2. -3.1 New OS dependent features in 4.0.2 +3.1 New OS dependant features in 4.0.3 + + o Support for the wscons console driver in post 2.8 OpenBSD. + + o A fix for multi-threaded libraries support. + +3.2 New OS dependent features in 4.0.2 o Support for the OpenBSD ports tree, @@ -46,7 +51,7 @@ See the Release Notes for non-OS dependent new features in XFree86 4.0.2. o startx now creates an Xauthority magic cookie for the display. -3.2 New OS dependent features in 4.0.1 +3.3 New OS dependent features in 4.0.1 o Several features from the OpenBSD X11 tree were merged into xdm: @@ -65,21 +70,21 @@ See the Release Notes for non-OS dependent new features in XFree86 4.0.2. o The Xsun server can be built again on OpenBSD/sparc. -3.3 New OS dependent features in 4.0 +3.4 New OS dependent features in 4.0 o Multi-thread safe libraries are built by default on OpenBSD 2.6 and later, o Preliminary APM support. -3.4 New OS dependent features in 3.9.18 +3.5 New OS dependent features in 3.9.18 o Support for USB mices has been added on OpenBSD. o Soft-booting secondary cards through the int10 BIOS interface is now possible using the x86emu real mode emulator. -3.5 New OS dependent features in 3.9.17 +3.6 New OS dependent features in 3.9.17 o Silken mouse is supported for serial mices, and, under post 2.6 OpenBSD- current for PS/2 mices. @@ -92,8 +97,8 @@ Refer to the Installation Document for detailed installation instructions. 5. Configuring X for Your Hardware -The /etc/XF86Config file tells the X server what kind of monitor, video card -and mouse you have. You must create it to tell the server what specific +The /etc/X11/XF86Config file tells the X server what kind of monitor, video +card and mouse you have. You must create it to tell the server what specific hardware you have. You'll need info on your hardware: @@ -104,6 +109,11 @@ You'll need info on your hardware: o Your monitor's sync frequencies. +The recommended way to generate an XF86Config file is to use the xf86cfg +utility. The xf86config text utility is still there for the (few) cases +where xf86cfg can't be used. Also, there is a sample file installed as +/usr/X11R6/lib/X11/XF86Config.eg, which can be used as a starting point. + For details about the XF86Config file format, refer to the XF86Config(5) man- ual page. @@ -112,8 +122,10 @@ the xvidtune utility. 5.1 About mouse configuration -If your serial mouse does not work try using kermit or tip to connect to the -mouse serial port and verify that it does indeed generate characters. +XFree86 4.0.2 has support for the mouse driver included in the new wscons +console driver introduced by OpenBSD-current after 2.8. Specify ``wsmouse'' +as the protocol and ``/dev/wsmouse0'' as the device in /etc/X11/XF86Config +if you're using OpenBSD-current with a PS/2 mouse. The OpenBSD pms driver provides both ``raw'' and ``cooked'' (translated) modes. ``raw'' mode does not do protocol translation, so XFree86 would use @@ -168,8 +180,11 @@ The server supports the two standard OpenBSD/i386 console drivers: pcvt and pccons. They are detected at runtime and no configuration of the server itself is required. -The pcvt console driver is the default in OpenBSD. It offers several virtual -consoles and international keyboard support. +The pcvt console driver is the default in OpenBSD up to OpenBSD 2.8. It +offers several virtual consoles and international keyboard support. + +OpenBSD-current after 2.8 has switched to the wscons console driver. This +console driver has a pcvt compatibility mode for X support. 7.2 Aperture Driver @@ -219,6 +234,14 @@ I've also included it below, if you want to edit the source file by hand. else return -1; +In post 2.8 OpenBSD-current, a modified version of this patch has been inte- +grated. You should set + + machdep.allowaperture=2 + +in /etc/sysctl.conf in order to achieve this. See the xf86(4) manual page for +details. + Another (less recommended) way to enable linear memory and I/O ports access is to disable the kernel security feature by adding ``option INSECURE'' in your kernel configuration file and build a new kernel. You will also need to @@ -279,11 +302,22 @@ OpenBSD/powerpc and on OpenBSD/i386 -current can be built by adding: to xc/config/host.def before rebuilding the server. This has not been thor- oughly tested, except on the macppc. +For the i386, you should include both pcvt and wscons support in order to use +the pcvt compatibility mode of wscons: + + #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT + 8.2 Building on other architectures XFree86 should also compiles on other OpenBSD architectures. However, please note that 3.9.x snapshots have only been tested on the i386 for now. +Note that OpenBSD project has now its own source tree, based on the XFree86 +source tree, with some local modifications. You may want to start with this +tree to rebuild from sources. The OpenBSD X11 source tree is available by +anoncvs from all OpenBSD anoncvs servers. See http://www.openbsd.org/anon- +cvs.html for details on anoncvs. + 9. Building New X Clients The easiest way to build a new client (X application) is to use xmkmf if an @@ -298,7 +332,7 @@ Many thanks to all people who contributed to make XFree86 work on *BSD, in particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, Nate Williams, Rod Grimes, Jack Velte and Michael Smith. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.15 2000/12/12 18:54:29 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.16 2001/03/04 09:47:35 herrb Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.20 2000/12/12 19:04:02 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.21 2001/03/04 09:48:47 herrb Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.ati b/xc/programs/Xserver/hw/xfree86/doc/README.ati index 3745c2067..19b525acb 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 December 6 + 2001 March 24 Abstract @@ -216,7 +216,7 @@ been specified instead. A ChipSet name of ``vgawonder'' is equivalent to ``ativga'', except that only VGAWonder-capable adapters can be assigned to the ``Device'' section. This -specifically excludes newer Mach64's with integrated controllers. +specifically excludes the newer integrated Mach64 controllers. In some PCI or AGP systems, the driver will not, by default, probe for non- PCI Mach32's or Mach64's. This is because, before doing any such probe, the @@ -426,9 +426,19 @@ 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. +option is ignored. -5.10 Option ``shadowfb'' +5.10 Option ``HWCursor'' and Option ``SWCursor'' + +Option ``HWCursor'', which is the default, specifies that hardware facilities +are to be used to paint the mouse pointer on the screen. Option ``SWCursor'' +specifies that the mouse pointer is to by drawn by software, which is much +slower. If both options are specified, option ``SWCursor'' prevails. Cur- +rently, these options are only acted upon for 256-colour or higher depth +modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is +being used. In all other situations, a software cursor will be used. + +5.11 Option ``shadowfb'' 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 @@ -444,19 +454,19 @@ Note that, due to various limitations, this option is forcibly disabled when a linear video memory aperture is not enabled, when the frame buffer depth is less than 8, or when acceleration is used. -5.11 Option ``dpms'' +5.12 Option ``dpms'' This option enables the driver's support for VESA's Display Power Management Specification. -5.12 Option ``backingstore'' +5.13 Option ``backingstore'' This is not specifically a driver option. It is used to enable the server's support for backing store, a mechanism by which pixel data for occluded win- dow regions is remembered by the server thereby alleviating the need to send expose events to X clients when the data needs to be redisplayed. -5.13 MemBase address +5.14 MemBase address This specification is only effective for non-PCI Mach64 adapters, and is used to override the CPU address at which the adapter will map its video memory. @@ -470,14 +480,14 @@ 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'' +5.15 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'' +5.16 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 @@ -673,7 +683,7 @@ newer driver API of XFree86 4.0 and later. 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.35 2001/01/06 20:58:03 tsi Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.36 2001/03/25 05:32:07 tsi Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.54 2001/01/21 21:19:15 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.55 2001/03/25 05:42:43 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.dps b/xc/programs/Xserver/hw/xfree86/doc/README.dps new file mode 100644 index 000000000..da1bf9fdc --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/doc/README.dps @@ -0,0 +1,170 @@ + XFree86 and DPS + + Juliusz Chroboczek, <jch@xfree86.org> + + 27 February 2001 + +1. Introduction + +Display Postscript (or DPS for short) is a rendering extension for X11. DPS +is slightly atypical in that it is based on code mobility, the ability to +send executable code from client to server. Thus, a DPS client does not +request that a line should be rendered; instead, it uploads code to the +server which, when executed, causes a line to be drawn. + +This document does not aim at teaching programming with DPS; it is only a +summary description of the DPS support code included with XFree86. More +information about DPS, including a DPS bibliography, is available from the +DPS extension site <URL:http://dps.sourceforge.net>. + + Note: Adobe, PostScript and Display PostScript are trademarks of + Adobe Systems Incorporated which may be registered in certain + jurisdictions. + +As all X11 extensions, DPS consists of client-side and server-side compo- +nents. The DPS client side consists of a number of libraries and a number of +tools for programming and configuration. The DPS server side may consist +either of an X server extension, or of a client-side process known as the +``DPS agent.'' In this latter case, the term ``server-side'' is somewhat +misleading. + +At the time of writing, only the client side is included with XFree86; the +server side must be obtained separately. Please see server side (section 3., +page 1) later in this document for more information. + +2. The DPS client side + +The DPS client side consists of four libraries and a number of basic tools +for programming and configuration; these are all included with XFree86. + +2.1 Libraries + +The libpsres library is a library for management of PostScript resources, on- +disk files representing PostScript data structures such as fonts, font encod- +ings, procsets, etc. It is closely related to the makepsres tool (see client- +side tools (section 2.2, page 1) later in this document). + +The basic DPS client library is libdps. This library contains a number of +functions for connection establishment, resource management, as well as stubs +for all standard PostScript operators. Normally, all DPS clients should link +with libdps; in addition, libdps may be used for printing by non-DPS clients +(this is done, for example, by Sun's JDK). This library is documented in +[CLRM] and [CLSX]. + +The libdpstk library contains a number of additional utilities for managing +DPS contexts, user paths and user objects, and for previewing EPS files. It +is documented in [DPTX]. + +The libdpstkXm library contains four Motif widgets. The DPS Scrolling Widget +is a DPS drawing area that automatically manages issues such as scrolling, +scaling, client-side backing store, incremental redisplay, etc. The Font +Selection Box, and its associated Font Preview, present a convenient and pow- +erful interface for choosing scalable fonts. Finally, the Color Picker pre- +sents an interface for choosing colours using either of the RGB or HSV +spaces. The latter three widgets are documented in [DPTX]; some summary +Scrolling Widget documentation is available in the doc subdirectory of the +DPS.tar.gz file, available from <URL:ftp://dps.source- +forge.net/pub/dps/DPS.tar.gz>. + +The source code for libdpstkXm is included with XFree86; however, as it +depends on Motif, this library is not built by default. A GTK-based library +providing some of the functionality of libdpstkXm is available from the +gtkDPS site <URL:http://www.gyve.org/gtkDPS/>. + +2.1.1 Libdps and Xt + +In X11R5, libdps did not depend on libXt. In X11R6, however, code was added +to make the Xt main loop dispatch to sundry code on DPS events; with this +addition, all programs that link with libdps need to link with libXt, whether +they use Xt or not. + +This state of affairs is unfortunately true of the version of libdps included +with XFree86. We are currently considering various solutions to this problem +(including the use of weak linker symbols or splitting off the guilty func- +tions into a separate library). + +2.2 Client-side tools + +In addition to the libraries, the client side of DPS consists of two utili- +ties. + +The makepsres utility is used for managing PostScript resources. Its basic +operation consists in walking recursively a filesystem tree, noting all +resources, and then writing out a ``Unix PostScript Resources,'' file, basi- +cally a directory of all the resources found. This utility is documented in +the makepsres(1) manual page. + +The pswrap utility is a stub generator for PostScript clients. Roughly +speaking, it takes as its input textual PostScript code, and generates a col- +lection of C functions that transmit that code in pre-tokenised form to the +DPS extension. Pswrap is documented in [PSWRAP]. + +2.3 Sample clients + +XFree86 contains three sample DPS clients, dpsinfo, dpsexec and texteroids. +They are documented in their respective manual pages. + +A number of sample clients that depend on Motif are available in +<URL:ftp://dps.sourceforge.net/pub/ftp/DPS.tar.gz>. Additional sample +clients can be found as part of GtkDPS (see above). + +The GNUstep environment can be compiled to use DPS for all rendering; for +more information, please see the GNUstep site <URL:http://www.gnustep.org>. + +3. The DPS server side + +In order to use DPS clients, you need to install a DPS server side, which can +be either a server extension (a ``DPS/X extension''), or a separate process +(referred to, variously, either as a ``DPS/NX agent'' or, rather confusingly, +as ``Client-Side DPS'' (CSDPS). + +3.1 Display Ghostscript + +Display Ghostscript (note the capitalisation), or DGS, is a client-side +implementation of DPS based on the Ghostscript PostScript interpreter. DGS +is still in beta at the time of writing; it does, however, provide a very +usable implementation of DPS, although it still has some problems with the +semantics of multiple DPS contexts. + +DGS is available from the GNUstep download area +<URL:http://www.gnustep.org/resources/sources.html>. + +3.2 The DPS extension + +The DPS extension is a much younger project aiming at producing an efficient +server-side implementation of DPS. The extension is currently in a state +best described as alpha; current versions are known to crash the X server +under some circumstances. + +The DPS extension is available from the DPS extension site +<URL:http://dps.sourceforge.net>. + +4. References + +Links to electronic versions of all of these, and more, are available from +the DPS extension site <URL:http://dps.sourceforge.net>. + +[PLRM2] PostScript language reference manual. Adobe Systems, 2nd ed. Addison- +Wesley, 1990. ISBN 0-201-18127-4. + +[PLRM] PostScript language reference. Adobe Systems Incorporated, 3rd ed. +Addison-Wesley, 1999. ISBN 0-201-37922-8. + +[INTRO] Display PostScript System. Introduction: Perspective for Software +Developers. 15 April 1993. + +[CLRM] Display PostScript System. Client Library Reference Manual. 15 April +1993. + +[CLSX] Display PostScript System. Client Library Supplement for X. 15 April +1993. + +[DPTX] Display PostScript System. Display PostScript Toolkit for X. 15 April +1993. + +[PSWRAP] Display PostScript System. pswrap Reference Manual. 15 April 1993. + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.1 2001/03/02 02:45:37 dawes Exp $ + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.dps,v 1.2 2001/03/02 17:47:53 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.fonts b/xc/programs/Xserver/hw/xfree86/doc/README.fonts index 122b98071..9a3b84b26 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.fonts +++ b/xc/programs/Xserver/hw/xfree86/doc/README.fonts @@ -2,7 +2,7 @@ Juliusz Chroboczek, <jch@xfree86.org> - 14 December 2000 + 21 January 2001 1. Introduction @@ -238,7 +238,7 @@ On most platforms, the XFree86 servers are modular: the font backends are included in modules that are loaded at runtime. The modules to be loaded are specified in the `XF86Config' file using the `Load' directive: - Load "Type1" + Load "type1" If you have trouble installing fonts in a specific format, you may want to check the server's log file in order to see whether the relevant modules are @@ -247,14 +247,16 @@ follows: o "bitmap": bitmap fonts (`*.bdf', `*.pcf' and `*.snf'); - o "Type1": Type 1 fonts (`*.pfa' and `*.pfb') and CIDFonts; + o "type1": Type 1 fonts (`*.pfa' and `*.pfb') and CIDFonts; - o "Speedo": Bitstream Speedo fonts (`*.spd'); + o "speedo": Bitstream Speedo fonts (`*.spd'); o "freetype": TrueType fonts (`*.ttf' and `*.ttc'); o "xtt": alternate TrueType backend (`*.ttf' and `*.ttc'). +Please note that the argument of the `Load' directive is case-sensitive. + 3. Fonts included with XFree86 3.1 Standard bitmap fonts @@ -1008,7 +1010,7 @@ The IANA RFC documents, available from a number of sites throughout the world, often provide interesting information about character set issues; my favourite is RFC 373. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.11 2000/12/15 20:01:56 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.13 2001/03/01 00:37:09 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.15 2000/12/15 20:22:16 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.16 2001/03/02 17:47:53 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES index 226506c6f..a1dd1afdb 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/RELNOTES +++ b/xc/programs/Xserver/hw/xfree86/doc/RELNOTES @@ -17,7 +17,7 @@ significant redesign of the XFree86 X server. 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. Our Driver Status document summarizes how the hardware driver support compares between 3.3.6 and 4.0.2. Please -check there first before downloading 4.0.2. +check there first before downloading 4.0.2. The 4.0.1 release introduced a new graphical configuration tool, "xf86cfg", and a text mode interface was added to it for the 4.0.2 release. It is work @@ -824,34 +824,35 @@ via DDC, you may want to add that information to XF86Config. To allow a graceful transition for applications moving from core text render- ing to the Render extension, Xft can use either core fonts or FreeType and -the Render extension for text. By default, Xft is configured to support only -core fonts, see the section on building FreeType support for the changes -needed to add FreeType/Render fonts. +the Render extension for text. By default, Xft is configured to support both +core fonts and FreeType fonts using the supplied version of FreeType 2. See +the section on FreeType support in Xft for instructions on configuring +XFree86 to use an existing FreeType installation. The Xft library uses a configuration file, XftConfig, which contains informa- tion about which directories contain font files and also provides a sophisti- cated font aliasing mechanism. Documentation for that file is included in the Xft man page. -4.11.2 Building FreeType support for Xft +4.11.2 FreeType support in Xft -XFree86 4.0.2 includes sources for FreeType version 2.0.1, but they are not -built and installed automatically. As a result, Xft is configured to provide -only core fonts by default. +XFree86 4.0.2 includes sources for FreeType version 2.0.1, and, by default, +they are built and installed automatically. -To build FreeType support for Xft, first FreeType must be built and -installed, either from the sources included in XFree86 in extras/freetype2 or -from another FreeType (version 2.0.1 or later) release. Early FreeType ver- -sion 2 releases used a different header file installation and aren't compati- -ble with XFree86. Instructions for building and installing FreeType can be -found in the INSTALL file included with the FreeType release. +If you prefer, you can configure XFree86 4.0.2 to use an existing Freetype2 +installation by telling XFree86 not to build the internal copy and indicating +where that external version has been installed. Edit (or create) con- +fig/cf/host.def to include: -Second, XFree86 needs to know the installed location for FreeType, usually -/usr/local. Edit (or create) config/cf/host.def to include: + o #define BuildFreetype2Library NO - #define Freetype2Dir /usr/local + o #define Freetype2Dir /usr/local -Finally, build XFree86 with "make World" from the top. +Note that XFree86 assumes you'll be using a release FreeType no older than +version 2.0.1. Early FreeType version 2 releases used a different header +file installation and aren't compatible with XFree86. Instructions for build- +ing and installing FreeType can be found in the INSTALL file included with +the FreeType release. 4.11.3 Application Support For Anti-Aliased Text @@ -871,8 +872,8 @@ instead: Xditview will use Xft instead of the core API by default. X11perf includes tests to measure the performance of text rendered in three ways, anti- aliased, anti-aliased with sub-pixel sampling and regular chunky text, but -through the Render extension, a path which has not been optimized within the -X server yet. +through the Render extension, a path which is currently somewhat slower than +core text. 4.12 Other extensions @@ -1081,7 +1082,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.58 2000/12/17 23:01:10 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.60 2001/03/02 17:40:48 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.96 2000/12/18 05:55:38 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.97 2001/03/02 17:47:53 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/Status b/xc/programs/Xserver/hw/xfree86/doc/Status index 6c5669771..0e05bc4ce 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Status +++ b/xc/programs/Xserver/hw/xfree86/doc/Status @@ -8,8 +8,10 @@ This document provides information about the status of the driver and hardware support in XFree86 4.0.2 compared with that in XFree86 - 3.3.6. Please send updates for this document to - <fixes@xfree86.org> + 3.3.6. Unless otherwise stated, hardware is classified as "sup- + ported" if its driver provides basic 2D support. Support for addi- + tional features may or may not be present. Please send updates for + this document to <fixes@xfree86.org> 1. Introduction @@ -514,8 +516,8 @@ architectures known to work on (e.g., Alpha, PPC), etc. some problems with it in this version. Summary: - Support for the 86C201, 86C202, 86C215, 86C225, 5597 and 5598 is - currently only available in 3.3.6. + Support for the 86C201, 86C202, 86C205, 86C215, 86C225, 5597 and + 5598 is currently only available in 3.3.6. 31. Silicon Motion, Inc. @@ -627,7 +629,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. Summary: No Weitek chips are supported in 4.0.2. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.26 2000/12/14 22:15:48 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.28 2001/03/16 22:13:19 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.21 2000/12/14 22:34:26 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.22 2001/03/25 05:42:43 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml index 7f7208065..16ebb560c 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml @@ -10,10 +10,10 @@ <author> <htmlurl url="http://www.valinux.com/" name="VA Linux Systems, Inc."> Professional Services - Graphics. - <date>5 January 2001 + <date>15 March 2001 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.16 2001/01/08 01:07:33 martin Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.20 2001/04/05 19:29:42 dawes Exp $ </ident> <toc> @@ -22,7 +22,7 @@ <p> <sect1>Copyright <p> - <bf>Copyright © 2000 by VA Linux Systems, Inc. + <bf>Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.</bf> <p> <bf>Permission is granted to make and distribute verbatim copies @@ -74,9 +74,9 @@ to brianp@valinux.com. <sect>Supported Architectures & Hardware - <p> +<p> <sect1>CPU Architectures - <p> +<p> The architectures currently supported by the DRI have grown from the initial Intel i386 systems to now include the Alpha Processor and the Sun SPARC machines. @@ -94,38 +94,12 @@ Like the SSE optimizations, a runtime check is made to determine if the CPU can execute 3DNow! instructions. - The build environment for both of these new architectures - have a pre-build environment that will correctly build the - DRI drivers and Mesa meaning no extra configuration is necessary - to build the DRI for these architectures. - - <sect2>Alpha Features - <p> - On newer Alpha processors, it should be noted that a - significant performance increase can be seen with the - addition of the -mcpu= command that should be passed to - GCC upon compilation. Dependent of the architecture of the - processor, for example -mcpu=ev6 will build specifically - for the EV6 based AXP's, giving both byte and word alignment - access to the DRI/Mesa drivers. - - Use this as an example of compiling with this extra speed. - In your host.def file that should reside in the xc/config - directory, add the line. - - #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 - - Additional speed improvements to 3D rendering can be achieved - by installing Compaq's Math Libraries (CPML) which can be - obtained from the following URL. - - http://www.support.compaq.com/alpha-tools/software/index.html - - Alpha systems can benefit from several compile-time optimizations - which are described in the DRI Compile Guide. + Alpha-based systems can use Compaq's optimized math library for + improved 3D performance. See the DRI Compilation Guide for + details. <sect1> Graphics Hardware - <p> +<p> XFree86 4.0 (or later versions) includes 3D acceleration for the following graphics hardware: @@ -202,7 +176,7 @@ <sect>Kernel Modules - <p> +<p> 3D hardware acceleration requires a DRI kernel module that's specific to your graphics hardware. <P> @@ -231,7 +205,7 @@ exists. <sect>XF86Config file - <p> +<p> The XFree86 configuration file is usually found in <tt>/etc/X11/XF86Config</tt>. This section describes the parts which must be specially set for @@ -251,9 +225,13 @@ Next, the DRI section can be used to restrict access to direct rendering. + A client can only use direct rendering if it has permission to + open the <tt>/dev/dri/card?</tt> file(s). + The permissions on these DRI device files is controlled by the "DRI" + section in the XF86Config file. <p> If you want all of the users on your system to be able to use - direct-rendering, then use a simple DRI section: + direct-rendering, then use a simple DRI section like this: <verb> Section "DRI" Mode 0666 @@ -476,8 +454,70 @@ <sect>General Trouble Shooting <p> This section contains information to help you diagnose general - problems. - See below for additional information for specific hardware. + problems. + See below for additional information for specific hardware. + + <sect1>Bus Mastering +<p> + DMA-based DRI drivers (that's most DRI drivers) cannot function + unless bus mastering is enabled for your graphics card. + By default, some systems don't having bus mastering on. + You should enable it in your BIOS. + <p> + Alternately, you can check the status of bus mastering and change + the setting from within Linux. There may be similar procedures for + other operating systems. + <p> + Run <tt>lspci</tt> (as root) and find the information + describing your graphics adapter. For example: + <P> + + <verb> + 00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03) + 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03) + 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02) + 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01) + 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) + 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02) + 00:11.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08) + 00:12.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR) 53c895 (rev 02) + 00:14.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 08) + 01:00.0 VGA compatible controller: 3Dfx Interactive, Inc.: Unknown device 0009 (rev 01) + </verb> + <p> + The bus, device, and function number comprise the device id, + which is conventionally written in the form bus:dev.func, or + in this case 01:00.0. + <p> + Use the <tt>setpci</tt> command to examine bit two of register 4 for + your graphics card. This will indicate whether or not bus mastering + is enabled. + <p> + <verb> + setpci -s 01:00.0 4.w + </verb> + <p> + A hexadecimal value will be printed. Convert the least significant + digit to binary. For example, if you see 3, that's 0011 in binary + (bit two is 0). If you see 7, that's 0111 in binary (bit two is 1). + In the first example, bus mastering is disabled. It's enabled in + the second example. + <p> + The following shell script will enabled bus mastering for your + graphics card and host bridge. Run it as root. + <verb> + #!/bin/bash + dev=01:00.0 # change as appropriate + echo Enabling bus mastering on device $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + dev=00:00.0 + echo Enabling bus mastering on host bridge $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + </verb> + <p> + You can check if this worked by running the first setpci command again. + <p> + <sect1>The X Server <p> @@ -706,14 +746,22 @@ </verb> <p> - The kernel module for the Voodoo3 is named <tt>tdfx.o</tt> and + The kernel module for 3dfx hardware is named <tt>tdfx.o</tt> and should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded by the Xserver if needed. <p> - The DRI 3D driver for the Voodoo3 should be in + The DRI 3D driver for 3dfx hardware should be in <tt>/usr/X11R6/lib/modules/dri/tdfx_dri.so</tt>. This will be automatically loaded by libGL.so. <p> + The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. + When running in 32bpp mode an 8-bit stencil buffer and 24-bit + Z (depth) buffer are offered. + When running in 16bpp mode only a 16-bit Z (depth) buffer is + offered and stencil is implemented in software. + <p> + A software-based accumulation buffer is available in both + 16 and 32bpp modes. <sect2>Troubleshooting <p> @@ -731,9 +779,17 @@ the 16 bit/pixel screen mode. Use <tt/xdpyinfo/ to verify that all your visuals are depth 16. Edit your XF86Config file if needed. - <item> + <item> The <tt>/dev/3dfx</tt> device is not used for DRI; it's only for Glide on older 3dfx hardware. + <item> + Different versions of Glide are needed for Voodoo3 and Voodoo5. + See the DRI website's resources page to download the right + version of Glide. + <item> + Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) + but 3D acceleration is not supported in that mode. + 32bpp mode is fully 3D accelerated. </itemize> <sect2>Performance @@ -742,7 +798,7 @@ <item> Normally, buffer swapping in double-buffered applications is synchronized to your monitor's refresh rate. - This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERNVAL/ + This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERVAL/ environment variable. The value of this variable indicates the maximum number of swap buffer commands can be buffered. @@ -798,97 +854,6 @@ Using <tt/glColorMask(r, g, b, a)/ when r!=g or g!=b. </itemize> <item> - The lowest mipmap level is sometimes miscolored in trilinear- - sampled polygons. - </itemize> - - - <sect1>3dfx Voodoo5 Series -<p> - <sect2>Dependencies -<p> - The Voodoo5 DRI driver requires a special versions of - the 3dfx Glide library, different than that used for Voodoo3 - hardware. - It can be downloaded from the DRI website. -<p> - <sect2>Configuration -<p> - Your XF86Config file's device section must specify the - <tt>tdfx</tt> device: - <verb> - Section "Device" - Identifier "Voodoo5" - VendorName "3dfx" - Driver "tdfx" - EndSection - </verb> - The Screen section should then reference the Voodoo3 device: - <verb> - Section "Screen" - Identifier "Screen 1" - Device "Voodoo5" - Monitor "High Res Monitor" - DefaultDepth 24 - Subsection "Display" - Depth 16 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - Subsection "Display" - Depth 24 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - EndSection - </verb> - <p> - The kernel module for the Voodoo5 is named <tt>tdfx.o</tt> and - should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. - It will be automatically loaded by the Xserver if needed. - <p> - The DRI 3D driver for the Voodoo5 should be in - <tt>/usr/X11R6/lib/modules/dri/tdfx_dri.so</tt>. - This will be automatically loaded by libGL.so. - <p> - The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. - When running in 32bpp mode an 8-bit stencil buffer and 24-bit - Z (depth) buffer are offered. - When running in 16bpp mode only a 16-bit Z (depth) buffer is - offered and stencil is implemented in software. - <p> - A software-based accumulation buffer is available in both - 16 and 32bpp modes. - <p> - - <sect2>Troubleshooting -<p> - <itemize> - <item> - The <tt>/dev/3dfx</tt> device is not used for DRI; it's only for - Glide on older 3dfx hardware. - <item> - Different versions of Glide are needed for Voodoo3 and Voodoo5. - See the DRI website's resources page to download the right - version of Glide. - </itemize> - - <sect2>Performance -<p> - <itemize> - <item> - Normally, buffer swapping in double-buffered applications is - synchronized to your monitor's refresh rate. - This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERNVAL/ - environment variable. - The value of this variable indicates the maximum number of - swap buffer commands can be buffered. - Zero allows maximum frame rate. - <item> - Rendering with 16-bit per texel textures is faster than using - 32-bit per texel textures. The <tt/internalFormat/ parameter - to <tt/glTexImage2D/ can be used to control texel size. - <item> The Voodoo5 driver reverts to software rendering under the same conditions Voodoo3 with three exceptions. First, stencil operations are implemented in hardware when the @@ -897,6 +862,18 @@ hardware. Third, <tt/glColorMask/ is fully supported in hardware when the screen is configured for 32 bits/pixel. + <item> + As of January, 2001 the second VSA-100 chip on the Voodoo5 is + not yet operational. + Therefore, the board isn't being used to its full capacity. + The second VSA-100 chip will allow Scan-Line Interleave (SLI) + mode for full-screen applications and games, potentially doubling + the system's fill rate. + When the second VSA-100 chip is activated + glGetString(GL_RENDERER) will report Voodoo5 instead of Voodoo4. + <item> + The lowest mipmap level is sometimes miscolored in trilinear- + sampled polygons. </itemize> <sect2>Known Problems @@ -906,25 +883,12 @@ The lowest mipmap level is sometimes miscolored in trilinear- sampled polygons (Voodoo3/Banshee). <item> - Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) - but 3D acceleration is not supported in that mode. - 32bpp mode is fully 3D accelerated. - <item> Fog doesn't work with orthographic projections. <item> The accuracy of blending operations on Voodoo4/5 isn't always very good. If you run Glean, you'll find some test failures. <item> - As of October, 2000 the second VSA-100 chip on the Voodoo5 is - not yet operational. - Therefore, the board isn't being used to its full capacity. - The second VSA-100 chip will allow Scan-Line Interleave (SLI) - mode for full-screen applications and games, potentially doubling - the system's fill rate. - When the second VSA-100 chip is activated - glGetString(GL_RENDERER) will report Voodoo5 instead of Voodoo4. - <item> The Glide library cannot be used directly; it's only meant to be used via the tdfx DRI driver. <item> @@ -935,9 +899,9 @@ <sect1>Intel i810 - <p> +<p> <sect2>Dependencies - <p> +<p> A Linux kernel with AGP GART support is required. The 2.2.x kernel series does not have AGP GART support. The 2.4.x test kernels have AGP GART and have been tested @@ -945,7 +909,7 @@ <p> <sect2>Configuration - <p> +<p> Your XF86Config file's device section must specify the <tt>i810</tt> device, and specify a usable amount of video ram to reserve. @@ -954,6 +918,7 @@ Identifier "i810" VendorName "Intel" Driver "i810" + Option "AGPMode" "1" VideoRam 10000 EndSection </verb> @@ -1004,14 +969,14 @@ <p> <sect1>Matrox G200 and G400 - <p> +<p> <sect2>Dependencies - <p> +<p> A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. <p> <sect2>Configuration - <p> +<p> Your XF86Config file's device section must specify the <tt>mga</tt> device: <verb> @@ -1019,6 +984,7 @@ Identifier "MGA" VendorName "Matrox" Driver "mga" + Option "AGPMode" "1" VideoRam 32768 EndSection </verb> @@ -1072,9 +1038,14 @@ <item>Using glLogicOp. <item>Using glPolygonStipple or glLineStipple. <item>Using 1D or 3D textures. + <item>Using texture borders. + <item>Using glDepthFunc(GL_NEVER). <item>Using the accumulation buffer. </itemize> - +<p> + The AGP mode may be set to 1, 2, or 4. One is used by default. + Higher AGP speeds may result in unreliable performance depending + on your motherboard. <sect2>IRQ Assignment <p> @@ -1129,14 +1100,14 @@ <sect1>ATI Rage 128 - <p> +<p> <sect2>Dependencies - <p> +<p> A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. <p> <sect2>Configuration - <p> +<p> Your XF86Config file's device section must specify the <tt>ati</tt> device: <verb> @@ -1144,6 +1115,8 @@ Identifier "Rage128" VendorName "ATI" Driver "ati" + Option "AGPMode" "1" + Option "UseCCEFor2D" "false" EndSection </verb> The Screen section should then reference the Rage 128 device: @@ -1182,21 +1155,30 @@ While PCI Rage 128 based cards are supported, they do not yet support PCI GART, so they will not perform as well as their AGP counterparts. +<p> + For AGP cards, the AGP mode may be set to 1, 2, or 4. One is + used by default. + Higher AGP speeds may result in unreliable performance depending + on your motherboard. <sect2>Known Problems <p> - None. + If you experience stability problems you may try setting the + <tt>UseCCEFor2D</tt> option to <tt>true</tt>. This will + effectively disable 2D hardware acceleration. Performance will + be degraded, of course. +<p> <sect1>ATI Radeon - <p> +<p> <sect2>Dependencies - <p> +<p> A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. <p> <sect2>Configuration - <p> +<p> Your XF86Config file's device section must specify the <tt>ati</tt> device: <verb> @@ -1204,6 +1186,7 @@ Identifier "Radeon" VendorName "ATI" Driver "ati" + Option "AGPMode" "1" EndSection </verb> The Screen section should then reference the Radeon device: @@ -1242,6 +1225,10 @@ While this driver supports many of the features of ATI Radeon cards, we do not <em/yet/ fully support the card's TCL features. This work is progressing, but is not yet ready. +<p> + The AGP mode may be set to 1, 2, or 4. One is used by default. + Higher AGP speeds may result in unreliable performance depending + on your motherboard. <sect2>Known Problems <p> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml index 135e9ca4d..f77dce508 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml @@ -10,10 +10,10 @@ <author> <htmlurl url="http://www.valinux.com/" name="VA Linux Systems, Inc."> Professional Services - Graphics. - <date>5 January 2001 + <date>15 March 2001 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.10 2001/01/08 01:07:34 martin Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.13 2001/04/05 19:29:42 dawes Exp $ </ident> <toc> @@ -22,7 +22,7 @@ <sect1>Copyright <p> - <bf>Copyright © 2000 by VA Linux Systems, Inc. + <bf>Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.</bf> <p> <bf>Permission is granted to make and distribute verbatim copies @@ -79,7 +79,8 @@ <p> The DRI 3D drivers generally work on systems with Intel or AMD CPUs. - However, there is limited support for Alpha and Sparc. + However, there is limited support for Alpha and PowerPC support is + underway. <p> For 3dfx Voodoo3 hardware, you'll also need: @@ -115,7 +116,8 @@ The DRI project closely tracks Linux kernel development. Since the internal Linux data structures might change in the 2.4 Linux - kernel, it's important to have use the most recent Linux kernel. + kernel, it's important to use the most recent Linux kernel and + not an old, intermediate development release. As of this writing (Jan 2001), 2.4.0 is the most recent version of Linux which the DRI is synchronized to. <p> @@ -154,7 +156,7 @@ compilation problems. <item>Read /usr/src/linux/Documentation/Changes. This file lists the minimum requirements for all software - packages required to build the kernel. You must upgrage at + packages required to build the kernel. You must upgrade at least gcc, make, binutils and modutils to at least the versions specified in this file. The other packages may not be needed. If you are upgrading from Linux 2.2.x you must @@ -217,22 +219,22 @@ runtime which CPU-dependent optimizations should be used and enable them where appropriate. - <sect1>Intel Pentium III Features - <p> + <sect1>Intel Pentium III Features <p> + The Pentium III SSE (Katmai) instructions are used in optimized vertex transformation functions in the Mesa-based DRI drivers. On Linux, SSE requires a recent kernel (such as 2.4.0-test11 or later) both at compile time and runtime. - <sect1>AMD 3DNow! Features - <p> + <sect1>AMD 3DNow! Features <p> + AMD's 3DNow! instructions are used in optimized vertex transformation functions in the Mesa-based DRI drivers. 3DNow! is supported in most versions of Linux. - <sect1>Alpha Features - <p> + <sect1>Alpha Features <p> + On newer Alpha processors a significant performance increase can be seen with the addition of the -mcpu= option to GCC. This option is dependent on the architecture of the processor. @@ -243,7 +245,7 @@ To enable this optimization edit your xc/config/host.def file and add the line: - #define DefaultCCOptions -ansi GccWarningOptions -pipe -mcpu=ev6 + #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 Additional speed improvements to 3D rendering can be achieved by installing Compaq's Math Libraries (CPML) which can be @@ -516,7 +518,7 @@ <p> To load the appropriate DRI module in your running kernel you can either use ismod and restart your X server or copy the kernel module - to <tt>/lib/modules/2.4.x/kernel/driver/char/drm/</tt> then run + to <tt>/lib/modules/2.4.x/kernel/drivers/char/drm/</tt> then run depmod and restart your X server. <p> Make sure you first unload any older DRI kernel modules that might diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile b/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile index 7b348d473..c9b0477bb 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile @@ -3,7 +3,7 @@ XCOMM $XConsortium: Imakefile /main/16 1996/10/28 05:13:04 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.70 2001/02/07 18:49:30 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.71 2001/03/02 02:45:37 dawes Exp $ #include <Server.tmpl> #include <lnxdoc.rules> @@ -12,7 +12,7 @@ SGMLDEPENDS = defs.ent MANSGMLDEPENDS = mdefs.ent INDEXLIST = README.sgml RELNOTES.sgml Status.sgml LICENSE.sgml Install.sgml \ DESIGN.sgml Versions.sgml \ - mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml \ + mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml dps.sgml \ Darwin.sgml isc.sgml LynxOS.sgml NetBSD.sgml OpenBSD.sgml \ OS2note.sgml \ apm.sgml ati.sgml chips.sgml cyrix.sgml DECtga.sgml \ @@ -118,6 +118,7 @@ LinuxDocTarget(xinput) #endif LinuxDocReadmeTarget(DRI) LinuxDocReadmeTarget(DRIcomp) +LinuxDocReadmeTarget(dps) SGMLMANDEFS=-D__drivermansuffix__='"$(DRIVERMANSUFFIX)"' \ -D__filemansuffix__='"$(FILEMANSUFFIX)"' \ diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml index dc2df49d0..c4b02d73d 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>15 December 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.10 2000/12/15 19:09:06 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11 2001/03/02 17:40:48 dawes Exp $ </ident> <abstract> @@ -36,7 +36,17 @@ used to install the binaries. <sect>Downloading the XFree86 &relvers; binaries <p> -We provide XFree86 &relvers; binaries for a range + +<![ %updaterel [ +XFree86 &relvers; is an update release. The most recent full release +(&fullrelvers;) needs to be installed before installing this update. +Information about downloading and installing &fullrelvers; can be found +in the installation document for that version, which can be found +on the <url name="XFree86 web site" +url="http://www.xfree86.org/pub/XFree86/&fullrelvers/Install.html">. +]]> + +We provide XFree86 &relvers; <![ %updaterel [update ]]>binaries for a range of operating systems at our <![ %snapshot; [ <url name="ftp site" @@ -80,11 +90,13 @@ 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. +<![ %updaterel; [update ]]>distribution is suitable for your system, +download the necessary files. The <![ %fullrel [twelve (12)]]><![ +%updaterel [four (4)]]> mandatory files for all installations are listed +below. If you have not downloaded all of the files, the installer script +will complain. +<![ %fullrel [ <quote><verb> 1. Xinstall.sh The installer script 2. extract The utility for extracting tarballs @@ -99,6 +111,16 @@ complain. 11. Xxserv.tgz XFree86 X server 12. Xmod.tgz XFree86 X server modules </verb></quote> +]]> + +<![ %updaterel [ +<quote><verb> +1. Xinstall.sh The installer script +2. extract The utility for extracting tarballs +3. Xupdate.tgz Updated files except X server drivers +4. Xdrivers.tgz Updated X server drivers +</verb></quote> +]]> NOTES: <itemize> @@ -107,18 +129,22 @@ NOTES: version called <tt>extract.exe</tt> instead. This should fix the problem. (This is not a DOS/Windows executable.) +<![ %fullrel [ <item>A few distributions don't have or require the <tt>Xvar.tgz</tt> tarball. If it is present in the <tt>binaries</tt> sub-directory for your platform, then it is required. +]]> <item>The Darwin/Mac OS X distribution doesn't have or require the - <tt>Xmod.tgz</tt> tarball. + <![ %fullrel [<tt>Xmod.tgz</tt>]]><![ %updaterel + [<tt>Xdrivers.tgz</tt>]]> tarball. <item>Some distributions may have additional mandatory tarballs. While rare, the installer script will tell you if any are missing. </itemize> +<![ %fullrel [ The following thirteen (13) tarballs are optional. You should download the ones you want to install. @@ -146,15 +172,22 @@ NOTES: If you miss some and want to install them later, go to the <ref id="manual-install" name="Manual Installation"> section. +]]> <sect>Installing XFree86 &relvers; using the <tt>Xinstall.sh</tt> script <p> We strongly recommend that our XFree86 &relvers; binaries be installed -using the <tt>Xinstall.sh</tt> script that we provide. There are a lot of +using the <tt>Xinstall.sh</tt> script that we provide. +<![ %updaterel [It is also important that the previous full release +(&fullrelvers;) is installed before installing this update release. +Make sure that you use the &relvers; version of the <tt>Xinstall.sh</tt> +script to install this update. Older versions may not be able to do it +correctly.]]> +There are a lot of steps in the manual installation process, and those steps can vary -according to the platform and hardware setup. There is a description of +according to the platform and hardware setup. <![ %fullrel [There is a description of the manual installation process for the most common cases <ref -id="manual-install" name="below">. +id="manual-install" name="below">.]]> You must login as the super user (root) to run the installer script. Place all of the downloaded files into a single directory (choose a @@ -184,7 +217,9 @@ be a problem, you should exit your X session, including stopping xdm or equivalent if it is running, before continuing. If you ignore this warning and run into problems, well, you were warned! -If you have an existing X installation, you will be warned that proceeding +<![ %fullrel [If you have an existing X installation, you]]> +<![ %updaterel [You ]]> +will be warned that proceeding with this installation will overwrite it. Only those things that are part of our standard distribution will be overwritten. Other X applications that you may have installed will not be removed. Some @@ -203,6 +238,7 @@ script may remove some old files or directories that would get in the way of the new installation. It will list which files/directories have been removed. If none are listed, then none were removed. +<![ %fullrel [ The next step when installing over an existing version is to check for existing configuration files. As of XFree86 version 3.9.18, the run-time configuration files are installed by default under <tt>/etc/X11</tt> @@ -222,7 +258,7 @@ then you can safely answer "no" if you don't want them moved. When installing over an existing version, you will be prompted before each set of configuration files is installed. If you haven't made any -customisations to your existing configuration files, then you can safely +Customisations to your existing configuration files, then you can safely answer "yes" for each of these. If you have made customisations, you can try answering "no". If you run into problems later, you may need to manually merge your customisations into the the new version of the @@ -273,6 +309,8 @@ rm -f /usr/bin/rstartd ln -s /usr/X11R6/bin/rstartd /usr/bin/rstartd </verb></tscreen> +]]> + <sect1>After the installation is complete <p> The next step is to configure the X server. That is covered in detail @@ -301,6 +339,7 @@ operation of the new X server, you can safely remove the old After the X server configuration is done, it may be advisable to reboot, especially if you run xdm (or equivalent) or the font server (xfs). +<![ %fullrel [ <sect>Installing XFree86 &relvers; manually<label id="manual-install"> <p> This section describes how to manually install the XFree86 &relvers; binary @@ -427,5 +466,7 @@ Once that's done, the main part of the installation can be done: /usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc </verb></tscreen> +]]> + </article> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml index 9aa0de66a..35a248852 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml @@ -5,10 +5,10 @@ <article> <title>Licenses</title> <author>The XFree86 Project</author> -<date>1999</date> +<date>March 2001</date> <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.7 2000/03/06 22:59:23 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.8 2001/03/16 22:13:19 dawes Exp $ </ident> <sect>XFree86 License @@ -17,7 +17,7 @@ XFree86 code without an explicit copyright is covered by the following copyright/license: <p> -Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. +Copyright (C) 1994-2001 The XFree86 Project, Inc. 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"), diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml index dc4dd743b..47f9d66d4 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml @@ -9,10 +9,10 @@ David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb -<Date>Last modified on: 7 December 2000 +<Date>Last modified on: 3 March 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.59 2000/12/12 18:54:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.60 2001/03/04 09:47:34 herrb Exp $ </ident> <toc> @@ -20,10 +20,9 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.59 2000/12/12 <sect>What and Where is XFree86? <p> -XFree86 is a port of X11R6.4 that supports several versions of -Intel-based Unix. It is derived from X386 1.2, which was the X server -distributed with X11R5. This release consists of many new features -and performance improvements as well as many bug fixes. +XFree86 is the Open Source port of X.Org's X11R6.4 release that supports +several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) +operating systems on Intel and other platforms. See the <htmlurl url="COPYRIGHT.html" name="Copyright Notice">. @@ -32,7 +31,7 @@ The sources for XFree86 are available by anonymous ftp from: <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;" url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;"> -Binaries for NetBSD 1.3 and later are available from: +Binaries for NetBSD 1.4 and later are available from: <htmlurl name="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/binaries/NetBSD" url="ftp://ftp.XFree86.org/pub/XFree86/&relvers;/NetBSD"> @@ -111,7 +110,7 @@ for detailed installation instructions. <sect>Configuring X for Your Hardware <p> -The <tt>/etc/XF86Config</tt> file tells the X server what kind of +The <tt>/etc/X11/XF86Config</tt> file tells the X server what kind of monitor, video card and mouse you have. You <em/must/ create it to tell the server what specific hardware you have. @@ -123,13 +122,12 @@ You'll need info on your hardware: <item>Your monitor's sync frequencies. </itemize> -<!-- + The recommended way to generate an <tt/XF86Config/ file is to use the -<tt/XF86Setup/ utility. The xf86config text utility is still there -for the (few) cases where XF86Setup can't be used. Also, there is a +<tt/xf86cfg/ utility. The xf86config text utility is still there +for the (few) cases where xf86cfg can't be used. Also, there is a sample file installed as <tt>/usr/X11R6/lib/X11/XF86Config.eg</tt>, which can be used as a starting point. ---> For details about the <tt/XF86Config/ file format, refer to the <em>XF86Config(5)</em> manual page. @@ -140,20 +138,21 @@ modes with the <tt>xvidtune</tt> utility. <sect1>About mouse configuration <p> -The NetBSD pms mouse driver handles PS/2 style mice as -Busmouse. Specify the protocol as ``<bf/busmouse/'' in the mouse -section of your -<tt/XF86Config/ file if you're using a PS/2 mouse. +XFree86 &relvers; has support for the mouse driver included in +the <bf/wscons/ console driver introduced by NetBSD 1.4. Specify +``<tt/wsmouse/'' as the protocol and ``<tt>/dev/wsmouse0</tt>'' as the +device in <tt>/etc/X11/XF86Config</tt> if you're using NetBSD 1.4 or later +with a PS/2 mouse. +<p> +For older releases, the NetBSD <bf/pms/ mouse driver handles PS/2 style +mice as Busmouse. Specify the protocol as ``<tt/busmouse/'' in the +mouse section of your <tt/XF86Config/ file if you're using a PS/2 +mouse with NetBSD 1.3 or former releases. <p> Only standard PS/2 mice are supported by this driver. Newest PS/2 mice that send more than three bytes at a time (especially -Intellimouse, or MouseMan+ with a ``3D'' roller) are not supported yet. -<p> -XFree86 &relvers; also has support for the mouse driver included in -the new <bf/wscons/ console driver introduced by NetBSD 1.4. Specify -``<tt/wsmouse/'' as the protocol and ``<tt>/dev/wsmouse0</tt>'' as the -device in <tt>/etc/XF86Config</tt> if you're using NetBSD 1.4 with -wscons. +Intellimouse, or MouseMan+ with a wheel) are not supported by NetBSD +1.3 and former releases. <p> See <htmlurl url="mouse.html" name="README.mouse"> for general instruction on mouse configuration in XFree86. @@ -190,8 +189,9 @@ xdm=YES xdm_flags="" # x11 display manager in <tt>/etc/rc.conf</tt>. <p> -Under NetBSD 1.4 with the wscons console driver, you must enable a -virtual console for the X server first. To do this follow these steps: +Under NetBSD 1.4 and later with the wscons console driver, you must +enable a virtual console for the X server first. To do this follow +these steps: <itemize> <item>Make sure the device file exists. If not, ``<tt>cd /dev ; ./MAKEDEV wscons</tt>''. @@ -210,8 +210,8 @@ screen 4 - - screen 5 - vt100 </verb></tscreen> </itemize> -(Thanks to Mason Loring Bliss <tt><mason@acheron.middleboro.ma.us></tt> for -this explanation) +(Thanks to Mason Loring Bliss +<tt><mason@acheron.middleboro.ma.us></tt> for this explanation) <p> Note that the binary distributions of XFree86 for NetBSD don't include support for the XDM-AUTHORIZATION-1 protocol. @@ -239,7 +239,7 @@ The pccons driver is the most widely tested and is the console driver contained in the NetBSD binary distribution's kernels. <p> -The pcvt console driver is bundled with NetBSD. The pcvt X +The pcvt console driver was bundled with NetBSD until 1.4. The pcvt X mode is compatible with the pccons driver X mode. It offers several virtual consoles and international keyboard support. In order to use this driver, change the line: @@ -258,9 +258,9 @@ in your kernel config file, and rebuild and install your kernel. <p> <label id="wscons"> -XFree86 will also run with the wscons console driver in -NetBSD 1.4. For now, it uses the pcvt compatibility mode, so be -sure to have the lines: +Wscons is the current console driver, included in NetBSD 1.4 and +later. For now, XFree86 supports wscons using the pcvt compatibility +mode, so be sure to have the lines: <tscreen><verb> options WSDISPLAY_COMPAT_PCVT # emulate some ioctls options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls @@ -344,11 +344,6 @@ extension. <sect> Rebuilding the XFree86 Distribution <p> -<!-- out of date -See <htmlurl url="INSTALL.html" name="INSTALL"> for instructions on -unbundling and building the source distribution. ---> - You should configure the distribution by editing <tt>xc/config/cf/host.def</tt> before compiling. To compile the sources, invoke ``<tt/make World/'' in the xc directory. @@ -403,6 +398,12 @@ by adding: </verb></tscreen> to <tt>xc/config/host.def</tt> before rebuilding the server. This has not been thoroughly tested, except on the macppc. +<p> +For the i386, you should include both pcvt and wscons support in order +to use the pcvt compatibility mode of wscons: +<tscreen><verb> + #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT +</verb></tscreen> <sect1>Building on other architectures<label id="sparc"> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml index 09a13a4cc..39db92490 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml @@ -6,10 +6,10 @@ <title>README for XFree86 &relvers; on OpenBSD <author> Matthieu Herrb -<Date>Last modified on: 2 December 2000 +<Date>Last modified on: 3 March 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.15 2000/12/12 18:54:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.17 2001/04/05 19:29:43 dawes Exp $ </ident> <toc> @@ -18,10 +18,9 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.15 2000/12/12 <sect>What and Where is XFree86? <p> -XFree86 is a port of X11R6.4 that supports several versions of -Intel-based Unix. It is derived from X386 1.2, which was the X server -distributed with X11R5. This release consists of many new features -and performance improvements as well as many bug fixes. +XFree86 is the Open Source port of X.Org's X11R6.4 release that supports +several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) +operating systems on Intel and other platforms. See the <htmlurl url="COPYRIGHT.html" name="Copyright Notice">. @@ -57,6 +56,13 @@ this file and we'll revise it. See the <htmlurl url="RELNOTES.html" name="Release Notes"> for non-OS dependent new features in XFree86 &relvers;. +<sect1>New OS dependent features in 4.0.3 +<p> +<itemize> +<item>Support for the wscons console driver in post 2.8 OpenBSD. +<item>A fix for multi-threaded libraries support. +</itemize> + <sect1>New OS dependent features in 4.0.2 <p> <itemize> @@ -115,7 +121,7 @@ for detailed installation instructions. <sect>Configuring X for Your Hardware <p> -The <tt>/etc/XF86Config</tt> file tells the X server what kind of +The <tt>/etc/X11/XF86Config</tt> file tells the X server what kind of monitor, video card and mouse you have. You <em/must/ create it to tell the server what specific hardware you have. @@ -126,13 +132,13 @@ You'll need info on your hardware: <item>The video card's chipset (e.g. ET4000, S3, etc). <item>Your monitor's sync frequencies. </itemize> -<!-- + The recommended way to generate an <tt/XF86Config/ file is to use the -<tt/XF86Setup/ utility. The xf86config text utility is still there -for the (few) cases where XF86Setup can't be used. Also, there is a +<tt/xf86cfg/ utility. The xf86config text utility is still there +for the (few) cases where xf86cfg can't be used. Also, there is a sample file installed as <tt>/usr/X11R6/lib/X11/XF86Config.eg</tt>, which can be used as a starting point. ---> + For details about the <tt/XF86Config/ file format, refer to the <em>XF86Config(5)</em> manual page. @@ -143,9 +149,11 @@ modes with the <tt>xvidtune</tt> utility. <sect1>About mouse configuration <p> -If your serial mouse does not work try using <tt>kermit</tt> or -<tt>tip</tt> to connect to the mouse serial port and verify that it -does indeed generate characters. +XFree86 &relvers; has support for the mouse driver included in +the new <bf/wscons/ console driver introduced by OpenBSD-current after +2.8. Specify ``<tt/wsmouse/'' as the protocol and +``<tt>/dev/wsmouse0</tt>'' as the device in <tt>/etc/X11/XF86Config</tt> +if you're using OpenBSD-current with a PS/2 mouse. <p> The OpenBSD pms driver provides both ``raw'' and ``cooked'' (translated) modes. ``raw'' mode does not do protocol translation, so @@ -213,9 +221,13 @@ console drivers: pcvt and pccons. They are detected at runtime and no configuration of the server itself is required. <p> -The pcvt console driver is the default in OpenBSD. It offers -several virtual consoles and international keyboard support. +The pcvt console driver is the default in OpenBSD up to OpenBSD 2.8. +It offers several virtual consoles and international keyboard support. +<p> +OpenBSD-current after 2.8 has switched to the wscons console +driver. This console driver has a pcvt compatibility mode for X +support. <sect1>Aperture Driver <p> @@ -271,6 +283,11 @@ diff -u -r1.14 mem.c return -1; </verb></tscreen> +<p>In post 2.8 OpenBSD-current, a modified version of this patch has +been integrated. You should set +<tscreen><verb>machdep.allowaperture=2</verb></tscreen> +in <tt>/etc/sysctl.conf</tt> in order to achieve this. See the xf86(4) +manual page for details. <p> Another (less recommended) way to enable linear memory and I/O ports access is to disable the kernel security feature by adding ``option @@ -314,11 +331,6 @@ changes to the <tt/xf86site.def/, type ``<tt>./mkmf</tt>'' and ``<tt/make/'' to link the server. See <tt>/usr/X11R6/lib/Server/README</tt> for more info. -<!-- out of date -See <htmlurl url="INSTALL.html" name="INSTALL"> for instructions on -unbundling and building the source distribution. ---> - You should configure the distribution by editing <tt>xc/config/cf/host.def</tt> before compiling. To compile the sources, invoke ``<tt/make World/'' in the xc directory. @@ -351,6 +363,11 @@ by adding: to <tt>xc/config/host.def</tt> before rebuilding the server. This has not been thoroughly tested, except on the macppc. +For the i386, you should include both pcvt and wscons support in order +to use the pcvt compatibility mode of wscons: +<tscreen><verb> + #define XFree86ConsoleDefines -DPCVT_SUPPORT -DWSCONS_SUPPORT +</verb></tscreen> <sect1>Building on other architectures<label id="otherarch"> @@ -360,7 +377,6 @@ XFree86 should also compiles on other OpenBSD architectures. However, please note that 3.9.x snapshots have only been tested on the i386 for now. -<!-- <p> Note that OpenBSD project has now its own source tree, based on the XFree86 source tree, with some local modifications. You may want @@ -368,7 +384,6 @@ to start with this tree to rebuild from sources. The OpenBSD X11 source tree is available by anoncvs from all OpenBSD anoncvs servers. See <htmlurl url="http://www.openbsd.org/anoncvs.html" name="http://www.openbsd.org/anoncvs.html"> for details on anoncvs. ---> <sect>Building New X Clients diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml index 5d54d012c..55b0f8198 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml @@ -15,7 +15,7 @@ <date>15 December 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.111 2001/02/09 04:15:35 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.113 2001/03/16 22:13:19 dawes Exp $ </ident> <abstract> @@ -80,6 +80,10 @@ is supported before upgrading to the 4.x series. Specific release enhancements can be viewed in the <htmlurl name="Release Notes" url="RELNOTES.html">. +The XFree86 version numbering system has had some changes as of the +4.0.2 release. Information about this can be found in the +<htmlurl name="Versions Document" url="Versions.html">. + Information about binary distributions and the attendant installation instructions can be found in the <htmlurl name="Installation Document" url="Install.html">. @@ -227,7 +231,6 @@ gzip -d < &prevrelvers;-&relvers;.diff.gz | patch -p0 -E Information about getting the source for &prevrelvers can be found in the README file for that version, which can be found on the <url name="XFree86 web site" url="http://www.xfree86.org/pub/XFree86/&prevrelvers;/README.html">. -. ]]> <![ %fullrel [ diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml index 517442e02..dbc5d5bd4 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml @@ -9,7 +9,7 @@ <date>17 December 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.59 2001/02/09 00:35:03 keithp Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.60 2001/03/02 17:40:48 dawes Exp $ </ident> <abstract> @@ -24,13 +24,20 @@ in XFree86 &relvers; and their status. <sect>Introduction to the 4.x Release Series <p> XFree86 4.0 was the first official release of the new XFree86 4 series. -The current release (&relvers;) is the latest in that series. XFree86 +<![ %updaterel [ +XFree86 &relvers; is the &whichupdaterel; update to &fullrelvers;, which +is the latest full release in that series. +]]> +<![ %fullrel [ +The current release (&relvers;) is the latest in that series. +]]> +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, but conversely, 4.x has some hardware support not present in 3.3.x. Our <htmlurl name="Driver Status document" url="Status.html"> summarizes how the hardware driver support compares between &legacyvers; and &relvers;. -Please check there first before downloading &relvers;. +Please check there first before downloading &relvers;. The 4.0.1 release introduced a new graphical configuration tool, "<tt>xf86cfg</tt>", and a text mode interface was added to it for the @@ -60,14 +67,27 @@ this release, please have a quick read through the <htmlurl name="Installation Document" url="Install.html">. It may save you some time and help you figure out which of the binary releases you need. +<![ %updaterel [ +The next sections describe what has changed in the update release(s) +as well as what is new in the latest full release (&fullrelvers;). +]]> +<![ %fullrel [ The next section describes what is new in the latest version (&relvers;). +]]> The other sections below describe some of the new features and changes between 3.3.x and 4.0. There are lot's of new features, and we definitely don't have enough space to cover them all here. </sect> -<sect>Summary of new features in &relvers;. +<![ %updaterel [ +<sect>Summary of updates in &relvers;. +<p> + +</sect> +]]> + +<sect>Summary of new features in &fullrelvers;. <p> <sect1>X server <p> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml index c817f134a..61b42d3c2 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml @@ -9,7 +9,7 @@ <date>4 December 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.26 2000/12/14 22:15:48 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.29 2001/04/04 01:34:18 dawes Exp $ </ident> <abstract> @@ -17,7 +17,8 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.26 2000/12/14 This document provides information about the status of the driver and hardware support in XFree86 &relvers; compared with that in XFree86 &legacyvers;. Please send updates for this document to -<email>fixes@xfree86.org</email> +<email>fixes@xfree86.org</email>. Please do not send requests for +information or support to that address. </abstract> @@ -29,7 +30,10 @@ This document contains one section per vendor (organised alphabetically) for each chipset family that is supported in XFree86 &legacyvers; or XFree86 &relvers;. It includes information about the status of the drivers and the hardware they support, including a comparison of the -level of support between versions &legacyvers; and &relvers;. +level of support between versions &legacyvers; and &relvers;. Unless +otherwise stated, hardware is classified as "supported" if its driver +provides basic 2D support. Support for additional features may or may +not be present. In XFree86 &legacyvers;, several X servers are available; much hardware uses the XF86_SVGA server, which has a set of driver modules that are built @@ -363,15 +367,17 @@ other architectures known to work on (e.g., Alpha, PPC), etc. Linux, and requires the agpgart.o kernel module in order to use modes that require more than 1MB of video memory. -<tag>&relvers;:</tag> - Support (accelerated) for the Intel i740 is provided by the - "i740" driver, and support for the Intel i810 is provided by - the "i810" driver. The "i810" driver is currently Linux-only, - and requires the agpgart.o kernel module. +<tag>&relvers;:</tag> Support (accelerated) for the Intel i740 is + provided by the "i740" driver, and support for the Intel i810 + (including i810-dc100 and i810e) and i815 is provided by the + "i810" driver. The "i810" driver is currently supported only on + Linux and FreeBSD (4.1 and later), and requires the agpgart + kernel support. <tag>Summary:</tag> - The i740 and i810 are supported in both versions, but the i810 is - only supported on Linux/x86 platforms at present. + The i740 and i810 are supported in both versions, but the i810 + is only supported on Linux/x86 and recent FreeBSD/i386 platforms + at present. </descrip> @@ -614,7 +620,7 @@ other architectures known to work on (e.g., Alpha, PPC), etc. there are some problems with it in this version. <tag>Summary:</tag> - Support for the 86C201, 86C202, 86C215, 86C225, 5597 and 5598 + Support for the 86C201, 86C202, 86C205, 86C215, 86C225, 5597 and 5598 is currently only available in &legacyvers;. </descrip> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml index 75f69a29e..44b2e0364 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml @@ -8,14 +8,14 @@ <title>ATI Adapters README file <author>Marc Aurele La France -<date>2000 December 6 +<date>2001 March 24 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.35 2001/01/06 20:58:03 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.36 2001/03/25 05:32:07 tsi Exp $ </ident> <abstract> @@ -208,7 +208,7 @@ operate as if ``<it>ativga</it>'' had been specified instead.<p> A ChipSet name of ``<it>vgawonder</it>'' is equivalent to ``<it>ativga</it>'', except that only VGAWonder-capable adapters can be assigned to the ``Device'' section. -This specifically excludes newer Mach64's with integrated controllers.<p> +This specifically excludes the newer integrated Mach64 controllers.<p> In some PCI or AGP systems, the driver will not, by default, probe for non-PCI Mach32's or Mach64's. This is because, before doing any such probe, the driver attempts to determine @@ -394,7 +394,17 @@ By default, the driver will enable a linear video memory aperture for 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> +option is ignored.<p> +<sect1>Option <it>``HWCursor''</it> and Option <it>``SWCursor''</it><p> +Option <it>``HWCursor''</it>, which is the default, specifies that hardware +facilities are to be used to paint the mouse pointer on the screen. +Option <it>``SWCursor''</it> specifies that the mouse pointer is to by drawn by +software, which is much slower. +If both options are specified, option <it>``SWCursor''</it> prevails. +Currently, these options are only acted upon for 256-colour or higher depth +modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is being +used. +In all other situations, a software cursor will be used.<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 diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml new file mode 100644 index 000000000..b691d7652 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml @@ -0,0 +1,192 @@ +<!doctype LINUXDOC PUBLIC "-//XFree86//DTD linuxdoc//EN" [ +<!ENTITY % defs SYSTEM "defs.ent"> %defs; +]> + +<article> + +<title>XFree86 and DPS +<author>Juliusz Chroboczek, <email/jch@xfree86.org/ +<date>27 February 2001</date> + +<ident>$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.1 2001/03/02 02:45:37 dawes Exp $</ident> + +<toc> + +<sect>Introduction + +<p>Display Postscript (or DPS for short) is a rendering extension for +X11. DPS is slightly atypical in that it is based on <it/code +mobility/, the ability to send executable code from client to server. +Thus, a DPS client does not request that a line should be rendered; +instead, it uploads code to the server which, when executed, causes a +line to be drawn. + +<p>This document does not aim at teaching programming with DPS; it is +only a summary description of the DPS support code included with +XFree86. More information about DPS, including a DPS bibliography, is +available from +<url url="http://dps.sourceforge.net" name="the DPS extension site">. + +<tscreen> +<it>Note: Adobe, PostScript and Display PostScript are trademarks of +Adobe Systems Incorporated which may be registered in certain +jurisdictions.</it> +</tscreen> + +As all X11 extensions, DPS consists of client-side and server-side +components. The DPS client side consists of a number of libraries and +a number of tools for programming and configuration. The DPS server +side may consist either of an X server extension, or of a client-side +process known as the ``DPS agent.'' In this latter case, the term +``server-side'' is somewhat misleading. + +At the time of writing, only the client side is included with XFree86; +the server side must be obtained separately. Please see <ref +id="sec:server-side" name="server side"> later in this document for +more information. + +<sect>The DPS client side + +<p>The DPS client side consists of four libraries and a number of +basic tools for programming and configuration; these are all included +with XFree86. + +<sect1>Libraries + +<p>The <tt/libpsres/ library is a library for management of +<it/PostScript resources/, on-disk files representing PostScript data +structures such as fonts, font encodings, procsets, <it/etc./ It is +closely related to the <tt/makepsres/ tool (see <ref id="sec:tools" +name="client-side tools"> later in this document). + +The basic DPS client library is <tt/libdps/. This library contains a +number of functions for connection establishment, resource management, +as well as stubs for all standard PostScript operators. Normally, all +DPS clients should link with <tt/libdps/; in addition, <tt/libdps/ may +be used for printing by non-DPS clients (this is done, for example, by +Sun's JDK). This library is documented in [CLRM] and [CLSX]. + +The <tt/libdpstk/ library contains a number of additional utilities +for managing DPS contexts, user paths and user objects, and for +previewing EPS files. It is documented in [DPTX]. + +The <tt/libdpstkXm/ library contains four Motif widgets. The <it/DPS +Scrolling Widget/ is a DPS drawing area that automatically manages +issues such as scrolling, scaling, client-side backing store, +incremental redisplay, <it/etc./ The <it/Font Selection Box/, and its +associated <it/Font Preview/, present a convenient and powerful +interface for choosing scalable fonts. Finally, the <it/Color Picker/ +presents an interface for choosing colours using either of the RGB or +HSV spaces. The latter three widgets are documented in [DPTX]; some +summary Scrolling Widget documentation is available in the <tt/doc/ +subdirectory of the <tt/DPS.tar.gz/ file, available from <url +url="ftp://dps.sourceforge.net/pub/dps/DPS.tar.gz">. + +The source code for <tt/libdpstkXm/ is included with XFree86; however, +as it depends on Motif, this library is not built by default. +A GTK-based library providing some of the functionality of +<tt/libdpstkXm/ is available from +<url url="http://www.gyve.org/gtkDPS/" + name="the gtkDPS site">. + +<sect2>Libdps and Xt + +<p>In X11R5, <tt/libdps/ did not depend on <tt/libXt/. In X11R6, +however, code was added to make the Xt main loop dispatch to sundry +code on DPS events; with this addition, all programs that link with +<tt/libdps/ need to link with <tt/libXt/, whether they use Xt or not. + +This state of affairs is unfortunately true of the version of +<tt/libdps/ included with XFree86. We are currently considering +various solutions to this problem (including the use of weak linker +symbols or splitting off the guilty functions into a separate +library). + +<sect1>Client-side tools <label id="sec:tools"> + +<p>In addition to the libraries, the client side of DPS consists of two +utilities. + +The <tt/makepsres/ utility is used for managing PostScript resources. +Its basic operation consists in walking recursively a filesystem tree, +noting all resources, and then writing out a ``Unix PostScript +Resources,'' file, basically a directory of all the resources found. +This utility is documented in the makepsres(1) manual page. + +The <tt/pswrap/ utility is a stub generator for PostScript clients. +Roughly speaking, it takes as its input textual PostScript code, and +generates a collection of C functions that transmit that code in +pre-tokenised form to the DPS extension. <tt/Pswrap/ is documented in +[PSWRAP]. + +<sect1>Sample clients + +<p>XFree86 contains three sample DPS clients, <tt/dpsinfo/, +<tt/dpsexec/ and <tt/texteroids/. They are documented in their +respective manual pages. + +A number of sample clients that depend on Motif are available in <url +url="ftp://dps.sourceforge.net/pub/ftp/DPS.tar.gz">. Additional +sample clients can be found as part of GtkDPS (see above). + +The GNUstep environment can be compiled to use DPS for +all rendering; for more information, please see +<url url="http://www.gnustep.org" name="the GNUstep site">. + +<sect>The DPS server side <label id="sec:server-side"> + +<p>In order to use DPS clients, you need to install a DPS server side, +which can be either a server extension (a ``DPS/X extension''), or a +separate process (referred to, variously, either as a ``DPS/NX agent'' +or, rather confusingly, as ``Client-Side DPS'' (CSDPS). + +<sect1>Display Ghostscript + +<p>Display Ghostscript (note the capitalisation), or DGS, is a +client-side implementation of DPS based on the Ghostscript +PostScript interpreter. DGS is still in beta at the time of writing; +it does, however, provide a very usable implementation of DPS, +although it still has some problems with the semantics of multiple DPS +contexts. + +DGS is available from +<url url="http://www.gnustep.org/resources/sources.html" + name="the GNUstep download area">. + +<sect1>The DPS extension + +<p>The DPS extension is a much younger project aiming at producing an +efficient server-side implementation of DPS. The extension is +currently in a state best described as alpha; current versions are +known to crash the X server under some circumstances. + +The DPS extension is available from +<url url="http://dps.sourceforge.net" name="the DPS extension site">. + +<sect>References + +<p>Links to electronic versions of all of these, and more, are +available from <url url="http://dps.sourceforge.net" name="the DPS +extension site">. + +[PLRM2] PostScript language reference manual. Adobe Systems, 2nd ed. Addison-Wesley, 1990. ISBN 0-201-18127-4. + +[PLRM] PostScript language reference. Adobe Systems Incorporated, 3rd +ed. Addison-Wesley, 1999. ISBN 0-201-37922-8. + +[INTRO] Display PostScript System. Introduction: Perspective for +Software Developers. 15 April 1993. + +[CLRM] Display PostScript System. Client Library Reference Manual. 15 +April 1993. + +[CLSX] Display PostScript System. Client Library Supplement for X. 15 +April 1993. + +[DPTX] Display PostScript System. Display PostScript Toolkit for X. 15 +April 1993. + +[PSWRAP] Display PostScript System. pswrap Reference Manual. 15 April +1993. + +</article> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml index 612824db8..ba2976e23 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml @@ -6,10 +6,10 @@ <title>Fonts in XFree86 <author>Juliusz Chroboczek, <email/jch@xfree86.org/ -<date>21 January 2000</date> +<date>21 January 2001</date> <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.12 2001/02/13 19:19:15 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.13 2001/03/01 00:37:09 dawes Exp $ </ident> <toc> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml index ef8c09536..575989f65 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml @@ -7,7 +7,7 @@ <author>Precision Insight, Inc. <date>3 March 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00:00:30 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.3 2001/04/04 01:34:18 dawes Exp $ </ident> <toc> @@ -19,6 +19,7 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00: <item>i810, <item>i810-dc100, <item>i810e + <item>i815 </itemize> </itemize> @@ -43,16 +44,17 @@ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00: in 32 bit per pixel format, and this mode is not supported by this driver. <item>Interlace modes cannot be supported. - <item>This driver currently only works for Linux/ix86, and normal use - requires the agpgart.o kernel module, included in Linux kernels - 2.3.42 and higher. + <item>This driver currently only works for Linux/ix86 and recent versions + of FreeBSD. It requires the agpgart kernel support, which is + included in Linux kernels 2.3.42 and higher, and FreeBSD 4.1 + and higher. </itemize> <sect>Reported Working Video Cards <p> <itemize> - <item>Intel evaluation hardware - i810, i810-dc100 and i810e. + <item>Intel evaluation hardware - i810, i810-dc100, i810e and i815. <item>Tyan Tomcat Motherboard. <item>HappyPC set-top box. </itemize> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/Imakefile index 0e68e1e9f..c8f4b799f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.20 2000/11/28 20:59:17 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.21 2001/04/05 19:29:43 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -15,7 +15,7 @@ OBJS = apm/?*_drv.o ati/?*_drv.o chips/?*_drv.o cirrus/?*_drv.o \ i810/?*_drv.o imstt/?*_drv.o mga/?*_drv.o neomagic/?*_drv.o \ nv/?*_drv.o rendition/?*_drv.o s3virge/?*_drv.o sis/?*_drv.o \ tdfx/?*_drv.o tga/?*_drv.o trident/?*_drv.o tseng/?*_drv.o \ - vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o + vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o vmware/?*_drv.o #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile index 236e025cc..756445cd1 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.28 2001/01/24 00:06:15 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.29 2001/03/25 05:32:07 tsi Exp $ XCOMM XCOMM Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org XCOMM @@ -107,9 +107,10 @@ DEFINES = $(CPIODEFINES) $(DRIDEFINES) SRCS1 = ati.c atiadapter.c atibus.c atichip.c atiident.c atioption.c \ atiprobe.c atividmem.c $(MODSRCS1) $(CPIOSRCS1) \ radeon_probe.c r128_probe.c -SRCS2 = atiadjust.c aticlock.c aticonfig.c aticonsole.c atidac.c atidga.c \ - atidsp.c atilock.c atimach64.c atimach64io.c atimode.c atipreinit.c \ - atiprint.c atiscreen.c atiutil.c ativalid.c $(MODSRCS2) $(CPIOSRCS2) +SRCS2 = atiaccel.c atiadjust.c aticlock.c aticonfig.c aticonsole.c \ + aticursor.c atidac.c atidga.c atidsp.c atilock.c atimach64.c \ + atimach64io.c atimode.c atipreinit.c atiprint.c atiscreen.c atiutil.c \ + ativalid.c $(MODSRCS2) $(CPIOSRCS2) SRCS3 = r128_accel.c r128_cursor.c r128_dga.c r128_driver.c r128_video.c \ $(MODSRCS3) $(DRISRCS3) SRCS4 = radeon_accel.c radeon_cursor.c radeon_dga.c radeon_driver.c \ @@ -118,9 +119,10 @@ SRCS4 = radeon_accel.c radeon_cursor.c radeon_dga.c radeon_driver.c \ OBJS1 = ati.o atiadapter.o atibus.o atichip.o atiident.o atioption.o \ atiprobe.o atividmem.o $(MODOBJS1) $(CPIOOBJS1) \ radeon_probe.o r128_probe.o -OBJS2 = atiadjust.o aticlock.o aticonfig.o aticonsole.o atidac.o atidga.o \ - atidsp.o atilock.o atimach64.o atimach64io.o atimode.o atipreinit.o \ - atiprint.o atiscreen.o atiutil.o ativalid.o $(MODOBJS2) $(CPIOOBJS2) +OBJS2 = atiaccel.o atiadjust.o aticlock.o aticonfig.o aticonsole.o \ + aticursor.o atidac.o atidga.o atidsp.o atilock.o atimach64.o \ + atimach64io.o atimode.o atipreinit.o atiprint.o atiscreen.o atiutil.o \ + ativalid.o $(MODOBJS2) $(CPIOOBJS2) OBJS3 = r128_accel.o r128_cursor.o r128_dga.o r128_driver.o r128_video.o \ $(MODOBJS3) $(DRIOBJS3) OBJS4 = radeon_accel.o radeon_cursor.o radeon_dga.o radeon_driver.o \ @@ -173,6 +175,8 @@ InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(ati.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(ati.cpp,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(ati.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atiaccel.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atiaccel.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiadapter.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiadapter.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiadjust.c,$(DRIVERSDKDIR)/drivers/ati) @@ -192,6 +196,8 @@ InstallDriverSDKNonExecFile(aticonfig.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(aticonsole.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(aticonsole.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(aticrtc.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(aticursor.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(aticursor.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atidac.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atidac.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atidga.c,$(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 6d5e41321..ea431b85c 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.15 2001/01/06 20:58:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.16 2001/03/25 05:32:07 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -66,6 +66,7 @@ * David S. Miller, davem@redhat.com * A E Lawrence, adrian.lawrence@computing-services.oxford.ac.uk * Linus Torvalds, torvalds@transmeta.com + * William Blew <wblew@home.com> * * ... and, many, many others from around the world. * diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c new file mode 100644 index 000000000..dcac2d8cf --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c @@ -0,0 +1,79 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.4 2001/04/04 00:19:04 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * 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 "atiaccel.h" +#include "atiadapter.h" +#include "atimach64.h" +#include "atistruct.h" + +/* + * ATIInitializeAcceleration -- + * + * This function is called to initialise XAA on a screen. + */ +Bool +ATIInitializeAcceleration +( + ScrnInfoPtr pScreenInfo, + ScreenPtr pScreen, + ATIPtr pATI +) +{ + BoxRec ScreenArea; + unsigned int scanlines; + + if (!pATI->OptionAccel) + return TRUE; + + if (!(pATI->pXAAInfo = XAACreateInfoRec())) + return FALSE; + + switch (pATI->Adapter) + { + case ATI_ADAPTER_MACH64: + if (ATIMach64AccelInit(pATI, pATI->pXAAInfo)) + break; + /* Fall through */ + + default: + XAADestroyInfoRec(pATI->pXAAInfo); + pATI->pXAAInfo = NULL; + return FALSE; + } + + ScreenArea.x1 = ScreenArea.y1 = 0; + ScreenArea.x2 = pATI->displayWidth; + scanlines = pScreenInfo->videoRam * 1024 * 8 / pATI->displayWidth / + pATI->bitsPerPixel; + if (scanlines > ATIMach64MaxY) + scanlines = ATIMach64MaxY; + ScreenArea.y2 = (short int)scanlines; + xf86InitFBManager(pScreen, &ScreenArea); + + if (XAAInit(pScreen, pATI->pXAAInfo)) + return TRUE; + + XAADestroyInfoRec(pATI->pXAAInfo); + pATI->pXAAInfo = NULL; + return FALSE; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h new file mode 100644 index 000000000..d7d730313 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h @@ -0,0 +1,36 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h,v 1.1 2001/03/25 05:33:06 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * 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 ___ATIMODE_H___ +#define ___ATIMODE_H___ 1 + +#include "atipriv.h" +#include "atiproto.h" + +#include "xf86str.h" + +extern Bool ATIInitializeAcceleration FunctionPrototype((ScrnInfoPtr, + ScreenPtr, + ATIPtr)); + +#endif /* ___ATIACCEL_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c index 4199fab09..906e7e4ba 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.17 2001/01/21 21:19:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.18 2001/03/25 05:32:07 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -582,6 +582,7 @@ ATIChipID case OldChipID('Q', 'E'): case NewChipID('Q', 'E'): case OldChipID('Q', 'F'): case NewChipID('Q', 'F'): case OldChipID('Q', 'G'): case NewChipID('Q', 'G'): + case OldChipID('Q', 'Y'): case NewChipID('Q', 'Y'): return ATI_CHIP_RADEON; case OldChipID('H', 'D'): case NewChipID('H', 'D'): diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c index 90a86a027..b1ac91ccb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.3 2001/02/15 18:04:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.5 2001/03/25 05:32:07 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -24,11 +24,12 @@ #include "ati.h" #include "atiadapter.h" #include "aticonfig.h" +#include "aticursor.h" #include "atioption.h" #include "atistruct.h" /* - * Recognised XF86Config options. + * Non-publicised XF86Config options. */ typedef enum { @@ -81,10 +82,18 @@ ATIProcessOptions # define CRTScreen PublicOption[ATI_OPTION_CRT].value.bool # define CSync PublicOption[ATI_OPTION_CSYNC].value.bool # define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool +# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool + +#ifndef AVOID_CPIO + # define Linear PublicOption[ATI_OPTION_LINEAR].value.bool + +#endif /* AVOID_CPIO */ + # define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool # define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool # define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool +# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool # define Sync PrivateOption[ATI_OPTION_SYNC].value.bool # define ReferenceClock \ @@ -102,7 +111,14 @@ ATIProcessOptions #endif /* AVOID_CPIO */ { - Accel = Linear = CacheMMIO = TRUE; + Accel = CacheMMIO = HWCursor = TRUE; + +#ifndef AVOID_CPIO + + Linear = TRUE; + +#endif /* AVOID_CPIO */ + } ReferenceClock = ((double)157500000.0) / ((double)11.0); @@ -124,6 +140,8 @@ ATIProcessOptions xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, PrivateOption); +#ifndef AVOID_CPIO + /* Disable linear apertures if the OS doesn't support them */ if (!xf86LinearVidMem() && Linear) { @@ -133,39 +151,60 @@ ATIProcessOptions Linear = FALSE; } +#endif /* AVOID_CPIO */ + /* Move option values into driver private structure */ pATI->OptionAccel = Accel; pATI->OptionCRT = CRTScreen; pATI->OptionCSync = CSync; pATI->OptionDevel = Devel; + +#ifndef AVOID_CPIO + pATI->OptionLinear = Linear; + +#endif /* AVOID_CPIO */ + pATI->OptionMMIOCache = CacheMMIO; 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) { - xfree(PublicOption); - return; + /* Validate and set cursor options */ + if (SWCursor || !HWCursor) + { + pATI->Cursor = ATI_CURSOR_SOFTWARE; + if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Option \"sw_cursor\" overrides Option \"hw_cursor\".\n"); + } + else + { + pATI->Cursor = ATI_CURSOR_HARDWARE; } - switch ((int)(ReferenceClock / ((double)100000.0))) + + /* Only set the reference clock if it hasn't already been determined */ + if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator) { - 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; + 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; + } } + xfree(PublicOption); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c new file mode 100644 index 000000000..49ee8e8c1 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c @@ -0,0 +1,75 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c,v 1.1 2001/03/25 05:33:06 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * 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 "atiadapter.h" +#include "aticursor.h" +#include "atimach64.h" +#include "atistruct.h" + +#include "xf86.h" + +/* + * ATIInitializeCursor -- + * + * This function initialises the screen cursor. + */ +Bool +ATIInitializeCursor +( + ScreenPtr pScreen, + ATIPtr pATI +) +{ + /* Initialise software cursor */ + if (!miDCInitialize(pScreen, xf86GetPointerScreenFuncs())) + return FALSE; + + if (pATI->Cursor == ATI_CURSOR_SOFTWARE) + return TRUE; + + if (!(pATI->pCursorInfo = xf86CreateCursorInfoRec())) + return FALSE; + + switch (pATI->Adapter) + { + case ATI_ADAPTER_MACH64: + if (ATIMach64CursorInit(pATI->pCursorInfo)) + break; + /* Fall through */ + + default: + xf86DestroyCursorInfoRec(pATI->pCursorInfo); + pATI->pCursorInfo = NULL; + return FALSE; + } + + if (xf86InitCursor(pScreen, pATI->pCursorInfo)) + { + xf86SetSilkenMouse(pScreen); + return TRUE; + } + + xf86DestroyCursorInfoRec(pATI->pCursorInfo); + pATI->pCursorInfo = NULL; + return FALSE; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h new file mode 100644 index 000000000..86f1878c5 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h @@ -0,0 +1,44 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h,v 1.1 2001/03/25 05:33:06 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * 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 ___ATICURSOR_H___ +#define ___ATICURSOR_H___ 1 + +#include "atipriv.h" +#include "atiproto.h" + +#include "screenint.h" + +/* + * Cursor related definitions. + */ +typedef enum +{ + ATI_CURSOR_SOFTWARE, /* Software cursor */ + ATI_CURSOR_HARDWARE, /* Hardware cursor provided by CRTC */ + ATI_CURSOR_DAC /* Hardware cursor provided by RAMDAC */ +} ATICursorType; + +extern Bool ATIInitializeCursor FunctionPrototype((ScreenPtr, ATIPtr)); + +#endif /* ___ATICURSOR_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c index 52073a601..a79edfa98 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.5 2001/01/21 21:19:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.6 2001/03/25 05:32:07 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -24,6 +24,7 @@ #ifdef XFree86LOADER #include "ati.h" +#include "aticursor.h" #include "atiload.h" #include "atistruct.h" @@ -79,6 +80,9 @@ ATILoadModules "XAACreateInfoRec", "XAADestroyInfoRec", "XAAInit", + "xf86InitCursor", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", NULL); /* Load shadow frame buffer code if needed */ @@ -96,6 +100,19 @@ ATILoadModules xf86LoaderReqSymbols("XAACreateInfoRec", "XAADestroyInfoRec", NULL); } + /* Load ramdac module if needed */ + if (pATI->Cursor > ATI_CURSOR_SOFTWARE) + { + if (!ATILoadModule(pScreenInfo, "ramdac", "xf86InitCursor")) + return FALSE; + + /* Require more ramdac symbols */ + xf86LoaderReqSymbols( + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + NULL); + } + /* Load depth-specific entry points */ switch (pATI->bitsPerPixel) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c index b03ba1fd7..9cc5575a8 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.9 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.10 2001/03/25 05:32:07 tsi Exp $ */ /* * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -133,6 +133,11 @@ ATIUnlock ~(LCD_MONDET_INT_EN | LCD_MONDET_INT)); } + pATI->LockData.mem_cntl = inr(MEM_CNTL); + if (pATI->Chip < ATI_CHIP_264CT) + outr(MEM_CNTL, pATI->LockData.mem_cntl & + ~(CTL_MEM_BNDRY | CTL_MEM_BNDRY_EN)); + #ifndef AVOID_CPIO /* Ensure VGA aperture is enabled */ @@ -140,22 +145,8 @@ ATIUnlock 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) - 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) @@ -346,10 +337,10 @@ ATIUnlock out8(LCD_INDEX, GetByte(pATI->LockData.lcd_index, 0)); } } - } #endif /* AVOID_CPIO */ + } } /* @@ -508,7 +499,8 @@ ATILock #endif /* AVOID_CPIO */ - outr(MEM_CNTL, pATI->LockData.mem_cntl); + if (pATI->Chip < ATI_CHIP_264CT) + 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 68033eac8..e822d522c 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.29 2001/01/12 20:44:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.30 2001/03/25 05:32:07 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -47,6 +47,7 @@ #include "ati.h" #include "atibus.h" #include "atichip.h" +#include "aticrtc.h" #include "atimach64.h" #include "atimach64io.h" @@ -116,8 +117,14 @@ ATIMach64PreInit pATIHW->bus_cntl &= ~(BUS_FIFO_ERR_INT_EN | BUS_ROM_DIS); pATIHW->bus_cntl |= SetBits(15, BUS_FIFO_WS) | BUS_FIFO_ERR_INT; } + else if (pATI->MMIOInLinear) + { + pATIHW->bus_cntl &= ~BUS_APER_REG_DIS; + } else + { pATIHW->bus_cntl |= BUS_APER_REG_DIS; + } if (pATI->Chip >= ATI_CHIP_264VT) pATIHW->bus_cntl |= BUS_EXT_REG_EN; /* Enable Block 1 */ @@ -142,6 +149,8 @@ ATIMach64PreInit if ((pATI->depth > 8) || (pScreenInfo->rgbBits == 8)) pATIHW->dac_cntl |= DAC_8BIT_EN; + pATIHW->gen_test_cntl = pATI->LockData.gen_test_cntl & ~GEN_CUR_EN; + pATIHW->config_cntl = config_cntl = inr(CONFIG_CNTL); #ifndef AVOID_CPIO @@ -167,6 +176,31 @@ ATIMach64PreInit pATIHW->config_cntl |= SetBits(2, CFG_MEM_AP_SIZE); } + if (pATI->Chip >= ATI_CHIP_264VTB) + { + pATIHW->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); + + switch (pATI->bitsPerPixel) + { + default: + pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_BYTE_ENDIAN, + CTL_MEM_UPPER_APER_ENDIAN); + break; + + case 16: + pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_WORD_ENDIAN, + CTL_MEM_UPPER_APER_ENDIAN); + break; + + case 32: + pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_LONG_ENDIAN, + CTL_MEM_UPPER_APER_ENDIAN); + break; + } + } + /* Draw engine setup */ if (pATI->OptionAccel) { @@ -296,6 +330,12 @@ ATIMach64Save pATIHW->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT); pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM); + pATIHW->cur_clr0 = inr(CUR_CLR0); + pATIHW->cur_clr1 = inr(CUR_CLR1); + pATIHW->cur_offset = inr(CUR_OFFSET); + pATIHW->cur_horz_vert_posn = inr(CUR_HORZ_VERT_POSN); + pATIHW->cur_horz_vert_off = inr(CUR_HORZ_VERT_OFF); + pATIHW->clock_cntl = inr(CLOCK_CNTL); pATIHW->bus_cntl = inr(BUS_CNTL); @@ -307,6 +347,11 @@ ATIMach64Save pATIHW->config_cntl = inr(CONFIG_CNTL); + pATIHW->gen_test_cntl = inr(GEN_TEST_CNTL); + + if (pATI->Chip >= ATI_CHIP_264VTB) + pATIHW->mem_cntl = inr(MEM_CNTL); + /* Save draw engine state */ if (pATI->OptionAccel && (pATIHW == &pATI->OldHW)) { @@ -587,14 +632,25 @@ ATIMach64Set outr(CRTC_OFF_PITCH, pATIHW->crtc_off_pitch); - /* Set pixel clock */ - outr(CLOCK_CNTL, pATIHW->clock_cntl | CLOCK_STROBE); - /* Load overscan registers */ 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); + /* Load hardware cursor registers */ + outr(CUR_CLR0, pATIHW->cur_clr0); + outr(CUR_CLR1, pATIHW->cur_clr1); + outr(CUR_OFFSET, pATIHW->cur_offset); + outr(CUR_HORZ_VERT_POSN, pATIHW->cur_horz_vert_posn); + outr(CUR_HORZ_VERT_OFF, pATIHW->cur_horz_vert_off); + + /* Set pixel clock */ + outr(CLOCK_CNTL, pATIHW->clock_cntl | CLOCK_STROBE); + + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | GEN_GUI_EN); + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl); + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | GEN_GUI_EN); + /* Finalise CRTC setup and turn on the screen */ outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl); @@ -733,6 +789,9 @@ ATIMach64Set outr(CONFIG_CNTL, pATIHW->config_cntl); outr(BUS_CNTL, pATIHW->bus_cntl); + + if (pATI->Chip >= ATI_CHIP_264VTB) + outr(MEM_CNTL, pATIHW->mem_cntl); } /* @@ -1091,23 +1150,11 @@ ATIMach64SetupForScreenToScreenCopy { ATIPtr pATI = ATIPTR(pScreenInfo); - pATI->dst_cntl = 0; - - if (ydir > 0) - pATI->dst_cntl |= DST_Y_DIR; - if (xdir > 0) - pATI->dst_cntl |= DST_X_DIR; - - if (pATI->XModifier == 1) - outf(DST_CNTL, pATI->dst_cntl); - else - pATI->dst_cntl |= DST_24_ROT_EN; - 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)); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); if (TransparencyColour == -1) outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); @@ -1117,6 +1164,18 @@ ATIMach64SetupForScreenToScreenCopy outf(CLR_CMP_CLR, TransparencyColour); outf(CLR_CMP_CNTL, CLR_CMP_FN_EQUAL | CLR_CMP_SRC_2D); } + + pATI->dst_cntl = 0; + + if (ydir > 0) + pATI->dst_cntl |= DST_Y_DIR; + if (xdir > 0) + pATI->dst_cntl |= DST_X_DIR; + + if (pATI->XModifier == 1) + outf(DST_CNTL, pATI->dst_cntl); + else + pATI->dst_cntl |= DST_24_ROT_EN; } /* @@ -1183,17 +1242,17 @@ ATIMach64SetupForSolidFill { ATIPtr pATI = ATIPTR(pScreenInfo); - if (pATI->XModifier == 1) - outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); - ATIMach64WaitForFIFO(pATI, 5); - 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)); outf(DP_FRGD_CLR, colour); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + if (pATI->XModifier == 1) + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); } /* @@ -1248,11 +1307,11 @@ ATIMach64SetupForSolidLine ATIPtr pATI = ATIPTR(pScreenInfo); ATIMach64WaitForFIFO(pATI, 5); - 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)); outf(DP_FRGD_CLR, colour); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); @@ -1428,8 +1487,11 @@ ATIMach64SetupForScanlineCPUToScreenColorExpandFill { ATIPtr pATI = ATIPTR(pScreenInfo); - if (pATI->XModifier == 1) - outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); + 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)); + outf(DP_FRGD_CLR, fg); if (bg == -1) outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | @@ -1437,18 +1499,15 @@ ATIMach64SetupForScanlineCPUToScreenColorExpandFill else { ATIMach64WaitForFIFO(pATI, 2); + outf(DP_BKGD_CLR, bg); outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | SetBits(ATIMach64ALU[rop], DP_BKGD_MIX)); - outf(DP_BKGD_CLR, bg); } - ATIMach64WaitForFIFO(pATI, 4); - outf(DP_WRITE_MASK, planemask); - outf(DP_SRC, DP_MONO_SRC_HOST | - SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); - outf(DP_FRGD_CLR, fg); - outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + if (pATI->XModifier == 1) + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); } /* @@ -1505,12 +1564,13 @@ ATIMach64SubsequentColorExpandScanline int iBuffer ) { - ATIPtr pATI = ATIPTR(pScreenInfo); - CARD32 *pBitmapData = pATI->ExpansionBitmapScanlinePtr[iBuffer]; - CARD32 *pDst, *pSrc; - int w = pATI->ExpansionBitmapWidth; - int nDWord; - unsigned int iDWord; + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 *pBitmapData = pATI->ExpansionBitmapScanlinePtr[iBuffer]; + volatile CARD32 *pDst; + CARD32 *pSrc; + int w = pATI->ExpansionBitmapWidth; + int nDWord; + unsigned int iDWord; while (w > 0) { @@ -1531,7 +1591,7 @@ ATIMach64SubsequentColorExpandScanline * only be guaranteed to be on a chunk-sized boundary. */ iDWord = 16 - nDWord; - pDst = (CARD32 *)pATI->pHOST_DATA - iDWord; + pDst = (volatile CARD32 *)pATI->pHOST_DATA - iDWord; pSrc = pBitmapData - iDWord; /* @@ -1658,3 +1718,348 @@ ATIMach64AccelInit return TRUE; } + +/* + * ATIMach64SetCursorColours -- + * + * Set hardware cursor foreground and background colours. + */ +static void +ATIMach64SetCursorColours +( + ScrnInfoPtr pScreenInfo, + int fg, + int bg +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + + outr(CUR_CLR0, SetBits(fg, CUR_CLR)); + outr(CUR_CLR1, SetBits(bg, CUR_CLR)); +} + +/* + * ATIMach64SetCursorPosition -- + * + * Set position of hardware cursor. + */ +static void +ATIMach64SetCursorPosition +( + ScrnInfoPtr pScreenInfo, + int x, + int y +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD16 CursorXOffset, CursorYOffset; + + /* Adjust x & y when the cursor is partially obscured */ + if (x < 0) + { + if ((CursorXOffset = -x) > 63) + CursorXOffset = 63; + x = 0; + } + else + { + CursorXOffset = pScreenInfo->frameX1 - pScreenInfo->frameX0; + if (x > CursorXOffset) + x = CursorXOffset; + CursorXOffset = 0; + } + + if (y < 0) + { + if ((CursorYOffset = -y) > 63) + CursorYOffset = 63; + y = 0; + } + else + { + CursorYOffset = pScreenInfo->frameY1 - pScreenInfo->frameY0; + if (y > CursorYOffset) + y = CursorYOffset; + CursorYOffset = 0; + } + + /* Adjust for multiscanned modes */ + if (pScreenInfo->currentMode->Flags & V_DBLSCAN) + y *= 2; + if (pScreenInfo->currentMode->VScan > 1) + y *= pScreenInfo->currentMode->VScan; + + do + { + if (CursorYOffset != pATI->CursorYOffset) + { + pATI->CursorYOffset = CursorYOffset; + outr(CUR_OFFSET, ((CursorYOffset << 4) + pATI->CursorOffset) >> 3); + } + else if (CursorXOffset == pATI->CursorXOffset) + break; + + pATI->CursorXOffset = CursorXOffset; + outr(CUR_HORZ_VERT_OFF, SetBits(CursorXOffset, CUR_HORZ_OFF) | + SetBits(CursorYOffset, CUR_VERT_OFF)); + } while (0); + + outr(CUR_HORZ_VERT_POSN, + SetBits(x, CUR_HORZ_POSN) | SetBits(y, CUR_VERT_POSN)); +} + +/* + * ATIMach64LoadCursorImage -- + * + * Copy hardware cursor image into offscreen video memory. + */ +static void +ATIMach64LoadCursorImage +( + ScrnInfoPtr pScreenInfo, + CARD8 *pImage +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 *pSrc = (pointer)pImage; + volatile CARD32 *pDst = pATI->pCursorImage; + + /* This is lengthy, but it does maximise burst modes */ + pDst[ 0] = pSrc[ 0]; pDst[ 1] = pSrc[ 1]; + pDst[ 2] = pSrc[ 2]; pDst[ 3] = pSrc[ 3]; + pDst[ 4] = pSrc[ 4]; pDst[ 5] = pSrc[ 5]; + pDst[ 6] = pSrc[ 6]; pDst[ 7] = pSrc[ 7]; + pDst[ 8] = pSrc[ 8]; pDst[ 9] = pSrc[ 9]; + pDst[ 10] = pSrc[ 10]; pDst[ 11] = pSrc[ 11]; + pDst[ 12] = pSrc[ 12]; pDst[ 13] = pSrc[ 13]; + pDst[ 14] = pSrc[ 14]; pDst[ 15] = pSrc[ 15]; + pDst[ 16] = pSrc[ 16]; pDst[ 17] = pSrc[ 17]; + pDst[ 18] = pSrc[ 18]; pDst[ 19] = pSrc[ 19]; + pDst[ 20] = pSrc[ 20]; pDst[ 21] = pSrc[ 21]; + pDst[ 22] = pSrc[ 22]; pDst[ 23] = pSrc[ 23]; + pDst[ 24] = pSrc[ 24]; pDst[ 25] = pSrc[ 25]; + pDst[ 26] = pSrc[ 26]; pDst[ 27] = pSrc[ 27]; + pDst[ 28] = pSrc[ 28]; pDst[ 29] = pSrc[ 29]; + pDst[ 30] = pSrc[ 30]; pDst[ 31] = pSrc[ 31]; + pDst[ 32] = pSrc[ 32]; pDst[ 33] = pSrc[ 33]; + pDst[ 34] = pSrc[ 34]; pDst[ 35] = pSrc[ 35]; + pDst[ 36] = pSrc[ 36]; pDst[ 37] = pSrc[ 37]; + pDst[ 38] = pSrc[ 38]; pDst[ 39] = pSrc[ 39]; + pDst[ 40] = pSrc[ 40]; pDst[ 41] = pSrc[ 41]; + pDst[ 42] = pSrc[ 42]; pDst[ 43] = pSrc[ 43]; + pDst[ 44] = pSrc[ 44]; pDst[ 45] = pSrc[ 45]; + pDst[ 46] = pSrc[ 46]; pDst[ 47] = pSrc[ 47]; + pDst[ 48] = pSrc[ 48]; pDst[ 49] = pSrc[ 49]; + pDst[ 50] = pSrc[ 50]; pDst[ 51] = pSrc[ 51]; + pDst[ 52] = pSrc[ 52]; pDst[ 53] = pSrc[ 53]; + pDst[ 54] = pSrc[ 54]; pDst[ 55] = pSrc[ 55]; + pDst[ 56] = pSrc[ 56]; pDst[ 57] = pSrc[ 57]; + pDst[ 58] = pSrc[ 58]; pDst[ 59] = pSrc[ 59]; + pDst[ 60] = pSrc[ 60]; pDst[ 61] = pSrc[ 61]; + pDst[ 62] = pSrc[ 62]; pDst[ 63] = pSrc[ 63]; + pDst[ 64] = pSrc[ 64]; pDst[ 65] = pSrc[ 65]; + pDst[ 66] = pSrc[ 66]; pDst[ 67] = pSrc[ 67]; + pDst[ 68] = pSrc[ 68]; pDst[ 69] = pSrc[ 69]; + pDst[ 70] = pSrc[ 70]; pDst[ 71] = pSrc[ 71]; + pDst[ 72] = pSrc[ 72]; pDst[ 73] = pSrc[ 73]; + pDst[ 74] = pSrc[ 74]; pDst[ 75] = pSrc[ 75]; + pDst[ 76] = pSrc[ 76]; pDst[ 77] = pSrc[ 77]; + pDst[ 78] = pSrc[ 78]; pDst[ 79] = pSrc[ 79]; + pDst[ 80] = pSrc[ 80]; pDst[ 81] = pSrc[ 81]; + pDst[ 82] = pSrc[ 82]; pDst[ 83] = pSrc[ 83]; + pDst[ 84] = pSrc[ 84]; pDst[ 85] = pSrc[ 85]; + pDst[ 86] = pSrc[ 86]; pDst[ 87] = pSrc[ 87]; + pDst[ 88] = pSrc[ 88]; pDst[ 89] = pSrc[ 89]; + pDst[ 90] = pSrc[ 90]; pDst[ 91] = pSrc[ 91]; + pDst[ 92] = pSrc[ 92]; pDst[ 93] = pSrc[ 93]; + pDst[ 94] = pSrc[ 94]; pDst[ 95] = pSrc[ 95]; + pDst[ 96] = pSrc[ 96]; pDst[ 97] = pSrc[ 97]; + pDst[ 98] = pSrc[ 98]; pDst[ 99] = pSrc[ 99]; + pDst[100] = pSrc[100]; pDst[101] = pSrc[101]; + pDst[102] = pSrc[102]; pDst[103] = pSrc[103]; + pDst[104] = pSrc[104]; pDst[105] = pSrc[105]; + pDst[106] = pSrc[106]; pDst[107] = pSrc[107]; + pDst[108] = pSrc[108]; pDst[109] = pSrc[109]; + pDst[110] = pSrc[110]; pDst[111] = pSrc[111]; + pDst[112] = pSrc[112]; pDst[113] = pSrc[113]; + pDst[114] = pSrc[114]; pDst[115] = pSrc[115]; + pDst[116] = pSrc[116]; pDst[117] = pSrc[117]; + pDst[118] = pSrc[118]; pDst[119] = pSrc[119]; + pDst[120] = pSrc[120]; pDst[121] = pSrc[121]; + pDst[122] = pSrc[122]; pDst[123] = pSrc[123]; + pDst[124] = pSrc[124]; pDst[125] = pSrc[125]; + pDst[126] = pSrc[126]; pDst[127] = pSrc[127]; + pDst[128] = pSrc[128]; pDst[129] = pSrc[129]; + pDst[130] = pSrc[130]; pDst[131] = pSrc[131]; + pDst[132] = pSrc[132]; pDst[133] = pSrc[133]; + pDst[134] = pSrc[134]; pDst[135] = pSrc[135]; + pDst[136] = pSrc[136]; pDst[137] = pSrc[137]; + pDst[138] = pSrc[138]; pDst[139] = pSrc[139]; + pDst[140] = pSrc[140]; pDst[141] = pSrc[141]; + pDst[142] = pSrc[142]; pDst[143] = pSrc[143]; + pDst[144] = pSrc[144]; pDst[145] = pSrc[145]; + pDst[146] = pSrc[146]; pDst[147] = pSrc[147]; + pDst[148] = pSrc[148]; pDst[149] = pSrc[149]; + pDst[150] = pSrc[150]; pDst[151] = pSrc[151]; + pDst[152] = pSrc[152]; pDst[153] = pSrc[153]; + pDst[154] = pSrc[154]; pDst[155] = pSrc[155]; + pDst[156] = pSrc[156]; pDst[157] = pSrc[157]; + pDst[158] = pSrc[158]; pDst[159] = pSrc[159]; + pDst[160] = pSrc[160]; pDst[161] = pSrc[161]; + pDst[162] = pSrc[162]; pDst[163] = pSrc[163]; + pDst[164] = pSrc[164]; pDst[165] = pSrc[165]; + pDst[166] = pSrc[166]; pDst[167] = pSrc[167]; + pDst[168] = pSrc[168]; pDst[169] = pSrc[169]; + pDst[170] = pSrc[170]; pDst[171] = pSrc[171]; + pDst[172] = pSrc[172]; pDst[173] = pSrc[173]; + pDst[174] = pSrc[174]; pDst[175] = pSrc[175]; + pDst[176] = pSrc[176]; pDst[177] = pSrc[177]; + pDst[178] = pSrc[178]; pDst[179] = pSrc[179]; + pDst[180] = pSrc[180]; pDst[181] = pSrc[181]; + pDst[182] = pSrc[182]; pDst[183] = pSrc[183]; + pDst[184] = pSrc[184]; pDst[185] = pSrc[185]; + pDst[186] = pSrc[186]; pDst[187] = pSrc[187]; + pDst[188] = pSrc[188]; pDst[189] = pSrc[189]; + pDst[190] = pSrc[190]; pDst[191] = pSrc[191]; + pDst[192] = pSrc[192]; pDst[193] = pSrc[193]; + pDst[194] = pSrc[194]; pDst[195] = pSrc[195]; + pDst[196] = pSrc[196]; pDst[197] = pSrc[197]; + pDst[198] = pSrc[198]; pDst[199] = pSrc[199]; + pDst[200] = pSrc[200]; pDst[201] = pSrc[201]; + pDst[202] = pSrc[202]; pDst[203] = pSrc[203]; + pDst[204] = pSrc[204]; pDst[205] = pSrc[205]; + pDst[206] = pSrc[206]; pDst[207] = pSrc[207]; + pDst[208] = pSrc[208]; pDst[209] = pSrc[209]; + pDst[210] = pSrc[210]; pDst[211] = pSrc[211]; + pDst[212] = pSrc[212]; pDst[213] = pSrc[213]; + pDst[214] = pSrc[214]; pDst[215] = pSrc[215]; + pDst[216] = pSrc[216]; pDst[217] = pSrc[217]; + pDst[218] = pSrc[218]; pDst[219] = pSrc[219]; + pDst[220] = pSrc[220]; pDst[221] = pSrc[221]; + pDst[222] = pSrc[222]; pDst[223] = pSrc[223]; + pDst[224] = pSrc[224]; pDst[225] = pSrc[225]; + pDst[226] = pSrc[226]; pDst[227] = pSrc[227]; + pDst[228] = pSrc[228]; pDst[229] = pSrc[229]; + pDst[230] = pSrc[230]; pDst[231] = pSrc[231]; + pDst[232] = pSrc[232]; pDst[233] = pSrc[233]; + pDst[234] = pSrc[234]; pDst[235] = pSrc[235]; + pDst[236] = pSrc[236]; pDst[237] = pSrc[237]; + pDst[238] = pSrc[238]; pDst[239] = pSrc[239]; + pDst[240] = pSrc[240]; pDst[241] = pSrc[241]; + pDst[242] = pSrc[242]; pDst[243] = pSrc[243]; + pDst[244] = pSrc[244]; pDst[245] = pSrc[245]; + pDst[246] = pSrc[246]; pDst[247] = pSrc[247]; + pDst[248] = pSrc[248]; pDst[249] = pSrc[249]; + pDst[250] = pSrc[250]; pDst[251] = pSrc[251]; + pDst[252] = pSrc[252]; pDst[253] = pSrc[253]; + pDst[254] = pSrc[254]; pDst[255] = pSrc[255]; +} + +/* + * ATIMach64HideCursor -- + * + * Turn off hardware cursor. + */ +static void +ATIMach64HideCursor +( + ScrnInfoPtr pScreenInfo +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (!(pATI->NewHW.gen_test_cntl & GEN_CUR_EN)) + return; + + pATI->NewHW.gen_test_cntl &= ~GEN_CUR_EN; + outr(GEN_TEST_CNTL, pATI->NewHW.gen_test_cntl); +} + +/* + * ATIMach64ShowCursor -- + * + * Turn on hardware cursor. + */ +static void +ATIMach64ShowCursor +( + ScrnInfoPtr pScreenInfo +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (pATI->NewHW.gen_test_cntl & GEN_CUR_EN) + return; + + pATI->NewHW.gen_test_cntl |= GEN_CUR_EN; + outr(GEN_TEST_CNTL, pATI->NewHW.gen_test_cntl); +} + +/* + * ATIMach64UseHWCursor -- + * + * Notify cursor layer whether a hardware cursor is configured. + */ +static Bool +ATIMach64UseHWCursor +( + ScreenPtr pScreen, + CursorPtr pCursor +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (!pATI->CursorBase) + return FALSE; + +#ifndef AVOID_CPIO + + /* + * For some reason, the hardware cursor isn't vertically scaled when a VGA + * doublescanned or multiscanned mode is in effect. + */ + if (pATI->NewHW.crtc == ATI_CRTC_MACH64) + return TRUE; + if ((pScreenInfo->currentMode->Flags & V_DBLSCAN) || + (pScreenInfo->currentMode->VScan > 1)) + return FALSE; + +#endif /* AVOID_CPIO */ + + return TRUE; +} + +/* + * ATIMach64CursorInit -- + * + * Initialise xf86CursorInfoRec fields with information specific to Mach64 + * variants. + */ +Bool +ATIMach64CursorInit +( + xf86CursorInfoPtr pCursorInfo +) +{ + pCursorInfo->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_INVERT_MASK | + +#if X_BYTE_ORDER != X_LITTLE_ENDIAN + + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + +#endif /* X_BYTE_ORDER */ + + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; + pCursorInfo->MaxWidth = pCursorInfo->MaxHeight = 64; + + pCursorInfo->SetCursorColors = ATIMach64SetCursorColours; + pCursorInfo->SetCursorPosition = ATIMach64SetCursorPosition; + pCursorInfo->LoadCursorImage = ATIMach64LoadCursorImage; + pCursorInfo->HideCursor = ATIMach64HideCursor; + pCursorInfo->ShowCursor = ATIMach64ShowCursor; + pCursorInfo->UseHWCursor = ATIMach64UseHWCursor; + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h index 2fccd2944..52b5f3dbf 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.10 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.11 2001/03/25 05:32:08 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -28,6 +28,7 @@ #include "atiproto.h" #include "xaa.h" +#include "xf86Cursor.h" #define ATIMach64MaxX 8191 #define ATIMach64MaxY 32767 @@ -44,4 +45,6 @@ extern void ATIMach64SetDPMSMode FunctionPrototype((ATIPtr, int)); extern Bool ATIMach64AccelInit FunctionPrototype((ATIPtr, XAAInfoRecPtr)); +extern Bool ATIMach64CursorInit FunctionPrototype((xf86CursorInfoPtr)); + #endif /* ___ATIMACH64_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h index 3ca64947a..502081653 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.7 2001/02/12 03:31:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.8 2001/03/25 05:32:08 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -187,7 +187,7 @@ extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8, { \ ATIAccessMach64PLLReg(pATI, _Index, TRUE); \ out8(CLOCK_CNTL + 2, _Value); \ - } while(0) + } while (0) #define ATIGetMach64LCDReg(_Index) \ ( \ @@ -199,7 +199,7 @@ extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8, { \ out8(LCD_INDEX, SetBits(_Index, LCD_REG_INDEX)); \ outr(LCD_DATA, _Value); \ - } while(0) + } while (0) #define ATIGetMach64TVReg(_Index) \ ( \ @@ -211,6 +211,6 @@ extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8, { \ out8(TV_OUT_INDEX, SetBits(_Index, TV_REG_INDEX)); \ outr(TV_OUT_DATA, _Value); \ - } while(0) + } while (0) #endif /* ___ATIMACH64IO_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c index 2e2ce98e6..c0c2d49cd 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.2 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.3 2001/03/03 22:27:41 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -30,7 +30,7 @@ static XF86ModuleVersionInfo ATIVersionRec = { - ATI_DRIVER_NAME, + "atimisc", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c index 27a889e51..2129b34fd 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.3 2001/02/12 03:53:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.4 2001/03/25 05:32:08 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -263,68 +263,72 @@ ATIModePreInit { ATIMach64PreInit(pScreenInfo, pATI, pATIHW); - } - - if (pATI->Chip >= ATI_CHIP_264CT) - { - /* Ensure proper VCLK source */ - pATIHW->pll_vclk_cntl = ATIGetMach64PLLReg(PLL_VCLK_CNTL) | - (PLL_VCLK_SRC_SEL | PLL_VCLK_RESET); - - /* Set provisional values for other PLL registers */ - pATIHW->pll_vclk_post_div = ATIGetMach64PLLReg(PLL_VCLK_POST_DIV); - pATIHW->pll_vclk0_fb_div = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV); - pATIHW->pll_vclk1_fb_div = ATIGetMach64PLLReg(PLL_VCLK1_FB_DIV); - pATIHW->pll_vclk2_fb_div = ATIGetMach64PLLReg(PLL_VCLK2_FB_DIV); - pATIHW->pll_vclk3_fb_div = ATIGetMach64PLLReg(PLL_VCLK3_FB_DIV); - pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL); - /* For now disable extended reference and feedback dividers */ - if (pATI->Chip >= ATI_CHIP_264LT) - pATIHW->pll_ext_vpll_cntl = ATIGetMach64PLLReg(PLL_EXT_VPLL_CNTL) & - ~(PLL_EXT_VPLL_EN | PLL_EXT_VPLL_VGA_EN | PLL_EXT_VPLL_INSYNC); - } - - /* Initialise CRTC data for LCD panels */ - if (pATI->LCDPanelID >= 0) - { - if (pATI->Chip == ATI_CHIP_264LT) + if (pATI->Chip >= ATI_CHIP_264CT) { - 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 = 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 = - ATIGetMach64LCDReg(LCD_CONFIG_PANEL) | DONT_SHADOW_HEND; - pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); - outr(LCD_INDEX, lcd_index); - } + /* Ensure proper VCLK source */ + pATIHW->pll_vclk_cntl = ATIGetMach64PLLReg(PLL_VCLK_CNTL) | + (PLL_VCLK_SRC_SEL | PLL_VCLK_RESET); + + /* Set provisional values for other PLL registers */ + pATIHW->pll_vclk_post_div = ATIGetMach64PLLReg(PLL_VCLK_POST_DIV); + pATIHW->pll_vclk0_fb_div = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV); + pATIHW->pll_vclk1_fb_div = ATIGetMach64PLLReg(PLL_VCLK1_FB_DIV); + pATIHW->pll_vclk2_fb_div = ATIGetMach64PLLReg(PLL_VCLK2_FB_DIV); + pATIHW->pll_vclk3_fb_div = ATIGetMach64PLLReg(PLL_VCLK3_FB_DIV); + pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL); + + /* For now disable extended reference and feedback dividers */ + if (pATI->Chip >= ATI_CHIP_264LT) + pATIHW->pll_ext_vpll_cntl = + ATIGetMach64PLLReg(PLL_EXT_VPLL_CNTL) & + ~(PLL_EXT_VPLL_EN | PLL_EXT_VPLL_VGA_EN | + PLL_EXT_VPLL_INSYNC); + + /* Initialise CRTC data for LCD panels */ + if (pATI->LCDPanelID >= 0) + { + if (pATI->Chip == ATI_CHIP_264LT) + { + 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 = 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 = + ATIGetMach64LCDReg(LCD_CONFIG_PANEL) | + DONT_SHADOW_HEND; + pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); + outr(LCD_INDEX, lcd_index); + } - pATIHW->lcd_gen_ctrl &= - ~(HORZ_DIVBY2_EN | DISABLE_PCLK_RESET | DIS_HOR_CRT_DIVBY2 | - VCLK_DAC_PM_EN | XTALIN_PM_EN | CRTC_RW_SELECT | - USE_SHADOWED_VEND | USE_SHADOWED_ROWCUR | - SHADOW_EN | SHADOW_RW_EN); - pATIHW->lcd_gen_ctrl |= DONT_SHADOW_VPAR | LOCK_8DOT; + pATIHW->lcd_gen_ctrl &= + ~(HORZ_DIVBY2_EN | DISABLE_PCLK_RESET | + DIS_HOR_CRT_DIVBY2 | VCLK_DAC_PM_EN | XTALIN_PM_EN | + CRTC_RW_SELECT | USE_SHADOWED_VEND | + USE_SHADOWED_ROWCUR | SHADOW_EN | SHADOW_RW_EN); + pATIHW->lcd_gen_ctrl |= DONT_SHADOW_VPAR | LOCK_8DOT; - if (pATI->OptionCRT) - { - /* - * Use primary CRTC to drive the CRT. Turn off panel interface. - */ - pATIHW->lcd_gen_ctrl &= ~LCD_ON; - pATIHW->lcd_gen_ctrl |= CRT_ON; - } - else - { - /* Use primary CRTC to drive the panel */ - pATIHW->lcd_gen_ctrl |= LCD_ON; + if (pATI->OptionCRT) + { + /* + * Use primary CRTC to drive the CRT. Turn off panel + * interface. + */ + pATIHW->lcd_gen_ctrl &= ~LCD_ON; + pATIHW->lcd_gen_ctrl |= CRT_ON; + } + else + { + /* Use primary CRTC to drive the panel */ + pATIHW->lcd_gen_ctrl |= LCD_ON; + } + } } } @@ -370,36 +374,38 @@ ATIModeSave pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL); if (pATI->Chip >= ATI_CHIP_264LT) pATIHW->pll_ext_vpll_cntl = ATIGetMach64PLLReg(PLL_EXT_VPLL_CNTL); - } - /* Save LCD registers */ - if (pATI->LCDPanelID >= 0) - { - if (pATI->Chip == ATI_CHIP_264LT) - { - 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 */ - 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)) */ + /* Save LCD registers */ + if (pATI->LCDPanelID >= 0) { - 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); + if (pATI->Chip == ATI_CHIP_264LT) + { + 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 */ - ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & - ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); + /* Set up to save non-shadow registers */ + 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 = 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 */ + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & + ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); + } } } @@ -422,52 +428,57 @@ ATIModeSave { ATIMach64Save(pATI, pATIHW); - } - /* Save DSP data */ - if (pATI->Chip >= ATI_CHIP_264VTB) - ATIDSPSave(pATI, pATIHW); - - if (pATI->LCDPanelID >= 0) - { - if (!pATI->OptionCRT) + if (pATI->Chip >= ATI_CHIP_264VTB) { - /* Switch to shadow registers */ - if (pATI->Chip == ATI_CHIP_264LT) - 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)) */ - ATIPutMach64LCDReg(LCD_GEN_CNTL, - (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | - (SHADOW_EN | SHADOW_RW_EN)); + /* Save DSP data */ + ATIDSPSave(pATI, pATIHW); + + if (pATI->LCDPanelID >= 0) + { + if (!pATI->OptionCRT) + { + /* Switch to shadow registers */ + if (pATI->Chip == ATI_CHIP_264LT) + 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)) */ + 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); + /* 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 = 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); - } + /* Save shadow Mach64 CRTC registers */ + 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) - 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)) */ - { - ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl); - outr(LCD_INDEX, pATIHW->lcd_index); + /* Restore CRTC selection and shadow state */ + if (pATI->Chip == ATI_CHIP_264LT) + 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)) */ + { + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl); + outr(LCD_INDEX, pATIHW->lcd_index); + } + } } } @@ -535,7 +546,7 @@ ATIModeCalculate ) { CARD32 lcd_index; - int Index, ECPClock; + int Index, ECPClock, MaxScalerClock; /* Clobber mode timings */ if ((pATI->LCDPanelID >= 0) && !pATI->OptionCRT && @@ -748,10 +759,20 @@ ATIModeCalculate /* Setup ECP clock divider */ if (pATI->Chip >= ATI_CHIP_264VT) { + if (pATI->Chip <= ATI_CHIP_264VT3) + MaxScalerClock = 80000; + else if (pATI->Chip <= ATI_CHIP_264GT2C) + MaxScalerClock = 100000; + else if (pATI->Chip == ATI_CHIP_264GTPRO) + MaxScalerClock = 125000; + else if (pATI->Chip <= ATI_CHIP_MOBILITY) + MaxScalerClock = 135000; + else + MaxScalerClock = 80000; /* Conservative */ pATIHW->pll_vclk_cntl &= ~PLL_ECP_DIV; /* XXX Don't do this for TVOut! */ ECPClock = pMode->SynthClock; - for (Index = 0; (ECPClock > 125000) && (Index < 2); Index++) + for (Index = 0; (ECPClock > MaxScalerClock) && (Index < 2); Index++) ECPClock >>= 1; pATIHW->pll_vclk_cntl |= SetBits(Index, PLL_ECP_DIV); } @@ -796,45 +817,47 @@ ATIModeSet ATIPutMach64PLLReg(PLL_EXT_VPLL_CNTL, pATIHW->pll_ext_vpll_cntl); ATIPutMach64PLLReg(PLL_VCLK_CNTL, pATIHW->pll_vclk_cntl & ~PLL_VCLK_RESET); - } - /* Load LCD registers */ - if (pATI->LCDPanelID >= 0) - { - /* Stop CRTC */ - 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 */ - outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | - SHADOW_EN | SHADOW_RW_EN)); - - /* Temporarily disable stretching */ - outr(HORZ_STRETCHING, pATIHW->horz_stretching & - ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); - outr(VERT_STRETCHING, pATIHW->vert_stretching & - ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | - VERT_STRETCH_USE0 | VERT_STRETCH_EN)); - } - else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || - (pATI->Chip == ATI_CHIP_264XL) || - (pATI->Chip == ATI_CHIP_MOBILITY)) */ + /* Load LCD registers */ + if (pATI->LCDPanelID >= 0) { - /* Update non-shadow registers first */ - 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 */ - ATIPutMach64LCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching & - ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); - ATIPutMach64LCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching & - ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | - VERT_STRETCH_USE0 | VERT_STRETCH_EN)); + /* Stop CRTC */ + 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 */ + outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & + ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | + SHADOW_EN | SHADOW_RW_EN)); + + /* Temporarily disable stretching */ + outr(HORZ_STRETCHING, pATIHW->horz_stretching & + ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); + outr(VERT_STRETCHING, pATIHW->vert_stretching & + ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | + VERT_STRETCH_USE0 | VERT_STRETCH_EN)); + } + else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || + (pATI->Chip == ATI_CHIP_264XL) || + (pATI->Chip == ATI_CHIP_MOBILITY)) */ + { + /* Update non-shadow registers first */ + 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 */ + ATIPutMach64LCDReg(LCD_HORZ_STRETCHING, + pATIHW->horz_stretching & + ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); + ATIPutMach64LCDReg(LCD_VERT_STRETCHING, + pATIHW->vert_stretching & + ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | + VERT_STRETCH_USE0 | VERT_STRETCH_EN)); + } } } @@ -867,8 +890,14 @@ ATIModeSet if (pATI->Chip >= ATI_CHIP_88800GXC) { outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl); + outr(CUR_CLR0, pATIHW->cur_clr0); + outr(CUR_CLR1, pATIHW->cur_clr1); + outr(CUR_OFFSET, pATIHW->cur_offset); + outr(CUR_HORZ_VERT_POSN, pATIHW->cur_horz_vert_posn); + outr(CUR_HORZ_VERT_OFF, pATIHW->cur_horz_vert_off); outr(MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel); outr(MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel); + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl); outr(CONFIG_CNTL, pATIHW->config_cntl); if (pATI->Chip >= ATI_CHIP_264CT) { @@ -879,6 +908,8 @@ ATIModeSet outr(CRTC_OFF_PITCH, pATIHW->crtc_off_pitch); outr(BUS_CNTL, pATIHW->bus_cntl); outr(DAC_CNTL, pATIHW->dac_cntl); + if (pATI->Chip >= ATI_CHIP_264VTB) + outr(MEM_CNTL, pATIHW->mem_cntl); } } @@ -985,6 +1016,9 @@ ATIModeSet /* Load RAMDAC */ ATIDACSet(pATI, pATIHW); + /* Reset hardware cursor caching */ + pATI->CursorXOffset = pATI->CursorYOffset = (CARD16)(-1); + #ifndef AVOID_CPIO /* Restore video memory */ @@ -1003,52 +1037,3 @@ ATIModeSet ATIPrintRegisters(pATI); } } - -/* - * ATIModeAccelInit -- - * - * This function is called to initialise XAA on a screen. - */ -Bool -ATIModeAccelInit -( - ScrnInfoPtr pScreenInfo, - ScreenPtr pScreen, - ATIPtr pATI -) -{ - BoxRec ScreenArea; - - if (!pATI->OptionAccel) - return TRUE; - - if (!(pATI->pXAAInfo = XAACreateInfoRec())) - return FALSE; - - switch (pATI->Adapter) - { - case ATI_ADAPTER_MACH64: - if (ATIMach64AccelInit(pATI, pATI->pXAAInfo)) - break; - - default: - XAADestroyInfoRec(pATI->pXAAInfo); - pATI->pXAAInfo = NULL; - return FALSE; - } - - ScreenArea.x1 = ScreenArea.y1 = 0; - ScreenArea.x2 = pATI->displayWidth; - ScreenArea.y2 = pScreenInfo->videoRam * 1024 * 8 / pATI->displayWidth / - pATI->bitsPerPixel; - if ((unsigned)ScreenArea.y2 > ATIMach64MaxY) - ScreenArea.y2 = ATIMach64MaxY; - xf86InitFBManager(pScreen, &ScreenArea); - - if (XAAInit(pScreen, pATI->pXAAInfo)) - return TRUE; - - XAADestroyInfoRec(pATI->pXAAInfo); - pATI->pXAAInfo = NULL; - return FALSE; -} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h index e3ccda471..88b6f51cc 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.2 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.3 2001/03/25 05:32:08 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -38,7 +38,4 @@ extern Bool ATIModeCalculate FunctionPrototype((int, ATIPtr, ATIHWPtr, extern void ATIModeSet FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); -extern Bool ATIModeAccelInit FunctionPrototype((ScrnInfoPtr, ScreenPtr, - ATIPtr)); - #endif /* ___ATIMODE_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c index 1e2f8574d..5d74e13ad 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.15 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.16 2001/03/25 05:32:09 tsi Exp $ */ /* * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -54,12 +54,25 @@ OptionInfoRec ATIPublicOptions[] = FALSE }, { + ATI_OPTION_HWCURSOR, + "hw_cursor", + OPTV_BOOLEAN, + {0, }, + FALSE, + }, + +#ifndef AVOID_CPIO + + { ATI_OPTION_LINEAR, "linear", OPTV_BOOLEAN, {0, }, FALSE }, + +#endif /* AVOID_CPIO */ + { ATI_OPTION_MMIO_CACHE, "mmio_cache", @@ -89,6 +102,13 @@ OptionInfoRec ATIPublicOptions[] = FALSE }, { + ATI_OPTION_SWCURSOR, + "sw_cursor", + OPTV_BOOLEAN, + {0, }, + FALSE, + }, + { -1, NULL, OPTV_NONE, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h index 5d34acbac..475b68144 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.5 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.6 2001/03/25 05:32:09 tsi Exp $ */ /* * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -36,11 +36,19 @@ typedef enum ATI_OPTION_ACCEL, ATI_OPTION_CRT, ATI_OPTION_CSYNC, + ATI_OPTION_HWCURSOR, + +#ifndef AVOID_CPIO + ATI_OPTION_LINEAR, + +#endif /* AVOID_CPIO */ + ATI_OPTION_MMIO_CACHE, ATI_OPTION_PROBE_CLOCKS, ATI_OPTION_REFERENCE_CLOCK, - ATI_OPTION_SHADOW_FB + ATI_OPTION_SHADOW_FB, + ATI_OPTION_SWCURSOR } ATIPublicOptionType; extern OptionInfoRec ATIPublicOptions[]; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c index e1ab33f86..9b072da5f 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.42 2001/02/12 03:53:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.44 2001/04/01 14:00:09 tsi Exp $ */ /* * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -27,6 +27,7 @@ #include "atibus.h" #include "atichip.h" #include "aticonfig.h" +#include "aticursor.h" #include "atidac.h" #include "atidsp.h" #include "atiident.h" @@ -404,7 +405,7 @@ ATIPreInit DisplayModePtr pMode; unsigned long Block0Base; CARD32 IOValue; - int i, j, AcceleratorVideoRAM = 0; + int i, j, AcceleratorVideoRAM = 0, ServerVideoRAM; int Numerator, Denominator; int MinX, MinY; ClockRange ATIClockRange = {NULL, 0, 80000, 0, TRUE, TRUE, 1, 1, 0}; @@ -655,7 +656,8 @@ ATIPreInit } } - pScreenInfo->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT; + pScreenInfo->racIoFlags = + RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR; pScreenInfo->racMemFlags = RAC_FB; /* Deal with ChipID & ChipRev overrides */ @@ -804,7 +806,7 @@ ATIPreInit } ATIMapMach64(pScreenInfo->scrnIndex, pATI); - } while(0); + } while (0); pATI->Block0Base = Block0Base; #ifdef AVOID_CPIO @@ -843,16 +845,16 @@ ATIPreInit #endif /* AVOID_CPIO */ - IOValue = inr(MEM_CNTL); + pATIHW->mem_cntl = inr(MEM_CNTL); if (pATI->Chip < ATI_CHIP_264VTB) pATI->VideoRAM = - videoRamSizes[GetBits(IOValue, CTL_MEM_SIZE) + 2]; + videoRamSizes[GetBits(pATIHW->mem_cntl, CTL_MEM_SIZE) + 2]; else { pATI->nFIFOEntries = /* Don't care */ (unsigned int)(-1) >> 1; - IOValue = GetBits(IOValue, CTL_MEM_SIZEB); + IOValue = GetBits(pATIHW->mem_cntl, CTL_MEM_SIZEB); if (IOValue < 8) pATI->VideoRAM = (IOValue + 1) * 512; else if (IOValue < 12) @@ -918,12 +920,22 @@ ATIPreInit * enabled. */ if ((pATI->LCDPanelID >= 0) && - !pATI->LCDHorizontal && - !pATI->LCDVertical && !(pATIHW->horz_stretching & HORZ_STRETCH_EN) && !(pATIHW->vert_stretching & VERT_STRETCH_EN) && !(pATIHW->lcd_gen_ctrl & LCD_ON)) + { + /* + * At this point, if an XL or Mobility BIOS hasn't set + * panel dimensions, then there is no panel. Otherwise, + * keep any panel disabled to allow for modes greater than + * the panel's dimensions. + */ + if ((pATI->Chip >= ATI_CHIP_264XL) && + (!pATI->LCDHorizontal || !pATI->LCDVertical)) pATI->LCDPanelID = -1; + else + pATI->OptionCRT = TRUE; + } } else { @@ -1141,7 +1153,7 @@ ATIPreInit pATI->DAC = ClockDac; /* For now */ } - /* Determine panel dimensions and driving clock */ + /* Determine panel dimensions */ if (pATI->LCDPanelID >= 0) { LCDTable = BIOSWord(0x78U); @@ -1341,10 +1353,10 @@ ATIPreInit #ifdef AVOID_CPIO - if (!pATI->OptionLinear) + if (!xf86LinearVidMem()) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "A linear aperture is not available in this configuration.\n"); + "A linear aperture is not available.\n"); ATILock(pATI); ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); @@ -1533,325 +1545,347 @@ ATIPreInit */ if (pATI->LCDPanelID >= 0) { - int HDisplay, VDisplay; - CARD8 ClockMask, PostMask; + if (pATI->OptionCRT) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + "Using CRT interface and disabling digital flat panel.\n"); + } + else + { + int HDisplay, VDisplay; + CARD8 ClockMask, PostMask; - /* - * Determine porch data. The following is inaccurate (but still good - * enough) when BIOS initialisation has set things up so that the - * registers read here are not the ones actually in use by the panel. - * Thus, a further refinement here would be to flip back and forth - * between shadow and non-shadow registers as dictated by the various - * LCD_GEN_CNTL and CONFIG_PANEL bits involved. - * - * This groks the mode on entry to extract the width and position of - * its sync and blanking pulses, and considers any overscan as part of - * the displayed area, given that the overscan is also stretched. - * - * This also attempts to determine panel dimensions but cannot do so - * for one that is "auto-stretched". - */ + /* + * Determine porch data. The following is inaccurate (but still + * good enough) when BIOS initialisation has set things up so that + * the registers read here are not the ones actually in use by the + * panel. Thus, a further refinement here would be to flip back + * and forth between shadow and non-shadow registers as dictated by + * the various LCD_GEN_CNTL and CONFIG_PANEL bits involved. + * + * This groks the mode on entry to extract the width and position + * of its sync and blanking pulses, and considers any overscan as + * part of the displayed area, given that the overscan is also + * stretched. + * + * This also attempts to determine panel dimensions but cannot do + * so for one that is "auto-stretched". + */ #ifndef AVOID_CPIO - if (!(pATIHW->crtc_gen_cntl & CRTC_EXT_DISP_EN)) - { - pATIHW->clock = (inb(R_GENMO) & 0x0CU) >> 2; - - pATIHW->crt[0] = GetReg(CRTX(pATI->CPIO_VGABase), 0x00U); - pATIHW->crt[2] = GetReg(CRTX(pATI->CPIO_VGABase), 0x02U); - pATIHW->crt[3] = GetReg(CRTX(pATI->CPIO_VGABase), 0x03U); - pATIHW->crt[4] = GetReg(CRTX(pATI->CPIO_VGABase), 0x04U); - pATIHW->crt[5] = GetReg(CRTX(pATI->CPIO_VGABase), 0x05U); - pATIHW->crt[6] = GetReg(CRTX(pATI->CPIO_VGABase), 0x06U); - pATIHW->crt[7] = GetReg(CRTX(pATI->CPIO_VGABase), 0x07U); - pATIHW->crt[9] = GetReg(CRTX(pATI->CPIO_VGABase), 0x09U); - pATIHW->crt[16] = GetReg(CRTX(pATI->CPIO_VGABase), 0x10U); - pATIHW->crt[17] = GetReg(CRTX(pATI->CPIO_VGABase), 0x11U); - pATIHW->crt[21] = GetReg(CRTX(pATI->CPIO_VGABase), 0x15U); - pATIHW->crt[22] = GetReg(CRTX(pATI->CPIO_VGABase), 0x16U); - - pATI->LCDHSyncWidth = (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU; - pATI->LCDHBlankWidth = (((pATIHW->crt[3] & 0x1FU) | - ((pATIHW->crt[5] >> 2) & 0x20U)) - - pATIHW->crt[2]) & 0x3FU; - pATI->LCDVSyncWidth = (pATIHW->crt[17] - pATIHW->crt[16]) & 0x0FU; - pATI->LCDVBlankWidth = (pATIHW->crt[22] - pATIHW->crt[21]) & 0xFFU; - - HDisplay = pATIHW->crt[0] + 5 - pATI->LCDHBlankWidth; - VDisplay = (((pATIHW->crt[7] << 4) & 0x0200U) | - ((pATIHW->crt[7] << 8) & 0x0100U) | - pATIHW->crt[6]) + 2 - pATI->LCDVBlankWidth; - - pATI->LCDHSyncStart = - ((pATIHW->crt[4] - pATIHW->crt[2]) & 0xFFU) + 1; - pATI->LCDVSyncStart = (((((pATIHW->crt[7] << 2) & 0x0200U) | - ((pATIHW->crt[7] << 6) & 0x0100U) | - pATIHW->crt[16]) - - (((pATIHW->crt[9] << 4) & 0x0200U) | - ((pATIHW->crt[7] << 5) & 0x0100U) | - pATIHW->crt[21])) & 0xFFU) + 1; - } - else + if (!(pATIHW->crtc_gen_cntl & CRTC_EXT_DISP_EN)) + { + pATIHW->clock = (inb(R_GENMO) & 0x0CU) >> 2; + + pATIHW->crt[0] = GetReg(CRTX(pATI->CPIO_VGABase), 0x00U); + pATIHW->crt[2] = GetReg(CRTX(pATI->CPIO_VGABase), 0x02U); + pATIHW->crt[3] = GetReg(CRTX(pATI->CPIO_VGABase), 0x03U); + pATIHW->crt[4] = GetReg(CRTX(pATI->CPIO_VGABase), 0x04U); + pATIHW->crt[5] = GetReg(CRTX(pATI->CPIO_VGABase), 0x05U); + pATIHW->crt[6] = GetReg(CRTX(pATI->CPIO_VGABase), 0x06U); + pATIHW->crt[7] = GetReg(CRTX(pATI->CPIO_VGABase), 0x07U); + pATIHW->crt[9] = GetReg(CRTX(pATI->CPIO_VGABase), 0x09U); + pATIHW->crt[16] = GetReg(CRTX(pATI->CPIO_VGABase), 0x10U); + pATIHW->crt[17] = GetReg(CRTX(pATI->CPIO_VGABase), 0x11U); + pATIHW->crt[21] = GetReg(CRTX(pATI->CPIO_VGABase), 0x15U); + pATIHW->crt[22] = GetReg(CRTX(pATI->CPIO_VGABase), 0x16U); + + pATI->LCDHSyncWidth = + (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU; + pATI->LCDHBlankWidth = (((pATIHW->crt[3] & 0x1FU) | + ((pATIHW->crt[5] >> 2) & 0x20U)) - + pATIHW->crt[2]) & 0x3FU; + pATI->LCDVSyncWidth = + (pATIHW->crt[17] - pATIHW->crt[16]) & 0x0FU; + pATI->LCDVBlankWidth = + (pATIHW->crt[22] - pATIHW->crt[21]) & 0xFFU; + + HDisplay = pATIHW->crt[0] + 5 - pATI->LCDHBlankWidth; + VDisplay = (((pATIHW->crt[7] << 4) & 0x0200U) | + ((pATIHW->crt[7] << 8) & 0x0100U) | + pATIHW->crt[6]) + 2 - pATI->LCDVBlankWidth; + + pATI->LCDHSyncStart = + ((pATIHW->crt[4] - pATIHW->crt[2]) & 0xFFU) + 1; + pATI->LCDVSyncStart = (((((pATIHW->crt[7] << 2) & 0x0200U) | + ((pATIHW->crt[7] << 6) & 0x0100U) | + pATIHW->crt[16]) - + (((pATIHW->crt[9] << 4) & 0x0200U) | + ((pATIHW->crt[7] << 5) & 0x0100U) | + pATIHW->crt[21])) & 0xFFU) + 1; + } + else #endif /* AVOID_CPIO */ - { - pATIHW->clock = inr(CLOCK_CNTL) & 0x03U; - - 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->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT); - pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM); - - HDisplay = GetBits(pATIHW->crtc_h_total_disp, CRTC_H_DISP) + - GetBits(pATIHW->ovr_wid_left_right, OVR_WID_LEFT) + - GetBits(pATIHW->ovr_wid_left_right, OVR_WID_RIGHT); - VDisplay = GetBits(pATIHW->crtc_v_total_disp, CRTC_V_DISP) + - GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_TOP) + - GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_BOTTOM); - - pATI->LCDHSyncStart = - (GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_STRT_HI) * - (MaxBits(CRTC_H_SYNC_STRT) + 1)) + - GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_STRT) - - HDisplay; - 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; - 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; - - HDisplay++; - VDisplay++; - } + { + pATIHW->clock = inr(CLOCK_CNTL) & 0x03U; + + 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->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT); + pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM); + + HDisplay = GetBits(pATIHW->crtc_h_total_disp, CRTC_H_DISP) + + GetBits(pATIHW->ovr_wid_left_right, OVR_WID_LEFT) + + GetBits(pATIHW->ovr_wid_left_right, OVR_WID_RIGHT); + VDisplay = GetBits(pATIHW->crtc_v_total_disp, CRTC_V_DISP) + + GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_TOP) + + GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_BOTTOM); + + pATI->LCDHSyncStart = + (GetBits(pATIHW->crtc_h_sync_strt_wid, + CRTC_H_SYNC_STRT_HI) * + (MaxBits(CRTC_H_SYNC_STRT) + 1)) + + GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_STRT) - + HDisplay; + 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; + 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; + + HDisplay++; + VDisplay++; + } - HDisplay <<= 3; - pATI->LCDHSyncStart <<= 3; - pATI->LCDHSyncWidth <<= 3; - pATI->LCDHBlankWidth <<= 3; + HDisplay <<= 3; + pATI->LCDHSyncStart <<= 3; + pATI->LCDHSyncWidth <<= 3; + pATI->LCDHBlankWidth <<= 3; - /* Calculate panel dimensions implied by the input timing */ - if ((pATIHW->horz_stretching & (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) == - HORZ_STRETCH_EN) - { - if (pATIHW->horz_stretching & HORZ_STRETCH_MODE) + /* Calculate panel dimensions implied by the input timing */ + if ((pATIHW->horz_stretching & + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) == + HORZ_STRETCH_EN) { - if (pATIHW->horz_stretching & HORZ_STRETCH_BLEND) + if (pATIHW->horz_stretching & HORZ_STRETCH_MODE) + { + if (pATIHW->horz_stretching & HORZ_STRETCH_BLEND) + { + HDisplay = + (HDisplay * (MaxBits(HORZ_STRETCH_BLEND) + 1)) / + GetBits(pATIHW->horz_stretching, + HORZ_STRETCH_BLEND); + } + } + else if (((pATIHW->horz_stretching & HORZ_STRETCH_LOOP) > + HORZ_STRETCH_LOOP15) || + (pATIHW->horz_stretching & + SetBits(1, HORZ_STRETCH_RATIO))) { - HDisplay = (HDisplay * (MaxBits(HORZ_STRETCH_BLEND) + 1)) / - GetBits(pATIHW->horz_stretching, HORZ_STRETCH_BLEND); + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Ignoring invalid horizontal stretch ratio in mode on" + " server entry.\n"); } - } - else if (((pATIHW->horz_stretching & HORZ_STRETCH_LOOP) > - HORZ_STRETCH_LOOP15) || - (pATIHW->horz_stretching & - SetBits(1, HORZ_STRETCH_RATIO))) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Ignoring invalid horizontal stretch ratio in mode on" - " server entry.\n"); - } - else - { - IOValue = GetBits(pATIHW->horz_stretching, HORZ_STRETCH_RATIO); - - switch (GetBits(pATIHW->horz_stretching, HORZ_STRETCH_LOOP)) + else { - case GetBits(HORZ_STRETCH_LOOP09, HORZ_STRETCH_LOOP): - i = 9; - IOValue &= (1 << 9) - 1; - break; + IOValue = + GetBits(pATIHW->horz_stretching, HORZ_STRETCH_RATIO); - case GetBits(HORZ_STRETCH_LOOP11, HORZ_STRETCH_LOOP): - i = 11; - IOValue &= (1 << 11) - 1; - break; - - case GetBits(HORZ_STRETCH_LOOP12, HORZ_STRETCH_LOOP): - i = 12; - IOValue &= (1 << 12) - 1; - break; + switch (GetBits(pATIHW->horz_stretching, + HORZ_STRETCH_LOOP)) + { + case GetBits(HORZ_STRETCH_LOOP09, HORZ_STRETCH_LOOP): + i = 9; + IOValue &= (1 << 9) - 1; + break; + + case GetBits(HORZ_STRETCH_LOOP11, HORZ_STRETCH_LOOP): + i = 11; + IOValue &= (1 << 11) - 1; + break; + + case GetBits(HORZ_STRETCH_LOOP12, HORZ_STRETCH_LOOP): + i = 12; + IOValue &= (1 << 12) - 1; + break; + + case GetBits(HORZ_STRETCH_LOOP14, HORZ_STRETCH_LOOP): + i = 14; + IOValue &= (1 << 14) - 1; + break; + + case GetBits(HORZ_STRETCH_LOOP15, HORZ_STRETCH_LOOP): + default: /* Muffle compiler */ + i = 15; + IOValue &= (1 << 15) - 1; + break; + } - case GetBits(HORZ_STRETCH_LOOP14, HORZ_STRETCH_LOOP): - i = 14; - IOValue &= (1 << 14) - 1; - break; + if (IOValue) + { + /* Count the number of bits in IOValue */ + j = (IOValue >> 1) & 0x36DBU; + j = IOValue - j - ((j >> 1) & 0x36DBU); + j = ((j + (j >> 3)) & 0x71C7U) % 0x3FU; - case GetBits(HORZ_STRETCH_LOOP15, HORZ_STRETCH_LOOP): - default: /* Muffle compiler */ - i = 15; - IOValue &= (1 << 15) - 1; - break; + HDisplay = (HDisplay * i) / j; + } } + } + + if ((pATIHW->vert_stretching & VERT_STRETCH_EN) && + !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) + { + if ((pATIHW->vert_stretching & VERT_STRETCH_USE0) || + (VDisplay <= 350)) + IOValue = + GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO0); + else if (VDisplay <= 400) + IOValue = + GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO1); + else if ((VDisplay <= 480) || + !(pATIHW->ext_vert_stretch & VERT_STRETCH_RATIO3)) + IOValue = + GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO2); + else + IOValue = + GetBits(pATIHW->ext_vert_stretch, VERT_STRETCH_RATIO3); if (IOValue) - { - /* Count the number of bits in IOValue */ - j = (IOValue >> 1) & 0x36DBU; - j = IOValue - j - ((j >> 1) & 0x36DBU); - j = ((j + (j >> 3)) & 0x71C7U) % 0x3FU; + VDisplay = + (VDisplay * (MaxBits(VERT_STRETCH_RATIO0) + 1)) / + IOValue; + } - HDisplay = (HDisplay * i) / j; - } + /* Match calculated dimensions to probed dimensions */ + if (!pATI->LCDHorizontal) + { + if ((pATIHW->horz_stretching & + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) != + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) + pATI->LCDHorizontal = HDisplay; + } + else if (pATI->LCDHorizontal != HDisplay) + { + if ((pATIHW->horz_stretching & + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) != + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Inconsistent panel horizontal dimension:" + " %d and %d.\n", pATI->LCDHorizontal, HDisplay); + HDisplay = pATI->LCDHorizontal; } - } - if ((pATIHW->vert_stretching & VERT_STRETCH_EN) && - !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) - { - if ((pATIHW->vert_stretching & VERT_STRETCH_USE0) || - (VDisplay <= 350)) - IOValue = - GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO0); - else if (VDisplay <= 400) - IOValue = - GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO1); - else if ((VDisplay <= 480) || - !(pATIHW->ext_vert_stretch & VERT_STRETCH_RATIO3)) - IOValue = - GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO2); - else - IOValue = - GetBits(pATIHW->ext_vert_stretch, VERT_STRETCH_RATIO3); + if (!pATI->LCDVertical) + { + if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) || + !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) + pATI->LCDVertical = VDisplay; + } + else if (pATI->LCDVertical != VDisplay) + { + if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) || + !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Inconsistent panel vertical dimension: %d and %d.\n", + pATI->LCDVertical, VDisplay); + VDisplay = pATI->LCDVertical; + } - if (IOValue) - VDisplay = - (VDisplay * (MaxBits(VERT_STRETCH_RATIO0) + 1)) / IOValue; - } + 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"); - /* Match calculated dimensions to probed dimensions */ - if (!pATI->LCDHorizontal) - { - if ((pATIHW->horz_stretching & (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) - != (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) - pATI->LCDHorizontal = HDisplay; - } - else if (pATI->LCDHorizontal != HDisplay) - { - if ((pATIHW->horz_stretching & (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) - != (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Inconsistent panel horizontal dimension: %d and %d.\n", - pATI->LCDHorizontal, HDisplay); - HDisplay = pATI->LCDHorizontal; - } + ATILock(pATI); + ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } - if (!pATI->LCDVertical) - { - if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) || - !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) - pATI->LCDVertical = VDisplay; - } - else if (pATI->LCDVertical != VDisplay) - { - if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) || - !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Inconsistent panel vertical dimension: %d and %d.\n", - pATI->LCDVertical, VDisplay); - VDisplay = pATI->LCDVertical; - } + /* If the mode on entry wasn't stretched, adjust timings */ + if (!(pATIHW->horz_stretching & HORZ_STRETCH_EN) && + ((HDisplay = pATI->LCDHorizontal - HDisplay) > 0)) + { + if ((pATI->LCDHSyncStart -= HDisplay) < 0) + pATI->LCDHSyncStart = 0; + pATI->LCDHBlankWidth -= HDisplay; + HDisplay = pATI->LCDHSyncStart + pATI->LCDHSyncWidth; + if (pATI->LCDHBlankWidth < HDisplay) + pATI->LCDHBlankWidth = HDisplay; + } + + if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) && + ((VDisplay = pATI->LCDVertical - VDisplay) > 0)) + { + if ((pATI->LCDVSyncStart -= VDisplay) < 0) + pATI->LCDVSyncStart = 0; + pATI->LCDVBlankWidth -= VDisplay; + VDisplay = pATI->LCDVSyncStart + pATI->LCDVSyncWidth; + if (pATI->LCDVBlankWidth < VDisplay) + pATI->LCDVBlankWidth = VDisplay; + } - 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); + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "%dx%d panel (ID %d) detected.\n", + pATI->LCDHorizontal, pATI->LCDVertical, pATI->LCDPanelID); else - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to determine dimensions of panel.\n"); - - ATILock(pATI); - ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); - ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); - return FALSE; - } + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "%dx%d panel detected.\n", + pATI->LCDHorizontal, pATI->LCDVertical); - /* If the mode on entry wasn't stretched, adjust timings */ - if (!(pATIHW->horz_stretching & HORZ_STRETCH_EN) && - ((HDisplay = pATI->LCDHorizontal - HDisplay) > 0)) - { - if ((pATI->LCDHSyncStart -= HDisplay) < 0) - pATI->LCDHSyncStart = 0; - pATI->LCDHBlankWidth -= HDisplay; - HDisplay = pATI->LCDHSyncStart + pATI->LCDHSyncWidth; - if (pATI->LCDHBlankWidth < HDisplay) - pATI->LCDHBlankWidth = HDisplay; - } + 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; + } + } - if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) && - ((VDisplay = pATI->LCDVertical - VDisplay) > 0)) - { - if ((pATI->LCDVSyncStart -= VDisplay) < 0) - pATI->LCDVSyncStart = 0; - pATI->LCDVBlankWidth -= VDisplay; - VDisplay = pATI->LCDVSyncStart + pATI->LCDVSyncWidth; - if (pATI->LCDVBlankWidth < VDisplay) - pATI->LCDVBlankWidth = VDisplay; - } + /* + * Determine panel clock. This must be done after option + * processing so that the adapter's reference frequency is always + * available. + * + * Get post divider. A GCC bug has caused the following expression + * to be broken down into its individual components. + */ + ClockMask = PLL_VCLK0_XDIV << pATIHW->clock; + PostMask = PLL_VCLK0_POST_DIV << (pATIHW->clock * 2); + i = GetBits(ATIGetMach64PLLReg(PLL_XCLK_CNTL), ClockMask); + i *= MaxBits(PLL_VCLK0_POST_DIV) + 1; + i |= GetBits(ATIGetMach64PLLReg(PLL_VCLK_POST_DIV), PostMask); + + /* Calculate clock of mode on entry */ + Numerator = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV + pATIHW->clock) * + pATI->ReferenceNumerator; + Denominator = pATI->ClockDescriptor.MinM * + pATI->ReferenceDenominator * + pATI->ClockDescriptor.PostDividers[i]; + pATI->LCDClock = ATIDivide(Numerator, Denominator, 1, 0); - 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; - } - } + "Panel clock is %.3f MHz.\n", + (double)(pATI->LCDClock) / 1000.0); - /* - * Determine panel clock. This must be done after option processing so - * that the adapter's reference frequency is always available. - * - * Get post divider. A GCC bug has caused the following expression to - * be broken down into its individual components. - */ - ClockMask = PLL_VCLK0_XDIV << pATIHW->clock; - PostMask = PLL_VCLK0_POST_DIV << (pATIHW->clock * 2); - i = GetBits(ATIGetMach64PLLReg(PLL_XCLK_CNTL), ClockMask); - i *= MaxBits(PLL_VCLK0_POST_DIV) + 1; - i |= GetBits(ATIGetMach64PLLReg(PLL_VCLK_POST_DIV), PostMask); - - /* Calculate clock of mode on entry */ - Numerator = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV + pATIHW->clock) * - pATI->ReferenceNumerator; - Denominator = pATI->ClockDescriptor.MinM * pATI->ReferenceDenominator * - pATI->ClockDescriptor.PostDividers[i]; - 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 xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Using digital flat panel interface.\n"); + } } /* @@ -1943,157 +1977,189 @@ ATIPreInit #endif /* AVOID_CPIO */ { - /* Possibly set up for linear aperture */ - -#ifndef AVOID_CPIO - - if (pATI->OptionLinear) - -#endif /* AVOID_CPIO */ - + /* Get adapter's linear aperture configuration */ + pATIHW->config_cntl = inr(CONFIG_CNTL); + pATI->LinearBase = + GetBits(pATIHW->config_cntl, CFG_MEM_AP_LOC) << 22; + if ((pATIHW->config_cntl & CFG_MEM_AP_SIZE) != CFG_MEM_AP_SIZE) { - /* Get adapter's linear aperture configuration */ - pATIHW->config_cntl = inr(CONFIG_CNTL); - pATI->LinearBase = - GetBits(pATIHW->config_cntl, CFG_MEM_AP_LOC) << 22; - if ((pATIHW->config_cntl & CFG_MEM_AP_SIZE) != CFG_MEM_AP_SIZE) - { - pATI->LinearSize = - GetBits(pATIHW->config_cntl, CFG_MEM_AP_SIZE) << 22; + pATI->LinearSize = + GetBits(pATIHW->config_cntl, CFG_MEM_AP_SIZE) << 22; - /* - * Linear aperture could have been disabled (but still - * assigned) by BIOS initialisation. - */ - if (pATI->LinearBase && !pATI->LinearSize) - { - if (pATI->VideoRAM < 4096) - pATI->LinearSize = 4 * 1024 * 1024; - else - pATI->LinearSize = 8 * 1024 * 1024; - } + /* + * Linear aperture could have been disabled (but still + * assigned) by BIOS initialisation. + */ + if (pATI->LinearBase && !pATI->LinearSize) + { + if (pATI->VideoRAM < 4096) + pATI->LinearSize = 4 * 1024 * 1024; + else + pATI->LinearSize = 8 * 1024 * 1024; } + } #ifndef AVOID_CPIO - /* Except for PCI & AGP, allow for user override */ - if (!pATI->PCIInfo) - { - if (pATI->Chip == ATI_CHIP_88800CX) - IOValue = ~((CARD32)((1 << 23) - 1)); - else if (pATI->Chip >= ATI_CHIP_88800GXE) - IOValue = ~((CARD32)((1 << 24) - 1)); - else if (pATI->VideoRAM >= 4096) - IOValue = ~((CARD32)((1 << 23) - 1)); - else - IOValue = ~((CARD32)((1 << 22) - 1)); + /* Except for PCI & AGP, allow for user override */ + if (!pATI->PCIInfo) + { + if (pATI->Chip == ATI_CHIP_88800CX) + IOValue = ~((CARD32)((1 << 23) - 1)); + else if (pATI->Chip >= ATI_CHIP_88800GXE) + IOValue = ~((CARD32)((1 << 24) - 1)); + else if (pATI->VideoRAM >= 4096) + IOValue = ~((CARD32)((1 << 23) - 1)); + else + IOValue = ~((CARD32)((1 << 22) - 1)); - if ((IOValue &= pGDev->MemBase) && - (IOValue <= (MaxBits(CFG_MEM_AP_LOC) << 22))) - pATI->LinearBase = IOValue; + if ((IOValue &= pGDev->MemBase) && + (IOValue <= (MaxBits(CFG_MEM_AP_LOC) << 22))) + pATI->LinearBase = IOValue; - if (!pATI->LinearBase) - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Linear aperture not configured. Specify" - " \"MemBase\" override in XF86Config \"Device\"" - " section.\n"); - else + if (!pATI->LinearBase) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Linear aperture not configured. Specify \"MemBase\"" + " override in XF86Config \"Device\" section.\n"); + else + { + if (!pATI->LinearSize) { if (pATI->VideoRAM < 4096) pATI->LinearSize = 4 * 1024 * 1024; else pATI->LinearSize = 8 * 1024 * 1024; + } - Resources[0].type = ResExcMemBlock; - Resources[0].rBegin = pATI->LinearBase; - Resources[0].rEnd = pATI->LinearBase + - pATI->LinearSize - 1; - if (xf86RegisterResources(pATI->iEntity, Resources, - ResNone)) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Unable to register %d MB linear aperture at" - " 0x%08X.\n", pATI->LinearSize >> 10, - pATI->LinearBase); + Resources[0].type = ResExcMemBlock; + Resources[0].rBegin = pATI->LinearBase; + Resources[0].rEnd = + pATI->LinearBase + pATI->LinearSize - 1; + if (xf86RegisterResources(pATI->iEntity, Resources, + ResNone)) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Unable to register %d MB linear aperture at" + " 0x%08X.\n", pATI->LinearSize >> 10, + pATI->LinearBase); - pATI->LinearSize = 0; - } + pATI->LinearSize = 0; } } + } #endif /* AVOID_CPIO */ - if (!pATI->LinearBase || !pATI->LinearSize) + if (pATI->LinearBase && pATI->LinearSize) + { + /* + * Unless specified in PCI configuration space, set MMIO + * address to tail end of linear aperture. + */ + if (!pATI->Block0Base) { + pATI->Block0Base = + pATI->LinearBase + pATI->LinearSize - 0x00000400U; + pATI->MMIOInLinear = pATI->OptionAccel; + } -#ifndef AVOID_CPIO + AcceleratorVideoRAM = pATI->LinearSize >> 10; + + /* + * Account for MMIO area at the tail end of the linear + * aperture, if it is needed or if it cannot be disabled. + */ + if (pATI->MMIOInLinear || (pATI->Chip < ATI_CHIP_264VTB)) + AcceleratorVideoRAM -= 2; - if (pATI->VGAAdapter == ATI_ADAPTER_NONE) + ServerVideoRAM = pATI->VideoRAM; -#endif /* AVOID_CPIO */ + if (pATI->Cursor > ATI_CURSOR_SOFTWARE) + { + /* + * Allocate a 1 kB cursor image area at the top of the + * little-endian aperture, just before any MMIO area that + * might also be there. + */ + if (ServerVideoRAM > AcceleratorVideoRAM) + ServerVideoRAM = AcceleratorVideoRAM; - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "A linear aperture is not available through this" - " adapter.\n"); - ATILock(pATI); - ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); - ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); - return FALSE; - } + ServerVideoRAM--; + pATI->CursorOffset = ServerVideoRAM << 10; + pATI->CursorBase = pATI->LinearBase + pATI->CursorOffset; + + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "Storing hardware cursor image at 0x%08X.\n", + pATI->CursorBase); + } #ifndef AVOID_CPIO - /* Insurance */ - pATI->LinearBase = pATI->LinearSize = 0; + if (pATI->OptionLinear) #endif /* AVOID_CPIO */ - } - else { - /* - * Unless specified in PCI configuration space, set MMIO - * address to tail end of linear aperture. - */ - if (!pATI->Block0Base) - pATI->Block0Base = - pATI->LinearBase + pATI->LinearSize - 0x00000400U; - - AcceleratorVideoRAM = pATI->LinearSize >> 10; + CARD32 PageSize = getpagesize() >> 10; #if X_BYTE_ORDER == X_LITTLE_ENDIAN /* - * Account for MMIO area, if it cannot be disabled. This - * relinquishes the entire last page of the linear aperture - * to prevent the server from write-combining it. + * MMIO areas must be mmap()'ed separately to avoid write + * combining them. Thus, they might not end up still + * adjacent with the little-endian linear aperture after + * mmap()'ing. So, round down the linear aperture size to + * avoid an overlap. Any hardware cursor image area might + * not end up being write combined, but this seems + * preferable to further reducing the video memory size + * advertised to the server. + * + * XXX Ideally this should be dealt with in the os-support + * layer, i.e., it should be possible to reset a + * subarea's write combining after it has been + * mmap()'ed, but doing so currently causes the removal + * of write combining for the entire aperture. */ - if (pATI->Chip < ATI_CHIP_264VTB) - AcceleratorVideoRAM -= getpagesize() >> 10; + if (pATI->MMIOInLinear) + AcceleratorVideoRAM -= AcceleratorVideoRAM % PageSize; -#else /* if X_BYTE_ORDER == X_BIG_ENDIAN */ +#else /* if X_BYTE_ORDER != X_LITTLE_ENDIAN */ - /* Big-endian aperture is 8 MB higher */ + /* + * Big-endian apertures are 8 MB higher and don't contain + * an MMIO area. + */ pATI->LinearBase += 0x00800000U; + AcceleratorVideoRAM = pATI->LinearSize >> 10; #endif /* X_BYTE_ORDER */ - if (AcceleratorVideoRAM < pATI->VideoRAM) - { - pScreenInfo->videoRam = AcceleratorVideoRAM; - xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, - "Virtual resolutions will be limited to %d kB due" - " to linear aperture size.\n", - AcceleratorVideoRAM); - } + if (ServerVideoRAM > AcceleratorVideoRAM) + ServerVideoRAM = AcceleratorVideoRAM; + else if (AcceleratorVideoRAM > pATI->VideoRAM) + AcceleratorVideoRAM = pATI->VideoRAM; + + PageSize--; + AcceleratorVideoRAM = + (AcceleratorVideoRAM + PageSize) & ~PageSize; xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Using %d MB linear aperture at 0x%08X.\n", pATI->LinearSize >> 20, pATI->LinearBase); /* Only mmap what is needed */ - ApertureSize = pATI->LinearSize = pATI->VideoRAM * 1024; + ApertureSize = pATI->LinearSize = + AcceleratorVideoRAM << 10; + } + + if (ServerVideoRAM < pATI->VideoRAM) + { + pScreenInfo->videoRam = ServerVideoRAM; + xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, + "Virtual resolutions will be limited to %d kB\n due to" + " linear aperture size and/or placement of hardware" + " cursor image area.\n", + ServerVideoRAM); } } } @@ -2125,8 +2191,9 @@ ATIPreInit /* * Unless specified in PCI configuration space, or at the top of - * of a linear aperture, set MMIO address to the one just above the - * VGA aperture. This does not work on the CT (maybe others). + * of a little-endian linear aperture, set MMIO address to the one + * just above the VGA aperture. This does not work on the CT + * (maybe others). */ if (!pATI->Block0Base && ((pATI->Chip < ATI_CHIP_264CT) || @@ -2135,8 +2202,49 @@ ATIPreInit pATI->Block0Base = 0x000BFC00U; } + if (!pATI->OptionLinear) + pATI->LinearBase = 0; /* Not needed */ + +#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, + "Linear aperture not available.\n"); + ATILock(pATI); + ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } + +#ifndef AVOID_CPIO + + /* Insurance */ + pATI->LinearBase = pATI->LinearSize = 0; + #endif /* AVOID_CPIO */ + } + +#ifndef AVOID_CPIO + + if (!pATI->OptionAccel) + { + pATI->Block0Base = 0; /* Not needed */ + pATI->MMIOInLinear = FALSE; + } + else + +#endif + if (pATI->Block0Base) { xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, @@ -2219,6 +2327,14 @@ ATIPreInit #endif /* AVOID_CPIO */ + if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && !pATI->CursorBase) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Unable to store hardware cursor image. Reverting to software" + " cursor.\n"); + pATI->Cursor = ATI_CURSOR_SOFTWARE; + } + /* * Remap apertures. Must lock and re-unlock around this in case the * remapping fails. @@ -2368,7 +2484,7 @@ ATIPreInit if (pATI->OptionShadowFB) { - /* Until ShadowFB becomes a true screen wrapper... */ + /* Until ShadowFB becomes a true screen wrapper, if it ever does... */ #ifndef AVOID_CPIO diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c index 1c5db81b1..a7866b489 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.41 2001/02/14 22:04:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.42 2001/04/01 14:00:09 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -58,6 +58,32 @@ * largely ignored. */ +#ifdef XFree86LOADER + +/* + * The following exists to prevent the compiler from considering entry points + * defined in a separate module from being constants. + */ +static xf86PreInitProc * const volatile PreInitProc = ATIPreInit; +static xf86ScreenInitProc * const volatile ScreenInitProc = ATIScreenInit; +static xf86SwitchModeProc * const volatile SwitchModeProc = ATISwitchMode; +static xf86AdjustFrameProc * const volatile AdjustFrameProc = ATIAdjustFrame; +static xf86EnterVTProc * const volatile EnterVTProc = ATIEnterVT; +static xf86LeaveVTProc * const volatile LeaveVTProc = ATILeaveVT; +static xf86FreeScreenProc * const volatile FreeScreenProc = ATIFreeScreen; +static xf86ValidModeProc * const volatile ValidModeProc = ATIValidMode; + +#define ATIPreInit PreInitProc +#define ATIScreenInit ScreenInitProc +#define ATISwitchMode SwitchModeProc +#define ATIAdjustFrame AdjustFrameProc +#define ATIEnterVT EnterVTProc +#define ATILeaveVT LeaveVTProc +#define ATIFreeScreen FreeScreenProc +#define ATIValidMode ValidModeProc + +#endif + /* Used as a temporary buffer */ #define Identifier ((char *)(pATI->MMIOCache)) @@ -2248,26 +2274,6 @@ NoVGAWonder:; xf86LoaderReqSymLists(ATISymbols, NULL); -#ifndef ELFDEBUG - /* Workaround for possible loader bug */ -# define ATIPreInit \ - (xf86PreInitProc*) LoaderSymbol("ATIPreInit") -# define ATIScreenInit \ - (xf86ScreenInitProc*) LoaderSymbol("ATIScreenInit") -# define ATISwitchMode \ - (xf86SwitchModeProc*) LoaderSymbol("ATISwitchMode") -# define ATIAdjustFrame \ - (xf86AdjustFrameProc*)LoaderSymbol("ATIAdjustFrame") -# define ATIEnterVT \ - (xf86EnterVTProc*) LoaderSymbol("ATIEnterVT") -# define ATILeaveVT \ - (xf86LeaveVTProc*) LoaderSymbol("ATILeaveVT") -# define ATIFreeScreen \ - (xf86FreeScreenProc*) LoaderSymbol("ATIFreeScreen") -# define ATIValidMode \ - (xf86ValidModeProc*) LoaderSymbol("ATIValidMode") -#endif - #endif /* Attach device to screen */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h index aecd27ce4..a64dc31f9 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.15 2001/02/12 03:36:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.16 2001/03/25 05:32:09 tsi Exp $ */ /* * Copyright 1994 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -735,9 +735,23 @@ #define CRTC2_OFF_PITCH BlockIOTag(0x17u) /* LTPro */ #define CUR_CLR0 IOPortTag(0x0bu, 0x18u) #define CUR_CLR1 IOPortTag(0x0cu, 0x19u) +/* These are for both CUR_CLR0 and CUR_CLR1 */ +#define CUR_CLR_I 0x000000fful +#define CUR_CLR_B 0x0000ff00ul +#define CUR_CLR_G 0x00ff0000ul +#define CUR_CLR_R 0xff000000ul +#define CUR_CLR (CUR_CLR_R | CUR_CLR_G | CUR_CLR_B) #define CUR_OFFSET IOPortTag(0x0du, 0x1au) #define CUR_HORZ_VERT_POSN IOPortTag(0x0eu, 0x1bu) +#define CUR_HORZ_POSN 0x000007fful +/* ? 0x0000f800ul */ +#define CUR_VERT_POSN 0x07ff0000ul +/* ? 0xf8000000ul */ #define CUR_HORZ_VERT_OFF IOPortTag(0x0fu, 0x1cu) +#define CUR_HORZ_OFF 0x0000007ful +/* ? 0x0000ff80ul */ +#define CUR_VERT_OFF 0x007f0000ul +/* ? 0xff800000ul */ #define CONFIG_PANEL BlockIOTag(0x1du) /* LT */ #define PANEL_FORMAT 0x00000007ul /* ? 0x00000008ul */ @@ -1281,7 +1295,7 @@ /* DST_Y_X BlockIOTag(0x4du) */ /* Duplicate */ #define TRAIL_BRES_ERR BlockIOTag(0x4eu) /* GT */ #define TRAIL_BRES_INC BlockIOTag(0x4fu) /* GT */ -#define TRAIL_BRES_DEC BlockIOTag(0x50u) /* GT */ +#define TRAIL_BRES_DEC BlockIOTag(0x50u) /* GT */ #define LEAD_BRES_LNTH BlockIOTag(0x51u) /* GT */ #define Z_OFF_PITCH BlockIOTag(0x52u) /* GT */ #define Z_CNTL BlockIOTag(0x53u) /* GT */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c index 4b26de811..83c44c698 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.18 2001/02/15 18:04:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.19 2001/03/25 05:32:09 tsi Exp $ */ /* * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -22,7 +22,9 @@ */ #include "ati.h" +#include "atiaccel.h" #include "aticonsole.h" +#include "aticursor.h" #include "atidac.h" #include "atidga.h" #include "atimode.h" @@ -227,15 +229,16 @@ ATIScreenInit (void)ATIDGAInit(pScreenInfo, pScreen, pATI); /* Setup acceleration */ - if (!ATIModeAccelInit(pScreenInfo, pScreen, pATI)) + if (!ATIInitializeAcceleration(pScreenInfo, pScreen, pATI)) return FALSE; /* Initialise backing store */ miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); - /* Initialise software cursor */ - miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + /* Initialise cursor */ + if (!ATIInitializeCursor(pScreen, pATI)) + return FALSE; /* Create default colourmap */ if (!miCreateDefColormap(pScreen)) @@ -309,6 +312,12 @@ ATICloseScreen pATI->Closeable = FALSE; + if (pATI->pCursorInfo) + { + xf86DestroyCursorInfoRec(pATI->pCursorInfo); + pATI->pCursorInfo = NULL; + } + ATILeaveGraphics(pScreenInfo, pATI); xfree(pATI->ExpansionBitmapScanlinePtr[1]); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h index 07f78b8c9..9fe89bae4 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.24 2001/01/21 21:19:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.25 2001/03/25 05:32:09 tsi Exp $ */ /* * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -28,6 +28,7 @@ #include "aticlock.h" #include "atiregs.h" +#include "xf86Cursor.h" #include "xf86Resources.h" #include "xaa.h" @@ -83,8 +84,10 @@ typedef struct _ATIHWRec crtc_v_total_disp, crtc_v_sync_strt_wid, crtc_off_pitch, crtc_gen_cntl, dsp_config, dsp_on_off, ovr_clr, ovr_wid_left_right, ovr_wid_top_bottom, - clock_cntl, bus_cntl, mem_vga_wp_sel, mem_vga_rp_sel, - dac_cntl, config_cntl; + cur_clr0, cur_clr1, cur_offset, + cur_horz_vert_posn, cur_horz_vert_off, + clock_cntl, bus_cntl, mem_cntl, mem_vga_wp_sel, mem_vga_rp_sel, + dac_cntl, gen_test_cntl, config_cntl; /* LCD registers */ CARD32 lcd_index, config_panel, lcd_gen_ctrl, @@ -234,6 +237,10 @@ typedef struct _ATIRec #ifndef AVOID_CPIO + /* + * Banking interface. + */ + miBankInfoRec BankInfo; pointer pBank; CARD8 UseSmallApertures; @@ -245,15 +252,6 @@ typedef struct _ATIRec pointer pMMIO, pBlock[2]; unsigned long Block0Base, Block1Base; -#ifndef AVOID_CPIO - - /* - * Banking interface. - */ - miBankInfoRec BankInfo; - -#endif /* AVOID_CPIO */ - /* * XAA interface. */ @@ -268,6 +266,16 @@ typedef struct _ATIRec int ExpansionBitmapWidth; /* + * Cursor-related definitions. + */ + xf86CursorInfoPtr pCursorInfo; + pointer pCursorPage, pCursorImage; + unsigned long CursorBase; + CARD32 CursorOffset; + CARD16 CursorXOffset, CursorYOffset; + CARD8 Cursor; + + /* * MMIO cache. */ CARD32 MMIOCache[CacheSlotOf(DWORD_SELECT) + 1]; @@ -364,7 +372,13 @@ typedef struct _ATIRec CARD8 OptionCRT; /* Prefer CRT over digital panel */ CARD8 OptionCSync; /* Use composite sync */ CARD8 OptionDevel; /* Intentionally undocumented */ + +#ifndef AVOID_CPIO + CARD8 OptionLinear; /* Use linear fb aperture when available */ + +#endif /* AVOID_CPIO */ + CARD8 OptionMMIOCache; /* Cache MMIO writes */ CARD8 OptionProbeClocks; /* Force probe for fixed clocks */ CARD8 OptionShadowFB; /* Use shadow frame buffer */ @@ -374,6 +388,7 @@ typedef struct _ATIRec * State flags. */ CARD8 Unlocked, Mapped, Closeable; + CARD8 MMIOInLinear; /* * Wrapped functions. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h index beefcab3d..86036b8d2 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.31 2001/02/12 04:32:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.33 2001/04/01 14:00:09 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -27,11 +27,11 @@ #define ATI_NAME "ATI" #define ATI_DRIVER_NAME "ati" -#define ATI_VERSION_NAME "6.2.5" +#define ATI_VERSION_NAME "6.3.1" #define ATI_VERSION_MAJOR 6 -#define ATI_VERSION_MINOR 2 -#define ATI_VERSION_PATCH 5 +#define ATI_VERSION_MINOR 3 +#define ATI_VERSION_PATCH 1 #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/ativgaio.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h index 1e7fafd75..ae5884619 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.3 2001/03/25 05:32:09 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -49,7 +49,7 @@ extern void ATISetVGAIOBase FunctionPrototype((ATIPtr, const CARD8)); { \ outb(_Register, _Index); \ outb((_Register) + 1, _Value); \ - } while(0) + } while (0) #endif /* AVOID_CPIO */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c index dcc967bbc..58991c1f4 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.11 2001/01/06 20:58:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.12 2001/03/25 05:32:09 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -101,8 +101,6 @@ ATIUnmapLinear ATIPtr pATI ) { - unsigned long PageSize; - int LinearSize; #ifdef AVOID_CPIO @@ -116,13 +114,7 @@ ATIUnmapLinear #endif /* AVOID_CPIO */ { - PageSize = getpagesize(); - LinearSize = pATI->LinearSize; - if (((pATI->Block0Base | (PageSize - 1)) + 1) == - (pATI->LinearBase + LinearSize)) - LinearSize -= PageSize; - - xf86UnMapVidMem(iScreen, pATI->pMemory, LinearSize); + xf86UnMapVidMem(iScreen, pATI->pMemory, pATI->LinearSize); } pATI->pMemory = NULL; @@ -147,6 +139,24 @@ ATIUnmapMMIO } /* + * ATIUnmapCursor -- + * + * Unmap hardware cursor image area. + */ +static void +ATIUnmapCursor +( + int iScreen, + ATIPtr pATI +) +{ + if (pATI->pCursorPage) + xf86UnMapVidMem(iScreen, pATI->pCursorPage, getpagesize()); + + pATI->pCursorPage = pATI->pCursorImage = NULL; +} + +/* * ATIMapApertures -- * * This function maps all apertures used by the driver. @@ -160,8 +170,7 @@ ATIMapApertures { pciVideoPtr pVideo; PCITAG Tag; - unsigned long PageSize, MMIOBase; - int LinearSize; + unsigned long PageSize; if (pATI->Mapped) return TRUE; @@ -178,10 +187,6 @@ ATIMapApertures } 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; @@ -221,10 +226,10 @@ ATIMapApertures { if (pVideo) pATI->pMemory = xf86MapPciMem(iScreen, VIDMEM_FRAMEBUFFER, - Tag, pATI->LinearBase, LinearSize); + Tag, pATI->LinearBase, pATI->LinearSize); else pATI->pMemory = xf86MapVidMem(iScreen, VIDMEM_FRAMEBUFFER, - pATI->LinearBase, LinearSize); + pATI->LinearBase, pATI->LinearSize); if (!pATI->pMemory) { @@ -240,11 +245,22 @@ ATIMapApertures } pATI->Mapped = TRUE; + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + if ((pATI->CursorBase >= pATI->LinearBase) && + ((pATI->CursorOffset + 0x00000400UL) <= (CARD32)pATI->LinearSize)) + pATI->pCursorImage = (char *)pATI->pMemory + pATI->CursorOffset; + +#endif /* X_BYTE_ORDER */ + } /* Map MMIO aperture */ if (pATI->Block0Base) { + unsigned long MMIOBase = pATI->Block0Base & ~(PageSize - 1); + if (pVideo) pATI->pMMIO = xf86MapPciMem(iScreen, VIDMEM_MMIO, Tag, MMIOBase, PageSize); @@ -254,6 +270,13 @@ ATIMapApertures if (!pATI->pMMIO) { + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + ATIUnmapCursor(iScreen, pATI); + +#endif /* X_BYTE_ORDER */ + ATIUnmapLinear(iScreen, pATI); #ifndef AVOID_CPIO @@ -273,6 +296,51 @@ ATIMapApertures if (pATI->Block1Base) pATI->pBlock[1] = (char *)pATI->pBlock[0] - 0x00000400U; + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + if (!pATI->pCursorImage) + +#endif /* X_BYTE_ORDER */ + + { + if ((pATI->CursorBase >= MMIOBase) && + ((pATI->CursorBase + 0x00000400UL) <= (MMIOBase + PageSize))) + pATI->pCursorImage = (char *)pATI->pMMIO + + (pATI->CursorBase - MMIOBase); + } + } + + /* Map hardware cursor image area */ + if (pATI->CursorBase && !pATI->pCursorImage) + { + unsigned long CursorBase = pATI->CursorBase & ~(PageSize - 1); + + if (pVideo) + pATI->pCursorPage = xf86MapPciMem(iScreen, VIDMEM_FRAMEBUFFER, + Tag, CursorBase, PageSize); + else + pATI->pCursorPage = xf86MapVidMem(iScreen, VIDMEM_FRAMEBUFFER, + CursorBase, PageSize); + + if (!pATI->pCursorPage) + { + ATIUnmapCursor(iScreen, pATI); + ATIUnmapMMIO(iScreen, pATI); + ATIUnmapLinear(iScreen, pATI); + +#ifndef AVOID_CPIO + + ATIUnmapVGA(iScreen, pATI); + +#endif /* AVOID_CPIO */ + + pATI->Mapped = FALSE; + return FALSE; + } + + pATI->pCursorImage = (char *)pATI->pCursorPage + + (pATI->CursorBase - CursorBase); } return TRUE; @@ -294,6 +362,9 @@ ATIUnmapApertures return; pATI->Mapped = FALSE; + /* Unmap hardware cursor image area */ + ATIUnmapCursor(iScreen, pATI); + /* Unmap MMIO area */ ATIUnmapMMIO(iScreen, pATI); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c index 6cc71a9ce..ffb5fe0d2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.6 2000/12/22 05:27:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.8 2001/03/03 22:26:09 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -402,7 +402,7 @@ static void R128SetupForDashedLine(ScrnInfoPtr pScrn, { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - CARD32 pat = *(CARD32 *)pattern; + CARD32 pat = *(CARD32 *)(pointer)pattern; #ifdef XF86DRI R128CCE_TO_MMIO(pScrn, info); @@ -820,13 +820,13 @@ static void R128SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, OUTREG(R128_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31)); } -/* Subsequent XAA indirect CPU-to-screen color expandion. This is called +/* Subsequent XAA indirect CPU-to-screen color expansion. This is called once for each scanline. */ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - CARD32 *p = (CARD32 *)info->scratch_buffer[bufno]; + CARD32 *p = (pointer)info->scratch_buffer[bufno]; int i; int left = info->scanline_words; volatile CARD32 *d; @@ -838,6 +838,9 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) if (info->scanline_direct) return; --info->scanline_h; while (left) { +#if defined(__alpha__) + write_mem_barrier(); +#endif if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { @@ -967,7 +970,7 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - CARD32 *p = (CARD32 *)info->scratch_buffer[bufno]; + CARD32 *p = (pointer)info->scratch_buffer[bufno]; int i; int left = info->scanline_words; volatile CARD32 *d; @@ -979,6 +982,9 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) if (info->scanline_direct) return; --info->scanline_h; while (left) { +#if defined(__alpha__) + write_mem_barrier(); +#endif if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c index 44b90300e..4b52c8d25 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.4 2000/12/22 05:27:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.5 2001/03/03 22:26:09 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -107,8 +107,8 @@ static void R128LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - CARD32 *s = (CARD32 *)image; - CARD32 *d = (CARD32 *)(info->FB + info->cursor_start); + CARD32 *s = (pointer)image; + CARD32 *d = (pointer)(info->FB + info->cursor_start); int y; CARD32 save; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c index 0e9b67bf5..3127aff1d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.9 2001/01/08 01:07:34 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.12 2001/03/21 19:46:26 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -576,6 +576,8 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) OUTREG(R128_AGP_BASE, info->ringHandle); /* Ring buf is at AGP offset 0 */ OUTREG(R128_AGP_CNTL, cntl); + xf86EnablePciBusMaster(info->PciInfo, TRUE); + return TRUE; } @@ -735,10 +737,10 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) /* Check the DRI version */ DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "R128DRIScreenInit failed " - "(DRI version = %d.%d.%d, expected 3.1.x). " + "(DRI version = %d.%d.%d, expected 4.0.x). " "Disabling DRI.\n", major, minor, patch); return FALSE; @@ -817,6 +819,9 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = R128DRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) { xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed!\n"); xfree(pDRIInfo->devPrivate); @@ -830,8 +835,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) version = drmGetVersion(info->drmFD); if (version) { if (version->version_major != 2 || - version->version_minor != 1 || - version->version_patchlevel < 0) { + version->version_minor < 1) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "R128DRIScreenInit failed " @@ -954,6 +958,7 @@ Bool R128DRIFinishScreenInit(ScreenPtr pScreen) pR128DRI->agpTexMapSize = info->agpTexMapSize; pR128DRI->log2AGPTexGran = info->log2AGPTexGran; pR128DRI->agpTexOffset = info->agpTexStart; + pR128DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); return TRUE; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h index 733bbd6e7..5ef9cdfee 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.5 2001/01/08 01:07:34 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.6 2001/03/21 17:02:21 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -45,7 +45,7 @@ /* DRI Driver defaults */ #define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM #define R128_DEFAULT_CCE_BM_MODE R128_PM4_64BM_64VCBM_64INDBM -#define R128_DEFAULT_AGP_MODE 2 +#define R128_DEFAULT_AGP_MODE 1 #define R128_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */ #define R128_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */ #define R128_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */ @@ -96,6 +96,7 @@ typedef struct { drmSize agpTexMapSize; int log2AGPTexGran; int agpTexOffset; + unsigned int sarea_priv_offset; } R128DRIRec, *R128DRIPtr; #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c index ebbb43a35..0dae469be 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.22 2001/02/15 11:03:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.25 2001/04/03 17:10:36 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -107,6 +107,8 @@ #define MAX(a,b) ((a)>(b)?(a):(b)) #endif +#define USE_CRT_ONLY 0 + /* Forward definitions for driver functions */ static Bool R128CloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool R128SaveScreen(ScreenPtr pScreen, int mode); @@ -134,6 +136,10 @@ typedef enum { OPTION_BUFFER_SIZE, OPTION_USE_CCE_2D, #endif +#if USE_CRT_ONLY + /* FIXME: Disable CRTOnly until it is tested */ + OPTION_CRT, +#endif OPTION_BIOS_DISPLAY, OPTION_PANEL_WIDTH, OPTION_PANEL_HEIGHT, @@ -1418,7 +1424,8 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) if (!R128GetPLLParameters(pScrn)) goto fail; - if (!R128PreInitDDC(pScrn, pInt10)) goto fail; + /* Don't fail on this one */ + R128PreInitDDC(pScrn, pInt10); if (!R128PreInitGamma(pScrn)) goto fail; @@ -1534,6 +1541,7 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; R128InfoPtr info = R128PTR(pScrn); BoxRec MemBox; + int y2; R128TRACE(("R128ScreenInit %x %d\n", pScrn->memPhysBase, pScrn->fbOffset)); @@ -1844,13 +1852,14 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) MemBox.x1 = 0; MemBox.y1 = 0; MemBox.x2 = pScrn->displayWidth; - MemBox.y2 = (info->FbMapSize + y2 = (info->FbMapSize / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes)); /* The acceleration engine uses 14 bit signed coordinates, so we can't have any drawable caches beyond this region. */ - if (MemBox.y2 > 8191) MemBox.y2 = 8191; + if (y2 > 8191) y2 = 8191; + MemBox.y2 = y2; if (!xf86InitFBManager(pScreen, &MemBox)) { xf86DrvMsg(scrnIndex, X_ERROR, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c index 520ec36d9..39921b245 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.8 2001/02/12 04:24:24 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.9 2001/04/01 14:00:09 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -48,6 +48,32 @@ #include "xf86_ansic.h" #include "xf86Resources.h" +#ifdef XFree86LOADER + +/* + * The following exists to prevent the compiler from considering entry points + * defined in a separate module from being constants. + */ +static xf86PreInitProc * const volatile PreInitProc = R128PreInit; +static xf86ScreenInitProc * const volatile ScreenInitProc = R128ScreenInit; +static xf86SwitchModeProc * const volatile SwitchModeProc = R128SwitchMode; +static xf86AdjustFrameProc * const volatile AdjustFrameProc = R128AdjustFrame; +static xf86EnterVTProc * const volatile EnterVTProc = R128EnterVT; +static xf86LeaveVTProc * const volatile LeaveVTProc = R128LeaveVT; +static xf86FreeScreenProc * const volatile FreeScreenProc = R128FreeScreen; +static xf86ValidModeProc * const volatile ValidModeProc = R128ValidMode; + +#define R128PreInit PreInitProc +#define R128ScreenInit ScreenInitProc +#define R128SwitchMode SwitchModeProc +#define R128AdjustFrame AdjustFrameProc +#define R128EnterVT EnterVTProc +#define R128LeaveVT LeaveVTProc +#define R128FreeScreen FreeScreenProc +#define R128ValidMode ValidModeProc + +#endif + SymTabRec R128Chipsets[] = { { PCI_CHIP_RAGE128RE, "ATI Rage 128 RE (PCI)" }, { PCI_CHIP_RAGE128RF, "ATI Rage 128 RF (AGP)" }, @@ -166,6 +192,7 @@ R128Probe(DriverPtr drv, int flags) ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); #ifdef XFree86LOADER + if (!xf86LoadSubModule(pScrn, "r128")) { xf86Msg(X_ERROR, R128_NAME ": Failed to load \"r128\" module.\n"); @@ -175,26 +202,6 @@ R128Probe(DriverPtr drv, int flags) xf86LoaderReqSymLists(R128Symbols, NULL); -#ifndef ELFDEBUG - /* Workaround for possible loader bug */ -# define R128PreInit \ - (xf86PreInitProc*) LoaderSymbol("R128PreInit") -# define R128ScreenInit \ - (xf86ScreenInitProc*) LoaderSymbol("R128ScreenInit") -# define R128SwitchMode \ - (xf86SwitchModeProc*) LoaderSymbol("R128SwitchMode") -# define R128AdjustFrame \ - (xf86AdjustFrameProc*)LoaderSymbol("R128AdjustFrame") -# define R128EnterVT \ - (xf86EnterVTProc*) LoaderSymbol("R128EnterVT") -# define R128LeaveVT \ - (xf86LeaveVTProc*) LoaderSymbol("R128LeaveVT") -# define R128FreeScreen \ - (xf86FreeScreenProc*) LoaderSymbol("R128FreeScreen") -# define R128ValidMode \ - (xf86ValidModeProc*) LoaderSymbol("R128ValidMode") -#endif - #endif pScrn->driverVersion = R128_VERSION_CURRENT; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h index e9d584ab9..b2620ae0a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.9 2001/01/16 05:11:07 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.10 2001/03/03 22:26:09 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -59,7 +59,7 @@ #define OUTREG16(addr, val) MMIO_OUT16(R128MMIO, addr, val) #define OUTREG(addr, val) MMIO_OUT32(R128MMIO, addr, val) -#define ADDRREG(addr) ((volatile CARD32 *)(R128MMIO + (addr))) +#define ADDRREG(addr) ((volatile CARD32 *)(pointer)(R128MMIO + (addr))) #define OUTREGP(addr, val, mask) \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c index f532e15cd..586eec9d4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.17 2001/01/25 02:26:00 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.18 2001/03/03 22:26:10 tsi Exp $ */ #include "r128.h" #include "r128_reg.h" @@ -37,7 +37,7 @@ static int R128QueryImageAttributes(ScrnInfoPtr, int, unsigned short *, static void R128ResetVideo(ScrnInfoPtr); -static void R128VideoTimerCallback(ScrnInfoPtr pScrn, Time time); +static void R128VideoTimerCallback(ScrnInfoPtr pScrn, Time now); #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) @@ -253,8 +253,8 @@ RegionsEqual(RegionPtr A, RegionPtr B) (A->extents.y2 != B->extents.y2)) return FALSE; - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); + dataA = (pointer)REGION_RECTS(A); + dataB = (pointer)REGION_RECTS(B); while(num--) { if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) @@ -953,21 +953,21 @@ R128QueryImageAttributes( } static void -R128VideoTimerCallback(ScrnInfoPtr pScrn, Time time) +R128VideoTimerCallback(ScrnInfoPtr pScrn, Time now) { R128InfoPtr info = R128PTR(pScrn); R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr; if(pPriv->videoStatus & TIMER_MASK) { if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < time) { + if(pPriv->offTime < now) { unsigned char *R128MMIO = info->MMIO; OUTREG(R128_OV0_SCALE_CNTL, 0); pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = time + FREE_DELAY; + pPriv->freeTime = now + FREE_DELAY; } } else { /* FREE_TIMER */ - if(pPriv->freeTime < time) { + if(pPriv->freeTime < now) { if(pPriv->linear) { xf86FreeOffscreenLinear(pPriv->linear); pPriv->linear = NULL; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h index a527234d7..c1b50ace9 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.13 2001/01/21 21:19:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.16 2001/03/25 05:32:09 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -58,6 +58,11 @@ #include "GL/glxint.h" #endif + /* Render support */ +#ifdef RENDER +#include "picturestr.h" +#endif + #define RADEON_DEBUG 0 /* Turn off debugging output */ #define RADEON_TIMEOUT 2000000 /* Fall out of wait loops after this count */ #define RADEON_MMIOSIZE 0x80000 @@ -358,6 +363,10 @@ typedef struct { CARD32 re_width_height; CARD32 aux_sc_cntl; + +#ifdef PER_CONTEXT_SAREA + int perctx_sarea_size; +#endif #endif XF86VideoAdaptorPtr adaptor; @@ -474,7 +483,7 @@ do { \ (n) * (int)sizeof(CARD32) > RING_THRESHOLD ) { \ RADEONCPFlushIndirect( pScrn ); \ } \ - __head = (CARD32 *)((char *)info->indirectBuffer->address + \ + __head = (pointer)((char *)info->indirectBuffer->address + \ info->indirectBuffer->used); \ __count = 0; \ } while (0) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c index bdb30cd74..55c481090 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.9 2001/01/21 21:19:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.13 2001/03/28 20:08:22 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -476,7 +476,7 @@ static void RADEONSetupForDashedLine(ScrnInfoPtr pScrn, { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 pat = *(CARD32 *)pattern; + CARD32 pat = *(CARD32 *)(pointer)pattern; switch (length) { case 2: pat |= pat << 2; /* fall through */ @@ -723,7 +723,13 @@ static void RADEONSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr info->scanline_h = h; info->scanline_words = (w + 31) >> 5; - if ((info->scanline_words * h) <= 9) { +#ifdef __alpha__ + /* always use indirect for Alpha */ + if (0) +#else + if ((info->scanline_words * h) <= 9) +#endif + { /* Turn on direct for less than 9 dword colour expansion */ info->scratch_buffer[0] = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST) @@ -745,13 +751,13 @@ static void RADEONSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31)); } -/* Subsequent XAA indirect CPU-to-screen color expandion. This is called +/* Subsequent XAA indirect CPU-to-screen color expansion. This is called once for each scanline. */ static void RADEONSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 *p = (CARD32 *)info->scratch_buffer[bufno]; + CARD32 *p = (pointer)info->scratch_buffer[bufno]; int i; int left = info->scanline_words; volatile CARD32 *d; @@ -759,6 +765,7 @@ static void RADEONSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) if (info->scanline_direct) return; --info->scanline_h; while (left) { + write_mem_barrier(); if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { @@ -836,7 +843,13 @@ static void RADEONSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, info->scanline_h = h; info->scanline_words = (w * info->scanline_bpp + 31) >> 5; - if ((info->scanline_words * h) <= 9) { +#ifdef __alpha__ + /* always use indirect for Alpha */ + if (0) +#else + if ((info->scanline_words * h) <= 9) +#endif + { /* Turn on direct for less than 9 dword colour expansion */ info->scratch_buffer[0] = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST) @@ -864,7 +877,7 @@ static void RADEONSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 *p = (CARD32 *)info->scratch_buffer[bufno]; + CARD32 *p = (pointer)info->scratch_buffer[bufno]; int i; int left = info->scanline_words; volatile CARD32 *d; @@ -872,6 +885,7 @@ static void RADEONSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) if (info->scanline_direct) return; --info->scanline_h; while (left) { + write_mem_barrier(); if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c index fe218e760..1cf9a2bc6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.4 2000/12/22 05:27:47 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.5 2001/03/03 22:26:10 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -109,8 +109,8 @@ static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 *s = (CARD32 *)image; - CARD32 *d = (CARD32 *)(info->FB + info->cursor_start); + CARD32 *s = (pointer)image; + CARD32 *d = (pointer)(info->FB + info->cursor_start); int y; CARD32 save; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c index ead827483..407757ef8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.4 2001/01/21 21:19:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.10 2001/04/01 14:00:09 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -244,7 +244,36 @@ static Bool RADEONCreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore) { - /* Nothing yet */ +#ifdef PER_CONTEXT_SAREA + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONDRIContextPtr ctx_info; + + ctx_info = (RADEONDRIContextPtr)contextStore; + if (!ctx_info) return FALSE; + + if (drmAddMap(info->drmFD, 0, + info->perctx_sarea_size, + DRM_SHM, + DRM_REMOVABLE, + &ctx_info->sarea_handle) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[DRI] could not create private sarea for ctx id (%d)\n", + (int)hwContext); + return FALSE; + } + + if (drmAddContextPrivateMapping(info->drmFD, hwContext, + ctx_info->sarea_handle) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[DRI] could not associate private sarea to ctx id (%d)\n", + (int)hwContext); + drmRmMap(info->drmFD, ctx_info->sarea_handle); + return FALSE; + } + + ctx_info->ctx_id = hwContext; +#endif return TRUE; } @@ -252,7 +281,20 @@ static Bool RADEONCreateContext(ScreenPtr pScreen, VisualPtr visual, static void RADEONDestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore) { - /* Nothing yet */ +#ifdef PER_CONTEXT_SAREA + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONDRIContextPtr ctx_info; + + ctx_info = (RADEONDRIContextPtr) contextStore; + if (!ctx_info) return; + + if (drmRmMap(info->drmFD, ctx_info->sarea_handle) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[DRI] could not remove private sarea for ctx id (%d)\n", + (int)hwContext); + } +#endif } /* Called when the X server is woken up to allow the last client's @@ -333,7 +375,7 @@ static CARD32 radeon_mba_z16(RADEONInfoPtr info, address |= (ba & 0x3) << 8; /* a[8..9] = ba[0..1] */ address |= (y & 0x8) << 7; /* a[10] = y[3] */ address |= ((x & 0x10) ^ (y & 0x10)) << 7; /* a[11] = x[4] ^ y[4] */ - address |= (ba & ~0x3) << 10; /* a[12..] = ba[2..] */ + address |= (ba & ~0x3u) << 10; /* a[12..] = ba[2..] */ return address; } @@ -355,29 +397,30 @@ static CARD32 radeon_mba_z32(RADEONInfoPtr info, address |= (y & 0x8) << 7; /* a[10] = y[3] */ address |= (((x & 0x8) << 1) ^ (y & 0x10)) << 7; /* a[11] = x[3] ^ y[4] */ - address |= (ba & ~0x3) << 10; /* a[12..] = ba[2..] */ + address |= (ba & ~0x3u) << 10; /* a[12..] = ba[2..] */ return address; } /* 16-bit depth buffer functions */ #define WRITE_DEPTH16(_x, _y, d) \ - *(CARD16 *)(buf + radeon_mba_z16(info, (_x), (_y))) = (d) + *(CARD16 *)(pointer)(buf + radeon_mba_z16(info, (_x), (_y))) = (d) #define READ_DEPTH16(d, _x, _y) \ - (d) = *(CARD16 *)(buf + radeon_mba_z16(info, (_x), (_y))) + (d) = *(CARD16 *)(pointer)(buf + radeon_mba_z16(info, (_x), (_y))) /* 24 bit depth, 8 bit stencil depthbuffer functions */ #define WRITE_DEPTH32(_x, _y, d) \ do { \ - CARD32 tmp = *(CARD32 *)(buf + radeon_mba_z32(info, (_x), (_y))); \ + CARD32 tmp = \ + *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))); \ tmp &= 0xff000000; \ tmp |= ((d) & 0x00ffffff); \ - *(CARD32 *)(buf + radeon_mba_z32(info, (_x), (_y))) = tmp; \ + *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))) = tmp; \ } while (0) #define READ_DEPTH32(d, _x, _y) \ - d = *(CARD32 *)(buf + radeon_mba_z32(info, (_x), (_y))) & 0x00ffffff + d = *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))) & 0x00ffffff /* Screen to screen copy of data in the depth buffer */ static void RADEONScreenToScreenCopyDepth(ScrnInfoPtr pScrn, @@ -428,15 +471,27 @@ static void RADEONDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx) RADEONSAREAPrivPtr pSAREAPriv; BoxPtr pbox; int nbox; - int depth; + unsigned int color, depth; + unsigned int color_mask, depth_mask; /* FIXME: This should be based on the __GLXvisualConfig info */ + color = 0; switch (pScrn->bitsPerPixel) { - case 8: depth = 0x000000ff; break; - case 16: depth = 0x0000ffff; break; - case 24: depth = 0x00ffffff; break; - case 32: depth = 0xffffffff; break; - default: depth = 0x00000000; break; + case 16: + depth = 0x0000ffff; + color_mask = 0x0000ffff; + depth_mask = 0xffffffff; + break; + case 32: + depth = 0x00ffffff; + color_mask = 0xffffffff; + depth_mask = 0xffffffff; + break; + default: + depth = 0x00000000; + color_mask = 0x00000000; + depth_mask = 0x00000000; + break; } /* FIXME: Copy XAAPaintWindow() and use REGION_TRANSLATE() */ @@ -464,11 +519,8 @@ static void RADEONDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx) ret = drmRadeonClear(info->drmFD, DRM_RADEON_BACK | DRM_RADEON_DEPTH, - pbox->x1, - pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1, - 0, depth); + color, depth, color_mask, depth_mask, + pSAREAPriv->boxes, pSAREAPriv->nbox); if (ret) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DRIInitBuffers timed out, resetting engine...\n"); @@ -803,9 +855,7 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) /* Enable bus mastering in PCI config space */ - info->pciCommand = pciReadLong(info->PciTag, PCI_CMD_STAT_REG); - pciWriteLong(info->PciTag, PCI_CMD_STAT_REG, - info->pciCommand | PCI_CMD_MASTER_ENABLE); + xf86EnablePciBusMaster(info->PciInfo, TRUE); return TRUE; } @@ -1028,9 +1078,10 @@ static void RADEONDRISAREAInit(ScreenPtr pScreen, ctx->pp_rot_matrix_0 = 0x00000000; ctx->pp_rot_matrix_1 = 0x00000000; - ctx->rb3d_stencilrefmask = ((0x000 << RADEON_STENCIL_REF_SHIFT) | - (0x0ff << RADEON_STENCIL_MASK_SHIFT) | - (0x0ff << RADEON_STENCIL_WRITEMASK_SHIFT)); + ctx->rb3d_stencilrefmask = + (CARD32)((0x000 << RADEON_STENCIL_REF_SHIFT) | + (0x0ff << RADEON_STENCIL_MASK_SHIFT) | + (0x0ff << RADEON_STENCIL_WRITEMASK_SHIFT)); ctx->rb3d_ropcntl = 0x00000000; ctx->rb3d_planemask = 0xffffffff; @@ -1133,10 +1184,10 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) /* Check the DRI version */ DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "RADEONDRIScreenInit failed " - "(DRI version = %d.%d.%d, expected 3.1.x). " + "(DRI version = %d.%d.%d, expected 4.0.x). " "Disabling DRI.\n", major, minor, patch); return FALSE; @@ -1180,6 +1231,11 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) < RADEON_MAX_DRAWABLES ? SAREA_MAX_DRAWABLES : RADEON_MAX_DRAWABLES); +#ifdef PER_CONTEXT_SAREA + /* This is only here for testing per-context SAREAs. When used, the + magic number below would be properly defined in a header file. */ + info->perctx_sarea_size = 64 * 1024; +#endif #ifdef NOT_DONE /* FIXME: Need to extend DRI protocol to pass this size back to @@ -1215,6 +1271,9 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = RADEONDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) { xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed!\n"); xfree(pDRIInfo->devPrivate); @@ -1228,8 +1287,7 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) version = drmGetVersion(info->drmFD); if (version) { if (version->version_major != 1 || - version->version_minor != 0 || - version->version_patchlevel < 0) { + version->version_minor < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "RADEONDRIScreenInit failed " @@ -1323,6 +1381,7 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) /* Initialize the SAREA private data structure */ pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScreen); memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); + RADEONDRISAREAInit(pScreen, pSAREAPriv); pRADEONDRI = (RADEONDRIPtr)info->pDRIInfo->devPrivate; @@ -1357,6 +1416,13 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) pRADEONDRI->log2AGPTexGran = info->log2AGPTexGran; pRADEONDRI->agpTexOffset = info->agpTexStart; + pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); + +#ifdef PER_CONTEXT_SAREA + /* Set per-context SAREA size */ + pRADEONDRI->perctx_sarea_size = info->perctx_sarea_size; +#endif + return TRUE; } @@ -1405,9 +1471,6 @@ void RADEONDRICloseScreen(ScreenPtr pScreen) drmAgpRelease(info->drmFD); } - /* Restore PCI command register */ - pciWriteLong(info->PciTag, PCI_CMD_STAT_REG, info->pciCommand); - /* De-allocate all DRI resources */ DRICloseScreen(pScreen); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h index 41b5248ad..553d54526 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h,v 1.1 2001/01/08 01:07:35 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -43,7 +43,7 @@ /* DRI Driver defaults */ #define RADEON_DEFAULT_CP_PIO_MODE RADEON_CSQ_PRIPIO_INDPIO #define RADEON_DEFAULT_CP_BM_MODE RADEON_CSQ_PRIBM_INDBM -#define RADEON_DEFAULT_AGP_MODE 2 +#define RADEON_DEFAULT_AGP_MODE 1 #define RADEON_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */ #define RADEON_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */ #define RADEON_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */ @@ -96,6 +96,11 @@ typedef struct { drmSize agpTexMapSize; int log2AGPTexGran; int agpTexOffset; + unsigned int sarea_priv_offset; + +#ifdef PER_CONTEXT_SAREA + drmSize perctx_sarea_size; +#endif } RADEONDRIRec, *RADEONDRIPtr; #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h index 90898e534..351713e56 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h,v 1.1 2001/01/08 01:07:35 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -38,6 +38,8 @@ #define _RADEON_DRIPRIV_H_ #include "GL/glxint.h" +#include "xf86drm.h" +#include "xf86drmRadeon.h" #define RADEON_MAX_DRAWABLES 256 @@ -50,8 +52,13 @@ typedef struct { } RADEONConfigPrivRec, *RADEONConfigPrivPtr; typedef struct { +#ifdef PER_CONTEXT_SAREA + drmContext ctx_id; + drmHandle sarea_handle; +#else /* Nothing here yet */ int dummy; +#endif } RADEONDRIContextRec, *RADEONDRIContextPtr; #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c index 26049b328..0c2180602 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.15 2001/01/22 02:16:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.18 2001/04/03 17:10:36 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -1662,16 +1662,19 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Reserve space for textures */ info->textureOffset = (info->FbMapSize - info->textureSize + - RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN; + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN; /* Reserve space for the shared depth buffer */ info->depthOffset = (info->textureOffset - bufferSize + - RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN; + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN; info->depthPitch = pScrn->displayWidth; /* Reserve space for the shared back buffer */ info->backOffset = (info->depthOffset - bufferSize + - RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN; + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN; info->backPitch = pScrn->displayWidth; scanlines = info->backOffset / width_bytes - 1; @@ -1742,7 +1745,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* The acceleration engine uses 14 bit signed coordinates, so we can't have any drawable caches beyond this region. */ - if (y2 > 8191 ) y2 = 8191; + if (y2 > 8191) y2 = 8191; MemBox.y2 = y2; if (!xf86InitFBManager(pScreen, &MemBox)) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c index 1c0549d5e..e1fdb6c87 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.6 2001/01/06 20:19:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.7 2001/04/01 14:00:10 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -47,6 +47,32 @@ #include "xf86_ansic.h" #include "xf86Resources.h" +#ifdef XFree86LOADER + +/* + * The following exists to prevent the compiler from considering entry points + * defined in a separate module from being constants. + */ +static xf86PreInitProc * const volatile PreInitProc = RADEONPreInit; +static xf86ScreenInitProc * const volatile ScreenInitProc = RADEONScreenInit; +static xf86SwitchModeProc * const volatile SwitchModeProc = RADEONSwitchMode; +static xf86AdjustFrameProc * const volatile AdjustFrameProc = RADEONAdjustFrame; +static xf86EnterVTProc * const volatile EnterVTProc = RADEONEnterVT; +static xf86LeaveVTProc * const volatile LeaveVTProc = RADEONLeaveVT; +static xf86FreeScreenProc * const volatile FreeScreenProc = RADEONFreeScreen; +static xf86ValidModeProc * const volatile ValidModeProc = RADEONValidMode; + +#define RADEONPreInit PreInitProc +#define RADEONScreenInit ScreenInitProc +#define RADEONSwitchMode SwitchModeProc +#define RADEONAdjustFrame AdjustFrameProc +#define RADEONEnterVT EnterVTProc +#define RADEONLeaveVT LeaveVTProc +#define RADEONFreeScreen FreeScreenProc +#define RADEONValidMode ValidModeProc + +#endif + SymTabRec RADEONChipsets[] = { { PCI_CHIP_RADEON_QD, "ATI Radeon QD (AGP)" }, { PCI_CHIP_RADEON_QE, "ATI Radeon QE (AGP)" }, @@ -151,6 +177,7 @@ RADEONProbe(DriverPtr drv, int flags) ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); #ifdef XFree86LOADER + if (!xf86LoadSubModule(pScrn, "radeon")) { xf86Msg(X_ERROR, RADEON_NAME ": Failed to load \"radeon\" module.\n"); @@ -160,26 +187,6 @@ RADEONProbe(DriverPtr drv, int flags) xf86LoaderReqSymLists(RADEONSymbols, NULL); -#ifndef ELFDEBUG - /* Workaround for possible loader bug */ -# define RADEONPreInit \ - (xf86PreInitProc*) LoaderSymbol("RADEONPreInit") -# define RADEONScreenInit \ - (xf86ScreenInitProc*) LoaderSymbol("RADEONScreenInit") -# define RADEONSwitchMode \ - (xf86SwitchModeProc*) LoaderSymbol("RADEONSwitchMode") -# define RADEONAdjustFrame \ - (xf86AdjustFrameProc*)LoaderSymbol("RADEONAdjustFrame") -# define RADEONEnterVT \ - (xf86EnterVTProc*) LoaderSymbol("RADEONEnterVT") -# define RADEONLeaveVT \ - (xf86LeaveVTProc*) LoaderSymbol("RADEONLeaveVT") -# define RADEONFreeScreen \ - (xf86FreeScreenProc*) LoaderSymbol("RADEONFreeScreen") -# define RADEONValidMode \ - (xf86ValidModeProc*) LoaderSymbol("RADEONValidMode") -#endif - #endif pScrn->driverVersion = RADEON_VERSION_CURRENT; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h index 2b725913b..0d006dfa5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.6 2001/01/11 03:36:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.8 2001/03/21 17:02:22 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -69,7 +69,7 @@ #define OUTREG16(addr, val) MMIO_OUT16(RADEONMMIO, addr, val) #define OUTREG(addr, val) MMIO_OUT32(RADEONMMIO, addr, val) -#define ADDRREG(addr) ((volatile CARD32 *)(RADEONMMIO + (addr))) +#define ADDRREG(addr) ((volatile CARD32 *)(pointer)(RADEONMMIO + (addr))) #define OUTREGP(addr, val, mask) \ @@ -1073,36 +1073,36 @@ #define RADEON_PP_TXFORMAT_0 0x1c58 #define RADEON_PP_TXFORMAT_1 0x1c70 #define RADEON_PP_TXFORMAT_2 0x1c88 -# define RADEON_TXF_8BPP_I (0 << 0) -# define RADEON_TXF_16BPP_AI88 (1 << 0) -# define RADEON_TXF_8BPP_RGB332 (2 << 0) -# define RADEON_TXF_16BPP_ARGB1555 (3 << 0) -# define RADEON_TXF_16BPP_RGB565 (4 << 0) -# define RADEON_TXF_16BPP_ARGB4444 (5 << 0) -# define RADEON_TXF_32BPP_ARGB8888 (6 << 0) -# define RADEON_TXF_32BPP_RGBA8888 (7 << 0) -# define RADEON_TXF_8BPP_Y (8 << 0) -# define RADEON_TXF_FORMAT_MASK (31 << 0) -# define RADEON_TXF_FORMAT_SHIFT 0 -# define RADEON_TXF_APPLE_YUV_MODE (1 << 5) -# define RADEON_TXF_ALPHA_IN_MAP (1 << 6) -# define RADEON_TXF_NON_POWER2 (1 << 7) -# define RADEON_TXF_WIDTH_MASK (15 << 8) -# define RADEON_TXF_WIDTH_SHIFT 8 -# define RADEON_TXF_HEIGHT_MASK (15 << 12) -# define RADEON_TXF_HEIGHT_SHIFT 12 -# define RADEON_TXF_ST_ROUTE_STQ0 (0 << 24) -# define RADEON_TXF_ST_ROUTE_MASK (3 << 24) -# define RADEON_TXF_ST_ROUTE_STQ1 (1 << 24) -# define RADEON_TXF_ST_ROUTE_STQ2 (2 << 24) -# define RADEON_TXF_ENDIAN_NO_SWAP (0 << 26) -# define RADEON_TXF_ENDIAN_16BPP_SWAP (1 << 26) -# define RADEON_TXF_ENDIAN_32BPP_SWAP (2 << 26) -# define RADEON_TXF_ENDIAN_HALFDW_SWAP (3 << 26) -# define RADEON_TXF_ALPHA_MASK_ENABLE (1 << 28) -# define RADEON_TXF_CHROMA_KEY_ENABLE (1 << 29) -# define RADEON_TXF_CUBIC_MAP_ENABLE (1 << 30) -# define RADEON_TXF_PERSPECTIVE_ENABLE (1 << 31) +# define RADEON_TXFORMAT_I8 (0 << 0) +# define RADEON_TXFORMAT_AI88 (1 << 0) +# define RADEON_TXFORMAT_RGB332 (2 << 0) +# define RADEON_TXFORMAT_ARGB1555 (3 << 0) +# define RADEON_TXFORMAT_RGB565 (4 << 0) +# define RADEON_TXFORMAT_ARGB4444 (5 << 0) +# define RADEON_TXFORMAT_ARGB8888 (6 << 0) +# define RADEON_TXFORMAT_RGBA8888 (7 << 0) +# define RADEON_TXFORMAT_Y8 (8 << 0) +# define RADEON_TXFORMAT_FORMAT_MASK (31 << 0) +# define RADEON_TXFORMAT_FORMAT_SHIFT 0 +# define RADEON_TXFORMAT_APPLE_YUV_MODE (1 << 5) +# define RADEON_TXFORMAT_ALPHA_IN_MAP (1 << 6) +# define RADEON_TXFORMAT_NON_POWER2 (1 << 7) +# define RADEON_TXFORMAT_WIDTH_MASK (15 << 8) +# define RADEON_TXFORMAT_WIDTH_SHIFT 8 +# define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12) +# define RADEON_TXFORMAT_HEIGHT_SHIFT 12 +# define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_STQ2 (2 << 24) +# define RADEON_TXFORMAT_ENDIAN_NO_SWAP (0 << 26) +# define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP (1 << 26) +# define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP (2 << 26) +# define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3 << 26) +# define RADEON_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) +# define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) +# define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) +# define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31) #define RADEON_PP_TXOFFSET_0 0x1c5c #define RADEON_PP_TXOFFSET_1 0x1c74 #define RADEON_PP_TXOFFSET_2 0x1c8c diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h index 94cdcc0b2..65fc9f0af 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.1 2001/01/08 01:07:36 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -81,7 +81,7 @@ /* Vertex/indirect buffer size */ -#define RADEON_BUFFER_SIZE 16384 +#define RADEON_BUFFER_SIZE 65536 /* Byte offsets for indirect buffer data */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c index f18762c72..f4758c793 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.10 2001/01/25 02:27:50 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.11 2001/03/03 22:26:11 tsi Exp $ */ #include "radeon.h" #include "radeon_reg.h" @@ -37,7 +37,7 @@ static int RADEONQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, static void RADEONResetVideo(ScrnInfoPtr); -static void RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time time); +static void RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now); #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) @@ -253,8 +253,8 @@ RegionsEqual(RegionPtr A, RegionPtr B) (A->extents.y2 != B->extents.y2)) return FALSE; - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); + dataA = (pointer)REGION_RECTS(A); + dataB = (pointer)REGION_RECTS(B); while(num--) { if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) @@ -506,7 +506,7 @@ RADEONCopyMungedData( w >>= 1; for(j = 0; j < h; j++) { - dst = (CARD32*)dst1; + dst = (pointer)dst1; s1 = src1; s2 = src2; s3 = src3; i = w; while(i > 4) { @@ -841,21 +841,21 @@ RADEONQueryImageAttributes( } static void -RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time time) +RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now) { RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr; if(pPriv->videoStatus & TIMER_MASK) { if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < time) { + if(pPriv->offTime < now) { unsigned char *RADEONMMIO = info->MMIO; OUTREG(RADEON_OV0_SCALE_CNTL, 0); pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = time + FREE_DELAY; + pPriv->freeTime = now + FREE_DELAY; } } else { /* FREE_TIMER */ - if(pPriv->freeTime < time) { + if(pPriv->freeTime < now) { if(pPriv->linear) { xf86FreeOffscreenLinear(pPriv->linear); pPriv->linear = NULL; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c index 3e25a53d8..233550fb7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.5 2001/02/15 17:39:27 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.6 2001/04/01 14:00:10 tsi Exp $ */ /* * Copyright 2000 by Egbert Eich * @@ -143,7 +143,7 @@ Cir_OpenFramebuffer( CirPtr pCir = CIRPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)pCir->FbAddress; + *mem = (unsigned char*)(long)pCir->FbAddress; *size = pCir->FbMapSize; *offset = 0; /* Always */ *flags = 0; /* Root permissions OS-dependent */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile index 9308b5e71..cfba2fa80 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the fbdev driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile,v 1.9 2001/01/24 00:06:17 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile,v 1.10 2001/04/06 18:16:30 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -21,7 +21,7 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(XF86SRC)/rac \ -I$(SERVERSRC)/Xext -I$(XF86SRC)/xf24_32bpp\ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) -I$(SERVERSRC)/render + -I$(SERVERSRC)/miext/shadow -I$(EXTINCSRC) -I$(SERVERSRC)/render #endif DEFINES = FbdevDefines diff --git a/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c b/xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c index 86b653052..82b2d2fd3 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.28 2001/01/21 21:19:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.29 2001/04/06 18:16:30 dawes Exp $ */ /* * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> @@ -15,11 +15,11 @@ #include "micmap.h" #include "colormapst.h" #include "xf86cmap.h" -#include "shadowfb.h" +#include "shadow.h" +#include "dgaproc.h" /* for visuals */ #include "fb.h" -#include "cfb24_32.h" #ifdef USE_AFB #include "afb.h" #endif @@ -55,8 +55,18 @@ static Bool FBDevPreInit(ScrnInfoPtr pScrn, int flags); 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); +static void * FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 *size); +static Bool FBDevDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen); + + +#if 0 +static ShadowUpdateProc updateFuncs[] = + { shadowUpdatePacked, shadowUpdateRotate8, shadowUpdateRotUD8, shadowUpdateRotCCW8, + shadowUpdatePacked, shadowUpdateRotate16, shadowUpdateRotUD16, shadowUpdateRotCCW16, + shadowUpdatePacked, shadowUpdateRotate32, shadowUpdateRotUD32, shadowUpdateRotCCW32 }; +#endif + /* -------------------------------------------------------------------- */ @@ -91,23 +101,23 @@ static SymTabRec FBDevChipsets[] = { #ifdef USE_AFB { 0, "afb" }, #endif -#if 0 - { 0, "cfb8" }, - { 0, "cfb16" }, - { 0, "cfb24" }, - { 0, "cfb32" }, -#endif {-1, NULL } }; /* Supported options */ typedef enum { OPTION_SHADOW_FB, +#if 0 + OPTION_ROTATE, +#endif OPTION_FBDEV } FBDevOpts; static OptionInfoRec FBDevOptions[] = { { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, +#if 0 + { OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE }, +#endif { OPTION_FBDEV, "fbdev", OPTV_STRING, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -127,7 +137,9 @@ static const char *cfbSymbols[] = { }; static const char *shadowSymbols[] = { - "ShadowFBInit", + "shadowAlloc", + "shadowInit", + "shadowUpdatePacked", NULL }; @@ -199,11 +211,17 @@ typedef struct { unsigned char* fbstart; unsigned char* fbmem; int fboff; + int lineLength; unsigned char* shadowmem; - int shadowPitch; +#if 0 + int rotate; +#endif Bool shadowFB; CloseScreenProcPtr CloseScreen; EntityInfoPtr pEnt; + /* DGA info */ + DGAModePtr pDGAMode; + int nDGAMode; } FBDevRec, *FBDevPtr; #define FBDEVPTR(p) ((FBDevPtr)((p)->driverPrivate)) @@ -346,7 +364,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags) { FBDevPtr fPtr; int default_depth; - char *mod = NULL; + char *mod = NULL, *s; const char *reqSym = NULL; Gamma zeros = {0.0, 0.0, 0.0}; @@ -421,10 +439,45 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags) /* handle options */ xf86CollectOptions(pScrn, NULL); xf86ProcessOptions(pScrn->scrnIndex, fPtr->pEnt->device->options, FBDevOptions); + + /* use shadow framebuffer by default */ fPtr->shadowFB = xf86ReturnOptValBool(FBDevOptions, OPTION_SHADOW_FB, TRUE); - xf86DrvMsg(pScrn->scrnIndex, - xf86IsOptionSet(FBDevOptions, OPTION_SHADOW_FB) ? X_CONFIG : X_DEFAULT, - "Option ShadowFB is %s\n",fPtr->shadowFB ? "on" : "off"); + +#if 0 + /* rotation (doesn't work yet) */ + fPtr->rotate = 0; + if ((s = xf86GetOptValString(FBDevOptions, OPTION_ROTATE))) + { + if(!xf86NameCmp(s, "CW")) + { + fPtr->shadowFB = TRUE; + fPtr->rotate = 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen clockwise\n"); + } + else if(!xf86NameCmp(s, "CCW")) + { + fPtr->shadowFB = TRUE; + fPtr->rotate = 3; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise\n"); + } + else if(!xf86NameCmp(s, "UD")) + { + fPtr->shadowFB = TRUE; + fPtr->rotate = 2; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise\n"); + } + else + { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for Option \"Rotate\"\n", s); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid options are \"CW\", \"CCW\" or \"UD\"\n"); + } + } +#endif /* select video modes */ @@ -469,6 +522,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags) case FBDEVHW_PACKED_PIXELS: mod = "fb"; reqSym = "fbScreenInit"; + xf86LoaderReqSymbols("fbPictureInit", NULL); switch (pScrn->bitsPerPixel) { @@ -517,83 +571,31 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags) } xf86LoaderReqSymbols(reqSym, NULL); - /* Load shadowFB if needed */ + /* Load shadow if needed */ if (fPtr->shadowFB) { - if (!xf86LoadSubModule(pScrn, "shadowfb")) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\"\n"); + if (!xf86LoadSubModule(pScrn, "shadow")) { FBDevFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("ShadowFBInit", NULL); + xf86LoaderReqSymLists(shadowSymbols, NULL); } TRACE_EXIT("PreInit"); return TRUE; } -/* for ShadowFB */ -static void -FBDevRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) -{ - FBDevPtr fPtr = FBDEVPTR(pScrn); - int width, height, Bpp, FBPitch; - unsigned char *src, *dst; - - Bpp = pScrn->bitsPerPixel >> 3; - FBPitch = fbdevHWGetLineLength(pScrn); - - while(num--) { - width = (pbox->x2 - pbox->x1) * Bpp; - height = pbox->y2 - pbox->y1; - src = fPtr->shadowmem + (pbox->y1 * fPtr->shadowPitch) + - (pbox->x1 * Bpp); - dst = fPtr->fbmem + fPtr->fboff + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); - - while(height--) { - memcpy(dst, src, width); - dst += FBPitch; - src += fPtr->shadowPitch; - } - pbox++; - } -} - -static Bool -FBDevSaveScreen(ScreenPtr pScreen, int mode) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - FBDevPtr fPtr = FBDEVPTR(pScrn); - BoxRec box; - Bool unblank; - - TRACE_ENTER("FBDevSaveScreen"); - if (!(fPtr->shadowFB)) - /* Not implemented yet - alloc huge memory block and copy ? */ - return TRUE; - - unblank = xf86IsUnblank(mode); - - if (unblank) { - box.x1 = 0; - box.x2 = pScrn->virtualX; - box.y1 = 0; - box.y2 = pScrn->virtualY; - FBDevRefreshArea(pScrn, 1, &box); - } else { - memset(fPtr->fbmem + fPtr->fboff, 0, - pScrn->virtualX * pScrn->virtualY * ((pScrn->bitsPerPixel+7)/8)); - } - return TRUE; -} - static Bool FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; FBDevPtr fPtr = FBDEVPTR(pScrn); VisualPtr visual; - int ret,flags; + int ret,flags,width,height; + ShadowUpdateProc fun; TRACE_ENTER("FBDevScreenInit"); + #if DEBUG ErrorF("\tbitsPerPixel=%d, depth=%d, defaultVisual=%s\n" "\tmask: %x,%x,%x, offset: %d,%d,%d\n", @@ -612,6 +614,8 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; + + fbdevHWSaveScreen(pScreen, SCREEN_SAVER_ON); fbdevHWAdjustFrame(scrnIndex,0,0,0); /* mi layer */ @@ -625,12 +629,28 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; } + if (!miSetPixmapDepths()) + return FALSE; + +#if 0 + if(fPtr->rotate==3 || fPtr->rotate==1) + { + height = pScrn->virtualX; + width = pScrn->virtualY; + } else { +#endif + height = pScrn->virtualY; + width = pScrn->virtualX; +#if 0 + } +#endif /* shadowfb */ if (fPtr->shadowFB) { - fPtr->shadowPitch = - ((pScrn->virtualX * pScrn->bitsPerPixel >> 3) + 3) & ~3L; - fPtr->shadowmem = xalloc(fPtr->shadowPitch * pScrn->virtualY); + if ((fPtr->shadowmem = shadowAlloc(width, height, + pScrn->bitsPerPixel)) == NULL) + return FALSE; + fPtr->fbstart = fPtr->shadowmem; } else { fPtr->shadowmem = NULL; @@ -641,6 +661,22 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { #ifdef USE_AFB case FBDEVHW_PLANES: +#if 0 + if (fPtr->rotate) + { + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: Rotate not supported for afb\n"); + ret = FALSE; + break; + } +#endif + if (fPtr->shadowFB) + { + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: Shadwo framebuffer not supported for afb\n"); + ret = FALSE; + break; + } ret = afbScreenInit (pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); @@ -652,16 +688,18 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (pix24bpp == 32) { ret = cfb24_32ScreenInit - (pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY, + (pScreen, fPtr->fbstart, width, height, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); break; } case 8: case 16: case 32: - ret = fbScreenInit - (pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel); + ret = fbScreenInit(pScreen, fPtr->fbstart, width, height, + pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel); + if (ret && !fbPictureInit(pScreen, NULL, 0)) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "RENDER extension initialisation failed.\n"); break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -719,6 +757,36 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } +#if 0 + switch (pScrn->bitsPerPixel) + { + case 8: + case 16: + case 32: +#endif + if (fPtr->shadowFB && + !shadowInit(pScreen, shadowUpdatePacked, /*updateFuncs[fPtr->rotate + (pScrn->bitsPerPixel/4 & 0xc)],*/ + FBDevWindowLinear)) + return FALSE; +#if 0 + break; + default: + if (fPtr->rotate) + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: rotate not supported for %dbpp.\n", + pScrn->bitsPerPixel); + return FALSE; + } + + if (!fPtr->rotate) +#endif + FBDevDGAInit(pScrn, pScreen); +#if 0 + else + xf86DrvMsg(scrnIndex, X_WARNING, + "Rotated display, disabling DGA\n"); +#endif + xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -726,9 +794,6 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* software cursor */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - if(fPtr->shadowFB) - ShadowFBInit(pScreen, FBDevRefreshArea); - /* colormap */ switch (fbdevHWGetType(pScrn)) { @@ -767,9 +832,9 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if(!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPalette, NULL, flags)) return FALSE; - xf86DPMSInit(pScreen, FBDevDPMSSet, 0); + xf86DPMSInit(pScreen, fbdevHWDPMSSet, 0); - pScreen->SaveScreen = FBDevSaveScreen; + pScreen->SaveScreen = fbdevHWSaveScreen; /* Wrap the current CloseScreen function */ fPtr->CloseScreen = pScreen->CloseScreen; @@ -786,9 +851,8 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #endif -#if DEBUG - ErrorF("FBDevScreenInit done\n",pScrn->scrnIndex); -#endif + TRACE_EXIT("FBDevScreenInit"); + return TRUE; } @@ -802,15 +866,169 @@ FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen) fbdevHWUnmapVidmem(pScrn); if (fPtr->shadowmem) xfree(fPtr->shadowmem); + if (fPtr->pDGAMode) + xfree(fPtr->pDGAMode); pScrn->vtSema = FALSE; pScreen->CloseScreen = fPtr->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } +static void * +FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 *size) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + FBDevPtr fPtr = FBDEVPTR(pScrn); + + if (fPtr->lineLength) + *size = fPtr->lineLength; + else + *size = fPtr->lineLength = fbdevHWGetLineLength(pScrn); + + return ((CARD8 *)fPtr->fbmem + fPtr->fboff + row * fPtr->lineLength + offset); +} + + +/*********************************************************************** + * DGA stuff + ***********************************************************************/ +static Bool FBDevDGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName, + unsigned char **ApertureBase, + int *ApertureSize, int *ApertureOffset, + int *flags); +static Bool FBDevDGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode); +static void FBDevDGASetViewport(ScrnInfoPtr pScrn, int x, int y, int flags); + +static Bool +FBDevDGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName, + unsigned char **ApertureBase, int *ApertureSize, + int *ApertureOffset, int *flags) +{ + *DeviceName = NULL; /* No special device */ + *ApertureBase = (unsigned char *)(pScrn->memPhysBase); + *ApertureSize = pScrn->videoRam; + *ApertureOffset = pScrn->fbOffset; + *flags = 0; + + return TRUE; +} + +static Bool +FBDevDGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode) +{ + DisplayModePtr pMode; + int scrnIdx = pScrn->pScreen->myNum; + int frameX0, frameY0; + + if (pDGAMode) { + pMode = pDGAMode->mode; + frameX0 = frameY0 = 0; + } + else { + if (!(pMode = pScrn->currentMode)) + return TRUE; + + frameX0 = pScrn->frameX0; + frameY0 = pScrn->frameY0; + } + + if (!(*pScrn->SwitchMode)(scrnIdx, pMode, 0)) + return FALSE; + (*pScrn->AdjustFrame)(scrnIdx, frameX0, frameY0, 0); + + return TRUE; +} static void -FBDevDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) +FBDevDGASetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) +{ + (*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags); +} + +static int +FBDevDGAGetViewport(ScrnInfoPtr pScrn) { - fbdevHWDPMSSet(pScrn, mode, flags); + return (0); +} + +static DGAFunctionRec FBDevDGAFunctions = +{ + FBDevDGAOpenFramebuffer, + NULL, /* CloseFramebuffer */ + FBDevDGASetMode, + FBDevDGASetViewport, + FBDevDGAGetViewport, + NULL, /* Sync */ + NULL, /* FillRect */ + NULL, /* BlitRect */ + NULL, /* BlitTransRect */ +}; + +static void +FBDevDGAAddModes(ScrnInfoPtr pScrn) +{ + FBDevPtr fPtr = FBDEVPTR(pScrn); + DisplayModePtr pMode = pScrn->modes; + DGAModePtr pDGAMode; + + do { + pDGAMode = xrealloc(fPtr->pDGAMode, + (fPtr->nDGAMode + 1) * sizeof(DGAModeRec)); + if (!pDGAMode) + break; + + fPtr->pDGAMode = pDGAMode; + pDGAMode += fPtr->nDGAMode; + (void)memset(pDGAMode, 0, sizeof(DGAModeRec)); + + ++fPtr->nDGAMode; + pDGAMode->mode = pMode; + pDGAMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + pDGAMode->byteOrder = pScrn->imageByteOrder; + pDGAMode->depth = pScrn->depth; + pDGAMode->bitsPerPixel = pScrn->bitsPerPixel; + pDGAMode->red_mask = pScrn->mask.red; + pDGAMode->green_mask = pScrn->mask.green; + pDGAMode->blue_mask = pScrn->mask.blue; + pDGAMode->visualClass = pScrn->bitsPerPixel > 8 ? + TrueColor : PseudoColor; + pDGAMode->xViewportStep = 1; + pDGAMode->yViewportStep = 1; + pDGAMode->viewportWidth = pMode->HDisplay; + pDGAMode->viewportHeight = pMode->VDisplay; + + if (fPtr->lineLength) + pDGAMode->bytesPerScanline = fPtr->lineLength; + else + pDGAMode->bytesPerScanline = fPtr->lineLength = fbdevHWGetLineLength(pScrn); + + pDGAMode->imageWidth = pMode->HDisplay; + pDGAMode->imageHeight = pMode->VDisplay; + pDGAMode->pixmapWidth = pDGAMode->imageWidth; + pDGAMode->pixmapHeight = pDGAMode->imageHeight; + pDGAMode->maxViewportX = pScrn->virtualX - + pDGAMode->viewportWidth; + pDGAMode->maxViewportY = pScrn->virtualY - + pDGAMode->viewportHeight; + + pDGAMode->address = fPtr->fbstart; + + pMode = pMode->next; + } while (pMode != pScrn->modes); +} + +static Bool +FBDevDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen) +{ + FBDevPtr fPtr = FBDEVPTR(pScrn); + + if (pScrn->depth < 8) + return FALSE; + + if (!fPtr->nDGAMode) + FBDevDGAAddModes(pScrn); + + return (DGAInit(pScreen, &FBDevDGAFunctions, + fPtr->pDGAMode, fPtr->nDGAMode)); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile index 9583be466..9d0d04db1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.31 2001/01/31 16:14:51 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.32 2001/02/24 14:29:16 alanh Exp $ XCOMM XCOMM This is an Imakefile for the GLINT driver. XCOMM @@ -14,11 +14,11 @@ DRIINCLUDES=-I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri SRCS = glint_driver.c pm2_dac.c pm2ramdac.c pm2_accel.c pm_dac.c IBMramdac.c \ pm_accel.c tx_dac.c tx_accel.c pm2v_dac.c pm2vramdac.c pm2_video.c \ - pm3_dac.c pm3_accel.c TIramdac.c \ + pm3_dac.c pm3_accel.c pm3_video.c TIramdac.c \ glint_shadow.c $(DRISRC) sx_accel.c glint_dga.c OBJS = glint_driver.o pm2_dac.o pm2ramdac.o pm2_accel.o pm_dac.o IBMramdac.o \ pm_accel.o tx_dac.o tx_accel.o pm2v_dac.o pm2vramdac.o pm2_video.o \ - pm3_dac.o pm3_accel.o TIramdac.o \ + pm3_dac.o pm3_accel.o pm3_video.o TIramdac.o \ glint_shadow.o $(DRIOBJ) sx_accel.o glint_dga.o #if defined(XF86DriverSDK) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 index 5a79d688e..5285b59ae 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.7 2000/12/20 11:13:01 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.8 2001/02/24 14:29:16 alanh Exp $ */ STATUS as of Mon, 16 Oct 2000 21:24:51 +0200 @@ -7,7 +7,8 @@ Working : 1280x1024 only as my monitor don't support higher modes. * Endianess clean, thanks to Romain Dolbeau <dolbeaur@club-internet.fr> for helping me debug this. - * HW cursor. + * HW cursor : + - The cursor cannot be hidden, we need to move it offscreen instead. * ShadowFb works. * Full 2D Accels. - Sync. @@ -24,20 +25,22 @@ Working : - Pixmap Writes using direct FIFO writes with or without FIFO Disconnect. * Appian J2000 second head initialization. * Dual head : The console fonts will get trashed, but dual head works. - * DRI : - - Gamma, if available, get's claimed with the UseGamma option. + * Xv : Is working, but there are still problems when using smaller displays. + * DRI : Work is underway. + Not Working : - * 2D Accel : + * [NOT POSSIBLE] 2D Accel : - Solid & Dashed Lines are not possible on glint hardware. - 8x8 Color Pattern Fill is almost never used. - Clipping needs cleaning up. - - Seems broken on big endian systems, cannot test it though. - * 2D Accel hooks for the Rendering extension ? + * [TODO] 2D Accel hooks for the Rendering extension : - Render extension initialization. - CPUToScreenTexture. - CPUToScreenAlphaTexture. - * Video Overlay. - * DRI. + * [WORK IS UNDERWAY] DRI/OpenGL (only together with a gamma chip) : + - DRI support should be ok, but accelerated openGL is not yet supported. + - The accelerated OpenGL library supposes we are using a gamma together + with a MX rasterizer, not a Permedia3 one. Known Problem : @@ -49,56 +52,14 @@ Known Problem : vesafb, it will be a bit slower, but the fonts will no more become corrupt. Maybe i will even try writting a specific fbdev for the pm3, which will be much faster and have more functionality. - * R-B inversion. Sometimes, all of a sudden, it seems as the RGB order - gets changed. going to console and back solves this. - * [TRIGGERED IN ENLIGTHENMENT ONLY] When moving a window around a lot - quicly, the video outputs dies. I have to switch to a console and back - to have it restored. Is it possible that the accel engine gets - overloaded or something such ? Don't think so, it happens even when - PCIRetry is used too ... + [FIX2] try : consolechars -d, it should reload the console fonts. + * R-B inversion. Sometimes, all of a sudden, it seems as the + RGB order gets changed. going to console and back solves this. + Well, this is partly fixed, but still appears under very heavy load. + * When moving a window around a lot quicly, the video outputs dies. + Well, this is partly fixed, but still appears under very heavy load. * Sometimes there are blue transparent garbage in the form of small horizontal bands, few pixels high, and more pixels width, maybe 64pixels ? - -Video Overlay [NOTHING DONE YET] : - - * I have not done anything yet here. - -DRI/3D Accels [WORK IS PLANED] : - - * First approach would be to use the gamma for one head only (most probably - the first head, it could be configurable though). - * Sharing the gamma between both driver instances would need a setup similar - of what was done for the Matrox dualheaded G400 (mga driver). - * Alternatively it could be possible to use DRI with the gamma on one head, - and DRI with the pm3 alone on the second head. This would need writing a - pm3 drm kernel driver as well as a pm3 OpenGL driver. Could be useful for - boards without gamma chips though. - - * Claiming the Gamma (in the one head only approach) : - - The first possibility is the use of the UseGamma Option in the driver - section. The UseGamma option then tries to claim a gamma chip, if - available, on the same device. This enable the use of the gamma on - either head, in a two head setup. - - The second possibility is the automatic claiming of a gamma chip if - available. This works ok in single headed mode, but in dual head setup, - only the first head will be accelerated. - * Using the Gamma : - - A first try of using the Gamma (for 2D only) gave me a system freeze. - This is probably due to bad initialization since i only set the IOBase - to the Gamma registers, and did nothing more to initialize the Gamma. - I need more info on initialization of the Gamma chip, especially on how - to tell it which Permedia3 to use. - - A Second try, after initializing MultiGLINTAperture and MultiGLINT1 did - end in the same way. - - Once that is done, i need to write a pm3_dri.c file, inspired on the - glint_dri.c file, which does the dri setup, and the 2d/3d state saving. - * Changes to the 2D driver when using the Gamma : - - Well, there could be some changes, but in particular, the Gamma has only - a 32 entries deep Input FIFO, and not a 120 entries deep one like - permedia3. - - Another idea, is to use Gamma bypass when doing 2D accels. This way, we - don't have to worry about the Gamma smaller input Fifo. But we need to - sync the gamma also when doing syncs. Not sure where the right place for - this is though. Maybe when switching between 2D and 3D ? + This seems like a hardware bug. Sven Luther <luther@dpt-info.u-strasbg.fr> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h index 52cc1f883..5f190632d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.44 2001/02/07 13:26:18 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.46 2001/03/19 22:50:28 alanh Exp $ */ /* * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * @@ -123,6 +123,7 @@ typedef struct { Bool HWCursor; Bool ClippingOn; Bool UseBlockWrite; + Bool UseFlatPanel; Bool UseFireGL3000; CARD8 VGAdata[65536]; Bool VGAcore; @@ -234,6 +235,8 @@ void Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg); Bool Permedia3AccelInit(ScreenPtr pScreen); void Permedia3InitializeEngine(ScrnInfoPtr pScrn); +void Permedia3Sync(ScrnInfoPtr pScrn); +void DualPermedia3Sync(ScrnInfoPtr pScrn); void TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void TXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); @@ -303,6 +306,11 @@ void Permedia2VideoUninit(ScrnInfoPtr pScrn); void Permedia2VideoEnterVT(ScrnInfoPtr pScrn); void Permedia2VideoLeaveVT(ScrnInfoPtr pScrn); +void Permedia3VideoInit(ScreenPtr pScreen); +void Permedia3VideoUninit(ScrnInfoPtr pScrn); +void Permedia3VideoEnterVT(ScrnInfoPtr pScrn); +void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn); + void Permedia2vOutIndReg(ScrnInfoPtr pScrn, CARD32, unsigned char mask, unsigned char data); unsigned char Permedia2vInIndReg(ScrnInfoPtr pScrn, CARD32); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man index 5856b1360..59ae9427d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.2 2001/01/27 18:20:48 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.3 2001/03/19 22:50:28 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH GLINT __drivermansuffix__ __vendorversion__ @@ -57,8 +57,8 @@ The following driver .B Options are supported: .TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. +.BI "Option \*qUseFlatPanel\*q \*q" boolean \*q +Enable the FlatPanel feature on the Permedia3. Default: off. .TP .BI "Option \*qSWCursor\*q \*q" boolean \*q Enable or disable the SW cursor. Default: off. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c index 67ac50088..2272403c1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.21 2001/02/07 13:26:18 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.25 2001/03/28 11:10:56 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -353,9 +353,9 @@ GLINTDRIScreenInit(ScreenPtr pScreen) { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "GLINTDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n", + "GLINTDRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n", major, minor, patch); return FALSE; } @@ -365,6 +365,8 @@ GLINTDRIScreenInit(ScreenPtr pScreen) if (pGlint->numMultiDevices > 2) return FALSE; + if (pGlint->MultiChip != PCI_CHIP_MX) return FALSE; + pDRIInfo = DRICreateInfoRec(); if(pDRIInfo == NULL) return FALSE; @@ -427,6 +429,9 @@ GLINTDRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = GLINTDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &(pGlint->drmSubFD))) { DRIDestroyInfoRec(pGlint->pDRIInfo); xfree(pGlintDRI); @@ -438,8 +443,7 @@ GLINTDRIScreenInit(ScreenPtr pScreen) drmVersionPtr version = drmGetVersion(pGlint->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor != 0 || - version->version_patchlevel < 0) { + version->version_minor < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "GLINTDRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", @@ -587,6 +591,8 @@ GLINTDRIScreenInit(ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] %d DMA buffers mapped\n", pGlint->drmBufs->count); + xf86EnablePciBusMaster(pGlint->PciInfo, TRUE); + /* tell the generic kernel driver how to handle Gamma DMA */ if (pGlint->irq <= 0) { pGlint->irq = drmGetInterruptFromBusID(pGlint->drmSubFD, 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 638c2298c..e362f31d7 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.117 2001/02/15 11:03:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.120 2001/03/19 22:50:28 alanh Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -67,6 +67,7 @@ #include "extensions/dpms.h" #define DEBUG 0 +#define PM3Video 1 #if DEBUG # define TRACE_ENTER(str) ErrorF("glint: " str " %d\n",pScrn->scrnIndex) @@ -188,7 +189,8 @@ typedef enum { OPTION_FIREGL3000, OPTION_OVERLAY, OPTION_SHADOW_FB, - OPTION_FBDEV + OPTION_FBDEV, + OPTION_FLATPANEL } GLINTOpts; static OptionInfoRec GLINTOptions[] = { @@ -200,6 +202,7 @@ static OptionInfoRec GLINTOptions[] = { { OPTION_OVERLAY, "Overlay", OPTV_ANYSTR, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FLATPANEL, "UseFlatPanel", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -1145,6 +1148,10 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pGlint->HWCursor ? "HW" : "SW"); + if (xf86ReturnOptValBool(GLINTOptions, OPTION_FLATPANEL, FALSE)) { + pGlint->UseFlatPanel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Flat Panel Interface\n"); + } if (xf86ReturnOptValBool(GLINTOptions, OPTION_NOACCEL, FALSE)) { pGlint->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); @@ -2490,6 +2497,10 @@ GLINTRestore(ScrnInfoPtr pScrn) Permedia2VRestore(pScrn, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: +#ifdef PM3Video + TRACE("PM3Video : VideoLeaveVT"); + Permedia3VideoLeaveVT(pScrn); +#endif Permedia3Restore(pScrn, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2518,6 +2529,10 @@ GLINTRestore(ScrnInfoPtr pScrn) (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_CHIP_PERMEDIA3: +#ifdef PM3Video + TRACE("PM3Video : VideoLeaveVT"); + Permedia3VideoLeaveVT(pScrn); +#endif if (pGlint->numMultiDevices == 2) { ACCESSCHIP2(); Permedia3Restore(pScrn, glintReg2); @@ -2887,6 +2902,19 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoInit(pScreen); + break; +#ifdef PM3Video + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoInit"); + Permedia3VideoInit(pScreen); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoInit"); + Permedia3VideoInit(pScreen); + } +#endif } #if 0 @@ -3033,6 +3061,19 @@ GLINTEnterVT(int scrnIndex, int flags) case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoEnterVT(pScrn); + break; +#ifdef PM3Video + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoEnterVT"); + Permedia3VideoEnterVT(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoEnterVT"); + Permedia3VideoEnterVT(pScrn); + } +#endif } if (!pGlint->NoAccel) { @@ -3125,6 +3166,18 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen) case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoUninit(pScrn); + break; +#ifdef PM3Video + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoUninit"); + Permedia3VideoUninit(pScrn); + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoUninit"); + Permedia3VideoUninit(pScrn); + } +#endif } if (pScrn->vtSema) { @@ -3170,6 +3223,7 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen) static void GLINTFreeScreen(int scrnIndex, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; TRACE_ENTER("GLINTFreeScreen"); if (xf86LoaderCheckSymbol("fbdevHWFreeRec")) fbdevHWFreeRec(xf86Screens[scrnIndex]); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c index ef3a1b1bb..532c56178 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c @@ -30,7 +30,7 @@ * * Permedia 2 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.28 2001/02/15 11:03:57 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.29 2001/02/27 23:04:59 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -1004,7 +1004,7 @@ SECOND_PASS: height = h; srcpntr = src; while(height--) { - GLINT_WAIT(dwords); + GLINT_WAIT(dwords + 1); /* 0x0D is the TAG value for BitMaskPattern */ GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); GLINT_MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), 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 0279a584a..91b0b9419 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.24 2001/02/07 13:26:20 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.25 2001/02/27 18:47:25 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -177,7 +177,7 @@ Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->DacRegs[PM2VDACRDDClk0PostScale] = p; } - pReg->DacRegs[PM2VDACRDIndexControl] = 0x00; + pReg->glintRegs[PM2VDACRDIndexControl >> 3] = 0x00; if (pScrn->rgbBits == 8) pReg->DacRegs[PM2VDACRDMiscControl] = 0x01; /* 8bit DAC */ @@ -262,8 +262,8 @@ Permedia2VSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) glintReg->cmap[i] = Permedia2ReadData(pScrn); } - glintReg->DacRegs[PM2VDACRDIndexControl] = - Permedia2vInIndReg(pScrn, PM2VDACRDIndexControl); + glintReg->glintRegs[PM2VDACRDIndexControl >> 3] = + GLINT_READ_REG(PM2VDACRDIndexControl); glintReg->DacRegs[PM2VDACRDOverlayKey] = Permedia2vInIndReg(pScrn, PM2VDACRDOverlayKey); glintReg->DacRegs[PM2VDACRDSyncControl] = @@ -323,8 +323,8 @@ Permedia2VRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsStart >> 3], PMVsStart); GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsEnd >> 3], PMVsEnd); - Permedia2vOutIndReg(pScrn, PM2VDACRDIndexControl, 0x00, - glintReg->DacRegs[PM2VDACRDIndexControl]); + GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM2VDACRDIndexControl >> 3], + PM2VDACRDIndexControl); Permedia2vOutIndReg(pScrn, PM2VDACRDOverlayKey, 0x00, glintReg->DacRegs[PM2VDACRDOverlayKey]); Permedia2vOutIndReg(pScrn, PM2VDACRDSyncControl, 0x00, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c index 604ed1533..4cf9a4a31 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c @@ -26,7 +26,7 @@ * * Permedia 3 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.22 2001/02/05 15:10:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.23 2001/02/27 23:04:59 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -846,7 +846,12 @@ Permedia3SubsequentScanlineCPUToScreenColorExpandFill( PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); - if ((pGlint->dwords*h) < pGlint->FIFOSize) { +#if defined(__alpha__) + if (0) /* force Alpha to use indirect always */ +#else + if ((pGlint->dwords*h) < pGlint->FIFOSize) +#endif + { /* Turn on direct for less than 120 dword colour expansion */ pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; pGlint->ScanlineDirect = 1; @@ -931,7 +936,12 @@ static void Permedia3SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); - if (pGlint->dwords < pGlint->FIFOSize) { +#if defined(__alpha__) + if (0) /* force Alpha to use indirect always */ +#else + if (pGlint->dwords < pGlint->FIFOSize) +#endif + { /* Turn on direct for less than 120 dword colour expansion */ pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; pGlint->ScanlineDirect = 1; 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 2cdcbbea4..29b0a7715 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c @@ -26,7 +26,7 @@ * this work is sponsored by Appian Graphics. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.18 2001/02/05 10:44:58 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.22 2001/03/20 19:08:58 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -305,21 +305,22 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) temp1 = 0; temp2 = 0; -#if 0 /* Currently commented out while testing Flat Panel support */ - temp1 |= 0x40; - temp2 |= 0x01; - STOREREG(VSConfiguration, - (GLINT_READ_REG(VSConfiguration) & 0xFFFFFFF8) | 0x06)); - STOREREG(VSBBase, 1<<14); -#endif - if (mode->Flags & V_PHSYNC) temp1 |= 0x01; /* invert hsync */ - if (mode->Flags & V_PVSYNC) temp1 |= 0x08; /* invert vsync */ + temp3 = 0; + + if (pGlint->UseFlatPanel) { + temp2 |= PM3RD_DACControl_BLANK_PEDESTAL_ENABLE; + temp3 |= PM3RD_MiscControl_VSB_OUTPUT_ENABLE; + STOREREG(VSConfiguration, 0x06); + STOREREG(VSBBase, 1<<14); + } + + if (mode->Flags & V_PHSYNC) temp1 |= PM3RD_SyncControl_HSYNC_ACTIVE_HIGH; + if (mode->Flags & V_PVSYNC) temp1 |= PM3RD_SyncControl_VSYNC_ACTIVE_HIGH; - STOREDAC(PM2VDACRDIndexControl, 0x00); + STOREREG(PM2VDACRDIndexControl, 0x00); STOREDAC(PM2VDACRDSyncControl, temp1); - STOREDAC(PM2VDACRDDACControl, 0x00); + STOREDAC(PM2VDACRDDACControl, temp2); - temp3 = 0; if (pScrn->rgbBits == 8) temp3 |= 0x01; /* 8bit DAC */ @@ -352,6 +353,8 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) } STOREDAC(PM2VDACRDMiscControl, temp3); + STOREREG(PM3FifoControl, 0x905); /* Lower the default fifo threshold */ + return(TRUE); } @@ -383,6 +386,7 @@ Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr pReg) SAVEREG(ChipConfig); SAVEREG(Aperture0); SAVEREG(Aperture1); + SAVEREG(PM3FifoControl); if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) SAVEREG(DFIFODis); @@ -400,17 +404,17 @@ Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr pReg) SAVEREG(PMScreenBase); SAVEREG(PMVideoControl); SAVEREG(VClkCtl); -#if 0 /* Currently commented out while testing Flat Panel support */ - SAVEREG(VSConfiguration); - SAVEREG(VSBBase); -#endif + if (pGlint->UseFlatPanel) { + SAVEREG(VSConfiguration); + SAVEREG(VSBBase); + } for (i=0;i<768;i++) { Permedia2ReadAddress(pScrn, i); pReg->cmap[i] = Permedia2ReadData(pScrn); } - P2VIN(PM2VDACRDIndexControl); + SAVEREG(PM2VDACRDIndexControl); P2VIN(PM2VDACRDOverlayKey); P2VIN(PM2VDACRDSyncControl); P2VIN(PM2VDACRDMiscControl); @@ -452,6 +456,7 @@ Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr pReg) RESTOREREG(ChipConfig); RESTOREREG(Aperture0); RESTOREREG(Aperture1); + RESTOREREG(PM3FifoControl); if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) RESTOREREG(DFIFODis); RESTOREREG(FIFODis); @@ -469,12 +474,12 @@ Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr pReg) RESTOREREG(PMVsStart); RESTOREREG(PMVsEnd); -#if 0 /* Currently commented out while testing Flat Panel support */ - RESTOREREG(VSConfiguration); - RESTOREREG(VSBBase); -#endif + if (pGlint->UseFlatPanel) { + RESTOREREG(VSConfiguration); + RESTOREREG(VSBBase); + } - P2VOUT(PM2VDACRDIndexControl); + RESTOREREG(PM2VDACRDIndexControl); P2VOUT(PM2VDACRDOverlayKey); P2VOUT(PM2VDACRDSyncControl); P2VOUT(PM2VDACRDMiscControl); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h index 42946b213..0b6685177 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.4 2001/01/31 16:15:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.5 2001/02/24 14:29:18 alanh Exp $ */ /* * glint register file @@ -157,22 +157,78 @@ #define PM3MiscControl 0x3088 #define PM3VideoOverlayUpdate 0x3100 + #define PM3VideoOverlayUpdate_DISABLE (0<<0) + #define PM3VideoOverlayUpdate_ENABLE (1<<0) #define PM3VideoOverlayMode 0x3108 #define PM3VideoOverlayMode_DISABLE (0<<0) #define PM3VideoOverlayMode_ENABLE (1<<0) - /* ... */ + #define PM3VideoOverlayMode_BUFFERSYNC_MANUAL (0<<1) + #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMA (1<<1) + #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMB (2<<1) + #define PM3VideoOverlayMode_FIELDPOLARITY_NORMAL (0<<4) + #define PM3VideoOverlayMode_FIELDPOLARITY_INVERT (1<<4) + #define PM3VideoOverlayMode_PIXELSIZE_8BIT (0<<5) + #define PM3VideoOverlayMode_PIXELSIZE_16BIT (1<<5) + #define PM3VideoOverlayMode_PIXELSIZE_32BIT (2<<5) + #define PM3VideoOverlayMode_COLORFORMAT_RGB8888 ((0<<7)|(1<<12)|(2<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB4444 ((1<<7)|(1<<12)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB5551 ((2<<7)|(1<<12)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB565 ((3<<7)|(1<<12)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB332 ((4<<7)|(1<<12)|(0<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR8888 ((0<<7)|(2<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR4444 ((1<<7)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR5551 ((2<<7)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR565 ((3<<7)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR332 ((4<<7)|(0<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_CI8 ((5<<7)|(1<<12)|(0<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_VUY444 ((2<<10)|(1<<12)|(2<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_YUV444 ((2<<10)|(2<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_VUY422 ((1<<10)|(1<<12)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_YUV422 ((1<<10)|(1<<5)) + #define PM3VideoOverlayMode_COLORORDER_BGR (0<<12) + #define PM3VideoOverlayMode_COLORORDER_RGB (1<<12) + #define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0<<13) + #define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1<<13) + #define PM3VideoOverlayMode_FILTER_OFF (0<<14) + #define PM3VideoOverlayMode_FILTER_FULL (1<<14) + #define PM3VideoOverlayMode_FILTER_PARTIAL (2<<14) + #define PM3VideoOverlayMode_DEINTERLACE_OFF (0<<16) + #define PM3VideoOverlayMode_DEINTERLACE_BOB (1<<16) + #define PM3VideoOverlayMode_PATCHMODE_OFF (0<<18) + #define PM3VideoOverlayMode_PATCHMODE_ON (1<<18) + #define PM3VideoOverlayMode_FLIP_VIDEO (0<<20) + #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1<<20) + #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2<<20) + #define PM3VideoOverlayMode_MIRRORX_OFF (0<<23) + #define PM3VideoOverlayMode_MIRRORX_ON (1<<23) + #define PM3VideoOverlayMode_MIRRORY_OFF (0<<24) + #define PM3VideoOverlayMode_MIRRORY_ON (1<<24) #define PM3VideoOverlayFifoControl 0x3110 #define PM3VideoOverlayIndex 0x3118 #define PM3VideoOverlayBase0 0x3120 #define PM3VideoOverlayBase1 0x3128 #define PM3VideoOverlayBase2 0x3130 #define PM3VideoOverlayStride 0x3138 + #define PM3VideoOverlayStride_STRIDE(s) (((s)&0xfff)<<0) #define PM3VideoOverlayWidth 0x3140 + #define PM3VideoOverlayWidth_WIDTH(w) (((w)&0xfff)<<0) #define PM3VideoOverlayHeight 0x3148 + #define PM3VideoOverlayHeight_HEIGHT(h) (((h)&0xfff)<<0) #define PM3VideoOverlayOrigin 0x3150 + #define PM3VideoOverlayOrigin_XORIGIN(x) (((x)&0xfff)<<0) + #define PM3VideoOverlayOrigin_YORIGIN(y) (((y)&0xfff)<<16) #define PM3VideoOverlayShrinkXDelta 0x3158 + #define PM3VideoOverlayShrinkXDelta_NONE (1<<16) + #define PM3VideoOverlayShrinkXDelta_DELTA(s,d) \ + ((((s)<<16)/(d))&0x0ffffff0) #define PM3VideoOverlayZoomXDelta 0x3160 + #define PM3VideoOverlayZoomXDelta_NONE (1<<16) + #define PM3VideoOverlayZoomXDelta_DELTA(s,d) \ + ((((s)<<16)/(d))&0x0001fff0) #define PM3VideoOverlayYDelta 0x3168 + #define PM3VideoOverlayYDelta_NONE (1<<16) + #define PM3VideoOverlayYDelta_DELTA(s,d) \ + ((((s)<<16)/(d))&0x0ffffff0) #define PM3VideoOverlayFieldOffset 0x3170 #define PM3VideoOverlayStatus 0x3178 @@ -314,6 +370,18 @@ #define PM3RD_Scratch 0x01f #define PM3RD_VideoOverlayControl 0x020 + #define PM3RD_VideoOverlayControl_DISABLE (0<<0) + #define PM3RD_VideoOverlayControl_ENABLE (1<<0) + #define PM3RD_VideoOverlayControl_MODE_MAINKEY (0<<1) + #define PM3RD_VideoOverlayControl_MODE_OVERLAYKEY (1<<1) + #define PM3RD_VideoOverlayControl_MODE_ALWAYS (2<<1) + #define PM3RD_VideoOverlayControl_MODE_BLEND (3<<1) + #define PM3RD_VideoOverlayControl_DIRECTCOLOR_DISABLED (0<<3) + #define PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED (1<<3) + #define PM3RD_VideoOverlayControl_BLENDSRC_MAIN (0<<4) + #define PM3RD_VideoOverlayControl_BLENDSRC_REGISTER (1<<4) + #define PM3RD_VideoOverlayControl_KEY_COLOR (0<<5) + #define PM3RD_VideoOverlayControl_KEY_ALPHA (1<<5) #define PM3RD_VideoOverlayXStartLow 0x021 #define PM3RD_VideoOverlayXStartHigh 0x022 #define PM3RD_VideoOverlayYStartLow 0x023 @@ -326,6 +394,10 @@ #define PM3RD_VideoOverlayKeyG 0x02a #define PM3RD_VideoOverlayKeyB 0x02b #define PM3RD_VideoOverlayBlend 0x02c + #define PM3RD_VideoOverlayBlend_FACTOR_0_PERCENT (0<<6) + #define PM3RD_VideoOverlayBlend_FACTOR_25_PERCENT (1<<6) + #define PM3RD_VideoOverlayBlend_FACTOR_59_PERCENT (2<<6) + #define PM3RD_VideoOverlayBlend_FACTOR_75_PERCENT (3<<6) #define PM3RD_DClkSetup1 0x1f0 #define PM3RD_DClkSetup2 0x1f1 @@ -840,6 +912,23 @@ #define PM3TextureIndexMode1And 0xb3d0 #define PM3TextureIndexMode1Or 0xb3d8 /* ... */ +#define PM3TextureMapSize 0xb428 +#define PM3TextureMapWidth0 0x8580 +#define PM3TextureMapWidth1 0x8588 + #define PM3TextureMapWidth_Width(w) ((w&0xfff)<<0) + #define PM3TextureMapWidth_BorderLayout (1<<12) + #define PM3TextureMapWidth_Layout_Linear (0<<13) + #define PM3TextureMapWidth_Layout_Patch64 (1<<13) + #define PM3TextureMapWidth_Layout_Patch32_2 (2<<13) + #define PM3TextureMapWidth_Layout_Patch2 (3<<13) + #define PM3TextureMapWidth_HostTexture (1<<15) +#define PM3TextureReadMode0 0xb400 +#define PM3TextureReadMode0And 0xac30 +#define PM3TextureReadMode0Or 0xac38 +#define PM3TextureReadMode1 0xb408 +#define PM3TextureReadMode1And 0xad40 +#define PM3TextureReadMode1Or 0xad48 +/* ... */ #define PM3WaitForCompletion 0x80b8 #define PM3Window 0x8980 #define PM3Window_ForceLBUpdate 1<<3 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c new file mode 100644 index 000000000..400442b8b --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c @@ -0,0 +1,1249 @@ +/* + * Permedia 3 Xv Driver + * + * Copyright (C) 2001 Sven Luther <luther@dpt-info.u-strasbg.fr> + * + * 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 + * AUTHORS OR COPYRIGHT HOLDERS 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 + * + * Based on work of Michael H. Schimek <m.schimek@netway.at> + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.1 2001/02/24 14:29:19 alanh Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xf86Xinput.h" +#include "xf86fbman.h" +#include "xf86xv.h" +#include "Xv.h" + +#include "glint_regs.h" +#include "pm3_regs.h" +#include "glint.h" + +#ifndef XvExtension + +void Permedia3VideoInit(ScreenPtr pScreen) {} +void Permedia3VideoUninit(ScrnInfoPtr pScrn) {} +void Permedia3VideoEnterVT(ScrnInfoPtr pScrn) {} +void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) {} + +#else + +#undef MIN +#undef ABS +#undef CLAMP +#undef ENTRIES + +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define ABS(n) (((n) < 0) ? -(n) : (n)) +#define CLAMP(v, min, max) (((v) < (min)) ? (min) : MIN(v, max)) +#define ENTRIES(array) (sizeof(array) / sizeof((array)[0])) + +#define ADAPTORS 1 +#define PORTS 1 + +#define MAX_BUFFERS 3 + +typedef struct { + CARD32 xy, wh; /* 16.0 16.0 */ + INT32 s, t; /* 12.20 fp */ + short y1, y2; +} CookieRec, *CookiePtr; + +typedef struct _PortPrivRec { + struct _AdaptorPrivRec * pAdaptor; + + INT32 Attribute[8]; /* Brig, Con, Sat, Hue, Int, Filt, BkgCol, Alpha */ + + int BuffersRequested; + int BuffersAllocated; + FBAreaPtr pFBArea[MAX_BUFFERS]; + CARD32 BufferBase[MAX_BUFFERS]; /* FB byte offset */ + int CurrentBuffer; + CARD32 BufferStride; /* bytes */ + + INT32 vx, vy, vw, vh; /* 12.10 fp */ + int dx, dy, dw, dh; + int fw, fh; + + int Id, Bpp; /* Scaler */ + + int Plug; + int BkgCol; /* RGB 5:6:5; 5:6:5 */ + int StopDelay; + + +} PortPrivRec, *PortPrivPtr; + +enum { VIDEO_OFF, VIDEO_ONE_SHOT, VIDEO_ON }; + +typedef struct _LFBAreaRec { + struct _LFBAreaRec * Next; + int Linear; + FBAreaPtr pFBArea; +} LFBAreaRec, *LFBAreaPtr; + +typedef struct _AdaptorPrivRec { + struct _AdaptorPrivRec * Next; + ScrnInfoPtr pScrn; + + OsTimerPtr Timer; + int TimerUsers; + int Delay, Instant; + + int FramesPerSec; + int FrameLines; + int IntLine; /* Frame, not field */ + int LinePer; /* nsec */ + + int VideoStd; + + PortPrivRec Port[PORTS]; + +} AdaptorPrivRec, *AdaptorPrivPtr; + +static AdaptorPrivPtr AdaptorPrivList = NULL; + +#define PORTNUM(p) ((int)((p) - &pAPriv->Port[0])) + +#define DEBUG(x) x + +static const Bool ColorBars = FALSE; + +/* + * Attributes + */ + +#define XV_ENCODING "XV_ENCODING" +#define XV_BRIGHTNESS "XV_BRIGHTNESS" +#define XV_CONTRAST "XV_CONTRAST" +#define XV_SATURATION "XV_SATURATION" +#define XV_HUE "XV_HUE" + +/* Proprietary */ + +#define XV_INTERLACE "XV_INTERLACE" /* Interlaced (bool) */ +#define XV_FILTER "XV_FILTER" /* Bilinear filter (bool) */ +#define XV_BKGCOLOR "XV_BKGCOLOR" /* Output background (0x00RRGGBB) */ +#define XV_ALPHA "XV_ALPHA" /* Scaler alpha channel (bool) */ + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvEncoding, xvBrightness, xvContrast, xvSaturation, xvHue; +static Atom xvInterlace, xvFilter, xvBkgColor, xvAlpha; + + +/* Scaler */ + +static XF86VideoEncodingRec +ScalerEncodings[] = +{ + { 0, "XV_IMAGE", 2047, 2047, { 1, 1 }}, +}; + +static XF86AttributeRec +ScalerAttributes[] = +{ + { XvSettable | XvGettable, 0, 1, XV_FILTER }, + { XvSettable | XvGettable, 0, 1, XV_ALPHA }, +}; + +static XF86VideoFormatRec +ScalerVideoFormats[] = +{ + { 8, TrueColor }, /* Dithered */ + { 15, TrueColor }, + { 16, TrueColor }, + { 24, TrueColor }, +}; + +/* + * FOURCC from http://www.webartz.com/fourcc + * Generic GUID for legacy FOURCC XXXXXXXX-0000-0010-8000-00AA00389B71 + */ +#define LE4CC(a,b,c,d) (((CARD32)(a)&0xFF)|(((CARD32)(b)&0xFF)<<8)|(((CARD32)(c)&0xFF)<<16)|(((CARD32)(d)&0xFF)<<24)) +#define GUID4CC(a,b,c,d) { a,b,c,d,0,0,0,0x10,0x80,0,0,0xAA,0,0x38,0x9B,0x71 } + +#define NoOrder LSBFirst + +static XF86ImageRec +ScalerImages[] = +{ + /* Planar YVU 4:2:0 (emulated) */ + { LE4CC('Y','V','1','2'), XvYUV, NoOrder, GUID4CC('Y','V','1','2'), + 12, XvPlanar, 3, 0, 0, 0, 0, + 8, 8, 8, 1, 2, 2, 1, 2, 2, "YVU", XvTopToBottom }, + + /* Packed YUYV 4:2:2 */ + { LE4CC('Y','U','Y','2'), XvYUV, NoOrder, GUID4CC('Y','U','Y','2'), + 16, XvPacked, 1, 0, 0, 0, 0, + 8, 8, 8, 1, 2, 2, 1, 1, 1, "YUYV", XvTopToBottom }, + + /* Packed UYVY 4:2:2 */ + { LE4CC('U','Y','V','Y'), XvYUV, NoOrder, GUID4CC('U','Y','V','Y'), + 16, XvPacked, 1, 0, 0, 0, 0, + 8, 8, 8, 1, 2, 2, 1, 1, 1, "UYVY", XvTopToBottom }, + + /* Packed YUVA 4:4:4 */ + { LE4CC('Y','U','V','A') /* XXX not registered */, XvYUV, LSBFirst, { 0 }, + 32, XvPacked, 1, 0, 0, 0, 0, + 8, 8, 8, 1, 1, 1, 1, 1, 1, "YUVA", XvTopToBottom }, + + /* Packed VUYA 4:4:4 */ + { LE4CC('V','U','Y','A') /* XXX not registered */, XvYUV, LSBFirst, { 0 }, + 32, XvPacked, 1, 0, 0, 0, 0, + 8, 8, 8, 1, 1, 1, 1, 1, 1, "VUYA", XvTopToBottom }, + + /* RGBA 8:8:8:8 */ + { 0x41, XvRGB, LSBFirst, { 0 }, + 32, XvPacked, 1, 24, 0x0000FF, 0x00FF00, 0xFF0000, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom }, + + /* RGB 5:6:5 */ + { 0x42, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 16, 0x001F, 0x07E0, 0xF800, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGB", XvTopToBottom }, + + /* RGBA 5:5:5:1 */ + { 0x43, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 15, 0x001F, 0x03E0, 0x7C00, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom }, + + /* RGBA 4:4:4:4 */ + { 0x44, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 12, 0x000F, 0x00F0, 0x0F00, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom }, + + /* RGB 3:3:2 */ + { 0x46, XvRGB, NoOrder, { 0 }, + 8, XvPacked, 1, 8, 0x07, 0x38, 0xC0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGB", XvTopToBottom }, + + /* BGRA 8:8:8:8 */ + { 0x47, XvRGB, LSBFirst, { 0 }, + 32, XvPacked, 1, 24, 0xFF0000, 0x00FF00, 0x0000FF, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom }, + + /* BGR 5:6:5 */ + { 0x48, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 16, 0xF800, 0x07E0, 0x001F, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGR", XvTopToBottom }, + + /* BGRA 5:5:5:1 */ + { 0x49, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 15, 0x7C00, 0x03E0, 0x001F, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom }, + + /* BGRA 4:4:4:4 */ + { 0x4A, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 12, 0x0F00, 0x00F0, 0x000F, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom }, + + /* BGR 2:3:3 */ + { 0x4C, XvRGB, NoOrder, { 0 }, + 8, XvPacked, 1, 8, 0xC0, 0x38, 0x07, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGR", XvTopToBottom }, +}; + +/* + * Buffer management + */ + +static void +RemoveAreaCallback(FBAreaPtr pFBArea) +{ + PortPrivPtr pPPriv = (PortPrivPtr) pFBArea->devPrivate.ptr; + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + DEBUG(ScrnInfoPtr pScrn = pAPriv->pScrn;) + int i; + + /* Well, for each buffer, just do nothing ? */ + for (i = 0; i < MAX_BUFFERS && pPPriv->pFBArea[i] != pFBArea; i++); + + if (i >= MAX_BUFFERS) + return; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "RemoveAreaCallback port #%d, buffer #%d, pFB=%p, off=0x%08x\n", + PORTNUM(pPPriv), i, pPPriv->pFBArea[i], pPPriv->BufferBase[i])); + + for (; i < MAX_BUFFERS - 1; i++) + pPPriv->pFBArea[i] = pPPriv->pFBArea[i + 1]; + + pPPriv->pFBArea[MAX_BUFFERS - 1] = NULL; + + pPPriv->BuffersAllocated--; +} + +static void +RemoveableBuffers(PortPrivPtr pPPriv, Bool remove) +{ + int i; + + for (i = 0; i < MAX_BUFFERS; i++) + if (pPPriv->pFBArea[i]) + pPPriv->pFBArea[i]->RemoveAreaCallback = + remove ? RemoveAreaCallback : NULL; +} + +static void +FreeBuffers(PortPrivPtr pPPriv) +{ + DEBUG(AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;) + DEBUG(ScrnInfoPtr pScrn = pAPriv->pScrn;) + int i; + + RemoveableBuffers(pPPriv, FALSE); + + for (i = MAX_BUFFERS - 1; i >= 0; i--) + if (pPPriv->pFBArea[i]) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "FreeBuffers port #%d, buffer #%d, pFB=%p, off=0x%08x\n", + PORTNUM(pPPriv), i, pPPriv->pFBArea[i], pPPriv->BufferBase[i])); + + xf86FreeOffscreenArea(pPPriv->pFBArea[i]); + + pPPriv->pFBArea[i] = NULL; + } + + pPPriv->BuffersAllocated = 0; +} + +enum { FORCE_LINEAR = 1, FORCE_RECT }; + +static int +AllocateBuffers(PortPrivPtr pPPriv, + int w, int h, int bytespp, + int num, int force) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + Bool linear = (force != FORCE_RECT); + int i; + if (!linear) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Sorry, only linear buffers allowed right now ...\n"); + return 0; + } + FreeBuffers(pPPriv); + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SVEN : Tryig ot allocate (%d) %s buffer with : %dx%d, bpp = %d.\n", + num, (force==FORCE_RECT)?"rectangular":"linear", w, h, bytespp)); + for (i = 0; i < num; i++) { + if (linear) { + pPPriv->BufferStride = w * bytespp; + + /* Well, we need to set alignement correctly ... */ +#if 0 + pPPriv->pFBArea[i] = xf86AllocateLinearOffscreenArea(pScrn->pScreen, + (pPPriv->BufferStride * h + + (1 << pGlint->BppShift) -1) >> pGlint->BppShift, + 16 >> pGlint->BppShift, NULL, NULL, (pointer) pPPriv); +#endif + pPPriv->pFBArea[i] = xf86AllocateLinearOffscreenArea(pScrn->pScreen, + pPPriv->BufferStride * h, 0, NULL, NULL, (pointer) pPPriv); + /* Well, not that we have allocated a buffer, let's see + * to what it correspond in the cards memory space ... */ + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SVEN : Let's see what kind of buffer got allocated ...\n" + "\t BOX : x1 = %d, y1 = %d, x2 = %d, y2 = %d.\n" + "\t pScrn->virtualX = %d, pGlint->BppShift = %d.\n", + pPPriv->pFBArea[i]->box.x1, pPPriv->pFBArea[i]->box.y1, + pPPriv->pFBArea[i]->box.x2, pPPriv->pFBArea[i]->box.y2, + pScrn->virtualX, pGlint->BppShift)); + + if (pPPriv->pFBArea[i]) + pPPriv->BufferBase[i] = + ((pPPriv->pFBArea[i]->box.y1 * pScrn->virtualX) + + pPPriv->pFBArea[i]->box.x1) << pGlint->BppShift; + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "New linear buffer %dx%d, rec %dx%d -> pFB=%p, off=0x%08x\n" + "\tNotice : Framebuffer is at : 0x%08x, 0x%08x.\n", + w, h, pPPriv->BufferStride, h, pPPriv->pFBArea[i], + pPPriv->BufferBase[i], pGlint->FbAddress, pGlint->FbBase)); + } else { +#if 0 + /* SVEN : well for now, all buffers are linear, so we don't need + * to worry. */ + pPPriv->BufferStride = pScrn->displayWidth << BPPSHIFT(pGlint); + pPPriv->pFBArea[i] = xf86AllocateOffscreenArea(pScrn->pScreen, + w, h, 8 >> BPPSHIFT(pGlint), NULL, NULL, (pointer) pPPriv); + if (pPPriv->pFBArea[i]) + pPPriv->BufferBase[i] = + ((pPPriv->pFBArea[i]->box.y1 * pScrn->displayWidth) + + pPPriv->pFBArea[i]->box.x1) << BPPSHIFT(pGlint); + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "New rect buffer %dx%d, stride %d, pFB=%p, off=0x%08x\n", + w, h, pPPriv->BufferStride, pPPriv->pFBArea[i], + pPPriv->BufferBase[i])); +#endif + } + if (pPPriv->pFBArea[i]) + continue; + } + + return pPPriv->BuffersAllocated = i; + return pPPriv->CurrentBuffer = 0; +} + +/* os/WaitFor.c */ + +static CARD32 +TimerCallback(OsTimerPtr pTim, CARD32 now, pointer p) +{ + AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) p; + int i; + + for (i = 0; i <= PORTS; i++) { + if (pAPriv->Port[i].StopDelay >= 0) { + if (!(pAPriv->Port[i].StopDelay--)) { + FreeBuffers(&pAPriv->Port[i]); + pAPriv->TimerUsers &= ~(1 << i); + } + } + } + + if (pAPriv->TimerUsers) + return pAPriv->Instant; + + return 0; /* Cancel */ +} + +/* + * Xv interface + */ + +static void +CopyYV12LE(CARD8 *Y, CARD32 *dst, int width, int height, int pitch) +{ + int Y_size = width * height; + CARD8 *V = Y + Y_size; + CARD8 *U = V + (Y_size >> 2); + int pad = (pitch >> 2) - (width >> 1); + int x; + + width >>= 1; + + for (height >>= 1; height > 0; height--) { + for (x = 0; x < width; Y += 2, x++) + *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); + dst += pad; + for (x = 0; x < width; Y += 2, x++) + *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); + dst += pad; + U += width; + V += width; + } +} + +#if X_BYTE_ORDER == X_BIG_ENDIAN + +static void +CopyYV12BE(CARD8 *Y, CARD32 *dst, int width, int height, int pitch) +{ + int Y_size = width * height; + CARD8 *V = Y + Y_size; + CARD8 *U = V + (Y_size >> 2); + int pad = (pitch >> 2) - (width >> 1); + int x; + + width >>= 1; + + for (height >>= 1; height > 0; height--) { + for (x = 0; x < width; Y += 2, x++) + *dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24); + dst += pad; + for (x = 0; x < width; Y += 2, x++) + *dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24); + dst += pad; + U += width; + V += width; + } +} + +#endif /* X_BYTE_ORDER == X_BIG_ENDIAN */ + +static void +CopyFlat(CARD8 *src, CARD8 *dst, int width, int height, int pitch) +{ + if (width == pitch) { + memcpy(dst, src, width * height); + return; + } + + while (height > 0) { + memcpy(dst, src, width); + dst += pitch; + src += width; + height--; + } +} + +#define FORMAT_RGB8888 PM3VideoOverlayMode_COLORFORMAT_RGB8888 +#define FORMAT_RGB4444 PM3VideoOverlayMode_COLORFORMAT_RGB4444 +#define FORMAT_RGB5551 PM3VideoOverlayMode_COLORFORMAT_RGB5551 +#define FORMAT_RGB565 PM3VideoOverlayMode_COLORFORMAT_RGB565 +#define FORMAT_RGB332 PM3VideoOverlayMode_COLORFORMAT_RGB332 +#define FORMAT_BGR8888 PM3VideoOverlayMode_COLORFORMAT_BGR8888 +#define FORMAT_BGR4444 PM3VideoOverlayMode_COLORFORMAT_BGR4444 +#define FORMAT_BGR5551 PM3VideoOverlayMode_COLORFORMAT_BGR5551 +#define FORMAT_BGR565 PM3VideoOverlayMode_COLORFORMAT_BGR565 +#define FORMAT_BGR332 PM3VideoOverlayMode_COLORFORMAT_BGR332 +#define FORMAT_CI8 PM3VideoOverlayMode_COLORFORMAT_CI8 +#define FORMAT_VUY444 PM3VideoOverlayMode_COLORFORMAT_VUY444 +#define FORMAT_YUV444 PM3VideoOverlayMode_COLORFORMAT_YUV444 +#define FORMAT_VUY422 PM3VideoOverlayMode_COLORFORMAT_VUY422 +#define FORMAT_YUV422 PM3VideoOverlayMode_COLORFORMAT_YUV422 + +#define RAMDAC_WRITE(data,index) \ +do{ \ + mem_barrier(); \ + GLINT_WAIT(3); \ + mem_barrier(); \ + GLINT_WRITE_REG(((index)>>8)&0xff, PM3RD_IndexHigh); \ + mem_barrier(); \ + GLINT_WRITE_REG((index)&0xff, PM3RD_IndexLow); \ + mem_barrier(); \ + GLINT_WRITE_REG(data, PM3RD_IndexedData); \ + mem_barrier(); \ +}while(0) + +/* Notice, have to check that we dont overflow the deltas here ... */ +static void +compute_scale_factor( + unsigned int* src_w, unsigned int* dst_w, + unsigned int* shrink_delta, unsigned int* zoom_delta) +{ + if (*src_w >= *dst_w) { + *dst_w &= ~0x3; + *shrink_delta = (((*src_w << 16) / *dst_w) & 0x0ffffff0) + 0x10; + *zoom_delta = 1<<16; + } else { + if (*src_w & 0x3) *src_w = (*src_w & ~0x3) + 4; + *shrink_delta = 1<<16; + for (;*dst_w > *src_w; *dst_w--) { + *zoom_delta = (*src_w << 16) / *dst_w; + if (((((*zoom_delta&0xf)+1) * *dst_w * *dst_w) >> 16) < *src_w) { + *zoom_delta = ((*zoom_delta & ~0xf) + 0x10) & 0x0001fff0; + return; + } + } + *zoom_delta = 1<<16; + } +} + +/* BeginOverlay ... + * This is still not workign correctly, in particular if we are + * using shrinking, since what we have to check is not a multiple of 4 + * width is the shrinked width, not the original width. + */ +static void +BeginOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num, + int format, int bpp_shift, int alpha) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + unsigned int src_w = pPPriv->vw; + unsigned int dst_w = pPPriv->dw; + unsigned int shrink_delta, zoom_delta; + + /* Let's adjust the width of source and dest to be compliant with + * the Permedia3 overlay unit requirement, and compute the X deltas. */ + compute_scale_factor(&src_w, &dst_w, &shrink_delta, &zoom_delta); + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "BeginOverlay %08x %08x %d %d\n", + BufferBase[0], format, bpp_shift, alpha)); + if (src_w != pPPriv->vw) + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "BeginOverlay : Padding video width to 4 pixels %d->%d.\n", + pPPriv->vw, src_w)); + if (dst_w != pPPriv->dw) + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "BeginOverlay : Scaling destination width from %d to %d.\n" + "\tThe scaling factor is to high, and may cause problems.", + pPPriv->dw, dst_w)); + if (alpha) + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0, + "BeginOverlay Sorry, Alpha is not yet supported, disabling it.\n")); + + GLINT_WAIT(12); + GLINT_WRITE_REG(3|(12<<16), PM3VideoOverlayFifoControl); + /* Updating the Video Overlay Source Image Parameters */ + switch (num) { + case 0: + GLINT_WRITE_REG((BufferBase[0]>>bpp_shift), PM3VideoOverlayBase0); + break; + case 1: + GLINT_WRITE_REG((BufferBase[1]>>bpp_shift), PM3VideoOverlayBase1); + break; + case 2: + GLINT_WRITE_REG((BufferBase[2]>>bpp_shift), PM3VideoOverlayBase2); + break; + } + GLINT_WRITE_REG(num, PM3VideoOverlayIndex); + GLINT_WRITE_REG(format | + PM3VideoOverlayMode_BUFFERSYNC_MANUAL | + PM3VideoOverlayMode_FLIP_VIDEO | + PM3VideoOverlayMode_FILTER_FULL | + PM3VideoOverlayMode_ENABLE, + PM3VideoOverlayMode); + /* Let's set the source stride. */ + GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(pPPriv->fw), + PM3VideoOverlayStride); + /* Let's set the position and size of the visible part of the source. */ + GLINT_WRITE_REG(PM3VideoOverlayWidth_WIDTH(src_w), + PM3VideoOverlayWidth); + GLINT_WRITE_REG(PM3VideoOverlayHeight_HEIGHT(pPPriv->vh), + PM3VideoOverlayHeight); + GLINT_WRITE_REG( + PM3VideoOverlayOrigin_XORIGIN(pPPriv->vx) | + PM3VideoOverlayOrigin_YORIGIN(pPPriv->vy), + PM3VideoOverlayOrigin); + /* Scale the source to the destinationsize */ + if (pPPriv->vh == pPPriv->dh) { + GLINT_WRITE_REG( + PM3VideoOverlayYDelta_NONE, + PM3VideoOverlayYDelta); + } else { + GLINT_WRITE_REG( + PM3VideoOverlayYDelta_DELTA(pPPriv->vh,pPPriv->dh), + PM3VideoOverlayYDelta); + } + GLINT_WRITE_REG(shrink_delta, PM3VideoOverlayShrinkXDelta); + GLINT_WRITE_REG(zoom_delta, PM3VideoOverlayZoomXDelta); + /* Launch the true update at the next FrameBlank */ + GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE, + PM3VideoOverlayUpdate); + /* Setting the ramdac video overlay rgion */ + /* Begining of overlay region */ + RAMDAC_WRITE((pPPriv->dx&0xff), PM3RD_VideoOverlayXStartLow); + RAMDAC_WRITE((pPPriv->dx&0xf00)>>8, PM3RD_VideoOverlayXStartHigh); + RAMDAC_WRITE((pPPriv->dy&0xff), PM3RD_VideoOverlayYStartLow); + RAMDAC_WRITE((pPPriv->dy&0xf00)>>8, PM3RD_VideoOverlayYStartHigh); + /* End of overlay regions (+1) */ + RAMDAC_WRITE(((pPPriv->dx+dst_w)&0xff), PM3RD_VideoOverlayXEndLow); + RAMDAC_WRITE(((pPPriv->dx+dst_w)&0xf00)>>8,PM3RD_VideoOverlayXEndHigh); + RAMDAC_WRITE(((pPPriv->dy+pPPriv->dh)&0xff), PM3RD_VideoOverlayYEndLow); + RAMDAC_WRITE(((pPPriv->dy+pPPriv->dh)&0xf00)>>8,PM3RD_VideoOverlayYEndHigh); + + /* And now enable Video Overlay in the RAMDAC */ + RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_MODE_ALWAYS, + PM3RD_VideoOverlayControl); + + /* Let's use a double buffering scheme */ + pPPriv->CurrentBuffer = 1-pPPriv->CurrentBuffer; +} + +static void +StopOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num, int cleanup) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "StopOverlay.\n")); + /* Stop the Video Overlay in the RAMDAC */ + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, + PM3RD_VideoOverlayControl); + /* Stop the Video Overlay in the Video Overlay Unit */ + GLINT_WAIT(1); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); +} +static int +Permedia3PutImage(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) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + GLINTPtr pGlint = GLINTPTR(pScrn); + int i; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "PutImage %d,%d,%d,%d -> %d,%d,%d,%d id=0x%08x buf=%p w=%d h=%d sync=%d\n", + src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, + id, buf, width, height, sync)); + + /* SVEN : Let's check if the source window is contained in the + * actual source */ + if ((src_x + src_w) > width || + (src_y + src_h) > height) + return BadValue; + + pPPriv->vx = src_x; + pPPriv->vy = src_y; + pPPriv->vw = src_w; + pPPriv->vh = src_h; + + pPPriv->dx = drw_x; + pPPriv->dy = drw_y; + pPPriv->dw = drw_w; + pPPriv->dh = drw_h; + + /* SVEN : Let's check if there is a allocated buffer already of the same + * id, width and height. If yes, use it, if not, we need to allocate one. + */ + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SVEN : PutImage Do we need to allocate buffers ?\n" + "\t existing : buffers = %d, id = %d, fw = %d, fh = %d.\n" + "\t requested : buffers = %d, id = %d, fw = %d, fh = %d.\n", + pPPriv->BuffersAllocated, pPPriv->Id, pPPriv->fw, pPPriv->fh, + 3, id, width, height)); + + /* Maybe we would test for correct bpp instead of if here, ? */ + if (pPPriv->BuffersAllocated <= 0 || + id != pPPriv->Id || /* same bpp */ + width != pPPriv->fw || + height != pPPriv->fh) + { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SVEN : PutImage, yes, we need to allocate buffers, isn't it ?.\n")); + /* SVEN : search for a ScalerImage corresponding to the id */ + for (i = 0; i < ENTRIES(ScalerImages); i++) + if (id == ScalerImages[i].id) + break; + + /* SVEN : If no scaler was found, we stop here and then */ + if (i >= ENTRIES(ScalerImages)) + return XvBadAlloc; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SVEN : PutImage, We did found a compatible image format (%d).\n", i)); + /* SVEN : Let's sync the chip ... (we do that a lot ...) */ + if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); + else Permedia3Sync(pScrn); +#if 0 /* SVEN : This was not disabled by me, don't know what it was */ + if (pPPriv->BuffersAllocated <= 0 || + pPPriv->Bpp != ScalerImages[i].bits_per_pixel || + width > pPPriv->fw || height > pPPriv->fw || + pPPriv->fw * pPPriv->fh > width * height * 2) +#else + if (1) +#endif + { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SVEN : PutImage, We will allocate a buffer ...\n")); + /* SVEN : Let's allocate a buffer to store the image. + * If it is not possible, we exit */ + if (!AllocateBuffers(pPPriv, width, height, + (ScalerImages[i].bits_per_pixel + 7) >> 3, 3, 0)) { + pPPriv->Id = 0; + pPPriv->Bpp = 0; + pPPriv->fw = 0; + pPPriv->fh = 0; + + return XvBadAlloc; + } + + /* SVEN : We set the id, bpp, width and height values of + * the allocated buffer, so that we will not need to + * allocate a buffer again on the next frame. */ + pPPriv->Id = id; + pPPriv->Bpp = ScalerImages[i].bits_per_pixel; + pPPriv->fw = width; + pPPriv->fh = height; + + /* SVEN : Add RemoveAreaCallBack to the pFBAreas of each buffer */ + /* Let's see if this cause the crash ??? No, it doesn't ... */ + RemoveableBuffers(pPPriv, TRUE); + } + } else + if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); + else Permedia3Sync(pScrn); + + switch (id) { + case LE4CC('Y','V','1','2'): +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + CopyYV12LE(buf, + (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[pPPriv->CurrentBuffer]), + width, height, pPPriv->BufferStride); +#else + if (pGlint->FBDev) + CopyYV12LE(buf, + (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]), + width, height, pPPriv->BufferStride); + else + CopyYV12BE(buf, + (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]), + width, height, pPPriv->BufferStride); +#endif + BeginOverlay(pPPriv, pPPriv->BufferBase, pPPriv->CurrentBuffer, FORMAT_YUV422, 1, 0); + break; + + case LE4CC('Y','U','Y','2'): + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 1, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_YUV422, 1, 0); + break; + + case LE4CC('U','Y','V','Y'): + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 1, height, pPPriv->BufferStride); + /* Not sure about this one ... */ + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_VUY422, 1, 0); + break; + + case LE4CC('Y','U','V','A'): + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 2, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_YUV444, 2, pPPriv->Attribute[7]); + break; + + case LE4CC('V','U','Y','A'): + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 2, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_VUY444, 2, pPPriv->Attribute[7]); + break; + + case 0x41: /* RGBA 8:8:8:8 */ + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 2, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB8888, 2, pPPriv->Attribute[7]); + break; + + case 0x42: /* RGB 5:6:5 */ + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 1, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB565, 1, 0); + break; + + case 0x43: /* RGB 1:5:5:5 */ + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 1, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB5551, 1, pPPriv->Attribute[7]); + break; + + case 0x44: /* RGB 4:4:4:4 */ + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 1, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB4444, 1, pPPriv->Attribute[7]); + break; + + case 0x46: /* RGB 2:3:3 */ + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB332, 0, 0); + break; + + case 0x47: /* BGRA 8:8:8:8 */ + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 2, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR8888, 2, pPPriv->Attribute[7]); + break; + + case 0x48: /* BGR 5:6:5 */ + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "PutImage case (13) BGR565.\n")); + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 1, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR565, 1, 0); + break; + + case 0x49: /* BGR 1:5:5:5 */ + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 1, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR5551, 1, pPPriv->Attribute[7]); + break; + + case 0x4A: /* BGR 4:4:4:4 */ + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "PutImage case (15) BGR4444.\n")); + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 1, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR4444, 1, pPPriv->Attribute[7]); + break; + + case 0x4C: /* BGR 2:3:3 */ + CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + width << 0, height, pPPriv->BufferStride); + BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR332, 0, 0); + break; + + default: + return XvBadAlloc; + } + + /* SVEN : Don't know what these two are for, let them stay as is */ + pPPriv->StopDelay = pAPriv->Delay; + if (!pAPriv->TimerUsers) { + pAPriv->TimerUsers |= 1 << PORTNUM(pPPriv); + TimerSet(pAPriv->Timer, 0, 80, TimerCallback, pAPriv); + } + + if (sync) { + if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); + else Permedia3Sync(pScrn); + } + + return Success; +} + +static void +Permedia3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "StopVideo port=%d, exit=%d\n", PORTNUM(pPPriv), cleanup)); + + StopOverlay(pPPriv, pPPriv->BufferBase, pPPriv->CurrentBuffer, cleanup); + + if (cleanup) { + FreeBuffers(pPPriv); + if (pAPriv->TimerUsers) { + pAPriv->TimerUsers &= ~PORTNUM(pPPriv); + if (!pAPriv->TimerUsers) + TimerCancel(pAPriv->Timer); + } + } +} + +static int +Permedia3SetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 value, pointer data) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SPA attr=%d val=%d port=%d\n", + attribute, value, PORTNUM(pPPriv))); + + return Success; +} + +static int +Permedia3GetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 *value, pointer data) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + + if (PORTNUM(pPPriv) >= 2 && + attribute != xvFilter && + attribute != xvAlpha) + return BadMatch; + + if (attribute == xvEncoding) { + if (pAPriv->VideoStd < 0) + return XvBadAlloc; + else + if (pPPriv == &pAPriv->Port[0]) + *value = pAPriv->VideoStd * 3 + pPPriv->Plug; + else + *value = pAPriv->VideoStd * 2 + pPPriv->Plug - 1; + } else if (attribute == xvBrightness) + *value = pPPriv->Attribute[0]; + else if (attribute == xvContrast) + *value = pPPriv->Attribute[1]; + else if (attribute == xvSaturation) + *value = pPPriv->Attribute[2]; + else if (attribute == xvHue) + *value = pPPriv->Attribute[3]; + else if (attribute == xvInterlace) + *value = pPPriv->Attribute[4]; + else if (attribute == xvFilter) + *value = pPPriv->Attribute[5]; + else if (attribute == xvBkgColor) + *value = pPPriv->Attribute[6]; + else if (attribute == xvAlpha) + *value = pPPriv->Attribute[7]; + else + return BadMatch; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "GPA attr=%d val=%d port=%d\n", + attribute, *value, PORTNUM(pPPriv))); + + return Success; +} + +static void +Permedia3QueryBestSize(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) +{ + unsigned int zoom_delta, shrink_delta, src_w; + + *p_w = drw_w; + compute_scale_factor (&src_w, p_w, &shrink_delta, &zoom_delta); + *p_h = drw_h; +} + +static int +Permedia3QueryImageAttributes(ScrnInfoPtr pScrn, + int id, unsigned short *width, unsigned short *height, + int *pitches, int *offsets) +{ + int i, pitch; + + *width = CLAMP(*width, 1, 2047); + *height = CLAMP(*height, 1, 2047); + + if (offsets) + offsets[0] = 0; + + switch (id) { + case LE4CC('Y','V','1','2'): /* Planar YVU 4:2:0 (emulated) */ + *width = CLAMP((*width + 1) & ~1, 2, 2046); + *height = CLAMP((*height + 1) & ~1, 2, 2046); + + pitch = *width; /* luma component */ + + if (offsets) { + offsets[1] = pitch * *height; + offsets[2] = offsets[1] + (offsets[1] >> 2); + } + + if (pitches) { + pitches[0] = pitch; + pitches[1] = pitches[2] = pitch >> 1; + } + + return pitch * *height * 3 / 2; + + case LE4CC('Y','U','Y','2'): /* Packed YUYV 4:2:2 */ + case LE4CC('U','Y','V','Y'): /* Packed UYVY 4:2:2 */ + *width = CLAMP((*width + 1) & ~1, 2, 2046); + + pitch = *width * 2; + + if (pitches) + pitches[0] = pitch; + + return pitch * *height; + + default: + for (i = 0; i < ENTRIES(ScalerImages); i++) + if (ScalerImages[i].id == id) + break; + + if (i >= ENTRIES(ScalerImages)) + break; + + pitch = *width * (ScalerImages[i].bits_per_pixel >> 3); + + if (pitches) + pitches[0] = pitch; + + return pitch * *height; + } + + return 0; +} + +static void +DeleteAdaptorPriv(AdaptorPrivPtr pAPriv) +{ + int i; + + for (i = 0; i < PORTS; i++) { + FreeBuffers(&pAPriv->Port[i]); + } + + TimerFree(pAPriv->Timer); + + xfree(pAPriv); +} + +static AdaptorPrivPtr +NewAdaptorPriv(ScrnInfoPtr pScrn) +{ + AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) xcalloc(1, sizeof(AdaptorPrivRec)); + int i; + + if (!pAPriv) return NULL; + + pAPriv->pScrn = pScrn; + + if (!(pAPriv->Timer = TimerSet(NULL, 0, 0, TimerCallback, pAPriv))) { + DeleteAdaptorPriv(pAPriv); + return NULL; + } + + for (i = 0; i < PORTS; i++) { + pAPriv->Port[i].pAdaptor = pAPriv; + + pAPriv->Port[i].StopDelay = -1; + pAPriv->Port[i].fw = 0; + pAPriv->Port[i].fh = 0; + pAPriv->Port[i].BuffersRequested = 1; + pAPriv->Delay = 125; + pAPriv->Instant = 1000 / 25; + + pAPriv->Port[i].Attribute[5] = 0; /* Bilinear Filter (Bool) */ + pAPriv->Port[i].Attribute[7] = 0; /* Alpha Enable (Bool) */ + } + + return pAPriv; +} + + +/* + * Glint interface + */ + +void +Permedia3VideoEnterVT(ScrnInfoPtr pScrn) +{ + AdaptorPrivPtr pAPriv; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv enter VT\n")); + + for (pAPriv = AdaptorPrivList; pAPriv != NULL; pAPriv = pAPriv->Next) + if (pAPriv->pScrn == pScrn) { + /* SVEN : nothing is done here, since we disabled + * input/ouput video support. */ + } +} + +void +Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) +{ + AdaptorPrivPtr pAPriv; + + for (pAPriv = AdaptorPrivList; pAPriv != NULL; pAPriv = pAPriv->Next) + if (pAPriv->pScrn == pScrn) { + /* SVEN : nothing is done here, since we disabled + * input/ouput video support. */ + } + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv leave VT\n")); +} + +void +Permedia3VideoUninit(ScrnInfoPtr pScrn) +{ + AdaptorPrivPtr pAPriv, *ppAPriv; + + for (ppAPriv = &AdaptorPrivList; (pAPriv = *ppAPriv); ppAPriv = &(pAPriv->Next)) + if (pAPriv->pScrn == pScrn) { + *ppAPriv = pAPriv->Next; + DeleteAdaptorPriv(pAPriv); + break; + } + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv cleanup\n")); +} + +void +Permedia3VideoInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GLINTPtr pGlint = GLINTPTR(pScrn); + AdaptorPrivPtr pAPriv; + DevUnion Private[PORTS]; + XF86VideoAdaptorRec VAR; + XF86VideoAdaptorPtr VARPtrs; + int i; + + switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + break; + + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) break; + + default: + xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, + "No Xv support for chipset %d.\n", pGlint->Chipset); + return; + } + + if (pGlint->NoAccel) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, + "Sorry, need to enable accel for Xv support for Permedia3.\n"); + return; + } + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, + "Initializing Xv driver rev. 1\n"); + + if (!(pAPriv = NewAdaptorPriv(pScrn))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Xv driver initialization failed\n"); + return; + } + + memset(&VAR, 0, sizeof(VAR)); + + for (i = 0; i < PORTS; i++) + Private[i].ptr = (pointer) &pAPriv->Port[i]; + + VARPtrs = &VAR; + + VAR.type = XvInputMask | XvWindowMask | XvImageMask; + VAR.flags = VIDEO_OVERLAID_IMAGES; + VAR.name = "Permedia 3 Frontend Scaler"; + VAR.nEncodings = ENTRIES(ScalerEncodings); + VAR.pEncodings = ScalerEncodings; + VAR.nFormats = ENTRIES(ScalerVideoFormats); + VAR.pFormats = ScalerVideoFormats; + VAR.nPorts = 3; + VAR.pPortPrivates = &Private[0]; + VAR.nAttributes = ENTRIES(ScalerAttributes); + VAR.pAttributes = ScalerAttributes; + VAR.nImages = ENTRIES(ScalerImages); + VAR.pImages = ScalerImages; + + VAR.PutVideo = NULL; + VAR.PutStill = NULL; + VAR.GetVideo = NULL; + VAR.GetStill = NULL; + VAR.StopVideo = Permedia3StopVideo; + VAR.SetPortAttribute = Permedia3SetPortAttribute; + VAR.GetPortAttribute = Permedia3GetPortAttribute; + VAR.QueryBestSize = Permedia3QueryBestSize; + VAR.PutImage = Permedia3PutImage; + VAR.QueryImageAttributes = Permedia3QueryImageAttributes; + + if (xf86XVScreenInit(pScreen, &VARPtrs, 1)) { + xvEncoding = MAKE_ATOM(XV_ENCODING); + xvHue = MAKE_ATOM(XV_HUE); + xvSaturation = MAKE_ATOM(XV_SATURATION); + xvBrightness = MAKE_ATOM(XV_BRIGHTNESS); + xvContrast = MAKE_ATOM(XV_CONTRAST); + xvInterlace = MAKE_ATOM(XV_INTERLACE); + xvFilter = MAKE_ATOM(XV_FILTER); + xvBkgColor = MAKE_ATOM(XV_BKGCOLOR); + xvAlpha = MAKE_ATOM(XV_ALPHA); + + /* Add it to the AdaptatorList */ + pAPriv->Next = AdaptorPrivList; + AdaptorPrivList = pAPriv; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Xv frontend scaler enabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Xv initialization failed\n"); + DeleteAdaptorPriv(pAPriv); + } +} + +#endif /* XvExtension */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h b/xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h index 7a57c0496..a03835aae 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h,v 1.1 2000/10/04 23:34:58 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h,v 1.2 2001/03/03 22:26:11 tsi Exp $ */ /* * Copyright 1994-2000 by Robin Cutshaw <robin@XFree86.Org> * @@ -24,8 +24,6 @@ /* $XConsortium: $ */ #include "compiler.h" -#include <X11/Xfuncproto.h> - /* Indirect indexed registers */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h index 3e0b14b83..031111ff7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h,v 1.4 2000/12/11 01:53:00 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h,v 1.5 2001/04/01 14:00:11 tsi Exp $ */ /* * Number Nine I128 functions * @@ -135,6 +135,6 @@ Bool I128ProgramSilverHammer(ScrnInfoPtr pScrn, DisplayModePtr mode); void I128DumpBaseRegisters(ScrnInfoPtr pScrn); void I128DumpActiveRegisters(ScrnInfoPtr pScrn); -void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile unsigned long *vrbg); +void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg); #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c index 4ce35cb0a..91aed1167 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.18 2001/01/21 21:19:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.19 2001/04/01 14:00:11 tsi Exp $ */ /* All drivers should typically include these */ @@ -2105,7 +2105,7 @@ I128DumpActiveRegisters(ScrnInfoPtr pScrn) unsigned short iobase; unsigned long rbase_g, rbase_w, rbase_a, rbase_b, rbase_i, rbase_e; unsigned long id, config1, config2, sgram, soft_sw, ddc, vga_ctl; - volatile unsigned long *vrba, *vrbg, *vrbw; + volatile CARD32 *vrba, *vrbg, *vrbw; vrba = pI128->mem.rbase_a; vrbg = pI128->mem.rbase_g; @@ -2343,7 +2343,7 @@ static unsigned char ibm52Xmask[0xA0] = { }; void -I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile unsigned long *vrbg) +I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg) { unsigned char ibmr[0x100]; char buf[128], tbuf[10]; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c index f5e3c5435..19336e0a6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c,v 1.1 2000/12/11 01:53:01 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c,v 1.2 2001/04/01 14:00:11 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -260,7 +260,7 @@ I128_OpenFramebuffer( int *flags ){ I128Ptr pI128 = I128PTR(pScrn); - CARD32 FbAddress = pI128->PciInfo->memBase[0] & 0xFFC00000; + unsigned long FbAddress = pI128->PciInfo->memBase[0] & 0xFFC00000; *name = NULL; /* no special device */ *mem = (unsigned char*)FbAddress; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c index 21f5bbbab..70b32a32b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.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/i740/i740_accel.c,v 1.4 2000/04/05 18:13:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c,v 1.5 2001/03/03 22:26:12 tsi Exp $ */ /* * Authors: @@ -33,10 +33,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#if 0 -#include <math.h> -#endif - #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" 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 81a54dcb0..e99307a7f 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.14 2000/12/21 12:22:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.17 2001/03/21 19:46:27 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -68,14 +68,15 @@ Bool I810InitDma(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); I810RingBuffer *ring = &(pI810->LpRing); + I810DRIPtr pI810DRI = (I810DRIPtr) pI810->pDRIInfo->devPrivate; drmI810Init info; Bool ret_val; info.start = ring->mem.Start; info.end = ring->mem.End; info.size = ring->mem.Size; - info.ring_map_idx = 6; - info.buffer_map_idx = 5; + info.mmio_offset = (unsigned int)pI810DRI->regs; + info.buffers_offset = (unsigned int)pI810->buffer_map; info.sarea_off = sizeof(XF86DRISAREARec); info.front_offset = 0; @@ -203,7 +204,6 @@ static unsigned int mylog2(unsigned int n) return log2; } - Bool I810DRIScreenInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -240,9 +240,9 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "I810DRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n", + "I810DRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n", major, minor, patch); return FALSE; } @@ -310,6 +310,8 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = I810DRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; /* This adds the framebuffer as a drm map *before* we have asked agp * to allocate it. Scary stuff, hold on... @@ -328,8 +330,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) drmVersionPtr version = drmGetVersion(pI810->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor != 1 || - version->version_patchlevel < 0) { + version->version_minor < 1) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "I810DRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", @@ -683,6 +684,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n", bufs, I810_DMA_BUF_SZ); + xf86EnablePciBusMaster(pI810->PciInfo, TRUE); I810InitDma(pScrn); @@ -733,6 +735,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) pI810DRI->auxPitch = pI810->auxPitch; pI810DRI->auxPitchBits = pI810->auxPitchBits; + pI810DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); if (!(I810InitVisualConfigs(pScreen))) { xf86DrvMsg(pScreen->myNum, X_ERROR, "I810InitVisualConfigs failed\n"); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h index bbb0cc927..f8e46ee3a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h @@ -1,10 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.3 2000/06/17 00:03:18 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.5 2001/03/21 17:02:23 dawes Exp $ */ #ifndef _I810_DRI_ #define _I810_DRI_ -#include <xf86drm.h> -#include <xf86drmI810.h> +#include "xf86drm.h" +#include "xf86drmI810.h" #define I810_MAX_DRAWABLES 256 @@ -50,6 +50,7 @@ typedef struct { drmBufMapPtr drmBufs; int irq; + unsigned int sarea_priv_offset; } I810DRIRec, *I810DRIPtr; 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 985ff3f10..1d4be078c 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.43 2001/01/21 21:19:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.44 2001/03/02 02:45:38 dawes Exp $ */ /* * Authors: @@ -35,7 +35,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * This server does not support these XFree86 4.0 features yet - * DDC1 & DDC2 (requires I2C) * shadowFb (if requested or acceleration is off) * Overlay planes * DGA @@ -121,7 +120,8 @@ typedef enum { OPTION_COLOR_KEY, OPTION_CACHE_LINES, OPTION_DAC_6BIT, - OPTION_DRI + OPTION_DRI, + OPTION_NO_DDC } I810Opts; static OptionInfoRec I810Options[] = { @@ -131,6 +131,7 @@ static OptionInfoRec I810Options[] = { { OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE}, { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_NO_DDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, { -1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -164,6 +165,13 @@ static const char *miscSymbols[] = { static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", + NULL +}; + +static const char *ddcSymbols[] = { + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; @@ -293,7 +301,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) driSymbols, #endif vbeSymbols, - NULL /* ddcsymbols */, + ddcSymbols, NULL /* i2csymbols */, NULL /* shadowSymbols */, NULL /* fbdevsymbols */, @@ -427,6 +435,29 @@ I810ProbeDDC(ScrnInfoPtr pScrn, int index) } } +static xf86MonPtr +I810DoDDC(ScrnInfoPtr pScrn, int index) +{ + vbeInfoPtr pVbe; + xf86MonPtr MonInfo = NULL; + + /* Honour Option "noDDC" */ + if (xf86ReturnOptValBool(I810Options, OPTION_NO_DDC, FALSE) ) { + return MonInfo; + } + + if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL,index))) { + MonInfo = vbeDoEDID(pVbe, NULL); + xf86PrintEDID( MonInfo ); + xf86SetDDCproperties(pScrn, MonInfo); + vbeFree(pVbe); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "this driver cannot do DDC without VBE\n"); + } + + return MonInfo; +} + /* * I810PreInit -- * @@ -546,6 +577,13 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) { ptr->found=FALSE; } + /* Get DDC info from monitor */ + /* after xf86ProcessOptions, + * because it is controlled by options [no]vbe and [no]ddc + */ + pScrn->monitor->DDC = I810DoDDC(pScrn, pI810->pEnt->index); + + /* We have to use PIO to probe, because we haven't mapped yet */ I810SetPIOAccess(pI810); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h b/xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h index 84dcafe90..095dead6b 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.3 2000/08/02 23:50:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h,v 1.4 2001/04/05 21:29:14 dawes Exp $ */ #ifndef _IMSTT_H #define _IMSTT_H @@ -34,6 +34,7 @@ typedef struct _IMSTTRec { Bool FBDev; int Chipset, ChipRev; int ydir; + int color; unsigned long pitch; unsigned long ll; unsigned long screen_width; 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 6bee19f0a..5eef2aa19 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.4 2000/08/01 20:05:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c,v 1.5 2001/04/05 21:29:14 dawes Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -45,6 +45,7 @@ static void IMSTTSync(ScrnInfoPtr pScrn) while(INREG(IMSTT_SSTATUS) & 0x80); while(INREG(IMSTT_SSTATUS) & 0x40); + return; } @@ -55,11 +56,18 @@ 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); + switch (pScrn->depth) { + case 8: + iptr->color = color | (color << 8) | (color << 16) | (color << 24); + break; + case 15: + case 16: + iptr->color = color | (color << 8) | (color << 16); + break; + default: + iptr->color = color; + break; + } } @@ -69,13 +77,28 @@ static void IMSTTSubsequentSolidFillRect(ScrnInfoPtr pScrn, IMSTTPtr iptr = IMSTTPTR(pScrn); IMSTTMMIO_VARS(); - 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)); + x *= (pScrn->bitsPerPixel >> 3); + y *= iptr->ll; + w *= (pScrn->bitsPerPixel >> 3); + h--; + w--; + + while(INREG(IMSTT_SSTATUS) & 0x80); + OUTREG(IMSTT_DSA, x + y); + OUTREG(IMSTT_CNT, (h << 16) | w); + OUTREG(IMSTT_DP_OCTL, iptr->ll); + OUTREG(IMSTT_SP, iptr->ll); + OUTREG(IMSTT_BI, 0xffffffff); + OUTREG(IMSTT_MBC, 0xffffffff); + OUTREG(IMSTT_CLR, iptr->color); + if (iptr->rev == 2) OUTREG(IMSTT_BLTCTL, 0x200000); else OUTREG(IMSTT_BLTCTL, 0x840); + + while(INREG(IMSTT_SSTATUS) & 0x80); + while(INREG(IMSTT_SSTATUS) & 0x40); } @@ -88,17 +111,20 @@ static void IMSTTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, unsigned long sp, dp, ll, cnt; iptr->bltctl = 0x05; + + ll = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3); ll = iptr->ll; + sp = ll << 16; - if (xdir > 0) { + if (xdir < 0) { iptr->bltctl |= 0x80; iptr->cnt = 1; } else { iptr->cnt = 0; } - if (ydir > 0) { + if (ydir < 0) { sp |= -(ll) & 0xffff; dp = -(ll) & 0xffff; iptr->ydir = 1; @@ -110,6 +136,7 @@ static void IMSTTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, iptr->sp = sp; iptr->dp = dp; + iptr->ll = ll; } @@ -122,6 +149,9 @@ static void IMSTTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, IMSTTMMIO_VARS(); unsigned long cnt; + x1 *= (pScrn->bitsPerPixel >> 3); + x2 *= (pScrn->bitsPerPixel >> 3); + w *= (pScrn->bitsPerPixel >> 3); w--; h--; cnt = h << 16; @@ -145,6 +175,8 @@ static void IMSTTSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, OUTREG(IMSTT_CNT, cnt); OUTREG(IMSTT_DP_OCTL, iptr->dp); OUTREG(IMSTT_BLTCTL, iptr->bltctl); + while(INREG(IMSTT_SSTATUS) & 0x80); + while(INREG(IMSTT_SSTATUS) & 0x40); } @@ -160,14 +192,28 @@ Bool IMSTTAccelInit(ScreenPtr pScreen) iptr->ll = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3); - iptr->screen_width = iptr->pitch = iptr->ll; + switch (pScrn->bitsPerPixel) { + case 16: + iptr->screen_width = iptr->pitch >> 1; + break; + case 24: + case 32: + iptr->screen_width = iptr->pitch >> 2; + break; + default: + iptr->screen_width = iptr->pitch = iptr->ll; + break; + } xaaptr->Flags = (PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER); xaaptr->Sync = IMSTTSync; - xaaptr->SetupForSolidFill = IMSTTSetupForSolidFill; - xaaptr->SubsequentSolidFillRect = IMSTTSubsequentSolidFillRect; + if (pScrn->bitsPerPixel == 8) { + /* FIXME fills are broken > 8bpp, iptr->color needs to be setup right */ + xaaptr->SetupForSolidFill = IMSTTSetupForSolidFill; + xaaptr->SubsequentSolidFillRect = IMSTTSubsequentSolidFillRect; + } xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; xaaptr->SetupForScreenToScreenCopy = IMSTTSetupForScreenToScreenCopy; 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 b1db68fe4..70d8f9c67 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.10 2000/12/02 15:30:43 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.11 2001/04/05 21:29:14 dawes Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -374,8 +374,7 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - if (pScrn->depth == 8) - pScrn->rgbBits = 8; + pScrn->rgbBits = 8; if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; @@ -423,6 +422,9 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags) iptr->FBDev = FALSE; } + /* hack */ + iptr->FBDev = TRUE; + if (iptr->FBDev) { if (!xf86LoadSubModule(pScrn, "fbdevhw")) return FALSE; @@ -558,7 +560,6 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags) xf86SetDpi(pScrn, 0, 0); xf86LoadSubModule(pScrn, "fb"); -/* xf86LoaderReqSymbols(fbSymbols, NULL); */ xf86LoaderReqSymbols("fbScreenInit", NULL); if (!xf86LoadSubModule(pScrn, "xaa")) @@ -772,6 +773,8 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, } } + iptr->pitch = pScrn->displayWidth; + if (iptr->FBDev) { if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -786,7 +789,7 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, if (pScrn->bitsPerPixel > 8) { if (!miSetVisualTypes(pScrn->depth, TrueColorMask, - pScrn->rgbBits, pScrn->defaultVisual)) + pScrn->rgbBits, TrueColor)) return FALSE; } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), @@ -813,8 +816,6 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, return FALSE; } - xf86SetBlackWhitePixels(pScreen); - if (pScrn->bitsPerPixel > 8) { visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { @@ -829,6 +830,7 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, } } + xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -848,8 +850,8 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, if (!miCreateDefColormap(pScreen)) return FALSE; - if (!xf86HandleColormaps(pScreen, 256, 8, (iptr->FBDev ? fbdevHWLoadPalette : NULL), - NULL, CMAP_RELOAD_ON_MODE_SWITCH)) + if (!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPalette, + NULL, CMAP_PALETTED_TRUECOLOR)) return FALSE; if (serverGeneration == 1) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile index 9ec02c4ea..0291d615a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile @@ -1,6 +1,6 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.41 2001/02/13 19:19:15 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.43 2001/04/05 17:42:32 dawes Exp $ XCOMM -XCOMM This is an Imakefile for the MGA driver. +XCOMM This is an Imakefile for the MGA driver. XCOMM #define IHaveModules @@ -12,8 +12,8 @@ SUBDIRS=hallib #endif #if BuildXF86DRI -DRISRCS = mga_dri.c mga_warp.c mga_wrap.c -DRIOBJS = mga_dri.o mga_warp.o mga_wrap.o +DRISRCS = mga_dri.c +DRIOBJS = mga_dri.o DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \ -I$(TOP)/include DRIDEFINES = $(GLX_DEFINES) @@ -57,10 +57,10 @@ hallib/libmga_hal.a: $(SUBDIRS) MGASRCS = mga_driver.c mga_hwcurs.c /* mga_cmap.c */ mga_dac3026.c mga_dacG.c \ mga_storm8.c mga_storm16.c mga_storm24.c mga_storm32.c mga_arc.c \ - mga_dga.c mga_shadow.c mga_video.c mga_g450pll.c $(DRISRCS) + mga_dga.c mga_shadow.c mga_video.c mga_g450pll.c mga_dh.c $(DRISRCS) MGAOBJS = mga_driver.o mga_hwcurs.o /* mga_cmap.o */ mga_dac3026.o mga_dacG.o \ mga_storm8.o mga_storm16.o mga_storm24.o mga_storm32.o mga_arc.o \ - mga_dga.o mga_shadow.o mga_video.o mga_g450pll.o $(DRIOBJS) + mga_dga.o mga_shadow.o mga_video.o mga_g450pll.o mga_dh.o $(DRIOBJS) SRCS = $(MGASRCS) $(MGAHALSRCS) OBJS = $(MGAOBJS) $(MGAHALOBJS) @@ -102,7 +102,7 @@ ObjectFromSpecialSource(mga_storm8, mga_storm, -DPSZ=8) ObjectFromSpecialSource(mga_storm16, mga_storm, -DPSZ=16) ObjectFromSpecialSource(mga_storm24, mga_storm, -DPSZ=24) ObjectFromSpecialSource(mga_storm32, mga_storm, -DPSZ=32) - + InstallObjectModule(mga,$(MODULEDIR),drivers) #if BuildHalModule InstallObjectModule(mga_hal,$(MODULEDIR),drivers) @@ -141,4 +141,3 @@ MakeSubdirs($(SUBDIRS)) ForceSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h index eed8b8962..9a83c7c21 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.71 2001/02/13 19:19:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.73 2001/04/05 17:42:32 dawes Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -22,16 +22,31 @@ #include "xf86DDC.h" #include "xf86xv.h" + + #ifdef XF86DRI #include "xf86drm.h" -#include "sarea.h" + + #define _XF86DRI_SERVER_ +#include "mga_dripriv.h" +#include "dri.h" +#include "GL/glxint.h" + + + + #include "xf86dri.h" #include "dri.h" + + + #include "GL/glxint.h" #include "mga_dri.h" #endif + + #ifdef USEMGAHAL #include "client.h" #endif @@ -59,6 +74,32 @@ void dbg_outreg32(ScrnInfoPtr,int,int); #define OUTREG(addr,val) dbg_outreg32(pScrn,addr,val) #endif /* EXTRADEBUG */ +/* + * Read/write to the DAC via MMIO + */ + +/* + * These were functions. Use macros instead to avoid the need to + * pass pMga to them. + */ + +#define inMGAdreg(reg) INREG8(RAMDAC_OFFSET + (reg)) + +#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) + +#define inMGAdac(reg) \ + (outMGAdreg(MGA1064_INDEX, reg), inMGAdreg(MGA1064_DATA)) + +#define outMGAdac(reg, val) \ + (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) + +#define outMGAdacmsk(reg, mask, val) \ + do { /* note: mask and reg may get evaluated twice */ \ + unsigned char tmp = (mask) ? (inMGAdac(reg) & (mask)) : 0; \ + outMGAdreg(MGA1064_INDEX, reg); \ + outMGAdreg(MGA1064_DATA, tmp | (val)); \ + } while (0) + #define PORT_OFFSET (0x1F00 - 0x300) #define MGA_VERSION 4000 @@ -74,11 +115,30 @@ typedef struct { unsigned char ExtVga[6]; unsigned char DacClk[6]; unsigned char * DacRegs; + unsigned long crtc2[0x58]; + unsigned char dac2[0x21]; CARD32 Option; CARD32 Option2; CARD32 Option3; } MGARegRec, *MGARegPtr; +/* For programming the second CRTC */ +typedef struct { + CARD32 ulDispWidth; /* Display Width in pixels*/ + CARD32 ulDispHeight; /* Display Height in pixels*/ + CARD32 ulBpp; /* Bits Per Pixels / input format*/ + CARD32 ulPixClock; /* Pixel Clock in kHz*/ + CARD32 ulHFPorch; /* Horizontal front porch in pixels*/ + CARD32 ulHSync; /* Horizontal Sync in pixels*/ + CARD32 ulHBPorch; /* Horizontal back porch in pixels*/ + CARD32 ulVFPorch; /* Vertical front porch in lines*/ + CARD32 ulVSync; /* Vertical Sync in lines*/ + CARD32 ulVBPorch; /* Vertical back Porch in lines*/ + CARD32 ulFBPitch; /* Pitch*/ + CARD32 flSignalMode; /* Signal Mode*/ +} xMODEINFO; + + typedef struct { int brightness; int contrast; @@ -261,7 +321,6 @@ typedef struct { int MaxBlitDWORDS; Bool TexturedVideo; MGAPortPrivPtr portPrivate; - int numXAALines; unsigned char *ScratchBuffer; unsigned char *ColorExpandBase; int expandRows; @@ -270,18 +329,21 @@ typedef struct { int expandHeight; int expandY; #ifdef XF86DRI - int agp_mode; - Bool ReallyUseIrqZero; - Bool have_quiescense; Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; - int drmSubFD; + int drmFD; int numVisualConfigs; __GLXvisualConfig* pVisualConfigs; MGAConfigPrivPtr pVisualConfigsPriv; + MGADRIServerPrivatePtr DRIServerInfo; + MGARegRec DRContextRegs; - MGADRIServerPrivatePtr DRIServerInfo; + + Bool haveQuiescense; void (*GetQuiescence)(ScrnInfoPtr pScrn); + + int agpMode; + #endif XF86VideoAdaptorPtr adaptor; Bool SecondCrtc; @@ -307,12 +369,6 @@ typedef struct { #endif } MGARec, *MGAPtr; -#ifdef XF86DRI -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **configprivs); -#endif - - extern CARD32 MGAAtype[16]; extern CARD32 MGAAtypeNoBLK[16]; @@ -333,10 +389,6 @@ extern CARD32 MGAAtypeNoBLK[16]; #define TRANSPARENCY_KEY 255 #define KEY_COLOR 0 -#define MGA_FRONT 0x1 -#define MGA_BACK 0x2 -#define MGA_DEPTH 0x4 - /* Prototypes */ @@ -365,22 +417,6 @@ void MGAPolyArcThinSolid(DrawablePtr, GCPtr, int, xArc*); Bool MGADGAInit(ScreenPtr pScreen); -Bool MGADRIScreenInit(ScreenPtr pScreen); -void MGADRICloseScreen(ScreenPtr pScreen); -Bool MGADRIFinishScreenInit(ScreenPtr pScreen); -void MGASwapContext(ScreenPtr pScreen); -void MGASwapContext_shared(ScreenPtr pScreen); -Bool mgaConfigureWarp(ScrnInfoPtr pScrn); -unsigned int mgaInstallMicrocode(ScreenPtr pScreen, int agp_offset); -unsigned int mgaGetMicrocodeSize(ScreenPtr pScreen); -void MGASelectBuffer(ScrnInfoPtr pScrn, int which); -Bool MgaCleanupDma(ScrnInfoPtr pScrn); -Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size); -#ifdef XF86DRI -Bool MgaLockUpdate(ScrnInfoPtr pScrn, drmLockFlags flags); -void mgaGetQuiescence(ScrnInfoPtr pScrn); -void mgaGetQuiescence_shared(ScrnInfoPtr pScrn); -#endif void MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void MGARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); @@ -412,7 +448,43 @@ void Mga32SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, void MGAPointerMoved(int index, int x, int y); void MGAInitVideo(ScreenPtr pScreen); -void MGAResetVideo(ScrnInfoPtr pScrn); +void MGAResetVideo(ScrnInfoPtr pScrn); + +#ifdef XF86DRI + +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 + +Bool MGADRIScreenInit( ScreenPtr pScreen ); +void MGADRICloseScreen( ScreenPtr pScreen ); +Bool MGADRIFinishScreenInit( ScreenPtr pScreen ); + +Bool MGALockUpdate( ScrnInfoPtr pScrn, drmLockFlags flags ); + +void MGAGetQuiescence( ScrnInfoPtr pScrn ); +void MGAGetQuiescenceShared( ScrnInfoPtr pScrn ); + +void MGASelectBuffer(ScrnInfoPtr pScrn, int which); +Bool MgaCleanupDma(ScrnInfoPtr pScrn); +Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size); + +#define MGA_AGP_1X_MODE 0x01 +#define MGA_AGP_2X_MODE 0x02 +#define MGA_AGP_4X_MODE 0x04 +#define MGA_AGP_MODE_MASK 0x07 + +#endif + +void CRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void EnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void CRTC2SetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo); +void CRTC2SetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY); +void CRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void CRTC2GetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo); +void CRTC2GetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY); + double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out); +void printDac(ScrnInfoPtr pScrn); #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c index 0979a7281..220ef1a49 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.55 2000/11/02 02:51:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.56 2001/04/05 21:29:14 dawes Exp $ */ /* * Copyright 1994 by Robin Cutshaw <robin@XFree86.org> * @@ -1071,7 +1071,10 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn) MGAdac->HideCursor = MGA3026HideCursor; MGAdac->ShowCursor = MGA3026ShowCursor; MGAdac->UseHWCursor = MGA3026UseHWCursor; - MGAdac->CursorFlags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + MGAdac->CursorFlags = +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c index 2d5361f9b..2b3536f3a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c @@ -2,7 +2,7 @@ * MGA-1064, MGA-G100, MGA-G200, MGA-G400 RAMDAC driver */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.43 2001/02/13 19:19:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.46 2001/04/06 16:51:19 dawes Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -49,33 +49,6 @@ #define OPTION1_MASK_PRIMARY 0xFFFC0FF -/* - * Read/write to the DAC via MMIO - */ - -/* - * These were functions. Use macros instead to avoid the need to - * pass pMga to them. - */ - -#define inMGAdreg(reg) INREG8(RAMDAC_OFFSET + (reg)) - -#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) - -#define inMGAdac(reg) \ - (outMGAdreg(MGA1064_INDEX, reg), inMGAdreg(MGA1064_DATA)) - -#define outMGAdac(reg, val) \ - (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) - -#define outMGAdacmsk(reg, mask, val) \ - do { /* note: mask and reg may get evaluated twice */ \ - unsigned char tmp = (mask) ? (inMGAdac(reg) & (mask)) : 0; \ - outMGAdreg(MGA1064_INDEX, reg); \ - outMGAdreg(MGA1064_DATA, tmp | (val)); \ - } while (0) - - static void MGAGRamdacInit(ScrnInfoPtr); static void MGAGSave(ScrnInfoPtr, vgaRegPtr, MGARegPtr, Bool); static void MGAGRestore(ScrnInfoPtr, vgaRegPtr, MGARegPtr, Bool); @@ -280,7 +253,21 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) MGARegPtr pReg; vgaRegPtr pVga; MGAFBLayout *pLayout; - + xMODEINFO ModeInfo; + + ModeInfo.ulDispWidth = mode->HDisplay; + ModeInfo.ulDispHeight = mode->VDisplay; + ModeInfo.ulFBPitch = mode->HDisplay; + ModeInfo.ulBpp = pScrn->bitsPerPixel; + ModeInfo.flSignalMode = 0; + ModeInfo.ulPixClock = mode->Clock; + ModeInfo.ulHFPorch = mode->HSyncStart - mode->HDisplay; + ModeInfo.ulHSync = mode->HSyncEnd - mode->HSyncStart; + ModeInfo.ulHBPorch = mode->HTotal - mode->HSyncEnd; + ModeInfo.ulVFPorch = mode->VSyncStart - mode->VDisplay; + ModeInfo.ulVSync = mode->VSyncEnd - mode->VSyncStart; + ModeInfo.ulVBPorch = mode->VTotal - mode->VSyncEnd; + pMga = MGAPTR(pScrn); pReg = &pMga->ModeReg; pVga = &VGAHWPTR(pScrn)->ModeReg; @@ -545,6 +532,21 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* This disables the VGA memory aperture */ pVga->MiscOutReg &= ~0x02; + + /* Urgh. Why do we define our own xMODEINFO structure instead + * of just passing the blinkin' DisplayModePtr? If we're going to + * just cut'n'paste routines from the HALlib, it would be better + * just to strip the MacroVision stuff out of the HALlib and release + * that, surely? + */ + /********************* Second Crtc programming **************/ + /* Writing values to crtc2[] array */ + if (pMga->SecondCrtc) + { + CRTC2Get(pScrn, &ModeInfo); + CRTC2GetPitch(pScrn, &ModeInfo); + CRTC2GetDisplayStart(pScrn, &ModeInfo,0,0,0); + } return(TRUE); } @@ -652,62 +654,81 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, MGAPtr pMga = MGAPTR(pScrn); CARD32 optionMask; - MGA_NOT_HAL( - /* - * Code is needed to get things back to bank zero. - */ - - /* restore DAC registers - * according to the docs we shouldn't write to reserved regs*/ - for (i = 0; i < DACREGSIZE; i++) { - if( (i <= 0x03) || - (i == 0x07) || - (i == 0x0b) || - (i == 0x0f) || - ((i >= 0x13) && (i <= 0x17)) || - (i == 0x1b) || - (i == 0x1c) || - ((i >= 0x1f) && (i <= 0x29)) || - ((i >= 0x30) && (i <= 0x37)) || - (MGAISG450(pMga) && - ((i == 0x2c) || (i == 0x2d) || (i == 0x2e) || - (i == 0x4c) || (i == 0x4d) || (i == 0x4e)))) - continue; - outMGAdac(i, mgaReg->DacRegs[i]); - } - - /* Do not set the memory config for primary cards as it - should be correct already */ - optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK; - - if (!MGAISG450(pMga)) { - /* restore pci_option register */ - pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask, - mgaReg->Option); - if (pMga->Chipset != PCI_CHIP_MGA1064) - pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION2, OPTION2_MASK, - mgaReg->Option2); - if (pMga->Chipset == PCI_CHIP_MGAG400) - pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK, - mgaReg->Option3); - } - ); /* MGA_NOT_HAL */ - - /* restore CRTCEXT regs */ - for (i = 0; i < 6; i++) - OUTREG16(0x1FDE, (mgaReg->ExtVga[i] << 8) | i); - - /* - * This function handles restoring the generic VGA registers. - */ - vgaHWRestore(pScrn, vgaReg, + if(!pMga->SecondCrtc) { +MGA_NOT_HAL( + /* + * Code is needed to get things back to bank zero. + */ + + /* restore DAC registers + * according to the docs we shouldn't write to reserved regs*/ + for (i = 0; i < DACREGSIZE; i++) { + if( (i <= 0x03) || + (i == 0x07) || + (i == 0x0b) || + (i == 0x0f) || + ((i >= 0x13) && (i <= 0x17)) || + (i == 0x1b) || + (i == 0x1c) || + ((i >= 0x1f) && (i <= 0x29)) || + ((i >= 0x30) && (i <= 0x37)) || + (MGAISG450(pMga) && + ((i == 0x2c) || (i == 0x2d) || (i == 0x2e) || + (i == 0x4c) || (i == 0x4d) || (i == 0x4e)))) + continue; + outMGAdac(i, mgaReg->DacRegs[i]); + } + + /* Do not set the memory config for primary cards as it + should be correct already */ + optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK; + + if (!MGAISG450(pMga)) { + /* restore pci_option register */ + pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask, + mgaReg->Option); + if (pMga->Chipset != PCI_CHIP_MGA1064) + pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION2, OPTION2_MASK, + mgaReg->Option2); + if (pMga->Chipset == PCI_CHIP_MGAG400) + pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK, + mgaReg->Option3); + } +); /* MGA_NOT_HAL */ + + /* restore CRTCEXT regs */ + for (i = 0; i < 6; i++) + OUTREG16(0x1FDE, (mgaReg->ExtVga[i] << 8) | i); + + /* + * This function handles restoring the generic VGA registers. + */ + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | (restoreFonts ? VGA_SR_FONTS : 0)); - MGAGRestorePalette(pScrn, vgaReg->DAC); - - /* - * this is needed to properly restore start address - */ - OUTREG16(0x1FDE, (mgaReg->ExtVga[0] << 8) | 0); + MGAGRestorePalette(pScrn, vgaReg->DAC); + + /* + * this is needed to properly restore start address + */ + OUTREG16(0x1FDE, (mgaReg->ExtVga[0] << 8) | 0); + } else { + /* Second Crtc */ + xMODEINFO ModeInfo; + + /* Enable Dual Head */ + CRTC2Set(pScrn, &ModeInfo); + EnableSecondOutPut(pScrn, &ModeInfo); + CRTC2SetPitch(pScrn, &ModeInfo); + CRTC2SetDisplayStart(pScrn, &ModeInfo,0,0,0); + + for (i = 0x80; i <= 0xa0; i ++) { + if (i== 0x8d) { + i = 0x8f; + continue; + } + outMGAdac(i, mgaReg->dac2[ i - 0x80]); + } + } /* endif pMga->SecondCrtc */ #ifdef DEBUG ErrorF("Setting DAC:"); @@ -740,7 +761,13 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg, int i; MGAPtr pMga = MGAPTR(pScrn); - if(pMga->SecondCrtc == TRUE) return; + if(pMga->SecondCrtc == TRUE) { + for(i = 0x80; i < 0xa0; i++) + mgaReg->dac2[i-0x80] = inMGAdac(i); + + return; + } + MGA_NOT_HAL( /* Allocate the DacRegs space if not done already */ if (mgaReg->DacRegs == NULL) { @@ -842,7 +869,10 @@ MGAGSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) while( INREG( MGAREG_Status ) & 0x08 ); /* Output position - "only" 12 bits of location documented */ - OUTREG( RAMDAC_OFFSET + MGA1064_CUR_XLOW, (y << 16) | (x & 0xFFFF)); + OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_XLOW, (x & 0xFF)); + OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_XHI, (x & 0xF00) >> 8); + OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_YLOW, (y & 0xFF)); + OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_YHI, (y & 0xF00) >> 8); } static void @@ -986,7 +1016,9 @@ MGAGRamdacInit(ScrnInfoPtr pScrn) MGAdac->ShowCursor = MGAGShowCursor; MGAdac->UseHWCursor = MGAGUseHWCursor; MGAdac->CursorFlags = +#if X_BYTE_ORDER == X_LITTLE_ENDIAN HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c new file mode 100644 index 000000000..4dae28e97 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c @@ -0,0 +1,502 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.1 2001/04/05 17:42:32 dawes Exp $ */ +/********************************************************************* +* G450: This is for Dual Head. +* Matrox Graphics +* Author : Luugi Marsan +**********************************************************************/ + + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +/* Drivers for PCI hardware need this */ +#include "xf86PciInfo.h" + +/* Drivers that need to access the PCI config space directly need this */ +#include "xf86Pci.h" + +#include "mga_bios.h" +#include "mga_reg.h" +#include "mga.h" + +#define MNP_TABLE_SIZE 64 +#define CLKSEL_MGA 0x0c +#define PLLLOCK 0x40 + +/* CRTC2 control field*/ +#define C2_EN_A 0 +#define C2_EN_M (1 << C2_EN_A) +#define C2_HIPRILVL_A 4 +#define C2_HIPRILVL_M (7 << C2_HIPRILVL_A) +#define C2_MAXHIPRI_A 8 +#define C2_MAXHIPRI_M (7 << C2_MAXHIPRI_A) + +#define C2CTL_PIXCLKSEL_SHIFT 1L +#define C2CTL_PIXCLKSEL_MASK (3L << C2CTL_PIXCLKSEL_SHIFT) +#define C2CTL_PIXCLKSELH_SHIFT 14L +#define C2CTL_PIXCLKSELH_MASK (1L << C2CTL_PIXCLKSELH_SHIFT) +#define C2CTL_PIXCLKSEL_PCICLK 0L +#define C2CTL_PIXCLKSEL_VDOCLK (1L << C2CTL_PIXCLKSEL_SHIFT) +#define C2CTL_PIXCLKSEL_PIXELPLL (2L << C2CTL_PIXCLKSEL_SHIFT) +#define C2CTL_PIXCLKSEL_VIDEOPLL (3L << C2CTL_PIXCLKSEL_SHIFT) +#define C2CTL_PIXCLKSEL_VDCLK (1L << C2CTL_PIXCLKSELH_SHIFT) + +#define C2CTL_PIXCLKSEL_CRISTAL (1L << C2CTL_PIXCLKSEL_SHIFT) | (1L << C2CTL_PIXCLKSELH_SHIFT) +#define C2CTL_PIXCLKSEL_SYSTEMPLL (2L << C2CTL_PIXCLKSEL_SHIFT) | (1L << C2CTL_PIXCLKSELH_SHIFT) + +#define C2CTL_PIXCLKDIS_SHIFT 3L +#define C2CTL_PIXCLKDIS_MASK (1L << C2CTL_PIXCLKDIS_SHIFT) +#define C2CTL_PIXCLKDIS_DISABLE (1L << C2CTL_PIXCLKDIS_SHIFT) + +#define C2CTL_CRTCDACSEL_SHIFT 20L +#define C2CTL_CRTCDACSEL_MASK (1L << C2CTL_CRTCDACSEL_SHIFT) +#define C2CTL_CRTCDACSEL_CRTC1 0 +#define C2CTL_CRTCDACSEL_CRTC2 (1L << C2CTL_CRTCDACSEL_SHIFT) + +/* Misc field*/ +#define IOADDSEL 0x01 +#define RAMMAPEN 0x02 +#define CLKSEL_25175 0x00 +#define CLKSEL_28322 0x04 +#define CLKSEL_MGA 0x0c +#define VIDEODIS 0x10 +#define HPGODDEV 0x20 +#define HSYNCPOL 0x40 +#define VSYNCPOL 0x80 + +/* XSYNCCTRL field */ +#define XSYNCCTRL_DAC1HSPOL_SHIFT 2 +#define XSYNCCTRL_DAC1HSPOL_MASK (1 << XSYNCCTRL_DAC1HSPOL_SHIFT) +#define XSYNCCTRL_DAC1HSPOL_NEG (1 << XSYNCCTRL_DAC1HSPOL_SHIFT) +#define XSYNCCTRL_DAC1HSPOL_POS 0 +#define XSYNCCTRL_DAC1VSPOL_SHIFT 3 +#define XSYNCCTRL_DAC1VSPOL_MASK (1 << XSYNCCTRL_DAC1VSPOL_SHIFT) +#define XSYNCCTRL_DAC1VSPOL_NEG (1 << XSYNCCTRL_DAC1VSPOL_SHIFT) +#define XSYNCCTRL_DAC1VSPOL_POS 0 +#define XSYNCCTRL_DAC2HSPOL_SHIFT 6 +#define XSYNCCTRL_DAC2HSPOL_MASK (1 << XSYNCCTRL_DAC2HSPOL_SHIFT) +#define XSYNCCTRL_DAC2HSPOL_NEG (1 << XSYNCCTRL_DAC2HSPOL_SHIFT) +#define XSYNCCTRL_DAC2HSPOL_POS 0 +#define XSYNCCTRL_DAC2VSPOL_SHIFT 7 +#define XSYNCCTRL_DAC2VSPOL_MASK (1 << XSYNCCTRL_DAC2VSPOL_SHIFT) +#define XSYNCCTRL_DAC2VSPOL_NEG (1 << XSYNCCTRL_DAC2VSPOL_SHIFT) +#define XSYNCCTRL_DAC2VSPOL_POS 0 +#define XSYNCCTRL_DAC1HSOFF_SHIFT 0 +#define XSYNCCTRL_DAC1HSOFF_MASK (1 << XSYNCCTRL_DAC1HSOFF_SHIFT) +#define XSYNCCTRL_DAC1HSOFF_OFF (1 << XSYNCCTRL_DAC1HSOFF_SHIFT) +#define XSYNCCTRL_DAC1HSOFF_ON 1 +#define XSYNCCTRL_DAC1VSOFF_SHIFT 1 +#define XSYNCCTRL_DAC1VSOFF_MASK (1 << XSYNCCTRL_DAC1VSOFF_SHIFT) +#define XSYNCCTRL_DAC1VSOFF_OFF (1 << XSYNCCTRL_DAC1VSOFF_SHIFT) +#define XSYNCCTRL_DAC1VSOFF_ON 0 +#define XSYNCCTRL_DAC2HSOFF_SHIFT 4 +#define XSYNCCTRL_DAC2HSOFF_MASK (1 << XSYNCCTRL_DAC2HSOFF_SHIFT) +#define XSYNCCTRL_DAC2HSOFF_OFF (1 << XSYNCCTRL_DAC2HSOFF_SHIFT) +#define XSYNCCTRL_DAC2HSOFF_ON 0 +#define XSYNCCTRL_DAC2VSOFF_SHIFT 5 +#define XSYNCCTRL_DAC2VSOFF_MASK (1 << XSYNCCTRL_DAC2VSOFF_SHIFT) +#define XSYNCCTRL_DAC2VSOFF_OFF (1 << XSYNCCTRL_DAC2VSOFF_SHIFT) +#define XSYNCCTRL_DAC2VSOFF_ON 0 + + +/* XDISPCTRL field */ +#define XDISPCTRL_DAC1OUTSEL_SHIFT 0L +#define XDISPCTRL_DAC1OUTSEL_MASK 1L +#define XDISPCTRL_DAC1OUTSEL_DIS 0L +#define XDISPCTRL_DAC1OUTSEL_EN 1L +#define XDISPCTRL_DAC2OUTSEL_SHIFT 2L +#define XDISPCTRL_DAC2OUTSEL_MASK (3L << XDISPCTRL_DAC2OUTSEL_SHIFT) +#define XDISPCTRL_DAC2OUTSEL_DIS 0L +#define XDISPCTRL_DAC2OUTSEL_CRTC1 (1L << XDISPCTRL_DAC2OUTSEL_SHIFT) +#define XDISPCTRL_DAC2OUTSEL_CRTC2 (2L << XDISPCTRL_DAC2OUTSEL_SHIFT) +#define XDISPCTRL_DAC2OUTSEL_TVE (3L << XDISPCTRL_DAC2OUTSEL_SHIFT) +#define XDISPCTRL_PANOUTSEL_SHIFT 5L +#define XDISPCTRL_PANOUTSEL_MASK (3L << XDISPCTRL_PANOUTSEL_SHIFT) +#define XDISPCTRL_PANOUTSEL_DIS 0L +#define XDISPCTRL_PANOUTSEL_CRTC1 (1L << XDISPCTRL_PANOUTSEL_SHIFT) +#define XDISPCTRL_PANOUTSEL_CRTC2RGB (2L << XDISPCTRL_PANOUTSEL_SHIFT) +#define XDISPCTRL_PANOUTSEL_CRTC2656 (3L << XDISPCTRL_PANOUTSEL_SHIFT) + +/* XPWRCTRL field*/ +#define XPWRCTRL_DAC2PDN_SHIFT 0 +#define XPWRCTRL_DAC2PDN_MASK (1 << XPWRCTRL_DAC2PDN_SHIFT) +#define XPWRCTRL_VIDPLLPDN_SHIFT 1 +#define XPWRCTRL_VIDPLLPDN_MASK (1 << XPWRCTRL_VIDPLLPDN_SHIFT) +#define XPWRCTRL_PANPDN_SHIFT 2 +#define XPWRCTRL_PANPDN_MASK (1 << XPWRCTRL_PANPDN_SHIFT) +#define XPWRCTRL_RFIFOPDN_SHIFT 3 +#define XPWRCTRL_RFIFOPDN_MASK (1 << XPWRCTRL_RFIFOPDN_SHIFT) +#define XPWRCTRL_CFIFOPDN_SHIFT 4 +#define XPWRCTRL_CFIFOPDN_MASK (1 << XPWRCTRL_CFIFOPDN_SHIFT) + + + +#define POS_HSYNC 0x00000004 +#define POS_VSYNC 0x00000008 + + +/* Set CRTC 2*/ +/* Uses the mode given by xfree86 to setup the registry */ +/* Does not write to the hard yet */ +void CRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + + + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg = &pMga->ModeReg; + + xMODEINFO tmpModeInfo; + CARD32 ulHTotal; + CARD32 ulHDispEnd; + CARD32 ulHBlkStr; + CARD32 ulHBlkEnd; + CARD32 ulHSyncStr; + CARD32 ulHSyncEnd; + CARD32 ulVTotal; + CARD32 ulVDispEnd; + CARD32 ulVBlkStr; + CARD32 ulVBlkEnd; + CARD32 ulVSyncStr; + CARD32 ulVSyncEnd; + CARD32 ulOffset; + CARD32 ulCtl2; + CARD32 ulDataCtl2; + CARD32 ulDispHeight = pModeInfo->ulDispHeight; + +#ifdef DEBUG + ErrorF("ENTER CRTC2Get\n"); +#endif + + tmpModeInfo = *pModeInfo; + + + /* First compute the Values */ + + ulHTotal = tmpModeInfo.ulDispWidth + + tmpModeInfo.ulHFPorch + + tmpModeInfo.ulHBPorch + + tmpModeInfo.ulHSync; + + ulHDispEnd = tmpModeInfo.ulDispWidth; + ulHBlkStr = ulHDispEnd; + ulHBlkEnd = ulHBlkStr + tmpModeInfo.ulHBPorch + tmpModeInfo.ulHFPorch + tmpModeInfo.ulHSync; + ulHSyncStr = ulHBlkStr + tmpModeInfo.ulHFPorch; + ulHSyncEnd = ulHSyncStr + tmpModeInfo.ulHSync; + + ulVTotal = ulDispHeight + + tmpModeInfo.ulVFPorch + + tmpModeInfo.ulVBPorch + + tmpModeInfo.ulVSync; + + + ulVDispEnd = ulDispHeight; + ulVBlkStr = ulVDispEnd; + ulVBlkEnd = ulVBlkStr + tmpModeInfo.ulVBPorch + tmpModeInfo.ulVFPorch + tmpModeInfo.ulVSync; + ulVSyncStr = ulVBlkStr + tmpModeInfo.ulVFPorch; + ulVSyncEnd = ulVSyncStr + tmpModeInfo.ulVSync; + + ulOffset = tmpModeInfo.ulFBPitch; + + + + ulCtl2 = INREG(MGAREG_C2CTL); + ulDataCtl2 = INREG(MGAREG_C2DATACTL); + + ulCtl2 &= 0xFF1FFFFF; + ulDataCtl2 &= 0xFFFFFF00; + + switch (tmpModeInfo.ulBpp) + { + case 15: ulCtl2 |= 0x00200000; + ulOffset <<= 1; + break; + case 16: ulCtl2 |= 0x00400000; + ulOffset <<= 1; + break; + case 32: ulCtl2 |= 0x00800000; + ulOffset <<= 2; + break; + } + + + pReg->crtc2[ MGAREG2_C2CTL ] = ulCtl2; + pReg->crtc2[ MGAREG2_C2DATACTL ] = ulDataCtl2; + + /* Horizontal Value*/ + pReg->crtc2[MGAREG2_C2HPARAM] = (((ulHDispEnd-8) << 16) | (ulHTotal-8)) ; + pReg->crtc2[MGAREG2_C2HSYNC] = (((ulHSyncEnd-8) << 16) | (ulHSyncStr-8)) ; + + + /*Vertical Value*/ + pReg->crtc2[MGAREG2_C2VPARAM] = (((ulVDispEnd-1) << 16) | (ulVTotal-1)) ; + pReg->crtc2[MGAREG2_C2VSYNC] = (((ulVSyncEnd-1) << 16) | (ulVSyncStr-1)) ; + + /** Offset value*/ + + pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset; + +#ifdef DEBUG + ErrorF("EXIT CRTC2Get\n"); +#endif + +} + +/* Set CRTC 2*/ +/* Writes to the hardware */ +void CRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + + + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg = &pMga->ModeReg; + +#ifdef DEBUG + ErrorF("ENTER CRTC2Set\n"); +#endif + + + /* This writes to the registers manually */ + OUTREG(MGAREG_C2CTL, pReg->crtc2[MGAREG2_C2CTL]); + OUTREG(MGAREG_C2DATACTL,pReg->crtc2[MGAREG2_C2DATACTL]); + + + /* Horizontal Value*/ + OUTREG(MGAREG_C2HPARAM, pReg->crtc2[MGAREG2_C2HPARAM]); + OUTREG(MGAREG_C2HSYNC, pReg->crtc2[MGAREG2_C2HSYNC]); + + + /*Vertical Value*/ + OUTREG(MGAREG_C2VPARAM, pReg->crtc2[MGAREG2_C2VPARAM]); + OUTREG(MGAREG_C2VSYNC, pReg->crtc2[MGAREG2_C2VSYNC]); + + /** Offset value*/ + + OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2VSYNC]); +#ifdef DEBUG + ErrorF("EXIT CRTC2Set\n"); +#endif + +} + + + /* Set CRTC2 on Second OutPut*/ +void EnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + CARD8 ucByte, ucXDispCtrl; + CARD32 ulC2CTL, ulStatusReg; + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + pReg = &pMga->ModeReg; +#ifdef DEBUG + ErrorF("ENTER EnableSecondOutPut\n"); +#endif + + + /* Route Video PLL on second CRTC */ + ulC2CTL = INREG( MGAREG_C2CTL); + + /*--- Disable Pixel clock oscillations On Crtc1 */ + OUTREG( MGAREG_C2CTL, ulC2CTL | C2CTL_PIXCLKDIS_MASK); + /*--- Have to wait minimum time (2 acces will be ok) */ + ulStatusReg = INREG( MGAREG_Status); + ulStatusReg = INREG( MGAREG_Status); + + + ulC2CTL &= ~(C2CTL_PIXCLKSEL_MASK | C2CTL_PIXCLKSELH_MASK); + + ulC2CTL |= C2CTL_PIXCLKSEL_VIDEOPLL; + + + OUTREG( MGAREG_C2CTL, ulC2CTL); + /*--- Enable Pixel clock oscillations on CRTC2*/ + OUTREG( MGAREG_C2CTL, ulC2CTL & ~C2CTL_PIXCLKDIS_MASK); + + + /* We don't use MISC synch pol, must be 0*/ + ucByte = inMGAdreg( MGAREG_MISC_READ); + + OUTREG8(MGAREG_MISC_WRITE, (CARD8)(ucByte & ~(HSYNCPOL| VSYNCPOL) )); + + + + + /* Set Rset to 0.7 V*/ + ucByte = inMGAdac(MGA1064_GEN_IO_CTL); + ucByte &= ~0x40; + pReg->DacRegs[MGA1064_GEN_IO_CTL] = ucByte; + outMGAdac (MGA1064_GEN_IO_CTL, ucByte); + + ucByte = inMGAdac( MGA1064_GEN_IO_DATA); + ucByte &= ~0x40; + pReg->DacRegs[MGA1064_GEN_IO_DATA]= ucByte; + outMGAdac (MGA1064_GEN_IO_DATA, ucByte); + + + + /* Route Crtc2 on Dac2*/ + ulC2CTL = INREG( MGAREG_C2CTL); + ucXDispCtrl = inMGAdac( MGA1064_DISP_CTL); + + ucXDispCtrl &= ~XDISPCTRL_DAC2OUTSEL_MASK; + ucXDispCtrl |= XDISPCTRL_DAC2OUTSEL_CRTC2; + + /* Enable CRTC2*/ + ulC2CTL |= C2_EN_M; + + pReg->dac2[ MGA1064_DISP_CTL - 0x80] = ucXDispCtrl; + + + + OUTREG( MGAREG_C2CTL, ulC2CTL); + + /* Set DAC2 Synch polarity*/ + ucByte = inMGAdac( MGA1064_SYNC_CTL); + ucByte &= ~(XSYNCCTRL_DAC2HSPOL_MASK | XSYNCCTRL_DAC2VSPOL_MASK); + if ( !(pModeInfo->flSignalMode & POS_HSYNC) ) + { + ucByte |= XSYNCCTRL_DAC2HSPOL_NEG; + } + if ( !(pModeInfo->flSignalMode & POS_VSYNC) ) + { + ucByte |= XSYNCCTRL_DAC2VSPOL_NEG; + } + + /* Enable synch output*/ + ucByte &= ~(XSYNCCTRL_DAC2HSOFF_MASK | XSYNCCTRL_DAC2VSOFF_MASK); + pReg->dac2[ MGA1064_SYNC_CTL - 0x80] = ucByte; + + /* Powerup DAC2*/ + ucByte = inMGAdac( MGA1064_PWR_CTL); + pReg->dac2[ MGA1064_PWR_CTL - 0x80] = /* 0x0b; */ (ucByte | XPWRCTRL_DAC2PDN_MASK); + + + + /* Power up Fifo*/ + ucByte = inMGAdac( MGA1064_PWR_CTL); + pReg->dac2[ MGA1064_PWR_CTL - 0x80] = 0x1b; /* (ucByte | XPWRCTRL_CFIFOPDN_MASK) */; + + +#ifdef DEBUG + ErrorF("EXIT EnableSecondOutPut\n"); +#endif +} + + + + + +void CRTC2GetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + CARD32 ulOffset; + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + + pReg = &pMga->ModeReg; +#ifdef DEBUG + ErrorF("ENTER CRTC2GetPitch\n"); +#endif + + + switch(pModeInfo->ulBpp) + { + case 15: + case 16: + ulOffset = pModeInfo->ulFBPitch * 2; + break; + case 32: + ulOffset = pModeInfo->ulFBPitch * 4; + break; + } + + pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset; + +#ifdef DEBUG + ErrorF("EXIT CRTC2GetPitch\n"); +#endif + +} + +void CRTC2SetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + pReg = &pMga->ModeReg; + +#ifdef DEBUG + ErrorF("ENTER CRCT2SetPitch\n"); +#endif + + + OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2OFFSET]); +#ifdef DEBUG + ErrorF("EXIT CRCT2SetPitch\n"); +#endif + +} + + + /* Set Display Start*/ + /* base in bytes*/ +void CRTC2GetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY) +{ + + CARD32 ulAddress; + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + pReg = &pMga->ModeReg; + +#ifdef DEBUG + ErrorF("ENTER CRTC2GetDisplayStart\n"); +#endif + + + pReg = &pMga->ModeReg; + + ulAddress = (pModeInfo->ulFBPitch * ulY + ulX); + switch(pModeInfo->ulBpp) + { + case 15: + case 16: + ulAddress <<= 1; + break; + case 32: + ulAddress <<= 2; + break; + } + + pReg->crtc2[MGAREG2_C2STARTADD0] = ulAddress + base; +#ifdef DEBUG + ErrorF("EXIT CRTC2GetDisplayStart\n"); +#endif + +} + +void CRTC2SetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + pReg = &pMga->ModeReg; +#ifdef DEBUG + ErrorF("ENTER CRTC2SetDisplayStart\n"); +#endif + + OUTREG(MGAREG2_C2STARTADD0, pReg->crtc2[MGAREG2_C2STARTADD0]); +#ifdef DEBUG + ErrorF("EXIT CRTC2GetDisplayStart\n"); +#endif + +} + + + + + + + + + + + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c index 10ad53bc9..eba6ecaf8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c @@ -1,4 +1,32 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.16 2001/01/08 01:07:37 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.19 2001/03/21 19:46:27 dawes Exp $ */ + +/* + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * 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 + * VA LINUX SYSTEMS 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: + * Keith WHitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ #include "xf86.h" #include "xf86_OSproc.h" @@ -15,219 +43,172 @@ #include "miline.h" -#include "GL/glxtokens.h" + + #include "mga_bios.h" #include "mga_reg.h" #include "mga.h" #include "mga_macros.h" #include "mga_dri.h" -#include "mga_wrap.h" +#include "mga_sarea.h" -static char MGAKernelDriverName[] = "mga"; -static char MGAClientDriverName[] = "mga"; +#define _XF86DRI_SERVER_ +#include "GL/glxtokens.h" +#include "sarea.h" -static Bool MGAInitVisualConfigs(ScreenPtr pScreen); -static Bool MGACreateContext(ScreenPtr pScreen, VisualPtr visual, - drmContext hwContext, void *pVisualConfigPriv, - DRIContextType contextStore); -static void MGADestroyContext(ScreenPtr pScreen, drmContext hwContext, - DRIContextType contextStore); -static void MGADRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, - void *readContextStore, - DRIContextType writeContextType, - void *writeContextStore); -static void MGADRISwapContext_shared(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, - void *readContextStore, - DRIContextType writeContextType, - void *writeContextStore); -extern void Mga8DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -extern void Mga8DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); -extern void Mga16DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -extern void Mga16DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); -extern void Mga24DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -extern void Mga24DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); -extern void Mga32DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -extern void Mga32DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); - -Bool MgaCleanupDma(ScrnInfoPtr pScrn) -{ - MGAPtr pMGA = MGAPTR(pScrn); - Bool ret_val; - ret_val = drmMgaCleanupDma(pMGA->drmSubFD); - if (ret_val == FALSE) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mga Dma Cleanup Failed\n"); - return ret_val; -} -Bool MgaLockUpdate(ScrnInfoPtr pScrn, drmLockFlags flags) -{ - MGAPtr pMGA = MGAPTR(pScrn); - Bool ret_val; - ret_val = drmMgaLockUpdate(pMGA->drmSubFD, flags); - if (ret_val == FALSE) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "LockUpdate failed\n"); +#include "GL/glxtokens.h" - return ret_val; -} +#include "mga_bios.h" +#include "mga_reg.h" +#include "mga.h" +#include "mga_macros.h" +#include "mga_dri.h" -Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size) -{ - MGAPtr pMGA = MGAPTR(pScrn); - MGADRIPtr pMGADRI = (MGADRIPtr)pMGA->pDRIInfo->devPrivate; - MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo; - drmMgaInit init; - Bool ret_val; - - memset(&init, 0, sizeof(drmMgaInit)); - init.reserved_map_agpstart = 0; - init.reserved_map_idx = 3; - init.buffer_map_idx = 4; - init.sarea_priv_offset = sizeof(XF86DRISAREARec); - init.primary_size = prim_size; - init.warp_ucode_size = pMGADRIServer->warp_ucode_size; +#include "mga_sarea.h" - switch(pMGA->Chipset) { - case PCI_CHIP_MGAG400: - init.chipset = MGA_CARD_TYPE_G400; - break; - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - init.chipset = MGA_CARD_TYPE_G200; - break; - default: - return FALSE; - } - - init.frontOffset = pMGADRI->frontOffset; - init.backOffset = pMGADRI->backOffset; - init.depthOffset = pMGADRI->depthOffset; - init.textureOffset = pMGADRI->textureOffset; - init.textureSize = pMGADRI->textureSize; - init.agpTextureSize = pMGADRI->agpTextureSize; - init.cpp = pMGADRI->cpp; - init.stride = pMGADRI->frontPitch; - init.mAccess = pMGA->MAccess; - init.sgram = !pMGA->HasSDRAM; - - memcpy(&init.WarpIndex, &pMGADRIServer->WarpIndex, - sizeof(drmMgaWarpIndex) * MGA_MAX_WARP_PIPES); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Mga Dma Initialization start\n"); - - ret_val = drmMgaInitDma(pMGA->drmSubFD, &init); - if (ret_val == FALSE) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Mga Dma Initialization Failed\n"); - else - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Mga Dma Initialization done\n"); - return ret_val; -} +static char MGAKernelDriverName[] = "mga"; +static char MGAClientDriverName[] = "mga"; -static Bool -MGAInitVisualConfigs(ScreenPtr pScreen) +/* DRI buffer management + */ +extern void Mga8DRIInitBuffers( WindowPtr pWin, RegionPtr prgn, + CARD32 index ); +extern void Mga8DRIMoveBuffers( WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index ); + +extern void Mga16DRIInitBuffers( WindowPtr pWin, RegionPtr prgn, + CARD32 index ); +extern void Mga16DRIMoveBuffers( WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index ); + +extern void Mga24DRIInitBuffers( WindowPtr pWin, RegionPtr prgn, + CARD32 index ); +extern void Mga24DRIMoveBuffers( WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index ); + +extern void Mga32DRIInitBuffers( WindowPtr pWin, RegionPtr prgn, + CARD32 index ); +extern void Mga32DRIMoveBuffers( WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index ); + + +/* Initialize the visual configs that are supported by the hardware. + * These are combined with the visual configs that the indirect + * rendering core supports, and the intersection is exported to the + * client. + */ +static Bool MGAInitVisualConfigs( ScreenPtr pScreen ) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); int numConfigs = 0; __GLXvisualConfig *pConfigs = 0; MGAConfigPrivPtr pMGAConfigs = 0; MGAConfigPrivPtr *pMGAConfigPtrs = 0; int i, db, depth, stencil, accum; - switch (pScrn->bitsPerPixel) { + switch ( pScrn->bitsPerPixel ) { case 8: case 24: break; + case 16: numConfigs = 8; - if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + pConfigs = (__GLXvisualConfig*)xnfcalloc( sizeof(__GLXvisualConfig), + numConfigs ); + if ( !pConfigs ) { return FALSE; } - if (!(pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc(sizeof(MGAConfigPrivRec), - numConfigs))) { - xfree(pConfigs); + + pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc( sizeof(MGAConfigPrivRec), + numConfigs ); + if ( !pMGAConfigs ) { + xfree( pConfigs ); return FALSE; } - if (!(pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc(sizeof(MGAConfigPrivPtr), - numConfigs))) { - xfree(pConfigs); - xfree(pMGAConfigs); + + pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc( sizeof(MGAConfigPrivPtr), + numConfigs ); + if ( !pMGAConfigPtrs ) { + xfree( pConfigs ); + xfree( pMGAConfigs ); return FALSE; } - for (i=0; i<numConfigs; i++) + + for ( i = 0 ; i < numConfigs ; i++ ) { pMGAConfigPtrs[i] = &pMGAConfigs[i]; + } i = 0; depth = 1; - for (accum = 0; accum <= 1; accum++) { - for (stencil = 0; stencil <= 1; stencil++) { /* no stencil for now */ - for (db=1; db>=0; db--) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 5; - pConfigs[i].greenSize = 6; - pConfigs[i].blueSize = 5; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x0000F800; - pConfigs[i].greenMask = 0x000007E0; - pConfigs[i].blueMask = 0x0000001F; - pConfigs[i].alphaMask = 0; - if (accum) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 0; + for ( accum = 0 ; accum <= 1 ; accum++ ) { + for ( stencil = 0 ; stencil <= 1 ; stencil++ ) { + for ( db = 1 ; db >= 0 ; db-- ) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].alphaSize = 0; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0; + if ( accum ) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; + 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 = 16; - if (depth) - pConfigs[i].depthSize = 16; - else - pConfigs[i].depthSize = 0; - if (stencil) - pConfigs[i].stencilSize = 8; - else - pConfigs[i].stencilSize = 0; - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (stencil || accum) - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - else - 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; + if ( db ) { + pConfigs[i].doubleBuffer = TRUE; + } else { + pConfigs[i].doubleBuffer = FALSE; + } + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 16; + if ( depth ) { + pConfigs[i].depthSize = 16; + } else { + pConfigs[i].depthSize = 0; + } + if ( stencil ) { + pConfigs[i].stencilSize = 8; + } else { + pConfigs[i].stencilSize = 0; + } + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if ( accum || stencil ) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + 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"); + if ( i != numConfigs ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n" ); return FALSE; } break; @@ -235,152 +216,689 @@ MGAInitVisualConfigs(ScreenPtr pScreen) case 32: numConfigs = 8; - if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + pConfigs = (__GLXvisualConfig*)xnfcalloc( sizeof(__GLXvisualConfig), + numConfigs ); + if ( !pConfigs ) { return FALSE; } - if (!(pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc(sizeof(MGAConfigPrivRec), - numConfigs))) { - xfree(pConfigs); + + pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc( sizeof(MGAConfigPrivRec), + numConfigs ); + if ( !pMGAConfigs ) { + xfree( pConfigs ); return FALSE; } - if (!(pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc(sizeof(MGAConfigPrivPtr), - numConfigs))) { - xfree(pConfigs); - xfree(pMGAConfigs); + + pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc( sizeof(MGAConfigPrivPtr), + numConfigs ); + if ( !pMGAConfigPtrs ) { + xfree( pConfigs ); + xfree( pMGAConfigs ); return FALSE; } - for (i=0; i<numConfigs; i++) + + for ( i = 0 ; i < numConfigs ; i++ ) { pMGAConfigPtrs[i] = &pMGAConfigs[i]; + } i = 0; - for (accum = 0; accum <= 1; accum++) { - for (depth = 0; depth <= 1; depth++) { /* and stencil */ - for (db=1; db>=0; db--) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 8; - pConfigs[i].greenSize = 8; - pConfigs[i].blueSize = 8; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x00FF0000; - pConfigs[i].greenMask = 0x0000FF00; - pConfigs[i].blueMask = 0x000000FF; - pConfigs[i].alphaMask = 0; - if (accum) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 0; + for ( accum = 0 ; accum <= 1 ; accum++ ) { + for ( depth = 0 ; depth <= 1 ; depth++ ) { /* and stencil */ + for ( db = 1 ; db >= 0 ; db-- ) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 8; + pConfigs[i].greenSize = 8; + pConfigs[i].blueSize = 8; + pConfigs[i].alphaSize = 8; + pConfigs[i].redMask = 0x00FF0000; + pConfigs[i].greenMask = 0x0000FF00; + pConfigs[i].blueMask = 0x000000FF; + pConfigs[i].alphaMask = 0; + if ( accum ) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; + 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 = 32; - if (depth) { - pConfigs[i].depthSize = 24; - pConfigs[i].stencilSize = 8; + if ( db ) { + pConfigs[i].doubleBuffer = TRUE; + } else { + pConfigs[i].doubleBuffer = FALSE; + } + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 32; + if ( depth ) { + pConfigs[i].depthSize = 24; + pConfigs[i].stencilSize = 8; } else { - pConfigs[i].depthSize = 0; - pConfigs[i].stencilSize = 0; + pConfigs[i].depthSize = 0; + pConfigs[i].stencilSize = 0; } - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (accum) - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - else - 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; + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if ( accum ) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + 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"); + if ( i != numConfigs ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n" ); return FALSE; } break; default: - ; /* unexpected bits/pixelx */ + /* Unexpected bits/pixels */ + break; } - pMGA->numVisualConfigs = numConfigs; - pMGA->pVisualConfigs = pConfigs; - pMGA->pVisualConfigsPriv = pMGAConfigs; - GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pMGAConfigPtrs); + + pMga->numVisualConfigs = numConfigs; + pMga->pVisualConfigs = pConfigs; + pMga->pVisualConfigsPriv = pMGAConfigs; + + GlxSetVisualConfigs( numConfigs, pConfigs, (void **)pMGAConfigPtrs ); + + return TRUE; +} + +static Bool MGACreateContext( ScreenPtr pScreen, VisualPtr visual, + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore ) +{ + /* Nothing yet */ return TRUE; } -static unsigned int mylog2(unsigned int n) +static void MGADestroyContext( ScreenPtr pScreen, drmContext hwContext, + DRIContextType contextStore ) +{ + /* Nothing yet */ +} + + +/* Quiescence, locking + */ +#define MGA_TIMEOUT 2048 + +static void MGAWaitForIdleDMA( ScrnInfoPtr pScrn ) +{ + MGAPtr pMga = MGAPTR(pScrn); + int ret; + int i = 0; + + for (;;) { + do { + ret = drmMGAFlushDMA( pMga->drmFD, + DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); + } while ( ( ret == -EBUSY ) && ( i++ < MGA_TIMEOUT ) ); + + if ( ret == 0 ) + return; + + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "Idle timed out, resetting engine...\n" ); + + drmMGAEngineReset( pMga->drmFD ); + } +} + + +void MGAGetQuiescence( ScrnInfoPtr pScrn ) +{ + MGAPtr pMga = MGAPTR(pScrn); + + DRILock( screenInfo.screens[pScrn->scrnIndex], 0 ); + pMga->haveQuiescense = 1; + + if ( pMga->directRenderingEnabled ) { + MGAFBLayout *pLayout = &pMga->CurrentLayout; + + MGAWaitForIdleDMA( pScrn ); + + WAITFIFO( 11 ); + OUTREG( MGAREG_MACCESS, pMga->MAccess ); + OUTREG( MGAREG_PITCH, pLayout->displayWidth ); + + pMga->PlaneMask = ~0; + OUTREG( MGAREG_PLNWT, pMga->PlaneMask ); + + pMga->BgColor = 0; + pMga->FgColor = 0; + OUTREG( MGAREG_BCOL, pMga->BgColor ); + OUTREG( MGAREG_FCOL, pMga->FgColor ); + OUTREG( MGAREG_SRCORG, pMga->realSrcOrg ); + + pMga->SrcOrg = 0; + OUTREG( MGAREG_DSTORG, pMga->DstOrg ); + OUTREG( MGAREG_OPMODE, MGAOPM_DMA_BLIT ); + OUTREG( MGAREG_CXBNDRY, 0xFFFF0000 ); /* (maxX << 16) | minX */ + OUTREG( MGAREG_YTOP, 0x00000000 ); /* minPixelPointer */ + OUTREG( MGAREG_YBOT, 0x007FFFFF ); /* maxPixelPointer */ + + pMga->AccelFlags &= ~CLIPPER_ON; + } +} + +void MGAGetQuiescenceShared( ScrnInfoPtr pScrn ) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGAEntPtr pMGAEnt = pMga->entityPrivate; + MGAPtr pMGA2 = MGAPTR(pMGAEnt->pScrn_2); + + DRILock( screenInfo.screens[pMGAEnt->pScrn_1->scrnIndex], 0 ); + + pMga = MGAPTR(pMGAEnt->pScrn_1); + pMga->haveQuiescense = 1; + pMGA2->haveQuiescense = 1; + + if ( pMGAEnt->directRenderingEnabled ) { + MGAWaitForIdleDMA( pMGAEnt->pScrn_1 ); + pMga->RestoreAccelState( pScrn ); + xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex ); + } +} + +static void MGASwapContext( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + + /* Arrange for dma_quiescence and xaa sync to be called as + * appropriate. + */ + pMga->haveQuiescense = 0; + pMga->AccelInfoRec->NeedToSync = TRUE; +} + +static void MGASwapContextShared( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGAEntPtr pMGAEnt = pMga->entityPrivate; + MGAPtr pMGA2 = MGAPTR(pMGAEnt->pScrn_2); + + pMga = MGAPTR(pMGAEnt->pScrn_1); + + pMga->haveQuiescense = 0; + pMga->AccelInfoRec->NeedToSync = TRUE; + + pMGA2->haveQuiescense = 0; + pMGA2->AccelInfoRec->NeedToSync = TRUE; +} + +/* This is really only called from validate/postvalidate as we + * override the dri lock/unlock. Want to remove validate/postvalidate + * processing, but need to remove all client-side use of drawable lock + * first (otherwise there is noone recover when a client dies holding + * the drawable lock). + * + * What does this mean? + * + * - The above code gets executed every time a + * window changes shape or the focus changes, which isn't really + * optimal. + * - The X server therefore believes it needs to do an XAA sync + * *and* a dma quiescense ioctl each time that happens. + * + * We don't wrap wakeuphandler any longer, so at least we can say that + * this doesn't happen *every time the mouse moves*... + */ +static void +MGADRISwapContext( ScreenPtr pScreen, DRISyncType syncType, + DRIContextType oldContextType, void *oldContext, + DRIContextType newContextType, void *newContext ) +{ +#if 0 + if ( syncType == DRI_3D_SYNC && + oldContextType == DRI_2D_CONTEXT && + newContextType == DRI_2D_CONTEXT ) + { + MGASwapContext( pScreen ); + } +#endif +} + +static void +MGADRISwapContextShared( ScreenPtr pScreen, DRISyncType syncType, + DRIContextType oldContextType, void *oldContext, + DRIContextType newContextType, void *newContext ) +{ +#if 0 + if ( syncType == DRI_3D_SYNC && + oldContextType == DRI_2D_CONTEXT && + newContextType == DRI_2D_CONTEXT ) + { + MGASwapContextShared( pScreen ); + } +#endif +} + + +static void MGAWakeupHandler( int screenNum, pointer wakeupData, + unsigned long result, pointer pReadmask ) +{ + ScreenPtr pScreen = screenInfo.screens[screenNum]; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { + MGASwapContextShared( pScreen ); + } else { + MGASwapContext( pScreen ); + } +} + +static void MGABlockHandler( int screenNum, pointer blockData, + pointer pTimeout, pointer pReadmask ) + +{ + ScreenPtr pScreen = screenInfo.screens[screenNum]; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGAEntPtr pMGAEnt; + + if ( pMga->haveQuiescense ) { + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { + /* Restore to first screen */ + pMga->RestoreAccelState( pScrn ); + xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex ); + pMGAEnt = pMga->entityPrivate; + + if ( pMGAEnt->directRenderingEnabled ) { + DRIUnlock( screenInfo.screens[pMGAEnt->pScrn_1->scrnIndex] ); + } + } else { + if ( pMga->directRenderingEnabled ) { + DRIUnlock( pScreen ); + } + } + pMga->haveQuiescense = 0; + } +} + +void MGASelectBuffer( ScrnInfoPtr pScrn, int which ) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate; + + switch ( which ) { + case MGA_BACK: + OUTREG( MGAREG_DSTORG, pMGADRI->backOffset ); + OUTREG( MGAREG_SRCORG, pMGADRI->backOffset ); + break; + case MGA_DEPTH: + OUTREG( MGAREG_DSTORG, pMGADRI->depthOffset ); + OUTREG( MGAREG_SRCORG, pMGADRI->depthOffset ); + break; + default: + case MGA_FRONT: + OUTREG( MGAREG_DSTORG, pMGADRI->frontOffset ); + OUTREG( MGAREG_SRCORG, pMGADRI->frontOffset ); + break; + } +} + + +static unsigned int mylog2( unsigned int n ) { unsigned int log2 = 1; - while (n>1) n >>= 1, log2++; + while ( n > 1 ) n >>= 1, log2++; return log2; } -static unsigned long MGAParseAgpMode(ScreenPtr pScreen) +static Bool MGADRIAgpInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); - unsigned long mode_mask; + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + unsigned long mode; + unsigned int vendor, device; + int ret, count; + + /* FIXME: Make these configurable... + */ + pMGADRIServer->agp.size = 12 * 1024 * 1024; - switch(pMga->agp_mode) { + pMGADRIServer->warp.offset = 0; + pMGADRIServer->warp.size = MGA_WARP_UCODE_SIZE; + + pMGADRIServer->primary.offset = (pMGADRIServer->warp.offset + + pMGADRIServer->warp.size); + pMGADRIServer->primary.size = 1024 * 1024; + + pMGADRIServer->buffers.offset = (pMGADRIServer->primary.offset + + pMGADRIServer->primary.size); + pMGADRIServer->buffers.size = MGA_NUM_BUFFERS * MGA_BUFFER_SIZE; + + if ( drmAgpAcquire( pMga->drmFD ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not available\n" ); + return FALSE; + } + + mode = drmAgpGetMode( pMga->drmFD ); /* Default mode */ + vendor = drmAgpVendorId( pMga->drmFD ); + device = drmAgpDeviceId( pMga->drmFD ); + + mode &= ~MGA_AGP_MODE_MASK; + switch ( pMga->agpMode ) { case 4: - mode_mask = ~0x00000003; - break; + mode |= MGA_AGP_4X_MODE; case 2: - if (pMga->Chipset == PCI_CHIP_MGAG200) { - xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Enabling AGP 2x pll encoding\n"); - OUTREG(MGAREG_AGP_PLL, AGP_PLL_agp2xpllen_enable); - } - mode_mask = ~0x00000005; - break; - default: - /* Default to 1X agp mode */ + mode |= MGA_AGP_2X_MODE; case 1: - if (pMga->Chipset == PCI_CHIP_MGAG200) { - xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Disabling AGP 2x pll encoding\n"); - OUTREG(MGAREG_AGP_PLL, AGP_PLL_agp2xpllen_disable); + default: + mode |= MGA_AGP_1X_MODE; + } + + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n", + mode, vendor, device, + pMga->PciInfo->vendor, + pMga->PciInfo->chipType ); + + if ( drmAgpEnable( pMga->drmFD, mode ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n" ); + drmAgpRelease( pMga->drmFD ); + return FALSE; + } + + if ( pMga->Chipset == PCI_CHIP_MGAG200 ) { + switch ( pMga->agpMode ) { + case 2: + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Enabling AGP 2x PLL encoding\n" ); + OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_ENABLE ); + break; + + case 1: + default: + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Disabling AGP 2x PLL encoding\n" ); + OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_DISABLE ); + pMga->agpMode = 1; + break; } - pMga->agp_mode = 1; - mode_mask = ~0x00000006; + } + + ret = drmAgpAlloc( pMga->drmFD, pMGADRIServer->agp.size, + 0, NULL, &pMGADRIServer->agp.handle ); + if ( ret < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Out of memory (%d)\n", ret ); + drmAgpRelease( pMga->drmFD ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] %d kB allocated with handle 0x%08x\n", + pMGADRIServer->agp.size/1024, pMGADRIServer->agp.handle ); + + if ( drmAgpBind( pMga->drmFD, pMGADRIServer->agp.handle, 0 ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Could not bind memory\n" ); + drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle ); + drmAgpRelease( pMga->drmFD ); + return FALSE; + } + + /* WARP microcode space + */ + if ( drmAddMap( pMga->drmFD, + pMGADRIServer->warp.offset, + pMGADRIServer->warp.size, + DRM_AGP, DRM_READ_ONLY, + &pMGADRIServer->warp.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add WARP microcode mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] WARP microcode handle = 0x%08lx\n", + pMGADRIServer->warp.handle ); + + if ( drmMap( pMga->drmFD, + pMGADRIServer->warp.handle, + pMGADRIServer->warp.size, + &pMGADRIServer->warp.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map WARP microcode\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] WARP microcode mapped at 0x%08lx\n", + (unsigned long)pMGADRIServer->warp.map ); + + /* Primary DMA space + */ + if ( drmAddMap( pMga->drmFD, + pMGADRIServer->primary.offset, + pMGADRIServer->primary.size, + DRM_AGP, DRM_READ_ONLY, + &pMGADRIServer->primary.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add primary DMA mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] Primary DMA handle = 0x%08lx\n", + pMGADRIServer->primary.handle ); + + if ( drmMap( pMga->drmFD, + pMGADRIServer->primary.handle, + pMGADRIServer->primary.size, + &pMGADRIServer->primary.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map primary DMA\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] Primary DMA mapped at 0x%08lx\n", + (unsigned long)pMGADRIServer->primary.map ); + + /* DMA buffers + */ + if ( drmAddMap( pMga->drmFD, + pMGADRIServer->buffers.offset, + pMGADRIServer->buffers.size, + DRM_AGP, 0, + &pMGADRIServer->buffers.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add DMA buffers mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] DMA buffers handle = 0x%08lx\n", + pMGADRIServer->buffers.handle ); + + if ( drmMap( pMga->drmFD, + pMGADRIServer->buffers.handle, + pMGADRIServer->buffers.size, + &pMGADRIServer->buffers.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map DMA buffers\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] DMA buffers mapped at 0x%08lx\n", + (unsigned long)pMGADRIServer->buffers.map ); + + count = drmAddBufs( pMga->drmFD, + MGA_NUM_BUFFERS, MGA_BUFFER_SIZE, + DRM_AGP_BUFFER, pMGADRIServer->buffers.offset ); + if ( count <= 0 ) { + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "[drm] failure adding %d %d byte DMA buffers\n", + MGA_NUM_BUFFERS, MGA_BUFFER_SIZE ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Added %d %d byte DMA buffers\n", + count, MGA_BUFFER_SIZE ); + + xf86EnablePciBusMaster( pMga->PciInfo, TRUE ); + + return TRUE; +} + +static Bool MGADRIMapInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + + pMGADRIServer->registers.size = MGAIOMAPSIZE; + + if ( drmAddMap( pMga->drmFD, + (drmHandle)pMga->IOAddress, + pMGADRIServer->registers.size, + DRM_REGISTERS, DRM_READ_ONLY, + &pMGADRIServer->registers.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] Could not add MMIO registers mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Registers handle = 0x%08lx\n", + pMGADRIServer->registers.handle ); + + pMGADRIServer->status.size = SAREA_MAX; + + if ( drmAddMap( pMga->drmFD, 0, pMGADRIServer->status.size, + DRM_SHM, DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL, + &pMGADRIServer->status.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] Could not add status page mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Status handle = 0x%08lx\n", + pMGADRIServer->status.handle ); + + if ( drmMap( pMga->drmFD, + pMGADRIServer->status.handle, + pMGADRIServer->status.size, + &pMGADRIServer->status.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map status page\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] Status page mapped at 0x%08lx\n", + (unsigned long)pMGADRIServer->status.map ); + + return TRUE; +} + +static Bool MGADRIKernelInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + drmMGAInit init; + int ret; + + memset( &init, 0, sizeof(drmMGAInit) ); + + init.sarea_priv_offset = sizeof(XF86DRISAREARec); + + switch ( pMga->Chipset ) { + case PCI_CHIP_MGAG400: + init.chipset = MGA_CARD_TYPE_G400; + break; + case PCI_CHIP_MGAG200: + case PCI_CHIP_MGAG200_PCI: + init.chipset = MGA_CARD_TYPE_G200; break; + default: + return FALSE; } + init.sgram = !pMga->HasSDRAM; - return mode_mask; + init.maccess = pMga->MAccess; + + init.fb_cpp = pScrn->bitsPerPixel / 8; + init.front_offset = pMGADRIServer->frontOffset; + init.front_pitch = pMGADRIServer->frontPitch / init.fb_cpp; + init.back_offset = pMGADRIServer->backOffset; + init.back_pitch = pMGADRIServer->backPitch / init.fb_cpp; + + init.depth_cpp = pScrn->bitsPerPixel / 8; + init.depth_offset = pMGADRIServer->depthOffset; + init.depth_pitch = pMGADRIServer->depthPitch / init.depth_cpp; + + init.texture_offset[0] = pMGADRIServer->textureOffset; + init.texture_size[0] = pMGADRIServer->textureSize; + + init.fb_offset = pMga->FbAddress; + init.mmio_offset = pMGADRIServer->registers.handle; + init.status_offset = pMGADRIServer->status.handle; + + init.warp_offset = pMGADRIServer->warp.handle; + init.primary_offset = pMGADRIServer->primary.handle; + init.buffers_offset = pMGADRIServer->buffers.handle; + + ret = drmMGAInitDMA( pMga->drmFD, &init ); + if ( ret < 0 ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Failed to initialize DMA! (%d)\n", ret ); + return FALSE; + } + +#if 0 + /* FIXME: This is just here to clean up after the engine reset test + * in the kernel module. Please remove it later... + */ + pMga->GetQuiescence( pScrn ); +#endif + + return TRUE; } -Bool MGADRIScreenInit(ScreenPtr pScreen) +static Bool MGADRIBuffersInit( ScreenPtr pScreen ) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + + + pMGADRIServer->drmBuffers = drmMapBufs( pMga->drmFD ); + if ( !pMGADRIServer->drmBuffers ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] Failed to map DMA buffers list\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Mapped %d DMA buffers\n", + pMGADRIServer->drmBuffers->count ); + + return TRUE; +} + + +Bool MGADRIScreenInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); DRIInfoPtr pDRIInfo; MGADRIPtr pMGADRI; MGADRIServerPrivatePtr pMGADRIServer; - int bufs, size; - int prim_size; - int init_offset; - int i; - unsigned long mode_mask; - switch(pMGA->Chipset) { + switch ( pMga->Chipset ) { case PCI_CHIP_MGAG400: case PCI_CHIP_MGAG200: #if 0 @@ -388,112 +906,131 @@ Bool MGADRIScreenInit(ScreenPtr pScreen) #endif break; default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Direct rendering only supported with G200/G400 AGP\n"); + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Direct rendering only supported with AGP G200/G400 cards!\n" ); return FALSE; } /* 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, - "MGADRIScreenInit failed (libdri.a too old)\n"); + * 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, + "MGADRIScreenInit failed (libdri.a too old)\n" ); return FALSE; } - + /* Check the DRI version */ { int major, minor, patch; - DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 1 || patch < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] MGADRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n", - major, minor, patch); + DRIQueryVersion( &major, &minor, &patch ); + if ( major != 4 || minor < 0) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] MGADRIScreenInit failed " + "(DRI version = %d.%d.%d, expected 4.0.x). " + "Disabling DRI.\n", + major, minor, patch ); return FALSE; } } - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] bpp: %d depth: %d\n", pScrn->bitsPerPixel, pScrn->depth); + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] bpp: %d depth: %d\n", + pScrn->bitsPerPixel, pScrn->depth ); - if ((pScrn->bitsPerPixel / 8) != 2 && - (pScrn->bitsPerPixel / 8) != 4) { - xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Direct rendering only supported in 16 and 32 bpp modes\n"); + if ( (pScrn->bitsPerPixel / 8) != 2 && + (pScrn->bitsPerPixel / 8) != 4 ) { + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Direct rendering only supported in 16 and 32 bpp modes\n" ); return FALSE; } - + pDRIInfo = DRICreateInfoRec(); - if (!pDRIInfo) + if ( !pDRIInfo ) return FALSE; - pMGA->pDRIInfo = pDRIInfo; + pMga->pDRIInfo = pDRIInfo; pDRIInfo->drmDriverName = MGAKernelDriverName; pDRIInfo->clientDriverName = MGAClientDriverName; pDRIInfo->busIdString = xalloc(64); - sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", - ((pciConfigPtr)pMGA->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pMGA->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pMGA->PciInfo->thisCard)->funcnum); + sprintf( pDRIInfo->busIdString, "PCI:%d:%d:%d", + ((pciConfigPtr)pMga->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pMga->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum ); pDRIInfo->ddxDriverMajorVersion = MGA_MAJOR_VERSION; pDRIInfo->ddxDriverMinorVersion = MGA_MINOR_VERSION; pDRIInfo->ddxDriverPatchVersion = MGA_PATCHLEVEL; - pDRIInfo->frameBufferPhysicalAddress = pMGA->FbAddress; - pDRIInfo->frameBufferSize = pMGA->FbMapSize; + pDRIInfo->frameBufferPhysicalAddress = pMga->FbAddress; + pDRIInfo->frameBufferSize = pMga->FbMapSize; pDRIInfo->frameBufferStride = pScrn->displayWidth*(pScrn->bitsPerPixel/8); pDRIInfo->ddxDrawableTableEntry = MGA_MAX_DRAWABLES; - MGADRIWrapFunctions( pScreen, pDRIInfo ); + pDRIInfo->wrap.BlockHandler = MGABlockHandler; + pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler; + pDRIInfo->wrap.ValidateTree = NULL; + pDRIInfo->wrap.PostValidateTree = NULL; - if (SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES) + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + + if ( SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES ) { pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; - else + } else { pDRIInfo->maxDrawableTableEntry = MGA_MAX_DRAWABLES; + } /* For now the mapping works by using a fixed size defined - * in the SAREA header + * in the SAREA header. */ - if (sizeof(XF86DRISAREARec)+sizeof(MGASAREARec)>SAREA_MAX) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Data does not fit in SAREA\n"); + if ( sizeof(XF86DRISAREARec) + sizeof(MGASAREAPrivRec) > SAREA_MAX ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Data does not fit in SAREA\n" ); return FALSE; } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Sarea %d+%d: %d\n", - sizeof(XF86DRISAREARec), sizeof(MGASAREARec), - sizeof(XF86DRISAREARec) + sizeof(MGASAREARec)); + + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "[drm] Sarea %d+%d: %d\n", + sizeof(XF86DRISAREARec), sizeof(MGASAREAPrivRec), + sizeof(XF86DRISAREARec) + sizeof(MGASAREAPrivRec) ); pDRIInfo->SAREASize = SAREA_MAX; - if (!(pMGADRI = (MGADRIPtr)xnfcalloc(sizeof(MGADRIRec),1))) { - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo=0; - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Failed to allocate memory for private record\n"); + pMGADRI = (MGADRIPtr)xnfcalloc( sizeof(MGADRIRec), 1 ); + if ( !pMGADRI ) { + DRIDestroyInfoRec( pMga->pDRIInfo ); + pMga->pDRIInfo = 0; + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Failed to allocate memory for private record\n" ); return FALSE; } - if (!(pMGADRIServer = (MGADRIServerPrivatePtr) - xnfcalloc(sizeof(MGADRIServerPrivateRec),1))) { - xfree(pMGADRI); - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo=0; - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Failed to allocate memory for private record\n"); + + pMGADRIServer = (MGADRIServerPrivatePtr) + xnfcalloc( sizeof(MGADRIServerPrivateRec), 1 ); + if ( !pMGADRIServer ) { + xfree( pMGADRI ); + DRIDestroyInfoRec( pMga->pDRIInfo ); + pMga->pDRIInfo = 0; + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Failed to allocate memory for private record\n" ); return FALSE; } + pMga->DRIServerInfo = pMGADRIServer; pDRIInfo->devPrivate = pMGADRI; - pMGA->DRIServerInfo = pMGADRIServer; pDRIInfo->devPrivateSize = sizeof(MGADRIRec); pDRIInfo->contextSize = sizeof(MGADRIContextRec); pDRIInfo->CreateContext = MGACreateContext; pDRIInfo->DestroyContext = MGADestroyContext; - if (xf86IsEntityShared(pScrn->entityList[0])) - pDRIInfo->SwapContext = MGADRISwapContext_shared; - else + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { + pDRIInfo->SwapContext = MGADRISwapContextShared; + } else { pDRIInfo->SwapContext = MGADRISwapContext; - + } + switch( pScrn->bitsPerPixel ) { case 8: pDRIInfo->InitBuffers = Mga8DRIInitBuffers; @@ -508,141 +1045,115 @@ Bool MGADRIScreenInit(ScreenPtr pScreen) pDRIInfo->InitBuffers = Mga32DRIInitBuffers; pDRIInfo->MoveBuffers = Mga32DRIMoveBuffers; } - + pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - if (!DRIScreenInit(pScreen, pDRIInfo, &pMGA->drmSubFD)) { - xfree(pMGADRIServer); - pMGA->DRIServerInfo = 0; - xfree(pDRIInfo->devPrivate); + if ( !DRIScreenInit( pScreen, pDRIInfo, &pMga->drmFD ) ) { + xfree( pMGADRIServer ); + pMga->DRIServerInfo = 0; + xfree( pDRIInfo->devPrivate ); pDRIInfo->devPrivate = 0; - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo = 0; - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] DRIScreenInit Failed\n"); + DRIDestroyInfoRec( pMga->pDRIInfo ); + pMga->pDRIInfo = 0; + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] DRIScreenInit Failed\n" ); return FALSE; } /* Check the MGA DRM version */ { - drmVersionPtr version = drmGetVersion(pMGA->drmSubFD); - if (version) { - if (version->version_major != 2 || - version->version_minor != 1 || - version->version_patchlevel < 0) { + drmVersionPtr version = drmGetVersion(pMga->drmFD); + if ( version ) { + if ( version->version_major != 3 || + version->version_minor < 0) { /* incompatible drm version */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] MGADRIScreenInit failed (DRM version = %d.%d.%d, expected 2.1.x). Disabling DRI.\n", - version->version_major, - version->version_minor, - version->version_patchlevel); -/* MGADRICloseScreen(pScreen); */ - - drmFreeVersion(version); + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] MGADRIScreenInit failed " + "(DRM version = %d.%d.%d, expected 3.0.x). " + "Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel ); + drmFreeVersion( version ); + MGADRICloseScreen( pScreen ); /* FIXME: ??? */ return FALSE; } - drmFreeVersion(version); + drmFreeVersion( version ); } } - pMGADRIServer->regsSize = MGAIOMAPSIZE; - if (drmAddMap(pMGA->drmSubFD, (drmHandle)pMGA->IOAddress, - pMGADRIServer->regsSize, DRM_REGISTERS, 0, - &pMGADRIServer->regs)<0) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap failed Register MMIO region\n"); - return FALSE; +#if 0 + /* Calculate texture constants for AGP texture space. + * FIXME: move! + */ + { + CARD32 agpTextureOffset = MGA_DMA_BUF_SZ * MGA_DMA_BUF_NR; + CARD32 agpTextureSize = pMGADRI->agp.size - agpTextureOffset; + + i = mylog2(agpTextureSize / MGA_NR_TEX_REGIONS); + if (i < MGA_LOG_MIN_TEX_REGION_SIZE) + i = MGA_LOG_MIN_TEX_REGION_SIZE; + + pMGADRI->logAgpTextureGranularity = i; + pMGADRI->agpTextureSize = (agpTextureSize >> i) << i; + pMGADRI->agpTextureOffset = agpTextureOffset; } - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", - pMGADRIServer->regs); - - /* Agp Support */ - pMGADRIServer->agpAcquired = FALSE; - pMGADRIServer->agpHandle = 0; - pMGADRIServer->agpSizep = 0; - pMGADRIServer->agp_map = 0; - - if (drmAgpAcquire(pMGA->drmSubFD) < 0) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n"); +#endif + + if ( !MGADRIAgpInit( pScreen ) ) { + DRICloseScreen( pScreen ); return FALSE; } - pMGADRIServer->agpAcquired = TRUE; - pMGADRIServer->warp_ucode_size = mgaGetMicrocodeSize(pScreen); - if (pMGADRIServer->warp_ucode_size == 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] microcodeSize is zero\n"); - DRICloseScreen(pScreen); + if ( !MGADRIMapInit( pScreen ) ) { + DRICloseScreen( pScreen ); return FALSE; } - mode_mask = MGAParseAgpMode(pScreen); - - pMGADRIServer->agpMode = drmAgpGetMode(pMGA->drmSubFD); - pMGADRIServer->agpMode &= mode_mask; - if (drmAgpEnable(pMGA->drmSubFD, pMGADRIServer->agpMode) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n"); - DRICloseScreen(pScreen); + if ( !MGAInitVisualConfigs( pScreen ) ) { + DRICloseScreen( pScreen ); return FALSE; } - ErrorF("[drm] drmAgpEnabled succeeded for AGP mode %dx\n", pMGA->agp_mode); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); - prim_size = 65536; - init_offset = ((prim_size + pMGADRIServer->warp_ucode_size + - 4096 - 1) / 4096) * 4096; - - pMGADRIServer->agpSizep = init_offset; - pMGADRI->agpSize = (drmAgpSize(pMGA->drmSubFD)) - init_offset; + return TRUE; +} - pMGADRIServer->agpBase = (drmAddress) drmAgpBase(pMGA->drmSubFD); - if (drmAddMap(pMGA->drmSubFD, 0, - init_offset, DRM_AGP, 0, - &pMGADRIServer->agp_private) < 0) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap failed on AGP aperture\n"); - return FALSE; - } - - if (drmMap(pMGA->drmSubFD, (drmHandle)pMGADRIServer->agp_private, - init_offset, - (drmAddressPtr)&pMGADRIServer->agp_map) < -1) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmMap failed on AGP aperture\n"); + +Bool MGADRIFinishScreenInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate; + int i; + + if ( !pMga->pDRIInfo ) return FALSE; - } - - /* Now allocate and bind a default of 8 megs */ - drmAgpAlloc(pMGA->drmSubFD, 0x00800000, 0, 0, - &pMGADRIServer->agpHandle); - - if (pMGADRIServer->agpHandle == 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAgpAlloc failed\n"); - DRICloseScreen(pScreen); + + pMga->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + + /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit + * because *DRIKernelInit requires that the hardware lock is held by + * the X server, and the first time the hardware lock is grabbed is + * in DRIFinishScreenInit. + */ + if ( !DRIFinishScreenInit( pScreen ) ) { + MGADRICloseScreen( pScreen ); return FALSE; } - - if (drmAgpBind(pMGA->drmSubFD, pMGADRIServer->agpHandle, 0) < 0) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAgpBind failed\n"); + + if ( !MGADRIKernelInit( pScreen ) ) { + MGADRICloseScreen( pScreen ); return FALSE; } - mgaInstallMicrocode(pScreen, prim_size); - - if (drmAddMap(pMGA->drmSubFD, (drmHandle)init_offset, - pMGADRI->agpSize, DRM_AGP, 0, - &pMGADRI->agp) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Failed to map public agp area\n"); - DRICloseScreen(pScreen); + if ( !MGADRIBuffersInit( pScreen ) ) { + MGADRICloseScreen( pScreen ); return FALSE; } - switch(pMGA->Chipset) { + switch ( pMga->Chipset ) { case PCI_CHIP_MGAG400: pMGADRI->chipset = MGA_CARD_TYPE_G400; break; @@ -653,356 +1164,97 @@ Bool MGADRIScreenInit(ScreenPtr pScreen) default: return FALSE; } - - pMGADRI->width = pScrn->virtualX; - pMGADRI->height = pScrn->virtualY; - pMGADRI->mem = pScrn->videoRam * 1024; - pMGADRI->cpp = pScrn->bitsPerPixel / 8; - pMGADRI->frontPitch = pScrn->displayWidth * (pScrn->bitsPerPixel / 8); - - - pMGADRI->frontOffset = 0; /* pMGA->YDstOrg * (pScrn->bitsPerPixel / 8) */ - pMGADRI->backOffset = ((pScrn->virtualY + pMGA->numXAALines + 1) * - pScrn->displayWidth * - pMGADRI->cpp + 4095) & ~0xFFF; - - - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] calced backoffset: 0x%x\n", - pMGADRI->backOffset); - - - size = pMGADRI->cpp * pScrn->virtualX * pScrn->virtualY; - size += 4095; - size &= ~4095; - pMGADRI->depthOffset = pMGA->FbUsableSize - size; - pMGADRI->depthOffset &= ~4095; - pMGADRI->textureOffset = pMGADRI->backOffset + size; - pMGADRI->textureSize = pMGADRI->depthOffset - pMGADRI->textureOffset; - - if (pMGADRI->depthOffset < pMGADRI->textureOffset + 512*1024) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Insufficient memory for direct rendering\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - pMGADRI->mAccess = pMGA->MAccess; - - i = mylog2(pMGADRI->textureSize / MGA_NR_TEX_REGIONS); - if (i < MGA_LOG_MIN_TEX_REGION_SIZE) + pMGADRI->width = pScrn->virtualX; + pMGADRI->height = pScrn->virtualY; + pMGADRI->mem = pScrn->videoRam * 1024; + pMGADRI->cpp = pScrn->bitsPerPixel / 8; + + pMGADRI->agpMode = pMga->agpMode; + + pMGADRI->frontOffset = pMGADRIServer->frontOffset; + pMGADRI->frontPitch = pMGADRIServer->frontPitch; + pMGADRI->backOffset = pMGADRIServer->backOffset; + pMGADRI->backPitch = pMGADRIServer->backPitch; + pMGADRI->depthOffset = pMGADRIServer->depthOffset; + pMGADRI->depthPitch = pMGADRIServer->depthPitch; + pMGADRI->textureOffset = pMGADRIServer->textureOffset; + pMGADRI->textureSize = pMGADRIServer->textureSize; + + i = mylog2( pMGADRI->textureSize / MGA_NR_TEX_REGIONS ); + if ( i < MGA_LOG_MIN_TEX_REGION_SIZE ) i = MGA_LOG_MIN_TEX_REGION_SIZE; - + pMGADRI->logTextureGranularity = i; pMGADRI->textureSize = (pMGADRI->textureSize >> i) << i; /* truncate */ - - /* Here is where we need to do initialization of the dma engine */ - if((bufs = drmAddBufs(pMGA->drmSubFD, - MGA_DMA_BUF_NR, - MGA_DMA_BUF_SZ, - DRM_AGP_BUFFER, - init_offset)) <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] failure adding %d %d byte DMA buffers\n", - MGA_DMA_BUF_NR, - MGA_DMA_BUF_SZ); - DRICloseScreen(pScreen); - return FALSE; - } - - pMGADRI->agpBufferOffset = init_offset + pMGADRIServer->agp_private; - - /* Calculate texture constants for AGP texture space - */ - { - CARD32 agpTextureOffset = MGA_DMA_BUF_SZ * MGA_DMA_BUF_NR; - CARD32 agpTextureSize = pMGADRI->agpSize - agpTextureOffset; - - i = mylog2(agpTextureSize / MGA_NR_TEX_REGIONS); - if (i < MGA_LOG_MIN_TEX_REGION_SIZE) - i = MGA_LOG_MIN_TEX_REGION_SIZE; - - pMGADRI->logAgpTextureGranularity = i; - pMGADRI->agpTextureSize = (agpTextureSize >> i) << i; - pMGADRI->agpTextureOffset = agpTextureOffset; - } - - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] added %d %d byte DMA buffers\n", - bufs, MGA_DMA_BUF_SZ); - - - if ((MgaInitDma(pScrn, prim_size)) != TRUE) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Failed to initialize dma engine\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Initialized Dma Engine\n"); - - if (!pMGADRIServer->irq) { - pMGADRIServer->irq = drmGetInterruptFromBusID(pMGA->drmSubFD, - ((pciConfigPtr)pMGA->PciInfo - ->thisCard)->busnum, - ((pciConfigPtr)pMGA->PciInfo - ->thisCard)->devnum, - ((pciConfigPtr)pMGA->PciInfo - ->thisCard)->funcnum); - - if(!pMGADRIServer->irq && !pMGA->ReallyUseIrqZero) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] Your graphics card has Interrupt zero" - " assigned to it.\n" - "This is highly unlikely so I'm disabling the DRI.\n" - "If your graphics card really has Interrupt zero, please" - "add the config option UseIrqZero\n" - "to the device section in your XF86Config file.\n" - "Please be warned that Interrupt zero is normally " - "the timer interrupt on X86 systems.\n" - "Using this option could make your system unusable.\n" - "The more likely solution is that your graphics card has" - " no interrupt assigned to it.\nPlease consult your" - " system BIOS manual for instructions on how to enable " - "an interrupt for your graphics card.\n"); - MGADRICloseScreen(pScreen); - return FALSE; - } - drmCtlInstHandler(pMGA->drmSubFD, pMGADRIServer->irq); - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] dma control initialized, using IRQ %d\n", - pMGADRIServer->irq); - - - if (!(MGAInitVisualConfigs(pScreen))) { - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); - + pMGADRI->registers.handle = pMGADRIServer->registers.handle; + pMGADRI->registers.size = pMGADRIServer->registers.size; + pMGADRI->status.handle = pMGADRIServer->status.handle; + pMGADRI->status.size = pMGADRIServer->status.size; + pMGADRI->primary.handle = pMGADRIServer->primary.handle; + pMGADRI->primary.size = pMGADRIServer->primary.size; + pMGADRI->buffers.handle = pMGADRIServer->buffers.handle; + pMGADRI->buffers.size = pMGADRIServer->buffers.size; + pMGADRI->sarea_priv_offset = sizeof(XF86DRISAREARec); return TRUE; } -void -MGADRICloseScreen(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); - MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo; - -/* The DRI will automagically clean these up when driFD is closed */ - if(pMGADRIServer->agp_map) { - drmUnmap(pMGADRIServer->agp_map, pMGADRIServer->agpSizep); - pMGADRIServer->agp_map = 0; - } - if(pMGADRIServer->agpHandle) { - pMGADRIServer->agpHandle = 0; - pMGADRIServer->agpSizep = 0; - } - if(pMGADRIServer->agpAcquired == TRUE) { - pMGADRIServer->agpAcquired = FALSE; - } - - DRICloseScreen(pScreen); - - if (pMGA->pDRIInfo) { - if (pMGA->pDRIInfo->devPrivate) { - xfree(pMGA->pDRIInfo->devPrivate); - pMGA->pDRIInfo->devPrivate = 0; - } - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo = 0; - } - if(pMGA->DRIServerInfo) { - xfree(pMGA->DRIServerInfo); - pMGA->DRIServerInfo = 0; - } - if (pMGA->pVisualConfigs) { - xfree(pMGA->pVisualConfigs); - } - if (pMGA->pVisualConfigsPriv) { - xfree(pMGA->pVisualConfigsPriv); - } -} - -static Bool -MGACreateContext(ScreenPtr pScreen, VisualPtr visual, - drmContext hwContext, void *pVisualConfigPriv, - DRIContextType contextStore) -{ - return TRUE; -} - -static void -MGADestroyContext(ScreenPtr pScreen, drmContext hwContext, - DRIContextType contextStore) -{ -} - -Bool -MGADRIFinishScreenInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGASAREAPtr sPriv; - MGAPtr pMGA = MGAPTR(pScrn); - - if (!pMGA->pDRIInfo) return FALSE; - - sPriv = (MGASAREAPtr)DRIGetSAREAPrivate(pScreen); - pMGA->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; - - xf86memset( sPriv, 0, sizeof(MGASAREARec) ); - - return DRIFinishScreenInit(pScreen); -} - -void -mgaGetQuiescence( ScrnInfoPtr pScrn ) +void MGADRICloseScreen( ScreenPtr pScreen ) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; - pMga->have_quiescense = 1; - - if (pMga->directRenderingEnabled) { - MGAFBLayout *pLayout = &pMga->CurrentLayout; - - MgaLockUpdate(pScrn, (DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH)); - - WAITFIFO(11); - OUTREG(MGAREG_MACCESS, pMga->MAccess); - OUTREG(MGAREG_PITCH, pLayout->displayWidth); - pMga->PlaneMask = ~0; - OUTREG(MGAREG_PLNWT, pMga->PlaneMask); - pMga->BgColor = 0; - pMga->FgColor = 0; - OUTREG(MGAREG_BCOL, pMga->BgColor); - OUTREG(MGAREG_FCOL, pMga->FgColor); - OUTREG(MGAREG_SRCORG, pMga->realSrcOrg); - pMga->SrcOrg = 0; - OUTREG(MGAREG_DSTORG, pMga->DstOrg); - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); - OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ - OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ - pMga->AccelFlags &= ~CLIPPER_ON; + if ( pMGADRIServer->drmBuffers ) { + drmUnmapBufs( pMGADRIServer->drmBuffers ); + pMGADRIServer->drmBuffers = NULL; } -} + drmMGACleanupDMA( pMga->drmFD ); -void -mgaGetQuiescence_shared( ScrnInfoPtr pScrn ) -{ - MGAPtr pMga = MGAPTR(pScrn); - MGAEntPtr pMgaEnt = pMga->entityPrivate; - MGAPtr pMga2 = MGAPTR(pMgaEnt->pScrn_2); - - pMga = MGAPTR(pMgaEnt->pScrn_1); - pMga->have_quiescense = 1; - pMga2->have_quiescense = 1; - - if (pMgaEnt->directRenderingEnabled) { - MgaLockUpdate(pMgaEnt->pScrn_1, (DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH)); - pMga->RestoreAccelState(pScrn); - xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex); + if ( pMGADRIServer->status.map ) { + drmUnmap( pMGADRIServer->status.map, pMGADRIServer->status.size ); + pMGADRIServer->status.map = NULL; } -} - - -void -MGASwapContext(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMga = MGAPTR(pScrn); - - /* Arrange for dma_quiescence and xaa sync to be called as - * appropriate. - */ - pMga->have_quiescense = 0; - pMga->AccelInfoRec->NeedToSync = TRUE; -} - -void -MGASwapContext_shared(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMga = MGAPTR(pScrn); - MGAEntPtr pMgaEnt = pMga->entityPrivate; - MGAPtr pMga2 = MGAPTR(pMgaEnt->pScrn_2); - - pMga = MGAPTR(pMgaEnt->pScrn_1); - pMga->have_quiescense = 0; - pMga->AccelInfoRec->NeedToSync = TRUE; - pMga2->have_quiescense = 0; - pMga2->AccelInfoRec->NeedToSync = TRUE; -} - - -/* This is really only called from validate/postvalidate as we - * override the dri lock/unlock. Want to remove validate/postvalidate - * processing, but need to remove all client-side use of drawable lock - * first (otherwise there is noone recover when a client dies holding - * the drawable lock). - * - * What does this mean? - * - * - The above code gets executed every time a - * window changes shape or the focus changes, which isn't really - * optimal. - * - The X server therefore believes it needs to do an XAA sync - * *and* a dma quiescense ioctl each time that happens. - * - * We don't wrap wakeuphandler any longer, so at least we can say that - * this doesn't happen *every time the mouse moves*... - */ -static void -MGADRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType oldContextType, void *oldContext, - DRIContextType newContextType, void *newContext) -{ - if (syncType == DRI_3D_SYNC && - oldContextType == DRI_2D_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { - MGASwapContext(pScreen); + if ( pMGADRIServer->buffers.map ) { + drmUnmap( pMGADRIServer->buffers.map, pMGADRIServer->buffers.size ); + pMGADRIServer->buffers.map = NULL; + } + if ( pMGADRIServer->primary.map ) { + drmUnmap( pMGADRIServer->primary.map, pMGADRIServer->primary.size ); + pMGADRIServer->primary.map = NULL; + } + if ( pMGADRIServer->warp.map ) { + drmUnmap( pMGADRIServer->warp.map, pMGADRIServer->warp.size ); + pMGADRIServer->warp.map = NULL; } -} -static void -MGADRISwapContext_shared(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType oldContextType, void *oldContext, - DRIContextType newContextType, void *newContext) -{ - if (syncType == DRI_3D_SYNC && - oldContextType == DRI_2D_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { - MGASwapContext_shared(pScreen); + if ( pMGADRIServer->agp.handle ) { + drmAgpUnbind( pMga->drmFD, pMGADRIServer->agp.handle ); + drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle ); + pMGADRIServer->agp.handle = 0; + drmAgpRelease( pMga->drmFD ); } -} -void -MGASelectBuffer(ScrnInfoPtr pScrn, int which) -{ - MGAPtr pMga = MGAPTR(pScrn); - MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate; + DRICloseScreen( pScreen ); - switch (which) { - case MGA_BACK: - OUTREG(MGAREG_DSTORG, pMGADRI->backOffset); - OUTREG(MGAREG_SRCORG, pMGADRI->backOffset); - break; - case MGA_DEPTH: - OUTREG(MGAREG_DSTORG, pMGADRI->depthOffset); - OUTREG(MGAREG_SRCORG, pMGADRI->depthOffset); - break; - default: - case MGA_FRONT: - OUTREG(MGAREG_DSTORG, pMGADRI->frontOffset); - OUTREG(MGAREG_SRCORG, pMGADRI->frontOffset); - break; + if ( pMga->pDRIInfo ) { + if ( pMga->pDRIInfo->devPrivate ) { + xfree( pMga->pDRIInfo->devPrivate ); + pMga->pDRIInfo->devPrivate = 0; + } + DRIDestroyInfoRec( pMga->pDRIInfo ); + pMga->pDRIInfo = 0; + } + if ( pMga->DRIServerInfo ) { + xfree( pMga->DRIServerInfo ); + pMga->DRIServerInfo = 0; + } + if ( pMga->pVisualConfigs ) { + xfree( pMga->pVisualConfigs ); + } + if ( pMga->pVisualConfigsPriv ) { + xfree( pMga->pVisualConfigsPriv ); } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h index 28d710353..97588bff5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h @@ -1,12 +1,45 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.3 2000/06/22 03:58:25 tsi Exp $ */ - -#ifndef _MGA_DRI_ -#define _MGA_DRI_ - -#include <xf86drm.h> -#include <xf86drmMga.h> - -#define MGA_MAX_DRAWABLES 256 +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.5 2001/03/21 17:02:24 dawes Exp $ */ + +/* + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * 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 + * VA LINUX SYSTEMS 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: + * Keith WHitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_DRI_H__ +#define __MGA_DRI_H__ + +#include "xf86drm.h" +#include "xf86drmMga.h" + +#define MGA_DEFAULT_AGP_MODE 1 +#define MGA_MAX_AGP_MODE 4 + +/* Buffer are aligned on 4096 byte boundaries. + */ +#define MGA_BUFFER_ALIGN 0x00000fff typedef struct { int reserved_map_agpstart; @@ -17,19 +50,33 @@ typedef struct { int warp_ucode_size; int chipset; int sgram; - unsigned long agpMode; - unsigned long agpHandle; - Bool agpAcquired; - drmHandle agp_private; - drmSize agpSizep; - drmAddress agpBase; - int irq; - drmHandle regs; - drmSize regsSize; - drmAddress regsMap; - drmMgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES]; - drmBufMapPtr drmBufs; - CARD8 *agp_map; + + unsigned int frontOffset; + unsigned int frontPitch; + + unsigned int backOffset; + unsigned int backPitch; + + unsigned int depthOffset; + unsigned int depthPitch; + + unsigned int textureOffset; + int textureSize; + + drmRegion agp; + + /* PCI mappings */ + drmRegion registers; + drmRegion status; + + /* AGP mappings */ + drmRegion warp; + drmRegion primary; + drmRegion buffers; + drmRegion agpTextures; + + drmBufMapPtr drmBuffers; + } MGADRIServerPrivateRec, *MGADRIServerPrivatePtr; typedef struct { @@ -38,6 +85,9 @@ typedef struct { int height; int mem; int cpp; + + int agpMode; + unsigned int frontOffset; unsigned int frontPitch; @@ -59,83 +109,13 @@ typedef struct { unsigned int agpTextureSize; int logAgpTextureGranularity; - /* Redundant? - */ - unsigned int frontOrg; - unsigned int backOrg; - unsigned int depthOrg; - unsigned int mAccess; - drmHandle agp; - drmSize agpSize; + drmRegion registers; + drmRegion status; + drmRegion primary; + drmRegion buffers; + unsigned int sarea_priv_offset; } MGADRIRec, *MGADRIPtr; - -/* WARNING: Do not change the SAREA structure without changing the kernel - * as well */ -typedef struct { - unsigned char next, prev; - unsigned char in_use; - unsigned int age; -} MGATexRegionRec, *MGATexRegionPtr; - -typedef struct { - /* The channel for communication of state information to the kernel - * on firing a vertex dma buffer. - */ - unsigned int ContextState[MGA_CTX_SETUP_SIZE]; - unsigned int ServerState[MGA_2D_SETUP_SIZE]; - unsigned int TexState[2][MGA_TEX_SETUP_SIZE]; - unsigned int WarpPipe; - unsigned int dirty; - - unsigned int nbox; - XF86DRIClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS]; - - /* Information about the most recently used 3d drawable. The - * client fills in the req_* fields, the server fills in the - * exported_ fields and puts the cliprects into boxes, above. - * - * The client clears the exported_drawable field before - * clobbering the boxes data. - */ - unsigned int req_drawable; /* the X drawable id */ - unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ - - unsigned int exported_drawable; - unsigned int exported_index; - unsigned int exported_stamp; - unsigned int exported_buffers; - int exported_nfront; - int exported_nback; - int exported_back_x, exported_front_x, exported_w; - int exported_back_y, exported_front_y, exported_h; - XF86DRIClipRectRec exported_boxes[MGA_NR_SAREA_CLIPRECTS]; - - /* Counters for aging textures and for client-side throttling. - */ - unsigned int last_enqueue; /* last time a buffer was enqueued */ - unsigned int last_dispatch; /* age of the most recently dispatched buffer */ - unsigned int last_quiescent; /* */ - - /* LRU lists for texture memory in agp space and on the card */ - - MGATexRegionRec texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; - unsigned int texAge[MGA_NR_TEX_HEAPS]; - /* Mechanism to validate card state. - */ - int ctxOwner; -} MGASAREARec, *MGASAREAPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} MGAConfigPrivRec, *MGAConfigPrivPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} MGADRIContextRec, *MGADRIContextPtr; - #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h index 841c17cb9..ba645d2bd 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h @@ -1,15 +1,42 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.1 2000/02/11 17:25:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.3 2001/03/21 17:11:47 dawes Exp $ */ -#ifndef _MGA_DRIPRIV_H_ -#define _MGA_DRIPRIV_H_ +/* + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * 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 + * VA LINUX SYSTEMS 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_DRIPRIV_H__ +#define __MGA_DRIPRIV_H__ + +#include "GL/glxint.h" #define MGA_MAX_DRAWABLES 256 -extern void GlxSetVisualConfigs( - int nconfigs, - __GLXvisualConfig *configs, - void **configprivs -); +extern void GlxSetVisualConfigs( int nconfigs, + __GLXvisualConfig *configs, + void **configprivs ); typedef struct { /* Nothing here yet */ 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 5797babf1..e9ea1b853 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c @@ -41,9 +41,11 @@ * Doug Merritt * doug@netcom.com * Fixed 32bpp hires 8MB horizontal line glitch at middle right + * Niels Gram Jeppesen + * Added digital screen option for first head */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.189 2001/02/15 18:16:18 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.195 2001/04/06 02:09:12 dawes Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -92,7 +94,7 @@ #include "shadowfb.h" #include "fbdevhw.h" -#ifdef XF86DRI +#ifdef XF86DRI #include "dri.h" #endif @@ -140,7 +142,7 @@ static void MGAG100BlackMagic(MGAPtr pMga); static int MGAEntityIndex = -1; -/* +/* * This contains the functions needed by the server after loading the * driver module. It must be supplied, and gets added the driver list by * the Module Setup funtion in the dynamic case. In the static case a @@ -202,12 +204,10 @@ typedef enum { OPTION_VIDEO_KEY, OPTION_ROTATE, OPTION_TEXTURED_VIDEO, - OPTION_XAALINES, OPTION_CRTC2HALF, OPTION_CRTC2RAM, OPTION_INT10, - OPTION_AGP_MODE_2X, - OPTION_AGP_MODE_4X, + OPTION_AGP_MODE, OPTION_DIGITAL, OPTION_TV, OPTION_TVSTANDARD, @@ -234,17 +234,14 @@ static OptionInfoRec MGAOptions[] = { { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_TEXTURED_VIDEO, "TexturedVideo",OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_XAALINES, "XAALines", OPTV_INTEGER, {0}, FALSE }, { OPTION_CRTC2HALF, "Crtc2Half", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CRTC2RAM, "Crtc2Ram", OPTV_INTEGER, {0}, FALSE }, { OPTION_INT10, "Int10", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_AGP_MODE_2X, "AGPMode2x", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_AGP_MODE_4X, "AGPMode4x", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, { OPTION_DIGITAL, "DigitalScreen",OPTV_BOOLEAN, {0}, FALSE }, { OPTION_TV, "TV", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_TVSTANDARD, "TVStandard", OPTV_ANYSTR, {0}, FALSE }, { OPTION_CABLETYPE, "CableType", OPTV_ANYSTR, {0}, FALSE }, - { OPTION_USEIRQZERO, "UseIrqZero", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOHAL, "NoHal", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SWAPPED_HEAD, "SwappedHead", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } @@ -311,7 +308,7 @@ static const char *ramdacSymbols[] = { NULL }; -#ifdef XF86DRI +#ifdef XF86DRI static const char *drmSymbols[] = { "drmAvailable", "drmAddBufs", @@ -327,9 +324,9 @@ static const char *drmSymbols[] = { "drmAgpGetMode", "drmAgpBase", "drmAgpSize", - "drmMgaCleanupDma", - "drmMgaLockUpdate", - "drmMgaInitDma", + "drmMGAInitDMA", + "drmMGACleanupDMA", + "drmMGAFlushDMA", "drmFreeVersion", "drmGetVersion", NULL @@ -415,7 +412,7 @@ static const char *fbdevHWSymbols[] = { "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", - + NULL }; @@ -431,7 +428,7 @@ static const char *halSymbols[] = { "MGAGetBOARDHANDLESize", "MGAGetHardwareInfo", "MGAOpenLibrary", - NULL + NULL }; #endif #ifdef XFree86LOADER @@ -479,7 +476,7 @@ mgaSetup(pointer module, pointer opts, int *errmaj, int *errmin) ddcSymbols, i2cSymbols, shadowSymbols, fbdevHWSymbols, vbeSymbols, fbSymbols, int10Symbols, -#ifdef XF86DRI +#ifdef XF86DRI drmSymbols, driSymbols, #endif #ifdef USEMGAHAL @@ -501,14 +498,14 @@ mgaSetup(pointer module, pointer opts, int *errmaj, int *errmin) #endif /* XFree86LOADER */ -/* +/* * ramdac info structure initialization */ static MGARamdacRec DacInit = { FALSE, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 90000, /* maxPixelClock */ 0, X_DEFAULT, X_DEFAULT, FALSE -}; +}; static Bool MGAGetRec(ScrnInfoPtr pScrn) @@ -625,14 +622,14 @@ MGAProbe(DriverPtr drv, int flags) #ifdef DISABLE_VGA_IO MgaSavePtr smga; #endif - + /* Allocate a ScrnInfoRec and claim the slot */ pScrn = NULL; - + #ifndef DISABLE_VGA_IO if ((pScrn = xf86ConfigPciEntity(pScrn, 0,usedChips[i], MGAPciChipsets, NULL, NULL, - NULL, NULL, NULL))) + NULL, NULL, NULL))) #else smga = xnfalloc(sizeof(MgaSave)); smga->pvp = xf86GetPciInfoForEntity(usedChips[i]); @@ -641,7 +638,7 @@ MGAProbe(DriverPtr drv, int flags) VgaIOSave, VgaIORestore,smga))) #endif { - + /* Fill in what we can of the ScrnInfoRec */ pScrn->driverVersion = MGA_VERSION; pScrn->driverName = MGA_DRIVER_NAME; @@ -657,7 +654,7 @@ MGAProbe(DriverPtr drv, int flags) pScrn->ValidMode = MGAValidMode; foundScreen = TRUE; } - + /* * For cards that can do dual head per entity, mark the entity * as sharable. @@ -691,7 +688,7 @@ MGAProbe(DriverPtr drv, int flags) } xfree(usedChips); - + return foundScreen; } @@ -716,13 +713,13 @@ MGAProbe(DriverPtr drv, int flags) * HISTORY * August 31, 1997 - [ajv] Andrew van der Stock * Fixed to understand Mystique and Millennium II - * + * * January 11, 1997 - [aem] Andrew E. Mileski * Set default values for GCLK (= MCLK / pre-scale ). * * October 7, 1996 - [aem] Andrew E. Mileski * Written and tested. - */ + */ static void MGAReadBios(ScrnInfoPtr pScrn) @@ -730,12 +727,12 @@ MGAReadBios(ScrnInfoPtr pScrn) CARD8 tmp[ 64 ]; CARD16 offset; CARD8 chksum; - CARD8 *pPINSInfo; + CARD8 *pPINSInfo; MGAPtr pMga; MGABiosInfo *pBios; MGABios2Info *pBios2; Bool pciBIOS = TRUE; - + pMga = MGAPTR(pScrn); pBios = &pMga->Bios; pBios2 = &pMga->Bios2; @@ -754,7 +751,7 @@ MGAReadBios(ScrnInfoPtr pScrn) (pciBIOS ? \ xf86ReadPciBIOS(offset, pMga->PciTag, pMga->FbBaseReg, buf, len) : \ xf86ReadBIOS(pMga->BiosAddress, offset, buf, len)) - + MGADoBIOSRead(0, tmp, sizeof( tmp )); if ( tmp[ 0 ] != 0x55 @@ -786,9 +783,9 @@ MGAReadBios(ScrnInfoPtr pScrn) ( CARD8 * ) & pBios2->PinID, sizeof( MGABios2Info )); } - + /* matrox millennium-2 and mystique pins info */ - if ( pBios2->PinID == 0x412e ) { + if ( pBios2->PinID == 0x412e ) { int i; /* check that the pins info is correct */ if ( pBios2->StructLen != 0x40 ) { @@ -879,8 +876,8 @@ MGASoftReset(ScrnInfoPtr pScrn) /* wait until drawing engine is ready */ while ( MGAISBUSY() ) usleep(1000); - - /* flush FIFO */ + + /* flush FIFO */ i = 32; WAITFIFO(i); while ( i-- ) @@ -893,7 +890,7 @@ MGASoftReset(ScrnInfoPtr pScrn) /* * MGACountRAM -- * - * Counts amount of installed RAM + * Counts amount of installed RAM */ static int MGACountRam(ScrnInfoPtr pScrn) @@ -906,7 +903,7 @@ MGACountRam(ScrnInfoPtr pScrn) #if 0 /* This isn't correct. It looks like this can have arbitrary data for the memconfig even when the bios has initialized - it. At least, my cards don't advertise the documented + it. At least, my cards don't advertise the documented values (my 8 and 16 Meg G200s have the same values) */ if(pMga->Primary) /* can only trust this for primary cards */ biosInfo = pciReadLong(pMga->PciTag, PCI_OPTION_REG); @@ -915,7 +912,7 @@ MGACountRam(ScrnInfoPtr pScrn) switch(pMga->Chipset) { case PCI_CHIP_MGA2164: case PCI_CHIP_MGA2164_AGP: - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to probe memory amount due to hardware bug. " "Assuming 4096 KB\n"); return 4096; @@ -925,12 +922,12 @@ MGACountRam(ScrnInfoPtr pScrn) case 0: return (biosInfo & (1 << 14)) ? 32768 : 16384; case 1: - case 2: + case 2: return 16384; - case 3: - case 5: + case 3: + case 5: return 65536; - case 4: + case 4: return 32768; } } @@ -964,11 +961,11 @@ MGACountRam(ScrnInfoPtr pScrn) volatile unsigned char* base; unsigned char tmp; int i; - + pMga->FbMapSize = ProbeSize * 1024; MGAMapMem(pScrn); base = pMga->FbBase; - + /* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */ OUTREG8(0x1FDE, 3); tmp = INREG8(0x1FDF); @@ -984,7 +981,7 @@ MGACountRam(ScrnInfoPtr pScrn) break; } } - + /* restore CRTCEXT3 state */ OUTREG8(0x1FDE, 3); OUTREG8(0x1FDF, tmp); @@ -1026,7 +1023,7 @@ MGAdoDDC(ScrnInfoPtr pScrn) xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "DDC1 disabled - chip not in VGA mode\n"); } - } + } /* Save the current state */ MGASave(pScrn); @@ -1080,7 +1077,7 @@ VgaIOSave(int i, void *arg) #ifdef DEBUG ErrorF("mga: VgaIOSave: %d:%d:%d\n", sMga->pvp->bus, sMga->pvp->device, - sMga->pvp->func); + sMga->pvp->func); #endif sMga->enable = (pciReadLong(tag, PCI_OPTION_REG) & 0x100) != 0; } @@ -1159,6 +1156,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) Bool digital = FALSE; Bool tv = FALSE; Bool swap_head = FALSE; + ULONG status; #endif /* @@ -1166,7 +1164,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) * not at the start of each server generation. This means that * only things that are persistent across server generations can * be initialised here. xf86Screens[] is (pScrn is a pointer to one - * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex() + * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex() * are too, and should be used for data that must persist across * server generations. * @@ -1186,7 +1184,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga = MGAPTR(pScrn); /* Set here until dri is enabled */ #ifdef XF86DRI - pMga->have_quiescense = 1; + pMga->haveQuiescense = 1; #endif /* Get the entity, and make sure it is PCI. */ pMga->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); @@ -1256,7 +1254,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86SetAccessFuncs(pMga->pEnt, &pMga->Access, &pMga->Access, &pMga->Access, NULL); #endif - + /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -1267,7 +1265,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) * unexpected behaviour when the config file marks the primary CRTC * as the second screen. */ - if(xf86IsEntityShared(pScrn->entityList[0]) && + if(xf86IsEntityShared(pScrn->entityList[0]) && xf86IsPrimInitDone(pScrn->entityList[0])) { /* This is the second crtc */ pMga->SecondCrtc = TRUE; @@ -1275,7 +1273,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pScrn->AdjustFrame = MGAAdjustFrameCrtc2; pMgaEnt->pScrn_2 = pScrn; #ifdef XF86DRI - pMga->GetQuiescence = mgaGetQuiescence_shared; + pMga->GetQuiescence = MGAGetQuiescenceShared; #endif } else { pMga->SecondCrtc = FALSE; @@ -1283,11 +1281,11 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (xf86IsEntityShared(pScrn->entityList[0])) { pMgaEnt->pScrn_1 = pScrn; #ifdef XF86DRI - pMga->GetQuiescence = mgaGetQuiescence_shared; + pMga->GetQuiescence = MGAGetQuiescenceShared; #endif } else { #ifdef XF86DRI - pMga->GetQuiescence = mgaGetQuiescence; + pMga->GetQuiescence = MGAGetQuiescence; #endif } } @@ -1373,6 +1371,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) /* Process the options */ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, MGAOptions); +#if !defined(__powerpc__) pMga->softbooted = FALSE; if (xf86ReturnOptValBool(MGAOptions, OPTION_INT10, FALSE) && xf86LoadSubModule(pScrn, "int10")) { @@ -1383,9 +1382,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (pInt) pMga->softbooted = TRUE; xf86FreeInt10(pInt); } +#endif /* Set the bits per RGB for 8bpp mode */ - if (pScrn->depth == 8) + if (pScrn->depth == 8) pScrn->rgbBits = 8; /* @@ -1444,60 +1444,23 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); - - if(xf86GetOptValInteger(MGAOptions, OPTION_XAALINES, - &(pMga->numXAALines))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Will Use %d lines for " - "offscreen memory if the DRI is enabled.\n", - pMga->numXAALines); - } else { - /* The default is to use 512 lines on a G400, 128 on a G200 */ - switch (pMga->Chipset) { - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - pMga->numXAALines = 128; - break; - default: - pMga->numXAALines = 512; - break; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offscreen memory usage " - "will be limited to %d lines if the DRI is enabled.\n", - pMga->numXAALines); - } - #ifdef XF86DRI - { - Bool temp; - - from = X_DEFAULT; - - pMga->agp_mode = 1; - if (xf86GetOptValBool(MGAOptions, OPTION_AGP_MODE_2X, - &temp)) { - pMga->agp_mode = 2; - from = X_CONFIG; - } - - if (xf86GetOptValBool(MGAOptions, OPTION_AGP_MODE_4X, - &temp)) { - pMga->agp_mode = 4; - from = X_CONFIG; - } - xf86DrvMsg(pScrn->scrnIndex, from, "Using AGP Mode %dx\n", - pMga->agp_mode); - - pMga->ReallyUseIrqZero = 0; - - if (xf86GetOptValBool(MGAOptions, OPTION_USEIRQZERO, - &temp)) { - pMga->ReallyUseIrqZero = 1; - from = X_CONFIG; - xf86DrvMsg(pScrn->scrnIndex, from, "Enabling use of IRQ " - "Zero (Dangerous)\n"); - } + from = X_DEFAULT; + pMga->agpMode = MGA_DEFAULT_AGP_MODE; + if (xf86GetOptValInteger(MGAOptions, + OPTION_AGP_MODE, &(pMga->agpMode))) { + if (pMga->agpMode < 1) { + pMga->agpMode = 1; + } + if (pMga->agpMode > MGA_MAX_AGP_MODE) { + pMga->agpMode = MGA_MAX_AGP_MODE; + } + from = X_CONFIG; } + + xf86DrvMsg(pScrn->scrnIndex, from, "Using AGP %dx mode\n", + pMga->agpMode); #endif from = X_DEFAULT; @@ -1552,38 +1515,38 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if(!xf86GetOptValInteger( MGAOptions, OPTION_COLOR_KEY,&(pMga->colorKey))) pMga->colorKey = TRANSPARENCY_KEY; - pScrn->colorKey = pMga->colorKey; + pScrn->colorKey = pMga->colorKey; pScrn->overlayFlags = OVERLAY_8_32_PLANAR; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PseudoColor overlay enabled\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option \"Overlay\" is only supported in 32 bits per pixel on" "the first CRTC\n"); } } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid value for Option \"Overlay\"\n", s); } } - + if(xf86GetOptValInteger(MGAOptions, OPTION_VIDEO_KEY, &(pMga->videoKey))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", pMga->videoKey); } else { - pMga->videoKey = (1 << pScrn->offset.red) | + pMga->videoKey = (1 << pScrn->offset.red) | (1 << pScrn->offset.green) | - (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); } if (xf86ReturnOptValBool(MGAOptions, OPTION_SHADOW_FB, FALSE)) { pMga->ShadowFB = TRUE; pMga->NoAccel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\" - acceleration disabled\n"); } if (xf86ReturnOptValBool(MGAOptions, OPTION_FBDEV, FALSE)) { pMga->FBDev = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using framebuffer device\n"); } if (xf86ReturnOptValBool(MGAOptions, OPTION_OVERCLOCK_MEM, FALSE)) { @@ -1613,7 +1576,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->NoAccel = TRUE; pMga->HWCursor = FALSE; pMga->Rotate = 1; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen clockwise - acceleration disabled\n"); } else if(!xf86NameCmp(s, "CCW")) { @@ -1621,12 +1584,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->NoAccel = TRUE; pMga->HWCursor = FALSE; pMga->Rotate = -1; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen counter clockwise - acceleration disabled\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid value for Option \"Rotate\"\n", s); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid options are \"CW\" or \"CCW\"\n"); } } @@ -1684,6 +1647,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", (unsigned long)pMga->FbAddress); +#if !defined(__powerpc__) if (pMga->device->IOBase != 0) { /* Require that the config file value matches one of the PCI values. */ if (!xf86CheckPciMemBase(pMga->PciInfo, pMga->device->IOBase)) { @@ -1709,21 +1673,25 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } } +#else + pMga->IOAddress = pMga->PciInfo->memBase[0]; +#endif xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pMga->IOAddress); - + pMga->ILOADAddress = 0; if ( pMga->Chipset != PCI_CHIP_MGA2064 ) { if (pMga->PciInfo->memBase[2] != 0) { pMga->ILOADAddress = pMga->PciInfo->memBase[2] & 0xffffc000; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Pseudo-DMA transfer window at 0x%lX\n", (unsigned long)pMga->ILOADAddress); - } + } } +#if !defined(__powerpc__) /* * Find the BIOS base. Get it from the PCI config if possible. Otherwise * use the VGA default. Allow the config file to override this. @@ -1762,8 +1730,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) MGAReadBios(pScrn); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "MGABios.RamdacType = 0x%x\n", pMga->Bios.RamdacType); +#endif /* !__powerpc__ */ /* HW bpp matches reported bpp */ pMga->HwBpp = pScrn->bitsPerPixel; @@ -1794,7 +1763,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if(pMga->SecondCrtc == FALSE) { Bool UseHalf = FALSE; int adjust; - + xf86GetOptValBool(MGAOptions, OPTION_CRTC2HALF, &UseHalf); adjust = pScrn->videoRam / 2; @@ -1802,7 +1771,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Crtc2 will use %dK of VideoRam\n", adjust); - } else { + } else { adjust = min(adjust, 8192); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Crtc2 will use %dK of VideoRam\n", @@ -1812,9 +1781,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pScrn->videoRam = pMgaEnt->mastervideoRam; pMgaEnt->slavevideoRam = adjust; pMgaEnt->masterFbAddress = pMga->FbAddress; - pMga->FbMapSize = + pMga->FbMapSize = pMgaEnt->masterFbMapSize = pScrn->videoRam * 1024; - pMgaEnt->slaveFbAddress = pMga->FbAddress + + pMgaEnt->slaveFbAddress = pMga->FbAddress + pMgaEnt->masterFbMapSize; pMgaEnt->slaveFbMapSize = pMgaEnt->slavevideoRam * 1024; pMga->realSrcOrg = pMga->SrcOrg = 0; @@ -1823,8 +1792,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->FbAddress = pMgaEnt->slaveFbAddress; pMga->FbMapSize = pMgaEnt->slaveFbMapSize; pScrn->videoRam = pMgaEnt->slavevideoRam; - pMga->DstOrg = pMga->realSrcOrg = - pMgaEnt->slaveFbAddress - pMgaEnt->masterFbAddress; + pMga->DstOrg = pMga->realSrcOrg = + pMgaEnt->slaveFbAddress - pMgaEnt->masterFbAddress; pMga->SrcOrg = 0; /* This is not stored in hw format!! */ } pMgaEnt->refCount++; @@ -1844,7 +1813,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", pScrn->videoRam); - + /* Set the bpp shift value */ pMga->BppShifts[0] = 0; pMga->BppShifts[1] = 1; @@ -1857,6 +1826,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) */ (*pMga->PreInit)(pScrn); +#if !defined(__powerpc__) /* Load DDC if we have the code to use it */ /* This gives us DDC1 */ if (pMga->ddc1Read || pMga->i2cInit) { @@ -1870,7 +1840,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->i2cInit = NULL; } } -#if MGAuseI2C +#if MGAuseI2C /* - DDC can use I2C bus */ /* Load I2C if we have the code to use it */ if (pMga->i2cInit) { @@ -1886,6 +1856,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) /* Read and print the Monitor DDC info */ pScrn->monitor->DDC = MGAdoDDC(pScrn); +#endif /* !__powerpc__ */ /* * If the driver can do gamma correction, it should call xf86SetGamma() @@ -1968,7 +1939,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) clockRanges->ClockMulFactor = 1; clockRanges->ClockDivFactor = 1; - + /* Only set MemClk if appropriate for the ramdac */ if (pMga->Dac.SetMemClk) { if (pMga->MemClk == 0) { @@ -1987,15 +1958,15 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) * care of this, we don't worry about setting them here. */ { - int Pitches1[] = + int Pitches1[] = {640, 768, 800, 960, 1024, 1152, 1280, 1600, 1920, 2048, 0}; - int Pitches2[] = - {512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664, + int Pitches2[] = + {512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664, 1920, 2048, 0}; int *linePitches = NULL; int minPitch = 256; - int maxPitch = 2048; - + int maxPitch = 2048; + switch(pMga->Chipset) { case PCI_CHIP_MGA2064: if (!pMga->NoAccel) { @@ -2027,7 +1998,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, linePitches, minPitch, maxPitch, - pMga->Roundings[(pScrn->bitsPerPixel >> 3) - 1] * + pMga->Roundings[(pScrn->bitsPerPixel >> 3) - 1] * pScrn->bitsPerPixel, 128, 2048, pScrn->display->virtualX, pScrn->display->virtualY, @@ -2068,9 +2039,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->pClientStruct = (LPCLIENTDATA) xalloc (sizeof(CLIENTDATA)); pMga->pClientStruct->pMga = (MGAPtr) pMga; - MGAMapMem(pScrn); + MGAMapMem(pScrn); MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA)); - MGAUnmapMem(pScrn); + MGAUnmapMem(pScrn); pMga->pMgaHwInfo = (LPMGAHWINFO) xalloc (sizeof(MGAHWINFO)); MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo); @@ -2082,7 +2053,8 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } if (!swap_head) { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1; + mgaModeInfo.flOutput = (digital == TRUE) ? MGAMODEINFO_DIGITAL2 + : MGAMODEINFO_ANALOG1; } else { mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2; } @@ -2090,7 +2062,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) mgaModeInfo.ulDispHeight = pScrn->virtualY; mgaModeInfo.ulDeskWidth = pScrn->virtualX; mgaModeInfo.ulDeskHeight = pScrn->virtualY; - mgaModeInfo.ulBpp = pScrn->bitsPerPixel; + mgaModeInfo.ulBpp = pScrn->bitsPerPixel; mgaModeInfo.ulZoom = 1; } else { /* Second CRTC && entity is shared */ if (digital == TRUE) { @@ -2112,15 +2084,15 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) mgaModeInfo.ulDispHeight = pScrn->virtualY; mgaModeInfo.ulDeskWidth = pScrn->virtualX; mgaModeInfo.ulDeskHeight = pScrn->virtualY; - mgaModeInfo.ulBpp = pScrn->bitsPerPixel; + mgaModeInfo.ulBpp = pScrn->bitsPerPixel; mgaModeInfo.ulZoom = 1; pMga->pBoard = pMgaEnt->pBoard; pMga->pClientStruct = pMgaEnt->pClientStruct; pMga->pMgaHwInfo = pMga->pMgaHwInfo; } - if(MGAValidateMode(pMga->pBoard,&mgaModeInfo) != 0) { + if((status = MGAValidateMode(pMga->pBoard,&mgaModeInfo)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "MGAValidateMode from HALlib found the mode to be invalid\n"); + "MGAValidateMode from HALlib found the mode to be invalid: 0x%lx\n", status); return FALSE; } pScrn->displayWidth = mgaModeInfo.ulFBPitch; @@ -2134,9 +2106,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) (pMga->PciInfo->subsysCard == PCI_CARD_PROD_G100_SD)) { pMga->HasSDRAM = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Has SDRAM\n"); - } - /* - * Can we trust HALlib to set the memory configuration + } + /* + * Can we trust HALlib to set the memory configuration * registers correctly? */ else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) && @@ -2182,10 +2154,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) */ pMga->YDstOrg = 0; - if (((pMga->Chipset == PCI_CHIP_MGA2064) || + if (((pMga->Chipset == PCI_CHIP_MGA2064) || (pMga->Chipset == PCI_CHIP_MGA2164) || (pMga->Chipset == PCI_CHIP_MGA2164_AGP)) && - (pScrn->virtualX * pScrn->virtualY * bytesPerPixel > 4*1024*1024)) + (pScrn->virtualX * pScrn->virtualY * bytesPerPixel > 4*1024*1024)) { int offset, offset_modulo, ydstorg_modulo; @@ -2226,12 +2198,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->FbUsableSize = pMgaEnt->masterFbMapSize; /* Allocate HW cursor buffer at the end of video ram */ if( pMga->HWCursor && pMga->Dac.CursorOffscreenMemSize ) { - if( pScrn->virtualY * pScrn->displayWidth * + if( pScrn->virtualY * pScrn->displayWidth * pScrn->bitsPerPixel / 8 <= pMga->FbUsableSize - pMga->Dac.CursorOffscreenMemSize ) { pMga->FbUsableSize -= pMga->Dac.CursorOffscreenMemSize; pMga->FbCursorOffset = - pMgaEnt->masterFbMapSize - + pMgaEnt->masterFbMapSize - pMga->Dac.CursorOffscreenMemSize; } else { pMga->HWCursor = FALSE; @@ -2248,7 +2220,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->FbUsableSize = pMga->FbMapSize - pMga->YDstOrg * bytesPerPixel; /* Allocate HW cursor buffer at the end of video ram */ if( pMga->HWCursor && pMga->Dac.CursorOffscreenMemSize ) { - if( pScrn->virtualY * pScrn->displayWidth * + if( pScrn->virtualY * pScrn->displayWidth * pScrn->bitsPerPixel / 8 <= pMga->FbUsableSize - pMga->Dac.CursorOffscreenMemSize ) { pMga->FbUsableSize -= pMga->Dac.CursorOffscreenMemSize; @@ -2333,7 +2305,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if(pMgaEnt->refCount == 2) { /* Both boards have done there initialization */ MGACloseLibrary(pMga->pBoard); - + if (pMga->pBoard) xfree(pMga->pBoard); if (pMga->pClientStruct) @@ -2346,7 +2318,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } } else { MGACloseLibrary(pMga->pBoard); - + if (pMga->pBoard) xfree(pMga->pBoard); if (pMga->pClientStruct) @@ -2377,7 +2349,7 @@ MGAMapMem(ScrnInfoPtr pScrn) /* * Map IO registers to virtual address space - */ + */ /* * For Alpha, we need to map SPARSE memory, since we need * byte/short access. This is taken care of automatically by the @@ -2411,7 +2383,7 @@ MGAMapMem(ScrnInfoPtr pScrn) if (pMga->ILOADAddress) { pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO | VIDMEM_MMIO_32BIT | - VIDMEM_READSIDEEFFECT, + VIDMEM_READSIDEEFFECT, pMga->PciTag, pMga->ILOADAddress, 0x800000); } else pMga->ILOADBase = NULL; @@ -2441,7 +2413,7 @@ MGAMapMemFBDev(ScrnInfoPtr pScrn) /* Map the ILOAD transfer window if there is one. We only make DWORD access on DWORD boundaries to this window */ if(pMga->ILOADAddress) - pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, + pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pMga->PciTag, pMga->ILOADAddress, 0x800000); else pMga->ILOADBase = NULL; #endif @@ -2463,7 +2435,7 @@ MGAUnmapMem(ScrnInfoPtr pScrn) /* * Unmap IO registers to virtual address space - */ + */ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000); pMga->IOBase = NULL; @@ -2511,6 +2483,10 @@ MGASave(ScrnInfoPtr pScrn) MGA_HAL(if (pMga->pBoard != NULL) MGASaveVgaState(pMga->pBoard)); #endif + /* I need to save the registers for the second head also */ + /* Save the register for 0x80 to 0xa0 */ + /* Could call it dac2Saved */ + /* Only save text mode fonts/text for the primary card */ (*pMga->Save)(pScrn, vgaReg, mgaReg, pMga->Primary); } @@ -2529,7 +2505,7 @@ static void FillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode) pMga->pMgaModeInfo->ulDeskWidth = pScrn->virtualX; pMga->pMgaModeInfo->ulDeskHeight = pScrn->virtualY; pMga->pMgaModeInfo->ulFBPitch = 0; - pMga->pMgaModeInfo->ulBpp = pScrn->bitsPerPixel; + pMga->pMgaModeInfo->ulBpp = pScrn->bitsPerPixel; pMga->pMgaModeInfo->ulZoom = 1; pMga->pMgaModeInfo->flSignalMode = 0x10; @@ -2651,8 +2627,9 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) } } else { if (!swap_head) { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG1 | - MGAMODEINFO_FORCE_PITCH; + pMga->pMgaModeInfo->flOutput = + ((digital == TRUE) ? MGAMODEINFO_DIGITAL2 : MGAMODEINFO_ANALOG1) | + MGAMODEINFO_FORCE_PITCH; } else { pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 | MGAMODEINFO_FORCE_PITCH; @@ -2690,9 +2667,6 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) } ); /* MGA_HAL */ -#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) -#define outMGAdac(reg, val) (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) - MGA_HAL( if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) { outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW, pMga->FbCursorOffset >> 10); @@ -2714,7 +2688,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) } pMga->CurrentLayout.mode = mode; - + #ifdef XF86DRI if (pMga->directRenderingEnabled) DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); @@ -2726,7 +2700,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* * Restore the initial (text) mode. */ -static void +static void MGARestore(ScrnInfoPtr pScrn) { vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -2771,7 +2745,7 @@ MGACrtc2FillStrip(ScrnInfoPtr pScrn) } else { xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex); pMga->RestoreAccelState(pScrn); - pMga->SetupForSolidFill(pScrn, 0, GXcopy, 0x00000000); + pMga->SetupForSolidFill(pScrn, 0, GXcopy, 0xFFFFFFFF); pMga->SubsequentSolidFillRect(pScrn, pScrn->virtualX, 0, pScrn->displayWidth - pScrn->virtualX, pScrn->virtualY); @@ -2798,7 +2772,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) MGAEntPtr pMgaEnt = NULL; int f; - /* + /* * First get the ScrnInfoRec */ pScrn = xf86Screens[pScreen->myNum]; @@ -2806,7 +2780,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) hwp = VGAHWPTR(pScrn); pMga = MGAPTR(pScrn); MGAdac = &pMga->Dac; - + /* Map the MGA memory and MMIO areas */ if (pMga->FBDev) { if (!MGAMapMemFBDev(pScrn)) @@ -2838,10 +2812,13 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Detecting for type of display */ if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_TV) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV detected\n"); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "TV detected\n"); + } + if (pMga->pMgaHwInfo->ulCapsFirstOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Digital Screen detected\n"); } if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Digital Screen detected\n"); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Digital Screen detected\n"); } /* Now copy these to the entitystructure */ @@ -2993,14 +2970,14 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * The DRI does not work when textured video is enabled at this time. */ - if (!pMga->NoAccel && pMga->TexturedVideo != TRUE && + if (!pMga->NoAccel && pMga->TexturedVideo != TRUE && pMga->SecondCrtc == FALSE) pMga->directRenderingEnabled = MGADRIScreenInit(pScreen); else pMga->directRenderingEnabled = FALSE; #endif - - + + if (pMga->Overlay8Plus24) { ret = cfb8_32ScreenInit(pScreen, FBStart, width, height, @@ -3048,15 +3025,15 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); - /* Initialize software cursor. + /* Initialize software cursor. Must precede creation of the default colormap */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - /* Initialize HW cursor layer. + /* Initialize HW cursor layer. Must follow software cursor initialization*/ - if (pMga->HWCursor) { + if (pMga->HWCursor) { if(!MGAHWCursorInit(pScreen)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor initialization failed\n"); } @@ -3064,13 +3041,13 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!miCreateDefColormap(pScreen)) return FALSE; - /* Initialize colormap layer. + /* Initialize colormap layer. Must follow initialization of the default colormap */ if (!pMga->SecondCrtc) f = CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH; else f = CMAP_RELOAD_ON_MODE_SWITCH; - if(!xf86HandleColormaps(pScreen, 256, 8, + if(!xf86HandleColormaps(pScreen, 256, 8, (pMga->FBDev ? fbdevHWLoadPalette : MGAdac->LoadPalette), NULL, f)) return FALSE; @@ -3087,7 +3064,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pMga->PointerMoved = pScrn->PointerMoved; pScrn->PointerMoved = MGAPointerMoved; } - + switch(pScrn->bitsPerPixel) { case 8: refreshArea = MGARefreshArea8; break; case 16: refreshArea = MGARefreshArea16; break; @@ -3112,26 +3089,22 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) MGAInitVideo(pScreen); #ifdef XF86DRI - /* Initialize the Warp engine */ - if (pMga->directRenderingEnabled) { - pMga->directRenderingEnabled = mgaConfigureWarp(pScrn); - } if (pMga->directRenderingEnabled) { - /* Now that mi, cfb, drm and others have done their thing, + /* Now that mi, cfb, drm and others have done their thing, * complete the DRI setup. */ pMga->directRenderingEnabled = MGADRIFinishScreenInit(pScreen); } if (pMga->directRenderingEnabled) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n"); } if (xf86IsEntityShared(pScrn->entityList[0]) && pMga->SecondCrtc == FALSE) pMgaEnt->directRenderingEnabled = pMga->directRenderingEnabled; - pMga->have_quiescense = 1; + pMga->haveQuiescense = 1; #endif - + /* Wrap the current CloseScreen function */ pMga->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = MGACloseScreen; @@ -3144,6 +3117,9 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* For the second head, work around display problem. */ if (pMga->SecondCrtc) { MGACrtc2FillStrip(pScrn); + } else { + /* shut second head */ + outMGAdac(0xa0,0x08); } /* Done */ @@ -3164,7 +3140,7 @@ MGASwitchMode(int scrnIndex, DisplayModePtr mode, int flags) * displayed location in the video memory. */ /* Usually mandatory */ -void +void MGAAdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn; @@ -3191,11 +3167,11 @@ MGAAdjustFrame(int scrnIndex, int x, int y, int flags) /* find start of retrace */ while (INREG8(0x1FDA) & 0x08); - while (!(INREG8(0x1FDA) & 0x08)); + while (!(INREG8(0x1FDA) & 0x08)); /* wait until we're past the start (fixseg.c in the DDK) */ count = INREG(MGAREG_VCOUNT) + 2; while(INREG(MGAREG_VCOUNT) < count); - + OUTREG16(MGAREG_CRTC_INDEX, (Base & 0x00FF00) | 0x0C); OUTREG16(MGAREG_CRTC_INDEX, ((Base & 0x0000FF) << 8) | 0x0D); OUTREG8(MGAREG_CRTCEXT_INDEX, 0x00); @@ -3225,7 +3201,7 @@ MGAAdjustFrameCrtc2(int scrnIndex, int x, int y, int flags) * 3-93 c2startadd0 * 3-96 c2vcount */ - + Base = (y * pLayout->displayWidth + x) * pLayout->bitsPerPixel >> 3; Base += pMga->DstOrg; Base &= 0x01ffffc0; @@ -3245,7 +3221,7 @@ MGAEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; MGAPtr pMga; -#ifdef XF86DRI +#ifdef XF86DRI ScreenPtr pScreen; #endif @@ -3257,7 +3233,11 @@ MGAEnterVT(int scrnIndex, int flags) DRIUnlock(pScreen); } #endif - + + if (!pMga->SecondCrtc) { + outMGAdac(0xa0,0x08); + } + if (!MGAModeInit(pScrn, pScrn->currentMode)) return FALSE; MGAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -3274,12 +3254,12 @@ static Bool MGAEnterVTFBDev(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; -#ifdef XF86DRI +#ifdef XF86DRI ScreenPtr pScreen; - MGAPtr pMGA; + MGAPtr pMga; - pMGA = MGAPTR(pScrn); - if (pMGA->directRenderingEnabled) { + pMga = MGAPTR(pScrn); + if (pMga->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRIUnlock(pScreen); } @@ -3303,24 +3283,26 @@ MGALeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); #ifdef XF86DRI ScreenPtr pScreen; - MGAPtr pMGA; #endif + /* Close second Crtc */ + outMGAdac(0xa0, 0x08); + MGARestore(pScrn); vgaHWLock(hwp); if (xf86IsPc98()) outb(0xfac, 0x00); #ifdef XF86DRI - pMGA = MGAPTR(pScrn); - if (pMGA->directRenderingEnabled) { + if (pMga->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRILock(pScreen, 0); } #endif - + } @@ -3339,7 +3321,9 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen) vgaHWPtr hwp = VGAHWPTR(pScrn); MGAPtr pMga = MGAPTR(pScrn); MGAEntPtr pMgaEnt = NULL; - + + MGA_NOT_HAL(outMGAdac(0xa0, 0x08)); + if (pScrn->vtSema) { if (pMga->FBDev) { fbdevHWRestore(pScrn); @@ -3351,7 +3335,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen) vgaHWUnmapMem(pScrn); } } -#ifdef XF86DRI +#ifdef XF86DRI if (pMga->directRenderingEnabled) { MGADRICloseScreen(pScreen); pMga->directRenderingEnabled=FALSE; @@ -3371,7 +3355,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen) if(pMgaEnt->refCount == 0) { /* Both boards have closed there screen */ MGACloseLibrary(pMga->pBoard); - + if (pMga->pBoard) xfree(pMga->pBoard); if (pMga->pClientStruct) @@ -3383,7 +3367,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen) } } else { MGACloseLibrary(pMga->pBoard); - + if (pMga->pBoard) xfree(pMga->pBoard); if (pMga->pClientStruct) @@ -3392,7 +3376,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen) xfree(pMga->pMgaModeInfo); if (pMga->pMgaHwInfo) xfree(pMga->pMgaHwInfo); - } + } ); /* MGA_HAL */ #endif @@ -3455,8 +3439,8 @@ MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) lace = 1 + ((mode->Flags & V_INTERLACE) != 0); if ((mode->CrtcHDisplay <= 2048) && - (mode->CrtcHSyncStart <= 4096) && - (mode->CrtcHSyncEnd <= 4096) && + (mode->CrtcHSyncStart <= 4096) && + (mode->CrtcHSyncEnd <= 4096) && (mode->CrtcHTotal <= 4096) && (mode->CrtcVDisplay <= 2048 * lace) && (mode->CrtcVSyncStart <= 4096 * lace) && @@ -3492,24 +3476,24 @@ MGASaveScreenCrtc2(ScreenPtr pScreen, int mode) MGAPtr pMga = NULL; Bool on; CARD32 tmp; - + on = xf86IsUnblank(mode); - + if (on) SetTimeSinceLastInputEvent(); if (pScreen != NULL) pScrn = xf86Screens[pScreen->myNum]; - + if (pScrn != NULL) pMga = MGAPTR(pScrn); - + if(pMga != NULL && pScrn->vtSema) { tmp = INREG(MGAREG_C2CTL); tmp &= ~0x00000008; if (!on) tmp |= 0x0000008; OUTREG(MGAREG_C2CTL, tmp); } - + return TRUE; } @@ -3576,7 +3560,7 @@ MGABlockHandler ( ScrnInfoPtr pScrn = xf86Screens[i]; MGAPtr pMga = MGAPTR(pScrn); - if(pMga->PaletteLoadCallback) + if(pMga->PaletteLoadCallback) (*pMga->PaletteLoadCallback)(pScrn); pScreen->BlockHandler = pMga->BlockHandler; @@ -3588,7 +3572,7 @@ MGABlockHandler ( (*pMga->VideoTimerCallback)(pScrn, currentTime.milliseconds); } - if(pMga->RenderCallback) + if(pMga->RenderCallback) (*pMga->RenderCallback)(pScrn); } @@ -3679,7 +3663,7 @@ dbg_outreg32(ScrnInfoPtr pScrn,int addr,int val) MGAPtr pMga; CARD32 ret; - if (((addr & 0xff00) == 0x1c00) + if (((addr & 0xff00) == 0x1c00) && (addr != 0x1c04) /* && (addr != 0x1c1c) */ && (addr != 0x1c20) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c index 943c71b77..64b81bdde 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.1 2001/02/13 19:19:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.2 2001/04/05 17:42:32 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -15,17 +15,10 @@ #include "mga_reg.h" #include "mga.h" -#define DEBUG - #define MNP_TABLE_SIZE 64 #define CLKSEL_MGA 0x0c #define PLLLOCK 0x40 -#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) - -#define outMGAdac(reg, val) \ - (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) - static CARD32 G450ApplyPFactor(ScrnInfoPtr pScrn, CARD8 ucP, CARD32 *pulFIn) { if(!(ucP & 0x40)) @@ -143,7 +136,10 @@ static CARD32 G450FindNextPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout, *pulPLLMNP |= (CARD32)ucM << 16; *pulPLLMNP |= (CARD32)ucN << 8; *pulPLLMNP |= (CARD32)ucP; - } +#ifdef DEBUG + ErrorF("FINS_S: VCO = %d, S = %02X, *pulPLLMNP = %08X\n", ulVCO, (ULONG)ucS, *pulPLLMNP); +#endif + } return TRUE; } @@ -196,12 +192,19 @@ static CARD32 G450FindFirstPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout, static CARD32 G450WriteMNP(ScrnInfoPtr pScrn, CARD32 ulMNP) { MGAPtr pMga = MGAPTR(pScrn); - - /* Pixel Pll */ - outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16)); - outMGAdac(MGA1064_PIX_PLLC_N, (CARD8)(ulMNP >> 8)); - outMGAdac(MGA1064_PIX_PLLC_P, (CARD8) ulMNP); - OUTREG8(0x3c00, 0x4f); + MGARegPtr pReg; + + pReg = &pMga->ModeReg; + + if (!pMga->SecondCrtc) { + outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16)); + outMGAdac(MGA1064_PIX_PLLC_N, (CARD8)(ulMNP >> 8)); + outMGAdac(MGA1064_PIX_PLLC_P, (CARD8) ulMNP); + } else { + outMGAdac(MGA1064_VID_PLL_M, (CARD8)(ulMNP >> 16)); + outMGAdac(MGA1064_VID_PLL_N, (CARD8)(ulMNP >> 8)); + outMGAdac(MGA1064_VID_PLL_P, (CARD8) ulMNP); + } return TRUE; } @@ -256,7 +259,10 @@ static CARD32 G450IsPllLocked(ScrnInfoPtr pScrn, Bool *lpbLocked) MGAPtr pMga = MGAPTR(pScrn); /* Pixel PLL */ - OUTREG8(0x3c00, 0x4f); + if (!pMga->SecondCrtc) + OUTREG8(0x3c00, 0x4f); + else + OUTREG8(0x3c00, 0x8f); ulFallBackCounter = 0; @@ -290,7 +296,6 @@ double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out) Bool bFoundValidPLL; Bool bLocked; CARD8 ucMisc; - CARD8 ucS; CARD32 ulMaxIndex; CARD32 ulMNP; CARD32 ulMNPTable[MNP_TABLE_SIZE]; @@ -359,10 +364,10 @@ double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out) { ulTryMNP = ulMNPTable[ulIndex]; - for(ucS = 0; !bFoundValidPLL && (ucS < 0x40); ucS += 8) +/* for(ucS = 0; !bFoundValidPLL && (ucS < 0x40); ucS += 8)*/ { - ulTryMNP &= 0xffffffc7; - ulTryMNP |= (CARD32)ucS; +/* ulTryMNP &= 0xffffffc7;*/ +/* ulTryMNP |= (CARD32)ucS;*/ bLocked = TRUE; if((ulMNPTable[ulIndex] & 0xff00) < 0x300 || diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h index 85c9b92d6..f8907bc6b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.19 2001/02/13 19:19:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.20 2001/03/21 17:02:24 dawes Exp $ */ #ifndef _MGA_MACROS_H_ #define _MGA_MACROS_H_ @@ -83,7 +83,7 @@ while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \ #ifdef XF86DRI #define CHECK_DMA_QUIESCENT(pMGA, pScrn) { \ - if (!pMGA->have_quiescense) { \ + if (!pMGA->haveQuiescense) { \ pMGA->GetQuiescence( pScrn ); \ } \ } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h index ba0d8fabc..c0689c334 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h @@ -2,7 +2,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.14 2000/11/08 05:03:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.16 2001/04/05 17:42:33 dawes Exp $ */ @@ -22,7 +22,7 @@ * g.desbief@aix.pacwan.net * MGA1064SG Mystique register file */ - + #ifndef _MGA_REG_H_ #define _MGA_REG_H_ @@ -170,7 +170,7 @@ /* z drawing mode. use MGADWG_NOZCMP for always */ #define MGADWG_NOZCMP ( 0x00 << 8 ) -#define MGADWG_ZE ( 0x02 << 8 ) +#define MGADWG_ZE ( 0x02 << 8 ) #define MGADWG_ZNE ( 0x03 << 8 ) #define MGADWG_ZLT ( 0x04 << 8 ) #define MGADWG_ZLTE ( 0x05 << 8 ) @@ -219,7 +219,7 @@ #define MGAREG_MISC_CLK_SEL_MGA_MSK (0x3 << 2) #define MGAREG_MISC_VIDEO_DIS (0x1 << 4) #define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5) - + /* MMIO VGA registers */ #define MGAREG_CRTC_INDEX 0x1fd4 #define MGAREG_CRTC_DATA 0x1fd5 @@ -387,6 +387,44 @@ #define MGA1064_PIX_PLL_STAT 0x4f +/*Added for G450 dual head*/ +/* Supported PLL*/ +#define __PIXEL_PLL 1 +#define __SYSTEM_PLL 2 +#define __VIDEO_PLL 3 + +#define MGA1064_VID_PLL_P 0x8D +#define MGA1064_VID_PLL_M 0x8E +#define MGA1064_VID_PLL_N 0x8F + +#define MGA1064_DISP_CTL 0x8a +#define MGA1064_SYNC_CTL 0x8b +#define MGA1064_PWR_CTL 0xa0 +/* Using crtc2 */ +#define MGAREG2_C2CTL 0x10 +#define MGAREG2_C2HPARAM 0x14 +#define MGAREG2_C2HSYNC 0x18 +#define MGAREG2_C2VPARAM 0x1c +#define MGAREG2_C2VSYNC 0x20 +#define MGAREG2_C2STARTADD0 0x28 + +#define MGAREG2_C2OFFSET 0x40 +#define MGAREG2_C2DATACTL 0x4c + +#define MGAREG_C2CTL 0x3c10 +#define MGAREG_C2HPARAM 0x3c14 +#define MGAREG_C2HSYNC 0x3c18 +#define MGAREG_C2VPARAM 0x3c1c +#define MGAREG_C2VSYNC 0x3c20 +#define MGAREG_C2STARTADD0 0x3c28 + +#define MGAREG_C2OFFSET 0x3c40 +#define MGAREG_C2DATACTL 0x3c4c + +#define MGA1064_DISP_CTL 0x8a +#define MGA1064_SYNC_CTL 0x8b +#define MGA1064_PWR_CTL 0xa0 + /* video register */ #define MGAREG_BESA1C3ORG 0x3d60 @@ -431,9 +469,8 @@ #define MGAREG_ALPHACTRL 0x2c7c #define MGAREG_DWGSYNC 0x2c4c -#define MGAREG_AGP_PLL 0x1e4c -#define AGP_PLL_agp2xpllen_enable 0x1 -#define AGP_PLL_agp2xpllen_disable 0x0 +#define MGAREG_AGP_PLL 0x1e4c +#define MGA_AGP2XPLL_ENABLE 0x1 +#define MGA_AGP2XPLL_DISABLE 0x0 #endif - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h new file mode 100644 index 000000000..616dee587 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h @@ -0,0 +1,222 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h,v 1.1 2001/03/21 17:11:47 dawes Exp $ */ + +/* + * Copyright 2000 Gareth Hughes + * 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 + * GARETH HUGHES 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_SAREA_H__ +#define __MGA_SAREA_H__ + +/* WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (mga_drm.h) + */ +#ifndef __MGA_SAREA_DEFINES__ +#define __MGA_SAREA_DEFINES__ + +/* WARP pipe flags + */ +#define MGA_F 0x1 /* fog */ +#define MGA_A 0x2 /* alpha */ +#define MGA_S 0x4 /* specular */ +#define MGA_T2 0x8 /* multitexture */ + +#define MGA_WARP_TGZ 0 +#define MGA_WARP_TGZF (MGA_F) +#define MGA_WARP_TGZA (MGA_A) +#define MGA_WARP_TGZAF (MGA_F|MGA_A) +#define MGA_WARP_TGZS (MGA_S) +#define MGA_WARP_TGZSF (MGA_S|MGA_F) +#define MGA_WARP_TGZSA (MGA_S|MGA_A) +#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) +#define MGA_WARP_T2GZ (MGA_T2) +#define MGA_WARP_T2GZF (MGA_T2|MGA_F) +#define MGA_WARP_T2GZA (MGA_T2|MGA_A) +#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) +#define MGA_WARP_T2GZS (MGA_T2|MGA_S) +#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) +#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) +#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) + +#define MGA_MAX_G200_PIPES 8 /* no multitex */ +#define MGA_MAX_G400_PIPES 16 +#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES +#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ + +#define MGA_CARD_TYPE_G200 1 +#define MGA_CARD_TYPE_G400 2 + + +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 + +/* What needs to be changed for the current vertex dma buffer? + */ +#define MGA_UPLOAD_CONTEXT 0x1 +#define MGA_UPLOAD_TEX0 0x2 +#define MGA_UPLOAD_TEX1 0x4 +#define MGA_UPLOAD_PIPE 0x8 +#define MGA_UPLOAD_TEX0IMAGE 0x10 +#define MGA_UPLOAD_TEX1IMAGE 0x20 +#define MGA_UPLOAD_2D 0x40 +#define MGA_WAIT_AGE 0x80 /* handled client-side */ +#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ +#if 0 +#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock + quiescent */ +#endif + +/* 32 buffers of 64k each, total 1 meg. + */ +#define MGA_BUFFER_SIZE (1 << 16) +#define MGA_NUM_BUFFERS 128 + +/* Keep these small for testing. + */ +#define MGA_NR_SAREA_CLIPRECTS 8 + +/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 + * regions, subject to a minimum region size of (1<<16) == 64k. + * + * Clients may subdivide regions internally, but when sharing between + * clients, the region size is the minimum granularity. + */ + +#define MGA_CARD_HEAP 0 +#define MGA_AGP_HEAP 1 +#define MGA_NR_TEX_HEAPS 2 +#define MGA_NR_TEX_REGIONS 16 +#define MGA_LOG_MIN_TEX_REGION_SIZE 16 + +#endif /* __MGA_SAREA_DEFINES__ */ + + +/* Setup registers for 3D context + */ +typedef struct { + unsigned int dstorg; + unsigned int maccess; + unsigned int plnwt; + unsigned int dwgctl; + unsigned int alphactrl; + unsigned int fogcolor; + unsigned int wflag; + unsigned int tdualstage0; + unsigned int tdualstage1; + unsigned int fcol; + unsigned int stencil; + unsigned int stencilctl; +} mga_context_regs_t; + +/* Setup registers for 2D, X server + */ +typedef struct { + unsigned int pitch; +} mga_server_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int texctl; + unsigned int texctl2; + unsigned int texfilter; + unsigned int texbordercol; + unsigned int texorg; + unsigned int texwidth; + unsigned int texheight; + unsigned int texorg1; + unsigned int texorg2; + unsigned int texorg3; + unsigned int texorg4; +} mga_texture_regs_t; + +/* General ageing mechanism + */ +typedef struct { + unsigned int head; /* Position of head pointer */ + unsigned int wrap; /* Primary DMA wrap count */ +} mga_age_t; + + +/* WARNING: Do not change the SAREA structure without changing the kernel + * as well. + */ +typedef struct { + /* The channel for communication of state information to the kernel + * on firing a vertex dma buffer. + */ + mga_context_regs_t ContextState; + mga_server_regs_t ServerState; + mga_texture_regs_t TexState[2]; + unsigned int WarpPipe; + unsigned int dirty; + unsigned int vertsize; + + /* The current cliprects, or a subset thereof. + */ + XF86DRIClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Information about the most recently used 3d drawable. The + * client fills in the req_* fields, the server fills in the + * exported_ fields and puts the cliprects into boxes, above. + * + * The client clears the exported_drawable field before + * clobbering the boxes data. + */ + unsigned int req_drawable; /* the X drawable id */ + unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ + + unsigned int exported_drawable; + unsigned int exported_index; + unsigned int exported_stamp; + unsigned int exported_buffers; + unsigned int exported_nfront; /* FIXME: verify signedness... */ + unsigned int exported_nback; + int exported_back_x, exported_front_x, exported_w; + int exported_back_y, exported_front_y, exported_h; + XF86DRIClipRectRec exported_boxes[MGA_NR_SAREA_CLIPRECTS]; + + /* Counters for aging textures and for client-side throttling. + */ + unsigned int status[4]; + unsigned int last_wrap; + + mga_age_t last_frame; + unsigned int last_enqueue; /* last time a buffer was enqueued */ + unsigned int last_dispatch; /* age of the most recently dispatched buffer */ + unsigned int last_quiescent; /* */ + + /* LRU lists for texture memory in agp space and on the card. + */ + drmTextureRegion texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; + unsigned int texAge[MGA_NR_TEX_HEAPS]; + + /* Last context that uploaded statel + */ + int ctxOwner; +} MGASAREAPrivRec, *MGASAREAPrivPtr; + +#endif 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 0dc9b145a..4b8b34158 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.84 2001/02/16 15:39:35 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.87 2001/04/05 21:29:15 dawes Exp $ */ /* All drivers should typically include these */ @@ -61,7 +61,7 @@ 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, +static void MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR); static void MGANAME(SubsequentSolidHorVertLine) (ScrnInfoPtr pScrn, @@ -78,8 +78,8 @@ static void MGANAME(SubsequentMono8x8PatternFillRect_Additional)( ScrnInfoPtr pScrn, int patx, int paty, int x, int y, int w, int h ); static void MGANAME(SubsequentMono8x8PatternFillTrap)( ScrnInfoPtr pScrn, - int patx, int paty, int y, int h, - int left, int dxL, int dyL, int eL, + 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(SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop, unsigned int planemask, @@ -89,7 +89,7 @@ static void MGANAME(SubsequentScanlineImageWriteRect)(ScrnInfoPtr pScrn, static void MGANAME(SubsequentImageWriteScanline)(ScrnInfoPtr pScrn, int num); #if PSZ != 24 static void MGANAME(SetupForPlanarScreenToScreenColorExpandFill)( - ScrnInfoPtr pScrn, int fg, int bg, int rop, + ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); static void MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, @@ -97,16 +97,16 @@ static void MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( int srcx, int srcy, int skipleft); #endif static void MGANAME(SetupForScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int fg, int bg, int rop, + int fg, int bg, int rop, unsigned int planemask); static void MGANAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int skipleft); -static void MGANAME(SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, +static void MGANAME(SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int length, unsigned char *pattern); static void MGANAME(SubsequentDashedTwoPointLine)(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, + int x1, int y1, int x2, int y2, int flags, int phase); void MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn); #if PSZ == 8 @@ -116,7 +116,7 @@ void Mga32RestoreAccelState(ScrnInfoPtr pScrn); #endif #ifdef XF86DRI -void MGANAME(DRIInitBuffers)(WindowPtr pWin, +void MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index); void MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); @@ -126,14 +126,14 @@ void MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, extern void MGASetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2); extern void MGADisableClipping(ScrnInfoPtr pScrn); -extern void MGAFillSolidRectsDMA(ScrnInfoPtr pScrn, int fg, int rop, +extern void MGAFillSolidRectsDMA(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask, int nBox, BoxPtr pBox); -extern void MGAFillSolidSpansDMA(ScrnInfoPtr pScrn, int fg, int rop, +extern void MGAFillSolidSpansDMA(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask, int n, DDXPointPtr ppt, int *pwidth, int fSorted); extern void MGAFillMono8x8PatternRectsTwoPass(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int nBox, - BoxPtr pBox, int pattern0, int pattern1, + BoxPtr pBox, int pattern0, int pattern1, int xorigin, int yorigin); extern void MGAValidatePolyArc(GCPtr, unsigned long, DrawablePtr); extern void MGAValidatePolyPoint(GCPtr, unsigned long, DrawablePtr); @@ -142,7 +142,7 @@ extern void MGAFillCacheBltRects(ScrnInfoPtr, int, unsigned int, int, BoxPtr, #ifdef RENDER -extern Bool +extern Bool MGASetupForCPUToScreenAlphaTexture ( ScrnInfoPtr pScrn, int op, @@ -158,7 +158,7 @@ MGASetupForCPUToScreenAlphaTexture ( int flags ); -extern Bool +extern Bool MGASetupForCPUToScreenAlphaTextureFaked ( ScrnInfoPtr pScrn, int op, @@ -175,7 +175,7 @@ MGASetupForCPUToScreenAlphaTextureFaked ( ); -extern Bool +extern Bool MGASetupForCPUToScreenTexture ( ScrnInfoPtr pScrn, int op, @@ -187,7 +187,7 @@ MGASetupForCPUToScreenTexture ( int flags ); -extern void +extern void MGASubsequentCPUToScreenTexture ( ScrnInfoPtr pScrn, int dstx, @@ -208,7 +208,7 @@ extern CARD32 MGATextureFormats[2]; CARD32 MGAAlphaTextureFormats[2] = {PICT_a8, 0}; CARD32 MGATextureFormats[2] = {PICT_a8r8g8b8, 0}; -static void +static void RemoveLinear (FBLinearPtr linear) { MGAPtr pMga = (MGAPtr)(linear->devPrivate.ptr); @@ -243,19 +243,19 @@ AllocateLinear ( pMga->RenderCallback = RenderCallback; if(pMga->LinearScratch) { - if(pMga->LinearScratch->size >= sizeNeeded) + if(pMga->LinearScratch->size >= sizeNeeded) return TRUE; else { if(xf86ResizeOffscreenLinear(pMga->LinearScratch, sizeNeeded)) return TRUE; - + xf86FreeOffscreenLinear(pMga->LinearScratch); pMga->LinearScratch = NULL; } } pMga->LinearScratch = xf86AllocateOffscreenLinear( - pScrn->pScreen, sizeNeeded, 32, + pScrn->pScreen, sizeNeeded, 32, NULL, RemoveLinear, pMga); return (pMga->LinearScratch != NULL); @@ -264,15 +264,15 @@ AllocateLinear ( static int GetPowerOfTwo(int w) { - int Pof2; + int Pof2 = 0; int i = 12; while(--i) { if(w & (1 << i)) { Pof2 = i; - if(w & ((1 << i) - 1)) + if(w & ((1 << i) - 1)) Pof2++; - break; + break; } } return Pof2; @@ -281,7 +281,7 @@ GetPowerOfTwo(int w) static int tex_padw, tex_padh; -Bool +Bool MGASetupForCPUToScreenAlphaTextureFaked ( ScrnInfoPtr pScrn, int op, @@ -318,7 +318,7 @@ MGASetupForCPUToScreenAlphaTextureFaked ( pitch = (width + 15) & ~15; sizeNeeded = pitch * height; - if(pScrn->bitsPerPixel == 16) + if(pScrn->bitsPerPixel == 16) sizeNeeded <<= 1; if(!AllocateLinear(pScrn, sizeNeeded)) @@ -328,12 +328,12 @@ MGASetupForCPUToScreenAlphaTextureFaked ( if(pScrn->bitsPerPixel == 32) offset <<= 1; - if(pMga->AccelInfoRec->NeedToSync) + if(pMga->AccelInfoRec->NeedToSync) MGAStormSync(pScrn); XAA_888_plus_PICT_a8_to_8888( - (blue >> 8) | (green & 0xff00) | ((red & 0xff00) << 8), - alphaPtr, alphaPitch, (CARD32*)(pMga->FbStart + offset), + (blue >> 8) | (green & 0xff00) | ((red & 0xff00) << 8), + alphaPtr, alphaPitch, (CARD32*)(pMga->FbStart + offset), pitch, width, height); tex_padw = 1 << log2w; @@ -344,24 +344,24 @@ MGASetupForCPUToScreenAlphaTextureFaked ( OUTREG(MGAREG_TMR1, 0); /* sy inc */ OUTREG(MGAREG_TMR2, 0); /* tx inc */ OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */ - OUTREG(MGAREG_TMR4, 0x00000000); + OUTREG(MGAREG_TMR4, 0x00000000); OUTREG(MGAREG_TMR5, 0x00000000); OUTREG(MGAREG_TMR8, 0x00010000); - OUTREG(MGAREG_TEXORG, offset); - OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | + OUTREG(MGAREG_TEXORG, offset); + OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | ((width - 1) << 18)); - OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | + OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | ((height - 1) << 18)); OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9)); OUTREG(MGAREG_TEXCTL2, 0x00000014); - OUTREG(MGAREG_DWGCTL, 0x000c7076); + OUTREG(MGAREG_DWGCTL, 0x000c7076); OUTREG(MGAREG_TEXFILTER, 0x01e00020); OUTREG(MGAREG_ALPHACTRL, 0x00000154); return TRUE; } -Bool +Bool MGASetupForCPUToScreenAlphaTexture ( ScrnInfoPtr pScrn, int op, @@ -399,7 +399,7 @@ MGASetupForCPUToScreenAlphaTexture ( pitch = (width + 15) & ~15; sizeNeeded = (pitch * height) >> 1; - if(pScrn->bitsPerPixel == 32) + if(pScrn->bitsPerPixel == 32) sizeNeeded >>= 1; if(!AllocateLinear(pScrn, sizeNeeded)) @@ -409,7 +409,7 @@ MGASetupForCPUToScreenAlphaTexture ( if(pScrn->bitsPerPixel == 32) offset <<= 1; - if(pMga->AccelInfoRec->NeedToSync) + if(pMga->AccelInfoRec->NeedToSync) MGAStormSync(pScrn); i = height; @@ -423,7 +423,7 @@ MGASetupForCPUToScreenAlphaTexture ( tex_padw = 1 << log2w; tex_padh = 1 << log2h; - + WAITFIFO(12); OUTREG(MGAREG_DR4, red << 7); /* red start */ OUTREG(MGAREG_DR6, 0); @@ -435,25 +435,25 @@ MGASetupForCPUToScreenAlphaTexture ( OUTREG(MGAREG_DR14, 0); OUTREG(MGAREG_DR15, 0); OUTREG(MGAREG_ALPHASTART, alpha << 7); /* alpha start */ - OUTREG(MGAREG_ALPHAXINC, 0); - OUTREG(MGAREG_ALPHAYINC, 0); + OUTREG(MGAREG_ALPHAXINC, 0); + OUTREG(MGAREG_ALPHAYINC, 0); WAITFIFO(15); OUTREG(MGAREG_TMR0, (1 << 20) / tex_padw); /* sx inc */ OUTREG(MGAREG_TMR1, 0); /* sy inc */ OUTREG(MGAREG_TMR2, 0); /* tx inc */ OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */ - OUTREG(MGAREG_TMR4, 0x00000000); + OUTREG(MGAREG_TMR4, 0x00000000); OUTREG(MGAREG_TMR5, 0x00000000); OUTREG(MGAREG_TMR8, 0x00010000); - OUTREG(MGAREG_TEXORG, offset); - OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | + OUTREG(MGAREG_TEXORG, offset); + OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | ((width - 1) << 18)); - OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | + OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | ((height - 1) << 18)); OUTREG(MGAREG_TEXCTL, 0x3A000107 | ((pitch & 0x07FF) << 9)); OUTREG(MGAREG_TEXCTL2, 0x00000014); - OUTREG(MGAREG_DWGCTL, 0x000c7076); + OUTREG(MGAREG_DWGCTL, 0x000c7076); OUTREG(MGAREG_TEXFILTER, 0x01e00020); OUTREG(MGAREG_ALPHACTRL, 0x02000151); @@ -461,7 +461,7 @@ MGASetupForCPUToScreenAlphaTexture ( } -Bool +Bool MGASetupForCPUToScreenTexture ( ScrnInfoPtr pScrn, int op, @@ -494,7 +494,7 @@ MGASetupForCPUToScreenTexture ( pitch = (width + 15) & ~15; sizeNeeded = pitch * height; - if(pScrn->bitsPerPixel == 16) + if(pScrn->bitsPerPixel == 16) sizeNeeded <<= 1; if(!AllocateLinear(pScrn, sizeNeeded)) @@ -504,7 +504,7 @@ MGASetupForCPUToScreenTexture ( if(pScrn->bitsPerPixel == 32) offset <<= 1; - if(pMga->AccelInfoRec->NeedToSync) + if(pMga->AccelInfoRec->NeedToSync) MGAStormSync(pScrn); { @@ -525,23 +525,23 @@ MGASetupForCPUToScreenTexture ( OUTREG(MGAREG_TMR1, 0); /* sy inc */ OUTREG(MGAREG_TMR2, 0); /* tx inc */ OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */ - OUTREG(MGAREG_TMR4, 0x00000000); + OUTREG(MGAREG_TMR4, 0x00000000); OUTREG(MGAREG_TMR5, 0x00000000); OUTREG(MGAREG_TMR8, 0x00010000); - OUTREG(MGAREG_TEXORG, offset); - OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | + OUTREG(MGAREG_TEXORG, offset); + OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | ((width - 1) << 18)); - OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | + OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | ((height - 1) << 18)); OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9)); OUTREG(MGAREG_TEXCTL2, 0x00000014); - OUTREG(MGAREG_DWGCTL, 0x000c7076); + OUTREG(MGAREG_DWGCTL, 0x000c7076); OUTREG(MGAREG_TEXFILTER, 0x01e00020); OUTREG(MGAREG_ALPHACTRL, 0x00000151); return TRUE; } -void +void MGASubsequentCPUToScreenTexture ( ScrnInfoPtr pScrn, int dstx, @@ -567,7 +567,7 @@ MGASubsequentCPUToScreenTexture ( #endif Bool -MGANAME(AccelInit)(ScreenPtr pScreen) +MGANAME(AccelInit)(ScreenPtr pScreen) { XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -578,7 +578,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen) pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * PSZ) + 127) >> 3); if(!pMga->ScratchBuffer) return FALSE; - + pMga->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -593,7 +593,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen) case PCI_CHIP_MGA2164_AGP: pMga->AccelFlags = BLK_OPAQUE_EXPANSION | TRANSC_SOLID_FILL | - USE_RECTS_FOR_LINES; + USE_RECTS_FOR_LINES; break; case PCI_CHIP_MGAG400: if(pMga->SecondCrtc == TRUE) { @@ -638,7 +638,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen) } /* fill out infoPtr here */ - infoPtr->Flags = PIXMAP_CACHE | + infoPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER | MICROSOFT_ZERO_LINE_BIAS; @@ -666,7 +666,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen) infoPtr->SetupForSolidLine = infoPtr->SetupForSolidFill; infoPtr->SubsequentSolidHorVertLine = MGANAME(SubsequentSolidHorVertLine); - infoPtr->SubsequentSolidTwoPointLine = + infoPtr->SubsequentSolidTwoPointLine = MGANAME(SubsequentSolidTwoPointLine); /* clipping */ @@ -675,15 +675,16 @@ MGANAME(AccelInit)(ScreenPtr pScreen) infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE | HARDWARE_CLIP_DASHED_LINE | HARDWARE_CLIP_SOLID_FILL | - HARDWARE_CLIP_MONO_8x8_FILL; + HARDWARE_CLIP_MONO_8x8_FILL; +#if X_BYTE_ORDER == X_LITTLE_ENDIAN /* dashed lines */ infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; infoPtr->SetupForDashedLine = MGANAME(SetupForDashedLine); - infoPtr->SubsequentDashedTwoPointLine = + infoPtr->SubsequentDashedTwoPointLine = MGANAME(SubsequentDashedTwoPointLine); infoPtr->DashPatternMaxLength = 128; - +#endif /* 8x8 mono patterns */ infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_BITS | @@ -691,16 +692,20 @@ MGANAME(AccelInit)(ScreenPtr pScreen) HARDWARE_PATTERN_SCREEN_ORIGIN | BIT_ORDER_IN_BYTE_MSBFIRST; infoPtr->SetupForMono8x8PatternFill = MGANAME(SetupForMono8x8PatternFill); - infoPtr->SubsequentMono8x8PatternFillRect = + infoPtr->SubsequentMono8x8PatternFillRect = MGANAME(SubsequentMono8x8PatternFillRect); - infoPtr->SubsequentMono8x8PatternFillTrap = + infoPtr->SubsequentMono8x8PatternFillTrap = MGANAME(SubsequentMono8x8PatternFillTrap); /* cpu to screen color expansion */ - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | +#if X_BYTE_ORDER == X_BIG_ENDIAN + BIT_ORDER_IN_BYTE_MSBFIRST | +#else BIT_ORDER_IN_BYTE_LSBFIRST | +#endif LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X; @@ -719,23 +724,23 @@ MGANAME(AccelInit)(ScreenPtr pScreen) MGANAME(SubsequentScanlineCPUToScreenColorExpandFill); infoPtr->SubsequentColorExpandScanline = MGANAME(SubsequentColorExpandScanline); - infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->NumScanlineColorExpandBuffers = 1; infoPtr->ScanlineColorExpandBuffers = &(pMga->ColorExpandBase); /* screen to screen color expansion */ if(pMga->AccelFlags & USE_LINEAR_EXPANSION) { - infoPtr->ScreenToScreenColorExpandFillFlags = + infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->SetupForScreenToScreenColorExpandFill = + infoPtr->SetupForScreenToScreenColorExpandFill = MGANAME(SetupForScreenToScreenColorExpandFill); - infoPtr->SubsequentScreenToScreenColorExpandFill = + infoPtr->SubsequentScreenToScreenColorExpandFill = MGANAME(SubsequentScreenToScreenColorExpandFill); } else { #if PSZ != 24 /* Alternate (but slower) planar expansions */ - infoPtr->SetupForScreenToScreenColorExpandFill = + infoPtr->SetupForScreenToScreenColorExpandFill = MGANAME(SetupForPlanarScreenToScreenColorExpandFill); - infoPtr->SubsequentScreenToScreenColorExpandFill = + infoPtr->SubsequentScreenToScreenColorExpandFill = MGANAME(SubsequentPlanarScreenToScreenColorExpandFill); infoPtr->CacheColorExpandDensity = PSZ; infoPtr->CacheMonoStipple = XAACachePlanarMonoStipple; @@ -753,15 +758,15 @@ MGANAME(AccelInit)(ScreenPtr pScreen) NO_TRANSPARENCY | NO_GXCOPY; - infoPtr->SetupForScanlineImageWrite = + infoPtr->SetupForScanlineImageWrite = MGANAME(SetupForScanlineImageWrite); - infoPtr->SubsequentScanlineImageWriteRect = + infoPtr->SubsequentScanlineImageWriteRect = MGANAME(SubsequentScanlineImageWriteRect); - infoPtr->SubsequentImageWriteScanline = + infoPtr->SubsequentImageWriteScanline = MGANAME(SubsequentImageWriteScanline); - infoPtr->NumScanlineImageWriteBuffers = 1; + infoPtr->NumScanlineImageWriteBuffers = 1; infoPtr->ScanlineImageWriteBuffers = &(pMga->ScratchBuffer); - + /* midrange replacements */ @@ -772,13 +777,13 @@ MGANAME(AccelInit)(ScreenPtr pScreen) if(pMga->AccelFlags & TWO_PASS_COLOR_EXPAND) { if(infoPtr->SetupForMono8x8PatternFill) - infoPtr->FillMono8x8PatternRects = + infoPtr->FillMono8x8PatternRects = MGAFillMono8x8PatternRectsTwoPass; } if(infoPtr->SetupForSolidFill) { infoPtr->ValidatePolyArc = MGAValidatePolyArc; - infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask | + infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask | GCLineStyle | GCFillStyle; infoPtr->ValidatePolyPoint = MGAValidatePolyPoint; infoPtr->PolyPointMask = GCFunction | GCPlaneMask; @@ -790,7 +795,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen) infoPtr->SolidFillFlags |= NO_PLANEMASK; infoPtr->SolidLineFlags |= NO_PLANEMASK; infoPtr->DashedLineFlags |= NO_PLANEMASK; - infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK; + infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK; infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->FillSolidRectsFlags |= NO_PLANEMASK; infoPtr->FillSolidSpansFlags |= NO_PLANEMASK; @@ -798,45 +803,138 @@ MGANAME(AccelInit)(ScreenPtr pScreen) infoPtr->FillCacheBltRectsFlags |= NO_PLANEMASK; } - + maxFastBlitMem = (pMga->Interleave ? 4096 : 2048) * 1024; if(pMga->FbMapSize > maxFastBlitMem) { pMga->MaxFastBlitY = maxFastBlitMem / (pScrn->displayWidth * PSZ / 8); } - maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) / + maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) / (pScrn->displayWidth * PSZ / 8); + #ifdef XF86DRI - if (pMga->directRenderingEnabled) { - if(maxlines > (pMga->numXAALines + pScrn->virtualY)) - maxlines = pMga->numXAALines + pScrn->virtualY; - - if(maxlines < (pMga->numXAALines + pScrn->virtualY)) - pMga->numXAALines = maxlines - pScrn->virtualY; - - /* not like the 3D will even work when there's not - even enough memory for a tiny pixmap cache */ - } - + if ( pMga->directRenderingEnabled ) { + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + BoxRec MemBox; + int cpp = pScrn->bitsPerPixel / 8; + int width_bytes = pScrn->displayWidth * cpp; + int bufferSize = ((pScrn->virtualY * width_bytes + MGA_BUFFER_ALIGN) + & ~MGA_BUFFER_ALIGN); + int scanlines; + + pMGADRIServer->frontOffset = 0; + pMGADRIServer->frontPitch = width_bytes; + + /* Try for front, back, depth, and two framebuffers worth of + * pixmap cache. Should be enough for a fullscreen background + * image plus some leftovers. + */ + pMGADRIServer->textureSize = pMga->FbMapSize - 5 * bufferSize; + + /* If that gives us less than half the available memory, let's + * be greedy and grab some more. Sorry, I care more about 3D + * performance than playing nicely, and you'll get around a full + * framebuffer's worth of pixmap cache anyway. + */ + if ( pMGADRIServer->textureSize < (int)pMga->FbMapSize / 2 ) { + pMGADRIServer->textureSize = pMga->FbMapSize - 4 * bufferSize; + } + + /* Check to see if there is more room available after the maximum + * scanline for textures. + */ + if ( (int)pMga->FbMapSize - maxlines * width_bytes - bufferSize * 2 + > pMGADRIServer->textureSize ) { + pMGADRIServer->textureSize = (pMga->FbMapSize - + maxlines * width_bytes - + bufferSize * 2); + } + + /* Set a minimum usable local texture heap size. This will fit + * two 256x256x32bpp textures. + */ + if ( pMGADRIServer->textureSize < 512 * 1024 ) { + pMGADRIServer->textureOffset = 0; + pMGADRIServer->textureSize = 0; + } + + /* Reserve space for textures */ + pMGADRIServer->textureOffset = (pMga->FbMapSize - + pMGADRIServer->textureSize + + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN; + + /* Reserve space for the shared depth buffer */ + pMGADRIServer->depthOffset = (pMGADRIServer->textureOffset - + bufferSize + + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN; + pMGADRIServer->depthPitch = width_bytes; + + /* Reserve space for the shared back buffer */ + pMGADRIServer->backOffset = (pMGADRIServer->depthOffset - bufferSize + + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN; + pMGADRIServer->backPitch = width_bytes; + + scanlines = pMGADRIServer->backOffset / width_bytes - 1; + if ( scanlines > maxlines ) scanlines = maxlines; + + MemBox.x1 = 0; + MemBox.y1 = 0; + MemBox.x2 = pScrn->displayWidth; + MemBox.y2 = scanlines; + + if ( !xf86InitFBManager( pScreen, &MemBox ) ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2 ); + return FALSE; + } else { + int width, height; + + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2 ); + + if ( xf86QueryLargestOffscreenArea( pScreen, &width, + &height, 0, 0, 0 ) ) { + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Largest offscreen area available: %d x %d\n", + width, height ); + } + } + + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Reserved back buffer at offset 0x%x\n", + pMGADRIServer->backOffset ); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Reserved depth buffer at offset 0x%x\n", + pMGADRIServer->depthOffset ); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Reserved %d kb for textures at offset 0x%x\n", + pMGADRIServer->textureSize/1024, + pMGADRIServer->textureOffset ); + } + else #endif + { + AvailFBArea.x1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y1 = 0; + AvailFBArea.y2 = maxlines; + + /* + * Need to keep a strip of memory to the right of screen to workaround + * a display problem with the second CRTC. + */ + if (pMga->SecondCrtc) + AvailFBArea.x2 = pScrn->virtualX; + + xf86InitFBManager(pScreen, &AvailFBArea); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d lines for offscreen " + "memory.\n", + maxlines - pScrn->virtualY); - AvailFBArea.x1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y1 = 0; - AvailFBArea.y2 = maxlines; - - /* - * Need to keep a strip of memory to the right of screen to workaround - * a display problem with the second CRTC. - */ - if (pMga->SecondCrtc) - AvailFBArea.x2 = pScrn->virtualX; - - xf86InitFBManager(pScreen, &AvailFBArea); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d lines for offscreen " - "memory.\n", - maxlines - pScrn->virtualY); + } { Bool shared_accel = FALSE; @@ -855,15 +953,15 @@ MGANAME(AccelInit)(ScreenPtr pScreen) { if(pMga->Chipset == PCI_CHIP_MGAG400) { infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE; - infoPtr->SetupForCPUToScreenAlphaTexture = + infoPtr->SetupForCPUToScreenAlphaTexture = MGASetupForCPUToScreenAlphaTexture; } else { infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE | XAA_RENDER_NO_SRC_ALPHA; - infoPtr->SetupForCPUToScreenAlphaTexture = + infoPtr->SetupForCPUToScreenAlphaTexture = MGASetupForCPUToScreenAlphaTextureFaked; } - infoPtr->SubsequentCPUToScreenAlphaTexture = + infoPtr->SubsequentCPUToScreenAlphaTexture = MGASubsequentCPUToScreenTexture; infoPtr->CPUToScreenAlphaTextureFormats = MGAAlphaTextureFormats; @@ -885,7 +983,7 @@ MGANAME(InitSolidFillRectFuncs)(MGAPtr pMga) } /* Support for multiscreen */ -void +void MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); @@ -909,42 +1007,42 @@ MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn) SET_FOREGROUND(tmp); OUTREG(MGAREG_SRCORG, pMga->realSrcOrg); OUTREG(MGAREG_DSTORG, pMga->DstOrg); - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x10000); OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ + OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ pMga->AccelFlags &= ~CLIPPER_ON; } #if PSZ == 8 CARD32 MGAAtype[16] = { - MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, + MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, MGADWG_RSTR | 0x00040000, MGADWG_BLK | 0x000c0000, - MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000, + MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000, MGADWG_RSTR | 0x00060000, MGADWG_RSTR | 0x000e0000, - MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000, + MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000, MGADWG_RSTR | 0x00050000, MGADWG_RSTR | 0x000d0000, - MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000, + MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000, MGADWG_RSTR | 0x00070000, MGADWG_RPL | 0x000f0000 }; CARD32 MGAAtypeNoBLK[16] = { - MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, + MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, MGADWG_RSTR | 0x00040000, MGADWG_RPL | 0x000c0000, - MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000, + MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000, MGADWG_RSTR | 0x00060000, MGADWG_RSTR | 0x000e0000, - MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000, + MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000, MGADWG_RSTR | 0x00050000, MGADWG_RSTR | 0x000d0000, - MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000, + MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000, MGADWG_RSTR | 0x00070000, MGADWG_RPL | 0x000f0000 }; -Bool +Bool MGAStormAccelInit(ScreenPtr pScreen) -{ +{ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; switch( pScrn->bitsPerPixel ) @@ -964,34 +1062,37 @@ MGAStormAccelInit(ScreenPtr pScreen) void -MGAStormSync(ScrnInfoPtr pScrn) +MGAStormSync(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); CHECK_DMA_QUIESCENT(pMga, pScrn); - + while(MGAISBUSY()); /* flush cache before a read (mga-1064g 5.1.6) */ - OUTREG8(MGAREG_CRTC_INDEX, 0); + OUTREG8(MGAREG_CRTC_INDEX, 0); if(pMga->AccelFlags & CLIPPER_ON) { pMga->AccelFlags &= ~CLIPPER_ON; OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); } } -void +void MGAStormEngineInit(ScrnInfoPtr pScrn) { long maccess = 0; MGAPtr pMga = MGAPTR(pScrn); MGAFBLayout *pLayout = &pMga->CurrentLayout; + CARD32 opmode; CHECK_DMA_QUIESCENT(pMga, pScrn); - if ((pMga->Chipset == PCI_CHIP_MGAG100) + if ((pMga->Chipset == PCI_CHIP_MGAG100) || (pMga->Chipset == PCI_CHIP_MGAG100_PCI)) maccess = 1 << 14; - + + opmode = INREG(MGAREG_OPMODE); + switch( pLayout->bitsPerPixel ) { case 8: @@ -1003,19 +1104,22 @@ MGAStormEngineInit(ScrnInfoPtr pScrn) maccess |= (1 << 31); Mga16InitSolidFillRectFuncs(pMga); pMga->RestoreAccelState = Mga16RestoreAccelState; + opmode |= 10000; break; case 24: maccess |= 3; Mga24InitSolidFillRectFuncs(pMga); pMga->RestoreAccelState = Mga24RestoreAccelState; break; + opmode |= 20000; case 32: maccess |= 2; Mga32InitSolidFillRectFuncs(pMga); pMga->RestoreAccelState = Mga32RestoreAccelState; + opmode |= 20000; break; } - + pMga->fifoCount = 0; while(MGAISBUSY()); @@ -1041,12 +1145,12 @@ MGAStormEngineInit(ScrnInfoPtr pScrn) OUTREG(MGAREG_FCOL, pMga->FgColor); pMga->BgColor = 0; OUTREG(MGAREG_BCOL, pMga->BgColor); - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | opmode); /* put clipping in a known state */ - OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ - OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ + OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ + OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ + OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ pMga->AccelFlags &= ~CLIPPER_ON; switch(pMga->Chipset) { @@ -1072,9 +1176,9 @@ void MGASetClippingRectangle( CHECK_DMA_QUIESCENT(pMga, pScrn); WAITFIFO(3); - OUTREG(MGAREG_CXBNDRY,(x2 << 16) | x1); - OUTREG(MGAREG_YTOP, (y1 * pScrn->displayWidth) + pMga->YDstOrg); - OUTREG(MGAREG_YBOT, (y2 * pScrn->displayWidth) + pMga->YDstOrg); + OUTREG(MGAREG_CXBNDRY,(x2 << 16) | x1); + OUTREG(MGAREG_YTOP, (y1 * pScrn->displayWidth) + pMga->YDstOrg); + OUTREG(MGAREG_YBOT, (y2 * pScrn->displayWidth) + pMga->YDstOrg); pMga->AccelFlags |= CLIPPER_ON; } @@ -1085,9 +1189,9 @@ void MGADisableClipping(ScrnInfoPtr pScrn) CHECK_DMA_QUIESCENT(pMga, pScrn); WAITFIFO(3); - OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ - OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ + OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ + OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ + OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ pMga->AccelFlags &= ~CLIPPER_ON; } @@ -1101,40 +1205,40 @@ void MGADisableClipping(ScrnInfoPtr pScrn) #define BLIT_LEFT 1 #define BLIT_UP 4 -void +void MGANAME(SetupForScreenToScreenCopy)( ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, - int trans + int trans ){ MGAPtr pMga = MGAPTR(pScrn); - CARD32 dwgctl = pMga->AtypeNoBLK[rop] | MGADWG_SHIFTZERO | + CARD32 dwgctl = pMga->AtypeNoBLK[rop] | MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL; CHECK_DMA_QUIESCENT(pMga, pScrn); - pMga->AccelInfoRec->SubsequentScreenToScreenCopy = + pMga->AccelInfoRec->SubsequentScreenToScreenCopy = MGANAME(SubsequentScreenToScreenCopy); pMga->BltScanDirection = 0; if(ydir == -1) pMga->BltScanDirection |= BLIT_UP; if(xdir == -1) pMga->BltScanDirection |= BLIT_LEFT; - else if(pMga->HasFBitBlt && (rop == GXcopy) && !pMga->DrawTransparent) - pMga->AccelInfoRec->SubsequentScreenToScreenCopy = + else if(pMga->HasFBitBlt && (rop == GXcopy) && !pMga->DrawTransparent) + pMga->AccelInfoRec->SubsequentScreenToScreenCopy = MGANAME(SubsequentScreenToScreenCopy_FastBlit); - if(pMga->DrawTransparent) { + if(pMga->DrawTransparent) { dwgctl |= MGADWG_TRANSC; WAITFIFO(2); SET_FOREGROUND(trans); trans = ~0; SET_BACKGROUND(trans); - } + } - WAITFIFO(4); + WAITFIFO(4); OUTREG(MGAREG_DWGCTL, dwgctl); OUTREG(MGAREG_SGN, pMga->BltScanDirection); SET_PLANEMASK(planemask); @@ -1142,7 +1246,7 @@ MGANAME(SetupForScreenToScreenCopy)( } -static void +static void MGANAME(SubsequentScreenToScreenCopy)( ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h @@ -1165,10 +1269,10 @@ MGANAME(SubsequentScreenToScreenCopy)( start = end = XYADDRESS(srcX, srcY); if(pMga->BltScanDirection & BLIT_LEFT) start += w; - else end += w; + else end += w; if (pMga->AccelFlags & LARGE_ADDRESSES) { - WAITFIFO(7); + WAITFIFO(7); if(DstOrg) OUTREG(MGAREG_DSTORG, (DstOrg << 6) + pMga->DstOrg); if(SrcOrg != pMga->SrcOrg) { @@ -1187,7 +1291,7 @@ MGANAME(SubsequentScreenToScreenCopy)( if(DstOrg) OUTREG(MGAREG_DSTORG, pMga->DstOrg); } else { - WAITFIFO(4); + WAITFIFO(4); OUTREG(MGAREG_AR0, end); OUTREG(MGAREG_AR3, start); OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff)); @@ -1196,7 +1300,7 @@ MGANAME(SubsequentScreenToScreenCopy)( } -static void +static void MGANAME(SubsequentScreenToScreenCopy_FastBlit)( ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h @@ -1228,11 +1332,11 @@ MGANAME(SubsequentScreenToScreenCopy_FastBlit)( if(pMga->MaxFastBlitY) { if(pMga->BltScanDirection & BLIT_UP) { if((srcY >= pMga->MaxFastBlitY) || - (dstY >= pMga->MaxFastBlitY)) + (dstY >= pMga->MaxFastBlitY)) goto FASTBLIT_BAILOUT; } else { if(((srcY + h) > pMga->MaxFastBlitY) || - ((dstY + h) > pMga->MaxFastBlitY)) + ((dstY + h) > pMga->MaxFastBlitY)) goto FASTBLIT_BAILOUT; } } @@ -1247,7 +1351,7 @@ MGANAME(SubsequentScreenToScreenCopy_FastBlit)( if((dstX & (1 << 5)) && (((fxright >> 5) - (dstX >> 5)) & 7) == 7) { fxright |= 1 << 5; #elif PSZ == 24 - if(((dstX * 3) & (1 << 6)) && + if(((dstX * 3) & (1 << 6)) && ((((fxright * 3 + 2) >> 6) - ((dstX * 3) >> 6)) & 7) == 7) { fxright = ((fxright * 3 + 2) | (1 << 6)) / 3; #elif PSZ == 32 @@ -1261,39 +1365,39 @@ MGANAME(SubsequentScreenToScreenCopy_FastBlit)( OUTREG(MGAREG_AR3, start); OUTREG(MGAREG_FXBNDRY, (fxright << 16) | (dstX & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); - OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | + OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL); OUTREG(MGAREG_CXRIGHT, 0xFFFF); return; } /* } } } (preserve pairs for pair matching) */ } - - WAITFIFO(6); + + WAITFIFO(6); OUTREG(MGAREG_DWGCTL, 0x040A400C); OUTREG(MGAREG_AR0, end); OUTREG(MGAREG_AR3, start); OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); - OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | MGADWG_SHIFTZERO | + OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL); return; - } + } FASTBLIT_BAILOUT: - - WAITFIFO(4); + + WAITFIFO(4); OUTREG(MGAREG_AR0, end); OUTREG(MGAREG_AR3, start); OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); } - + /******************\ | Solid Fills | \******************/ -void +void MGANAME(SetupForSolidFill)( ScrnInfoPtr pScrn, int color, @@ -1306,28 +1410,28 @@ MGANAME(SetupForSolidFill)( #if PSZ == 24 if(!RGBEQUAL(color)) - pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | - MGADWG_SGNZERO | MGADWG_SHIFTZERO | + pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | + MGADWG_SGNZERO | MGADWG_SHIFTZERO | MGADWG_BMONOLEF | pMga->AtypeNoBLK[rop]; else #endif - pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | - MGADWG_SGNZERO | MGADWG_SHIFTZERO | + pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | + MGADWG_SGNZERO | MGADWG_SHIFTZERO | MGADWG_BMONOLEF | pMga->Atype[rop]; - pMga->SolidLineCMD = MGADWG_SOLID | MGADWG_SHIFTZERO | MGADWG_BFCOL | + pMga->SolidLineCMD = MGADWG_SOLID | MGADWG_SHIFTZERO | MGADWG_BFCOL | pMga->AtypeNoBLK[rop]; - if(pMga->AccelFlags & TRANSC_SOLID_FILL) + if(pMga->AccelFlags & TRANSC_SOLID_FILL) pMga->FilledRectCMD |= MGADWG_TRANSC; WAITFIFO(3); SET_FOREGROUND(color); SET_PLANEMASK(planemask); OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); -} +} -static void +static void MGANAME(SubsequentSolidFillRect)( ScrnInfoPtr pScrn, int x, int y, int w, int h ) @@ -1337,10 +1441,10 @@ MGANAME(SubsequentSolidFillRect)( WAITFIFO(2); OUTREG(MGAREG_FXBNDRY, ((x + w) << 16) | (x & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); -} +} -static void -MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, +static void +MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR ) { @@ -1351,7 +1455,7 @@ MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, int ar5 = sdxr? dxR : -dxR; WAITFIFO(11); - OUTREG(MGAREG_DWGCTL, + OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD & ~(MGADWG_ARZERO | MGADWG_SGNZERO)); OUTREG(MGAREG_AR0, dyL); OUTREG(MGAREG_AR1, ar2 - eL); @@ -1370,10 +1474,10 @@ MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, \***************/ -static void +static void MGANAME(SubsequentSolidHorVertLine) ( ScrnInfoPtr pScrn, - int x, int y, + int x, int y, int len, int dir ){ MGAPtr pMga = MGAPTR(pScrn); @@ -1391,12 +1495,12 @@ MGANAME(SubsequentSolidHorVertLine) ( OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD | MGADWG_AUTOLINE_OPEN); OUTREG(MGAREG_XYSTRT, (y << 16) | (x & 0xffff)); OUTREG(MGAREG_XYEND + MGAREG_EXEC, ((y + len) << 16) | (x & 0xffff)); - OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); + OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); } } -static void +static void MGANAME(SubsequentSolidTwoPointLine)( ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags @@ -1404,11 +1508,11 @@ MGANAME(SubsequentSolidTwoPointLine)( MGAPtr pMga = MGAPTR(pScrn); WAITFIFO(4); - OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD | + OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD | ((flags & OMIT_LAST) ? MGADWG_AUTOLINE_OPEN : MGADWG_AUTOLINE_CLOSE)); OUTREG(MGAREG_XYSTRT, (y1 << 16) | (x1 & 0xFFFF)); OUTREG(MGAREG_XYEND + MGAREG_EXEC, (y2 << 16) | (x2 & 0xFFFF)); - OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); + OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); } @@ -1418,7 +1522,7 @@ MGANAME(SubsequentSolidTwoPointLine)( \***************************/ -static void +static void MGANAME(SetupForMono8x8PatternFill)( ScrnInfoPtr pScrn, int patx, int paty, @@ -1431,12 +1535,12 @@ MGANAME(SetupForMono8x8PatternFill)( CHECK_DMA_QUIESCENT(pMga, pScrn); - pMga->PatternRectCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO | + pMga->PatternRectCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO | MGADWG_BMONOLEF; - infoRec->SubsequentMono8x8PatternFillRect = + infoRec->SubsequentMono8x8PatternFillRect = MGANAME(SubsequentMono8x8PatternFillRect); - + if(bg == -1) { #if PSZ == 24 if(!RGBEQUAL(fg)) @@ -1448,9 +1552,9 @@ MGANAME(SetupForMono8x8PatternFill)( WAITFIFO(5); } else { #if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && RGBEQUAL(fg) && RGBEQUAL(bg)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && RGBEQUAL(fg) && RGBEQUAL(bg)) #else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) + if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) #endif pMga->PatternRectCMD |= pMga->Atype[rop]; else @@ -1468,7 +1572,7 @@ MGANAME(SetupForMono8x8PatternFill)( -static void +static void MGANAME(SubsequentMono8x8PatternFillRect)( ScrnInfoPtr pScrn, int patx, int paty, @@ -1480,11 +1584,11 @@ MGANAME(SubsequentMono8x8PatternFillRect)( OUTREG(MGAREG_SHIFT, (paty << 4) | patx); OUTREG(MGAREG_FXBNDRY, ((x + w) << 16) | (x & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); - pMga->AccelInfoRec->SubsequentMono8x8PatternFillRect = + pMga->AccelInfoRec->SubsequentMono8x8PatternFillRect = MGANAME(SubsequentMono8x8PatternFillRect_Additional); } -static void +static void MGANAME(SubsequentMono8x8PatternFillRect_Additional)( ScrnInfoPtr pScrn, int patx, int paty, @@ -1498,12 +1602,12 @@ MGANAME(SubsequentMono8x8PatternFillRect_Additional)( } -static void +static void MGANAME(SubsequentMono8x8PatternFillTrap)( ScrnInfoPtr pScrn, - int patx, int paty, - int y, int h, - int left, int dxL, int dyL, int eL, + int patx, int paty, + int y, int h, + int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR ){ MGAPtr pMga = MGAPTR(pScrn); @@ -1515,7 +1619,7 @@ MGANAME(SubsequentMono8x8PatternFillTrap)( WAITFIFO(12); OUTREG(MGAREG_SHIFT, (paty << 4) | patx); - OUTREG(MGAREG_DWGCTL, + OUTREG(MGAREG_DWGCTL, pMga->PatternRectCMD & ~(MGADWG_ARZERO | MGADWG_SGNZERO)); OUTREG(MGAREG_AR0, dyL); OUTREG(MGAREG_AR1, ar2 - eL); @@ -1534,7 +1638,7 @@ MGANAME(SubsequentMono8x8PatternFillTrap)( \***********************/ -static void +static void MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( ScrnInfoPtr pScrn, int fg, int bg, @@ -1542,7 +1646,7 @@ MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( unsigned int planemask ) { MGAPtr pMga = MGAPTR(pScrn); - CARD32 mgaCMD = MGADWG_ILOAD | MGADWG_LINEAR | MGADWG_SGNZERO | + CARD32 mgaCMD = MGADWG_ILOAD | MGADWG_LINEAR | MGADWG_SGNZERO | MGADWG_SHIFTZERO | MGADWG_BMONOLEF; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -1558,10 +1662,10 @@ MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( WAITFIFO(3); } else { #if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && + RGBEQUAL(fg) && RGBEQUAL(bg)) #else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) + if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) #endif mgaCMD |= pMga->Atype[rop]; else @@ -1573,9 +1677,9 @@ MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( SET_FOREGROUND(fg); SET_PLANEMASK(planemask); OUTREG(MGAREG_DWGCTL, mgaCMD); -} +} -static void +static void MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( ScrnInfoPtr pScrn, int x, int y, int w, int h, @@ -1605,8 +1709,8 @@ MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( OUTREG(MGAREG_FXBNDRY, ((x + w - 1) << 16) | (x & 0xFFFF)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); -#ifdef __alpha__ - if(1) +#if defined(__alpha__) + if(1) /* force indirect always on Alpha */ #else if(pMga->expandDWORDs > pMga->FifoSize) #endif @@ -1632,14 +1736,14 @@ MGANAME(SubsequentColorExpandScanlineIndirect)( MGAPtr pMga = MGAPTR(pScrn); int dwords = pMga->expandDWORDs; CARD32 *src = (CARD32*)(pMga->ScratchBuffer); - + while(dwords > pMga->FifoSize) { WAITFIFO(pMga->FifoSize); MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); src += pMga->FifoSize; dwords -= pMga->FifoSize; } - + WAITFIFO(dwords); MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); @@ -1648,7 +1752,7 @@ MGANAME(SubsequentColorExpandScanlineIndirect)( 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) | + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) | pMga->expandHeight); pMga->expandY += pMga->expandHeight; pMga->expandRows = pMga->expandHeight; @@ -1672,7 +1776,7 @@ MGANAME(SubsequentColorExpandScanline)( 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) | + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) | pMga->expandHeight); pMga->expandY += pMga->expandHeight; pMga->expandRows = pMga->expandHeight; @@ -1689,7 +1793,7 @@ MGANAME(SubsequentColorExpandScanline)( \*******************/ -static void MGANAME(SetupForScanlineImageWrite)( +static void MGANAME(SetupForScanlineImageWrite)( ScrnInfoPtr pScrn, int rop, unsigned int planemask, @@ -1758,7 +1862,7 @@ static void MGANAME(SubsequentImageWriteScanline)( void MGANAME(SetupForDashedLine)( - ScrnInfoPtr pScrn, + ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int length, @@ -1793,7 +1897,7 @@ MGANAME(SetupForDashedLine)( case 4: NiceDashPattern |= NiceDashPattern << 4; case 8: NiceDashPattern |= byte_reversed[NiceDashPattern] << 16; NiceDashPattern |= NiceDashPattern << 8; - pMga->NiceDashCMD = MGADWG_TRAP | MGADWG_ARZERO | + pMga->NiceDashCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO | MGADWG_BMONOLEF; pMga->AccelFlags |= NICE_DASH_PATTERN; if(bg == -1) { @@ -1805,10 +1909,10 @@ MGANAME(SetupForDashedLine)( pMga->NiceDashCMD |= MGADWG_TRANSC | pMga->Atype[rop]; } else { #if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && + RGBEQUAL(fg) && RGBEQUAL(bg)) #else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) + if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) #endif pMga->NiceDashCMD |= pMga->Atype[rop]; else @@ -1829,8 +1933,8 @@ MGANAME(SetupForDashedLine)( void MGANAME(SubsequentDashedTwoPointLine)( - ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, + ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, int flags, int phase ){ MGAPtr pMga = MGAPTR(pScrn); @@ -1840,20 +1944,20 @@ MGANAME(SubsequentDashedTwoPointLine)( OUTREG(MGAREG_DWGCTL, pMga->NiceDashCMD); if(x2 < x1) { if(flags & OMIT_LAST) x2++; - OUTREG(MGAREG_SHIFT, ((-y1 & 0x07) << 4) | - ((7 - phase - x1) & 0x07)); + OUTREG(MGAREG_SHIFT, ((-y1 & 0x07) << 4) | + ((7 - phase - x1) & 0x07)); OUTREG(MGAREG_FXBNDRY, ((x1 + 1) << 16) | (x2 & 0xffff)); } else { if(!flags) x2++; - OUTREG(MGAREG_SHIFT, (((1 - y1) & 0x07) << 4) | - ((phase - x1) & 0x07)); + OUTREG(MGAREG_SHIFT, (((1 - y1) & 0x07) << 4) | + ((phase - x1) & 0x07)); OUTREG(MGAREG_FXBNDRY, (x2 << 16) | (x1 & 0xffff)); - } + } OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y1 << 16) | 1); } else { - OUTREG(MGAREG_SHIFT, (pMga->StyleLen << 16 ) | - (pMga->StyleLen - phase)); - OUTREG(MGAREG_DWGCTL, pMga->DashCMD | ((flags & OMIT_LAST) ? + OUTREG(MGAREG_SHIFT, (pMga->StyleLen << 16 ) | + (pMga->StyleLen - phase)); + OUTREG(MGAREG_DWGCTL, pMga->DashCMD | ((flags & OMIT_LAST) ? MGADWG_AUTOLINE_OPEN : MGADWG_AUTOLINE_CLOSE)); OUTREG(MGAREG_XYSTRT, (y1 << 16) | (x1 & 0xFFFF)); OUTREG(MGAREG_XYEND + MGAREG_EXEC, (y2 << 16) | (x2 & 0xFFFF)); @@ -1867,15 +1971,15 @@ MGANAME(SubsequentDashedTwoPointLine)( | Planar Screen to Screen Color Expansion | \******************************************/ -static void +static void MGANAME(SetupForPlanarScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, - int fg, int bg, + int fg, int bg, int rop, unsigned int planemask ){ MGAPtr pMga = MGAPTR(pScrn); - CARD32 mgaCMD = pMga->AtypeNoBLK[rop] | MGADWG_BITBLT | + CARD32 mgaCMD = pMga->AtypeNoBLK[rop] | MGADWG_BITBLT | MGADWG_SGNZERO | MGADWG_BPLAN; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -1894,11 +1998,11 @@ MGANAME(SetupForPlanarScreenToScreenColorExpandFill)( OUTREG(MGAREG_DWGCTL, mgaCMD); } -static void +static void MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, int x, int y, int w, int h, - int srcx, int srcy, + int srcx, int srcy, int skipleft ){ MGAPtr pMga = MGAPTR(pScrn); @@ -1921,10 +2025,10 @@ MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( | Screen to Screen Color Expansion | \***********************************/ -static void +static void MGANAME(SetupForScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, - int fg, int bg, + int fg, int bg, int rop, unsigned int planemask ){ @@ -1944,10 +2048,10 @@ MGANAME(SetupForScreenToScreenColorExpandFill)( WAITFIFO(4); } else { #if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && + RGBEQUAL(fg) && RGBEQUAL(bg)) #else - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION)) #endif mgaCMD |= pMga->Atype[rop]; else @@ -1963,11 +2067,11 @@ MGANAME(SetupForScreenToScreenColorExpandFill)( } -static void +static void MGANAME(SubsequentScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, int x, int y, int w, int h, - int srcx, int srcy, + int srcx, int srcy, int skipleft ){ MGAPtr pMga = MGAPTR(pScrn); @@ -2015,10 +2119,10 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)( OUTREG(MGAREG_AR0, start + num); OUTREG(MGAREG_FXBNDRY, ((x + num) << 16) | (x & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | 1); - + OUTREG(MGAREG_AR3, next); OUTREG(MGAREG_AR0, start + w ); - OUTREG(MGAREG_FXBNDRY + MGAREG_EXEC, ((x + w) << 16) | + OUTREG(MGAREG_FXBNDRY + MGAREG_EXEC, ((x + w) << 16) | ((x + num + 1) & 0xffff)); start += pitch; h--; y++; @@ -2033,7 +2137,7 @@ MGANAME(SubsequentScreenToScreenColorExpandFill)( OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | num); start += num * pitch; - h -= num; y += num; + h -= num; y += num; } } } @@ -2067,7 +2171,7 @@ MGAFillSolidRectsDMA( if(nBox & 1) { OUTREG(MGAREG_FXBNDRY, ((pBox->x2) << 16) | (pBox->x1 & 0xffff)); - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pBox->y1 << 16) | (pBox->y2 - pBox->y1)); nBox--; pBox++; } @@ -2086,7 +2190,7 @@ MGAFillSolidRectsDMA( pBox++; base += 5; nBox -= 2; } - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); } void @@ -2096,7 +2200,7 @@ MGAFillSolidSpansDMA( unsigned int planemask, int n, DDXPointPtr ppt, - int *pwidth, int fSorted + int *pwidth, int fSorted ){ MGAPtr pMga = MGAPTR(pScrn); XAAInfoRecPtr infoRec = pMga->AccelInfoRec; @@ -2104,14 +2208,14 @@ MGAFillSolidSpansDMA( CHECK_DMA_QUIESCENT(pMga, pScrn); SET_SYNC_FLAG(infoRec); - + if(infoRec->ClipBox) { OUTREG(MGAREG_CXBNDRY, - ((infoRec->ClipBox->x2 - 1) << 16) | infoRec->ClipBox->x1); - OUTREG(MGAREG_YTOP, - (infoRec->ClipBox->y1 * pScrn->displayWidth) + pMga->YDstOrg); - OUTREG(MGAREG_YBOT, - ((infoRec->ClipBox->y2 - 1) * pScrn->displayWidth) + pMga->YDstOrg); + ((infoRec->ClipBox->x2 - 1) << 16) | infoRec->ClipBox->x1); + OUTREG(MGAREG_YTOP, + (infoRec->ClipBox->y1 * pScrn->displayWidth) + pMga->YDstOrg); + OUTREG(MGAREG_YBOT, + ((infoRec->ClipBox->y2 - 1) * pScrn->displayWidth) + pMga->YDstOrg); } (*infoRec->SetupForSolidFill)(pScrn, fg, rop, planemask); @@ -2137,13 +2241,13 @@ MGAFillSolidSpansDMA( ppt++; base += 5; n -= 2; } - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); } if(infoRec->ClipBox) { - OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ - OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ + OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ + OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ + OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ } } @@ -2184,7 +2288,7 @@ SECOND_PASS: while(nBox--) { WAITFIFO(2); OUTREG(MGAREG_FXBNDRY, ((pBox->x2) << 16) | (pBox->x1 & 0xffff)); - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pBox->y1 << 16) | (pBox->y2 - pBox->y1)); pBox++; } @@ -2211,17 +2315,17 @@ MGAValidatePolyArc( MGAPtr pMga = MGAPTR(pScrn); Bool fullPlanemask = TRUE; - if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != + if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != pMga->AccelInfoRec->FullPlanemask) { if(pMga->AccelFlags & MGA_NO_PLANEMASK) return; - fullPlanemask = FALSE; + fullPlanemask = FALSE; } - if(!pGC->lineWidth && + if(!pGC->lineWidth && (pGC->fillStyle == FillSolid) && (pGC->lineStyle == LineSolid) && - ((pGC->alu != GXcopy) || !fullPlanemask)) + ((pGC->alu != GXcopy) || !fullPlanemask)) { pGC->ops->PolyArc = MGAPolyArcThinSolid; } @@ -2231,7 +2335,7 @@ static void MGAPolyPoint ( DrawablePtr pDraw, GCPtr pGC, - int mode, + int mode, int npt, xPoint *ppt ){ @@ -2242,7 +2346,7 @@ MGAPolyPoint ( int xorg, yorg; if(!numRects) return; - + if(numRects != 1) { XAAFallbackOps.PolyPoint(pDraw, pGC, mode, npt, ppt); return; @@ -2268,7 +2372,7 @@ MGAPolyPoint ( OUTREG(MGAREG_FXBNDRY, ((xorg + 1) << 16) | (xorg & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (yorg << 16) | 1); ppt++; - } + } } else { int x; while(npt--) { @@ -2279,9 +2383,9 @@ MGAPolyPoint ( ppt++; } } - + (*infoRec->DisableClipping)(infoRec->pScrn); - + SET_SYNC_FLAG(infoRec); } @@ -2298,11 +2402,11 @@ MGAValidatePolyPoint( pGC->ops->PolyPoint = XAAFallbackOps.PolyPoint; - if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != + if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != pMga->AccelInfoRec->FullPlanemask) { if(pMga->AccelFlags & MGA_NO_PLANEMASK) return; - fullPlanemask = FALSE; + fullPlanemask = FALSE; } if((pGC->alu != GXcopy) || !fullPlanemask) @@ -2310,7 +2414,7 @@ MGAValidatePolyPoint( } -void +void MGAFillCacheBltRects( ScrnInfoPtr pScrn, int rop, @@ -2339,11 +2443,11 @@ MGAFillCacheBltRects( start = phaseY ? (pCache->orig_h - phaseY) : 0; /* This is optimized for WRAM */ - - if ((rop == GXcopy) && (height >= (pCache->orig_h + start))) { + + if ((rop == GXcopy) && (height >= (pCache->orig_h + start))) { w = width; skipleft = phaseX; x = pBox->x1; blit_h = pCache->orig_h; - + while(1) { blit_w = pCache->w - skipleft; if(blit_w > w) blit_w = w; @@ -2364,7 +2468,7 @@ MGAFillCacheBltRects( y += start; } start = blit_h; - + while(height) { if(blit_h > height) blit_h = height; (*infoRec->SubsequentScreenToScreenCopy)(pScrn, @@ -2379,7 +2483,7 @@ MGAFillCacheBltRects( w = width; skipleft = phaseX; x = pBox->x1; blit_h = pCache->h - phaseY; if(blit_h > height) blit_h = height; - + while(1) { blit_w = pCache->w - skipleft; if(blit_w > w) blit_w = w; @@ -2399,7 +2503,7 @@ MGAFillCacheBltRects( } pBox++; } - + SET_SYNC_FLAG(infoRec); } @@ -2411,7 +2515,7 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index) { ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); BoxPtr pbox = REGION_RECTS(prgn); int nbox = REGION_NUM_RECTS(prgn); @@ -2429,7 +2533,7 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index) } MGASelectBuffer(pScrn, MGA_FRONT); - pMGA->AccelInfoRec->NeedToSync = TRUE; + pMga->AccelInfoRec->NeedToSync = TRUE; } /* @@ -2438,14 +2542,14 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index) instead of destination. My origin is upside down so the ydir cases are reversed. */ - + void -MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, +MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index) { ScreenPtr pScreen = pParent->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); int nbox; BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; DDXPointPtr pptTmp, pptNew1, pptNew2; @@ -2522,7 +2626,7 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, } pboxBase = pboxNext = pbox; while (pboxBase < pbox+nbox) { - while ((pboxNext < pbox+nbox) && + while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; pboxTmp = pboxNext; @@ -2542,9 +2646,9 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, /* No changes are needed */ xdir = 1; } - + MGANAME(SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, -1, -1); - for ( ; nbox-- ; pbox++) + for ( ; nbox-- ; pbox++) { int x1 = pbox->x1; int y1 = pbox->y1; @@ -2553,7 +2657,7 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, int w = pbox->x2 - x1 + 1; int h = pbox->y2 - y1 + 1; - if ( destx < 0 ) x1 -= destx, w += destx, destx = 0; + if ( destx < 0 ) x1 -= destx, w += destx, destx = 0; if ( desty < 0 ) y1 -= desty, h += desty, desty = 0; if ( destx + w > screenwidth ) w = screenwidth - destx; if ( desty + h > screenheight ) h = screenheight - desty; @@ -2561,10 +2665,10 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, if ( h <= 0 ) continue; MGASelectBuffer(pScrn, MGA_BACK); - MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1, y1, + MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1, y1, destx,desty, w, h); MGASelectBuffer(pScrn, MGA_DEPTH); - MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1, + MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1, destx,desty, w, h); } MGASelectBuffer(pScrn, MGA_FRONT); @@ -2578,8 +2682,7 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, DEALLOCATE_LOCAL(pboxNew1); } - pMGA->AccelInfoRec->NeedToSync = TRUE; + pMga->AccelInfoRec->NeedToSync = TRUE; } - -#endif /* XF86DRI */ +#endif /* XF86DRI */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c index 391194b04..536c6b55d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.22 2000/12/21 00:10:56 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.23 2001/04/05 17:42:33 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -164,10 +164,6 @@ static XF86ImageRec Images[NUM_IMAGES] = XVIMAGE_UYVY }; -#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) -#define outMGAdac(reg, val) \ - (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) - static void MGAResetVideoOverlay(ScrnInfoPtr pScrn) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c index 4a5b7ef5f..29c5c8e4f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c @@ -1,38 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c,v 1.2 2000/09/24 13:51:28 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-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, 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 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. - -**************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c,v 1.3 2001/03/21 17:02:24 dawes Exp $ */ /* - * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * 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 + * VA LINUX SYSTEMS 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: + * Keith WHitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ - #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -56,46 +51,50 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mga_macros.h" #include "mga_dri.h" #include "mga_wrap.h" +#include "mga_sarea.h" +#define MGA_WRAP_DEBUG 0 -static void MGAWakeupHandler(int screenNum, - pointer wakeupData, - unsigned long result, - pointer pReadmask) +static void MGAWakeupHandler( int screenNum, pointer wakeupData, + unsigned long result, pointer pReadmask ) { ScreenPtr pScreen = screenInfo.screens[screenNum]; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - /*DRIWrappedFuncsRec *pDRIWrap = DRIGetWrappedFuncs(pScreen);*/ - - if (0) ErrorF("MGAWakeupHandler (in)\n"); - - /* Disabled: Check contention like the 3d clients do before trying - * to restore state. - */ - DRILock(pScreen, 0); - if (xf86IsEntityShared(pScrn->entityList[0])) - MGASwapContext_shared(pScreen); - else - MGASwapContext(pScreen); + + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { + MGASwapContextShared( pScreen ); + } else { + MGASwapContext( pScreen ); + } } -static void MGABlockHandler(int screenNum, - pointer blockData, - pointer pTimeout, - pointer pReadmask) +static void MGABlockHandler( int screenNum, pointer blockData, + pointer pTimeout, pointer pReadmask ) { ScreenPtr pScreen = screenInfo.screens[screenNum]; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); - /*DRIWrappedFuncsRec *pDRIWrap = DRIGetWrappedFuncs(pScreen);*/ - MGASAREAPtr sa = (MGASAREAPtr)DRIGetSAREAPrivate( pScreen ); - if (0) ErrorF("MGABlockHandler (out)\n"); + if ( pMga->haveQuiescense ) { + pMga->haveQuiescense = 0; + + if ( pMga->directRenderingEnabled ) { + DRIUnlock( pScreen ); + } + } - /* Examine the cliprects for the most recently used 3d drawable. + + +#if 0 + MGASAREAPrivPtr sa = (MGASAREAPrivPtr)DRIGetSAREAPrivate( pScreen ); + + if ( MGA_WRAP_DEBUG ) + ErrorF( "MGABlockHandler (out)\n" ); + + /* Examine the cliprects for the most recently used 3D drawable. * If they've changed, attempt to push the updated values into the * sarea. * @@ -106,46 +105,47 @@ static void MGABlockHandler(int screenNum, * * Thus the number of round trips in the cases where comparison is * possible is reduced to no more (and usually fewer) than the number - * Utah requires. + * Utah requires. */ - if (sa->req_drawable != sa->exported_drawable || - sa->exported_stamp != DRIGetDrawableStamp( pScreen, sa->exported_index )) + if ( sa->req_drawable != sa->exported_drawable || + sa->exported_stamp != DRIGetDrawableStamp( pScreen, + sa->exported_index ) ) { int i; XF86DRIClipRectPtr frontboxes, backboxes; XF86DRIClipRectPtr boxes = (XF86DRIClipRectPtr)sa->exported_boxes; WindowPtr window = LookupIDByType( sa->req_drawable, RT_WINDOW ); - if (0) - ErrorF("Trying to update req_drawable: %d (exp %d), stamp %d/%d\n", - sa->req_drawable, sa->exported_drawable); + if ( MGA_WRAP_DEBUG ) + ErrorF( "Trying to update req_drawable: %d (exp %d), stamp %d/%d\n", + sa->req_drawable, sa->exported_drawable ); sa->exported_drawable = 0; - if (!window) { - if (0) - ErrorF("Couldn't retreive window\n"); + if ( !window ) { + if ( MGA_WRAP_DEBUG ) + ErrorF( "Couldn't retreive window\n" ); sa->req_drawable = 0; goto finished; } - if (!DRIGetDrawableInfo( pScreen, &(window->drawable), - &sa->exported_index, - &sa->exported_stamp, - &sa->exported_front_x, - &sa->exported_front_y, - &sa->exported_w, - &sa->exported_h, - &sa->exported_nfront, - &frontboxes, - &sa->exported_back_x, - &sa->exported_back_y, - &sa->exported_nback, - &backboxes )) + if ( !DRIGetDrawableInfo( pScreen, &(window->drawable), + &sa->exported_index, + &sa->exported_stamp, + &sa->exported_front_x, + &sa->exported_front_y, + &sa->exported_w, + &sa->exported_h, + &sa->exported_nfront, + &frontboxes, + &sa->exported_back_x, + &sa->exported_back_y, + &sa->exported_nback, + &backboxes ) ) { - if (0) - ErrorF("Couldn't get DRI info\n"); + if ( MGA_WRAP_DEBUG ) + ErrorF( "Couldn't get DRI info\n" ); sa->req_drawable = 0; goto finished; } @@ -153,57 +153,55 @@ static void MGABlockHandler(int screenNum, /* If we can't fit both sets of cliprects into the sarea, try to * fit the current draw buffer. Otherwise return. */ - sa->exported_buffers = MGA_FRONT | MGA_BACK; - if (sa->exported_nback + sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS) { - if (sa->req_draw_buffer == MGA_FRONT) { + if ( sa->exported_nback + sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS ) { + if ( sa->req_draw_buffer == MGA_FRONT ) { sa->exported_buffers = MGA_FRONT; - if (sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS) + if ( sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS ) goto finished; } else { sa->exported_buffers = MGA_BACK; - if (sa->exported_nback >= MGA_NR_SAREA_CLIPRECTS) + if ( sa->exported_nback >= MGA_NR_SAREA_CLIPRECTS ) goto finished; } } - if (sa->exported_buffers & MGA_BACK) { - for (i = 0 ; i < sa->exported_nback ; i++) - *boxes++ = backboxes[i]; + if ( sa->exported_buffers & MGA_BACK ) { + for ( i = 0 ; i < sa->exported_nback ; i++ ) + *boxes++ = backboxes[i]; } - if (sa->exported_buffers & MGA_FRONT) { - for (i = 0 ; i < sa->exported_nfront ; i++) - *boxes++ = frontboxes[i]; + if ( sa->exported_buffers & MGA_FRONT ) { + for ( i = 0 ; i < sa->exported_nfront ; i++ ) + *boxes++ = frontboxes[i]; } sa->exported_drawable = sa->req_drawable; - } + } finished: - if (xf86IsEntityShared(pScrn->entityList[0])) { + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { /* Restore to first screen */ - pMga->RestoreAccelState(pScrn); - xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex); + pMga->RestoreAccelState( pScrn ); + xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex ); } - DRIUnlock(pScreen); + DRIUnlock( pScreen ); +#endif } - - /* Just wrap validate tree for now to remove the quiescense hack. * This is more of a win for the i810 than the mga, but should be useful * here too. */ -void MGADRIWrapFunctions(ScreenPtr pScreen, DRIInfoPtr pDRIInfo) +void MGADRIWrapFunctions( ScreenPtr pScreen, DRIInfoPtr pDRIInfo ) { - pDRIInfo->wrap.BlockHandler = MGABlockHandler; - pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler; -/* pDRIInfo->wrap.ValidateTree = NULL; */ -/* pDRIInfo->wrap.PostValidateTree = NULL; */ + pDRIInfo->wrap.BlockHandler = MGABlockHandler; + pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler; +#if 1 + pDRIInfo->wrap.ValidateTree = NULL; + pDRIInfo->wrap.PostValidateTree = NULL; +#endif } - - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c index 745240bfd..c4b3fc455 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c @@ -30,7 +30,7 @@ * Project. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.6 2000/12/14 20:59:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.8 2001/04/01 14:00:11 tsi Exp $ */ /* function prototypes, common data structures & generic includes */ #include "newport.h" @@ -56,14 +56,6 @@ #include "xf86xv.h" #include "Xv.h" -/* Temporary workaround. A module really shouldn't need this */ -#ifndef XFree86LOADER -# include "xf86_OSlib.h" -# ifndef MAP_FAILED -# define MAP_FAILED ((pointer)(-1)) -# endif -#endif - #define VERSION 4000 #define NEWPORT_NAME "Newport" #define NEWPORT_DRIVER_NAME "newport" @@ -268,7 +260,7 @@ NewportProbe(DriverPtr drv, int flags) pScrn->ScreenInit = NewportScreenInit; pScrn->EnterVT = NewportEnterVT; pScrn->LeaveVT = NewportLeaveVT; - pScrn->driverPrivate = (void*)busID; + pScrn->driverPrivate = (void*)(long)busID; foundScreen = TRUE; break; } @@ -294,7 +286,7 @@ NewportPreInit(ScrnInfoPtr pScrn, int flags) if (pScrn->numEntities != 1) return FALSE; - busID = (int)(pScrn->driverPrivate); + busID = (long)(pScrn->driverPrivate); pScrn->driverPrivate = NULL; /* Fill in the monitor field */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile index 48e26e01b..2444ce45e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile @@ -1,19 +1,16 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.15 2001/01/24 00:06:25 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.17 2001/04/01 20:51:25 tsi Exp $ XCOMM XCOMM This is an Imakefile for the NVIDIA driver. XCOMM - -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.15 2001/01/24 00:06:25 dawes Exp $ - #define IHaveModules #include <Server.tmpl> SRCS = nv_driver.c nv_dac.c nv_setup.c nv_cursor.c nv_xaa.c nv_dga.c \ - nv_shadow.c riva_hw.c + nv_shadow.c riva_hw.c nv_video.c OBJS = nv_driver.o nv_dac.o nv_setup.o nv_cursor.o nv_xaa.o nv_dga.o \ - nv_shadow.o riva_hw.o + nv_shadow.o riva_hw.o nv_video.o #if defined(XF86DriverSDK) @@ -57,6 +54,7 @@ InstallDriverSDKNonExecFile(nv_include.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_local.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_proto.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_setup.c,$(DRIVERSDKDIR)/drivers/nv) +InstallDriverSDKNonExecFile(nv_video.c,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_shadow.c,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_type.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_xaa.c,$(DRIVERSDKDIR)/drivers/nv) 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 75ae60d4f..4744100ec 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.59 2001/02/18 23:47:29 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.63 2001/03/28 01:17:43 mvojkovi Exp $ */ #include "nv_include.h" @@ -107,10 +107,10 @@ static SymTabRec NVChipsets[] = { { NV_CHIP_GEFORCE2MXDDR, "GeForce2 MX DDR"}, { NV_CHIP_QUADRO2MXR, "Quadro 2 MXR"}, { NV_CHIP_GEFORCE2GO, "GeForce 2 Go"}, - { NV_CHIP_0200, "NV Chip 0x0200"}, - { NV_CHIP_0201, "NV Chip 0x0201"}, - { NV_CHIP_0202, "NV Chip 0x0202"}, - { NV_CHIP_0203, "NV Chip 0x0203"}, + { NV_CHIP_GEFORCE3, "GeForce3"}, + { NV_CHIP_GEFORCE3_1, "GeForce3 (rev 1)"}, + { NV_CHIP_GEFORCE3_2, "GeForce3 (rev 2)"}, + { NV_CHIP_GEFORCE3_3, "GeForce3 (rev 3)"}, {-1, NULL } }; @@ -135,10 +135,10 @@ static PciChipsets NVPciChipsets[] = { { NV_CHIP_GEFORCE2MXDDR, NV_CHIP_GEFORCE2MXDDR, RES_SHARED_VGA }, { NV_CHIP_QUADRO2MXR, NV_CHIP_QUADRO2MXR, RES_SHARED_VGA }, { NV_CHIP_GEFORCE2GO, NV_CHIP_GEFORCE2GO, RES_SHARED_VGA }, - { NV_CHIP_0200, NV_CHIP_0200, RES_SHARED_VGA }, - { NV_CHIP_0201, NV_CHIP_0201, RES_SHARED_VGA }, - { NV_CHIP_0202, NV_CHIP_0202, RES_SHARED_VGA }, - { NV_CHIP_0203, NV_CHIP_0203, RES_SHARED_VGA }, + { NV_CHIP_GEFORCE3, NV_CHIP_GEFORCE3, RES_SHARED_VGA }, + { NV_CHIP_GEFORCE3_1, NV_CHIP_GEFORCE3_1, RES_SHARED_VGA }, + { NV_CHIP_GEFORCE3_2, NV_CHIP_GEFORCE3_2, RES_SHARED_VGA }, + { NV_CHIP_GEFORCE3_3, NV_CHIP_GEFORCE3_3, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -293,7 +293,8 @@ typedef enum { OPTION_SHOWCACHE, OPTION_SHADOW_FB, OPTION_FBDEV, - OPTION_ROTATE + OPTION_ROTATE, + OPTION_VIDEO_KEY } NVOpts; @@ -305,6 +306,7 @@ static OptionInfoRec NVOptions[] = { { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -601,6 +603,30 @@ NVLeaveVT(int scrnIndex, int flags) vgaHWLock(hwp); } + + +static void +NVBlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrnInfo = xf86Screens[i]; + NVPtr pNv = NVPTR(pScrnInfo); + + pScreen->BlockHandler = pNv->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = NVBlockHandler; + + if (pNv->VideoTimerCallback) + (*pNv->VideoTimerCallback)(pScrnInfo, currentTime.milliseconds); + +} + + /* * This is called at the end of each server generation. It restores the * original (text) mode. It should also unmap the video memory, and free @@ -636,9 +662,12 @@ NVCloseScreen(int scrnIndex, ScreenPtr pScreen) xfree(pNv->DGAModes); if ( pNv->expandBuffer ) xfree(pNv->expandBuffer); + if (pNv->overlayAdaptor) + xfree(pNv->overlayAdaptor); pScrn->vtSema = FALSE; pScreen->CloseScreen = pNv->CloseScreen; + pScreen->BlockHandler = pNv->BlockHandler; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } @@ -1085,6 +1114,15 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) "Valid options are \"CW\" or \"CCW\"\n"); } } + if(xf86GetOptValInteger(NVOptions, OPTION_VIDEO_KEY, &(pNv->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", + pNv->videoKey); + } else { + pNv->videoKey = (1 << pScrn->offset.red) | + (1 << pScrn->offset.green) | + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); + } + if (pNv->pEnt->device->MemBase != 0) { /* Require that the config file value matches one of the PCI values. */ @@ -1153,6 +1191,8 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) case NV_CHIP_TNT: case NV_CHIP_TNT2: + case NV_CHIP_TNT2_A: + case NV_CHIP_TNT2_B: case NV_CHIP_UTNT2: case NV_CHIP_VTNT2: case NV_CHIP_UVTNT2: @@ -1172,6 +1212,12 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) case NV_CHIP_QUADRO2MXR: case NV_CHIP_GEFORCE2GO: NV10Setup(pScrn); + break; + case NV_CHIP_GEFORCE3: + case NV_CHIP_GEFORCE3_1: + case NV_CHIP_GEFORCE3_2: + case NV_CHIP_GEFORCE3_3: + NV20Setup(pScrn); break; } @@ -1256,6 +1302,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) break; case NV_ARCH_04: case NV_ARCH_10: + case NV_ARCH_20: pNv->FbUsableSize -= 128 * 1024; break; } @@ -1521,6 +1568,8 @@ NVModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if ( pNv->Restore ) (*pNv->Restore)(pScrn, vgaReg, nvReg, FALSE); + NVResetGraphics(pScrn); + vgaHWProtect(pScrn, FALSE); pNv->CurrentLayout.mode = mode; @@ -1802,18 +1851,7 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->memPhysBase = pNv->FbAddress; pScrn->fbOffset = 0; -#ifdef XvExtension - { - XF86VideoAdaptorPtr *ptr; - int n; - - n = xf86XVListGenericAdaptors(pScrn,&ptr); - if (n) { - xf86XVScreenInit(pScreen, ptr, n); - } - } - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Xv set up\n")); -#endif + NVInitVideo(pScreen); pScreen->SaveScreen = NVSaveScreen; @@ -1821,6 +1859,9 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pNv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = NVCloseScreen; + pNv->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = NVBlockHandler; + /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h index 5b5b010e3..ddd5e46c5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.9 2000/10/06 12:31:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.10 2001/03/28 01:17:43 mvojkovi Exp $ */ #ifndef __NV_INCLUDE_H__ #define __NV_INCLUDE_H__ @@ -31,6 +31,10 @@ #include "xf86RAC.h" #include "nv_const.h" + +#include "dixstruct.h" +#include "scrnintstr.h" + #ifndef NV_USE_FB /* * If using cfb, cfb.h is required. Select the others for the bpp values diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h index 47fd9e68f..3c9c484a5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.3 1999/11/12 02:12:40 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.6 2001/03/28 01:17:43 mvojkovi Exp $ */ #ifndef __NV_PROTO_H__ #define __NV_PROTO_H__ @@ -17,12 +17,16 @@ void NVDACRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, void NVDACLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual ); +/* in nv_video.c */ +void NVInitVideo(ScreenPtr); + /* in nv_setup.c */ void RivaEnterLeave(ScrnInfoPtr pScrn, Bool enter); void NV1Setup(ScrnInfoPtr pScrn); void NV3Setup(ScrnInfoPtr pScrn); void NV4Setup(ScrnInfoPtr pScrn); void NV10Setup(ScrnInfoPtr pScrn); +void NV20Setup(ScrnInfoPtr pScrn); /* in nv_cursor.c */ Bool NVCursorInit(ScreenPtr pScreen); @@ -30,6 +34,7 @@ Bool NVCursorInit(ScreenPtr pScreen); /* in nv_xaa.c */ Bool NVAccelInit(ScreenPtr pScreen); void NVSync(ScrnInfoPtr pScrn); +void NVResetGraphics(ScrnInfoPtr pScrn); /* in nv_dga.c */ Bool NVDGAInit(ScreenPtr pScreen); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c index bb0df1af5..d0550f26d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.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_setup.c,v 1.7 2000/11/03 18:46:12 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.9 2001/03/28 01:17:43 mvojkovi Exp $ */ #include "nv_include.h" @@ -235,7 +235,7 @@ NVCommonSetup(ScrnInfoPtr pScrn) regBase+0x00009000, 0x00001000); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PTIMER %x\n", pNv->riva.PTIMER)); pNv->riva.PMC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, - regBase+0x00000000, 0x00001000); + regBase+0x00000000, 0x00009000); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PMC %x\n", pNv->riva.PMC)); pNv->riva.FIFO = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00800000, 0x00010000); @@ -334,3 +334,26 @@ NV10Setup(ScrnInfoPtr pScrn) NVCommonSetup(pScrn); } +void +NV20Setup(ScrnInfoPtr pScrn) +{ + NVPtr pNv = NVPTR(pScrn); + CARD32 regBase = pNv->IOAddress; + int mmioFlags; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV10Setup\n")); + + pNv->riva.Architecture = 0x20; + /* + * Map chip-specific memory-mapped registers. This MUST be done in the OS sp +ecific driver code. + */ + mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; + pNv->riva.PRAMIN = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, + regBase+0x00710000, 0x00010000); + pNv->riva.PCRTC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, + regBase+0x00600000, 0x00001000); + + NVCommonSetup(pScrn); +} + 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 b7246ddb7..4fc8107a2 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.20 2001/02/17 23:20:17 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.22 2001/03/28 01:17:43 mvojkovi Exp $ */ #ifndef __NV_STRUCT_H__ #define __NV_STRUCT_H__ @@ -85,6 +85,7 @@ typedef struct { void (*Restore)(ScrnInfoPtr, vgaRegPtr, NVRegPtr, Bool); Bool (*ModeInit)(ScrnInfoPtr, DisplayModePtr); void (*PointerMoved)(int index, int x, int y); + ScreenBlockHandlerProcPtr BlockHandler; CloseScreenProcPtr CloseScreen; Bool FBDev; /* Color expansion */ @@ -113,6 +114,9 @@ typedef struct { Bool (*i2cInit)(ScrnInfoPtr); I2CBusPtr I2C; xf86Int10InfoPtr pInt; + void (*VideoTimerCallback)(ScrnInfoPtr, Time); + XF86VideoAdaptorPtr overlayAdaptor; + int videoKey; } NVRec, *NVPtr; #define NVPTR(p) ((NVPtr)((p)->driverPrivate)) @@ -143,9 +147,9 @@ void NVPointerMoved(int index, int x, int y); #define NV_CHIP_GEFORCE2GTS_1 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2GTS_1) #define NV_CHIP_GEFORCE2ULTRA ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE2ULTRA) #define NV_CHIP_QUADRO2PRO ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_QUADRO2PRO) -#define NV_CHIP_0200 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0200) -#define NV_CHIP_0201 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0201) -#define NV_CHIP_0202 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0202) -#define NV_CHIP_0203 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_0203) +#define NV_CHIP_GEFORCE3 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3) +#define NV_CHIP_GEFORCE3_1 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_1) +#define NV_CHIP_GEFORCE3_2 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_2) +#define NV_CHIP_GEFORCE3_3 ((PCI_VENDOR_NVIDIA << 16) | PCI_CHIP_GEFORCE3_3) #endif /* __NV_STRUCT_H__ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c new file mode 100644 index 000000000..e7c6452cc --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c @@ -0,0 +1,1221 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c,v 1.2 2001/04/01 14:00:11 tsi Exp $ */ + +#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 "xf86xv.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" + +#include "nv_include.h" +#include "nvreg.h" +#include "nvvga.h" + + + +#define OFF_DELAY 450 /* milliseconds */ +#define FREE_DELAY 10000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + + + +#ifndef XvExtension +void NVInitVideo(ScreenPtr pScreen) {} +#else + +typedef struct _NVPortPrivRec { + short brightness; + short contrast; + short saturation; + short hue; + RegionRec clip; + CARD32 colorKey; + Bool autopaintColorKey; + Bool doubleBuffer; + CARD32 videoStatus; + int currentBuffer; + Time videoTime; + Bool grabbedByV4L; + FBLinearPtr linear; + int pitch; + int offset; +} NVPortPrivRec, *NVPortPrivPtr; + + +static XF86VideoAdaptorPtr NVSetupImageVideo(ScreenPtr); + +static void NVResetVideo(ScrnInfoPtr); + +static void NVStopOverlay (ScrnInfoPtr); +static void NVPutOverlayImage(ScrnInfoPtr pScrnInfo, + int offset, + int id, + int dstPitch, + BoxPtr dstBox, + int x1, int y1, int x2, int y2, + short width, short height, + short src_w, short src_h, + short dst_w, short dst_h, + RegionPtr cliplist); + +static int NVSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int NVGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); + +static void NVStopOverlayVideo(ScrnInfoPtr, pointer, Bool); + +static int NVPutImage( ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static void NVQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); +static int NVQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); + +static void NVVideoTimerCallback(ScrnInfoPtr, Time); + +static void NVInitOffscreenImages (ScreenPtr pScreen); + + +#define GET_OVERLAY_PRIVATE(pNv) \ + (NVPortPrivPtr)((pNv)->overlayAdaptor->pPortPrivates[0].ptr) + +#define GET_BLIT_PRIVATE(pNv) \ + (NVPortPrivPtr)((pNv)->blitAdaptor->pPortPrivates[0].ptr) + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast, xvColorKey, xvSaturation, + xvHue, xvAutopaintColorKey, xvSetDefaults, xvDoubleBuffer; + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding = +{ + 0, + "XV_IMAGE", + 2046, 2047, + {1, 1} +}; + +#define NUM_FORMATS_ALL 6 + +XF86VideoFormatRec NVFormats[NUM_FORMATS_ALL] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, + {15, DirectColor}, {16, DirectColor}, {24, DirectColor} +}; + +#define NUM_ATTRIBUTES 8 + +XF86AttributeRec NVAttributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}, + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"}, + {XvSettable , 0, 0, "XV_SET_DEFAULTS"}, + {XvSettable | XvGettable, -512, 511, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 8191, "XV_CONTRAST"}, + {XvSettable | XvGettable, 0, 8191, "XV_SATURATION"}, + {XvSettable | XvGettable, 0, 360, "XV_HUE"} +}; + +#define NUM_IMAGES_ALL 4 + +static XF86ImageRec NVImages[NUM_IMAGES_ALL] = +{ + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_UYVY, + XVIMAGE_I420 +}; + +static void +NVSetPortDefaults (ScrnInfoPtr pScrnInfo, NVPortPrivPtr pPriv) +{ + NVPtr pNv = NVPTR(pScrnInfo); + + pPriv->brightness = 0; + pPriv->contrast = 4096; + pPriv->saturation = 4096; + pPriv->hue = 0; + pPriv->colorKey = pNv->videoKey; + pPriv->autopaintColorKey = TRUE; + pPriv->doubleBuffer = TRUE; +} + + +static void +NVResetVideo (ScrnInfoPtr pScrnInfo) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + RIVA_HW_INST *pRiva = &(pNv->riva); + int satSine, satCosine; + double angle; + + angle = (double)pPriv->hue * 3.1415927 / 180.0; + + satSine = pPriv->saturation * sin(angle); + if (satSine < -1024) + satSine = -1024; + satCosine = pPriv->saturation * cos(angle); + if (satCosine < -1024) + satCosine = -1024; + + pRiva->PMC[0x00008910/4] = (pPriv->brightness << 16) | pPriv->contrast; + pRiva->PMC[0x00008914/4] = (pPriv->brightness << 16) | pPriv->contrast; + pRiva->PMC[0x00008918/4] = (satSine << 16) | (satCosine & 0xffff); + pRiva->PMC[0x0000891C/4] = (satSine << 16) | (satCosine & 0xffff); + pRiva->PMC[0x00008b00/4] = pPriv->colorKey; +} + + + +static void +NVStopOverlay (ScrnInfoPtr pScrnInfo) +{ + NVPtr pNv = NVPTR(pScrnInfo); + RIVA_HW_INST *pRiva = &(pNv->riva); + + pRiva->PMC[0x00008704/4] = 1; +} + +static FBLinearPtr +NVAllocateOverlayMemory( + ScrnInfoPtr pScrn, + FBLinearPtr linear, + int size +){ + ScreenPtr pScreen; + FBLinearPtr new_linear; + + if(linear) { + if(linear->size >= size) + return linear; + + if(xf86ResizeOffscreenLinear(linear, size)) + return linear; + + xf86FreeOffscreenLinear(linear); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32, + NULL, NULL, NULL); + + if(!new_linear) { + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 32, + PRIORITY_EXTREME); + + if(max_size < size) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32, + NULL, NULL, NULL); + } + + return new_linear; +} + +static void NVFreeOverlayMemory(ScrnInfoPtr pScrnInfo) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + + if(pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } +} + + +void NVInitVideo (ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr overlayAdaptor = NULL; + NVPtr pNv = NVPTR(pScrn); + int num_adaptors; + + if (pNv->AccelInfoRec && pNv->AccelInfoRec->FillSolidRects && + (pScrn->bitsPerPixel != 8) && (pNv->riva.Architecture >= NV_ARCH_10)) + { + + overlayAdaptor = NVSetupImageVideo(pScreen); + + if(overlayAdaptor) + NVInitOffscreenImages(pScreen); + } + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if(overlayAdaptor) { + int size = num_adaptors + 1; + + if((newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*)))) { + if(num_adaptors) + memcpy(newAdaptors, adaptors, + num_adaptors * sizeof(XF86VideoAdaptorPtr)); + + if(overlayAdaptor) { + newAdaptors[num_adaptors] = overlayAdaptor; + num_adaptors++; + } + adaptors = newAdaptors; + } + } + + if (num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if (newAdaptors) + xfree(newAdaptors); +} + + +static XF86VideoAdaptorPtr +NVSetupImageVideo (ScreenPtr pScreen) +{ + ScrnInfoPtr pScrnInfo = xf86Screens[pScreen->myNum]; + NVPtr pNv = NVPTR(pScrnInfo); + XF86VideoAdaptorPtr adapt; + NVPortPrivPtr pPriv; + + if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(NVPortPrivRec) + + sizeof(DevUnion)))) + { + return NULL; + } + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES|VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "NV Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = &DummyEncoding; + adapt->nFormats = NUM_FORMATS_ALL; + adapt->pFormats = NVFormats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + pPriv = (NVPortPrivPtr)(&adapt->pPortPrivates[1]); + adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->pAttributes = NVAttributes; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = NVImages; + adapt->nImages = NUM_IMAGES_ALL; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = NVStopOverlayVideo; + adapt->SetPortAttribute = NVSetPortAttribute; + adapt->GetPortAttribute = NVGetPortAttribute; + adapt->QueryBestSize = NVQueryBestSize; + adapt->PutImage = NVPutImage; + adapt->QueryImageAttributes = NVQueryImageAttributes; + + pPriv->videoStatus = 0; + pPriv->currentBuffer = 0; + pPriv->grabbedByV4L = FALSE; + + NVSetPortDefaults (pScrnInfo, pPriv); + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pNv->overlayAdaptor = adapt; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvHue = MAKE_ATOM("XV_HUE"); + xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + xvSetDefaults = MAKE_ATOM("XV_SET_DEFAULTS"); + + NVResetVideo(pScrnInfo); + + return adapt; +} + +/* + * RegionsEqual + */ +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; +} +/* NVClipVideo - + + 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. +*/ + +#define DummyScreen screenInfo.screens[0] + +static Bool +NVClipVideo( + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height +){ + INT32 vscale, hscale, delta; + BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); + int diff; + + hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1); + vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1); + + *xa <<= 16; *xb <<= 16; + *ya <<= 16; *yb <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *xa += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *xb -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *ya += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *yb -= diff * vscale; + } + + if(*xa < 0) { + diff = (- *xa + hscale - 1)/ hscale; + dst->x1 += diff; + *xa += diff * hscale; + } + delta = *xb - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *xb -= diff * hscale; + } + if(*xa >= *xb) return FALSE; + + if(*ya < 0) { + diff = (- *ya + vscale - 1)/ vscale; + dst->y1 += diff; + *ya += diff * vscale; + } + delta = *yb - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *yb -= diff * vscale; + } + if(*ya >= *yb) return FALSE; + + if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || + (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) + { + RegionRec clipReg; + REGION_INIT(DummyScreen, &clipReg, dst, 1); + REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); + REGION_UNINIT(DummyScreen, &clipReg); + } + return TRUE; +} + +static void +NVPutOverlayImage ( + ScrnInfoPtr pScrnInfo, + int offset, + int id, + int dstPitch, + BoxPtr dstBox, + int x1, + int y1, + int x2, + int y2, + short width, + short height, + short src_w, + short src_h, + short drw_w, + short drw_h, + RegionPtr clipBoxes +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + RIVA_HW_INST *pRiva = &(pNv->riva); + int buffer = pPriv->currentBuffer; + + /* paint the color key */ + if(pPriv->autopaintColorKey && + (pPriv->grabbedByV4L || !RegionsEqual(&pPriv->clip, clipBoxes))) + { + /* we always paint V4L's color key */ + if(!pPriv->grabbedByV4L) + REGION_COPY(pScrnInfo->pScreen, &pPriv->clip, clipBoxes); + (*pNv->AccelInfoRec->FillSolidRects)(pScrnInfo, pPriv->colorKey, + GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + pRiva->PMC[(0x8900/4) + buffer] = offset; + pRiva->PMC[(0x8928/4) + buffer] = (height << 16) | width; + pRiva->PMC[(0x8930/4) + buffer] = ((y1 << 4) & 0xffff0000) | (x1 >> 12); + pRiva->PMC[(0x8938/4) + buffer] = (src_w << 20) / drw_w; + pRiva->PMC[(0x8940/4) + buffer] = (src_h << 20) / drw_h; + pRiva->PMC[(0x8948/4) + buffer] = (dstBox->y1 << 16) | dstBox->x1; + pRiva->PMC[(0x8950/4) + buffer] = ((dstBox->y2 - dstBox->y1) << 16) | + (dstBox->x2 - dstBox->x1); + + dstPitch |= 1 << 20; /* use color key */ + + if(id != FOURCC_UYVY) + dstPitch |= 1 << 16; + + pRiva->PMC[(0x8958/4) + buffer] = dstPitch; + pRiva->PMC[0x00008704/4] = 0; + pRiva->PMC[0x8700/4] = 1 << (buffer << 2); + + pPriv->videoStatus = CLIENT_VIDEO_ON; +} + + + +/* + * StopVideo + */ +static void NVStopOverlayVideo +( + ScrnInfoPtr pScrnInfo, + pointer data, + Bool Exit +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = (NVPortPrivPtr)data; + + if(pPriv->grabbedByV4L) return; + + REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip); + + if(Exit) + { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) + NVStopOverlay(pScrnInfo); + NVFreeOverlayMemory(pScrnInfo); + pPriv->videoStatus = 0; + pNv->VideoTimerCallback = NULL; + } + else + { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) + { + pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON; + pPriv->videoTime = currentTime.milliseconds + OFF_DELAY; + pNv->VideoTimerCallback = NVVideoTimerCallback; + } + } +} + + + +static int NVSetPortAttribute +( + ScrnInfoPtr pScrnInfo, + Atom attribute, + INT32 value, + pointer data +) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)data; + + if (attribute == xvBrightness) + { + if ((value < -512) || (value > 512)) + return BadValue; + pPriv->brightness = value; + } + else if (attribute == xvDoubleBuffer) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; + } + else if (attribute == xvContrast) + { + if ((value < 0) || (value > 8191)) + return BadValue; + pPriv->contrast = value; + } + else if (attribute == xvHue) + { + value %= 360; + if (value < 0) + value += 360; + pPriv->hue = value; + } + else if (attribute == xvSaturation) + { + if ((value < 0) || (value > 8191)) + return BadValue; + pPriv->saturation = value; + } + else if (attribute == xvColorKey) + { + pPriv->colorKey = value; + REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip); + } + else if (attribute == xvAutopaintColorKey) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->autopaintColorKey = value; + } + else if (attribute == xvSetDefaults) + { + NVSetPortDefaults(pScrnInfo, pPriv); + } + else + return BadMatch; + + NVResetVideo(pScrnInfo); + return Success; +} + + + + +static int NVGetPortAttribute +( + ScrnInfoPtr pScrnInfo, + Atom attribute, + INT32 *value, + pointer data +) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)data; + + if (attribute == xvBrightness) + *value = pPriv->brightness; + else if (attribute == xvDoubleBuffer) + *value = (pPriv->doubleBuffer) ? 1 : 0; + else if (attribute == xvContrast) + *value = pPriv->contrast; + else if (attribute == xvSaturation) + *value = pPriv->saturation; + else if (attribute == xvHue) + *value = pPriv->hue; + else if (attribute == xvColorKey) + *value = pPriv->colorKey; + else if (attribute == xvAutopaintColorKey) + *value = (pPriv->autopaintColorKey) ? 1 : 0; + else + return BadMatch; + + return Success; +} + + +/* + * QueryBestSize + */ +static void NVQueryBestSize +( + ScrnInfoPtr pScrnInfo, + Bool motion, + short vid_w, + short vid_h, + short drw_w, + short drw_h, + unsigned int *p_w, + unsigned int *p_h, + pointer data +) +{ + if(vid_w > (drw_w << 3)) + drw_w = vid_w >> 3; + if(vid_h > (drw_h << 3)) + drw_h = vid_h >> 3; + + *p_w = drw_w; + *p_h = drw_h; +} +/* + * CopyData + */ +static void NVCopyData422 +( + unsigned char *src, + unsigned char *dst, + int srcPitch, + int dstPitch, + int h, + int w +) +{ + w <<= 1; + while(h--) + { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} +/* + * CopyMungedData + */ +static void NVCopyData420 +( + unsigned char *src1, + unsigned char *src2, + unsigned char *src3, + unsigned char *dst1, + int srcPitch, + int srcPitch2, + int dstPitch, + int h, + int w +) +{ + CARD32 *dst; + CARD8 *s1, *s2, *s3; + int i, j; + + w >>= 1; + + for(j = 0; j < h; j++) { + dst = (CARD32*)dst1; + s1 = src1; s2 = src2; s3 = src3; + i = w; + while(i > 4) { + dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); + dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); + dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); + dst += 4; s2 += 4; s3 += 4; s1 += 8; + i -= 4; + } + + while(i--) { + dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst++; s2++; s3++; + s1 += 2; + } + + dst1 += dstPitch; + src1 += srcPitch; + if(j & 1) { + src2 += srcPitch2; + src3 += srcPitch2; + } + } +} +/* + * PutImage + */ +static int NVPutImage +( + ScrnInfoPtr pScrnInfo, + 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 +) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)data; + NVPtr pNv = NVPTR(pScrnInfo); + INT32 xa, xb, ya, yb; + unsigned char *dst_start; + int pitch, newSize, offset, s2offset, s3offset; + int srcPitch, srcPitch2, dstPitch; + int top, left, npixels, nlines, bpp; + BoxRec dstBox; + CARD32 tmp; + + /* + * s2offset, s3offset - byte offsets into U and V plane of the + * source where copying starts. Y plane is + * done by editing "buf". + * + * offset - byte offset to the first line of the destination. + * + * dst_start - byte address to the first displayed pel. + * + */ + + if(pPriv->grabbedByV4L) return Success; + + /* make the compiler happy */ + s2offset = s3offset = srcPitch2 = 0; + + if(src_w > (drw_w << 3)) + drw_w = src_w >> 3; + if(src_h > (drw_h << 3)) + drw_h = src_h >> 3; + + /* Clip */ + xa = src_x; + xb = src_x + src_w; + ya = src_y; + yb = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if(!NVClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height)) + return Success; + + dstBox.x1 -= pScrnInfo->frameX0; + dstBox.x2 -= pScrnInfo->frameX0; + dstBox.y1 -= pScrnInfo->frameY0; + dstBox.y2 -= pScrnInfo->frameY0; + + bpp = pScrnInfo->bitsPerPixel >> 3; + pitch = bpp * pScrnInfo->displayWidth; + + dstPitch = ((width << 1) + 63) & ~63; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; /* of luma */ + s2offset = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + s3offset = (srcPitch2 * (height >> 1)) + s2offset; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + srcPitch = (width << 1); + break; + } + + newSize = height * dstPitch / bpp; + + if(pPriv->doubleBuffer) + newSize <<= 1; + + pPriv->linear = NVAllocateOverlayMemory(pScrnInfo, + pPriv->linear, + newSize); + + if(!pPriv->linear) return BadAlloc; + + offset = pPriv->linear->offset * bpp; + + if(pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (newSize * bpp) >> 1; + + dst_start = pNv->FbStart + offset; + + /* copy data */ + top = ya >> 16; + left = (xa >> 16) & ~1; + npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; + +#if 0 + /* I have my reservations about this */ + if(pPriv->doubleBuffer) { + RIVA_HW_INST *pRiva = &(pNv->riva); + int mask = 1 << (pPriv->currentBuffer << 2); + while(pRiva->PMC[0x00008700/4] & mask); + } +#endif + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + dst_start += (left << 1) + (top * dstPitch); + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + s2offset += tmp; + s3offset += tmp; + if(id == FOURCC_I420) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; + NVCopyData420(buf + (top * srcPitch) + left, buf + s2offset, + buf + s3offset, dst_start, srcPitch, srcPitch2, + dstPitch, nlines, npixels); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + left <<= 1; + buf += (top * srcPitch) + left; + nlines = ((yb + 0xffff) >> 16) - top; + dst_start += left + (top * dstPitch); + NVCopyData422(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + } + + NVPutOverlayImage(pScrnInfo, offset, id, dstPitch, &dstBox, xa, ya, xb, yb, + width, height, src_w, src_h, drw_w, drw_h, clipBoxes); + + pPriv->currentBuffer ^= 1; + + return Success; +} +/* + * QueryImageAttributes + */ +static int NVQueryImageAttributes +( + ScrnInfoPtr pScrnInfo, + int id, + unsigned short *w, + unsigned short *h, + int *pitches, + int *offsets +) +{ + int size, tmp; + + if(*w > 2046) + *w = 2046; + if(*h > 2047) + *h = 2047; + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) + { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if (pitches) + pitches[0] = size; + size *= *h; + if (offsets) + offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if (pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if (offsets) + offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + size *= *h; + break; + } + return size; +} + +static void NVVideoTimerCallback +( + ScrnInfoPtr pScrnInfo, + Time currentTime +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pOverPriv = NULL; + + pNv->VideoTimerCallback = NULL; + + if(!pScrnInfo->vtSema) return; + + if(pNv->overlayAdaptor) { + pOverPriv = GET_OVERLAY_PRIVATE(pNv); + if(!pOverPriv->videoStatus) + pOverPriv = NULL; + } + + if(pOverPriv) { + if(pOverPriv->videoTime < currentTime) { + if(pOverPriv->videoStatus & OFF_TIMER) { + NVStopOverlay(pScrnInfo); + pOverPriv->videoStatus = FREE_TIMER; + pOverPriv->videoTime = currentTime + FREE_DELAY; + pNv->VideoTimerCallback = NVVideoTimerCallback; + } else + if(pOverPriv->videoStatus & FREE_TIMER) { + NVFreeOverlayMemory(pScrnInfo); + pOverPriv->videoStatus = 0; + } + } else + pNv->VideoTimerCallback = NVVideoTimerCallback; + } +} + + +/***** Exported offscreen surface stuff ****/ + + +static int +NVAllocSurface ( + ScrnInfoPtr pScrnInfo, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + CARD8 *address; + int size, bpp; + + bpp = pScrnInfo->bitsPerPixel >> 3; + + if(pPriv->grabbedByV4L) return BadAlloc; + + if((w > 2046) || (h > 2047)) return BadValue; + + w = (w + 1) & ~1; + pPriv->pitch = ((w << 1) + 63) & ~63; + size = h * pPriv->pitch / bpp; + + pPriv->linear = NVAllocateOverlayMemory(pScrnInfo, pPriv->linear, + size); + + if(!pPriv->linear) return BadAlloc; + + pPriv->offset = pPriv->linear->offset * bpp; + address = pPriv->offset + pNv->FbStart; + + surface->width = w; + surface->height = h; + surface->pScrn = pScrnInfo; + surface->pitches = &pPriv->pitch; + surface->offsets = &pPriv->offset; + surface->devPrivate.ptr = (pointer)pPriv; + + /* grab the video */ + NVStopOverlay(pScrnInfo); + pPriv->videoStatus = 0; + REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip); + pNv->VideoTimerCallback = NULL; + pPriv->grabbedByV4L = TRUE; + + return Success; +} + +static int +NVStopSurface (XF86SurfacePtr surface) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr); + + if(pPriv->grabbedByV4L && pPriv->videoStatus) { + NVStopOverlay(surface->pScrn); + pPriv->videoStatus = 0; + } + + return Success; +} + +static int +NVFreeSurface (XF86SurfacePtr surface) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr); + + if(pPriv->grabbedByV4L) { + NVStopSurface(surface); + NVFreeOverlayMemory(surface->pScrn); + pPriv->grabbedByV4L = FALSE; + } + + return Success; +} + +static int +NVGetSurfaceAttribute ( + ScrnInfoPtr pScrnInfo, + Atom attribute, + INT32 *value +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + + return NVGetPortAttribute(pScrnInfo, attribute, value, (pointer)pPriv); +} + +static int +NVSetSurfaceAttribute( + ScrnInfoPtr pScrnInfo, + Atom attribute, + INT32 value +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + + return NVSetPortAttribute(pScrnInfo, attribute, value, (pointer)pPriv); +} + +static int +NVDisplaySurface ( + XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + RegionPtr clipBoxes +) +{ + ScrnInfoPtr pScrnInfo = surface->pScrn; + NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr); + INT32 xa, xb, ya, yb; + BoxRec dstBox; + + if(!pPriv->grabbedByV4L) return Success; + + if(src_w > (drw_w << 3)) + drw_w = src_w >> 3; + if(src_h > (drw_h << 3)) + drw_h = src_h >> 3; + + /* Clip */ + xa = src_x; + xb = src_x + src_w; + ya = src_y; + yb = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if(!NVClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, + surface->width, surface->height)) + { + return Success; + } + + dstBox.x1 -= pScrnInfo->frameX0; + dstBox.x2 -= pScrnInfo->frameX0; + dstBox.y1 -= pScrnInfo->frameY0; + dstBox.y2 -= pScrnInfo->frameY0; + + pPriv->currentBuffer = 0; + + NVPutOverlayImage (pScrnInfo, surface->offsets[0], surface->id, + surface->pitches[0], &dstBox, xa, xb, ya, yb, + surface->width, surface->height, src_w, src_h, + drw_w, drw_h, clipBoxes); + + return Success; +} + +XF86OffscreenImageRec NVOffscreenImages[2] = +{ + { + &NVImages[0], + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + NVAllocSurface, + NVFreeSurface, + NVDisplaySurface, + NVStopSurface, + NVGetSurfaceAttribute, + NVSetSurfaceAttribute, + 2046, 2047, + NUM_ATTRIBUTES - 1, + &NVAttributes[1] + }, + { + &NVImages[2], + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + NVAllocSurface, + NVFreeSurface, + NVDisplaySurface, + NVStopSurface, + NVGetSurfaceAttribute, + NVSetSurfaceAttribute, + 2046, 2047, + NUM_ATTRIBUTES - 1, + &NVAttributes[1] + }, +}; + +static void +NVInitOffscreenImages (ScreenPtr pScreen) +{ + xf86XVRegisterOffscreenImages(pScreen, NVOffscreenImages, 2); +} + +#endif + + 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 0244f86e8..256aa2f1e 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.19 2001/02/15 11:03:58 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.22 2001/03/31 20:32:13 mvojkovi Exp $ */ #include "nv_include.h" #include "xaalocal.h" @@ -52,13 +52,6 @@ #include "miline.h" -#define DOLINES - -/* - * Macro to define valid rectangle. - */ -#define NV_RECT_VALID(rr) (((rr).x1 < (rr).x2) && ((rr).y1 < (rr).y2)) - static void NVSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2) { @@ -224,6 +217,18 @@ NVSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, } +void +NVResetGraphics(ScrnInfoPtr pScrn) +{ + NVPtr pNv = NVPTR(pScrn); + + if(pNv->NoAccel) return; + + pNv->currentRop = -1; + NVSetRopPattern(pNv, GXcopy); +} + + /* * Synchronise with graphics engine. Make sure it is idle before returning. @@ -319,8 +324,10 @@ NVSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) write_mem_barrier(); } - if (!(--pNv->expandRows)) - RIVA_BUSY(pNv->riva); + if (!(--pNv->expandRows)) { /* hardware bug workaround */ + RIVA_FIFO_FREE(pNv->riva, Blt, 1); + pNv->riva.Blt->TopLeftSrc = 0; + } } static void @@ -330,8 +337,9 @@ NVSubsequentColorExpandScanlineFifo(ScrnInfoPtr pScrn, int bufno) if ( --pNv->expandRows ) { RIVA_FIFO_FREE(pNv->riva, Bitmap, pNv->expandWidth); - } else { - RIVA_BUSY(pNv->riva); + } else { /* hardware bug workaround */ + RIVA_FIFO_FREE(pNv->riva, Blt, 1); + pNv->riva.Blt->TopLeftSrc = 0; } write_mem_barrier(); } @@ -384,8 +392,6 @@ NVSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, NVSubsequentColorExpandScanlineFifo; RIVA_FIFO_FREE(pNv->riva, Bitmap, pNv->expandWidth); } - - RIVA_BUSY(pNv->riva); } @@ -412,8 +418,6 @@ NVSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, pNv->riva.Pixmap->TopLeft = (y << 16) | (x & 0xFFFF); pNv->riva.Pixmap->WidthHeight = (h << 16) | w; pNv->riva.Pixmap->WidthHeightIn = (h << 16) | bw; - - RIVA_BUSY(pNv->riva); } @@ -466,7 +470,6 @@ NVSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) } -#ifdef DOLINES static void NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask) @@ -475,7 +478,6 @@ NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask) NVSetRopSolid(pNv, rop); write_mem_barrier(); - RIVA_FIFO_FREE(pNv->riva, Line, 1); pNv->FgColor = color; } @@ -513,114 +515,6 @@ NVSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, write_mem_barrier(); } -#else - -static void -NVPolylinesThinSolidWrapper( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - DDXPointPtr pPts -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - NVPtr pNv = NVPTR(infoRec->pScrn); - pNv->CurrentGC = pGC; -#ifdef NV_USE_FB - pNv->CurrentDrawable = pDraw; -#endif - if(infoRec->NeedToSync) - RIVA_BUSY(pNv->riva); - XAAPolyLines(pDraw, pGC, mode, npt, pPts); -} - -static void -NVPolySegmentThinSolidWrapper( - DrawablePtr pDraw, - GCPtr pGC, - int nseg, - xSegment *pSeg -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - NVPtr pNv = NVPTR(infoRec->pScrn); - pNv->CurrentGC = pGC; -#ifdef NV_USE_FB - pNv->CurrentDrawable = pDraw; -#endif - if(infoRec->NeedToSync) - RIVA_BUSY(pNv->riva); - XAAPolySegment(pDraw, pGC, nseg, pSeg); -} - - -#define NVSetupForSolidLine NVSetupForSolidFill - -static void -NVSubsequentSolidHorVertLine( - ScrnInfoPtr pScrn, - int x, int y, - int len, int dir -){ - NVPtr pNv = NVPTR(pScrn); - int w, h; - - if(dir == DEGREES_0) { - w = len; h = 1; - } else { - w = 1; h = len; - } - - RIVA_FIFO_FREE(pNv->riva, Bitmap, 2); - pNv->riva.Bitmap->UnclippedRectangle[0].TopLeft = (x << 16) | y; - pNv->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h; - write_mem_barrier(); -} - -#ifndef NV_USE_FB -static void (*LineFuncs[4])() = { - cfbBresS, - cfb16BresS, - NULL, - cfb32BresS -}; -#endif - -static void -NVSubsequentSolidBresenhamLine( - ScrnInfoPtr pScrn, - int x, int y, - int dmaj, int dmin, - int e, int len, int octant -){ - NVPtr pNv = NVPTR(pScrn); -#ifndef NV_USE_FB - cfbPrivGCPtr devPriv; - int Bpp = pScrn->bitsPerPixel >> 3; - - devPriv = cfbGetGCPrivate(pNv->CurrentGC); - - /* you could trap for lines you could do here and accelerate them */ - - (*LineFuncs[Bpp - 1]) - (devPriv->rop, devPriv->and, devPriv->xor, - (unsigned long*)pNv->FbStart, - (pNv->CurrentLayout.displayWidth * Bpp) >> LOG2_BYTES_PER_SCANLINE_PAD, - (octant & XDECREASING) ? -1 : 1, - (octant & YDECREASING) ? -1 : 1, - (octant & YMAJOR) ? Y_AXIS : X_AXIS, - x, y, dmin + e, dmin, dmin - dmaj, len); -#else - fbBres(pNv->CurrentDrawable, pNv->CurrentGC, 0, - (octant & XDECREASING) ? -1 : 1, - (octant & YDECREASING) ? -1 : 1, - (octant & YMAJOR) ? Y_AXIS : X_AXIS, - x, y, dmin + e, dmin, -dmaj, len); -#endif -} - - -#endif - static void NVValidatePolyArc( GCPtr pGC, @@ -733,8 +627,7 @@ NVAccelInit(ScreenPtr pScreen) /* LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X; */ NO_PLANEMASK | NO_TRANSPARENCY | - NO_GXCOPY | - SYNC_AFTER_IMAGE_WRITE; + NO_GXCOPY; infoPtr->SetupForScanlineImageWrite = NVSetupForScanlineImageWrite; infoPtr->SubsequentScanlineImageWriteRect = @@ -746,7 +639,6 @@ NVAccelInit(ScreenPtr pScreen) infoPtr->ScanlineImageWriteBuffers = &pNv->expandBuffer; } -#ifdef DOLINES infoPtr->SolidLineFlags = NO_PLANEMASK; infoPtr->SetupForSolidLine = NVSetupForSolidLine; infoPtr->SubsequentSolidHorVertLine = @@ -757,20 +649,6 @@ NVAccelInit(ScreenPtr pScreen) 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 = - NVSubsequentSolidBresenhamLine; - infoPtr->PolySegmentThinSolid = - NVPolySegmentThinSolidWrapper; - infoPtr->PolylinesThinSolid = - NVPolylinesThinSolidWrapper; -#endif infoPtr->ValidatePolyArc = NVValidatePolyArc; infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c index c4fa1cae8..8cf1971e3 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.11 2001/02/18 23:47:29 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.13 2001/03/28 01:17:43 mvojkovi Exp $ */ #include "nv_local.h" #include "riva_hw.h" @@ -1215,6 +1215,7 @@ static void CalcStateExt state->repaint1 = hDisplaySize < 1280 ? 0x04 : 0x00; break; case NV_ARCH_10: + case NV_ARCH_20: nv10UpdateArbitrationSettings(VClk, pixelDepth * 8, &(state->arbitration0), @@ -1286,6 +1287,7 @@ static void UpdateFifoState chip->Tri05 = (RivaTexturedTriangle05 *)&(chip->FIFO[0x0000E000/4]); break; case NV_ARCH_10: + case NV_ARCH_20: /* * Initialize state for the RivaTriangle3D05 routines. */ @@ -1394,6 +1396,7 @@ static void LoadStateExt chip->PGRAPH[0x0000067C/4] = state->pitch3; break; case NV_ARCH_10: + case NV_ARCH_20: LOAD_FIXED_STATE(nv10,PFIFO); LOAD_FIXED_STATE(nv10,PRAMIN); LOAD_FIXED_STATE(nv10,PGRAPH); @@ -1422,15 +1425,38 @@ static void LoadStateExt chip->Tri03 = 0L; break; } - chip->PGRAPH[0x00000640/4] = state->offset0; - chip->PGRAPH[0x00000644/4] = state->offset1; - chip->PGRAPH[0x00000648/4] = state->offset2; - chip->PGRAPH[0x0000064C/4] = state->offset3; - chip->PGRAPH[0x00000670/4] = state->pitch0; - chip->PGRAPH[0x00000674/4] = state->pitch1; - chip->PGRAPH[0x00000678/4] = state->pitch2; - chip->PGRAPH[0x0000067C/4] = state->pitch3; - chip->PGRAPH[0x00000680/4] = state->pitch3; + + if(chip->Architecture == NV_ARCH_10) { + chip->PGRAPH[0x00000640/4] = state->offset0; + chip->PGRAPH[0x00000644/4] = state->offset1; + chip->PGRAPH[0x00000648/4] = state->offset2; + chip->PGRAPH[0x0000064C/4] = state->offset3; + chip->PGRAPH[0x00000670/4] = state->pitch0; + chip->PGRAPH[0x00000674/4] = state->pitch1; + chip->PGRAPH[0x00000678/4] = state->pitch2; + chip->PGRAPH[0x0000067C/4] = state->pitch3; + chip->PGRAPH[0x00000680/4] = state->pitch3; + } else { + chip->PGRAPH[0x00000820/4] = state->offset0; + chip->PGRAPH[0x00000824/4] = state->offset1; + chip->PGRAPH[0x00000828/4] = state->offset2; + chip->PGRAPH[0x0000082C/4] = state->offset3; + chip->PGRAPH[0x00000850/4] = state->pitch0; + chip->PGRAPH[0x00000854/4] = state->pitch1; + chip->PGRAPH[0x00000858/4] = state->pitch2; + chip->PGRAPH[0x0000085C/4] = state->pitch3; + chip->PGRAPH[0x00000860/4] = state->pitch3; + chip->PGRAPH[0x00000864/4] = state->pitch3; + chip->PGRAPH[0x000009A4/4] = chip->PFB[0x00000200/4]; + chip->PGRAPH[0x000009A8/4] = chip->PFB[0x00000204/4]; + } + chip->PMC[0x00008704/4] = 1; + chip->PMC[0x00008140/4] = 0; + chip->PMC[0x00008920/4] = 0; + chip->PMC[0x00008924/4] = 0; + chip->PMC[0x00008908/4] = 0x01ffffff; + chip->PMC[0x0000890C/4] = 0x01ffffff; + chip->PGRAPH[0x00000B00/4] = chip->PFB[0x00000240/4]; chip->PGRAPH[0x00000B04/4] = chip->PFB[0x00000244/4]; chip->PGRAPH[0x00000B08/4] = chip->PFB[0x00000248/4]; @@ -1608,6 +1634,7 @@ static void UnloadStateExt state->pitch3 = chip->PGRAPH[0x0000067C/4]; break; case NV_ARCH_10: + case NV_ARCH_20: state->offset0 = chip->PGRAPH[0x00000640/4]; state->offset1 = chip->PGRAPH[0x00000644/4]; state->offset2 = chip->PGRAPH[0x00000648/4]; @@ -1971,6 +1998,7 @@ int RivaGetConfig nv4GetConfig(chip); break; case NV_ARCH_10: + case NV_ARCH_20: nv10GetConfig(chip); break; default: diff --git a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h index 71f29dc00..f0eaf6a5a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.9 2001/02/15 11:03:58 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.10 2001/02/21 00:42:58 mvojkovi Exp $ */ #ifndef __RIVA_HW_H__ #define __RIVA_HW_H__ #define RIVA_SW_VERSION 0x00010003 @@ -47,6 +47,7 @@ #define NV_ARCH_03 0x03 #define NV_ARCH_04 0x04 #define NV_ARCH_10 0x10 +#define NV_ARCH_20 0x20 /***************************************************************************\ * * * FIFO registers. * 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 8bd563fcf..7b5c750eb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h @@ -36,9 +36,8 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.6 2000/08/11 05:04:08 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.7 2001/02/21 00:42:58 mvojkovi Exp $ */ -#define NV_NEW /* * RIVA Fixed Functionality Init Tables. @@ -64,9 +63,7 @@ static unsigned RivaTableFIFO[][2] = {0x00001800, 0x80000010}, {0x00002000, 0x80000011}, {0x00002800, 0x80000012}, -#ifdef NV_NEW {0x00003000, 0x80000016}, -#endif {0x00003800, 0x80000013} }; static unsigned nv3TablePFIFO[][2] = @@ -172,10 +169,8 @@ static unsigned nv3TablePRAMIN[][2] = {0x00000249, 0x00CC0346}, {0x0000024C, 0x80000013}, {0x0000024D, 0x00D70347}, -#ifdef NV_NEW {0x00000258, 0x80000016}, {0x00000259, 0x00CA034C}, -#endif {0x00000D05, 0x00000000}, {0x00000D06, 0x00000000}, {0x00000D07, 0x00000000}, @@ -212,13 +207,10 @@ static unsigned nv3TablePRAMIN[][2] = {0x00000D2C, 0x10830200}, {0x00000D2D, 0x00000000}, {0x00000D2E, 0x00000000}, - {0x00000D2F, 0x00000000} -#ifdef NV_NEW - , + {0x00000D2F, 0x00000000}, {0x00000D31, 0x00000000}, {0x00000D32, 0x00000000}, {0x00000D33, 0x00000000} -#endif }; static unsigned nv3TablePRAMIN_8BPP[][2] = { @@ -230,11 +222,8 @@ static unsigned nv3TablePRAMIN_8BPP[][2] = {0x00000D10, 0x10118203}, {0x00000D14, 0x10110203}, {0x00000D18, 0x10110203}, - {0x00000D1C, 0x10419208} -#ifdef NV_NEW - , + {0x00000D1C, 0x10419208}, {0x00000D30, 0x10118203} -#endif }; static unsigned nv3TablePRAMIN_15BPP[][2] = { @@ -246,11 +235,8 @@ static unsigned nv3TablePRAMIN_15BPP[][2] = {0x00000D10, 0x10118200}, {0x00000D14, 0x10110200}, {0x00000D18, 0x10110200}, - {0x00000D1C, 0x10419208} -#ifdef NV_NEW - , + {0x00000D1C, 0x10419208}, {0x00000D30, 0x10118200} -#endif }; static unsigned nv3TablePRAMIN_32BPP[][2] = { @@ -262,11 +248,8 @@ static unsigned nv3TablePRAMIN_32BPP[][2] = {0x00000D10, 0x10118201}, {0x00000D14, 0x10110201}, {0x00000D18, 0x10110201}, - {0x00000D1C, 0x10419208} -#ifdef NV_NEW - , + {0x00000D1C, 0x10419208}, {0x00000D30, 0x10118201} -#endif }; static unsigned nv4TableFIFO[][2] = { @@ -390,10 +373,8 @@ static unsigned nv4TablePRAMIN[][2] = {0x00000009, 0x80011149}, {0x0000000A, 0x80000015}, {0x0000000B, 0x8001114A}, -#ifdef NV_NEW {0x0000000C, 0x80000016}, {0x0000000D, 0x8001114F}, -#endif {0x00000020, 0x80000000}, {0x00000021, 0x80011142}, {0x00000022, 0x80000001}, @@ -461,13 +442,10 @@ static unsigned nv4TablePRAMIN[][2] = {0x00000537, 0x00000000}, {0x00000538, 0x0000005B}, {0x0000053A, 0x11401140}, - {0x0000053B, 0x00000000} -#ifdef NV_NEW - , + {0x0000053B, 0x00000000}, {0x0000053C, 0x0300A01C}, {0x0000053E, 0x11401140}, {0x0000053F, 0x00000000} -#endif }; static unsigned nv4TablePRAMIN_8BPP[][2] = { @@ -482,11 +460,8 @@ static unsigned nv4TablePRAMIN_8BPP[][2] = {0x0000052D, 0x00000302}, {0x0000052E, 0x00000302}, {0x00000535, 0x00000000}, - {0x00000539, 0x00000000} -#ifdef NV_NEW - , + {0x00000539, 0x00000000}, {0x0000053D, 0x00000302} -#endif }; static unsigned nv4TablePRAMIN_15BPP[][2] = { @@ -501,11 +476,8 @@ static unsigned nv4TablePRAMIN_15BPP[][2] = {0x0000052D, 0x00000902}, {0x0000052E, 0x00000902}, {0x00000535, 0x00000702}, - {0x00000539, 0x00000702} -#ifdef NV_NEW - , + {0x00000539, 0x00000702}, {0x0000053D, 0x00000902} -#endif }; static unsigned nv4TablePRAMIN_16BPP[][2] = { @@ -520,11 +492,8 @@ static unsigned nv4TablePRAMIN_16BPP[][2] = {0x0000052D, 0x00000C02}, {0x0000052E, 0x00000C02}, {0x00000535, 0x00000702}, - {0x00000539, 0x00000702} -#ifdef NV_NEW - , + {0x00000539, 0x00000702}, {0x0000053D, 0x00000C02} -#endif }; static unsigned nv4TablePRAMIN_32BPP[][2] = { @@ -539,11 +508,8 @@ static unsigned nv4TablePRAMIN_32BPP[][2] = {0x0000052D, 0x00000E02}, {0x0000052E, 0x00000E02}, {0x00000535, 0x00000E02}, - {0x00000539, 0x00000E02} -#ifdef NV_NEW - , + {0x00000539, 0x00000E02}, {0x0000053D, 0x00000E02} -#endif }; static unsigned nv10TableFIFO[][2] = { @@ -856,10 +822,8 @@ static unsigned nv10TablePRAMIN[][2] = {0x00000009, 0x80011149}, {0x0000000A, 0x80000015}, {0x0000000B, 0x8001114A}, -#ifdef NV_NEW {0x0000000C, 0x80000016}, {0x0000000D, 0x80011150}, -#endif {0x00000020, 0x80000000}, {0x00000021, 0x80011142}, {0x00000022, 0x80000001}, @@ -932,13 +896,10 @@ static unsigned nv10TablePRAMIN[][2] = {0x0000053B, 0x00000000}, {0x0000053C, 0x00000093}, {0x0000053E, 0x11401140}, - {0x0000053F, 0x00000000} -#ifdef NV_NEW - , + {0x0000053F, 0x00000000}, {0x00000540, 0x0300A01C}, {0x00000542, 0x11401140}, {0x00000543, 0x00000000} -#endif }; static unsigned nv10TablePRAMIN_8BPP[][2] = { @@ -954,11 +915,8 @@ static unsigned nv10TablePRAMIN_8BPP[][2] = {0x0000052E, 0x00000302}, {0x00000535, 0x00000000}, {0x00000539, 0x00000000}, - {0x0000053D, 0x00000000} -#ifdef NV_NEW - , + {0x0000053D, 0x00000000}, {0x00000541, 0x00000302} -#endif }; static unsigned nv10TablePRAMIN_15BPP[][2] = { @@ -974,11 +932,8 @@ static unsigned nv10TablePRAMIN_15BPP[][2] = {0x0000052E, 0x00000902}, {0x00000535, 0x00000902}, {0x00000539, 0x00000902}, - {0x0000053D, 0x00000902} -#ifdef NV_NEW - , + {0x0000053D, 0x00000902}, {0x00000541, 0x00000902} -#endif }; static unsigned nv10TablePRAMIN_16BPP[][2] = { @@ -994,11 +949,8 @@ static unsigned nv10TablePRAMIN_16BPP[][2] = {0x0000052E, 0x00000C02}, {0x00000535, 0x00000C02}, {0x00000539, 0x00000C02}, - {0x0000053D, 0x00000C02} -#ifdef NV_NEW - , + {0x0000053D, 0x00000C02}, {0x00000541, 0x00000C02} -#endif }; static unsigned nv10TablePRAMIN_32BPP[][2] = { @@ -1014,10 +966,7 @@ static unsigned nv10TablePRAMIN_32BPP[][2] = {0x0000052E, 0x00000E02}, {0x00000535, 0x00000E02}, {0x00000539, 0x00000E02}, - {0x0000053D, 0x00000E02} -#ifdef NV_NEW - , + {0x0000053D, 0x00000E02}, {0x00000541, 0x00000E02} -#endif }; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c index b31a08d26..0d6e8723f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.5 2001/02/13 21:15:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.6 2001/03/03 22:26:12 tsi Exp $ */ /* * @@ -15,7 +15,6 @@ * */ -#include <math.h> #include "Xarch.h" #include "xaalocal.h" #include "xaarop.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c index ba7cf5adc..0be456c2e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.11 2001/02/15 20:00:19 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.12 2001/03/08 17:12:11 eich Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -1315,6 +1315,8 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(shadowSymbols, NULL); } + SavageUnmapMem(pScrn, 1); + return TRUE; } @@ -2040,6 +2042,9 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, pScrn = xf86Screens[pScreen->myNum]; psav = SAVPTR(pScrn); + if (!SavageMapMMIO(pScrn)) + return FALSE; + SavageEnableMMIO(pScrn); if (!SavageMapFB(pScrn)) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h index 6c48ddf9f..3061d60fa 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h @@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.3 2001/02/15 18:20:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.4 2001/03/03 22:26:13 tsi Exp $ */ #ifndef _SMI_H #define _SMI_H @@ -63,19 +63,19 @@ authorization from the XFree86 Project and Silicon Motion. #endif /******************************************************************************/ -/* D E F I N I T O N S */ +/* D E F I N I T I O N S */ /******************************************************************************/ #ifndef SMI_DEBUG - #define SMI_DEBUG 0 + #define SMI_DEBUG 0 #endif #define SMI_USE_IMAGE_WRITES 0 -#define SMI_USE_VIDEO 1 -#define SMI_USE_CAPTURE 1 +#define SMI_USE_VIDEO 1 +#define SMI_USE_CAPTURE 1 /******************************************************************************/ -/* S T R U C T U R E S */ +/* S T R U C T U R E S */ /******************************************************************************/ /* Driver data structure; this should contain all needed info for a mode */ @@ -100,116 +100,142 @@ typedef struct typedef struct { /* accel additions */ - CARD32 AccelCmd; /* Value for DPR0C */ - CARD32 Stride; /* Stride of frame buffer */ - CARD32 ScissorsLeft; /* Left/top of current scissors */ - CARD32 ScissorsRight; /* Right/bottom of current scissors */ - Bool ClipTurnedOn; /* Clipping was turned on by the - previous command */ - - CARD8 SR18Value; /* PDR#521: original SR18 value */ - CARD8 SR21Value; /* PDR#521: original SR21 value */ - SMIRegRec SavedReg; /* console saved mode registers */ - SMIRegRec ModeReg; /* XServer video state mode registers */ - xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */ - - Bool ModeStructInit; /* Flag indicating ModeReg has been * - * duped from console state */ - int vgaCRIndex, vgaCRReg; - int width, height; /* Width and height of the screen */ - int Bpp; /* Bytes per pixel */ + CARD32 AccelCmd; /* Value for DPR0C */ + CARD32 Stride; /* Stride of frame buffer */ + CARD32 ScissorsLeft; /* Left/top of current + scissors */ + CARD32 ScissorsRight; /* Right/bottom of current + scissors */ + Bool ClipTurnedOn; /* Clipping was turned on by + the previous command */ + CARD8 SR18Value; /* PDR#521: original SR18 + value */ + CARD8 SR21Value; /* PDR#521: original SR21 + value */ + SMIRegRec SavedReg; /* console saved mode + registers */ + SMIRegRec ModeReg; /* XServer video state mode + registers */ + xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */ + + Bool ModeStructInit; /* Flag indicating ModeReg has + been duped from console + state */ + int vgaCRIndex, vgaCRReg; + int width, height; /* Width and height of the + screen */ + int Bpp; /* Bytes per pixel */ /* XAA */ - int videoRAMBytes; /* In units as noted, set in PreInit */ - int videoRAMKBytes; /* In units as noted, set in PreInit */ - unsigned char * MapBase; /* Base of mapped memory */ - int MapSize; /* Size of mapped memory */ - CARD8 * DPRBase; /* Base of DPR registers */ - CARD8 * VPRBase; /* Base of VPR registers */ - CARD8 * CPRBase; /* Base of CPR registers */ - CARD8 * DataPortBase; /* Base of data port */ - int DataPortSize; /* Size of data port */ - volatile CARD8 *IOBase; /* Base of MMIO VGA ports */ - unsigned char * FBBase; /* Base of FB */ - CARD32 FBOffset; /* Current visual FB starting * - * location */ - CARD32 FBCursorOffset; /* Cursor storage location */ - CARD32 FBReserved; /* Reserved memory in frame buffer */ + int videoRAMBytes; /* In units as noted, set in + PreInit */ + int videoRAMKBytes; /* In units as noted, set in + PreInit */ + unsigned char * MapBase; /* Base of mapped memory */ + int MapSize; /* Size of mapped memory */ + CARD8 * DPRBase; /* Base of DPR registers */ + CARD8 * VPRBase; /* Base of VPR registers */ + CARD8 * CPRBase; /* Base of CPR registers */ + CARD8 * DataPortBase; /* Base of data port */ + int DataPortSize; /* Size of data port */ + CARD8 * IOBase; /* Base of MMIO VGA ports */ + unsigned char * FBBase; /* Base of FB */ + CARD32 FBOffset; /* Current visual FB starting + location */ + CARD32 FBCursorOffset; /* Cursor storage location */ + CARD32 FBReserved; /* Reserved memory in frame + buffer */ - Bool PrimaryVidMapped; /* Flag indicating if vgaHWMapMem was * - * used successfully for this screen */ - int dacSpeedBpp; /* Clock value */ - int minClock; /* Mimimum clock */ - int maxClock; /* Maximum clock */ - int MCLK; /* Memory Clock */ - int GEResetCnt; /* Limit the number of errors printed * - * using a counter */ - - Bool pci_burst; /* Enable PCI burst mode for reads? */ - Bool NoPCIRetry; /* Diasable PCI retries */ - Bool fifo_conservative; /* Adjust fifo for acceleration? */ - Bool fifo_moderate; /* Adjust fifo for acceleration? */ - Bool fifo_aggressive; /* Adjust fifo for acceleration? */ - Bool NoAccel; /* Disable Acceleration */ - Bool hwcursor; /* hardware cursor enabled */ - Bool ShowCache; /* Debugging option */ - Bool useBIOS; /* USe BIOS for mode sets */ - Bool zoomOnLCD; /* Zoom on LCD */ + Bool PrimaryVidMapped; /* Flag indicating if + vgaHWMapMem was used + successfully for + this screen */ + int dacSpeedBpp; /* Clock value */ + int minClock; /* Mimimum clock */ + int maxClock; /* Maximum clock */ + int MCLK; /* Memory Clock */ + int GEResetCnt; /* Limit the number of errors + printed using a counter */ + + Bool pci_burst; /* Enable PCI burst mode for + reads? */ + Bool NoPCIRetry; /* Disable PCI retries */ + Bool fifo_conservative; /* Adjust fifo for + acceleration? */ + Bool fifo_moderate; /* Adjust fifo for + acceleration? */ + Bool fifo_aggressive; /* Adjust fifo for + acceleration? */ + Bool NoAccel; /* Disable Acceleration */ + Bool hwcursor; /* hardware cursor enabled */ + Bool ShowCache; /* Debugging option */ + Bool useBIOS; /* Use BIOS for mode sets */ + Bool zoomOnLCD; /* Zoom on LCD */ - CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped * - * CloseScreen function. */ - XAAInfoRecPtr AccelInfoRec; /* XAA info Rec */ - pciVideoPtr PciInfo; /* PCI info vars. */ + CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped + CloseScreen function */ + XAAInfoRecPtr AccelInfoRec; /* XAA info Rec */ + pciVideoPtr PciInfo; /* PCI info vars */ PCITAG PciTag; - int Chipset; /* Chip info, set using PCI above. */ - int ChipRev; + int Chipset; /* Chip info, set using PCI + above */ + int ChipRev; /* DGA */ - DGAModePtr DGAModes; /* Pointer to DGA modes */ - int numDGAModes; /* Number of DGA modes */ - Bool DGAactive; /* Flag if DGA is active */ - int DGAViewportStatus; /* DGA Viewport status */ + DGAModePtr DGAModes; /* Pointer to DGA modes */ + int numDGAModes; /* Number of DGA modes */ + Bool DGAactive; /* Flag if DGA is active */ + int DGAViewportStatus; /* DPMS */ - int CurrentDPMS; /* Current DPMS state */ - unsigned char DPMS_SR20; /* Saved DPMS SR20 register */ - unsigned char DPMS_SR21; /* Saved DPMS SR21 register */ - unsigned char DPMS_SR31; /* Saved DPMS SR31 register */ - unsigned char DPMS_SR34; /* Saved DPMS SR34 register */ + int CurrentDPMS; /* Current DPMS state */ + unsigned char DPMS_SR20; /* Saved DPMS SR20 register */ + unsigned char DPMS_SR21; /* Saved DPMS SR21 register */ + unsigned char DPMS_SR31; /* Saved DPMS SR31 register */ + unsigned char DPMS_SR34; /* Saved DPMS SR34 register */ /* Panel information */ - Bool lcd; /* LCD active, 1=DSTN, 2=TFT */ - int lcdWidth; /* LCD width */ - int lcdHeight; /* LCD height */ + Bool lcd; /* LCD active, 1=DSTN, 2=TFT */ + int lcdWidth; /* LCD width */ + int lcdHeight; /* LCD height */ - I2CBusPtr I2C; /* Pointer to I2C module */ - xf86Int10InfoPtr pInt; /* Pointer to INT10 module */ - vbeInfoPtr pVbe; /* Pointer to VBE module */ + I2CBusPtr I2C; /* Pointer into I2C module */ + xf86Int10InfoPtr pInt; /* Pointer to INT10 module */ + vbeInfoPtr pVbe; /* Pointer to VBE module */ /* Shadow frame buffer (rotation) */ - Bool shadowFB; /* Flag if shadow buffer is used */ - int rotate; /* Rotation flags */ - int ShadowPitch; /* Pitch of shadow buffer */ - int ShadowWidthBytes; /* Width of shadow buffer in bytes */ - int ShadowWidth; /* Width of shadow buffer in pixels */ - int ShadowHeight; /* Height of shadow buffer in pixels */ - CARD32 saveBufferSize; /* #670 - FB save buffer size */ - void * pSaveBuffer; /* #670 - FB save buffer */ - CARD32 savedFBOffset; /* #670 - Saved FBOffset value */ - CARD32 savedFBReserved; /* #670 - Saved FBReserved value */ - CARD8 * paletteBuffer; /* #920 - Palette save buffer */ + Bool shadowFB; /* Flag if shadow buffer is + used */ + int rotate; /* Rotation flags */ + int ShadowPitch; /* Pitch of shadow buffer */ + int ShadowWidthBytes; /* Width of shadow + buffer in bytes */ + int ShadowWidth; /* Width of shadow buffer in + pixels */ + int ShadowHeight; /* Height of shadow buffer in + pixels */ + CARD32 saveBufferSize; /* #670 - FB save buffer size */ + void * pSaveBuffer; /* #670 - FB save buffer */ + CARD32 savedFBOffset; /* #670 - Saved FBOffset value */ + CARD32 savedFBReserved; /* #670 - Saved + FBReserved value */ + CARD8 * paletteBuffer; /* #920 - Palette save buffer */ /* Polylines - #671 */ - ValidateGCProcPtr ValidatePolylines;/* Org. ValidatePolylines function */ - Bool polyLines; /* Our polylines patch is active */ + ValidateGCProcPtr ValidatePolylines; /* Org. + ValidatePolylines + function */ + Bool polyLines; /* Our polylines patch is + active */ void (*PointerMoved)(int index, int x, int y); #ifdef XvExtension - int videoKey; /* Video chroma key */ - Bool ByteSwap; /* Byte swap for ZV port */ + int videoKey; /* Video chroma key */ + Bool ByteSwap; /* Byte swap for ZV port */ /* XvExtension */ - XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter structure */ + XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter + structure */ void (*BlockHandler)(int i, pointer blockData, pointer pTimeout, pointer pReadMask); #endif @@ -219,7 +245,7 @@ typedef struct #define SMIPTR(p) ((SMIPtr)((p)->driverPrivate)) /******************************************************************************/ -/* M A C R O S */ +/* M A C R O S */ /******************************************************************************/ #if SMI_DEBUG @@ -243,51 +269,54 @@ typedef struct #include "regsmi.h" #if !defined (MetroLink) && !defined (VertDebug) -#define VerticalRetraceWait() \ -do \ -{ \ - if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \ - { \ - while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ - while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) ; \ - while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ - } \ +#define VerticalRetraceWait() \ +do \ +{ \ + if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \ + { \ + while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00); \ + while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08); \ + while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00); \ + } \ } while (0) #else #define SPIN_LIMIT 1000000 -#define VerticalRetraceWait() -do \ -{ \ - if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \ - { \ - volatile unsigned long _spin_me; \ - for (_spin_me = SPIN_LIMIT; \ - ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me; \ - _spin_me--) ; \ - if (!_spin_me) \ - ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ - for (_spin_me = SPIN_LIMIT; \ - ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) && _spin_me; \ - _spin_me--) ; \ - if (!_spin_me) \ - ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ - for (_spin_me = SPIN_LIMIT; \ - ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me; \ - _spin_me--) ; \ - if (!_spin_me) \ - ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ - } \ +#define VerticalRetraceWait() \ +do \ +{ \ + if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \ + { \ + volatile unsigned long _spin_me; \ + for (_spin_me = SPIN_LIMIT; \ + ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && \ + _spin_me; \ + _spin_me--); \ + if (!_spin_me) \ + ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ + for (_spin_me = SPIN_LIMIT; \ + ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) && \ + _spin_me; \ + _spin_me--); \ + if (!_spin_me) \ + ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ + for (_spin_me = SPIN_LIMIT; \ + ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && \ + _spin_me; \ + _spin_me--); \ + if (!_spin_me) \ + ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ + } \ } while (0) #endif /******************************************************************************/ -/* F U N C T I O N P R O T O T Y P E S */ +/* F U N C T I O N P R O T O T Y P E S */ /******************************************************************************/ /* smi_dac.c */ void SMI_CommonCalcClock(long freq, int min_m, int min_n1, int max_n1, - int min_n2, int max_n2, long freq_min, long freq_max, - unsigned char * mdiv, unsigned char * ndiv); + int min_n2, int max_n2, long freq_min, long freq_max, + unsigned char * mdiv, unsigned char * ndiv); /* smi_i2c */ Bool SMI_I2CInit(ScrnInfoPtr pScrn); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c index 68257cda5..9a583f336 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c @@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project or Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.9 2001/02/15 18:20:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.10 2001/03/08 17:12:12 eich Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -1578,7 +1578,7 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore) VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E, restore->CR90[14] & ~0x20); - VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33_2); + VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33); VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x3A, restore->CR3A); for (i = 0; i < 14; i++) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c index 323f78c57..b2f8d698f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c @@ -26,9 +26,9 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.2 2001/03/03 22:26:13 tsi Exp $ */ -#include <cursorstr.h> +#include "cursorstr.h" #include "smi.h" #define MAX_CURSOR 32 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c index 9022ba330..ff6a713aa 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c @@ -26,7 +26,7 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.3 2001/02/15 18:20:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.4 2001/03/03 22:26:13 tsi Exp $ */ #include "smi.h" #include "smi_video.h" @@ -36,9 +36,9 @@ authorization from the XFree86 Project and silicon Motion. #if defined(XvExtension) && SMI_USE_VIDEO -#include <dixstruct.h> -#include <xaa.h> -#include <xaalocal.h> +#include "dixstruct.h" +#include "xaa.h" +#include "xaalocal.h" static XF86VideoAdaptorPtr SMI_SetupVideo(ScreenPtr pScreen); static void SMI_ResetVideo(ScrnInfoPtr pScrn); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h index 3d4729994..7334c49a5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h @@ -26,12 +26,12 @@ Silicon Motion shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.1 2000/11/28 20:59:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.2 2001/03/03 22:26:13 tsi Exp $ */ #ifndef _SMI_VIDEO_H #define _SMI_VIDEO_H -#include <fourcc.h> +#include "fourcc.h" #define SMI_VIDEO_VIDEO 0 #define SMI_VIDEO_IMAGE 1 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c index ce0f2b0cb..821ced5c4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.5 2000/12/14 02:51:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.6 2001/03/03 22:26:13 tsi Exp $ */ /* * @@ -14,21 +14,20 @@ #define DEBUG #endif -#include <xf86.h> -#include <xf86_OSproc.h> -#include <xf86_ansic.h> -#include <xf86_libc.h> +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" -#include <xf86PciInfo.h> -#include <xf86Pci.h> +#include "xf86PciInfo.h" +#include "xf86Pci.h" -#include <compiler.h> +#include "compiler.h" -#include <miline.h> +#include "miline.h" -#include <xaa.h> -#include <xaalocal.h> -#include <xf86fbman.h> +#include "xaa.h" +#include "xaalocal.h" +#include "xf86fbman.h" #include "sis.h" #include "sis300_accel.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c index b41d5061e..32aa40415 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.9 2000/12/21 12:22:57 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.10 2001/03/21 17:02:25 dawes Exp $ */ /* modified from tdfx_dri.c, mga_dri.c */ @@ -194,9 +194,9 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n", + "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n", major, minor, patch); return FALSE; } @@ -262,6 +262,9 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = SISDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) { xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate=0; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h index 32d477566..75e4646db 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h @@ -1,11 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.2 2000/08/04 03:51:46 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.3 2001/03/03 22:26:13 tsi Exp $ */ /* modified from tdfx_dri.h */ #ifndef _SIS_DRI_ #define _SIS_DRI_ -#include <xf86drm.h> +#include "xf86drm.h" #define SIS_MAX_DRAWABLES 256 #define SISIOMAPSIZE (64*1024) 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 08e6e5ab9..c4deecbed 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.58 2001/01/21 21:19:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.59 2001/03/06 17:07:40 dawes Exp $ */ #include "fb.h" @@ -621,7 +621,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * Our preference for depth 24 is 24bpp, so tell it that too. */ pix24flags = Support32bppFb | Support24bppFb | - SupportConvert24to32 | SupportConvert32to24; + SupportConvert24to32 | SupportConvert32to24 | + PreferConvert32to24; if (!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) { return FALSE; @@ -1426,7 +1427,9 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #endif - SISInitVideo(pScreen); + if (pSiS->Chipset == PCI_CHIP_SIS630) { + SISInitVideo(pScreen); + } pSiS->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = SISCloseScreen; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h index 04df5dd5c..8d96e3d20 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h @@ -20,7 +20,7 @@ * 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/suncg14/cg14.h,v 1.1 2000/06/30 17:15:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h,v 1.2 2001/03/03 22:41:33 tsi Exp $ */ #ifndef CG14_H #define CG14_H @@ -64,8 +64,10 @@ typedef struct { #define GET_CG14_FROM_SCRN(p) ((Cg14Ptr)((p)->driverPrivate)) -#ifdef linux +/* + * This should match corresponding definition in Solaris's + * '/usr/include/sys/cg14io.h'. + */ #define CG14_SET_PIXELMODE (('M' << 8) | 3) -#endif #endif /* CG14_H */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile index 1a2d2e475..763d8916a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the ffb driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile,v 1.5 2001/01/24 00:06:30 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile,v 1.6 2001/03/03 22:41:34 tsi Exp $ #define IHaveModules #include <Server.tmpl> @@ -19,27 +19,36 @@ VISOPTIONS = -DUSE_VIS ASVISOPTION = AsVISOption GCCVISOPTION = -Wa,$(ASVISOPTION) #if AsOutputArchSize == 32 -#define FFBCObjectRule(name) @@\ -name.o: name.c @@\ - ObjectCompile(-mv8 -mtune=ultrasparc $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\ - dd if=/dev/zero bs=1 count=3 | dd of=$@ bs=1 count=3 seek=36 conv=notrunc @@\ - echo -e '\002' | dd of=$@ bs=1 count=1 seek=19 conv=notrunc @@\ - @@\ -name.i: name.c @@\ - CPPOnlyCompile(name.c,-mv8 $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\ - @@\ -CenterLoadTarget(debug_src,name.c,NullParameter,$(ALLDEFINES) -mv8 $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) -#define FFBsObjectRule(name) @@\ -name.o: name.s @@\ - $(RM) $@ @@\ - $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - @@\ - dd if=/dev/zero bs=1 count=3 | dd of=$@ bs=1 count=3 seek=36 conv=notrunc @@\ - echo -e '\002' | dd of=$@ bs=1 count=1 seek=19 conv=notrunc +#define FFBCObjectRule(name) @@\ +name.o: name.c @@\ + ObjectCompile(-mv8 -mtune=ultrasparc \ + $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\ + dd if=/dev/zero bs=1 count=3 2>/dev/null | \ + dd of=$@ bs=1 count=3 seek=36 conv=notrunc 2>/dev/null @@\ + dd if=/dev/zero bs=1 count=1 2>/dev/null | \ + tr '\000' '\002' | \ + dd of=$@ bs=1 count=1 seek=19 conv=notrunc 2>/dev/null @@\ + @@\ +name.i: name.c @@\ + CPPOnlyCompile(name.c,-mv8 \ + $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\ + @@\ +CenterLoadTarget(debug_src,name.c,NullParameter,$(ALLDEFINES) -mv8 \ + $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) +#define FFBsObjectRule(name) @@\ +name.o: name.s @@\ + $(RM) $@ @@\ + $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - @@\ + dd if=/dev/zero bs=1 count=3 2>/dev/null | \ + dd of=$@ bs=1 count=3 seek=36 conv=notrunc 2>/dev/null @@\ + dd if=/dev/zero bs=1 count=1 2>/dev/null | \ + tr '\000' '\002' | \ + dd of=$@ bs=1 count=1 seek=19 conv=notrunc 2>/dev/null #else #define FFBCObjectRule(name) SpecialCObjectRule(name,,$(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) -#define FFBsObjectRule(name) @@\ -name.o: name.s @@\ - $(RM) $@ @@\ +#define FFBsObjectRule(name) @@\ +name.o: name.s @@\ + $(RM) $@ @@\ $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - #endif #else @@ -50,16 +59,17 @@ ASVISOPTION = #define FFBsObjectRule(name) #endif -SRCS = ffb_driver.c ffb_accel.c ffb_attr.c ffb_stip.c ffb_bcopy.c ffb_cplane.c \ - ffb_fspans.c ffb_point.c ffb_seg.c ffb_plygon.c ffb_line.c ffb_glyph.c \ - ffb_frect.c ffb_circle.c ffb_checks.c ffb_stubs.c ffb_gc.c \ - ffb_gspans.c ffb_sspans.c ffb_zeroarc.c ffb_cursor.c ffb_dga.c ffb_dac.c \ - ffb_wid.c ffb_dbe.c $(DRISRCS) -OBJS = ffb_driver.o ffb_accel.o ffb_attr.o ffb_stip.o ffb_bcopy.o ffb_cplane.o \ - ffb_fspans.o ffb_point.o ffb_seg.o ffb_plygon.o ffb_line.o ffb_glyph.o \ - ffb_frect.o ffb_circle.o ffb_checks.o ffb_stubs.o ffb_gc.o \ - ffb_gspans.o ffb_sspans.o ffb_zeroarc.o ffb_cursor.o ffb_dga.o ffb_dac.o \ - ffb_wid.o ffb_dbe.o $(VISOBJS) $(DRIOBJS) +SRCS = ffb_driver.c ffb_accel.c ffb_attr.c ffb_stip.c ffb_bcopy.c \ + ffb_cplane.c ffb_fspans.c ffb_point.c ffb_seg.c ffb_plygon.c \ + ffb_line.c ffb_glyph.c ffb_frect.c ffb_circle.c ffb_checks.c \ + ffb_stubs.c ffb_gc.c ffb_gspans.c ffb_sspans.c ffb_zeroarc.c \ + ffb_cursor.c ffb_dga.c ffb_dac.c ffb_wid.c ffb_dbe.c $(DRISRCS) +OBJS = ffb_driver.o ffb_accel.o ffb_attr.o ffb_stip.o ffb_bcopy.o \ + ffb_cplane.o ffb_fspans.o ffb_point.o ffb_seg.o ffb_plygon.o \ + ffb_line.o ffb_glyph.o ffb_frect.o ffb_circle.o ffb_checks.o \ + ffb_stubs.o ffb_gc.o ffb_gspans.o ffb_sspans.o ffb_zeroarc.o \ + ffb_cursor.o ffb_dga.o ffb_dac.o ffb_wid.o ffb_dbe.o $(VISOBJS) \ + $(DRIOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h index 1a93ec075..5848ecb6e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h @@ -24,7 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.5 2000/12/01 00:24:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.6 2001/03/03 22:41:34 tsi Exp $ */ #ifndef FFB_H #define FFB_H @@ -290,8 +290,6 @@ extern int CreatorWindowPrivateIndex; #ifdef DEBUG_FFB -#include <stdio.h> - extern FILE *FDEBUG_FD; static __inline__ void FFB_DEBUG_init(void) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c index 587debf36..b8ce88b5d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c @@ -24,10 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c,v 1.4 2000/12/01 00:24:34 dawes Exp $ */ - -#include <asm/types.h> -#include <math.h> +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c,v 1.5 2001/03/03 22:41:34 tsi Exp $ */ #include "scrnintstr.h" #include "pixmapstr.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c index aded7f96f..78abdf2f0 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c,v 1.2 2000/06/30 17:15:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c,v 1.3 2001/04/05 17:42:33 dawes Exp $ */ #include "ffb.h" #include "ffb_rcache.h" @@ -348,6 +348,9 @@ init_dac_flags(FFBPtr pFfb) unsigned int did, manuf_rev, partnum; char *device; + /* Fetch kernel WID. */ + p->kernel_wid = *((volatile unsigned char *)pFfb->dfb8x); + /* For AFB, assume it is PAC2 which also implies not having * the inverted cursor control attribute. */ @@ -425,7 +428,9 @@ static void restore_kernel_xchannel(FFBPtr pFfb) { ffb_fbcPtr ffb = pFfb->regs; - unsigned int fbc, ppc, ppc_mask, drawop; + unsigned int fbc, ppc, ppc_mask, drawop, wid; + + wid = pFfb->dac_info.kernel_wid; if (pFfb->has_double_buffer) fbc = FFB_FBC_WB_AB; @@ -443,7 +448,7 @@ restore_kernel_xchannel(FFBPtr pFfb) FFB_ATTR_RAW(pFfb, ppc, ppc_mask, ~0, (FFB_ROP_EDIT_BIT | GXcopy)|(FFB_ROP_NEW<<8), - drawop, 0x0, fbc, 0xff); + drawop, 0x0, fbc, wid); FFBFifo(pFfb, 4); FFB_WRITE64(&ffb->by, 0, 0); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h index cc2911b41..b6c4f5db5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h,v 1.1 2000/05/23 04:47:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h,v 1.2 2001/04/05 17:42:33 dawes Exp $ */ #ifndef _FFB_DAC_H #define _FFB_DAC_H @@ -347,6 +347,8 @@ typedef struct ffb_dac_info { #define FFB_DAC_PAC2 0x00000002 /* Pacifica2 DAC, BT498 */ #define FFB_DAC_ICURCTL 0x00000004 /* Inverted CUR_CTRL bits */ + unsigned int kernel_wid; + /* These registers need to be modified when changing DAC * timing state, so at init time we capture their values. */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c index f866f1a2d..a5d97167a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.5 2000/12/21 12:22:57 alanh Exp $ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.6 2001/03/21 17:02:25 dawes Exp $ * Acceleration for the Creator and Creator3D framebuffer - DRI/DRM support. * * Copyright (C) 2000 David S. Miller (davem@redhat.com) @@ -273,6 +273,9 @@ FFBDRIScreenInit(ScreenPtr pScreen) /* Our InitBuffers depends heavily on this setting. */ pDRIInfo->bufferRequests = DRI_3D_WINDOWS_ONLY; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &(pFfb->drmSubFD))) { DRIDestroyInfoRec(pFfb->pDRIInfo); xfree(pFfbDRI); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c index b9bc424fc..689607ff3 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c @@ -20,7 +20,7 @@ * 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/sunffb/ffb_driver.c,v 1.7 2000/12/02 15:30:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.8 2001/04/05 17:42:33 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -818,7 +818,8 @@ FFBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; #ifdef XF86DRI - if (pFfb->ffb_type != afb_m3 && pFfb->ffb_type != afb_m6) { + if (pFfb->ffb_type != afb_m3 && pFfb->ffb_type != afb_m6 && + pFfb->NoAccel == FALSE) { pFfb->dri_enabled = FFBDRIScreenInit(pScreen); if (pFfb->dri_enabled == TRUE) xf86Msg(X_INFO, "%s: DRM initialized\n", @@ -912,7 +913,8 @@ FFBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; /* Setup DGA support. */ - FFB_InitDGA(pScreen); + if (!pFfb->NoAccel) + FFB_InitDGA(pScreen); #ifdef XF86DRI if (pFfb->dri_enabled) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c index 4ad5f744e..340efef3b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c @@ -24,7 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c,v 1.2 2000/05/23 04:47:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c,v 1.3 2001/04/05 17:42:33 dawes Exp $ */ #include "ffb.h" #include "ffb_regs.h" @@ -451,7 +451,7 @@ CreatorFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, unsigned long CreatorBoxFillPage(pFfb, nBox, pBox); pFfb->rp_active = 1; - FFBSync(pFfb, ffb); + FFBSync(pFfb, pFfb->regs); } static void diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c index 2d194d82e..feb80346a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c @@ -23,11 +23,10 @@ * IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c,v 1.2 2000/05/23 04:47:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c,v 1.3 2001/03/03 22:41:34 tsi Exp $ */ #define PSZ 32 -#include <math.h> #include "ffb.h" #include "ffb_regs.h" #include "ffb_rcache.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c index e70821732..ee6231066 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c @@ -20,11 +20,9 @@ * 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/sunleo/leo_accel.c,v 1.2 2000/12/01 00:24:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c,v 1.3 2001/03/03 22:41:34 tsi Exp $ */ #define PSZ 32 -#include <asm/types.h> -#include <math.h> #include "scrnintstr.h" #include "pixmapstr.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h index 9c1af323a..2c048a2d2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h @@ -5,7 +5,7 @@ Copyright: 1998,1999 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.18 2000/12/20 01:30:46 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.21 2001/04/05 21:29:17 dawes Exp $ */ #ifndef _TDFX_H_ #define _TDFX_H_ @@ -39,6 +39,8 @@ typedef struct _TDFXRec *TDFXPtr; #include "tdfx_priv.h" extern void TDFXSwapContextFifo(ScreenPtr pScreen); extern void TDFXLostContext(ScreenPtr pScreen); +extern Bool TDFXSetupSLI(ScrnInfoPtr pScrn, Bool sliEnable, int aaSamples); +extern Bool TDFXDisableSLI(TDFXPtr pTDFX); #ifdef XF86DRI extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI); @@ -69,7 +71,7 @@ extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI); #ifdef TRACECURS #define TDFXTRACECURS ErrorF #else -#define TDFXTRACECURS if(0) (unsigned long) +#define TDFXTRACECURS if(0) ErrorF #endif #ifdef TRACEREG @@ -78,8 +80,8 @@ extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI); #define TDFXTRACEREG if(0) ErrorF #endif -#include <xaa.h> -#include <xf86Cursor.h> +#include "xaa.h" +#include "xf86Cursor.h" typedef void (*TDFXWriteIndexedByteFunc)(TDFXPtr pTDFX, int addr, char index, char value); @@ -97,12 +99,17 @@ typedef int (*TDFXReadChipWordFunc)(TDFXPtr pTDFX, int chip, int addr); typedef void (*TDFXSyncFunc)(ScrnInfoPtr pScrn); typedef void (*TDFXBufferFunc)(TDFXPtr pTDFX, int which); +#if X_BYTE_ORDER == X_BIG_ENDIAN +typedef void (*TDFXWriteFifoFunc)(TDFXPtr pTDFX, int val); +#endif + typedef struct { unsigned int vidcfg; unsigned int vidpll; unsigned int dacmode; unsigned int vgainit0; + unsigned int miscinit0; unsigned int screensize; unsigned int stride; unsigned int cursloc; @@ -174,6 +181,9 @@ typedef struct _TDFXRec { TDFXWriteChipWordFunc writeChipLong; TDFXReadChipWordFunc readChipLong; TDFXSyncFunc sync; +#if X_BYTE_ORDER == X_BIG_ENDIAN + TDFXWriteFifoFunc writeFifo; +#endif int syncDone; int scanlineWidth; unsigned char *scanlineColorExpandBuffers[2]; @@ -251,9 +261,11 @@ extern void TDFXSetPIOAccess(TDFXPtr pTDFX); extern void TDFXSetMMIOAccess(TDFXPtr pTDFX); extern void TDFXWriteLongMMIO(TDFXPtr pTDFX, int addr, int val); extern int TDFXReadLongMMIO(TDFXPtr pTDFX, int addr); +extern void TDFXWriteChipLongMMIO(TDFXPtr pTDFX, int chip, int addr, int val); extern void TDFXNeedSync(ScrnInfoPtr pScrn); extern void TDFXCheckSync(ScrnInfoPtr pScrn); +extern void TDFXFirstSync(ScrnInfoPtr pScrn); extern void TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, @@ -269,7 +281,6 @@ extern void TDFXSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, extern void TDFXSelectBuffer(TDFXPtr pTDFX, int which); +extern void TDFXInitVideo(ScreenPtr pScreen); #endif - - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c index ce4b0369e..ce9f18de1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.17 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.19 2001/04/05 21:29:17 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -57,6 +57,7 @@ static void TDFXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, static void TDFXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags, int phase); +#ifdef ENABLE_SS_COLOR_EXPAND_FILL static void TDFXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); @@ -64,6 +65,7 @@ static void TDFXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int offset); +#endif static void TDFXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); @@ -105,7 +107,6 @@ TDFXCheckSync(ScrnInfoPtr pScrn) { pTDFX->syncDone=FALSE; #ifdef XF86DRI if (pTDFX->directRenderingEnabled) { - TDFXLostContext(screenInfo.screens[pScrn->scrnIndex]); DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); } #endif @@ -124,8 +125,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) { else fmt=pTDFX->stride|((pTDFX->cpp+1)<<16); TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->fbOffset); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->fbOffset); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; case TDFX_BACK: if (pTDFX->cpp==2) @@ -134,8 +137,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) { fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */ TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->backOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->backOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; case TDFX_DEPTH: if (pTDFX->cpp==2) @@ -144,8 +149,10 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) { fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */ TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->depthOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->depthOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; default: ; @@ -155,6 +162,17 @@ TDFXSelectBuffer(TDFXPtr pTDFX, int which) { void TDFXSetLFBConfig(TDFXPtr pTDFX) { if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned int lfbmode; + lfbmode=TDFXReadLongMMIO(pTDFX, SST_3D_LFBMODE); + + lfbmode&=~BIT(12); /* 0 bit 12 is byte swizzle */ + lfbmode|=BIT(11); /* 1 bit 11 is word swizzle */ + lfbmode&=~BIT(10); /* 0 bit 10 ARGB or ABGR */ + lfbmode&=~BIT(9); /* 0 bit 9 if bit10 = 0: ARGB else ABGR */ + + TDFXWriteLongMMIO(pTDFX, SST_3D_LFBMODE, lfbmode); +#endif TDFXWriteLongMMIO(pTDFX, LFBMEMORYCONFIG, (pTDFX->backOffset>>12) | SST_RAW_LFB_ADDR_STRIDE_4K | ((pTDFX->stride+127)/128)<<SST_RAW_LFB_TILE_STRIDE_SHIFT); @@ -233,7 +251,7 @@ TDFXAccelInit(ScreenPtr pScreen) infoPtr->SubsequentScreenToScreenCopy = TDFXSubsequentScreenToScreenCopy; infoPtr->ScreenToScreenCopyFlags = commonFlags; - /* When we're using the fifo interface we have to use indirect */ + /* When we're using the fifo we have to use indirect expansion */ pTDFX->scanlineColorExpandBuffers[0] = xalloc((pScrn->virtualX+62)/32*4); pTDFX->scanlineColorExpandBuffers[1] = xalloc((pScrn->virtualX+62)/32*4); infoPtr->NumScanlineColorExpandBuffers=2; @@ -244,7 +262,10 @@ TDFXAccelInit(ScreenPtr pScreen) TDFXSubsequentCPUToScreenColorExpandFill; infoPtr->SubsequentColorExpandScanline = TDFXSubsequentColorExpandScanline; - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = commonFlags | + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + BIT_ORDER_IN_BYTE_MSBFIRST | +#endif CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */ @@ -256,7 +277,7 @@ TDFXAccelInit(ScreenPtr pScreen) HARDWARE_PATTERN_PROGRAMMED_ORIGIN | HARDWARE_PATTERN_SCREEN_ORIGIN; -#if 0 +#ifdef ENABLE_SS_COLOR_EXPAND_FILL /* This causes us to fail compliance */ /* I suspect 1bpp pixmaps are getting written to cache incorrectly */ infoPtr->SetupForScreenToScreenColorExpandFill = @@ -274,6 +295,9 @@ TDFXAccelInit(ScreenPtr pScreen) pTDFX->ModeReg.dstbaseaddr=pTDFX->fbOffset; TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, pTDFX->ModeReg.dstbaseaddr); + pTDFX->sst2DSrcFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_SRCFORMAT); + pTDFX->sst2DDstFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_DSTFORMAT); + /* Fill in acceleration functions */ return XAAInit(pScreen, infoPtr); } @@ -418,7 +442,9 @@ TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, TDFXMakeRoom(pTDFX, 2); DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; } void @@ -476,6 +502,7 @@ TDFXSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, DECLARE(SSTCP_DSTFORMAT|SSTCP_COLORFORE| SSTCP_COLORBACK); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_COLORBACK, color); TDFXWriteLong(pTDFX, SST_2D_COLORFORE, color); } @@ -525,6 +552,7 @@ TDFXSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty, |SSTCP_PATTERN1ALIAS|SSTCP_COLORFORE| SSTCP_COLORBACK); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_PATTERN0, patx); TDFXWriteLong(pTDFX, SST_2D_PATTERN1, paty); TDFXWriteLong(pTDFX, SST_2D_COLORBACK, bg); @@ -638,8 +666,14 @@ TDFXNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n, (pbox->x1&0x1FFF)); TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, ((pbox->y2&0x1FFF)<<16) | (pbox->x2&0x1FFF)); +#if X_BYTE_ORDER == X_BIG_ENDIAN + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, SST_2D_PIXFMT_1BPP | + SST_2D_SOURCE_PACKING_DWORD | BIT(20)); +#else TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, SST_2D_PIXFMT_1BPP | SST_2D_SOURCE_PACKING_DWORD); +#endif + pTDFX->sst2DSrcFmtShadow = SST_2D_PIXFMT_1BPP | SST_2D_SOURCE_PACKING_DWORD; TDFXWriteLong(pTDFX, SST_2D_SRCXY, 0); TDFXWriteLong(pTDFX, SST_2D_COLORFORE, fg); TDFXWriteLong(pTDFX, SST_2D_COMMAND, pTDFX->Cmd); @@ -668,7 +702,11 @@ TDFXNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n, TDFXMakeRoom(pTDFX, i); DECLARE_LAUNCH(i, 0); for (j=0; j<i; j++) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + TDFXWriteLong(pTDFX, SST_2D_LAUNCH, *glyph_data); +#else TDFXWriteLong(pTDFX, SST_2D_LAUNCH, XAAReverseBitOrder(*glyph_data)); +#endif glyph_data++; } ndwords -= i; @@ -682,9 +720,21 @@ TDFXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned char *pattern) { TDFXPtr pTDFX; +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned int pat = *(unsigned int *)pattern; +#endif TDFXTRACEACCEL("TDFXSetupForDashedLine\n"); pTDFX=TDFXPTR(pScrn); + +#if X_BYTE_ORDER == X_BIG_ENDIAN + pat=((pat & 0xAAAAAAAA) >> 1) | ((pat & 0x55555555) << 1); + pat=((pat & 0xCCCCCCCC) >> 2) | ((pat & 0x33333333) << 2); + pat=((pat & 0xF0F0F0F0) >> 4) | ((pat & 0x0F0F0F0F) << 4); + pat=((pat & 0xFF00FF00) >> 8) | ((pat & 0x00FF00FF) << 8); + pat=((pat & 0xFFFF0000) >> 16) | ((pat & 0x0000FFFF) << 16); +#endif + TDFXClearState(pScrn); pTDFX->Cmd = (TDFXROPCvt[rop]<<24) | SST_2D_STIPPLE_LINE; @@ -695,7 +745,11 @@ TDFXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, TDFXMakeRoom(pTDFX, 3); DECLARE(SSTCP_COLORFORE|SSTCP_COLORBACK|SSTCP_LINESTIPPLE); +#if X_BYTE_ORDER == X_BIG_ENDIAN + TDFXWriteLong(pTDFX, SST_2D_LINESTIPPLE, pat); +#else TDFXWriteLong(pTDFX, SST_2D_LINESTIPPLE, *(int *)pattern); +#endif TDFXWriteLong(pTDFX, SST_2D_COLORBACK, bg); TDFXWriteLong(pTDFX, SST_2D_COLORFORE, fg); } @@ -720,6 +774,7 @@ TDFXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, TDFXSubsequentSolidTwoPointLine(pScrn, x1, y1, x2, y2, flags); } +#ifdef ENABLE_SS_COLOR_EXPAND_FILL static void TDFXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) @@ -773,9 +828,11 @@ TDFXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, SSTCP_DSTSIZE|SSTCP_DSTXY|SSTCP_COMMAND | SSTCP_CLIP1MIN|SSTCP_CLIP1MAX); TDFXWriteLong(pTDFX,SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX,SST_2D_CLIP1MIN, (x&0x1FFF) | ((y&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_CLIP1MAX, ((x+w)&0x1FFF) | (((y+h)&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_SRCFORMAT, pTDFX->stride); + pTDFX->sst2DSrcFmtShadow = pTDFX->stride; TDFXWriteLong(pTDFX,SST_2D_SRCXY, (srcx&0x1FFF) | ((srcy&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_DSTSIZE, ((w+offset)&0x1FFF) | ((h&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_DSTXY, ((x-offset)&0x1FFF) | ((y&0x1FFF)<<16)); @@ -783,6 +840,7 @@ TDFXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, pTDFX->prevBlitDest.y1=y; } +#endif static void TDFXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, @@ -834,9 +892,16 @@ TDFXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, SSTCP_DSTFORMAT|SSTCP_DSTSIZE|SSTCP_SRCXY| SSTCP_DSTXY|SSTCP_COMMAND); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_CLIP1MIN, ((y&0x1FFF)<<16)|(x&0x1FFF)); TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, (((y+h)&0x1FFF)<<16)|((x+w)&0x1FFF)); +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* bit 20 byte swizzle */ + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF | BIT(20)); +#else TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF); +#endif + pTDFX->sst2DSrcFmtShadow = (((w+31)/32)*4) & 0x3FFF; TDFXWriteLong(pTDFX, SST_2D_SRCXY, skipleft&0x1F); TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, ((w-skipleft)&0x1FFF)|((h&0x1FFF)<<16)); TDFXWriteLong(pTDFX, SST_2D_DSTXY, ((x+skipleft)&0x1FFF) | ((y&0x1FFF)<<16)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c index c44a22899..f0a97a3b8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.5 2001/01/13 00:06:29 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.6 2001/03/21 17:02:26 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -170,10 +170,8 @@ TDFX_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; int ydir = (srcy < dsty) ? -1 : 1; - (*pTDFX->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, - GXcopy, ~0, -1); - (*pTDFX->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, - dstx, dsty, w, h); + (*pTDFX->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, ~0, -1); + (*pTDFX->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, dstx, dsty, w, h); } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index 171be47da..82309f52d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.17 2000/12/21 12:22:57 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.19 2001/03/21 17:02:26 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -16,20 +16,20 @@ static char TDFXKernelDriverName[] = "tdfx"; static char TDFXClientDriverName[] = "tdfx"; -static Bool TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, +static Bool TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore); static void TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore); -static void TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, +static void TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType readContextType, void *readContextStore, - DRIContextType writeContextType, + DRIContextType writeContextType, void *writeContextStore); static Bool TDFXDRIOpenFullScreen(ScreenPtr pScreen); static Bool TDFXDRICloseFullScreen(ScreenPtr pScreen); static void TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, +static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); static void TDFXDRITransitionTo2d(ScreenPtr pScreen); static void TDFXDRITransitionTo3d(ScreenPtr pScreen); @@ -65,7 +65,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) xfree(pTDFXConfigs); return FALSE; } - for (i=0; i<numConfigs; i++) + for (i=0; i<numConfigs; i++) pTDFXConfigPtrs[i] = &pTDFXConfigs[i]; i=0; @@ -104,7 +104,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) if (depth) { if (pTDFX->cpp>2) pConfigs[i].depthSize = 24; - else + else pConfigs[i].depthSize = 16; } else { pConfigs[i].depthSize = 0; @@ -158,7 +158,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) return FALSE; } - for (i = 0; i < numConfigs; i++) + for (i = 0; i < numConfigs; i++) pTDFXConfigPtrs[i] = &pTDFXConfigs[i]; i=0; @@ -199,7 +199,7 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) if (depth) { if (pTDFX->cpp > 2) pConfigs[i].depthSize = 24; - else + else pConfigs[i].depthSize = 16; } else { pConfigs[i].depthSize = 0; @@ -249,7 +249,7 @@ TDFXDoWakeupHandler(int screenNum, pointer wakeupData, unsigned long result, TDFXNeedSync(pScrn); } -static void +static void TDFXDoBlockHandler(int screenNum, pointer blockData, pointer pTimeout, pointer pReadmask) { @@ -280,7 +280,9 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) case 32: if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "DRI requires Voodoo3 or later, disabling DRI.\n"); + "DRI requires Voodoo4/5 in 32 bpp mode, disabling DRI.\n"); + xf86DrvMsg(pScreen->myNum, X_INFO, + "To use DRI, invoke the server using 16 bpp (depth 16).\n"); return FALSE; } } @@ -300,9 +302,9 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "TDFXDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n", + "TDFXDRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n", major, minor, patch); return FALSE; } @@ -343,10 +345,10 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->maxDrawableTableEntry = TDFX_MAX_DRAWABLES; #ifdef NOT_DONE - /* FIXME need to extend DRI protocol to pass this size back to client + /* FIXME need to extend DRI protocol to pass this size back to client * for SAREA mapping that includes a device private record */ - pDRIInfo->SAREASize = + pDRIInfo->SAREASize = ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */ /* + shared memory device private rec */ #else @@ -381,6 +383,9 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->TransitionTo3d = TDFXDRITransitionTo3d; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = FALSE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &pTDFX->drmSubFD)) { xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate=0; @@ -396,8 +401,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) drmVersionPtr version = drmGetVersion(pTDFX->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor != 0 || - version->version_patchlevel < 0) { + version->version_minor < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "TDFXDRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", @@ -413,7 +417,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) } pTDFXDRI->regsSize=TDFXIOMAPSIZE; - if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0], + if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0], pTDFXDRI->regsSize, DRM_REGISTERS, 0, &pTDFXDRI->regs)<0) { TDFXDRICloseScreen(pScreen); xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap failed, disabling DRI.\n"); @@ -453,7 +457,7 @@ TDFXDRICloseScreen(ScreenPtr pScreen) } static Bool -TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, +TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore) { @@ -461,7 +465,7 @@ TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, } static void -TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext, +TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore) { } @@ -489,11 +493,12 @@ TDFXDRIFinishScreenInit(ScreenPtr pScreen) pTDFXDRI->fbOffset=pTDFX->fbOffset; pTDFXDRI->backOffset=pTDFX->backOffset; pTDFXDRI->depthOffset=pTDFX->depthOffset; + pTDFXDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); return DRIFinishScreenInit(pScreen); } static void -TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, +TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, DRIContextType oldContextType, void *oldContext, DRIContextType newContextType, void *newContext) { @@ -515,10 +520,10 @@ TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) TDFXSetupForSolidFill(pScrn, 0, GXcopy, -1); while (nbox--) { TDFXSelectBuffer(pTDFX, TDFX_BACK); - TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, pbox->x2-pbox->x1, pbox->y2-pbox->y1); TDFXSelectBuffer(pTDFX, TDFX_DEPTH); - TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, pbox->x2-pbox->x1, pbox->y2-pbox->y1); pbox++; } @@ -528,7 +533,7 @@ TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) } static void -TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, +TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index) { ScreenPtr pScreen = pParent->drawable.pScreen; @@ -571,11 +576,11 @@ TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, static Bool TDFXDRIOpenFullScreen(ScreenPtr pScreen) { +#if 0 ScrnInfoPtr pScrn; TDFXPtr pTDFX; xf86DrvMsg(pScreen->myNum, X_INFO, "OpenFullScreen\n"); -#if 0 pScrn = xf86Screens[pScreen->myNum]; pTDFX=TDFXPTR(pScrn); if (pTDFX->numChips>1) { @@ -588,10 +593,10 @@ TDFXDRIOpenFullScreen(ScreenPtr pScreen) static Bool TDFXDRICloseFullScreen(ScreenPtr pScreen) { +#if 0 ScrnInfoPtr pScrn; xf86DrvMsg(pScreen->myNum, X_INFO, "CloseFullScreen\n"); -#if 0 pScrn = xf86Screens[pScreen->myNum]; TDFXDisableSLI(pScrn); #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h index 7da92b83a..956b7e703 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h @@ -1,9 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.3 2000/02/15 07:13:43 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.5 2001/03/21 17:02:26 dawes Exp $ */ #ifndef _TDFX_DRI_ #define _TDFX_DRI_ -#include <xf86drm.h> +#include "xf86drm.h" typedef struct { drmHandle regs; @@ -22,6 +22,7 @@ typedef struct { int depthOffset; int textureOffset; int textureSize; + unsigned int sarea_priv_offset; } TDFXDRIRec, *TDFXDRIPtr; #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index bc9349c8e..f983ad097 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.64 2001/02/15 18:01:43 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.67 2001/04/05 21:29:17 dawes Exp $ */ /* * Authors: @@ -164,7 +164,6 @@ static PciChipsets TDFXPciChipsets[] = { { -1, -1, RES_UNDEFINED } }; -/* !!! Do we want an option for PIO address space? !!! */ /* !!! Do we want an option for alternate clocking? !!! */ typedef enum { @@ -492,7 +491,10 @@ TDFXCountRam(ScrnInfoPtr pScrn) { /* set memory interface delay values and enable refresh */ /* these apply to all RAM vendors */ dramInit1 = 0x0; - dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; + if (pTDFX->ChipType==PCI_CHIP_BANSHEE) + dramInit1 |= 7<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; + else + dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; dramInit1 |= SST_SGRAM_CLK_NODELAY; dramInit1 |= SST_DRAM_REFRESH_EN; dramInit1 |= (0x18 << SST_DRAM_REFRESH_VALUE_SHIFT) & SST_DRAM_REFRESH_VALUE; @@ -544,11 +546,13 @@ TDFXCountRam(ScrnInfoPtr pScrn) { return memSize*1024; } +#if 0 static int TDFXCfgToSize(int cfg) { if (cfg<4) return 0x8000000<<cfg; return 0x4000000>>(cfg-4); } +#endif static int TDFXSizeToCfg(int size) { @@ -594,28 +598,31 @@ static void TDFXInitChips(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int i, cfgbits, initbits; + int i, v, cfgbits, initbits; int mem0base, mem1base, mem0size, mem0bits, mem1size, mem1bits; pTDFX=TDFXPTR(pScrn); cfgbits=pciReadLong(pTDFX->PciTag[0], CFG_PCI_DECODE); mem0base=pciReadLong(pTDFX->PciTag[0], CFG_MEM0BASE); mem1base=pciReadLong(pTDFX->PciTag[0], CFG_MEM1BASE); + initbits=pciReadLong(pTDFX->PciTag[0], CFG_INIT_ENABLE); mem0size=32*1024*1024; /* Registers are always 32MB */ mem1size=pScrn->videoRam*1024*2; /* Linear mapping is 2x memory */ mem0bits=TDFXSizeToCfg(mem0size); mem1bits=TDFXSizeToCfg(mem1size)<<4; cfgbits=(cfgbits&~(0xFF))|mem0bits|mem1bits; for (i=0; i<pTDFX->numChips; i++) { - initbits=pciReadLong(pTDFX->PciTag[i], CFG_INIT_ENABLE); initbits|=BIT(10); pciWriteLong(pTDFX->PciTag[i], CFG_INIT_ENABLE, initbits); + v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND); + if (!i) + pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x3); + else + pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x2); pTDFX->MMIOAddr[i]=mem0base+i*mem0size; - pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, 0xFFFFFFFF); pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, pTDFX->MMIOAddr[i]); pTDFX->MMIOAddr[i]&=0xFFFFFF00; pTDFX->LinearAddr[i]=mem1base+i*mem1size; - pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, 0xFFFFFFFF); pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, pTDFX->LinearAddr[i]); pTDFX->LinearAddr[i]&=0xFFFFFF00; pciWriteLong(pTDFX->PciTag[i], CFG_PCI_DECODE, cfgbits); @@ -655,10 +662,12 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) pTDFX->initDone=FALSE; pTDFX->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); +#if !defined(__powerpc__) if (flags & PROBE_DETECT) { TDFXProbeDDC(pScrn, pTDFX->pEnt->index); return TRUE; } +#endif if (pTDFX->pEnt->location.type != BUS_PCI) return FALSE; @@ -670,6 +679,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) /* Allocate a vgaHWRec */ if (!vgaHWGetHWRec(pScrn)) return FALSE; +#if !defined(__powerpc__) if (xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -687,6 +697,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) xf86FreeInt10(pInt); } } +#endif match=pTDFX->PciInfo=xf86GetPciInfoForEntity(pTDFX->pEnt->index); TDFXFindChips(pScrn, match); @@ -747,9 +758,17 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - if (!xf86SetDefaultVisual (pScrn, -1)) { + if (!xf86SetDefaultVisual(pScrn, -1)) { 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 use a programamble clock */ pScrn->progClock = TRUE; @@ -939,17 +958,23 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) } xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); - pTDFX->NoAccel=xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE); - if (!pTDFX->NoAccel) { + if (!xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) { TDFXFreeRec(pScrn); return FALSE; } } - if (xf86ReturnOptValBool(TDFXOptions, OPTION_SHOWCACHE, FALSE)) { - pTDFX->ShowCache = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n"); + if (!xf86GetOptValBool(TDFXOptions, OPTION_SHOWCACHE, &(pTDFX->ShowCache))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache %s\n", pTDFX->ShowCache ? "Enabled" : "Disabled"); + } else { + pTDFX->ShowCache = FALSE; + } + + if (xf86GetOptValInteger(TDFXOptions, OPTION_VIDEO_KEY, &(pTDFX->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", pTDFX->videoKey); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key default 0x%x\n", pTDFX->videoKey = 0x1E); } if (xf86GetOptValInteger(TDFXOptions, OPTION_VIDEO_KEY, &(pTDFX->videoKey))) { @@ -967,6 +992,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(ramdacSymbols, NULL); } +#if !defined(__powerpc__) /* Load DDC if needed */ /* This gives us DDC1 - we should be able to get DDC2B using i2c */ if (!xf86LoadSubModule(pScrn, "ddc")) { @@ -981,11 +1007,42 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) pMon = vbeDoEDID(VBEInit(NULL,pTDFX->pEnt->index), NULL); xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon)); } +#endif if (xf86ReturnOptValBool(TDFXOptions, OPTION_USE_PIO, FALSE)) { pTDFX->usePIO=TRUE; } +#if X_BYTE_ORDER == X_BIG_ENDIAN + pTDFX->ModeReg.miscinit0 = pTDFX->readLong(pTDFX, MISCINIT0); + pTDFX->SavedReg.miscinit0 = pTDFX->ModeReg.miscinit0; + + switch (pScrn->bitsPerPixel) { + case 8: + pTDFX->writeFifo = TDFXWriteFifo_8; + pTDFX->ModeReg.miscinit0 &= ~BIT(30); /* LFB byte swizzle */ + pTDFX->ModeReg.miscinit0 &= ~BIT(31); /* LFB word swizzle */ + break; + case 15: + case 16: + pTDFX->writeFifo = TDFXWriteFifo_16; + pTDFX->ModeReg.miscinit0 |= BIT(30); /* LFB byte swizzle */ + pTDFX->ModeReg.miscinit0 |= BIT(31); /* LFB word swizzle */ + break; + case 24: + case 32: + pTDFX->writeFifo = TDFXWriteFifo_24; + pTDFX->ModeReg.miscinit0 |= BIT(30); /* LFB byte swizzle */ + pTDFX->ModeReg.miscinit0 &= ~BIT(31); /* LFB word swizzle */ + break; + default: + return FALSE; + break; + } + pTDFX->writeLong(pTDFX, MISCINIT0, pTDFX->ModeReg.miscinit0); +#endif + + return TRUE; } @@ -1038,6 +1095,7 @@ TDFXUnmapMem(ScrnInfoPtr pScrn) return TRUE; } +#ifdef DEBUG static void PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs) { @@ -1093,6 +1151,7 @@ PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs) #endif #endif } +#endif /* * TDFXSave -- @@ -1106,6 +1165,7 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts) { TDFXPtr pTDFX; vgaHWPtr hwp; + int i, dummy, count; TDFXTRACE("TDFXDoSave start\n"); pTDFX = TDFXPTR(pScrn); @@ -1136,6 +1196,14 @@ DoSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool saveFonts) tdfxReg->clip1max=TDFXReadLongMMIO(pTDFX, SST_2D_CLIP1MAX); tdfxReg->srcbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_SRCBASEADDR); tdfxReg->dstbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_DSTBASEADDR); + for (i=0; i<512; i++) { + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACADDR, i); + dummy=TDFXReadLongMMIO(pTDFX, DACADDR); + } while (count++<100 && dummy!=i); + tdfxReg->dactable[i]=TDFXReadLongMMIO(pTDFX, DACDATA); + } } static void @@ -1155,6 +1223,7 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, Bool restoreFonts) { TDFXPtr pTDFX; vgaHWPtr hwp; + int i, dummy, count; TDFXTRACE("TDFXDoRestore start\n"); pTDFX = TDFXPTR(pScrn); @@ -1182,11 +1251,25 @@ DoRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, TDFXRegPtr tdfxReg, TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP1MIN, tdfxReg->clip1min); TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP1MAX, tdfxReg->clip1max); pTDFX->writeLong(pTDFX, VGAINIT0, tdfxReg->vgainit0); +#if X_BYTE_ORDER == X_BIG_ENDIAN + pTDFX->writeLong(pTDFX, MISCINIT0, tdfxReg->miscinit0); +#endif pTDFX->writeLong(pTDFX, VIDPROCCFG, tdfxReg->vidcfg); TDFXWriteLongMMIO(pTDFX, SST_2D_SRCBASEADDR, tdfxReg->srcbaseaddr); TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, tdfxReg->dstbaseaddr); - vgaHWProtect(pScrn, FALSE); + for (i=0; i<512; i++) { + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACADDR, i); + dummy=TDFXReadLongMMIO(pTDFX, DACADDR); + } while (count++<100 && dummy!=i); + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACDATA, tdfxReg->dactable[i]); + dummy=TDFXReadLongMMIO(pTDFX, DACDATA); + } while (count++<100 && dummy!=tdfxReg->dactable[i]); + } pTDFX->sync(pScrn); } @@ -1429,6 +1512,7 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) int hd, hbs, hss, hse, hbe, ht, hskew; Bool dbl; + hd = hbs = hss = hse = hbe = ht = hskew = 0; hwp = VGAHWPTR(pScrn); pTDFX = TDFXPTR(pScrn); @@ -1489,35 +1573,35 @@ TDFXModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) static void TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - short visualClass) { + VisualPtr pVisual) { TDFXPtr pTDFX; int i, j, index, v, repeat, max; TDFXTRACE("TDFXLoadPalette16 start\n"); pTDFX = TDFXPTR(pScrn); + for (i=0; i<numColors; i++) { index=indices[i]; v=(colors[index/2].red<<16)|(colors[index].green<<8)|colors[index/2].blue; - if (i<numColors-1) max=indices[i+1]<<2; - else max=256; - for (j=index<<2; j<max; j++) { + max=min((index+1)<<2, 256); + for (j = index<<2; j < max; j++) + { repeat=100; do { - pTDFX->writeLong(pTDFX, DACADDR, j); - } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=j); + TDFXWriteLongMMIO(pTDFX, DACADDR, j); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=j); if (!repeat) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, " - "bypassing CLUT\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, bypassing CLUT\n"); pTDFX->ModeReg.vidcfg |= SST_DESKTOP_CLUT_BYPASS; return; } + repeat=100; do { - pTDFX->writeLong(pTDFX, DACDATA, v); - } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v); + TDFXWriteLongMMIO(pTDFX, DACDATA, v); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v); if (!repeat) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, " - "bypassing CLUT\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, bypassing CLUT\n"); pTDFX->ModeReg.vidcfg |= SST_DESKTOP_CLUT_BYPASS; return; } @@ -1527,7 +1611,7 @@ TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, static void TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - short visualClass) { + VisualPtr pVisual) { TDFXPtr pTDFX; int i, index, v, repeat; @@ -1538,8 +1622,8 @@ TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, v=(colors[index].red<<16)|(colors[index].green<<8)|colors[index].blue; repeat=100; do { - pTDFX->writeLong(pTDFX, DACADDR, index); - } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=index); + TDFXWriteLongMMIO(pTDFX, DACADDR, index); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=index); if (!repeat) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, " "bypassing CLUT\n"); @@ -1548,8 +1632,8 @@ TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, } repeat=100; do { - pTDFX->writeLong(pTDFX, DACDATA, v); - } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v); + TDFXWriteLongMMIO(pTDFX, DACDATA, v); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v); if (!repeat) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, " "bypassing CLUT\n"); @@ -1593,6 +1677,7 @@ calcBufferHeightInTiles(int yres) } /* calcBufferHeightInTiles */ +#if 0 static int calcBufferSizeInTiles(int xres, int yres, int cpp) { int bufSizeInTiles; /* Size of buffer in tiles */ @@ -1603,6 +1688,7 @@ calcBufferSizeInTiles(int xres, int yres, int cpp) { return bufSizeInTiles; } /* calcBufferSizeInTiles */ +#endif static int calcBufferSize(int xres, int yres, Bool tiled, int cpp) @@ -1625,7 +1711,7 @@ calcBufferSize(int xres, int yres, Bool tiled, int cpp) static void allocateMemory(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int memRemaining, fifoSize, screenSizeInTiles; + int memRemaining, fifoSize, screenSizeInTiles, cursorSize; pTDFX = TDFXPTR(pScrn); @@ -1646,7 +1732,7 @@ static void allocateMemory(ScrnInfoPtr pScrn) { /* it to be on an *odd* page boundary. */ pTDFX->depthOffset = (memRemaining - screenSizeInTiles) &~ 0xFFF; if ((pTDFX->depthOffset & (0x1 << 12)) == 0) { -#if 0 +#if 1 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Changing depth offset from 0x%08x to 0x%08x\n", pTDFX->depthOffset, @@ -1658,7 +1744,7 @@ static void allocateMemory(ScrnInfoPtr pScrn) { /* to be on an *even* page boundary. */ pTDFX->backOffset = (pTDFX->depthOffset - screenSizeInTiles) &~ 0xFFF; if (pTDFX->backOffset & (0x1 << 12)) { -#if 0 +#if 1 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Changing back offset from 0x%08x to 0x%08x\n", pTDFX->backOffset, @@ -1670,8 +1756,9 @@ static void allocateMemory(ScrnInfoPtr pScrn) { /* CMDFIFO_PAGES pages, but no more than */ /* 255. We give 4096 bytes to the cursor */ fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12; + cursorSize = 4096; pTDFX->cursorOffset = 0; - pTDFX->fifoOffset = 4096; + pTDFX->fifoOffset = pTDFX->cursorOffset + cursorSize; pTDFX->fifoSize = fifoSize; /* Now, place the front buffer, forcing */ /* it to be on a page boundary too, just */ @@ -1684,21 +1771,21 @@ static void allocateMemory(ScrnInfoPtr pScrn) { if (pTDFX->texSize < 0) { pTDFX->backOffset = -1; pTDFX->depthOffset = -1; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Texture Memory available." - " Disabling direct rendering.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Texture Memory available, disabling DRI\n"); } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n", (float)pTDFX->texSize/1024.0/1024.0); } -#if 0 + +#if 1 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Cursor Offset: [0x%08X,0x%08X)\n", pTDFX->cursorOffset, - pTDFX->cursorOffset+1024); + pTDFX->cursorOffset + cursorSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fifo Offset: [0x%08X, 0x%08X)\n", pTDFX->fifoOffset, - pTDFX->fifoOffset+fifoSize); + pTDFX->fifoOffset + pTDFX->fifoSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Texture Offset: [0x%08X, 0x%08X)\n", pTDFX->texOffset, @@ -1711,11 +1798,11 @@ static void allocateMemory(ScrnInfoPtr pScrn) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BackOffset: [0x%08X, 0x%08X)\n", pTDFX->backOffset, - pTDFX->backOffset+screenSizeInTiles); + pTDFX->backOffset + screenSizeInTiles); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DepthOffset: [0x%08X, 0x%08X)\n", pTDFX->depthOffset, - pTDFX->depthOffset+screenSizeInTiles); + pTDFX->depthOffset + screenSizeInTiles); #endif /* 0/1 */ } @@ -1745,7 +1832,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { pTDFX->pixmapCacheLinesMin = ((720*480*2) + pTDFX->stride - 1)/pTDFX->stride; allocateMemory(pScrn); - +#if 0 if (pTDFX->numChips>1) { if (xf86ReturnOptValBool(TDFXOptions, OPTION_NO_SLI, FALSE)) { TDFXSetupSLI(pScrn, FALSE, 0); @@ -1753,13 +1840,14 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { TDFXSetupSLI(pScrn, TRUE, 0); } } +#endif TDFXSetLFBConfig(pTDFX); /* We initialize in the state that our FIFO is up to date */ pTDFX->syncDone=TRUE; if (!TDFXInitFifo(pScreen)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize fifo\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize private\n"); return FALSE; } @@ -1778,7 +1866,6 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%i lines of offscreen memory available for 2D and video\n", pTDFX->pixmapCacheLinesMax); - MemBox.y1 = 0; MemBox.x1 = 0; @@ -1798,6 +1885,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { miSetPixmapDepths (); + pTDFX->NoAccel=xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE); #ifdef XF86DRI /* * Setup DRI after visuals have been established, but before fbScreenInit @@ -1805,12 +1893,9 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { * InitGLXVisuals call back. */ if (!pTDFX->NoAccel) { - if ( !((pTDFX->backOffset == -1) && (pTDFX->depthOffset == -1))) { + if ((pTDFX->backOffset != -1) && (pTDFX->depthOffset != -1)) { pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen); } - /* Force the initialization of the context */ - if (pTDFX->directRenderingEnabled) - TDFXLostContext(pScreen); } #endif @@ -1905,6 +1990,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { } #endif + #ifdef XvExtension /* Initialize Xv support */ TDFXInitVideo (pScreen); @@ -1941,6 +2027,10 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) { TDFXTRACE("TDFXAdjustFrame start\n"); pScrn = xf86Screens[scrnIndex]; pTDFX = TDFXPTR(pScrn); + + if (pTDFX->ShowCache && y && pScrn->vtSema) + y += pScrn->virtualY - 1; + tdfxReg = &pTDFX->ModeReg; if(pTDFX->ShowCache && y && pScrn->vtSema) y += pScrn->virtualY - 1; @@ -1952,19 +2042,20 @@ TDFXAdjustFrame(int scrnIndex, int x, int y, int flags) { static Bool TDFXEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn; -#ifdef XF86DRI ScreenPtr pScreen; +#ifdef XF86DRI TDFXPtr pTDFX; #endif TDFXTRACE("TDFXEnterVT start\n"); pScrn = xf86Screens[scrnIndex]; + pScreen = screenInfo.screens[scrnIndex]; + TDFXInitFifo(pScreen); #ifdef XF86DRI pTDFX = TDFXPTR(pScrn); if (pTDFX->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRIUnlock(pScreen); - TDFXLostContext(pScreen); } #endif if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -1977,9 +2068,7 @@ TDFXLeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn; vgaHWPtr hwp; ScreenPtr pScreen; -#ifdef XF86DRI TDFXPtr pTDFX; -#endif TDFXTRACE("TDFXLeaveVT start\n"); pScrn = xf86Screens[scrnIndex]; @@ -1987,8 +2076,10 @@ TDFXLeaveVT(int scrnIndex, int flags) { TDFXRestore(pScrn); vgaHWLock(hwp); pScreen = screenInfo.screens[scrnIndex]; -#ifdef XF86DRI pTDFX = TDFXPTR(pScrn); + pTDFX->sync(pScrn); + TDFXShutdownFifo(pScreen); +#ifdef XF86DRI if (pTDFX->directRenderingEnabled) { DRILock(pScreen, 0); TDFXSwapContextFifo(pScreen); @@ -2041,7 +2132,6 @@ TDFXCloseScreen(int scrnIndex, ScreenPtr pScreen) pTDFX->adaptor = NULL; } - pScrn->vtSema=FALSE; pScreen->BlockHandler = pTDFX->BlockHandler; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c index db003c805..1cf277289 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.3 2000/02/15 07:13:43 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.4 2001/04/05 21:29:17 dawes Exp $ */ /* Voodoo Banshee driver version 1.0.2 @@ -14,7 +14,6 @@ #include "tdfx.h" -void TDFXCursorGrabMemory(ScreenPtr pScreen); static void TDFXLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src); static void TDFXShowCursor(ScrnInfoPtr pScrn); static void TDFXHideCursor(ScrnInfoPtr pScrn); @@ -37,7 +36,11 @@ TDFXCursorInit(ScreenPtr pScreen) infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; - infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST| + + infoPtr->Flags = +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK| HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; @@ -54,6 +57,21 @@ TDFXCursorInit(ScreenPtr pScreen) return xf86InitCursor(pScreen, infoPtr); } +#if X_BYTE_ORDER == X_BIG_ENDIAN +static unsigned int TDFXSwap(TDFXPtr pTDFX, unsigned int val) { + switch (pTDFX->cpp) { + case 1: + return val; + case 2: + return ((val & 0x00ff00ff) << 8) | + ((val & 0xff00ff00) >> 8); + case 3: + case 4: + return BE_BSWAP32(val); + } +} +#endif + static void TDFXLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { @@ -61,7 +79,19 @@ TDFXLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) TDFXTRACECURS("TDFXLoadCursorImage start\n"); pTDFX = TDFXPTR(pScrn); +#if X_BYTE_ORDER == X_BIG_ENDIAN + { + int i; + unsigned int *ptr=(unsigned int *)(pTDFX->FbBase+pTDFX->cursorOffset); + + for (i=0; i<256; i++) { + unsigned int val = ((unsigned int *)src)[i]; + *ptr++ = TDFXSwap(pTDFX, val); + } + } +#else memcpy(pTDFX->FbBase+pTDFX->cursorOffset, src, 1024); +#endif } static void diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c index 0bb5a1b3b..5de08d7ab 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.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/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c,v 1.6 2000/08/25 16:25:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c,v 1.7 2001/04/05 21:29:17 dawes Exp $ */ /* * Authors: @@ -54,11 +54,11 @@ static char TDFXReadControlPIO(TDFXPtr pTDFX, int addr, char index) { return inb(pTDFX->PIOBase[0]+addr+1); } -void TDFXWriteChipLongPIO(TDFXPtr pTDFX, int chip, int addr, int val) { +static void TDFXWriteChipLongPIO(TDFXPtr pTDFX, int chip, int addr, int val) { outl(pTDFX->PIOBase[chip]+addr, val); } -int TDFXReadChipLongPIO(TDFXPtr pTDFX, int chip, int addr) { +static int TDFXReadChipLongPIO(TDFXPtr pTDFX, int chip, int addr) { return inl(pTDFX->PIOBase[chip]+addr); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c index 58e49d1cf..a90e130a5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.13 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.15 2001/04/05 21:29:17 dawes Exp $ */ #include "xf86.h" @@ -11,16 +11,37 @@ /* Memory layout of card is as follows: - 000000-003fff: Cursor - 001000-xxxxxx: Fifo (Min of CMDFIFO pages) - xxxxxx-420fff: Texture maps - 421000- A-1 : Framebuffer - A - B-1 : Offscreen pixmaps - B - C-1 : Back buffer - C - D-1 : Z buffer + 000000-00ffff: VGA memory + 010000-013fff: Cursor + 011000-xxxxxx: Fifo (Min of CMDFIFO pages) + xxxxxx- A-1 : Front Buffer (framebuffer) + A - B-1 : Pixmap Cache (framebuffer) + B - C-1 : Texture Memory + C - D-1 : Back Buffer + D - E-1 : Depth Buffer + + NB: pixmap cache usually butts right up against texture memory. when + 3d is disabled (via Transition2D) then the pixmap cache is increased + to overlap the texture memory. maximum pixmap cache of 4095 lines on + voodoo5 and 2048 on voodoo3/4 applies. */ -void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn) +#if X_BYTE_ORDER == X_BIG_ENDIAN +void TDFXWriteFifo_24(TDFXPtr pTDFX, int val) { + *pTDFX->fifoPtr++ = val; +} + +void TDFXWriteFifo_16(TDFXPtr pTDFX, int val) { + *pTDFX->fifoPtr++ = BE_WSWAP32(val); +} + +void TDFXWriteFifo_8(TDFXPtr pTDFX, int val) { + *pTDFX->fifoPtr++ = BE_BSWAP32(val); +} +#endif + + +static void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; @@ -30,7 +51,7 @@ void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn) WRITE_FIFO(pTDFX, 0, 0); } -void TDFXSendNOPFifo2D(ScrnInfoPtr pScrn) +static void TDFXSendNOPFifo2D(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; @@ -50,7 +71,7 @@ void TDFXSendNOPFifo(ScrnInfoPtr pScrn) TDFXSendNOPFifo3D(pScrn); } -void InstallFifo(ScrnInfoPtr pScrn) +static void InstallFifo(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; @@ -78,7 +99,7 @@ void InstallFifo(ScrnInfoPtr pScrn) TDFXSendNOPFifo(pScrn); } -void TDFXResetFifo(ScrnInfoPtr pScrn) +static void TDFXResetFifo(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; int oldValue; @@ -117,9 +138,9 @@ void TDFXResetFifo(ScrnInfoPtr pScrn) static void TDFXSyncFifo(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int i, cnt; + int i, cnt, resets=0; int stat; - long start_sec, end_sec, dummy; + long start_sec, end_sec, dummy, readptr; TDFXTRACEACCEL("TDFXSyncFifo start\n"); pTDFX=TDFXPTR(pScrn); @@ -127,7 +148,9 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) i=0; cnt=0; start_sec=0; + readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); do { + readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); stat=TDFXReadLongMMIO(pTDFX, 0); if (stat&SST_BUSY) i=0; else i++; cnt++; @@ -137,7 +160,17 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) } else { getsecs(&end_sec, &dummy); if (end_sec-start_sec>3) { - TDFXResetFifo(pScrn); + dummy=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); + if (dummy==readptr) { + TDFXResetFifo(pScrn); + readptr=dummy; + resets++; + if (resets==3) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Board is not responding.\n"); + return; + } + } start_sec=0; } } @@ -237,24 +270,6 @@ void TDFXSwapContextFifo(ScreenPtr pScreen) pTDFX->fifoSlots = pTDFX->fifoEnd-pTDFX->fifoPtr-8; } -void TDFXLostContext(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn; - TDFXPtr pTDFX; - TDFXSAREAPriv *sPriv; - - pScrn = xf86Screens[pScreen->myNum]; - pTDFX=TDFXPTR(pScrn); - sPriv=(TDFXSAREAPriv*)DRIGetSAREAPrivate(pScreen); - if (!sPriv) return; - if (sPriv->fifoPtr!=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase) || - sPriv->fifoRead!=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase)) { - sPriv->fifoPtr=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase); - sPriv->fifoRead=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase); - sPriv->fifoOwner=DRIGetContext(pScreen); - /* ErrorF("Out FifoPtr=%d FifoRead=%d\n", sPriv->fifoPtr, sPriv->fifoRead); */ - } -} #endif static void @@ -285,8 +300,13 @@ TDFXMakeSpace(TDFXPtr pTDFX, uint32 slots) /* ** Put a jump command in command fifo to wrap to the beginning. */ +#if X_BYTE_ORDER == X_BIG_ENDIAN + WRITE_FIFO(pTDFX, 0, (pTDFX->fifoOffset >> 2) << SSTCP_PKT0_ADDR_SHIFT | + SSTCP_PKT0_JMP_LOCAL); +#else *pTDFX->fifoPtr = (pTDFX->fifoOffset >> 2) << SSTCP_PKT0_ADDR_SHIFT | SSTCP_PKT0_JMP_LOCAL; +#endif FLUSH_WCB(); /* diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h index d7fd4dfa3..1e533baa6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.7 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.9 2001/04/05 21:29:17 dawes Exp $ */ #ifndef _TDFX_FIFO_H_ @@ -11,7 +11,7 @@ typedef int int32; typedef short int16; typedef char int8; -#define CMDFIFO_PAGES 64 +#define CMDFIFO_PAGES 255 #define PROPSAREADATA \ volatile int fifoPtr; \ @@ -87,6 +87,24 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots); if ((pTDFX->fifoSlots -= (_n)) < 0) \ cmdfifo_make_room(adapter, fifo_ptr, _n); \ +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define BE_BSWAP32(val) ((((val) & 0x000000ff) << 24) | \ + (((val) & 0x0000ff00) << 8) | \ + (((val) & 0x00ff0000) >> 8) | \ + (((val) & 0xff000000) >> 24)) + +#define BE_WSWAP32(val) ((((val) & 0x0000ffff) << 16) | \ + (((val) & 0xffff0000) >> 16)) + void TDFXWriteFifo_24(TDFXPtr pTDFX, int val); + void TDFXWriteFifo_16(TDFXPtr pTDFX, int val); + void TDFXWriteFifo_8(TDFXPtr pTDFX, int val); +#else +/* Don't swap on little-endian platforms */ +#define BE_BSWAP32(val) val +#define BE_WSWAP32(val) val +#endif + + #ifdef DEBUG_FIFO #define WRITE_FIFO(ptr, loc, _val) \ do { \ @@ -94,19 +112,30 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots); *pTDFX->fifoPtr++ = _val; \ } while(0) #else +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define WRITE_FIFO(ptr, loc, _val) \ + do { \ + pTDFX->writeFifo(ptr, _val); \ + } while (0) +#else #define WRITE_FIFO(ptr, loc, _val) \ do { \ *pTDFX->fifoPtr++ = _val; \ } while(0) -#endif +#endif /* X_BYTE_ORDER == X_BIG_ENDIAN */ +#endif /* DEBUG_FIFO */ +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define FLUSH_WCB() +#else #define FLUSH_WCB() inb(0x80) +#endif /* ** Send a packet header type 1 (2D) to the cmdfifo */ #define SET_2DPK1_HEADER(_ndwords, _inc, _reg) \ - WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ + WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ ((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \ SSTCP_PKT1_2D | \ FIELD_OFFSET(H3_2D_REGISTERS, _reg)/4 << SSTCP_REGBASE_SHIFT | \ @@ -117,7 +146,7 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots); ** Send a packet header type 1 to begin at launchArea[0] to the cmdfifo */ #define SET_PK1_HEADER_LAUNCH(_ndwords, _inc) \ - WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ + WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ ((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \ SSTCP_PKT1_LAUNCH | SSTCP_PKT1 \ ) @@ -126,7 +155,7 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots); ** Send a packet header type 1 to begin at colorPattern[0] to the cmdfifo */ #define SET_PK1_HEADER_COLORPATTERN(_ndwords, _inc) \ - WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ + WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ ((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \ SSTCP_PKT1_COLORPATTERN | SSTCP_PKT1 \ ) @@ -135,7 +164,7 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots); ** Send a packet header type 2 to the cmdfifo */ #define SET_PKT2_HEADER(_mask) \ - WRITE_FIFO (0, 0, ((_mask) << SSTCP_PKT2_MASK_SHIFT) | SSTCP_PKT2) + WRITE_FIFO (pTDFX, 0, ((_mask) << SSTCP_PKT2_MASK_SHIFT) | SSTCP_PKT2) /* ** These are used to select a register mask for use with @@ -159,14 +188,14 @@ void TDFXAllocateSlots(TDFXPtr pTDFX, int slots); #define R13 (1 << 13) #define SET_2DPK4_HEADER(_mask, _reg0) \ - WRITE_FIFO ( 0, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \ + WRITE_FIFO ( pTDFX, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \ SSTCP_PKT4_2D | \ (_reg0) | \ SSTCP_PKT4 \ ) #define SET_3DPK4_HEADER(_mask, _reg0) \ - WRITE_FIFO ( 0, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \ + WRITE_FIFO ( pTDFX, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \ (_reg0) | \ SSTCP_PKT4 \ ) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c index 4f784ca27..803a0db38 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.6 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.7 2001/03/21 17:02:26 dawes Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -12,7 +12,7 @@ /* #define RD_ABORT_ERROR */ #define H3VDD -static Bool TDFXDisableSLI(TDFXPtr pTDFX) +Bool TDFXDisableSLI(TDFXPtr pTDFX) { int i; int v; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c index 472bd0bb7..41f781c43 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.9 2001/01/25 02:20:34 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.10 2001/04/05 21:29:17 dawes Exp $ */ #include "xf86.h" #include "tdfx.h" @@ -436,12 +436,23 @@ TDFXCopyData( int h, int w ){ +#if X_BYTE_ORDER == X_BIG_ENDIAN + w >>= 1; + while(h--) { + int i; + for (i=0; i<w; i++) + ((unsigned long *)dst)[i]=BE_WSWAP32(((unsigned long *)src)[i]); + src += srcPitch; + dst += dstPitch; + } +#else w <<= 1; while(h--) { memcpy(dst, src, w); src += srcPitch; dst += dstPitch; } +#endif } static void @@ -467,15 +478,20 @@ TDFXCopyMungedData( s1 = src1; s2 = src2; s3 = src3; i = w; while(i > 4) { - dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); - dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); - dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); - dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); + dst[0] = BE_WSWAP32(s1[0] | (s1[1] << 16) | (s3[0] << 8) | + (s2[0] << 24)); + dst[1] = BE_WSWAP32(s1[2] | (s1[3] << 16) | (s3[1] << 8) | + (s2[1] << 24)); + dst[2] = BE_WSWAP32(s1[4] | (s1[5] << 16) | (s3[2] << 8) | + (s2[2] << 24)); + dst[3] = BE_WSWAP32(s1[6] | (s1[7] << 16) | (s3[3] << 8) | + (s2[3] << 24)); dst += 4; s2 += 4; s3 += 4; s1 += 8; i -= 4; } while(i--) { - dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst[0] = BE_WSWAP32(s1[0] | (s1[1] << 16) | (s3[0] << 8) | + (s2[0] << 24)); dst++; s2++; s3++; s1 += 2; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h index f4ae7a125..8fbcf22eb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.10 2000/12/20 01:30:47 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.12 2001/04/05 21:29:17 dawes Exp $ */ /* Voodoo Banshee driver version 1.0.1 @@ -47,8 +47,10 @@ #define SST_DESKTOP_CLUT_BYPASS BIT(10) #define SST_HALF_MODE BIT(4) #define SST_CURSOR_EN BIT(27) +#define SST_FBI_BUSY BIT(7) #define SST_BUSY BIT(9) #define SST_RETRACE BIT(6) +#define SST_COMMANDEXTRA_VSYNC BIT(2) #define MEM_TYPE_SGRAM 0 #define MEM_TYPE_SDRAM 1 @@ -195,14 +197,15 @@ /* 3D Registers */ #define SST_3D_OFFSET 0x200000 +#define SST_3D_LFBMODE SST_3D_OFFSET+0x114 #define SST_3D_COMMAND SST_3D_OFFSET+0x120 #define SST_3D_SLICTRL SST_3D_OFFSET+0x20C #define SST_3D_AACTRL SST_3D_OFFSET+0x210 -#define SST_3D_CHIPMASK SST_3D_OFFSET+0x214 #define SST_3D_LEFTOVERLAYBUF SST_3D_OFFSET+0x250 #define SST_3D_RIGHTOVERLAYBUF SST_3D_OFFSET+0x254 /* NAPALM REGISTERS */ +#define CFG_PCI_COMMAND 4 #define CFG_MEM0BASE 16 #define CFG_MEM1BASE 20 #define CFG_INIT_ENABLE 64 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile index 0d02108f2..694ceae09 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile,v 1.15 2000/10/21 18:40:13 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile,v 1.16 2001/03/19 11:00:54 alanh Exp $ XCOMM XCOMM This is an Imakefile for the TGA driver. XCOMM @@ -14,7 +14,7 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ + -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/rac -I$(EXTINCSRC) \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c index 52fdb941b..ccbe7bbd5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.11 2000/10/20 12:57:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.12 2001/03/19 11:00:54 alanh Exp $ */ /* * Copyright 1996,1997 by Alan Hourihane, Wigan, England. @@ -26,11 +26,7 @@ * DEC TGA accelerated options. */ -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - +#include "fb.h" #include "micmap.h" #include "xf86.h" #include "xf86_OSproc.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c index 9170e5069..b49eb7dc4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c @@ -22,7 +22,7 @@ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> * Matthew Grossman, <mattg@oz.net> - acceleration and misc fixes */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.52 2001/02/15 11:03:58 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.53 2001/03/19 11:00:54 alanh Exp $ */ /* everybody includes these */ #include "xf86.h" @@ -50,12 +50,7 @@ /* colormap manipulation */ #include "micmap.h" -/* TGA only does 8 and 32 bpp */ -#define PSZ 8 -#include "cfb.h" -#undef PSZ - -#include "cfb32.h" +#include "fb.h" /* more RAC stuff */ #include "xf86RAC.h" @@ -761,16 +756,7 @@ TGAPreInit(ScrnInfoPtr pScrn, int flags) pTga->FbMapSize = pScrn->videoRam * 1024; - /* Load bpp-specific modules */ - switch (pScrn->bitsPerPixel) { - case 8: - mod = "cfb"; - break; - case 32: - mod = "cfb32"; - break; - } - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { + if (mod && xf86LoadSubModule(pScrn, "fb") == NULL) { TGAFreeRec(pScrn); return FALSE; } @@ -1236,7 +1222,7 @@ TGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * function. If not, the visuals will need to be setup before calling * a fb ScreenInit() function and fixed up after. * - * For most PC hardware at depths >= 8, the defaults that cfb uses + * For most PC hardware at depths >= 8, the defaults that fb uses * are not appropriate. In this driver, we fixup the visuals after. */ @@ -1264,6 +1250,8 @@ TGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; } + miSetPixmapDepths (); + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. @@ -1271,14 +1259,12 @@ TGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) switch (pScrn->bitsPerPixel) { case 8: - ret = cfbScreenInit(pScreen, pTga->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; case 32: - ret = cfb32ScreenInit(pScreen, pTga->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); + ret = fbScreenInit(pScreen, pTga->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel); + if (ret) + fbPictureInit (pScreen, 0, 0); break; default: xf86DrvMsg(scrnIndex, X_ERROR, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h index 17789443b..50bc6eff5 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.35 2001/01/11 14:42:50 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.38 2001/04/04 12:46:35 alanh Exp $ */ #ifndef _TRIDENT_H_ #define _TRIDENT_H_ @@ -61,9 +61,6 @@ typedef struct { CARD32 IOAddress; unsigned long FbAddress; unsigned char * IOBase; -#ifdef __alpha__ - unsigned char * IOBaseDense; -#endif unsigned char * FbBase; long FbMapSize; Bool NoAccel; @@ -109,6 +106,8 @@ typedef struct { int w; int y; int lcdMode; + Bool lcdActive; + Bool doInit; #ifdef READOUT Bool DontSetClock; #endif @@ -143,7 +142,8 @@ typedef struct { typedef struct { CARD8 mode; - char* display; + int display_x; + int display_y; int clock; int shadow_0; int shadow_3; @@ -254,7 +254,9 @@ typedef enum { CYBERBLADEI1D, CYBERBLADEAI1, CYBERBLADEAI1D, - CYBERBLADEE4 + CYBERBLADEE4, + CYBERBLADEXP, + CYBERBLADEXPm } TRIDENTType; #define UseMMIO (pTrident->NoMMIO == FALSE) @@ -280,7 +282,9 @@ typedef enum { (pTrident->Chipset == CYBERBLADEI1D) || \ (pTrident->Chipset == CYBERBLADEAI1) || \ (pTrident->Chipset == CYBERBLADEAI1D) || \ - (pTrident->Chipset == BLADE3D)) + (pTrident->Chipset == BLADE3D) || \ + (pTrident->Chipset == CYBERBLADEXP) || \ + (pTrident->Chipset == CYBERBLADEXPm)) /* * Trident DAC's 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 f0d85a00f..95db63a9c 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.41 2001/02/15 17:59:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.42 2001/03/08 17:12:13 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -147,12 +147,15 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); TRIDENTRegPtr pReg = &pTrident->ModeReg; + int vgaIOBase; int offset = 0; int clock = pTrident->currentClock; CARD8 protect; + Bool fullSize = FALSE; vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr regp = &hwp->ModeReg; vgaRegPtr vgaReg = &hwp->ModeReg; vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; @@ -210,7 +213,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->tridentRegs3CE[HorStretch] = INB(0x3CF); OUTB(0x3CE,VertStretch); pReg->tridentRegs3CE[VertStretch] = INB(0x3CF); - + #ifdef READOUT if ((!((pReg->tridentRegs3CE[VertStretch] & 1) || (pReg->tridentRegs3CE[HorStretch] & 1))) @@ -251,22 +254,70 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->tridentRegs3x4[0x16] = LCD[i].shadow_16; if (LCDActive) pReg->tridentRegs3x4[CRTHiOrd] = LCD[i].shadow_HiOrd; + + fullSize = (pScrn->currentMode->HDisplay == LCD[i].display_x) + && (pScrn->currentMode->VDisplay == LCD[i].display_y); } - 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", + /* copy over common bits from normal VGA */ + + pReg->tridentRegs3x4[0x7] &= ~0x4A; + pReg->tridentRegs3x4[0x7] |= (vgaReg->CRTC[0x7] & 0x4A); + + if (LCDActive && fullSize) { + regp->CRTC[0] = pReg->tridentRegs3x4[0]; + regp->CRTC[3] = pReg->tridentRegs3x4[3]; + regp->CRTC[4] = pReg->tridentRegs3x4[4]; + regp->CRTC[5] = pReg->tridentRegs3x4[5]; + regp->CRTC[6] = pReg->tridentRegs3x4[6]; + regp->CRTC[7] = pReg->tridentRegs3x4[7]; + regp->CRTC[0x10] = pReg->tridentRegs3x4[0x10]; + regp->CRTC[0x11] = pReg->tridentRegs3x4[0x11]; + regp->CRTC[0x16] = pReg->tridentRegs3x4[0x16]; + } + if (LCDActive && !fullSize) { + /* + * If the LCD is active and we don't fill the entire screen + * and the previous mode was stretched we may need help from + * the BIOS to set all registers for the unstreched mode. + */ + pTrident->doInit = ((pReg->tridentRegs3CE[HorStretch] & 1) + || (pReg->tridentRegs3CE[VertStretch] & 1)); + 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"); + } + + + if (pTrident->CyberShadow) { + pReg->tridentRegs3CE[CyberControl] &= 0x7E; + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Forcing Shadow off\n"); + } + + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"H-timing shadow registers:" + " 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[4], pReg->tridentRegs3x4[5]); + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"H-timing registers: " + " 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n", + regp->CRTC[0], regp->CRTC[1], regp->CRTC[2], + regp->CRTC[3], regp->CRTC[4], regp->CRTC[5]); + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"V-timing shadow registers: " + "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x" + " 0x%2.2x (0x%2.2x)\n", + pReg->tridentRegs3x4[6], pReg->tridentRegs3x4[7], pReg->tridentRegs3x4[0x10],pReg->tridentRegs3x4[0x11], pReg->tridentRegs3x4[0x16], pReg->tridentRegs3x4[CRTHiOrd]); + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"V-timing registers: " + "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x " + "0x%2.2x 0x%2.2x 0x%2.2x\n", + regp->CRTC[6], regp->CRTC[7], regp->CRTC[0x10], + regp->CRTC[0x11],regp->CRTC[0x12], + regp->CRTC[0x14],regp->CRTC[0x16]); - /* copy over common bits from normal VGA */ - - pReg->tridentRegs3x4[0x7] &= ~0x4A; - pReg->tridentRegs3x4[0x7] |= (vgaReg->CRTC[0x7] & 0x4A); /* disable stretching, enable centering */ pReg->tridentRegs3CE[VertStretch] &= 0xFC; @@ -303,19 +354,7 @@ TridentInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* no stretch */ pReg->tridentRegs3CE[BiosReg] = 0; - - 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"); - } - if (pTrident->CyberShadow) { - pReg->tridentRegs3CE[CyberControl] &= 0x7E; - xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Forcing Shadow off\n"); - } if (pTrident->CyberStretch) { pReg->tridentRegs3CE[VertStretch] |= 0x01; pReg->tridentRegs3CE[HorStretch] |= 0x01; @@ -524,7 +563,12 @@ TridentRestore(ScrnInfoPtr pScrn, TRIDENTRegPtr tridentReg) OUTB(0x3C4, Protection); OUTB(0x3C5, 0x92); } - +#ifdef NOTYET + if (pTrident->doInit) { + OUTW_3CE(BiosReg); + + } +#endif /* Goto New Mode */ OUTB(0x3C4, 0x0B); temp = INB(0x3C5); 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 d1b1d6e8d..ca7631213 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c @@ -28,7 +28,7 @@ * 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.125 2001/02/15 17:59:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.129 2001/04/04 12:46:35 alanh Exp $ */ #include "xf1bpp.h" #include "xf4bpp.h" @@ -155,6 +155,8 @@ static SymTabRec TRIDENTChipsets[] = { { CYBERBLADEI1D, "cyberbladei1d" }, { CYBERBLADEAI1, "cyberbladeAi1" }, { CYBERBLADEAI1D, "cyberbladeAi1d" }, + { CYBERBLADEXP, "cyberbladeXP" }, + { CYBERBLADEXPm, "cyberbladeXPm" }, { -1, NULL } }; @@ -188,6 +190,8 @@ static PciChipsets TRIDENTPciChipsets[] = { { CYBERBLADEI1D, PCI_CHIP_8520, RES_SHARED_VGA }, { CYBERBLADEAI1, PCI_CHIP_8600, RES_SHARED_VGA }, { CYBERBLADEAI1D, PCI_CHIP_8620, RES_SHARED_VGA }, + { CYBERBLADEXP, PCI_CHIP_9910, RES_SHARED_VGA }, + { CYBERBLADEXPm, PCI_CHIP_9930, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -264,6 +268,8 @@ static int ClockLimit[] = { 230000, 230000, 230000, + 230000, + 230000, }; static int ClockLimit16bpp[] = { @@ -304,6 +310,8 @@ static int ClockLimit16bpp[] = { 230000, 230000, 230000, + 230000, + 230000, }; static int ClockLimit24bpp[] = { @@ -344,6 +352,8 @@ static int ClockLimit24bpp[] = { 115000, 115000, 115000, + 115000, + 115000, }; static int ClockLimit32bpp[] = { @@ -385,6 +395,8 @@ static int ClockLimit32bpp[] = { 115000, 115000, 115000, + 115000, + 115000, }; /* @@ -404,21 +416,22 @@ tridentLCD LCD[] = { /* 0 3 4 5 6 7 10 11 16 */ #else #if 0 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*/0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,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 } + { 1,640,480,25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08}, + { 3,800,600,40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08}, + { 2,1024,768,65000,0xa3,/*0x6*/0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,0x08}, + { 0,1280,1024,108000,0xce,0x81,0xa6,0x9a,0x27,0x50,0x00,0x03,0x26,0xa8}, + { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -#endif +#else tridentLCD LCD[] = { - { 1,"640x480",25200,0x5f,0x80,0x52,0x1e,0xb,0x3e,0xea,0x0c,0xb,0x08}, - { 3,"800x600",40000,0x7f,0x00,0x69,0x7f,0x72,0xf0,0x59,0x0d,0x00,0x08}, - { 2,"1024x768",65000,0xa3,0x86,0x83,0x94,0x24,0xf5,0x03,0x09,0x24,0x08}, - { 0,"1280x1024",108000,0xce,0x91,0xa6,0x14,0x28,0x5a,0x01,0x04,0x28,0xa8}, - { 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + { 1,640,480,25200,0x5f,0x80,0x52,0x1e,0xb,0x3e,0xea,0x0c,0xb,0x08}, + { 3,800,600,40000,0x7f,0x00,0x69,0x7f,0x72,0xf0,0x59,0x0d,0x00,0x08}, + { 2,1024,768,65000,0xa3,0x00,0x84,0x94,0x24,0xf5,0x03,0x09,0x24,0x08}, + { 0,1280,1024,108000,0xce,0x91,0xa6,0x14,0x28,0x5a,0x01,0x04,0x28,0xa8}, + { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; #endif +#endif static const char *xaaSymbols[] = { "XAADestroyInfoRec", @@ -977,6 +990,7 @@ TRIDENTProbeDDC(ScrnInfoPtr pScrn, int index) if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -1336,8 +1350,10 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) */ if (xf86LoadSubModule(pScrn, "vbe")) { xf86MonPtr pMon; - pMon = vbeDoEDID(VBEInit(pTrident->Int10, - pTrident->pEnt->index), NULL); + vbeInfoPtr pVbe; + pVbe = VBEInit(pTrident->Int10, pTrident->pEnt->index); + pMon = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); if (pMon) { if (!xf86LoadSubModule(pScrn, "ddc")) { TRIDENTFreeRec(pScrn); @@ -1697,6 +1713,28 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; break; + case CYBERBLADEXP: + pTrident->ddc1Read = Tridentddc1Read; + ramtype = "SGRAM"; + pTrident->HasSGRAM = TRUE; + pTrident->NoAccel = TRUE; /* Disable acceleration */ + /* pTrident->IsCyber = TRUE; */ + Support24bpp = TRUE; + chipset = "Cyber/BladeXP"; + pTrident->NewClockCode = TRUE; + pTrident->frequency = NTSC; + break; + case CYBERBLADEXPm: + pTrident->ddc1Read = Tridentddc1Read; + ramtype = "SGRAM"; + pTrident->HasSGRAM = TRUE; + pTrident->NoAccel = TRUE; /* Disable acceleration */ + pTrident->IsCyber = TRUE; + Support24bpp = TRUE; + chipset = "CyberBlade/XPm"; + pTrident->NewClockCode = TRUE; + pTrident->frequency = NTSC; + break; } if (!pScrn->progClock) { @@ -1751,8 +1789,10 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) case 0x04: /* 8MB, but - hw cursor can't store above 4MB */ /* So, we force to 4MB for now */ /* pScrn->videoRam = 8192; */ - - if (pTrident->HWCursor) { + /* Appearantly this isn't true for the CYBER9397DVD */ + /* maybe some other chipsets aren't affected either */ + /* XXX this needs to be investigated further */ + if (pTrident->HWCursor && (pTrident->Chipset != CYBER9397DVD)) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Found 8MB board, using 4MB\n"); pScrn->videoRam = 4096; @@ -1793,11 +1833,14 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) for (i = 0; LCD[i].mode != 0xff; i++) { if (LCD[i].mode == ((mod >> 4) & 3)) { pTrident->lcdMode = i; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%s Panel %s found\n", + xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%s Panel %ix%i found\n", (dsp & 0x80) ? "TFT" : - ((dsp1 & 0x20) ? "DSTN" : "STN"), LCD[i].display); + ((dsp1 & 0x20) ? "DSTN" : "STN"), + LCD[i].display_x,LCD[i].display_y); } } + OUTB(0x3CE, FPConfig); + pTrident->lcdActive = (INB(0x3CF) & 0x10); } pTrident->MCLK = 0; @@ -2088,10 +2131,13 @@ TRIDENTMapMem(ScrnInfoPtr pScrn) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); + int mapsize = 0x10000; + + if (Is3Dchip) mapsize = 0x20000; if (IsPciCard && UseMMIO) pTrident->IOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, - pTrident->PciTag, pTrident->IOAddress, 0x20000); + pTrident->PciTag, pTrident->IOAddress, mapsize); else { pTrident->IOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, pTrident->IOAddress, 0x1000); @@ -2126,12 +2172,15 @@ static Bool TRIDENTUnmapMem(ScrnInfoPtr pScrn) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int mapsize = 0x10000; + + if (Is3Dchip) mapsize = 0x20000; /* * Unmap IO registers to virtual address space */ if (IsPciCard && UseMMIO) - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pTrident->IOBase, 0x20000); + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pTrident->IOBase, mapsize); else { pTrident->IOBase -= 0xF00; xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pTrident->IOBase, 0x1000); @@ -2211,6 +2260,8 @@ TRIDENTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case CYBERBLADEE4: case CYBER9397: case CYBER9397DVD: + case CYBERBLADEXP: + case CYBERBLADEXPm: /* Get ready for MUX mode */ if (pTrident->MUX && pScrn->bitsPerPixel == 8 && @@ -2773,6 +2824,21 @@ TRIDENTFreeScreen(int scrnIndex, int flags) static int TRIDENTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + if (pTrident->lcdActive && (pTrident->lcdMode != 0xff) + && ((mode->HDisplay > LCD[pTrident->lcdMode].display_x) + || (mode->VDisplay > LCD[pTrident->lcdMode].display_y))) { + xf86DrvMsg(scrnIndex,X_INFO, "Removing mode (%dx%d) " + "larger than the LCD panel (%dx%d)\n", + mode->HDisplay, + mode->VDisplay, + LCD[pTrident->lcdMode].display_x, + LCD[pTrident->lcdMode].display_y); + return(MODE_BAD); + } + return(MODE_OK); } 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 2b624a5b6..7b14751eb 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.82 2001/02/15 17:54:55 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.83 2001/04/06 16:51:19 dawes Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -108,6 +108,10 @@ static int pix24bpp = 0; #define TSENG_MINOR_VERSION 0 #define TSENG_PATCHLEVEL 0 +/* CRTC timing limits */ +#define Tseng_HMAX (4096-8) +#define Tseng_VMAX (2048-1) + /* * This contains the functions needed by the server after loading the * driver module. It must be supplied, and gets added the driver list by @@ -1677,8 +1681,8 @@ TsengPreInit(ScrnInfoPtr pScrn, int flags) pTseng->Bytesperpixel = 1; /* this is fake for < 8bpp, but simplifies other code */ /* hardware limits */ - pScrn->maxHValue = 4096 / pTseng->Bytesperpixel; - pScrn->maxVValue = 2048; + pScrn->maxHValue = Tseng_HMAX; + pScrn->maxVValue = Tseng_VMAX; /* * This must happen after pScrn->display has been set because @@ -2735,8 +2739,6 @@ TsengAdjustFrame(int scrnIndex, int x, int y, int flags) ModeStatus TsengValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { -#define Tseng_HMAX (4096-8) -#define Tseng_VMAX (2048-1) PDEBUG(" TsengValidMode\n"); @@ -2744,7 +2746,7 @@ TsengValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) is this needed? xf86ValidMode gets HMAX and VMAX variables, so it could deal with this. need to recheck hsize with mode->Htotal*mulFactor/divFactor /* Check for CRTC timing bits overflow. */ - if (mode->HTotal * pTseng->Bytesperpixel > Tseng_HMAX) { + if (mode->HTotal > Tseng_HMAX) { return MODE_BAD_HVALUE; } if (mode->VTotal > Tseng_VMAX) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c b/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c index 9066dba4a..919df18e5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c @@ -2,7 +2,7 @@ * video4linux Xv Driver * based on Michael Schimek's permedia 2 driver. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.20 2001/02/08 18:56:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.22 2001/04/05 20:13:47 dawes Exp $ */ #include "videodev.h" #include "xf86.h" @@ -17,13 +17,7 @@ #include "dgaproc.h" #include "xf86str.h" - #include <asm/ioctl.h> /* _IORW(xxx) #defines are here */ -#if 0 -typedef unsigned long ulong; -#endif - -/* XXX Lots of xalloc() calls don't check for failure. */ #if 0 # define DEBUG(x) (x) @@ -116,21 +110,22 @@ typedef struct _PortPrivRec { Bool StreamOn; /* file handle */ - int fd; - char devname[16]; - int useCount; + int nr; struct video_capability cap; /* RGB overlay */ struct video_buffer rgb_fbuf; struct video_window rgb_win; int rgbpalette; + int rgbdepth; /* attributes */ struct video_picture pict; struct video_audio audio; XF86VideoEncodingPtr enc; + int *input; + int *norm; int nenc,cenc; /* yuv to offscreen */ @@ -170,18 +165,36 @@ InputVideoFormats[] = { #define V4L_ATTR (sizeof(Attributes) / sizeof(XF86AttributeRec)) -static XF86AttributeRec Attributes[] = { - {XvSettable | XvGettable, -1000, 1000, XV_ENCODING}, - {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS}, - {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST}, - {XvSettable | XvGettable, -1000, 1000, XV_SATURATION}, - {XvSettable | XvGettable, -1000, 1000, XV_HUE}, - {XvSettable | XvGettable, 0, 1, XV_MUTE}, - {XvSettable | XvGettable, 0, 16*1000, XV_FREQ}, +static const XF86AttributeRec Attributes[] = { + {XvSettable | XvGettable, -1000, 1000, XV_ENCODING}, + {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS}, + {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST}, + {XvSettable | XvGettable, -1000, 1000, XV_SATURATION}, + {XvSettable | XvGettable, -1000, 1000, XV_HUE}, +}; +static const XF86AttributeRec VolumeAttr = + {XvSettable | XvGettable, -1000, 1000, XV_VOLUME}; +static const XF86AttributeRec MuteAttr = + {XvSettable | XvGettable, 0, 1, XV_MUTE}; +static const XF86AttributeRec FreqAttr = + {XvSettable | XvGettable, 0, 16*1000, XV_FREQ}; + + +#define MAX_V4L_DEVICES 4 +#define V4L_FD (v4l_devices[pPPriv->nr].fd) +#define V4L_REF (v4l_devices[pPPriv->nr].useCount) +#define V4L_NAME (v4l_devices[pPPriv->nr].devName) + +static struct V4L_DEVICE { + int fd; + int useCount; + char devName[16]; +} v4l_devices[MAX_V4L_DEVICES] = { + { -1 }, + { -1 }, + { -1 }, + { -1 }, }; -static XF86AttributeRec VolumeAttr = - {XvSettable | XvGettable, -1000, 1000, XV_VOLUME}; - /* ---------------------------------------------------------------------- */ /* forward decl */ @@ -194,21 +207,8 @@ static void V4lQueryBestSize(ScrnInfoPtr pScrn, Bool motion, static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn) { - -#if 0 - /* I don't know if this is needed or not. Alan Cox says no. EE */ - if (!xf86NoSharedMem(pScrn->scrnIndex)) { - xf86Msg(X_ERROR,"Screen %i cannot grant access to fb\n", - pScrn->scrnIndex); - return 1; - } -#endif - pPPriv->useCount++; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, - "Xv/open: refcount=%d\n",pPPriv->useCount)); - - if (pPPriv->fd == -1) { - pPPriv->fd = open(pPPriv->devname, O_RDWR, 0); + if (-1 == V4L_FD) { + V4L_FD = open(V4L_NAME, O_RDWR, 0); pPPriv->rgb_fbuf.width = pScrn->virtualX; pPPriv->rgb_fbuf.height = pScrn->virtualY; @@ -218,35 +218,43 @@ static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn) switch (pScrn->bitsPerPixel) { case 16: - if (pScrn->weight.green == 5) + if (pScrn->weight.green == 5) { pPPriv->rgbpalette = VIDEO_PALETTE_RGB555; - else + pPPriv->rgbdepth = 16; + } else { pPPriv->rgbpalette = VIDEO_PALETTE_RGB565; + pPPriv->rgbdepth = 16; + } break; case 24: pPPriv->rgbpalette = VIDEO_PALETTE_RGB24; + pPPriv->rgbdepth = 24; break; case 32: pPPriv->rgbpalette = VIDEO_PALETTE_RGB32; + pPPriv->rgbdepth = 32; break; } } - if (pPPriv->fd == -1) + if (-1 == V4L_FD) return errno; - + + V4L_REF++; + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + "Xv/open: refcount=%d\n",V4L_REF)); + return 0; } -static void V4lCloseDevice(PortPrivPtr pPPriv) +static void V4lCloseDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn) { - pPPriv->useCount--; - - DEBUG(xf86DrvMsgVerb(0, X_INFO, 2, - "Xv/close: refcount=%d\n",pPPriv->useCount)); - if(pPPriv->useCount == 0 && pPPriv->fd != -1) { - close(pPPriv->fd); - pPPriv->fd = -1; + V4L_REF--; + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + "Xv/close: refcount=%d\n",V4L_REF)); + if (0 == V4L_REF && -1 != V4L_FD) { + close(V4L_FD); + V4L_FD = -1; } } @@ -268,7 +276,7 @@ V4lPutVideo(ScrnInfoPtr pScrn, /* Open a file handle to the device */ if (VIDEO_OFF == pPPriv->VideoOn) { if (V4lOpenDevice(pPPriv, pScrn)) - return BadAccess; + return Success; } if (pPPriv->have_yuv) { @@ -319,19 +327,18 @@ V4lPutVideo(ScrnInfoPtr pScrn, } /* program driver */ - if (VIDEO_YUV != pPPriv->VideoOn) { - if (-1 == ioctl(pPPriv->fd,VIDIOCSFBUF,&(pPPriv->yuv_fbuf))) - perror("ioctl VIDIOCSFBUF"); - if (-1 == ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict)) - perror("ioctl VIDIOCGPICT"); - pPPriv->pict.palette = VIDEO_PALETTE_YUV422; - if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict)) - perror("ioctl VIDIOCSPICT"); - if (-1 == ioctl(pPPriv->fd,VIDIOCSWIN,&(pPPriv->yuv_win))) - perror("ioctl VIDIOCSWIN"); - if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &one)) - perror("ioctl VIDIOCCAPTURE(1)"); - } + if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->yuv_fbuf))) + perror("ioctl VIDIOCSFBUF"); + if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict)) + perror("ioctl VIDIOCGPICT"); + pPPriv->pict.palette = VIDEO_PALETTE_YUV422; + pPPriv->pict.depth = 16; + if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict)) + perror("ioctl VIDIOCSPICT"); + if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->yuv_win))) + perror("ioctl VIDIOCSWIN"); + if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one)) + perror("ioctl VIDIOCCAPTURE(1)"); if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) { /* invert cliplist */ @@ -415,30 +422,31 @@ V4lPutVideo(ScrnInfoPtr pScrn, pPPriv->rgb_win.clipcount)); if (0 != pPPriv->rgb_win.clipcount) { pPPriv->rgb_win.clips = xalloc(pPPriv->rgb_win.clipcount*sizeof(struct video_clip)); - memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip)); - pBox = REGION_RECTS(clipBoxes); - clip = pPPriv->rgb_win.clips; - for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) { - clip->x = pBox->x1 - dx; - clip->y = pBox->y1 - dy; - clip->width = pBox->x2 - pBox->x1; - clip->height = pBox->y2 - pBox->y1; + if (NULL != pPPriv->rgb_win.clips) { + memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip)); + pBox = REGION_RECTS(clipBoxes); + clip = pPPriv->rgb_win.clips; + for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) { + clip->x = pBox->x1 - dx; + clip->y = pBox->y1 - dy; + clip->width = pBox->x2 - pBox->x1; + clip->height = pBox->y2 - pBox->y1; + } } } /* start */ - if (VIDEO_RGB != pPPriv->VideoOn) { - if (-1 == ioctl(pPPriv->fd,VIDIOCSFBUF,&(pPPriv->rgb_fbuf))) - perror("ioctl VIDIOCSFBUF"); - if (-1 == ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict)) - perror("ioctl VIDIOCGPICT"); - pPPriv->pict.palette = pPPriv->rgbpalette; - if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict)) - perror("ioctl VIDIOCSPICT"); - } - if (-1 == ioctl(pPPriv->fd,VIDIOCSWIN,&(pPPriv->rgb_win))) + if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->rgb_fbuf))) + perror("ioctl VIDIOCSFBUF"); + if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict)) + perror("ioctl VIDIOCGPICT"); + pPPriv->pict.palette = pPPriv->rgbpalette; + pPPriv->pict.depth = pPPriv->rgbdepth; + if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict)) + perror("ioctl VIDIOCSPICT"); + if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->rgb_win))) perror("ioctl VIDIOCSWIN"); - if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &one)) + if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one)) perror("ioctl VIDIOCCAPTURE(1)"); pPPriv->VideoOn = VIDEO_RGB; @@ -475,7 +483,7 @@ V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) if (!exit) { /* just reclipping, we have to stop DMA transfers to the visible screen */ if (VIDEO_RGB == pPPriv->VideoOn) { - if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &zero)) + if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero)) perror("ioctl VIDIOCCAPTURE(0)"); pPPriv->VideoOn = VIDEO_RECLIP; } @@ -487,10 +495,10 @@ V4lStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) xfree(pPPriv->surface); pPPriv->surface = NULL; } - if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &zero)) + if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero)) perror("ioctl VIDIOCCAPTURE(0)"); - V4lCloseDevice(pPPriv); + V4lCloseDevice(pPPriv,pScrn); pPPriv->VideoOn = VIDEO_OFF; } } @@ -520,19 +528,19 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn, int ret = Success; if (V4lOpenDevice(pPPriv, pScrn)) - return BadAccess; + return Success; DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/SPA %d, %d\n", - attribute, value)); + attribute, value)); - if (-1 == pPPriv->fd) { - ret = Success /* FIXME: EBUSY/ENODEV ?? */; + if (-1 == V4L_FD) { + ret = Success; } else if (attribute == xvEncoding) { if (value >= 0 && value < pPPriv->nenc) { pPPriv->cenc = value; - chan.channel = value/3; - chan.norm = value%3; - if (-1 == ioctl(pPPriv->fd,VIDIOCSCHAN,&chan)) + chan.channel = pPPriv->input[value]; + chan.norm = pPPriv->norm[value]; + if (-1 == ioctl(V4L_FD,VIDIOCSCHAN,&chan)) perror("ioctl VIDIOCSCHAN"); } else { ret = BadValue; @@ -541,16 +549,16 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn, attribute == xvContrast || attribute == xvSaturation || attribute == xvHue) { - ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict); + ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict); if (attribute == xvBrightness) pPPriv->pict.brightness = xv_to_v4l(value); if (attribute == xvContrast) pPPriv->pict.contrast = xv_to_v4l(value); if (attribute == xvSaturation) pPPriv->pict.colour = xv_to_v4l(value); if (attribute == xvHue) pPPriv->pict.hue = xv_to_v4l(value); - if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict)) + if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict)) perror("ioctl VIDIOCSPICT"); } else if (attribute == xvMute || attribute == xvVolume) { - ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio); + ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio); if (attribute == xvMute) { if (value) pPPriv->audio.flags |= VIDEO_AUDIO_MUTE; @@ -563,10 +571,10 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn, ret = BadValue; } if (ret != BadValue) - if (-1 == ioctl(pPPriv->fd,VIDIOCSAUDIO,&pPPriv->audio)) + if (-1 == ioctl(V4L_FD,VIDIOCSAUDIO,&pPPriv->audio)) perror("ioctl VIDIOCSAUDIO"); } else if (attribute == xvFreq) { - if (-1 == ioctl(pPPriv->fd,VIDIOCSFREQ,&value)) + if (-1 == ioctl(V4L_FD,VIDIOCSFREQ,&value)) perror("ioctl VIDIOCSFREQ"); } else if (pPPriv->have_yuv && pPPriv->myfmt->setAttribute) { @@ -576,7 +584,7 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn, ret = BadValue; } - V4lCloseDevice(pPPriv); + V4lCloseDevice(pPPriv,pScrn); return ret; } @@ -588,24 +596,27 @@ V4lGetPortAttribute(ScrnInfoPtr pScrn, int ret = Success; if (V4lOpenDevice(pPPriv, pScrn)) - return BadAccess; + return Success; - if (-1 == pPPriv->fd) { - ret = Success /* FIXME: EBUSY/ENODEV ?? */; + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d\n", + attribute)); + + if (-1 == V4L_FD) { + ret = Success; } else if (attribute == xvEncoding) { *value = pPPriv->cenc; } else if (attribute == xvBrightness || attribute == xvContrast || attribute == xvSaturation || attribute == xvHue) { - ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict); + ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict); if (attribute == xvBrightness) *value = v4l_to_xv(pPPriv->pict.brightness); if (attribute == xvContrast) *value = v4l_to_xv(pPPriv->pict.contrast); if (attribute == xvSaturation) *value = v4l_to_xv(pPPriv->pict.colour); if (attribute == xvHue) *value = v4l_to_xv(pPPriv->pict.hue); } else if (attribute == xvMute || attribute == xvVolume) { - ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio); + ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio); if (attribute == xvMute) { *value = (pPPriv->audio.flags & VIDEO_AUDIO_MUTE) ? 1 : 0; } else if (attribute == xvVolume) { @@ -615,7 +626,7 @@ V4lGetPortAttribute(ScrnInfoPtr pScrn, ret = BadValue; } } else if (attribute == xvFreq) { - ioctl(pPPriv->fd,VIDIOCGFREQ,value); + ioctl(V4L_FD,VIDIOCGFREQ,value); } else if (pPPriv->have_yuv && pPPriv->myfmt->getAttribute) { /* not mine -> pass to yuv scaler driver */ @@ -627,7 +638,7 @@ V4lGetPortAttribute(ScrnInfoPtr pScrn, DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d, %d\n", attribute, *value)); - V4lCloseDevice(pPPriv); + V4lCloseDevice(pPPriv,pScrn); return ret; } @@ -679,55 +690,144 @@ fixname(char *str) return str; } -static XF86VideoEncodingPtr -V4LBuildEncodings(int fd, int *count, int channels) +static int +v4l_add_enc(XF86VideoEncodingPtr enc, int i, + char *norm, char *input, int width, int height, int n, int d) { - static struct video_channel channel; - XF86VideoEncodingPtr enc; - int i; + enc[i].id = i; + enc[i].name = xalloc(strlen(norm)+strlen(input)+2); + if (NULL == enc[i].name) + return -1; + enc[i].width = width; + enc[i].height = height; + enc[i].rate.numerator = n; + enc[i].rate.denominator = d; + sprintf(enc[i].name,"%s-%s",norm,fixname(input)); + return 0; +} - enc = xalloc(sizeof(XF86VideoEncodingRec)*3*channels); - memset(enc,0,sizeof(XF86VideoEncodingRec)*3*channels); +static void +V4LBuildEncodings(PortPrivPtr p, int fd, int channels) +{ + static struct video_channel channel; + int i,entries,have_bttv; - for (i = 0; i < 3*channels; ) { - channel.channel = i/3; +#define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int) + have_bttv = 0; + if (-1 != ioctl(fd,BTTV_VERSION,NULL)) + have_bttv = 1; + + entries = (have_bttv ? 7 : 3) * channels; + p->enc = xalloc(sizeof(XF86VideoEncodingRec) * entries); + if (NULL == p->enc) + goto fail; + memset(p->enc,0,sizeof(XF86VideoEncodingRec) * entries); + p->norm = xalloc(sizeof(int) * entries); + if (NULL == p->norm) + goto fail; + memset(p->norm,0,sizeof(int) * entries); + p->input = xalloc(sizeof(int) * entries); + if (NULL == p->input) + goto fail; + memset(p->input,0,sizeof(int) * entries); + + p->nenc = 0; + for (i = 0; i < channels; i++) { + channel.channel = i; if (-1 == ioctl(fd,VIDIOCGCHAN,&channel)) { perror("ioctl VIDIOCGCHAN"); - return NULL; + continue; + } + + v4l_add_enc(p->enc, p->nenc,"pal", channel.name, 768,576, 1,50); + p->norm[p->nenc] = VIDEO_MODE_PAL; + p->input[p->nenc] = i; + p->nenc++; + + v4l_add_enc(p->enc,p->nenc,"ntsc", channel.name, 640,480, 1001,60000); + p->norm[p->nenc] = VIDEO_MODE_NTSC; + p->input[p->nenc] = i; + p->nenc++; + + v4l_add_enc(p->enc,p->nenc,"secam",channel.name, 768,576, 1,50); + p->norm[p->nenc] = VIDEO_MODE_SECAM; + p->input[p->nenc] = i; + p->nenc++; + + if (have_bttv) { + /* workaround for a v4l design flaw: The v4l API knows just pal, + ntsc and secam. But there are a few more norms (pal versions + with a different timings used in south america for example). + The bttv driver can handle these too. */ + if (0 != v4l_add_enc(p->enc,p->nenc,"palnc",channel.name, + 640, 576, 1,50)) + goto fail; + p->norm[p->nenc] = 3; + p->input[p->nenc] = i; + p->nenc++; + + if (0 != v4l_add_enc(p->enc,p->nenc,"palm",channel.name, + 640, 576, 1,50)) + goto fail; + p->norm[p->nenc] = 4; + p->input[p->nenc] = i; + p->nenc++; + + if (0 != v4l_add_enc(p->enc, p->nenc,"paln", channel.name, + 768,576, 1,50)) + goto fail; + p->norm[p->nenc] = 5; + p->input[p->nenc] = i; + p->nenc++; + + if (0 != v4l_add_enc(p->enc,p->nenc,"ntscjp", channel.name, + 640,480, 1001,60000)) + goto fail; + p->norm[p->nenc] = 6; + p->input[p->nenc] = i; + p->nenc++; } + } + return; + + fail: + if (p->input) + xfree(p->input); + p->input = NULL; + if (p->norm) + xfree(p->norm); + p->norm = NULL; + if (p->enc) + xfree(p->enc); + p->enc = NULL; + p->nenc = 0; +} - /* one for PAL ... */ - enc[i].id = i; - enc[i].name = malloc(strlen(channel.name)+8); - enc[i].width = 768; - enc[i].height = 576; - enc[i].rate.numerator = 1; - enc[i].rate.denominator = 50; - sprintf(enc[i].name,"pal-%s",fixname(channel.name)); - i++; - - /* NTSC */ - enc[i].id = i; - enc[i].name = malloc(strlen(channel.name)+8); - enc[i].width = 640; - enc[i].height = 480; - enc[i].rate.numerator = 1001; - enc[i].rate.denominator = 60000; - sprintf(enc[i].name,"ntsc-%s",fixname(channel.name)); - i++; - - /* SECAM */ - enc[i].id = i; - enc[i].name = malloc(strlen(channel.name)+8); - enc[i].width = 768; - enc[i].height = 576; - enc[i].rate.numerator = 1; - enc[i].rate.denominator = 50; - sprintf(enc[i].name,"secam-%s",fixname(channel.name)); - i++; +/* add a attribute a list */ +static void +v4l_add_attr(XF86AttributeRec **list, int *count, + const XF86AttributeRec *attr) +{ + XF86AttributeRec *oldlist = *list; + int i; + + for (i = 0; i < *count; i++) { + if (0 == strcmp((*list)[i].name,attr->name)) { + DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name)); + return; + } + } + + DEBUG(xf86Msg(X_INFO, "v4l: add attr %s\n",attr->name)); + *list = xalloc((*count + 1) * sizeof(XF86AttributeRec)); + if (NULL == *list) { + *count = 0; + return; } - *count = i; - return enc; + if (*count) + memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec)); + memcpy(*list + *count, attr, sizeof(XF86AttributeRec)); + (*count)++; } static int @@ -737,13 +837,12 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) PortPrivPtr pPPriv; DevUnion *Private; XF86VideoAdaptorPtr *VAR = NULL; - XF86VideoEncodingPtr enc; char dev[18]; - int fd,i,j,nenc; + int fd,i,j; DEBUG(xf86Msg(X_INFO, "v4l: init start\n")); - for (i = 0; i < 4; i++) { + for (i = 0; i < MAX_V4L_DEVICES; i++) { sprintf(dev, "/dev/video%d", i); fd = open(dev, O_RDWR, 0); if (fd == -1) { @@ -752,32 +851,32 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) if (fd == -1) break; } - - DEBUG(xf86Msg(X_INFO, "v4l: %s ok\n",dev)); + DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev)); /* our private data */ pPPriv = xalloc(sizeof(PortPrivRec)); if (!pPPriv) return FALSE; memset(pPPriv,0,sizeof(PortPrivRec)); - pPPriv->fd = -1; - strncpy(pPPriv->devname, dev, 16); - pPPriv->useCount=0; /* check device */ - if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) || - NULL == (enc = V4LBuildEncodings - (fd,&nenc,pPPriv->cap.channels))) { + if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) || + 0 == (pPPriv->cap.type & VID_TYPE_OVERLAY)) { + DEBUG(xf86Msg(X_INFO, "v4l: %s: no overlay support\n",dev)); xfree(pPPriv); break; } - pPPriv->enc = enc; - pPPriv->nenc = nenc; + strncpy(V4L_NAME, dev, 16); + V4LBuildEncodings(pPPriv,fd,pPPriv->cap.channels); + if (NULL == pPPriv->enc) + return FALSE; #if 1 - /* check for yuv (see if the driver accepts VIDEO_PALETTE_YUV422) */ + /* test v4l device for yuv support: check if the driver + accepts VIDEO_PALETTE_YUV422 */ ioctl(fd,VIDIOCGPICT,&pPPriv->pict); pPPriv->pict.palette = VIDEO_PALETTE_YUV422; + pPPriv->pict.depth = 16; if (0 == ioctl(fd,VIDIOCSPICT,&pPPriv->pict)) { ioctl(fd,VIDIOCGPICT,&pPPriv->pict); if (VIDEO_PALETTE_YUV422 == pPPriv->pict.palette) { @@ -808,20 +907,36 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) return FALSE; memset(VAR[i],0,sizeof(XF86VideoAdaptorRec)); - /* add attribute lists */ + + /* build attribute list */ + for (j = 0; j < V4L_ATTR; j++) { + /* video attributes */ + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + &Attributes[j]); + } + if (0 == ioctl(fd,VIDIOCGAUDIO,&pPPriv->audio)) { + /* audio attributes */ + if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME) + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + &VolumeAttr); + if (pPPriv->audio.flags & VIDEO_AUDIO_MUTABLE) + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + &MuteAttr); + } + if (pPPriv->cap.type & VID_TYPE_TUNER) { + /* tuner attributes */ + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + &FreqAttr); + } if (pPPriv->have_yuv) { - VAR[i]->nAttributes = V4L_ATTR + pPPriv->myfmt->num_attributes; - VAR[i]->pAttributes = xalloc(VAR[i]->nAttributes * - sizeof(XF86AttributeRec)); - memcpy(VAR[i]->pAttributes, Attributes, - sizeof(XF86AttributeRec) * V4L_ATTR); - memcpy(VAR[i]->pAttributes+V4L_ATTR, pPPriv->myfmt->attributes, - sizeof(XF86AttributeRec) * pPPriv->myfmt->num_attributes); - } else { - VAR[i]->nAttributes = V4L_ATTR; - VAR[i]->pAttributes = Attributes; + /* pass throuth scaler attributes */ + for (j = 0; j < pPPriv->myfmt->num_attributes; j++) { + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + pPPriv->myfmt->attributes+j); + } } - + + /* hook in private data */ Private = xalloc(sizeof(DevUnion)); if (!Private) @@ -843,32 +958,12 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) VAR[i]->GetPortAttribute = V4lGetPortAttribute; VAR[i]->QueryBestSize = V4lQueryBestSize; - VAR[i]->nEncodings = nenc; - VAR[i]->pEncodings = enc; + VAR[i]->nEncodings = pPPriv->nenc; + VAR[i]->pEncodings = pPPriv->enc; VAR[i]->nFormats = sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]); VAR[i]->pFormats = InputVideoFormats; - /* Check whether we have VIDEO_AUDIO_VOLUME */ - if (!ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio) && - pPPriv->audio.flags & VIDEO_AUDIO_VOLUME) { - XF86AttributeRec *oldattrs = VAR[i]->pAttributes; - int nattrs = VAR[i]->nAttributes; - - DEBUG(xf86Msg(X_INFO, "v4l: Volume supported, adding XV_VOLUME to attribute list\n")); - - VAR[i]->pAttributes = xalloc((nattrs + 1) * - sizeof(XF86AttributeRec)); - memcpy(VAR[i]->pAttributes, oldattrs, - sizeof(XF86AttributeRec) * nattrs); - memcpy(VAR[i]->pAttributes+nattrs, &VolumeAttr, - sizeof(XF86AttributeRec)); - VAR[i]->nAttributes++; - } else { - DEBUG(xf86Msg(X_INFO, "v4l: Volume not supported\n")); - } - - if (fd != -1) close(fd); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h b/xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h index 460ebcd27..77b592ef9 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h @@ -7,9 +7,9 @@ * Used here with the explicit permission of the original author, Alan Cox. * <alan@lxorguk.ukuu.org.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h,v 1.7 1999/05/15 15:31:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h,v 1.8 2001/03/03 22:46:31 tsi Exp $ */ -#include <Xmd.h> +#include "Xmd.h" #define VID_TYPE_CAPTURE 1 /* Can capture */ #define VID_TYPE_TUNER 2 /* Can tune */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c index 0847547d4..6b7750ef4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c @@ -1,4 +1,4 @@ -#define DEBUG +#define DEBUG_VERB 2 /* * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) * @@ -27,7 +27,7 @@ * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.12 2001/02/16 01:45:45 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.15 2001/04/01 14:00:12 tsi Exp $ */ #include "vesa.h" @@ -479,9 +479,8 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) if ((pScrn->monitor->DDC = pVesa->monitor) != NULL) xf86SetDDCproperties(pScrn, pVesa->monitor); -#ifdef DEBUG - ErrorF("Searching for matching VESA mode(s):\n"); -#endif + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DEBUG_VERB, + "Searching for matching VESA mode(s):\n"); i = 0; while (vbe->VideoModePtr[i] != 0xffff) { @@ -489,54 +488,94 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) if ((mode = VBEGetModeInfo(pVesa->pVbe, id)) == NULL) continue; -#ifdef DEBUG - ErrorF("Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); - ErrorF(" ModeAttributes: 0x%x\n", mode->ModeAttributes); - ErrorF(" WinAAttributes: 0x%x\n", mode->WinAAttributes); - ErrorF(" WinBAttributes: 0x%x\n", mode->WinBAttributes); - ErrorF(" WinGranularity: %d\n", mode->WinGranularity); - ErrorF(" WinSize: %d\n", mode->WinSize); - ErrorF(" WinASegment: 0x%x\n", mode->WinASegment); - ErrorF(" WinBSegment: 0x%x\n", mode->WinBSegment); - ErrorF(" WinFuncPtr: 0x%x\n", mode->WinFuncPtr); - ErrorF(" BytesPerScanline: %d\n", mode->BytesPerScanline); - ErrorF(" XResolution: %d\n", mode->XResolution); - ErrorF(" YResolution: %d\n", mode->YResolution); - ErrorF(" XCharSize: %d\n", mode->XCharSize); - ErrorF(" YCharSize: %d\n", mode->YCharSize); - ErrorF(" NumberOfPlanes: %d\n", mode->NumberOfPlanes); - ErrorF(" BitsPerPixel: %d\n", mode->BitsPerPixel); - ErrorF(" NumberOfBanks: %d\n", mode->NumberOfBanks); - ErrorF(" MemoryModel: %d\n", mode->MemoryModel); - ErrorF(" BankSize: %d\n", mode->BankSize); - ErrorF(" NumberOfImages: %d\n", mode->NumberOfImages); - ErrorF(" RedMaskSize: %d\n", mode->RedMaskSize); - ErrorF(" RedFieldPosition: %d\n", mode->RedFieldPosition); - ErrorF(" GreenMaskSize: %d\n", mode->GreenMaskSize); - ErrorF(" GreenFieldPosition: %d\n", mode->GreenFieldPosition); - ErrorF(" BlueMaskSize: %d\n", mode->BlueMaskSize); - ErrorF(" BlueFieldPosition: %d\n", mode->BlueFieldPosition); - ErrorF(" RsvdMaskSize: %d\n", mode->RsvdMaskSize); - ErrorF(" RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); - ErrorF(" DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); + xf86ErrorFVerb(DEBUG_VERB, + "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); + xf86ErrorFVerb(DEBUG_VERB, + " ModeAttributes: 0x%x\n", mode->ModeAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinAAttributes: 0x%x\n", mode->WinAAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinBAttributes: 0x%x\n", mode->WinBAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinGranularity: %d\n", mode->WinGranularity); + xf86ErrorFVerb(DEBUG_VERB, + " WinSize: %d\n", mode->WinSize); + xf86ErrorFVerb(DEBUG_VERB, + " WinASegment: 0x%x\n", mode->WinASegment); + xf86ErrorFVerb(DEBUG_VERB, + " WinBSegment: 0x%x\n", mode->WinBSegment); + xf86ErrorFVerb(DEBUG_VERB, + " WinFuncPtr: 0x%x\n", mode->WinFuncPtr); + xf86ErrorFVerb(DEBUG_VERB, + " BytesPerScanline: %d\n", mode->BytesPerScanline); + xf86ErrorFVerb(DEBUG_VERB, + " XResolution: %d\n", mode->XResolution); + xf86ErrorFVerb(DEBUG_VERB, + " YResolution: %d\n", mode->YResolution); + xf86ErrorFVerb(DEBUG_VERB, + " XCharSize: %d\n", mode->XCharSize); + xf86ErrorFVerb(DEBUG_VERB, + " YCharSize: %d\n", mode->YCharSize); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfPlanes: %d\n", mode->NumberOfPlanes); + xf86ErrorFVerb(DEBUG_VERB, + " BitsPerPixel: %d\n", mode->BitsPerPixel); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfBanks: %d\n", mode->NumberOfBanks); + xf86ErrorFVerb(DEBUG_VERB, + " MemoryModel: %d\n", mode->MemoryModel); + xf86ErrorFVerb(DEBUG_VERB, + " BankSize: %d\n", mode->BankSize); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfImages: %d\n", mode->NumberOfImages); + xf86ErrorFVerb(DEBUG_VERB, + " RedMaskSize: %d\n", mode->RedMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " RedFieldPosition: %d\n", mode->RedFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " GreenMaskSize: %d\n", mode->GreenMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " GreenFieldPosition: %d\n", mode->GreenFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " BlueMaskSize: %d\n", mode->BlueMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " BlueFieldPosition: %d\n", mode->BlueFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " RsvdMaskSize: %d\n", mode->RsvdMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); if (pVesa->major >= 2) { - ErrorF(" PhysBasePtr: 0x%x\n", mode->PhysBasePtr); + xf86ErrorFVerb(DEBUG_VERB, + " PhysBasePtr: 0x%x\n", mode->PhysBasePtr); if (pVesa->major >= 3) { - ErrorF(" LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine); - ErrorF(" BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages); - ErrorF(" LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages); - ErrorF(" LinRedMaskSize: %d\n", mode->LinRedMaskSize); - ErrorF(" LinRedFieldPosition: %d\n", mode->LinRedFieldPosition); - ErrorF(" LinGreenMaskSize: %d\n", mode->LinGreenMaskSize); - ErrorF(" LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition); - ErrorF(" LinBlueMaskSize: %d\n", mode->LinBlueMaskSize); - ErrorF(" LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition); - ErrorF(" LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize); - ErrorF(" LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition); - ErrorF(" MaxPixelClock: %d\n", mode->MaxPixelClock); + xf86ErrorFVerb(DEBUG_VERB, + " LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine); + xf86ErrorFVerb(DEBUG_VERB, + " BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages); + xf86ErrorFVerb(DEBUG_VERB, + " LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages); + xf86ErrorFVerb(DEBUG_VERB, + " LinRedMaskSize: %d\n", mode->LinRedMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinRedFieldPosition: %d\n", mode->LinRedFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinGreenMaskSize: %d\n", mode->LinGreenMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinBlueMaskSize: %d\n", mode->LinBlueMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " MaxPixelClock: %d\n", mode->MaxPixelClock); } } -#endif if (!(mode->ModeAttributes & (1 << 0)) || /* supported in the configured hardware */ !(mode->ModeAttributes & (1 << 4)) || /* text mode */ @@ -587,15 +626,16 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) } -#ifdef DEBUG - ErrorF("\n"); - ErrorF("Total Memory: %d 64Kb banks (%dM)\n", vbe->TotalMemory, + xf86ErrorFVerb(DEBUG_VERB, "\n"); + xf86ErrorFVerb(DEBUG_VERB, + "Total Memory: %d 64Kb banks (%dM)\n", vbe->TotalMemory, (vbe->TotalMemory * 65536) / (1024 * 1024)); -#endif pVesa->mapSize = vbe->TotalMemory * 65536; - if (pScrn->modePool == NULL) + if (pScrn->modePool == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No matching modes\n"); return (FALSE); + } for (i = 0; pScrn->modePool != NULL && pScrn->display->modes[i] != NULL; i++) { pMode = pScrn->modePool; @@ -704,8 +744,12 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) pScrn->currentMode = pScrn->modes; pScrn->displayWidth = pScrn->virtualX; - if (pScrn->modes == NULL) + xf86PrintModes(pScrn); + + if (pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes\n"); return (FALSE); + } /* options */ xf86CollectOptions(pScrn, NULL); @@ -812,7 +856,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pVesa->mapOff = 0; } - if ((void*)pVesa->mapPhys == NULL) { + if (pVesa->mapPhys == 0) { pVesa->mapPhys = 0xa0000; pVesa->mapSize = 0x10000; } @@ -1023,6 +1067,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) VESALoadPalette, NULL, flags)) return (FALSE); + pVesa->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = VESACloseScreen; pScreen->SaveScreen = VESASaveScreen; @@ -1061,7 +1106,8 @@ VESACloseScreen(int scrnIndex, ScreenPtr pScreen) xfree(pVesa->pDGAMode); pScrn->vtSema = FALSE; - return (TRUE); + pScreen->CloseScreen = pVesa->CloseScreen; + return pScreen->CloseScreen(scrnIndex, pScreen); } static Bool @@ -1152,10 +1198,9 @@ VESAMapVidMem(ScrnInfoPtr pScrn) else pVesa->VGAbase = pVesa->base; } -#ifdef DEBUG - ErrorF("virtual address = %p - physical address = %p - size = %d\n", + xf86ErrorFVerb(DEBUG_VERB, + "virtual address = %p - physical address = %p - size = %d\n", pVesa->base, pScrn->memPhysBase, pVesa->mapSize); -#endif return (pVesa->base != NULL); } @@ -1287,7 +1332,9 @@ VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, static void WriteAttr(int index, int value) { - CARD8 tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + CARD8 tmp; + + tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); index |= 0x20; outb(VGA_ATTR_INDEX, index); @@ -1297,7 +1344,9 @@ WriteAttr(int index, int value) static int ReadAttr(int index) { - CARD8 tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + CARD8 tmp; + + tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); index |= 0x20; outb(VGA_ATTR_INDEX, index); @@ -1597,7 +1646,7 @@ VESADGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName, VESAPtr pVesa = VESAGetRec(pScrn); *DeviceName = NULL; /* No special device */ - *ApertureBase = (unsigned char *)(pVesa->mapPhys); + *ApertureBase = (unsigned char *)(long)(pVesa->mapPhys); *ApertureSize = pVesa->mapSize; *ApertureOffset = pVesa->mapOff; *flags = DGA_NEED_ROOT; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h index 2fd47666c..1762da648 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h @@ -26,7 +26,7 @@ * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.7 2001/02/15 20:00:14 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.8 2001/03/22 03:10:58 dawes Exp $ */ #ifndef _VESA_H_ @@ -112,6 +112,7 @@ typedef struct _VESARec /* DGA info */ DGAModePtr pDGAMode; int nDGAMode; + CloseScreenProcPtr CloseScreen; } VESARec, *VESAPtr; typedef struct _ModeInfoData { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile new file mode 100644 index 000000000..df44030f8 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile @@ -0,0 +1,53 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile,v 1.1 2001/04/05 19:29:43 dawes Exp $ +XCOMM +XCOMM This is an Imakefile for the VMware virtual SVGA driver. +XCOMM + +#define IHaveModules +#include <Server.tmpl> + +SRCS = vmware.c vmwaregc.c vmwarefs.c vmwarepolypnt.c vmwarepush.c \ + vmwareglblt.c vmwaretext.c vmwarerect.c vmwarefillarc.c \ + vmwareply1rct.c vmwarezerarc.c vmwareline.c vmwareblt.c vmwareimage.c \ + vmwarewindow.c vmwarecurs.c vmwarebstor.c bits2pixels.c + +OBJS = vmware.o vmwaregc.o vmwarefs.o vmwarepolypnt.o vmwarepush.o \ + vmwareglblt.o vmwaretext.o vmwarerect.o vmwarefillarc.o \ + vmwareply1rct.o vmwarezerarc.o vmwareline.o vmwareblt.o vmwareimage.o \ + vmwarewindow.o vmwarecurs.o vmwarebstor.o bits2pixels.o + +#if defined(XF86DriverSDK) +INCLUDES = -I. -I../../include +#else +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ + -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(XF86SRC)/int10 \ + -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \ + -I$(XF86SRC)/vgahw -I$(XF86SRC)/fbdevhw \ + -I$(XF86SRC)/ramdac -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ + -I$(SERVERSRC)/Xext -I$(XF86SRC)/xf8_32bpp\ + -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(XF86SRC)/xf24_32bpp -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) \ + -I$(XF86OSSRC)/vbe $(DRIINCLUDES) +#endif + +DEFINES = -DPSZ=8 $(DRIDEFINES) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget(vmware,$(OBJS)) + +InstallObjectModule(vmware,$(MODULEDIR),drivers) + +#if !defined(XF86DriverSDK) +InstallModuleManPage(vmware) +#endif + +DependTarget() + +InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/vmware) + +InstallDriverSDKObjectModule(vmware,$(DRIVERSDKMODULEDIR),drivers) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/README b/xc/programs/Xserver/hw/xfree86/drivers/vmware/README new file mode 100644 index 000000000..938856018 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/README @@ -0,0 +1,346 @@ + +Copyright (C) 1999-2001 VMware, Inc. +All Rights Reserved + +The code here may be used/distributed under the terms of the standard +XFree86 license. + + + + VMware SVGA Device Interface and Programming Model + -------------------------------------------------- + + +Include Files +------------- + +svga_reg.h + SVGA register definitions, SVGA capabilities, and FIFO command definitions. + +svga_limits.h + Included by svga_reg.h, defines maximum frame buffer and memory region + sizes. + +guest_os.h + Values for the GUEST_ID register. + +vm_basic_types.h + Common type definitions. + +vm_device_version.h + PCI vendor ID's and related information. + + +Programming the VMware SVGA Device +---------------------------------- + +1. Reading/writing a register: + To read a register: + Set the index port to the index of the register, using a dword OUT + Do a dword IN from the value port + + To write a register: + Set the index port to the index of the register, using a dword OUT + Do a dword OUT to the value port + +2. Initialization + Check the version number + loop: + Write into SVGA_REG_ID the maximum SVGA_ID_* the driver supports. + Read from SVGA_REG_ID. + Check if it is the value you wrote. + If yes, VMware SVGA device supports it + If no, decrement SVGA_ID_* and goto loop + This algorithm converges. + + Map the frame buffer and the command FIFO + Read SVGA_REG_FB_START, SVGA_REG_FB_SIZE, SVGA_REG_MEM_START, + SVGA_REG_MEM_SIZE. + Map the frame buffer (FB) and the FIFO memory (MEM) + + Get the frame buffer dimensions + Read SVGA_REG_MAX_WIDTH, SVGA_REG_MAX_HEIGHT, SVGA_REG_BITS_PER_PIXEL + + SetMode + Set SVGA_REG_WIDTH, SVGA_REG_HEIGHT + Read SVGA_REG_FB_OFFSET + (SVGA_REG_FB_OFFSET is the offset from SVGA_REG_FB_START of the + visible portion of the frame buffer) + Read SVGA_REG_BYTES_PER_LINE, SVGA_REG_PSEUDOCOLOR, SVGA_REG_GREEN_MASK, + SVGA_REG_RED_MASK + + Enable SVGA + Set SVGA_REG_ENABLE to 1 + (to disable SVGA, set SVGA_REG_ENABLE to 0) + + Initialize the command FIFO + The FIFO is exclusively dword (32-bit) aligned. The first four + dwords define the portion of the MEM area that is used for the + command FIFO. These are values are all in byte offsets from the + start of the MEM area. + + A minimum sized FIFO would have these values: + mem[SVGA_FIFO_MIN] = 16; + mem[SVGA_FIFO_MAX] = 16 + (10 * 1024); + mem[SVGA_FIFO_NEXT_CMD] = 16; + mem[SVGA_FIFO_STOP] = 16; + + Write SVGA_REG_CONFIG_DONE after these values have been set. + +3. SVGA command FIFO protocol + The FIFO is empty when SVGA_FIFO_NEXT_CMD == SVGA_FIFO_STOP. The + driver writes commands to the FIFO starting at the offset specified + by SVGA_FIFO_NEXT_CMD, and then increments SVGA_FIFO_NEXT_CMD. + + The FIFO is full when SVGA_FIFO_NEXT_CMD is one word before SVGA_FIFO_STOP. + + When the FIFO becomes full, the FIFO should be sync'd + + To sync the FIFO + Write SVGA_REG_SYNC + Read SVGA_REG_BUSY + Wait for the value in SVGA_REG_BUSY to be 0 + + The FIFO should be sync'd before the driver touches the frame buffer, to + guarantee that any outstanding BLT's are completed. + +4. Capabilities + The capabilities of the SVGA device can be queried by reading + SVGA_REG_CAPABILITIES. + + +Drawing to the Screen +--------------------- + +After initialization, the driver can write directly to the frame buffer. +The updated frame buffer is not displayed immediately, but only when +an update command is sent. The update command (SVGA_CMD_UPDATE) defines +the rectangle in the frame buffer that has been modified by the driver, +and causes that rectangle to be updated on the screen. + +A complete driver can be developed this way. For increased performance, +additional commands are available to accelerate common operations. The +two most useful are SVGA_CMD_RECT_FILL and SVGA_CMD_RECT_COPY. + +After issuing an accelerated command, the FIFO should be sync'd, as +described above, before writing to the frame buffer. + + +Addendum on 7/11/2000 +--------------------- + +SVGA_REG_FB_OFFSET and SVGA_REG_BYTES_PER_LINE may change after +SVGA_REG_WIDTH or SVGA_REG_HEIGHT is set. Also the VGA registers must +be written to after setting SVGA_REG_ENABLE to 0 to change the display +to a VGA mode. + + +Capabilities +------------ + +The capabilities register (SVGA_REG_CAPABILITIES) is an array of +bits that indicates the capabilities of the SVGA emulation. +This table shows what commands are available, depending on the +capabilities: + + Command Capability + ------- ---------- + + SVGA_CMD_RECT_FILL SVGA_CAP_RECT_FILL + SVGA_CMD_RECT_COPY SVGA_CAP_RECT_COPY + SVGA_CMD_DEFINE_BITMAP SVGA_CAP_OFFSCREEN + SVGA_CMD_DEFINE_BITMAP_SCANLINE SVGA_CAP_OFFSCREEN + SVGA_CMD_DEFINE_PIXMAP SVGA_CAP_OFFSCREEN + SVGA_CMD_DEFINE_PIXMAP_SCANLINE SVGA_CAP_OFFSCREEN + SVGA_CMD_RECT_BITMAP_FILL SVGA_CAP_RECT_PAT_FILL + SVGA_CMD_RECT_PIXMAP_FILL SVGA_CAP_RECT_PAT_FILL + SVGA_CMD_RECT_BITMAP_COPY SVGA_CAP_RECT_PAT_FILL + SVGA_CMD_RECT_PIXMAP_COPY SVGA_CAP_RECT_PAT_FILL + SVGA_CMD_FREE_OBJECT SVGA_CAP_OFFSCREEN + SVGA_CMD_RECT_ROP_FILL SVGA_CAP_RECT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_COPY SVGA_CAP_RECT_COPY + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_BITMAP_FILL SVGA_CAP_RECT_PAT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_PIXMAP_FILL SVGA_CAP_RECT_PAT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_BITMAP_COPY SVGA_CAP_RECT_PAT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_PIXMAP_COPY SVGA_CAP_RECT_PAT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_DEFINE_CURSOR SVGA_CAP_CURSOR + SVGA_CMD_DISPLAY_CURSOR SVGA_CAP_CURSOR + SVGA_CMD_MOVE_CURSOR SVGA_CAP_CURSOR + +The ability to program the cursor directly through the registers +(described in the next section) is indicated by the capability +SVGA_CAP_CURSOR_BYPASS. + + +Cursor Handling +--------------- + +Starting with GSX Server Beta 3 (after 11/15/2000), a new cursor interface +was added that bypasses the FIFO. This is programmed using the +registers SVGA_REG_CURSOR_ID, SVGA_REG_CURSOR_X, SVGA_REG_CURSOR_Y, +and SVGA_REG_CURSOR_ON. + +First, the cursor must be defined using the FIFO command +SVGA_CMD_DEFINE_CURSOR. This command allocates a cursor ID and +associates two pixmaps with the cursor, the AND mask and the XOR mask. + +To display the cursor, the ID must be written to SVGA_REG_CURSOR_ID, +the coordinates written to SVGA_REG_CURSOR_X and SVGA_REG_CURSOR_Y, +then the value 1 must be written to SVGA_REG_CURSOR_ON. No display +occurs until SVGA_REG_CURSOR_ON is written. The same sequence is used +to move the cursor. + +To turn the cursor off, the ID must be written to SVGA_REG_CURSOR_ID, +and the value 0 must be written to SVGA_REG_CURSOR_ON. + +NOTE: The cursor must be turned off before touching the frame buffer, +because it is actually drawn into the frame buffer memory in the case +of direct graphics mode (e.g. full screen mode on Linux). The cursor +does not have to be turned off before issuing an accelerated command +via the command FIFO, this case is handled by the SVGA device. + + +Driver Version Numbers +---------------------- + +The SVGA drivers use the following convention for their version numbers: + +Version 10.0 - The first version that uses the FIFO +Version 10.1 - The version that uses the hardware cursor emulation via the FIFO +Version 10.2 - The version that uses the cursor that bypasses the FIFO + + +Frequently Asked Questions +-------------------------- + +1. My driver doesn't display anything, what's going on? + +First check if you are issuing an SVGA_CMD_UPDATE after drawing to +the screen. Another check you can do is to run your driver in full +screen mode on a Linux host. In this case you are drawing directly +on the frame buffer, so what you draw to the screen will be immediately +visible. If nothing is visible in this case, then most likely your +driver hasn't mapped the frame buffer correctly. + +A discrepancy between what you get in full screen mode and what you +get in window mode indicates that you have a missing or incorrect +update command. + + +2. What's the difference between bitmaps and pixmaps? + +Pixmaps have the same depth as the screen, while bitmaps have depth one. +When a bitmap is drawn, the command also takes two colors, foreground and +background. The set bits in the bitmap are replaced with the foreground +color, and the unset bits are replaced with the background color. + +Pixmaps, on the other hand, can be directly copied to the screen. + + +3. What's the significance of the ROP in the commands SVGA_CMD_RECT_ROP_FILL, +SVGA_CMD_RECT_ROP_BITMAP_COPY, etc. ? + +The ROP in the ...ROP... commands is a raster operation. It has the same +significance (and encoding) as it does in X Windows. The ROP value +SVGA_ROP_COPY means the source is copied to the destination, which makes +these commands the same as their non-ROP counterparts. The most commonly +used raster operation other than copy is probably SVGA_ROP_XOR, which +combines the source and destination using exclusive-or. + + +4. Tell me more about bitmaps and pixmaps. For example, the macro +SVGA_CMD_DEFINE_BITMAP has a field <scanlines>. What should this be +set to? Likewise with SVGA_CMD_DEFINE_PIXMAP. And when should the +SCANLINE macros be used? + +OK, I'll use pixmaps as an example. First you have to define the pixmap: + +#define SVGA_CMD_DEFINE_PIXMAP 6 + /* FIFO layout: + Pixmap ID, Width, Height, Depth, <scanlines> */ + +The ID is something you choose, which you subsequently use to refer to +this pixmap. It must be an integer between 0 and SVGA_MAX_ID. + +The width and height and depth are the dimensions of the pixmap. For now, +the depth of the pixmap has to match the depth of the screen. + +The scanlines are the pixels that make up the pixmap, arranged one row +at a time. Each row is required to be 32-bit aligned. The macros +SVGA_PIXMAP_SCANLINE_SIZE and SVGA_PIXMAP_SIZE give the size of a +single scanline, and the size of the entire pixmap, respectively, in +32-bit words. + +The second step is to use it: + +#define SVGA_CMD_RECT_PIXMAP_FILL 9 + /* FIFO layout: + Pixmap ID, X, Y, Width, Height */ + +The ID here is the one you chose when defining the pixmap. X, Y, +Width, and Height define a rectangle on the screen that is to be filled +with the pixmap. The pixmap is screen aligned, which means that the +coordinates in the pixmap are defined by the screen coordinates modulo +the pixmap dimensions. + +If you want a different alignment between the screen and the pixmap, +then you can use this command, which allows the pixmap coordinates to +be defined: + +#define SVGA_CMD_RECT_PIXMAP_COPY 11 + /* FIFO layout: + Pixmap ID, Source X, Source Y, Dest X, Dest Y, Width, + Height */ + +The Source X and Source Y are pixmap coordinates, and the Dest X and +Dest Y are screen coordinates. + + +5. OK, now it works briefly, then stops displaying anything. Also, +my log file is filled with lines like: + Unknown Command 0xff in SVGA command FIFO +What's happening? + +The most common problem at this point is that the FIFO gets out +of sync. This can happen if the amount of data in the FIFO doesn't +match what the VMware SVGA device expects. To track this down, try +to isolate the particular command which causes the problem. + +Another way this can happen is if the wraparound in the FIFO isn't +done correctly. Here is some example code for writing to the FIFO +(mem is an array of 32-bit integers that points to the FIFO memory +region): + +while (TRUE) { + fifo_min = mem[SVGA_FIFO_MIN] / 4; + fifo_max = mem[SVGA_FIFO_MAX] / 4; + fifo_next = mem[SVGA_FIFO_NEXT_CMD] / 4; + fifo_stop = mem[SVGA_FIFO_STOP] / 4; + + tmp_next = fifo_next+1; + if (tmp_next == fifo_max) + tmp_next = fifo_min; // Wraparound + + if (tmp_next == fifo_stop) { + sync_fifo(); // FIFO full + continue; // retry + } + + mem[fifo_next] = item; + mem[SVGA_FIFO_NEXT_CMD] = tmp_next * 4; + break; +} + +This isn't the most efficient code, but it should work. It's important +to do the increment with wraparound before the FIFO full check, and to +check FIFO full before updating the next command pointer. + + + +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/README,v 1.2 2001/04/05 21:09:37 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c new file mode 100644 index 000000000..9b73e86db --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c @@ -0,0 +1,1415 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c,v 1.1 2001/04/05 19:29:43 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1999-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_bits2pixels[] = "Id: bits2pixels.c,v 1.6 2001/01/26 23:32:15 yoel Exp $"; +#else +#define FILECODE "F(814)" +#endif + +/* + * bits2pixels.c -- + * + * Emulation routines to convert bitmaps to pixmaps + */ + +#include "vm_basic_types.h" +#include "bits2pixels.h" + + +/* + * Local functions + */ + +void RasterBitsToPixels8(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg); + +void RasterBitsToPixels16(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg); + +void RasterBitsToPixels24(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg); + +void RasterBitsToPixels32(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg); + + +/* + *---------------------------------------------------------------------- + * + * Raster_BitsToPixels -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg). + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +Raster_BitsToPixels(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, int bytes_per_pixel, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + switch (bytes_per_pixel) { + case 1: + RasterBitsToPixels8(bits, bits_increment, pix, pix_increment, + width, height, fg, bg); + break; + + case 2: + RasterBitsToPixels16(bits, bits_increment, pix, pix_increment, + width, height, fg, bg); + break; + + case 3: + RasterBitsToPixels24(bits, bits_increment, pix, pix_increment, + width, height, fg, bg); + break; + + case 4: + RasterBitsToPixels32(bits, bits_increment, pix, pix_increment, + width, height, fg, bg); + break; + } +} + + +/* + *---------------------------------------------------------------------- + * + * RasterBitsToPixels8 -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg), for an 8-bit + * pixmap + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +RasterBitsToPixels8(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + uint8 *lpix, *lbits; + int i, j; + uint32 expbits = 0; /* Bits to be expanded */ + + for (i=0; i<height; i++) { + lpix = pix; + lbits = bits; + for (j = width ; j > 0; j -= 4) { + expbits = (*lbits >> 4) & 0x0f; + + if (j < 4) + break; + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + + expbits = *lbits & 0x0f; + + j -= 4; + if (j < 4) { + break; + } + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + lbits++; + } + + if (j > 0) { + *lpix++ = (expbits & 0x08) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x04) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x02) ? fg : bg; + j--; + } + } + } + + pix += pix_increment; + bits += bits_increment; + } + return; +} + + +/* + *---------------------------------------------------------------------- + * + * RasterBitsToPixels16 -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg), for a 16-bit + * pixmap + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +RasterBitsToPixels16(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + uint16 *lpix; + uint8 *lbits; + int i, j; + uint32 expbits = 0; /* Bits to be expanded */ + + for (i=0; i<height; i++) { + lpix = (uint16 *)pix; + lbits = bits; + for (j = width; j > 0; j -= 4) { + expbits = (*lbits >> 4) & 0x0f; + + if (j < 4) + break; + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + + expbits = *lbits & 0x0f; + + j -= 4; + if (j < 4) { + break; + } + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + lbits++; + } + + if (j > 0) { + *lpix++ = (expbits & 0x08) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x04) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x02) ? fg : bg; + j--; + } + } + } + + pix += pix_increment; + bits += bits_increment; + } + return; +} + + + +/* + *---------------------------------------------------------------------- + * + * RasterBitsToPixels24 -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg), for a 24-bit + * pixmap + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +RasterBitsToPixels24(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + uint8 *lpix, *lbits; + uint32 fgColor1, fgColor2, fgColor3; + uint32 bgColor1, bgColor2, bgColor3; + + int i, j; + uint32 expbits = 0; /* Bits to be expanded */ + + fgColor1 = fg & 0x000000ff; + fgColor2 = (fg >> 8) & 0x000000ff; + fgColor3 = (fg >> 16) & 0x000000ff; + + bgColor1 = bg & 0x000000ff; + bgColor2 = (bg >> 8) & 0x000000ff; + bgColor3 = (bg >> 16) & 0x000000ff; + + for (i=0; i<height; i++) { + lpix = pix; + lbits = bits; + for (j = width; j > 0; j -= 4) { + expbits = (*lbits >> 4) & 0x0f; + + if (j < 4) + break; + + switch (expbits) { + case 0: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 1: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 2: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 3: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 4: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 5: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 6: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 7: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 8: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 9: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 10: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 11: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 12: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 13: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 14: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 15: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + } + + expbits = *lbits & 0x0f; + + j -= 4; + if (j < 4) { + break; + } + + switch (expbits) { + case 0: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 1: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 2: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 3: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 4: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 5: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 6: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 7: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 8: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 9: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 10: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 11: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 12: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 13: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 14: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 15: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + } + lbits++; + } + + if (j > 0) { + *lpix++ = (expbits & 0x08) ? fgColor1 : bgColor1; + *lpix++ = (expbits & 0x08) ? fgColor2 : bgColor2; + *lpix++ = (expbits & 0x08) ? fgColor3 : bgColor3; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x04) ? fgColor1 : bgColor1; + *lpix++ = (expbits & 0x04) ? fgColor2 : bgColor2; + *lpix++ = (expbits & 0x04) ? fgColor3 : bgColor3; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x02) ? fgColor1 : bgColor1; + *lpix++ = (expbits & 0x02) ? fgColor2 : bgColor2; + *lpix++ = (expbits & 0x02) ? fgColor3 : bgColor3; + j--; + } + } + } + + pix += pix_increment; + bits += bits_increment; + } + return; +} + + + +/* + *---------------------------------------------------------------------- + * + * RasterBitsToPixels32 -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg), for a 32-bit + * pixmap + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +RasterBitsToPixels32(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + uint32 *lpix; + uint8 *lbits; + int i, j; + uint32 expbits = 0; /* Bits to be expanded */ + + for (i=0; i<height; i++) { + lpix = (uint32 *)pix; + lbits = bits; + for (j = width; j > 0; j -= 4) { + expbits = (*lbits >> 4) & 0x0f; + + if (j < 4) + break; + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + + expbits = *lbits & 0x0f; + + j -= 4; + if (j < 4) { + break; + } + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + lbits++; + } + + if (j > 0) { + *lpix++ = (expbits & 0x08) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x04) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x02) ? fg : bg; + j--; + } + } + } + + pix += pix_increment; + bits += bits_increment; + } + return; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h new file mode 100644 index 000000000..348d0c05c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h @@ -0,0 +1,25 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1999-2001 VMware, Inc. + * All Rights Reserved + * Id: bits2pixels.h,v 1.4 2001/01/26 23:32:15 yoel Exp $ + * **********************************************************/ + +/* + * bits2pixels.h -- + * + * Drawing emulation routines + */ + +#ifndef _BITS2PIXELS_H_ +#define _BITS2PIXELS_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#include "includeCheck.h" + +void +Raster_BitsToPixels(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, int bytes_per_pixel, + uint32 width, uint32 height, uint32 fg, uint32 bg); + +#endif /* _BITS4PIXELS_H_ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h new file mode 100644 index 000000000..dedebe040 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h @@ -0,0 +1,30 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************* + * Copyright (C) 1999-2001 VMware, Inc. + * All Rights Reserved + * Id: guest_os.h,v 1.5 2001/01/26 23:32:15 yoel Exp $ + * **********************************************************/ + +#ifndef _GUEST_OS_H_ +#define _GUEST_OS_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#include "includeCheck.h" + +#define GUEST_OS_BASE 0x5000 + +#define GUEST_OS_DOS (GUEST_OS_BASE+1) +#define GUEST_OS_WIN31 (GUEST_OS_BASE+2) +#define GUEST_OS_WINDOWS95 (GUEST_OS_BASE+3) +#define GUEST_OS_WINDOWS98 (GUEST_OS_BASE+4) +#define GUEST_OS_WINDOWSME (GUEST_OS_BASE+5) +#define GUEST_OS_NT (GUEST_OS_BASE+6) +#define GUEST_OS_WIN2000 (GUEST_OS_BASE+7) +#define GUEST_OS_LINUX (GUEST_OS_BASE+8) +#define GUEST_OS_OS2 (GUEST_OS_BASE+9) +#define GUEST_OS_OTHER (GUEST_OS_BASE+10) +#define GUEST_OS_FREEBSD (GUEST_OS_BASE+11) +#define GUEST_OS_WHISTLER (GUEST_OS_BASE+12) + + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h new file mode 100644 index 000000000..05090865e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h @@ -0,0 +1,2 @@ +/* This space intentionally left blank. */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h,v 1.2 2001/04/06 17:44:58 dawes Exp $ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h new file mode 100644 index 000000000..cbd878330 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h @@ -0,0 +1,57 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * Id: svga_limits.h,v 1.8 2001/01/26 23:32:15 yoel Exp $ + * **********************************************************/ + +/* + * svga_reg.h -- + * + * SVGA limits + */ + +#ifndef _SVGA_LIMITS_H_ +#define _SVGA_LIMITS_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#include "includeCheck.h" + +/* + * Location and size of SVGA frame buffer. + */ +#define SVGA_FB_MAX_SIZE (16*1024*1024) +#define SVGA_MEM_SIZE (256*1024) + +/* + * SVGA_FB_START is the default starting address of the SVGA frame + * buffer in the guest's physical address space. + * SVGA_FB_START_BIGMEM is the starting address of the SVGA frame + * buffer for VMs that have a large amount of physical memory. + * + * The address of SVGA_FB_START is set to 2GB - (SVGA_FB_MAX_SIZE + SVGA_MEM_SIZE), + * thus the SVGA frame buffer sits at [SVGA_FB_START .. 2GB-1] in the + * physical address space. Our older SVGA drivers for NT treat the + * address of the frame buffer as a signed integer. For backwards + * compatibility, we keep the default location of the frame buffer + * at under 2GB in the address space. This restricts VMs to have "only" + * up to ~2031MB (i.e., up to SVGA_FB_START) of physical memory. + * + * For VMs that want more memory than the ~2031MB, we place the SVGA + * frame buffer at SVGA_FB_START_BIGMEM. This allows VMs to have up + * to 3584MB, at least as far as the SVGA frame buffer is concerned + * (note that there may be other issues that limit the VM memory + * size). PCI devices use high memory addresses, so we have to put + * SVGA_FB_START_BIGMEM low enough so that it doesn't overlap with any + * of these devices. Placing SVGA_FB_START_BIGMEM at 0xE0000000 + * should leave plenty of room for the PCI devices. + * + * NOTE: All of that is only true for the 0710 chipset. As of the 0405 + * chipset, the framebuffer start is determined solely based on the value + * the guest BIOS or OS programs into the PCI base address registers. + */ +#define SVGA_FB_LEGACY_START 0x7EFC0000 +#define SVGA_FB_LEGACY_START_BIGMEM 0xE0000000 + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h new file mode 100644 index 000000000..0452b5d39 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h @@ -0,0 +1,284 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * Id: svga_reg.h,v 1.9 2001/03/02 02:06:47 bhlim Exp $ + * **********************************************************/ + +/* + * svga_reg.h -- + * + * SVGA hardware definitions + */ + +#ifndef _SVGA_REG_H_ +#define _SVGA_REG_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#include "includeCheck.h" + +#include "svga_limits.h" + +/* + * Memory and port addresses and fundamental constants + */ + +#define SVGA_MAX_WIDTH 2364 +#define SVGA_MAX_HEIGHT 1773 + +#ifdef VMX86_SERVER +#define SVGA_DEFAULT_MAX_WIDTH 1600 +#define SVGA_DEFAULT_MAX_HEIGHT 1200 +#else +#define SVGA_DEFAULT_MAX_WIDTH SVGA_MAX_WIDTH +#define SVGA_DEFAULT_MAX_HEIGHT SVGA_MAX_HEIGHT +#endif + +#define SVGA_MAX_BITS_PER_PIXEL 32 +#if SVGA_MAX_WIDTH * SVGA_MAX_HEIGHT * SVGA_MAX_BITS_PER_PIXEL / 8 > \ + SVGA_FB_MAX_SIZE +#error "Bad SVGA maximum sizes" +#endif +#define SVGA_MAX_PSEUDOCOLOR_DEPTH 8 +#define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH) + +#define SVGA_MAGIC 0x900000 +#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver)) + +/* Version 2 let the address of the frame buffer be unsigned on Win32 */ +#define SVGA_VERSION_2 2 +#define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2) + +/* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so + PALETTE_BASE has moved */ +#define SVGA_VERSION_1 1 +#define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1) + +/* Version 0 is the initial version */ +#define SVGA_VERSION_0 0 +#define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0) + +/* Invalid SVGA_ID_ */ +#define SVGA_ID_INVALID 0xFFFFFFFF + +/* More backwards compatibility, old location of color map: */ +#define SVGA_OLD_PALETTE_BASE 17 + +/* Base and Offset gets us headed the right way for PCI Base Addr Registers */ +#define SVGA_LEGACY_BASE_PORT 0x4560 +#define SVGA_INDEX_PORT 0x0 +#define SVGA_VALUE_PORT 0x1 +#define SVGA_BIOS_PORT 0x2 +#define SVGA_NUM_PORTS 0x3 + +/* This port is deprecated, but retained because of old drivers. */ +#define SVGA_LEGACY_ACCEL_PORT 0x3 + +/* + * Registers + */ + +enum { + SVGA_REG_ID = 0, + SVGA_REG_ENABLE = 1, + SVGA_REG_WIDTH = 2, + SVGA_REG_HEIGHT = 3, + SVGA_REG_MAX_WIDTH = 4, + SVGA_REG_MAX_HEIGHT = 5, + SVGA_REG_DEPTH = 6, + SVGA_REG_BITS_PER_PIXEL = 7, + SVGA_REG_PSEUDOCOLOR = 8, + SVGA_REG_RED_MASK = 9, + SVGA_REG_GREEN_MASK = 10, + SVGA_REG_BLUE_MASK = 11, + SVGA_REG_BYTES_PER_LINE = 12, + SVGA_REG_FB_START = 13, + SVGA_REG_FB_OFFSET = 14, + SVGA_REG_FB_MAX_SIZE = 15, + SVGA_REG_FB_SIZE = 16, + + SVGA_REG_CAPABILITIES = 17, + SVGA_REG_MEM_START = 18, /* Memory for command FIFO and bitmaps */ + SVGA_REG_MEM_SIZE = 19, + SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */ + SVGA_REG_SYNC = 21, /* Write to force synchronization */ + SVGA_REG_BUSY = 22, /* Read to check if sync is done */ + SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */ + SVGA_REG_CURSOR_ID = 24, /* ID of cursor */ + SVGA_REG_CURSOR_X = 25, /* Set cursor X position */ + SVGA_REG_CURSOR_Y = 26, /* Set cursor Y position */ + SVGA_REG_CURSOR_ON = 27, /* Turn cursor on/off */ + + SVGA_REG_TOP = 28, /* Must be 1 greater than the last register */ + + SVGA_PALETTE_BASE = 1024 /* Base of SVGA color map */ +}; + + +/* + * Capabilities + */ + +#define SVGA_CAP_RECT_FILL 0x0001 +#define SVGA_CAP_RECT_COPY 0x0002 +#define SVGA_CAP_RECT_PAT_FILL 0x0004 +#define SVGA_CAP_OFFSCREEN 0x0008 +#define SVGA_CAP_RASTER_OP 0x0010 +#define SVGA_CAP_CURSOR 0x0020 +#define SVGA_CAP_CURSOR_BYPASS 0x0040 + + +/* + * Raster op codes (same encoding as X) + */ + +#define SVGA_ROP_CLEAR 0x00 +#define SVGA_ROP_AND 0x01 +#define SVGA_ROP_AND_REVERSE 0x02 +#define SVGA_ROP_COPY 0x03 +#define SVGA_ROP_AND_INVERTED 0x04 +#define SVGA_ROP_NOOP 0x05 +#define SVGA_ROP_XOR 0x06 +#define SVGA_ROP_OR 0x07 +#define SVGA_ROP_NOR 0x08 +#define SVGA_ROP_EQUIV 0x09 +#define SVGA_ROP_INVERT 0x0a +#define SVGA_ROP_OR_REVERSE 0x0b +#define SVGA_ROP_COPY_INVERTED 0x0c +#define SVGA_ROP_OR_INVERTED 0x0d +#define SVGA_ROP_NAND 0x0e +#define SVGA_ROP_SET 0x0f + + +/* + * Memory area offsets (viewed as an array of 32-bit words) + */ + +/* + * The distance from MIN to MAX must be at least 10K + */ + +#define SVGA_FIFO_MIN 0 +#define SVGA_FIFO_MAX 1 +#define SVGA_FIFO_NEXT_CMD 2 +#define SVGA_FIFO_STOP 3 + +#define SVGA_FIFO_USER_DEFINED 4 + +/* + * Drawing object ID's, in the range 0 to SVGA_MAX_ID + */ + +#define SVGA_MAX_ID 499 + +/* + * Macros to compute variable length items (sizes in 32-bit words) + */ + +#define SVGA_BITMAP_SIZE(w,h) ((((w)+31) >> 5) * (h)) +#define SVGA_BITMAP_SCANLINE_SIZE(w) (( (w)+31 ) >> 5) +#define SVGA_PIXMAP_SIZE(w,h,d) ((( ((w)*(d))+31 ) >> 5) * (h)) +#define SVGA_PIXMAP_SCANLINE_SIZE(w,d) (( ((w)*(d))+31 ) >> 5) + +/* + * Increment from one scanline to the next of a bitmap or pixmap + */ +#define SVGA_BITMAP_INCREMENT(w) ((( (w)+31 ) >> 5) * sizeof (uint32)) +#define SVGA_PIXMAP_INCREMENT(w,d) ((( ((w)*(d))+31 ) >> 5) * sizeof (uint32)) + +/* + * Commands in the command FIFO + */ + +#define SVGA_CMD_UPDATE 1 + /* FIFO layout: + X, Y, Width, Height */ + +#define SVGA_CMD_RECT_FILL 2 + /* FIFO layout: + Color, X, Y, Width, Height */ + +#define SVGA_CMD_RECT_COPY 3 + /* FIFO layout: + Source X, Source Y, Dest X, Dest Y, Width, Height */ + +#define SVGA_CMD_DEFINE_BITMAP 4 + /* FIFO layout: + Pixmap ID, Width, Height, <scanlines> */ + +#define SVGA_CMD_DEFINE_BITMAP_SCANLINE 5 + /* FIFO layout: + Pixmap ID, Width, Height, Line #, scanline */ + +#define SVGA_CMD_DEFINE_PIXMAP 6 + /* FIFO layout: + Pixmap ID, Width, Height, Depth, <scanlines> */ + +#define SVGA_CMD_DEFINE_PIXMAP_SCANLINE 7 + /* FIFO layout: + Pixmap ID, Width, Height, Depth, Line #, scanline */ + +#define SVGA_CMD_RECT_BITMAP_FILL 8 + /* FIFO layout: + Bitmap ID, X, Y, Width, Height, Foreground, Background */ + +#define SVGA_CMD_RECT_PIXMAP_FILL 9 + /* FIFO layout: + Pixmap ID, X, Y, Width, Height */ + +#define SVGA_CMD_RECT_BITMAP_COPY 10 + /* FIFO layout: + Bitmap ID, Source X, Source Y, Dest X, Dest Y, + Width, Height, Foreground, Background */ + +#define SVGA_CMD_RECT_PIXMAP_COPY 11 + /* FIFO layout: + Pixmap ID, Source X, Source Y, Dest X, Dest Y, Width, Height */ + +#define SVGA_CMD_FREE_OBJECT 12 + /* FIFO layout: + Object (pixmap, bitmap, ...) ID */ + +#define SVGA_CMD_RECT_ROP_FILL 13 + /* FIFO layout: + Color, X, Y, Width, Height, ROP */ + +#define SVGA_CMD_RECT_ROP_COPY 14 + /* FIFO layout: + Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */ + +#define SVGA_CMD_RECT_ROP_BITMAP_FILL 15 + /* FIFO layout: + ID, X, Y, Width, Height, Foreground, Background, ROP */ + +#define SVGA_CMD_RECT_ROP_PIXMAP_FILL 16 + /* FIFO layout: + ID, X, Y, Width, Height, ROP */ + +#define SVGA_CMD_RECT_ROP_BITMAP_COPY 17 + /* FIFO layout: + ID, Source X, Source Y, + Dest X, Dest Y, Width, Height, Foreground, Background, ROP */ + +#define SVGA_CMD_RECT_ROP_PIXMAP_COPY 18 + /* FIFO layout: + ID, Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */ + +#define SVGA_CMD_DEFINE_CURSOR 19 + /* FIFO layout: + ID, Hotspot X, Hotspot Y, Width, Height, + Depth for AND mask, Depth for XOR mask, + <scanlines for AND mask>, <scanlines for XOR mask> */ + +#define SVGA_CMD_DISPLAY_CURSOR 20 + /* FIFO layout: + ID, On/Off (1 or 0) */ + +#define SVGA_CMD_MOVE_CURSOR 21 + /* FIFO layout: + X, Y */ + +#define SVGA_CMD_MAX 22 + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h new file mode 100644 index 000000000..a884ce77b --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h @@ -0,0 +1,167 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * Id: vm_basic_types.h,v 1.9 2001/02/14 22:22:53 bennett Exp $ + * **********************************************************/ + +/* + * + * vm_basic_types.h -- + * + * basic data types. + */ + + +#ifndef _VM_BASIC_TYPES_H_ +#define _VM_BASIC_TYPES_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#define INCLUDE_ALLOW_MODULE +#define INCLUDE_ALLOW_VMKERNEL +#include "includeCheck.h" + +/* STRICT ANSI means the Xserver build and X defines Bool differently. */ +#ifndef __STRICT_ANSI__ +typedef char Bool; +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifdef _MSC_VER +typedef unsigned __int64 uint64; +typedef signed __int64 int64; + +#pragma warning (disable :4018) // signed/unsigned mismatch +#pragma warning (disable :4761) // integral size mismatch in argument; conversion supplied +#pragma warning (disable :4305) // truncation from 'const int' to 'short' +#pragma warning (disable :4244) // conversion from 'unsigned short' to 'unsigned char' +//#pragma warning (disable :4101) // unreferenced local variable +#pragma warning (disable :4133) // incompatible types - from 'struct VM *' to 'int *' +#pragma warning (disable :4047) // differs in levels of indirection +#pragma warning (disable :4146) // unary minus operator applied to unsigned type, result still unsigned +#pragma warning (disable :4142) // benign redefinition of type + +#elif __GNUC__ +/* The Xserver source compiles with -ansi -pendantic */ +#ifndef __STRICT_ANSI__ +typedef unsigned long long uint64; +typedef long long int64; +#endif +#else +#error - Need compiler define for int64/uint64 +#endif + +typedef unsigned int uint32; +typedef unsigned short uint16; +typedef unsigned char uint8; + +typedef int int32; +typedef short int16; +typedef char int8; + + +/* + * Printf format for 64-bit number. Use it like this: + * printf("%"FMT64"d\n", big); + */ + +#ifdef _MSC_VER +#define FMT64 "I64" +#elif __GNUC__ +#define FMT64 "L" +#else +#error - Need compiler define for FMT64 +#endif + +typedef uint32 VA; +typedef uint32 VPN; + +typedef uint32 PA; +typedef uint32 PPN; + +typedef uint32 MA; +typedef uint32 MPN; + +#define INVALID_MPN ((MPN)-1) + +#define EXTERN extern +/* + * Right now our use of CONST is broken enough that it only works + * with GCC. XXX Need to fix this. + */ +#ifdef __GNUC__ +#define CONST const +#else +#ifndef CONST +#define CONST +#endif +#endif + +#ifdef _MSC_VER +#ifndef INLINE +#define INLINE __inline +#endif +#else +#ifndef INLINE +#define INLINE inline +#endif +#endif + + +#if defined(WIN32) && !defined(VMX86_NO_THREADS) +#define THREADSPECIFIC _declspec(thread) +#else +#define THREADSPECIFIC +#endif + +/* + * Like "INLINE" but use this token to mark functions that are inline + * because they have only a single call site. In other words, if a second + * call site is introduced, the "INLINE_SINGLE_CALLER" token should be + * removed. + */ +#define INLINE_SINGLE_CALLER INLINE + +/* + * Attributes placed on function declarations to tell the compiler + * that the function never returns. + */ +#ifdef _MSC_VER +#define NORETURN_DECL(_fndecl) __declspec(noreturn) _fndecl +#elif __GNUC__ >= 2 && __GNUC_MINOR__ >= 5 +#define NORETURN_DECL(_fndecl) _fndecl __attribute__((__noreturn__)) +#else +#define NORETURN_DECL(_fndecl) _fndecl +#endif + + +/* + * GCC's argument checking for printf-like functions + * This is conditional until we have replaced all `"%x", void *' + * with `"0x%08x", (uint32) void *'. Note that %p prints different things + * on different platforms. + * + * fmtPos is the position of the format string argument, beginning at 1 + * varPos is the position of the variable argument, beginning at 1 + */ +#if defined(__GNUC__) && defined(notdef) +# define PRINTF_DECL(fmtPos, varPos) __attribute__((__format__(__printf__, fmtPos, varPos))) +#else +# define PRINTF_DECL(fmtPos, varPos) +#endif + +/* + * Used to silence compiler warnings that get generated when the + * compiler thinks that a function returns when it is marked noreturn. + */ +#define INFINITE_LOOP() do { } while (1) + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h new file mode 100644 index 000000000..8f6dd3b87 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h @@ -0,0 +1,64 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * Id: vm_device_version.h,v 1.2 2001/01/26 21:53:27 yoel Exp $ + * **********************************************************/ + + +#ifndef VM_DEVICE_VERSION_H +#define VM_DEVICE_VERSION_H + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#define INCLUDE_ALLOW_MODULE +#define INCLUDE_ALLOW_VMKERNEL +#include "includeCheck.h" + +#define PCI_VENDOR_ID_VMWARE 0x15AD +#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 +#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710 +#define PCI_DEVICE_ID_VMWARE_NET 0x0720 +#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730 +#define PCI_DEVICE_ID_VMWARE_IDE 0x1729 + +/* From linux/pci.h. We emulate an AMD ethernet controller */ +#define PCI_VENDOR_ID_AMD 0x1022 +#define PCI_DEVICE_ID_AMD_VLANCE 0x2000 +#define PCI_VENDOR_ID_BUSLOGIC 0x104B +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 + +/* Intel Values for the chipset */ +#define PCI_VENDOR_ID_INTEL 0x8086 +#define PCI_DEVICE_ID_INTEL_82439TX 0x7100 +#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110 +#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 +#define PCI_DEVICE_ID_INTEL_82371AB 0x7111 +#define PCI_DEVICE_ID_INTEL_82443BX 0x7192 + + +/************* Strings for IDE Identity Fields **************************/ +#define VIDE_ID_SERIAL_STR "00000000000000000001" /* Must be 20 Bytes */ +#define VIDE_ID_FIRMWARE_STR "00000001" /* Must be 8 Bytes */ + +/* No longer than 40 Bytes and must be an even length. */ +#define VIDE_ATA_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE Hard Drive " +#define VIDE_ATAPI_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE CDROM Drive " + +#define ATAPI_VENDOR_ID "NECVMWar" /* Must be 8 Bytes */ +#define ATAPI_PRODUCT_ID PRODUCT_GENERIC_NAME " IDE CDROM" /* Must be 16 Bytes */ +#define ATAPI_REV_LEVEL "1.00" /* Must be 4 Bytes */ + + +/************* Strings for SCSI Identity Fields **************************/ +#define SCSI_DISK_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI Hard Drive" +#define SCSI_CDROM_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI CDROM Drive" + +/************* Strings for the VESA BIOS Identity Fields *****************/ +#define VBE_OEM_STRING COMPANY_NAME " SVGA" +#define VBE_VENDOR_NAME COMPANY_NAME +#define VBE_PRODUCT_NAME PRODUCT_GENERIC_NAME + + +#endif /* VM_DEVICE_VERSION_H */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c new file mode 100644 index 000000000..04ca7f8bf --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c @@ -0,0 +1,1426 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmware[] = + + "Id: vmware.c,v 1.11 2001/02/23 02:10:39 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Resources.h" + +#include "compiler.h" /* inb/outb */ + +#include "xf86PciInfo.h" /* pci vendor id */ +#include "xf86Pci.h" /* pci */ + +#include "mipointer.h" /* sw cursor */ +#include "mibstore.h" /* backing store */ +#include "micmap.h" /* mi color map */ +#include "vgaHW.h" /* VGA hardware */ +#define PSZ 8 /* 8bpp */ +#include "cfb.h" +#undef PSZ +#include "cfb16.h" /* 16bpp */ +#include "cfb24.h" /* 24bpp */ +#include "cfb32.h" /* 32bpp */ + +#include "xf86cmap.h" /* xf86HandleColormaps */ + +#include "vmware.h" +#include "guest_os.h" +#include "vm_device_version.h" + +/* + * Sanity check that xf86PciInfo.h has the correct values (which come from + * the VMware source tree in vm_device_version.h. + */ +#if PCI_CHIP_VMWARE0405 != PCI_DEVICE_ID_VMWARE_SVGA2 +#error "PCI_CHIP_VMWARE0405 is wrong, update it from vm_device_version.h" +#endif +#if PCI_CHIP_VMWARE0710 != PCI_DEVICE_ID_VMWARE_SVGA +#error "PCI_CHIP_VMWARE0710 is wrong, update it from vm_device_version.h" +#endif +#if PCI_VENDOR_VMWARE != PCI_VENDOR_ID_VMWARE +#error "PCI_VENDOR_VMWARE is wrong, update it from vm_device_version.h" +#endif + +/* + * This is the only way I know to turn a #define of an integer constant into + * a constant string. + */ +#define VMW_INNERSTRINGIFY(s) #s +#define VMW_STRING(str) VMW_INNERSTRINGIFY(str) + +#define VMWARE_NAME "VMWARE" +#define VMWARE_DRIVER_NAME "vmware" +#define VMWARE_MAJOR_VERSION 10 +#define VMWARE_MINOR_VERSION 4 +#define VMWARE_PATCHLEVEL 0 +#define VERSION (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL) + +static const char VMWAREBuildStr[] = + "VMware Guest X Server " VMW_STRING(VMWARE_MAJOR_VERSION) + "." VMW_STRING(VMWARE_MINOR_VERSION) + "." VMW_STRING(VMWARE_PATCHLEVEL) " - build=$Name: $\n"; + +static SymTabRec VMWAREChipsets[] = { + { PCI_CHIP_VMWARE0405, "vmware0405" }, + { PCI_CHIP_VMWARE0710, "vmware0710" }, + { -1, NULL } +}; + +static resRange vmwareLegacyRes[] = { + { ResExcIoBlock, SVGA_LEGACY_BASE_PORT, SVGA_LEGACY_BASE_PORT + SVGA_NUM_PORTS*sizeof(uint32)}, + _VGA_EXCLUSIVE, _END +}; + +/* + * Currently, even the PCI obedient 0405 chip still only obeys IOSE and + * MEMSE for the SVGA resources. Thus, RES_EXCLUSIVE_VGA is required. + * + * The 0710 chip also uses hardcoded IO ports that aren't disablable. + */ + +static PciChipsets VMWAREPciChipsets[] = { + { PCI_CHIP_VMWARE0405, PCI_CHIP_VMWARE0405, RES_EXCLUSIVE_VGA }, + { PCI_CHIP_VMWARE0710, PCI_CHIP_VMWARE0710, vmwareLegacyRes }, + { -1, -1, RES_UNDEFINED } +}; + +#ifdef XFree86LOADER +static XF86ModuleVersionInfo vmwareVersRec = { + "vmware", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + VMWARE_MAJOR_VERSION, VMWARE_MINOR_VERSION, VMWARE_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + { 0, 0, 0, 0} +}; +#endif /* XFree86LOADER */ + +typedef enum { + OPTION_HW_CURSOR, + OPTION_NOACCEL +} VMWAREOpts; + +static OptionInfoRec VMWAREOptions[] = { + { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + +#define nVMWAREOptions (sizeof(VMWAREOptions) / sizeof(VMWAREOptions[0])) + +static Bool +VMWAREGetRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate != NULL) { + return TRUE; + } + pScrn->driverPrivate = xnfcalloc(sizeof(VMWARERec), 1); + /* FIXME: Initialize driverPrivate... */ + return TRUE; +} + +static void +VMWAREFreeRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate) { + xfree(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; + } +} + +static void ScreenToPrivate(ScreenPtr, ScrnInfoPtr); +static void ScreenFromPrivate(ScreenPtr, ScrnInfoPtr); + +/* VMware specific functions */ + +static CARD32 +vmwareReadReg(VMWAREPtr pVMWARE, int index) +{ + outl(pVMWARE->indexReg, index); + return inl(pVMWARE->valueReg); +} + +void +vmwareWriteReg(VMWAREPtr pVMWARE, int index, CARD32 value) +{ + outl(pVMWARE->indexReg, index); + outl(pVMWARE->valueReg, value); +} + +void +vmwareWriteWordToFIFO(VMWAREPtr pVMWARE, CARD32 value) +{ + CARD32* vmwareFIFO = pVMWARE->vmwareFIFO; + + /* Need to sync? */ + if ((vmwareFIFO[SVGA_FIFO_NEXT_CMD] + sizeof(CARD32) == vmwareFIFO[SVGA_FIFO_STOP]) + || (vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX] - sizeof(CARD32) && + vmwareFIFO[SVGA_FIFO_STOP] == vmwareFIFO[SVGA_FIFO_MIN])) { + vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1); + while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ; + } + vmwareFIFO[vmwareFIFO[SVGA_FIFO_NEXT_CMD] / sizeof(CARD32)] = value; + vmwareFIFO[SVGA_FIFO_NEXT_CMD] += sizeof(CARD32); + if (vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX]) { + vmwareFIFO[SVGA_FIFO_NEXT_CMD] = vmwareFIFO[SVGA_FIFO_MIN]; + } +} + +void +vmwareWaitForFB(VMWAREPtr pVMWARE) +{ + if (pVMWARE->vmwareFIFOMarkSet) { + vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1); + while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ; + pVMWARE->vmwareFIFOMarkSet = FALSE; + } +} + +void +vmwareSendSVGACmdUpdate(VMWAREPtr pVMWARE, BoxPtr pBB) +{ + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_UPDATE); + vmwareWriteWordToFIFO(pVMWARE, pBB->x1); + vmwareWriteWordToFIFO(pVMWARE, pBB->y1); + vmwareWriteWordToFIFO(pVMWARE, pBB->x2 - pBB->x1); + vmwareWriteWordToFIFO(pVMWARE, pBB->y2 - pBB->y1); +} + +static void +vmwareSendSVGACmdUpdateFullScreen(VMWAREPtr pVMWARE) +{ + BoxRec BB; + + BB.x1 = 0; + BB.y1 = 0; + BB.x2 = pVMWARE->ModeReg.svga_reg_width; + BB.y2 = pVMWARE->ModeReg.svga_reg_height; + vmwareSendSVGACmdUpdate(pVMWARE, &BB); +} + +static CARD32 +vmwareCalculateWeight(CARD32 mask) +{ + CARD32 weight; + + for (weight = 0; mask; mask >>= 1) { + if (mask & 1) { + weight++; + } + } + return weight; +} + +/* + *----------------------------------------------------------------------------- + * + * VMXGetVMwareSvgaId -- + * + * Retrieve the SVGA_ID of the VMware SVGA adapter. + * This function should hide any backward compatibility mess. + * + * Results: + * The SVGA_ID_* of the present VMware adapter. + * + * Side effects: + * ins/outs + * + *----------------------------------------------------------------------------- + */ + +static uint32 +VMXGetVMwareSvgaId(VMWAREPtr pVMWARE) +{ + uint32 vmware_svga_id; + + /* Any version with any SVGA_ID_* support will initialize SVGA_REG_ID + * to SVGA_ID_0 to support versions of this driver with SVGA_ID_0. + * + * Versions of SVGA_ID_0 ignore writes to the SVGA_REG_ID register. + * + * Versions of SVGA_ID_1 will allow us to overwrite the content + * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1. + * + * Versions of SVGA_ID_2 will allow us to overwrite the content + * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1 + * or SVGA_ID_2. + */ + + vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_2); + vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID); + if (vmware_svga_id == SVGA_ID_2) { + return SVGA_ID_2; + } + + vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_1); + vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID); + if (vmware_svga_id == SVGA_ID_1) { + return SVGA_ID_1; + } + + if (vmware_svga_id == SVGA_ID_0) { + return SVGA_ID_0; + } + + /* No supported VMware SVGA devices found */ + return SVGA_ID_INVALID; +} + + +/* + *---------------------------------------------------------------------- + * + * RewriteTagString -- + * + * Rewrites the given string, removing the $Name: $, and + * replacing it with the contents. The output string must + * have enough room, or else. + * + * Results: + * + * Output string updated. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +RewriteTagString(const char *istr, char *ostr, int osize) +{ + int chr; + Bool inTag = FALSE; + char *op = ostr; + + do { + chr = *istr++; + if (chr == '$') { + if (inTag) { + inTag = FALSE; + for (; op > ostr && op[-1] == ' '; op--) { + } + continue; + } + if (strncmp(istr, "Name:", 5) == 0) { + istr += 5; + istr += strspn(istr, " "); + inTag = TRUE; + continue; + } + } + *op++ = chr; + } while (chr); +} + +static void +VMWAREIdentify(int flags) +{ + xf86PrintChipsets(VMWARE_NAME, "driver for VMware SVGA", VMWAREChipsets); +} + +static OptionInfoPtr +VMWAREAvailableOptions(int chipid, int busid) +{ + return VMWAREOptions; +} + +static Bool +VMWAREPreInit(ScrnInfoPtr pScrn, int flags) +{ + MessageType from; + VMWAREPtr pVMWARE; + OptionInfoRec options[nVMWAREOptions]; + int bpp24flags; + uint32 id; + int i; + const char* mod; + ClockRange* clockRanges; + + if (pScrn->numEntities != 1) { + return FALSE; + } + + if (!VMWAREGetRec(pScrn)) { + return FALSE; + } + pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + if (pVMWARE->pEnt->location.type != BUS_PCI) { + return FALSE; + } + pVMWARE->PciInfo = xf86GetPciInfoForEntity(pVMWARE->pEnt->index); + if (pVMWARE->PciInfo == NULL) { + return FALSE; + } + + if (pVMWARE->PciInfo->chipType == PCI_CHIP_VMWARE0710) { + pVMWARE->indexReg = + SVGA_LEGACY_BASE_PORT + SVGA_INDEX_PORT*sizeof(uint32); + pVMWARE->valueReg = + SVGA_LEGACY_BASE_PORT + SVGA_VALUE_PORT*sizeof(uint32); + } else { + pVMWARE->indexReg = + pVMWARE->PciInfo->ioBase[0] + SVGA_INDEX_PORT; + pVMWARE->valueReg = + pVMWARE->PciInfo->ioBase[0] + SVGA_VALUE_PORT; + } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "VMware SVGA regs at (0x%04x, 0x%04x)\n", + pVMWARE->indexReg, pVMWARE->valueReg); + + id = VMXGetVMwareSvgaId(pVMWARE); + if (id == SVGA_ID_0 || id == SVGA_ID_INVALID) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No supported VMware SVGA found (read ID 0x%08x).\n", id); + return FALSE; + } + + if (!xf86LoadSubModule(pScrn, "vgahw")) { + return FALSE; + } + +/* xf86LoaderReqSymLists(vgahwSymbols, NULL); */ /* FIXME */ + + if (!vgaHWGetHWRec(pScrn)) { + return FALSE; + } + + pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device, + pVMWARE->PciInfo->func); + pVMWARE->Primary = xf86IsPrimaryPci(pVMWARE->PciInfo); + + pScrn->monitor = pScrn->confScreen->monitor; + + pVMWARE->depth = vmwareReadReg(pVMWARE, SVGA_REG_DEPTH); + pVMWARE->weight.red = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_RED_MASK)); + pVMWARE->weight.green = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_GREEN_MASK)); + pVMWARE->weight.blue = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_BLUE_MASK)); + pVMWARE->offset.blue = 0; + pVMWARE->offset.green = pVMWARE->weight.blue; + pVMWARE->offset.red = pVMWARE->weight.green + pVMWARE->offset.green; + pVMWARE->bitsPerPixel = vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); + pVMWARE->defaultVisual = vmwareReadReg(pVMWARE, SVGA_REG_PSEUDOCOLOR) ? PseudoColor : TrueColor; + pVMWARE->videoRam = vmwareReadReg(pVMWARE, SVGA_REG_FB_MAX_SIZE); + pVMWARE->memPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_FB_START); + pVMWARE->maxWidth = vmwareReadReg(pVMWARE, SVGA_REG_MAX_WIDTH); + pVMWARE->maxHeight = vmwareReadReg(pVMWARE, SVGA_REG_MAX_HEIGHT); +#define ACCELERATE_OPS +#ifdef ACCELERATE_OPS + pVMWARE->vmwareCapability = vmwareReadReg(pVMWARE, SVGA_REG_CAPABILITIES); +#else + pVMWARE->vmwareCapability = 0; +#endif + pVMWARE->cursorDefined = FALSE; + pVMWARE->mouseHidden = FALSE; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "depth: %d\n", pVMWARE->depth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.red: %d\n", pVMWARE->weight.red); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.grn: %d\n", pVMWARE->weight.green); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.blu: %d\n", pVMWARE->weight.blue); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "bpp: %d\n", pVMWARE->bitsPerPixel); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vis: %d\n", pVMWARE->defaultVisual); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vram: %d\n", pVMWARE->videoRam); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "pbase: %p\n", pVMWARE->memPhysBase); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mwidt: %d\n", pVMWARE->maxWidth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mheig: %d\n", pVMWARE->maxHeight); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "caps: 0x%08X\n", pVMWARE->vmwareCapability); + + switch (pVMWARE->depth) { + case 16: + /* + * In certain cases, the Windows host appears to + * report 16 bpp and 16 depth but 555 weight. Just + * silently convert it to depth of 15. + */ + if (pVMWARE->bitsPerPixel == 16 && + pVMWARE->weight.green == 5) + pVMWARE->depth = 15; + case 8: + case 15: + bpp24flags = NoDepth24Support; + break; + + case 32: + /* + * There is no 32 bit depth, apparently it can get + * reported this way sometimes on the Windows host. + */ + if (pVMWARE->bitsPerPixel == 32) + pVMWARE->depth = 24; + case 24: + if (pVMWARE->bitsPerPixel == 24) + bpp24flags = Support24bppFb; + else + bpp24flags = Support32bppFb; + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Adapter is using an unsupported depth (%d).\n", + pVMWARE->depth); + return FALSE; + } + + if (!xf86SetDepthBpp(pScrn, pVMWARE->depth, pVMWARE->bitsPerPixel, pVMWARE->bitsPerPixel, bpp24flags)) { + return FALSE; + } + if (pScrn->depth != pVMWARE->depth) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Currently unavailable depth of %d requested.\n" + "\tThe guest X server must run at the same depth as the host (which\n" + "\tis currently %d). This is automatically detected. Please do not\n" + "\tspecify a depth on the command line or via the config file.\n", + pScrn->depth, pVMWARE->depth); + return FALSE; + } + if (pScrn->bitsPerPixel != pVMWARE->bitsPerPixel) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given bpp (%d) is not supported by this driver (%d is required)\n", + pScrn->bitsPerPixel, pVMWARE->bitsPerPixel); + return FALSE; + } + xf86PrintDepthBpp(pScrn); + +#if 0 + if (pScrn->depth == 24 && pix24bpp == 0) { + pix24bpp = xf86GetBppFromDepth(pScrn, 24); + } +#endif + + if (pScrn->depth > 8) { + rgb zeros = { 0, 0, 0 }; + + if (!xf86SetWeight(pScrn, pVMWARE->weight, zeros)) { + return FALSE; + } + /* FIXME check returned weight */ + } + if (!xf86SetDefaultVisual(pScrn, pVMWARE->defaultVisual)) { + return FALSE; + } + if (pScrn->defaultVisual != pVMWARE->defaultVisual) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given visual (%d) is not supported by this driver (%d is required)\n", + pScrn->defaultVisual, pVMWARE->defaultVisual); + return FALSE; + } +#if 0 + bytesPerPixel = pScrn->bitsPerPixel / 8; +#endif + pScrn->progClock = TRUE; + +#if 0 /* MGA does not do this */ + if (pScrn->visual != 0) { /* FIXME */ + /* print error message */ + return FALSE; + } +#endif + + xf86CollectOptions(pScrn, NULL); + memcpy(options, VMWAREOptions, sizeof(VMWAREOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + + if (pScrn->depth <= 8) { + pScrn->rgbBits = 8; + } + + from = X_PROBED; + pScrn->chipset = (char*)xf86TokenToString(VMWAREChipsets, pVMWARE->PciInfo->chipType); + + if (!pScrn->chipset) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04 is not recognised\n", pVMWARE->PciInfo->chipType); + return FALSE; + } + + from = X_DEFAULT; + pVMWARE->hwCursor = TRUE; + if (xf86GetOptValBool(options, OPTION_HW_CURSOR, &pVMWARE->hwCursor)) { + from = X_CONFIG; + } + if (pVMWARE->hwCursor && !(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "HW cursor is not supported in this configuration\n"); + from = X_PROBED; + pVMWARE->hwCursor = FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + pVMWARE->hwCursor ? "HW" : "SW"); + if (xf86IsOptionSet(options, OPTION_NOACCEL)) { + pVMWARE->noAccel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); + pVMWARE->vmwareCapability = 0; + } else { + pVMWARE->noAccel = FALSE; + } + pScrn->videoRam = pVMWARE->videoRam / 1024; + pScrn->memPhysBase = pVMWARE->memPhysBase; + + { + Gamma zeros = { 0.0, 0.0, 0.0 }; + if (!xf86SetGamma(pScrn, zeros)) { + return FALSE; + } + } +#if 0 + if ((i = xf86GetPciInfoForScreen(pScrn->scrnIndex, &pciList, NULL)) != 1) { + /* print error message */ + VMWAREFreeRec(pScrn); + if (i > 0) { + xfree(pciList); + } + return FALSE; + } +#endif + clockRanges = xnfcalloc(sizeof(ClockRange), 1); + clockRanges->next = NULL; + clockRanges->minClock = 1; + clockRanges->maxClock = 400000000; + clockRanges->clockIndex = -1; + clockRanges->interlaceAllowed = FALSE; + clockRanges->doubleScanAllowed = FALSE; + clockRanges->ClockMulFactor = 1; + clockRanges->ClockDivFactor = 1; + + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, + clockRanges, NULL, 256, pVMWARE->maxWidth, 32 * 32, + 128, pVMWARE->maxHeight, + pScrn->display->virtualX, pScrn->display->virtualY, + pVMWARE->videoRam, + LOOKUP_BEST_REFRESH); + if (i == -1) { + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86PruneDriverModes(pScrn); + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + pScrn->currentMode = pScrn->modes; + xf86PrintModes(pScrn); + xf86SetDpi(pScrn, 0, 0); + switch (pScrn->bitsPerPixel) { + case 8: mod = "cfb"; break; + case 16:mod = "cfb16"; break; + case 24:mod = "cfb24"; break; + case 32:mod = "cfb32"; break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unexpected bpp (%d)\n", pScrn->bitsPerPixel); + VMWAREFreeRec(pScrn); + return FALSE; + } + if (mod && !xf86LoadSubModule(pScrn, mod)) { + VMWAREFreeRec(pScrn); + return FALSE; + } + if (!pVMWARE->noAccel || pVMWARE->hwCursor) { + if (!xf86LoadSubModule(pScrn, "xaa")) { + VMWAREFreeRec(pScrn); + return FALSE; + } + } + return TRUE; +} + +static Bool +VMWAREMapMem(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE; + + pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pVMWARE->PciTag, pVMWARE->memPhysBase, pVMWARE->videoRam); + if (!pVMWARE->FbBase) + return FALSE; + pVMWARE->FbSize = pVMWARE->videoRam; + + VmwareLog(("FB Mapped: %p/%u -> %p/%u\n", + pVMWARE->memPhysBase, pVMWARE->videoRam, + pVMWARE->FbBase, pVMWARE->FbSize)); + return TRUE; +} + +static Bool +VMWAREUnmapMem(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE; + + pVMWARE = VMWAREPTR(pScrn); + + VmwareLog(("Unmapped: %p/%u\n", pVMWARE->FbBase, pVMWARE->FbSize)); + + xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->FbBase, pVMWARE->FbSize); + pVMWARE->FbBase = NULL; + return TRUE; +} + +static void +VMWARESave(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->SavedReg; + + vgaHWSave(pScrn, vgaReg, VGA_SR_ALL); + + vmwareReg->svga_reg_enable = 0; + /* FIXME: Save VMWARE state */ +} + +static void +VMWARERestoreRegs(ScrnInfoPtr pScrn, VMWARERegPtr vmwareReg) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + if (vmwareReg->svga_reg_enable) { + vmwareWriteReg(pVMWARE, SVGA_REG_WIDTH, vmwareReg->svga_reg_width); + vmwareWriteReg(pVMWARE, SVGA_REG_HEIGHT, vmwareReg->svga_reg_height); + vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable); + vmwareWriteReg(pVMWARE, SVGA_REG_GUEST_ID, GUEST_OS_LINUX); + } else { + vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable); + } +} + +static void +VMWARERestore(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->SavedReg; + + /* FIXME: Sync */ + vgaHWProtect(pScrn, TRUE); + VMWARERestoreRegs(pScrn, vmwareReg); + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + vgaHWProtect(pScrn, FALSE); +} + +static Bool +VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->ModeReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->ModeReg; + + vgaHWUnlock(hwp); + if (!vgaHWInit(pScrn, mode)) + return FALSE; + pScrn->vtSema = TRUE; + + if (!vgaHWInit(pScrn, mode)) + return FALSE; + + vmwareReg->svga_reg_enable = 1; + vmwareReg->svga_reg_width = max(mode->HDisplay, pScrn->virtualX); + vmwareReg->svga_reg_height = max(mode->VDisplay, pScrn->virtualY); + + vgaHWProtect(pScrn, TRUE); + + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + VMWARERestoreRegs(pScrn, vmwareReg); + + VmwareLog(("Required mode: %ux%u\n", mode->HDisplay, mode->VDisplay)); + VmwareLog(("Virtual: %ux%u\n", pScrn->virtualX, pScrn->virtualY)); + VmwareLog(("dispWidth: %u\n", pScrn->displayWidth)); + pVMWARE->fbOffset = vmwareReadReg(pVMWARE, SVGA_REG_FB_OFFSET); + pVMWARE->fbPitch = vmwareReadReg(pVMWARE, SVGA_REG_BYTES_PER_LINE); + + pScrn->displayWidth = (pVMWARE->fbPitch * 8) / ((pScrn->bitsPerPixel + 7) & ~7); + VmwareLog(("fbOffset: %u\n", pVMWARE->fbOffset)); + VmwareLog(("fbPitch: %u\n", pVMWARE->fbPitch)); + VmwareLog(("New dispWidth: %u\n", pScrn->displayWidth)); + + vgaHWProtect(pScrn, FALSE); + pVMWARE->CurrentLayout.mode = mode; + return TRUE; +} + +static void +VMWAREAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + /* FIXME */ +} + +static void +VMWAREInitFIFO(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + CARD32* vmwareFIFO; + + pVMWARE->mmioPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_MEM_START); + pVMWARE->mmioSize = vmwareReadReg(pVMWARE, SVGA_REG_MEM_SIZE) & ~3; + pVMWARE->mmioVirtBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVMWARE->PciTag, pVMWARE->mmioPhysBase, pVMWARE->mmioSize); + vmwareFIFO = pVMWARE->vmwareFIFO = (CARD32*)pVMWARE->mmioVirtBase; + vmwareFIFO[SVGA_FIFO_MIN] = 4 * sizeof(CARD32); + vmwareFIFO[SVGA_FIFO_MAX] = pVMWARE->mmioSize; + vmwareFIFO[SVGA_FIFO_NEXT_CMD] = 4 * sizeof(CARD32); + vmwareFIFO[SVGA_FIFO_STOP] = 4 * sizeof(CARD32); + pVMWARE->vmwareFIFOMarkSet = FALSE; + vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 1); +} + +static void +VMWAREStopFIFO(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + /* ??? */ + vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0); +} + +static Bool +VMWARECloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + VMWARERestore(pScrn); + VMWAREStopFIFO(pScrn); + VMWAREUnmapMem(pScrn); + pScrn->vtSema = FALSE; + ScreenFromPrivate(pScreen, pScrn); + return (*pScreen->CloseScreen)(scrnIndex, pScreen); +} + +static Bool +VMWARESaveScreen(ScreenPtr pScreen, int mode) +{ + return vgaHWSaveScreen(pScreen, mode); +} + +static void +VMWARELoadPalette(ScrnInfoPtr pScrn, int numColors, int* indices, + LOCO* colors, VisualPtr pVisual) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + int i; + + for (i = 0; i < numColors; i++) { + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 0, colors[*indices].red); + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 1, colors[*indices].green); + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 2, colors[*indices].blue); + indices++; + } + + pVMWARE->checkCursorColor = TRUE; + VmwareLog(("Palette loading done\n")); +} + +static Bool +VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +{ + ScrnInfoPtr pScrn; + vgaHWPtr hwp; + VMWAREPtr pVMWARE; + Bool ret; + + /* Get the ScrnInfoRec */ + pScrn = xf86Screens[pScreen->myNum]; + pVMWARE = VMWAREPTR(pScrn); + + /* + * If using the vgahw module, its data structures and related + * things are typically initialised/mapped here. + */ + + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); + + /* Save the current video state */ + VMWARESave(pScrn); + + VMWAREInitFIFO(pScrn); + + /* Initialise the first mode */ + VMWAREModeInit(pScrn, pScrn->currentMode); + + /* Set the viewport if supported */ + VMWAREAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + /* + * Setup the screen's visuals, and initialise the framebuffer + * code. + */ + VMWAREMapMem(pScrn); + + /* Reset the visual list */ + miClearVisualTypes(); + + /* + * Setup the visuals supported. This driver only supports + * TrueColor for bpp > 8, so the default set of visuals isn't + * acceptable. To deal with this, call miSetVisualTypes with + * the appropriate visual mask. + */ + + if (pScrn->bitsPerPixel > 8) { + 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; + } + } + + /* + * Initialise the framebuffer. + */ + + switch (pScrn->bitsPerPixel) { +#if 0 + case 1: + ret = xf1bppScreenInit(pScreen, pVMWARE->FbBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + case 4: + ret = xf4bppScreenInit(pScreen, pVMWARE->FbBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; +#endif + case 8: + /* + * In ScreenToPrivate, below, we register our own + * CopyPlane proc (via mfbRegisterCopyPlaneProc). + * But we can't handle all cases, so we have to stash + * away a pointer to someone who can. + */ + pVMWARE->pcfbCopyPlane = cfbCopyPlane; + ret = cfbScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + case 16: + pVMWARE->pcfbCopyPlane = cfb16CopyPlane; + ret = cfb16ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + case 24: + pVMWARE->pcfbCopyPlane = cfb24CopyPlane; + ret = cfb24ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + case 32: + pVMWARE->pcfbCopyPlane = cfb32CopyPlane; + ret = cfb32ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth); + break; + default: + xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in VMWAREScreenInit\n", + pScrn->bitsPerPixel); + ret = FALSE; + break; + } + if (!ret) + return FALSE; + + /* Override the default mask/offset settings */ + if (pScrn->bitsPerPixel > 8) { + int i; + VisualPtr visual; + + for (i = 0, visual = pScreen->visuals; + i < pScreen->numVisuals; i++, visual++) { + 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; + } + } + } + + /* + * Wrap the CloseScreen vector and set SaveScreen. + */ + ScreenToPrivate(pScreen, pScrn); + /* + * If backing store is to be supported (as is usually the case), + * initialise it. + */ + miInitializeBackingStore(pScreen); + + /* + * Set initial black & white colourmap indices. + */ + xf86SetBlackWhitePixels(pScreen); + + /* + * Install colourmap functions. If using the vgahw module, + * vgaHandleColormaps would usually be called here. + */ + + /* + * Initialise cursor functions. This example is for the mi + * software cursor. + */ + if (pVMWARE->hwCursor) { + vmwareCursorInit(0, pScreen); + } else { + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + } + + /* Initialise the default colourmap */ + switch (pScrn->depth) { +#if 0 + case 1: + if (!xf1bppCreateDefColormap(pScreen)) + return FALSE; + break; + case 4: + if (!xf4bppCreateDefColormap(pScreen)) + return FALSE; + break; +#endif + default: + if (!cfbCreateDefColormap(pScreen)) + return FALSE; + break; + } + + if (!xf86HandleColormaps(pScreen, 256, 8, + VMWARELoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) { + return FALSE; + } + + + /* Report any unused options (only for the first generation) */ + if (serverGeneration == 1) { + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + } + + vmwareSendSVGACmdUpdateFullScreen(pVMWARE); + if (pVMWARE->hwCursor) { + vmwareRestoreCursor(pScreen); + } + /* Done */ + return TRUE; +} + +static Bool +VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +{ + return VMWAREModeInit(xf86Screens[scrnIndex], mode); +} + +static Bool +VMWAREEnterVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + return VMWAREModeInit(pScrn, pScrn->currentMode); +} + +static void +VMWARELeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + VMWARERestore(pScrn); +} + +static void +VMWAREFreeScreen(int scrnIndex, int flags) +{ + /* + * If the vgahw module is used vgaHWFreeHWRec() would be called + * here. + */ + VMWAREFreeRec(xf86Screens[scrnIndex]); +} + +static Bool +VMWAREValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +{ + /* FIXME... possible */ + return MODE_OK; +} + +static Bool +VMWAREProbe(DriverPtr drv, int flags) +{ + int numDevSections, numUsed; + GDevPtr *devSections; + int *usedChips; + int i; + Bool foundScreen = FALSE; + char buildString[sizeof(VMWAREBuildStr)]; + + RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr)); + xf86DrvMsg(0, X_PROBED, "%s", buildString); + + numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections); + if (numDevSections <= 0) { + xf86DrvMsg(0, X_ERROR, "No vmware driver section\n"); + return FALSE; + } + if (xf86GetPciVideoInfo()) { + VmwareLog(("Some PCI Video Info Exists\n")); + numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_VMWARE, + VMWAREChipsets, VMWAREPciChipsets, devSections, + numDevSections, drv, &usedChips); + for (i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn = NULL; + + VmwareLog(("Even some VMware SVGA PCI instances exists\n")); + pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i], + VMWAREPciChipsets, NULL, NULL, NULL, + NULL, NULL); + if (pScrn) { + VmwareLog(("And even configuration suceeded\n")); + pScrn->driverVersion = VERSION; + pScrn->driverName = VMWARE_DRIVER_NAME; + pScrn->name = VMWARE_NAME; + pScrn->Probe = VMWAREProbe; + pScrn->PreInit = VMWAREPreInit; + pScrn->ScreenInit = VMWAREScreenInit; + pScrn->SwitchMode = VMWARESwitchMode; + pScrn->AdjustFrame = VMWAREAdjustFrame; + pScrn->EnterVT = VMWAREEnterVT; + pScrn->LeaveVT = VMWARELeaveVT; + pScrn->FreeScreen = VMWAREFreeScreen; + pScrn->ValidMode = VMWAREValidMode; + foundScreen = TRUE; + } + } + if (numUsed > 0) { + xfree(usedChips); + } + } + xfree(devSections); + return foundScreen; +} + +DriverRec VMWARE = { + VERSION, + VMWARE_DRIVER_NAME, + VMWAREIdentify, + VMWAREProbe, + VMWAREAvailableOptions, + NULL, + 0 +}; + +#ifdef XFree86LOADER +static MODULESETUPPROTO(vmwareSetup); + +XF86ModuleData vmwareModuleData = { &vmwareVersRec, vmwareSetup, NULL }; + +static pointer +vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + xf86AddDriver(&VMWARE, module, 0); + return (pointer)1; + } + if (errmaj) { + *errmaj = LDR_ONCEONLY; + } + return NULL; +} +#endif /* XFree86LOADER */ + +ScreenPtr funcglob; +ScrnInfoPtr scrnglob; +int vmwareGCPrivateIndex; + +static void +ScreenToPrivate(ScreenPtr pScreen, ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->ScrnFuncs = *pScreen; + funcglob = &pVMWARE->ScrnFuncs; + scrnglob = pScrn; + + pScreen->CloseScreen = VMWARECloseScreen; + pScreen->SaveScreen = VMWARESaveScreen; + +#if 0 + pScreen->QueryBestSize = vmwareQueryBestSize; + pScreen->GetImage = vmwareGetImage; + pScreen->GetSpans = vmwareGetSpans; + pScreen->PointerNonInterestBox = vmwarePointerNonInterestBox; + pScreen->SourceValidate = vmwareSourceValidate; + + pScreen->CreateWindow = vmwareCreateWindow; + pScreen->DestroyWindow = vmwareDestroyWindow; + pScreen->PositionWindow = vmwarePositionWindow; + pScreen->ChangeWindowAttributes = vmwareChangeWindowAttributes; + pScreen->RealizeWindow = vmwareRealizeWindow; + pScreen->UnrealizeWindow = vmwareUnrealizeWindow; + pScreen->ValidateTree = vmwareValidateTree; +// pScreen->PostValidateTree = vmwarePostValidateTree; + pScreen->WindowExposures = vmwareWindowExposures; + pScreen->PaintWindowBackground = vmwarePaintWindowBackground; + pScreen->PaintWindowBorder = vmwarePaintWindowBorder; + pScreen->CopyWindow = vmwareCopyWindow; + pScreen->ClearToBackground = vmwareClearToBackground; + pScreen->ClipNotify = vmwareClipNotify; + pScreen->RestackWindow = vmwareRestackWindow; + + /* Pixmap procedures */ + + pScreen->CreatePixmap = vmwareCreatePixmap; + pScreen->DestroyPixmap = vmwareDestroyPixmap; + + /* Backing store procedures */ + + pScreen->SaveDoomedAreas = vmwareSaveDoomedAreas; + pScreen->RestoreAreas = vmwareRestoreAreas; + pScreen->ExposeCopy = vmwareExposeCopy; + pScreen->TranslateBackingStore = vmwareTranslateBackingStore; + pScreen->ClearBackingStore = vmwareClearBackingStore; + pScreen->DrawGuarantee = vmwareDrawGuarantee; + /* + * A read/write copy of the lower level backing store vector is needed now + * that the functions can be wrapped. + */ +// pScreen->BackingStoreFuncs = vmwareBackingStoreFuncs; + + /* Font procedures */ + + pScreen->RealizeFont = vmwareRealizeFont; + pScreen->UnrealizeFont = vmwareUnrealizeFont; + + /* Cursor Procedures */ + + pScreen->ConstrainCursor = vmwareConstrainCursor; + pScreen->CursorLimits = vmwareCursorLimits; + pScreen->DisplayCursor = vmwareDisplayCursor; + pScreen->RealizeCursor = vmwareRealizeCursor; + pScreen->UnrealizeCursor = vmwareUnrealizeCursor; + pScreen->RecolorCursor = vmwareRecolorCursor; + pScreen->SetCursorPosition = vmwareSetCursorPosition; + + /* GC procedures */ + + pScreen->CreateGC = vmwareCreateGC; + + /* Colormap procedures */ + + pScreen->CreateColormap = vmwareCreateColormap; + pScreen->DestroyColormap = vmwareDestroyColormap; + pScreen->InstallColormap = vmwareInstallColormap; + pScreen->UninstallColormap = vmwareUninstallColormap; + pScreen->ListInstalledColormaps = vmwareListInstalledColormaps; + pScreen->StoreColors = vmwareStoreColors; + pScreen->ResolveColor = vmwareResolveColor; + + + pScreen->GetWindowPixmap = vmwareGetWindowPixmap; + pScreen->SetWindowPixmap = vmwareSetWindowPixmap; + pScreen->GetScreenPixmap = vmwareGetScreenPixmap; + pScreen->SetScreenPixmap = vmwareSetScreenPixmap; + +#endif + + mfbRegisterCopyPlaneProc(pScreen, vmwareCopyPlane); + pScreen->PaintWindowBackground = vmwarePaintWindow; + pScreen->PaintWindowBorder = vmwarePaintWindow; + pScreen->CopyWindow = vmwareCopyWindow; + pScreen->CreateGC = vmwareCreateGC; + pScreen->GetSpans = vmwareGetSpans; + pScreen->GetImage = vmwareGetImage; + pScreen->BlockHandler = vmwareBlockHandler; + pScreen->SaveDoomedAreas = vmwareSaveDoomedAreas; + pScreen->RestoreAreas = vmwareRestoreAreas; + + vmwareGCPrivateIndex = AllocateGCPrivateIndex(); + if (!AllocateGCPrivate(pScreen, vmwareGCPrivateIndex, + sizeof(vmwarePrivGC))) return; + + + switch (pScrn->bitsPerPixel) { + case 8: + pVMWARE->Pmsk = 0x000000FF; + break; + case 16: + pVMWARE->Pmsk = 0x0000FFFF; + break; + case 24: + pVMWARE->Pmsk = 0x00FFFFFF; + break; + case 32: + pVMWARE->Pmsk = 0xFFFFFFFF; + break; + } +} + +static void ScreenFromPrivate(ScreenPtr pScreen, ScrnInfoPtr p) +{ + VMWAREPtr pVMWARE = VMWAREPTR(p); + ScreenPtr save = &pVMWARE->ScrnFuncs; + + /* Random screen procedures */ + + pScreen->CloseScreen = save->CloseScreen; + pScreen->QueryBestSize = save->QueryBestSize; + pScreen->SaveScreen = save->SaveScreen; + pScreen->GetImage = save->GetImage; + pScreen->GetSpans = save->GetSpans; + pScreen->PointerNonInterestBox = save->PointerNonInterestBox; + pScreen->SourceValidate = save->SourceValidate; + + /* Window Procedures */ + + pScreen->CreateWindow = save->CreateWindow; + pScreen->DestroyWindow = save->DestroyWindow; + pScreen->PositionWindow = save->PositionWindow; + pScreen->ChangeWindowAttributes = save->ChangeWindowAttributes; + pScreen->RealizeWindow = save->RealizeWindow; + pScreen->UnrealizeWindow = save->UnrealizeWindow; + pScreen->ValidateTree = save->ValidateTree; + pScreen->PostValidateTree = save->PostValidateTree; + pScreen->WindowExposures = save->WindowExposures; + pScreen->PaintWindowBackground = save->PaintWindowBackground; + pScreen->PaintWindowBorder = save->PaintWindowBorder; + pScreen->CopyWindow = save->CopyWindow; + pScreen->ClearToBackground = save->ClearToBackground; + pScreen->ClipNotify = save->ClipNotify; + pScreen->RestackWindow = save->RestackWindow; + + /* Pixmap procedures */ + + pScreen->CreatePixmap = save->CreatePixmap; + pScreen->DestroyPixmap = save->DestroyPixmap; + + /* Backing store procedures */ + + pScreen->SaveDoomedAreas = save->SaveDoomedAreas; + pScreen->RestoreAreas = save->RestoreAreas; + pScreen->ExposeCopy = save->ExposeCopy; + pScreen->TranslateBackingStore = save->TranslateBackingStore; + pScreen->ClearBackingStore = save->ClearBackingStore; + pScreen->DrawGuarantee = save->DrawGuarantee; + /* + * A read/write copy of the lower level backing store vector is needed now + * that the functions can be wrapped. + */ + pScreen->BackingStoreFuncs = save->BackingStoreFuncs; + + /* Font procedures */ + + pScreen->RealizeFont = save->RealizeFont; + pScreen->UnrealizeFont = save->UnrealizeFont; + + /* Cursor Procedures */ + + pScreen->ConstrainCursor = save->ConstrainCursor; + pScreen->CursorLimits = save->CursorLimits; + pScreen->DisplayCursor = save->DisplayCursor; + pScreen->RealizeCursor = save->RealizeCursor; + pScreen->UnrealizeCursor = save->UnrealizeCursor; + pScreen->RecolorCursor = save->RecolorCursor; + pScreen->SetCursorPosition = save->SetCursorPosition; + + /* GC procedures */ + + pScreen->CreateGC = save->CreateGC; + + /* Colormap procedures */ + + pScreen->CreateColormap = save->CreateColormap; + pScreen->DestroyColormap = save->DestroyColormap; + pScreen->InstallColormap = save->InstallColormap; + pScreen->UninstallColormap = save->UninstallColormap; + pScreen->ListInstalledColormaps = save->ListInstalledColormaps; + pScreen->StoreColors = save->StoreColors; + pScreen->ResolveColor = save->ResolveColor; + + /* Region procedures */ + +#ifdef NEED_SCREEN_REGIONS + pScreen->RegionCreate = save->RegionCreate; + pScreen->RegionInit = save->RegionInit; + pScreen->RegionCopy = save->RegionCopy; + pScreen->RegionDestroy = save->RegionDestroy; + pScreen->RegionUninit = save->RegionUninit; + pScreen->Intersect = save->Intersect; + pScreen->Union = save->Union; + pScreen->Subtract = save->Subtract; + pScreen->Inverse = save->Inverse; + pScreen->RegionReset = save->RegionReset; + pScreen->TranslateRegion = save->TranslateRegion; + pScreen->RectIn = save->RectIn; + pScreen->PointInRegion = save->PointInRegion; + pScreen->RegionNotEmpty = save->RegionNotEmpty; + pScreen->RegionBroken = save->RegionBroken; + pScreen->RegionBreak = save->RegionBreak; + pScreen->RegionEmpty = save->RegionEmpty; + pScreen->RegionExtents = save->RegionExtents; + pScreen->RegionAppend = save->RegionAppend; + pScreen->RegionValidate = save->RegionValidate; +#endif /* NEED_SCREEN_REGIONS */ + pScreen->BitmapToRegion = save->BitmapToRegion; +#ifdef NEED_SCREEN_REGIONS + pScreen->RectsToRegion = save->RectsToRegion; +#endif /* NEED_SCREEN_REGIONS */ + pScreen->SendGraphicsExpose = save->SendGraphicsExpose; + + /* os layer procedures */ + + pScreen->BlockHandler = save->BlockHandler; + pScreen->WakeupHandler = save->WakeupHandler; + + pScreen->CreateScreenResources = save->CreateScreenResources; + pScreen->ModifyPixmapHeader = save->ModifyPixmapHeader; + + pScreen->GetWindowPixmap = save->GetWindowPixmap; + pScreen->SetWindowPixmap = save->SetWindowPixmap; + pScreen->GetScreenPixmap = save->GetScreenPixmap; + pScreen->SetScreenPixmap = save->SetScreenPixmap; + + pScreen->MarkWindow = save->MarkWindow; + pScreen->MarkOverlappedWindows = save->MarkOverlappedWindows; + pScreen->ChangeSaveUnder = save->ChangeSaveUnder; + pScreen->PostChangeSaveUnder = save->PostChangeSaveUnder; + pScreen->MoveWindow = save->MoveWindow; + pScreen->ResizeWindow = save->ResizeWindow; + pScreen->GetLayerWindow = save->GetLayerWindow; + pScreen->HandleExposures = save->HandleExposures; + pScreen->ReparentWindow = save->ReparentWindow; + +#ifdef SHAPE + pScreen->SetShape = save->SetShape; +#endif /* SHAPE */ + + pScreen->ChangeBorderWidth = save->ChangeBorderWidth; + pScreen->MarkUnrealizedWindow = save->MarkUnrealizedWindow; +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h new file mode 100644 index 000000000..ab42e10f1 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h @@ -0,0 +1,758 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * Id: vmware.h,v 1.6 2001/01/30 18:13:47 bennett Exp $ + * **********************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#ifndef VMWARE_H +#define VMWARE_H + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Resources.h" + +#include "compiler.h" /* inb/outb */ + +#include "xf86PciInfo.h" /* pci vendor id */ +#include "xf86Pci.h" /* pci */ + +#include "mipointer.h" /* sw cursor */ +#include "mibstore.h" /* backing store */ +#include "micmap.h" /* mi color map */ +#include "vgaHW.h" /* VGA hardware */ +#define PSZ 8 /* 8bpp */ +#include "cfb.h" +#undef PSZ +#include "cfb16.h" /* 16bpp */ +#include "cfb24.h" /* 24bpp */ +#include "cfb32.h" /* 32bpp */ + +#include "xf86cmap.h" /* xf86HandleColormaps */ + +#include "vm_basic_types.h" +#include "svga_reg.h" + +typedef struct { + CARD32 svga_reg_enable; + CARD32 svga_reg_width; + CARD32 svga_reg_height; +} VMWARERegRec, *VMWARERegPtr; + +typedef struct { + DisplayModePtr mode; +} VMWAREFBLayout; + +typedef struct { + EntityInfoPtr pEnt; + pciVideoPtr PciInfo; + PCITAG PciTag; + Bool Primary; + int depth; + int bitsPerPixel; + rgb weight; + rgb offset; + int defaultVisual; + int videoRam; + unsigned long memPhysBase; + unsigned long fbOffset; + unsigned long fbPitch; + unsigned long ioBase; + int maxWidth; + int maxHeight; + unsigned int vmwareCapability; + + unsigned char* FbBase; + unsigned long FbSize; + + VMWARERegRec SavedReg; + VMWARERegRec ModeReg; + + VMWAREFBLayout CurrentLayout; + Bool noAccel; + Bool hwCursor; + Bool cursorDefined; + Bool mouseHidden; + + unsigned long mmioPhysBase; + unsigned long mmioSize; + + unsigned char* mmioVirtBase; + CARD32* vmwareFIFO; + Bool vmwareFIFOMarkSet; + BoxRec vmwareAccelArea; + struct { + BoxRec Box; + unsigned int Width; + unsigned int Height; + unsigned int XHot; + unsigned int YHot; + } Mouse; + Bool checkCursorColor; + unsigned int vmwareBBLevel; + unsigned long Pmsk; + + uint16 indexReg, valueReg; + + RegionPtr (*pcfbCopyPlane) (DrawablePtr, DrawablePtr, GCPtr, + int, int, int, int, int, int, + unsigned long); + ScreenRec ScrnFuncs; + /* ... */ +} VMWARERec, *VMWAREPtr; + +#define VMWAREPTR(p) ((VMWAREPtr)((p)->driverPrivate)) + +static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) { + return xf86Screens[s->myNum]; +} + +#include "gcstruct.h" + +#define MIN(a,b) ((a)<(b)?(a):(b)) +#define MAX(a,b) ((a)>(b)?(a):(b)) + +#define GC_FUNC_PROLOGUE(pGC) \ +{ \ + vmwarePrivGCPtr pGCPriv = (vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr; \ + (pGC)->funcs = pGCPriv->wrapFuncs; \ + (pGC)->ops = pGCPriv->wrapOps; \ +} + +#define GC_FUNC_EPILOGUE(pGC) \ +{ \ + vmwarePrivGCPtr pGCPriv = (vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr; \ + pGCPriv->wrapFuncs = (pGC)->funcs; \ + (pGC)->funcs = &vmwareGCFuncs; \ + pGCPriv->wrapOps = (pGC)->ops; \ + (pGC)->ops = &vmwareGCOps; \ +} + +#define GC_OPS(pGC) ((vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr)->wrapOps + +#define MOUSE_ID 1 + +#define UPDATE_ACCEL_AREA(pVMWARE,box) \ +{ \ + if (!(pVMWARE)->vmwareFIFOMarkSet) { \ + (pVMWARE)->vmwareFIFOMarkSet = TRUE; \ + (pVMWARE)->vmwareAccelArea.x1 = (box).x1; \ + (pVMWARE)->vmwareAccelArea.y1 = (box).y1; \ + (pVMWARE)->vmwareAccelArea.x2 = (box).x2; \ + (pVMWARE)->vmwareAccelArea.y2 = (box).y2; \ + } else { \ + if ((box).x1 < (pVMWARE)->vmwareAccelArea.x1) \ + (pVMWARE)->vmwareAccelArea.x1 = (box).x1; \ + if ((box).y1 < (pVMWARE)->vmwareAccelArea.y1) \ + (pVMWARE)->vmwareAccelArea.y1 = (box).y1; \ + if ((box).x2 > (pVMWARE)->vmwareAccelArea.x2) \ + (pVMWARE)->vmwareAccelArea.x2 = (box).x2; \ + if ((box).y2 > (pVMWARE)->vmwareAccelArea.y2) \ + (pVMWARE)->vmwareAccelArea.y2 = (box).y2; \ + } \ +} + +#define ABS(x) (((x) >= 0) ? (x) : -(x)) +#define BOX_INTERSECT(a, b) \ + (ABS(((a).x1 + (a).x2) - ((b).x1 + (b).x2)) <= \ + ((a).x2 - (a).x1) + ((b).x2 - (b).x1) && \ + ABS(((a).y1 + (a).y2) - ((b).y1 + (b).y2)) <= \ + ((a).y2 - (a).y1) + ((b).y2 - (b).y1)) + +#define HIDE_CURSOR(vmPtr,box) \ +{ \ + if (!(vmPtr)->mouseHidden) { \ + if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ + BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ + (vmPtr)->mouseHidden = TRUE; \ + if ((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ID, MOUSE_ID); \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, 0); \ + } else { \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 0); \ + UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ + } \ + } \ + } \ +} + +#define HIDE_CURSOR_ACCEL(vmPtr,box) \ +{ \ + if (!(vmPtr)->mouseHidden) { \ + if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ + !((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) && \ + BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ + (vmPtr)->mouseHidden = TRUE; \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 0); \ + UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ + } \ + } \ +} + + +#define SHOW_CURSOR(vmPtr,box) \ +{ \ + if ((vmPtr)->mouseHidden) { \ + if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ + BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ + (vmPtr)->mouseHidden = FALSE; \ + if ((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ID, MOUSE_ID); \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, 1); \ + } else { \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 1); \ + UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ + } \ + } \ + } \ +} + +/* Only use this for debugging */ + +#define HIDE_CURSOR_ALWAYS(vmPtr,box) \ +{ \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 0); \ + (vmPtr)->mouseHidden = TRUE; \ + vmwareFIFOMarkSet = TRUE; \ + UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ +} + +#define SHOW_CURSOR_ALWAYS(vmPtr,box) \ +{ \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 1); \ + (vmPtr)->mouseHidden = FALSE; \ + vmwareFIFOMarkSet = TRUE; \ +} + +/*#define DEBUG_LOGGING*/ +#undef DEBUG_LOGGING +#ifdef DEBUG_LOGGING +#define VmwareLog(args) ErrorF args +#define TRACEPOINT VmwareLog((__FUNCTION__ ":" __FILE__ "\n")); +#else +#define VmwareLog(args) +#define TRACEPOINT +#endif + +/* Undefine this to kill all acceleration */ +#define ACCELERATE_OPS + +typedef struct vmwarePrivGC +{ + GCFuncs *wrapFuncs; + GCOps *wrapOps; +} +vmwarePrivGC, *vmwarePrivGCPtr; + + +extern int vmwareGCPrivateIndex; + +#define GEN_FUNC_WRAPPER(cond,init,setBB,op) \ + if ((cond)) { \ + init; \ + \ + if (pVMWARE->vmwareBBLevel == 0) { \ + BoxRec BB; \ + \ + setBB; \ + HIDE_CURSOR(pVMWARE, BB); \ + vmwareWaitForFB(pVMWARE); \ + pVMWARE->vmwareBBLevel++; \ + op; \ + pVMWARE->vmwareBBLevel--; \ + vmwareSendSVGACmdUpdate(pVMWARE, &BB); \ + SHOW_CURSOR(pVMWARE, BB); \ + } else { \ + vmwareWaitForFB(pVMWARE); \ + op; \ + } \ + } else { \ + op; \ + } +#define VM_FUNC_WRAPPER(cond,setBB,op) \ + GEN_FUNC_WRAPPER(cond,,setBB,op) + +#define GC_FUNC_WRAPPER(cond,screen,setBB,op) \ + GEN_FUNC_WRAPPER(cond, VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(screen)), setBB, op) + +#define GC_FUNC_ACCEL_WRAPPER(cond,screen,setBB,accelcond,accel,op) \ + GEN_FUNC_WRAPPER(cond, \ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(screen)); \ + if (accelcond) { \ + BoxRec BB; \ + Bool hidden = pVMWARE->mouseHidden; \ + \ + setBB; \ + if (!hidden) { \ + HIDE_CURSOR_ACCEL(pVMWARE, BB); \ + } \ + accel; \ + if (!hidden) { \ + SHOW_CURSOR(pVMWARE, BB); \ + } \ + UPDATE_ACCEL_AREA(pVMWARE, BB); \ + return; \ + }, \ + setBB, op) + +void vmwareWriteReg( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE, int index, CARD32 value +#endif + ); + +void vmwareWriteWordToFIFO( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE, CARD32 value +#endif + ); + +void vmwareWaitForFB( +#ifdef NeedFunctionPrototypes + VMWAREPtr pVMWARE +#endif + ); + +void vmwareSendSVGACmdUpdate( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE, BoxPtr pBB +#endif + ); + +/* vmwaregc.c */ + +void vmwareInitGC( +#if NeedFunctionPrototypes + void +#endif + ); + +Bool vmwareCreateGC( +#if NeedFunctionPrototypes + GCPtr pGC +#endif + ); + +void vmwareValidateGC( +#if NeedFunctionPrototypes + GCPtr pGC, unsigned long changes, DrawablePtr pDrawable +#endif + ); + +void vmwareChangeGC( +#if NeedFunctionPrototypes + GCPtr pGC, unsigned long changes +#endif + ); + +void vmwareCopyGC( +#if NeedFunctionPrototypes + GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst +#endif + ); + +void vmwareDestroyGC( +#if NeedFunctionPrototypes + GCPtr pGC +#endif + ); + +void vmwareChangeClip( +#if NeedFunctionPrototypes + GCPtr pGC, int type, pointer pValue, int nrects +#endif + ); + +void vmwareDestroyClip( +#if NeedFunctionPrototypes + GCPtr pGC +#endif + ); + +void vmwareCopyClip( +#if NeedFunctionPrototypes + GCPtr pGCDst, GCPtr pGCSrc +#endif + ); + +/* vmwareinit.c */ + +void vmwareInitEnvironment( +#if NeedFunctionPrototypes + void +#endif + ); + +void vmwareInitDisplay( +#if NeedFunctionPrototypes + int screen_idx +#endif + ); + +void vmwareCleanUp( +#if NeedFunctionPrototypes + void +#endif + ); + +/* vmwarescrin.c */ +CARD32 vmwareCalculateOffset(CARD32 mask); + +Bool vmwareScreenInit( +#if NeedFunctionPrototypes + ScreenPtr pScreen, + pointer pbits, int xsize, int ysize, int dpix, int dpiy, int width +#endif + ); + +/* vmwarevga.c */ + +void vmwareSaveVGAInfo( +#if NeedFunctionPrototypes + int screen_idx +#endif + ); + +void vmwareRestoreVGAInfo( +#if NeedFunctionPrototypes + void +#endif + ); + +/* vmwarecmap.c */ + +void vmwareSetPaletteBase( +#if NeedFunctionPrototypes + int pal +#endif + ); + +int vmwareListInstalledColormaps( +#if NeedFunctionPrototypes + ScreenPtr pScreen, Colormap * pmaps +#endif + ); + +int vmwareGetInstalledColormaps( +#if NeedFunctionPrototypes + ScreenPtr pScreen, ColormapPtr * pmap +#endif + ); + +void vmwareStoreColors( +#if NeedFunctionPrototypes + ColormapPtr pmap, int ndef, xColorItem * pdefs +#endif + ); + +void vmwareInstallColormap( +#if NeedFunctionPrototypes + ColormapPtr pmap +#endif + ); + +void vmwareUninstallColormap( +#if NeedFunctionPrototypes + ColormapPtr pmap +#endif + ); + +void vmwareRestoreColor0( +#if NeedFunctionPrototypes + ScreenPtr pScreen +#endif + ); + +/* vmwarecurs.c */ +Bool vmwareCursorInit( +#if NeedFunctionPrototypes + char *pm, ScreenPtr pScr +#endif + ); + +Bool vmwareRealizeCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, CursorPtr pCurs +#endif + ); + +Bool vmwareUnrealizeCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, CursorPtr pCurs +#endif + ); + +void vmwareSetCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, CursorPtr pCurs, int x, int y +#endif + ); + +void vmwareRepositionCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr +#endif + ); + +void vmwareRestoreCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr +#endif + ); + +void vmwareMoveCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, int x, int y +#endif + ); + +void vmwareRenewCursorColor( +#if NeedFunctionPrototypes + ScreenPtr pScr +#endif + ); + +void vmwareRecolorCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, CursorPtr pCurs, Bool displayed +#endif + ); + +void vmwareWarpCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, int x, int y +#endif + ); + +void vmwareQueryBestSize( +#if NeedFunctionPrototypes + int class, unsigned short *pwidth, unsigned short *pheight, ScreenPtr pScr +#endif + ); + +void vmwareCursorOff( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE +#endif + ); + +void vmwareClearSavedCursor( +#if NeedFunctionPrototypes + int scr_index +#endif + ); + +void vmwareBlockHandler( +#if NeedFunctionPrototypes + int i, pointer blockData, pointer pTimeout, pointer pReadmask +#endif + ); + +/* BEGIN Screen functions that draw */ + +void vmwareCopyWindow( +#if NeedFunctionPrototypes + WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc +#endif + ); + +void vmwarePaintWindow( +#if NeedFunctionPrototypes + WindowPtr pWindow, RegionPtr pRegion, int what +#endif + ); + +void vmwareGetSpans( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst +#endif + ); + +void vmwareGetImage( +#if NeedFunctionPrototypes + DrawablePtr src, + int x, + int y, + int w, + int h, unsigned int format, unsigned long planeMask, char *pBinImage +#endif + ); + +void vmwareSaveDoomedAreas( +#if NeedFunctionPrototypes + WindowPtr pWin, RegionPtr prgnSave, int xorg, int yorg +#endif + ); + +RegionPtr vmwareRestoreAreas( +#if NeedFunctionPrototypes + WindowPtr pWin, + RegionPtr prgnRestore +#endif + ); + +/* END Screen functions that draw */ + +/* BEGIN GCOps */ + +void vmwareFillSpans( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted +#endif + ); + +void vmwareSetSpans( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, + char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted +#endif + ); + +void vmwarePutImage( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, + int depth, + int x, int y, int w, int h, int leftPad, int format, char *pBits +#endif + ); + +void vmwareDoBitblt(DrawablePtr pSrc, +#if NeedFunctionPrototypes + DrawablePtr pDst, + int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask, unsigned long bitplane +#endif + ); + +RegionPtr vmwareCopyArea( +#if NeedFunctionPrototypes + DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty +#endif + ); + +RegionPtr vmwareCopyPlane( +#if NeedFunctionPrototypes + DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + int srcx, + int srcy, + int width, int height, int dstx, int dsty, unsigned long bitPlane +#endif + ); + +void vmwarePolyPoint( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit +#endif + ); + +void vmwarePolylines( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit +#endif + ); + +void vmwarePolySegment( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs +#endif + ); + +void vmwarePolyRectangle( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle * pRects +#endif + ); + +void vmwarePolyArc( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs +#endif + ); + +void vmwareFillPolygon( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts +#endif + ); + +void vmwarePolyFillRect( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle * prectInit +#endif + ); + +void vmwarePolyFillArc( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs +#endif + ); + +int vmwarePolyText8( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars +#endif + ); + +int vmwarePolyText16( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, unsigned short *chars +#endif + ); + +void vmwareImageText8( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars +#endif + ); + +void vmwareImageText16( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, unsigned short *chars +#endif + ); + +void vmwareImageGlyphBlt( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase +#endif + ); + +void vmwarePolyGlyphBlt( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase +#endif + ); + +void vmwarePushPixels( +#if NeedFunctionPrototypes + GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y +#endif + ); + +/* END GCOps */ +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man new file mode 100644 index 000000000..e2d707fef --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man @@ -0,0 +1,37 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man,v 1.2 2001/04/06 17:44:58 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH VMWARE __drivermansuffix__ __vendorversion__ +.SH NAME +vmware \- VMware SVGA video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qvmware\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B vmware +is an XFree86 driver for VMware virtual video cards. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the version of any virtual VMware SVGA adapter. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: off. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Copyright (c) 1999-2001 VMware, Inc. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c new file mode 100644 index 000000000..f081a3b31 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c @@ -0,0 +1,283 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareblt[] = + + "Id: vmwareblt.c,v 1.4 2001/01/27 00:28:15 bennett Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "X.h" +#include "cfb.h" +#include "vmware.h" + +void +vmwareDoBitblt(DrawablePtr pSrc, + DrawablePtr pDst, + int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask, unsigned long bitplane) +{ + BoxPtr pbox; + int nbox; + BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; + DDXPointPtr pptTmp, pptNew1, pptNew2; + VMWAREPtr pVMWARE; + + pVMWARE = VMWAREPTR(infoFromScreen(pSrc->pScreen)); + + pbox = REGION_RECTS(prgnDst); + nbox = REGION_NUM_RECTS(prgnDst); + pboxNew1 = NULL; + pptNew1 = NULL; + pboxNew2 = NULL; + pptNew2 = NULL; + if (pptSrc->y < pbox->y1) { + if (nbox > 1) { + /* keep ordering in each band, reverse order of bands */ + pboxNew1 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + if (!pboxNew1) + return; + pptNew1 = + (DDXPointPtr) ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); + if (!pptNew1) { + DEALLOCATE_LOCAL(pboxNew1); + return; + } + pboxBase = pboxNext = pbox + nbox - 1; + while (pboxBase >= pbox) { + while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) + pboxNext--; + pboxTmp = pboxNext + 1; + pptTmp = pptSrc + (pboxTmp - pbox); + while (pboxTmp <= pboxBase) { + *pboxNew1++ = *pboxTmp++; + *pptNew1++ = *pptTmp++; + } + pboxBase = pboxNext; + } + pboxNew1 -= nbox; + pbox = pboxNew1; + pptNew1 -= nbox; + pptSrc = pptNew1; + } + } + if (pptSrc->x < pbox->x1) { + if (nbox > 1) { + /* reverse order of rects in each band */ + pboxNew2 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + pptNew2 = + (DDXPointPtr) ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); + if (!pboxNew2 || !pptNew2) { + if (pptNew2) + DEALLOCATE_LOCAL(pptNew2); + if (pboxNew2) + DEALLOCATE_LOCAL(pboxNew2); + if (pboxNew1) { + DEALLOCATE_LOCAL(pptNew1); + DEALLOCATE_LOCAL(pboxNew1); + } + return; + } + pboxBase = pboxNext = pbox; + while (pboxBase < pbox + nbox) { + while ((pboxNext < pbox + nbox) && + (pboxNext->y1 == pboxBase->y1)) pboxNext++; + pboxTmp = pboxNext; + pptTmp = pptSrc + (pboxTmp - pbox); + while (pboxTmp != pboxBase) { + *pboxNew2++ = *--pboxTmp; + *pptNew2++ = *--pptTmp; + } + pboxBase = pboxNext; + } + pboxNew2 -= nbox; + pbox = pboxNew2; + pptNew2 -= nbox; + pptSrc = pptNew2; + } + } + /* Send the commands */ + while (nbox--) { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_COPY); + vmwareWriteWordToFIFO(pVMWARE, pptSrc->x); + vmwareWriteWordToFIFO(pVMWARE, pptSrc->y); + vmwareWriteWordToFIFO(pVMWARE, pbox->x1); + vmwareWriteWordToFIFO(pVMWARE, pbox->y1); + vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1); + vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1); + vmwareWriteWordToFIFO(pVMWARE, alu); + pptSrc++; + pbox++; + } + if (pboxNew2) { + DEALLOCATE_LOCAL(pptNew2); + DEALLOCATE_LOCAL(pboxNew2); + } + if (pboxNew1) { + DEALLOCATE_LOCAL(pptNew1); + DEALLOCATE_LOCAL(pboxNew1); + } +} + +RegionPtr +vmwareCopyArea(DrawablePtr pSrcDrawable, +DrawablePtr pDstDrawable, +GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) +{ + RegionPtr prgn; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pGC->pScreen)); + + TRACEPOINT + if ((pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY) && + (pGC->alu == GXcopy || (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP)) && + pSrcDrawable->type == DRAWABLE_WINDOW && + pDstDrawable->type == DRAWABLE_WINDOW && + (pGC->planemask & pVMWARE->Pmsk) == pVMWARE->Pmsk) { + void (*doBitBlt) (DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long, unsigned long); + BoxRec updateBB; + BoxRec mouseBB; + Bool hidden = pVMWARE->mouseHidden; + + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); + mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); + mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; + mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; + doBitBlt = vmwareDoBitblt; + if (!hidden) { + HIDE_CURSOR_ACCEL(pVMWARE, mouseBB); + } + prgn = + cfbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, + height, dstx, dsty, doBitBlt, 0L); + if (!hidden) { + SHOW_CURSOR(pVMWARE, mouseBB); + } + UPDATE_ACCEL_AREA(pVMWARE, updateBB); + } else if (pDstDrawable->type == DRAWABLE_WINDOW || + pSrcDrawable->type == DRAWABLE_WINDOW) { + if (pVMWARE->vmwareBBLevel == 0) { + BoxRec updateBB; + BoxRec mouseBB; + + if (pDstDrawable->type == DRAWABLE_WINDOW && + pSrcDrawable->type != DRAWABLE_WINDOW) { + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB = updateBB; + } else if (pDstDrawable->type != DRAWABLE_WINDOW && + pSrcDrawable->type == DRAWABLE_WINDOW) { + updateBB.x1 = pSrcDrawable->x + srcx; + updateBB.y1 = pSrcDrawable->y + srcy; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB = updateBB; + } else { + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); + mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); + mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; + mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; + } + HIDE_CURSOR(pVMWARE, mouseBB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + prgn = + GC_OPS(pGC)->CopyArea(pSrcDrawable, + pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); + pVMWARE->vmwareBBLevel--; + if (pDstDrawable->type == DRAWABLE_WINDOW) { + vmwareSendSVGACmdUpdate(pVMWARE, &updateBB); + } + SHOW_CURSOR(pVMWARE, mouseBB); + } else { + vmwareWaitForFB(pVMWARE); + prgn = + GC_OPS(pGC)->CopyArea(pSrcDrawable, + pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); + } + } else { + prgn = + GC_OPS(pGC)->CopyArea(pSrcDrawable, pDstDrawable, + pGC, srcx, srcy, width, height, dstx, dsty); + } + return prgn; +} + +RegionPtr +vmwareCopyPlane(DrawablePtr pSrcDrawable, +DrawablePtr pDstDrawable, +GCPtr pGC, +int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane) +{ + RegionPtr prgn; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pGC->pScreen)); + + TRACEPOINT + + if (pDstDrawable->type == DRAWABLE_WINDOW || + pSrcDrawable->type == DRAWABLE_WINDOW) { + if (pVMWARE->vmwareBBLevel == 0) { + BoxRec updateBB; + BoxRec mouseBB; + + if (pDstDrawable->type == DRAWABLE_WINDOW && + pSrcDrawable->type != DRAWABLE_WINDOW) { + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB = updateBB; + } else if (pDstDrawable->type != DRAWABLE_WINDOW && + pSrcDrawable->type == DRAWABLE_WINDOW) { + updateBB.x1 = pSrcDrawable->x + srcx; + updateBB.y1 = pSrcDrawable->y + srcy; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB = updateBB; + } else { + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); + mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); + mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; + mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; + } + HIDE_CURSOR(pVMWARE, mouseBB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + prgn = + pVMWARE->pcfbCopyPlane(pSrcDrawable, + pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, + bitPlane); + pVMWARE->vmwareBBLevel--; + if (pDstDrawable->type == DRAWABLE_WINDOW) { + vmwareSendSVGACmdUpdate(pVMWARE, &updateBB); + } + SHOW_CURSOR(pVMWARE, mouseBB); + } else { + vmwareWaitForFB(pVMWARE); + prgn = + pVMWARE->pcfbCopyPlane(pSrcDrawable, + pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, + bitPlane); + } + } else { + prgn = + pVMWARE->pcfbCopyPlane(pSrcDrawable, pDstDrawable, + pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); + } + return prgn; +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c new file mode 100644 index 000000000..d390ddaa8 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c @@ -0,0 +1,65 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarebstor[] = + + "Id: vmwarebstor.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +void +vmwareSaveDoomedAreas(WindowPtr pWin, + RegionPtr prgnSave, int xorg, int yorg) +{ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + + TRACEPOINT + + if (pVMWARE->vmwareBBLevel == 0) { + BoxRec BB; + + BB = *REGION_EXTENTS(pWin->drawable.pScreen, prgnSave); + BB.x1 += xorg; + BB.x2 += xorg; + BB.y1 += yorg; + BB.y2 += yorg; + HIDE_CURSOR(pVMWARE, BB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + pVMWARE->ScrnFuncs.SaveDoomedAreas(pWin, prgnSave, xorg, yorg); + pVMWARE->vmwareBBLevel--; + SHOW_CURSOR(pVMWARE, BB); + } else { + pVMWARE->ScrnFuncs.SaveDoomedAreas(pWin, prgnSave, xorg, yorg); + } +} + +RegionPtr +vmwareRestoreAreas(WindowPtr pWin, + RegionPtr prgnRestore) +{ + RegionPtr res; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + + TRACEPOINT + + if (pVMWARE->vmwareBBLevel == 0) { + BoxPtr pBB; + + pBB = REGION_EXTENTS(pWin->drawable.pScreen, prgnRestore); + HIDE_CURSOR(pVMWARE, *pBB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + res = pVMWARE->ScrnFuncs.RestoreAreas(pWin, prgnRestore); + pVMWARE->vmwareBBLevel--; + vmwareSendSVGACmdUpdate(pVMWARE, pBB); + SHOW_CURSOR(pVMWARE, *pBB); + } else { + res = pVMWARE->ScrnFuncs.RestoreAreas(pWin, prgnRestore); + } + return res; +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c new file mode 100644 index 000000000..e4b16abce --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c @@ -0,0 +1,439 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarecurs[] = + + "Id: vmwarecurs.c,v 1.5 2001/01/30 23:33:02 bennett Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" +#include "cursorstr.h" +#include "bits2pixels.h" + +typedef struct _VMwareCursPriv { + uint8 *bSource; + uint8 *bMask; + uint8 *pSource; + uint8 *pMask; +} VMwareCursPriv; + +static int vmwareCursGeneration = -1; +static CursorPtr vmwareSaveCursors[MAXSCREENS]; + +static miPointerSpriteFuncRec vmwarePointerSpriteFuncs = { + vmwareRealizeCursor, + vmwareUnrealizeCursor, + vmwareSetCursor, + vmwareMoveCursor, +}; + +Bool +vmwareCursorInit(char *pm, + ScreenPtr pScr) +{ + TRACEPOINT + if (vmwareCursGeneration != serverGeneration) { + miPointerScreenFuncPtr xf86scrn = xf86GetPointerScreenFuncs(); + + pScr->QueryBestSize = vmwareQueryBestSize; + if (!(miPointerInitialize(pScr, &vmwarePointerSpriteFuncs, + xf86scrn, FALSE))) + return FALSE; + + pScr->RecolorCursor = vmwareRecolorCursor; + vmwareCursGeneration = serverGeneration; + } + return TRUE; +} + +static void ZeroBits(uint8 *buf, int preserveBits, int totalBits) { + while (preserveBits > 8) { + buf++; + preserveBits -= 8; + totalBits -= 8; + } + *buf &= ~(~0 << preserveBits); + buf++; + preserveBits -= 8; + totalBits -= 8; + while (totalBits > 0) { + *buf++ = 0; + totalBits -= 8; + } +} + +Bool +vmwareRealizeCursor(ScreenPtr pScr, + CursorPtr pCurs) +{ + pointer *pPriv = &pCurs->bits->devPriv[pScr->myNum]; + VMwareCursPriv *cursPriv; + int i; + uint8 *bits; + VMWAREPtr pVMWARE; + + TRACEPOINT + if (pCurs->bits->refcnt > 1) + return TRUE; + cursPriv = (VMwareCursPriv *) xcalloc(1, sizeof(VMwareCursPriv)); + if (!cursPriv) + return FALSE; + cursPriv->bSource = (uint8 *) xcalloc(1, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); + if (!cursPriv->bSource) { + xfree(cursPriv); + return FALSE; + } + pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + + memcpy(cursPriv->bSource, pCurs->bits->source, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); + bits = cursPriv->bSource; + /* Handle cursors that do not have zero bits beyond the right edge of each scanline */ + for (i = 0; i < pCurs->bits->height; i++) { + ZeroBits(bits, pCurs->bits->width, PixmapBytePad(pCurs->bits->width, 1) * 8); + bits += PixmapBytePad(pCurs->bits->width, 1); + } + /* Raster_BitsToPixels expects most significant bit first */ + for (i = 0; i < PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height; i++) { + cursPriv->bSource[i] = + (cursPriv->bSource[i] & 0x01) << 7 | + (cursPriv->bSource[i] & 0x02) << 5 | + (cursPriv->bSource[i] & 0x04) << 3 | + (cursPriv->bSource[i] & 0x08) << 1 | + (cursPriv->bSource[i] & 0x10) >> 1 | + (cursPriv->bSource[i] & 0x20) >> 3 | + (cursPriv->bSource[i] & 0x40) >> 5 | + (cursPriv->bSource[i] & 0x80) >> 7; + } + cursPriv->bMask = (uint8 *) xcalloc(1, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); + if (!cursPriv->bMask) { + xfree(cursPriv->bSource); + xfree(cursPriv); + return FALSE; + } + memcpy(cursPriv->bMask, pCurs->bits->mask, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); + bits = cursPriv->bMask; + /* Handle cursors that do not have zero bits beyond the right edge of each scanline */ + for (i = 0; i < pCurs->bits->height; i++) { + ZeroBits(bits, pCurs->bits->width, PixmapBytePad(pCurs->bits->width, 1) * 8); + bits += PixmapBytePad(pCurs->bits->width, 1); + } + for (i = 0; i < PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height; i++) { + cursPriv->bMask[i] = + (cursPriv->bMask[i] & 0x01) << 7 | + (cursPriv->bMask[i] & 0x02) << 5 | + (cursPriv->bMask[i] & 0x04) << 3 | + (cursPriv->bMask[i] & 0x08) << 1 | + (cursPriv->bMask[i] & 0x10) >> 1 | + (cursPriv->bMask[i] & 0x20) >> 3 | + (cursPriv->bMask[i] & 0x40) >> 5 | + (cursPriv->bMask[i] & 0x80) >> 7; + } + cursPriv->pSource = (uint8 *) xcalloc(4, SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel)); + if (!cursPriv->pSource) { + xfree(cursPriv->bMask); + xfree(cursPriv->bSource); + xfree(cursPriv); + return FALSE; + } + cursPriv->pMask = (uint8 *) xcalloc(4, SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel)); + if (!cursPriv->pMask) { + xfree(cursPriv->pSource); + xfree(cursPriv->bMask); + xfree(cursPriv->bSource); + xfree(cursPriv); + return FALSE; + } + Raster_BitsToPixels(cursPriv->bMask, PixmapBytePad(pCurs->bits->width, 1), + cursPriv->pMask, 4 * SVGA_PIXMAP_SCANLINE_SIZE(pCurs->bits->width, pVMWARE->bitsPerPixel), + pVMWARE->bitsPerPixel / 8, + pCurs->bits->width, pCurs->bits->height, 0, ~0); + *pPriv = (pointer) cursPriv; + return TRUE; +} + +Bool +vmwareUnrealizeCursor(ScreenPtr pScr, + CursorPtr pCurs) +{ + VMwareCursPriv *cursPriv; + + TRACEPOINT + if (pCurs->bits->refcnt <= 1 && + (cursPriv = pCurs->bits->devPriv[pScr->myNum])) { + xfree(cursPriv->pMask); + xfree(cursPriv->pSource); + xfree(cursPriv->bMask); + xfree(cursPriv->bSource); + xfree(cursPriv); + } + return TRUE; +} + +static void +vmwareLoadCursor(ScreenPtr pScr, + CursorPtr pCurs, + int x, + int y) +{ + VMWAREPtr pVMWARE; + + TRACEPOINT + + if (!pCurs) + return; + + pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + + pVMWARE->Mouse.Width = pCurs->bits->width; + pVMWARE->Mouse.Height = pCurs->bits->height; + pVMWARE->Mouse.XHot = pCurs->bits->xhot; + pVMWARE->Mouse.YHot = pCurs->bits->yhot; + vmwareRecolorCursor(pScr, pCurs, TRUE); + vmwareMoveCursor(pScr, x, y); + + if (!(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS)) { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); + vmwareWriteWordToFIFO(pVMWARE, 1); + } +} + +void +vmwareSetCursor(ScreenPtr pScr, + CursorPtr pCurs, + int x, + int y) +{ + int index = pScr->myNum; + + TRACEPOINT + + if (!pCurs) + return; + + vmwareSaveCursors[index] = pCurs; + vmwareLoadCursor(pScr, pCurs, x, y); +} + +void +vmwareRestoreCursor(ScreenPtr pScr) +{ + int index = pScr->myNum; + int x, y; + + TRACEPOINT + + miPointerPosition(&x, &y); + vmwareLoadCursor(pScr, vmwareSaveCursors[index], x, y); +} + +void +vmwareMoveCursor(ScreenPtr pScr, + int x, + int y) +{ + VMWAREPtr pVMWARE; + + TRACEPOINT + + pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + + pVMWARE->Mouse.Box.x1 = x - pVMWARE->Mouse.XHot; + if (pVMWARE->Mouse.Box.x1 < 0) pVMWARE->Mouse.Box.x1 = 0; + pVMWARE->Mouse.Box.y1 = y - pVMWARE->Mouse.YHot; + if (pVMWARE->Mouse.Box.y1 < 0) pVMWARE->Mouse.Box.y1 = 0; + + pVMWARE->Mouse.Box.x2 = pVMWARE->Mouse.Box.x1 + pVMWARE->Mouse.Width; + pVMWARE->Mouse.Box.y2 = pVMWARE->Mouse.Box.y1 + pVMWARE->Mouse.Height; + + if (pVMWARE->cursorDefined && !pVMWARE->mouseHidden) { + if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_X, x); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_Y, y); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, 1); + } else { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_MOVE_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, x); + vmwareWriteWordToFIFO(pVMWARE, y); + UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); + } + } +} + +void +vmwareRecolorCursor(ScreenPtr pScr, + CursorPtr pCurs, + Bool displayed) +{ + xColorItem sourceColor; + xColorItem maskColor; + VMwareCursPriv *cursPriv = pCurs->bits->devPriv[pScr->myNum]; + uint32 *b1, *b2; + int i; + VMWAREPtr pVMWARE; + + TRACEPOINT + + if (!displayed) + return; + + pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + + sourceColor.red = pCurs->foreRed; + sourceColor.green = pCurs->foreGreen; + sourceColor.blue = pCurs->foreBlue; + + maskColor.red = pCurs->backRed; + maskColor.green = pCurs->backGreen; + maskColor.blue = pCurs->backBlue; + + if (pScr->rootDepth > 8) + { + sourceColor.pixel = (sourceColor.red >> (16 - pVMWARE->weight.red)) << pVMWARE->offset.red | + (sourceColor.green >> (16 - pVMWARE->weight.green)) << pVMWARE->offset.green | + (sourceColor.blue >> (16 - pVMWARE->weight.blue)) << pVMWARE->offset.blue; + maskColor.pixel = (maskColor.red >> (16 - pVMWARE->weight.red)) << pVMWARE->offset.red | + (maskColor.green >> (16 - pVMWARE->weight.green)) << pVMWARE->offset.green | + (maskColor.blue >> (16 - pVMWARE->weight.blue)) << pVMWARE->offset.blue; + } + else + { + ColormapPtr pmap; + + pmap = miInstalledMaps[pScr->myNum]; + + FakeAllocColor(pmap, &sourceColor); + FakeAllocColor(pmap, &maskColor); + + FakeFreeColor(pmap, sourceColor.pixel); + FakeFreeColor(pmap, maskColor.pixel); + + maskColor.red = maskColor.red >> 8; + maskColor.green = maskColor.green >> 8; + maskColor.blue = maskColor.blue >> 8; + + sourceColor.red = sourceColor.red >> 8; + sourceColor.green = sourceColor.green >> 8; + sourceColor.blue = sourceColor.blue >> 8; + } + + /* Calculate XOR mask */ + Raster_BitsToPixels(cursPriv->bSource, PixmapBytePad(pCurs->bits->width, 1), + cursPriv->pSource, + 4 * SVGA_PIXMAP_SCANLINE_SIZE(pCurs->bits->width, pVMWARE->bitsPerPixel), + pVMWARE->bitsPerPixel / 8, + pCurs->bits->width, pCurs->bits->height, sourceColor.pixel, maskColor.pixel); + b1 = (uint32 *) cursPriv->pSource; + b2 = (uint32 *) cursPriv->pMask; + for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { + *b1++ &= ~*b2++; + } + + /* Define cursor */ + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DEFINE_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->xhot); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->yhot); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->width); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->height); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel); + b1 = (uint32 *) cursPriv->pSource; + b2 = (uint32 *) cursPriv->pMask; + for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { + vmwareWriteWordToFIFO(pVMWARE, *b2++); + } + for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { + vmwareWriteWordToFIFO(pVMWARE, *b1++); + /* vmwareWriteWordToFIFO(~0); */ + } + pVMWARE->checkCursorColor = FALSE; + + /* Sync the FIFO, so that the definition preceeds any use of the cursor */ + UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); + vmwareWaitForFB(pVMWARE); + pVMWARE->cursorDefined = TRUE; +} + +void +vmwareRenewCursorColor(ScreenPtr pScr) +{ + TRACEPOINT + + if (vmwareSaveCursors[pScr->myNum]) + vmwareRecolorCursor(pScr, vmwareSaveCursors[pScr->myNum], TRUE); +} + +void +vmwareBlockHandler(i, blockData, pTimeout, pReadmask) + int i; + pointer blockData; + pointer pTimeout; + pointer pReadmask; +{ + VMWAREPtr pVMWARE; + + TRACEPOINT + + pVMWARE = VMWAREPTR(xf86Screens[i]); + if (pVMWARE->checkCursorColor) + vmwareRenewCursorColor(screenInfo.screens[i]); +} + +void +vmwareQueryBestSize(class, pwidth, pheight, pScr) + int class; + unsigned short *pwidth; + unsigned short *pheight; + ScreenPtr pScr; +{ + TRACEPOINT + + if (*pwidth > 0) { + + switch (class) { + + case CursorShape: + if (*pwidth > 64) + *pwidth = 64; + if (*pheight > 64) + *pheight = 64; + break; + default: + mfbQueryBestSize(class, pwidth, pheight, pScr); + break; + } + } +} + +void +vmwareCursorOff(VMWAREPtr pVMWARE) +{ + TRACEPOINT + + if (pVMWARE->cursorDefined) { + if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, 0); + } else { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); + vmwareWriteWordToFIFO(pVMWARE, 0); + UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); + } + } +} + +void +vmwareClearSavedCursor(int scr_index) +{ + TRACEPOINT + + vmwareSaveCursors[scr_index] = NULL; +} + + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c new file mode 100644 index 000000000..0e1e8fc15 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c @@ -0,0 +1,62 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarefillarc[] = + + "Id: vmwarefillarc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBarc(DrawablePtr pDrawable, + GCPtr pGC, int narcs, xArc * parcs, BoxPtr pBB) +{ + if (narcs <= 0) + return; + pBB->x1 = parcs->x; + pBB->y1 = parcs->y; + pBB->x2 = parcs->x + parcs->width; + pBB->y2 = parcs->y + parcs->height; + while (--narcs) { + parcs++; + if (parcs->x < pBB->x1) + pBB->x1 = parcs->x; + if (parcs->y < pBB->y1) + pBB->y1 = parcs->y; + if ((parcs->x + parcs->width) > pBB->x2) + pBB->x2 = parcs->x + parcs->width; + if ((parcs->y + parcs->height) > pBB->y2) + pBB->y2 = parcs->y + parcs->height; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBarc(pDrawable, pGC, narcs, parcs, &BB), + GC_OPS(pGC)->PolyFillArc(pDrawable, pGC, narcs, parcs)); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c new file mode 100644 index 000000000..3bb70e3c4 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c @@ -0,0 +1,63 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarefs[] = + + "Id: vmwarefs.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static __inline void +vmwareDrawableToBox(BoxPtr BB, const DrawablePtr pDrawable) +{ + BB->x2 = (BB->x1 = pDrawable->x) + pDrawable->width; + BB->y2 = (BB->y1 = pDrawable->y) + pDrawable->height; +} + +void +vmwareFillSpans(DrawablePtr pDrawable, + GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pDrawable->pScreen, + vmwareDrawableToBox(&BB, pDrawable), + GC_OPS(pGC)->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)); +} + +void +vmwareSetSpans(DrawablePtr pDrawable, + GCPtr pGC, + char *pcharsrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pDrawable->pScreen, + vmwareDrawableToBox(&BB, pDrawable), + GC_OPS(pGC)->SetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)); +} + +void +vmwareGetSpans(DrawablePtr pDrawable, + int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst) +{ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pDrawable->pScreen)); + + TRACEPOINT + + VM_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + (BB.x1 = 0, BB.y1 = 0, + BB.x2 = pDrawable->pScreen->width, + BB.y2 = pDrawable->pScreen->height), + pVMWARE->ScrnFuncs.GetSpans(pDrawable, wMax, pPoints, pWidths, nSpans, pDst)); +} + + + + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c new file mode 100644 index 000000000..cad0109e6 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c @@ -0,0 +1,132 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwaregc[] = + + "Id: vmwaregc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "X.h" +#include "cfb.h" +#include "cfb16.h" +#include "cfb24.h" +#include "cfb32.h" +#include "mi.h" +#include "migc.h" +#include "vmware.h" + +GCFuncs vmwareGCFuncs = { + vmwareValidateGC, + vmwareChangeGC, + vmwareCopyGC, + vmwareDestroyGC, + vmwareChangeClip, + vmwareDestroyClip, + vmwareCopyClip +}; + +GCOps vmwareGCOps = { + vmwareFillSpans, + vmwareSetSpans, + vmwarePutImage, + vmwareCopyArea, + vmwareCopyPlane, + vmwarePolyPoint, + vmwarePolylines, + vmwarePolySegment, + vmwarePolyRectangle, + vmwarePolyArc, + vmwareFillPolygon, + vmwarePolyFillRect, + vmwarePolyFillArc, + vmwarePolyText8, + vmwarePolyText16, + vmwareImageText8, + vmwareImageText16, + vmwareImageGlyphBlt, + vmwarePolyGlyphBlt, + vmwarePushPixels, +#ifdef NEED_LINEHELPER + , NULL +#endif +}; + +unsigned long Pmsk; + +Bool +vmwareCreateGC(GCPtr pGC) +{ + Bool ret; + + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + ret = VMWAREPTR(infoFromScreen(pGC->pScreen))->ScrnFuncs.CreateGC(pGC); + GC_FUNC_EPILOGUE(pGC); + return ret; +} + +void +vmwareValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ValidateGC(pGC, changes, pDrawable); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareChangeGC(GCPtr pGC, unsigned long changes) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ChangeGC(pGC, changes); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGCDst); + pGCDst->funcs->CopyGC(pGCSrc, mask, pGCDst); + GC_FUNC_EPILOGUE(pGCDst); +} + +void +vmwareDestroyGC(GCPtr pGC) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->DestroyGC(pGC); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ChangeClip(pGC, type, pValue, nrects); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareDestroyClip(GCPtr pGC) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->DestroyClip(pGC); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareCopyClip(GCPtr pGCDst, GCPtr pGCSrc) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGCDst); + pGCDst->funcs->CopyClip(pGCDst, pGCSrc); + GC_FUNC_EPILOGUE(pGCDst); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c new file mode 100644 index 000000000..1579d3bfc --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c @@ -0,0 +1,47 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareglblt[] = + + "Id: vmwareglblt.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static __inline void +vmwareDrawableToBox(BoxPtr BB, const DrawablePtr pDrawable) +{ + BB->x2 = (BB->x1 = pDrawable->x) + pDrawable->width; + BB->y2 = (BB->y1 = pDrawable->y) + pDrawable->height; +} + +void +vmwareImageGlyphBlt(DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareDrawableToBox(&BB, pDrawable), + GC_OPS(pGC)->ImageGlyphBlt(pDrawable, pGC, x, y, + nglyph, ppci, pglyphBase)); +} + +void +vmwarePolyGlyphBlt(DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareDrawableToBox(&BB, pDrawable), + GC_OPS(pGC)->PolyGlyphBlt(pDrawable, pGC, x, y, + nglyph, ppci, pglyphBase)); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c new file mode 100644 index 000000000..d1dece31b --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c @@ -0,0 +1,59 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareimage[] = + + "Id: vmwareimage.c,v 1.3 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +/* + * vmwarePutImage does not optimize ops because a downstream call is made + * to CopyArea. + */ + +static __inline void +vmwareImageToBox(BoxPtr BB, DrawablePtr pDrawable, int x, int y, int w, int h) +{ + BB->x2 = (BB->x1 = pDrawable->x + x) + w; + BB->y2 = (BB->y1 = pDrawable->y + y) + h; +} + +void +vmwarePutImage(DrawablePtr pDrawable, + GCPtr pGC, + int depth, + int x, int y, int w, int h, int leftPad, int format, char *pImage) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareImageToBox(&BB, pDrawable, x, y, w, h), + GC_OPS(pGC)->PutImage(pDrawable, pGC, depth, x, y, + w, h, leftPad, format, pImage)); +} + +void +vmwareGetImage(DrawablePtr pDrawable, + int x, + int y, + int w, + int h, unsigned int format, unsigned long planeMask, char *pBinImage) +{ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pDrawable->pScreen)); + + TRACEPOINT + + VM_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + vmwareImageToBox(&BB, pDrawable, x, y, w, h), + pVMWARE->ScrnFuncs.GetImage(pDrawable, x, y, w, h, format, planeMask, pBinImage)); +} + + + + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c new file mode 100644 index 000000000..a09b5a12b --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c @@ -0,0 +1,141 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareline[] = + + "Id: vmwareline.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBpoints(DrawablePtr pDrawable, + GCPtr pGC, int mode, int npt, DDXPointPtr pptInit, BoxPtr pBB) +{ + int x, y; + + if (npt <= 0) + return; + x = pptInit->x; + y = pptInit->y; + pBB->x1 = x; + pBB->y1 = y; + pBB->x2 = x + 1; + pBB->y2 = y + 1; + while (--npt) { + pptInit++; + if (mode == CoordModeOrigin) { + x = pptInit->x; + y = pptInit->y; + } else { + x += pptInit->x; + y += pptInit->y; + } + if (x < pBB->x1) + pBB->x1 = x; + if (y < pBB->y1) + pBB->y1 = y; + if (x + 1 > pBB->x2) + pBB->x2 = x + 1; + if (y + 1 > pBB->y2) + pBB->y2 = y + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolylines(DrawablePtr pDrawable, + GCPtr pGC, int mode, int npt, DDXPointPtr pPts) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBpoints(pDrawable, pGC, mode, npt, pPts, &BB), + GC_OPS(pGC)->Polylines(pDrawable, pGC, mode, npt, pPts)); +} + +static void +computeBBsegments(DrawablePtr pDrawable, + GCPtr pGC, int nseg, xSegment * pSegs, BoxPtr pBB) +{ + if (nseg <= 0) + return; + pBB->x1 = pSegs->x1; + pBB->y1 = pSegs->y1; + pBB->x2 = pSegs->x1 + 1; + pBB->y2 = pSegs->y1 + 1; + if (pSegs->x2 < pBB->x1) + pBB->x1 = pSegs->x2; + if (pSegs->y2 < pBB->y1) + pBB->y1 = pSegs->y2; + if (pSegs->x2 + 1 > pBB->x2) + pBB->x2 = pSegs->x2 + 1; + if (pSegs->y2 + 1 > pBB->y2) + pBB->y2 = pSegs->y2 + 1; + while (--nseg) { + pSegs++; + if (pSegs->x1 < pBB->x1) + pBB->x1 = pSegs->x1; + if (pSegs->y1 < pBB->y1) + pBB->y1 = pSegs->y1; + if (pSegs->x1 + 1 > pBB->x2) + pBB->x2 = pSegs->x1 + 1; + if (pSegs->y1 + 1 > pBB->y2) + pBB->y2 = pSegs->y1 + 1; + if (pSegs->x2 < pBB->x1) + pBB->x1 = pSegs->x2; + if (pSegs->y2 < pBB->y1) + pBB->y1 = pSegs->y2; + if (pSegs->x2 + 1 > pBB->x2) + pBB->x2 = pSegs->x2 + 1; + if (pSegs->y2 + 1 > pBB->y2) + pBB->y2 = pSegs->y2 + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolySegment(DrawablePtr pDrawable, + GCPtr pGC, int nseg, xSegment * pSegs) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBsegments(pDrawable, pGC, nseg, pSegs, &BB), + GC_OPS(pGC)->PolySegment(pDrawable, pGC, nseg, pSegs)); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c new file mode 100644 index 000000000..7f9d6d308 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c @@ -0,0 +1,80 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareply1rct[] = + + "Id: vmwareply1rct.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBpoly(DrawablePtr pDrawable, + GCPtr pGC, int mode, int count, DDXPointPtr pptInit, BoxPtr pBB) +{ + int x, y; + + if (count <= 0) + return; + x = pptInit->x; + y = pptInit->y; + pBB->x1 = x; + pBB->y1 = y; + pBB->x2 = x + 1; + pBB->y2 = y + 1; + while (--count) { + pptInit++; + if (mode == CoordModeOrigin) { + x = pptInit->x; + y = pptInit->y; + } else { + x += pptInit->x; + y += pptInit->y; + } + if (x < pBB->x1) + pBB->x1 = x; + if (y < pBB->y1) + pBB->y1 = y; + if (x + 1 > pBB->x2) + pBB->x2 = x + 1; + if (y + 1 > pBB->y2) + pBB->y2 = y + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwareFillPolygon(DrawablePtr pDrawable, + GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBpoly(pDrawable, pGC, mode, count, pPts, &BB), + GC_OPS(pGC)->FillPolygon(pDrawable, pGC, shape, mode, + count, pPts)); +} + + + + + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c new file mode 100644 index 000000000..fb17997e1 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c @@ -0,0 +1,74 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarepolypnt[] = + + "Id: vmwarepolypnt.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBpoints(DrawablePtr pDrawable, + GCPtr pGC, int mode, int npt, DDXPointPtr pptInit, BoxPtr pBB) +{ + int x, y; + + if (npt <= 0) + return; + x = pptInit->x; + y = pptInit->y; + pBB->x1 = x; + pBB->y1 = y; + pBB->x2 = x + 1; + pBB->y2 = y + 1; + while (--npt) { + pptInit++; + if (mode == CoordModeOrigin) { + x = pptInit->x; + y = pptInit->y; + } else { + x += pptInit->x; + y += pptInit->y; + } + if (x < pBB->x1) + pBB->x1 = x; + if (y < pBB->y1) + pBB->y1 = y; + if (x + 1 > pBB->x2) + pBB->x2 = x + 1; + if (y + 1 > pBB->y2) + pBB->y2 = y + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + xPoint * pptInit) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBpoints(pDrawable, pGC, mode, npt, pptInit, &BB), + GC_OPS(pGC)->PolyPoint(pDrawable, pGC, mode, npt, pptInit)); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c new file mode 100644 index 000000000..8fd371f8e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c @@ -0,0 +1,43 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarepush[] = + + "Id: vmwarepush.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static __inline void +vmwarePushToBox(BoxPtr BB, const GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) +{ + BB->x1 = + MAX(pDrawable->x + xOrg, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + yOrg, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + xOrg + dx, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + yOrg + dy, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePushPixels(GCPtr pGC, + PixmapPtr pBitmap, + DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwarePushToBox(&BB, pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg), + GC_OPS(pGC)->PushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c new file mode 100644 index 000000000..00a9517e7 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c @@ -0,0 +1,274 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarerect[] = + + "Id: vmwarerect.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "X.h" +#include "cfb.h" +#include "vmware.h" + +static void +computeBBrect(DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit, BoxPtr pBB) +{ + if (nrectFill <= 0) + return; + pBB->x1 = prectInit->x; + pBB->y1 = prectInit->y; + pBB->x2 = prectInit->x + prectInit->width + 1; + pBB->y2 = prectInit->y + prectInit->height + 1; + while (--nrectFill) { + prectInit++; + if (prectInit->x < pBB->x1) + pBB->x1 = prectInit->x; + if (prectInit->y < pBB->y1) + pBB->y1 = prectInit->y; + if ((prectInit->x + prectInit->width + 1) > pBB->x2) + pBB->x2 = prectInit->x + prectInit->width + 1; + if ((prectInit->y + prectInit->height + 1) > pBB->y2) + pBB->y2 = prectInit->y + prectInit->height + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyRectangle(DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBrect(pDrawable, pGC, nrectFill, prectInit, &BB), + GC_OPS(pGC)->PolyRectangle(pDrawable, pGC, nrectFill, prectInit)); +} + +static void +accelFillRectSolid(VMWAREPtr pVMWARE, DrawablePtr pDrawable, GCPtr pGC, int nBox, BoxPtr pBox) +{ + while (nBox) { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_FILL); + vmwareWriteWordToFIFO(pVMWARE, pGC->fgPixel); + vmwareWriteWordToFIFO(pVMWARE, pBox->x1); + vmwareWriteWordToFIFO(pVMWARE, pBox->y1); + vmwareWriteWordToFIFO(pVMWARE, pBox->x2 - pBox->x1); + vmwareWriteWordToFIFO(pVMWARE, pBox->y2 - pBox->y1); + vmwareWriteWordToFIFO(pVMWARE, pGC->alu); + pBox++; + nBox--; + } +} + +#define NUM_STACK_RECTS 1024 + +static void +accelPolyFillRect(VMWAREPtr pVMWARE, DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit) +{ + xRectangle *prect; + RegionPtr prgnClip; + BoxPtr pbox; + BoxPtr pboxClipped; + BoxPtr pboxClippedBase; + BoxPtr pextent; + BoxRec stackRects[NUM_STACK_RECTS]; + cfbPrivGC *priv; + int numRects; + int n; + int xorg, yorg; + + priv = cfbGetGCPrivate(pGC); + prgnClip = cfbGetCompositeClip(pGC); + + prect = prectInit; + xorg = pDrawable->x; + yorg = pDrawable->y; + if (xorg || yorg) { + prect = prectInit; + n = nrectFill; + while (n--) { + prect->x += xorg; + prect->y += yorg; + prect++; + } + } + + prect = prectInit; + + numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; + if (numRects > NUM_STACK_RECTS) { + pboxClippedBase = (BoxPtr) ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); + if (!pboxClippedBase) + return; + } else + pboxClippedBase = stackRects; + + pboxClipped = pboxClippedBase; + + if (REGION_NUM_RECTS(prgnClip) == 1) { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_RECTS(prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) { + if ((pboxClipped->x1 = prect->x) < x1) + pboxClipped->x1 = x1; + + if ((pboxClipped->y1 = prect->y) < y1) + pboxClipped->y1 = y1; + + bx2 = (int)prect->x + (int)prect->width; + if (bx2 > x2) + bx2 = x2; + pboxClipped->x2 = bx2; + + by2 = (int)prect->y + (int)prect->height; + if (by2 > y2) + by2 = y2; + pboxClipped->y2 = by2; + + prect++; + if ((pboxClipped->x1 < pboxClipped->x2) && + (pboxClipped->y1 < pboxClipped->y2)) { + pboxClipped++; + } + } + } else { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) { + BoxRec box; + + if ((box.x1 = prect->x) < x1) + box.x1 = x1; + + if ((box.y1 = prect->y) < y1) + box.y1 = y1; + + bx2 = (int)prect->x + (int)prect->width; + if (bx2 > x2) + bx2 = x2; + box.x2 = bx2; + + by2 = (int)prect->y + (int)prect->height; + if (by2 > y2) + by2 = y2; + box.y2 = by2; + + prect++; + + if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) + continue; + + n = REGION_NUM_RECTS(prgnClip); + pbox = REGION_RECTS(prgnClip); + + /* clip the rectangle to each box in the clip region + * this is logically equivalent to calling Intersect() + */ + while (n--) { + pboxClipped->x1 = max(box.x1, pbox->x1); + pboxClipped->y1 = max(box.y1, pbox->y1); + pboxClipped->x2 = min(box.x2, pbox->x2); + pboxClipped->y2 = min(box.y2, pbox->y2); + pbox++; + + /* see if clipping left anything */ + if (pboxClipped->x1 < pboxClipped->x2 && + pboxClipped->y1 < pboxClipped->y2) { + pboxClipped++; + } + } + } + } + if (pboxClipped != pboxClippedBase) + accelFillRectSolid(pVMWARE, pDrawable, pGC, + pboxClipped - pboxClippedBase, pboxClippedBase); + if (pboxClippedBase != stackRects) + DEALLOCATE_LOCAL(pboxClippedBase); +} + +static void +computeBBfillrect(DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit, BoxPtr pBB) +{ + if (nrectFill <= 0) + return; + pBB->x1 = prectInit->x; + pBB->y1 = prectInit->y; + pBB->x2 = prectInit->x + prectInit->width; + pBB->y2 = prectInit->y + prectInit->height; + while (--nrectFill) { + prectInit++; + if (prectInit->x < pBB->x1) + pBB->x1 = prectInit->x; + if (prectInit->y < pBB->y1) + pBB->y1 = prectInit->y; + if ((prectInit->x + prectInit->width) > pBB->x2) + pBB->x2 = prectInit->x + prectInit->width; + if ((prectInit->y + prectInit->height) > pBB->y2) + pBB->y2 = prectInit->y + prectInit->height; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyFillRect(DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit) +{ + TRACEPOINT + + GC_FUNC_ACCEL_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBfillrect(pDrawable, pGC, nrectFill, prectInit, &BB), + (pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) && + (pGC->alu == GXcopy || (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP)) && + pGC->fillStyle == FillSolid && ((pGC->planemask & pVMWARE->Pmsk) == pVMWARE->Pmsk), + accelPolyFillRect(pVMWARE, pDrawable, pGC, nrectFill, prectInit), + GC_OPS(pGC)->PolyFillRect(pDrawable, pGC, nrectFill, prectInit)); +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c new file mode 100644 index 000000000..ed91bd63a --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c @@ -0,0 +1,180 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwaretext[] = + + "Id: vmwaretext.c,v 1.3 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" +#include "dixfontstr.h" + +static void +vmwareTextExtent(FontPtr pFont, int count, char* chars, FontEncoding fontEncoding, BoxPtr box) +{ + unsigned long n, i; + int w; + CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ + + GetGlyphs(pFont, (unsigned long)count, (unsigned char *)chars, + fontEncoding, &n, charinfo); + w = 0; + for (i=0; i < n; i++) { + w += charinfo[i]->metrics.characterWidth; + } + if (i) { + w += charinfo[i - 1]->metrics.rightSideBearing; + } + + box->x1 = 0; + if (n) { + if (charinfo[0]->metrics.leftSideBearing < 0) { + box->x1 = charinfo[0]->metrics.leftSideBearing; + } + } + box->x2 = w; + box->y1 = -FONTMAXBOUNDS(pFont,ascent); + box->y2 = FONTMAXBOUNDS(pFont,descent); +} + +static __inline void +vmwareFontToBox(BoxPtr BB, DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, char *chars, + int wide) +{ + FontPtr pFont; + + pFont = pGC->font; + if (pFont->info.constantWidth) { + int ascent, descent, left, right = 0; + + ascent = + MAX(pFont->info.fontAscent, pFont->info.maxbounds.ascent); + descent = + MAX(pFont->info.fontDescent, + pFont->info.maxbounds.descent); + left = pFont->info.maxbounds.leftSideBearing; + if (count > 0) { + right = + (count - 1) * pFont->info.maxbounds.characterWidth; + } + right += pFont->info.maxbounds.rightSideBearing; + BB->x1 = + MAX(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + y - ascent, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + x + right, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + y + descent, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); + } else { + vmwareTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit, BB); + BB->x1 = + MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + y + BB->y1, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + x + BB->x2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + y + BB->y2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); + } +} + +static __inline void +vmwareImageFontToBox(BoxPtr BB, DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, char *chars, + int wide) +{ + FontPtr pFont; + + pFont = pGC->font; + vmwareTextExtent(pFont, count, chars, + wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit, + BB); + BB->x1 = + MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + y + BB->y1, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + x + BB->x2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + y + BB->y2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); +} + +int +vmwarePolyText8(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, char *chars) +{ + int n; + + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareFontToBox(&BB, pDrawable, pGC, x, y, count, chars, 0), + n = GC_OPS(pGC)->PolyText8(pDrawable, pGC, x, y, count, chars)); + return n; +} + +int +vmwarePolyText16(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, unsigned short *chars) +{ + int n; + + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareFontToBox(&BB, pDrawable, pGC, x, y, count, (char*)chars, 1), + n = GC_OPS(pGC)->PolyText16(pDrawable, pGC, x, y, count, chars)); + return n; +} + +void +vmwareImageText8(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, char *chars) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareImageFontToBox(&BB, pDrawable, pGC, x, y, count, chars, 0), + GC_OPS(pGC)->ImageText8(pDrawable, pGC, x, y, count, chars)); +} + +void +vmwareImageText16(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, unsigned short *chars) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareImageFontToBox(&BB, pDrawable, pGC, x, y, count, (char*)chars, 1), + GC_OPS(pGC)->ImageText16(pDrawable, pGC, x, y, count, chars)); +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c new file mode 100644 index 000000000..45bc3d75d --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c @@ -0,0 +1,145 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarewindow[] = + + "Id: vmwarewindow.c,v 1.4 2001/01/27 00:28:15 bennett Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +void +vmwareCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + DDXPointPtr pptSrc; + register DDXPointPtr ppt; + RegionRec rgnDst; + BoxPtr pbox; + int dx, dy; + int i, nbox; + WindowPtr pwinRoot; + BoxPtr pBB; + + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + + TRACEPOINT + if (!(pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY)) { + pVMWARE->ScrnFuncs.CopyWindow(pWin, ptOldOrg, prgnSrc); + return; + } + pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; + REGION_INIT(pWin->drawable.pScreen, &rgnDst, NullBox, 0); + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, + prgnSrc); + pbox = REGION_RECTS(&rgnDst); + nbox = REGION_NUM_RECTS(&rgnDst); + if (!nbox || + !(pptSrc = + (DDXPointPtr) ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { + REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); + return; + } + ppt = pptSrc; + for (i = nbox; --i >= 0; ppt++, pbox++) { + ppt->x = pbox->x1 + dx; + ppt->y = pbox->y1 + dy; + } + pBB = REGION_EXTENTS(pWin->drawable.pScreen, &rgnDst); + HIDE_CURSOR_ACCEL(pVMWARE, *pBB); + vmwareDoBitblt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot, + GXcopy, &rgnDst, pptSrc, ~0L, 0); + SHOW_CURSOR(pVMWARE, *pBB); + UPDATE_ACCEL_AREA(pVMWARE, *pBB); + DEALLOCATE_LOCAL(pptSrc); + REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); +} + +static void +accelPaintWindow(VMWAREPtr pVMWARE, WindowPtr pWin, RegionPtr pRegion, int what, BoxPtr pBB) +{ + Pixel pixel; + RegionRec drawRegion; + RegionRec BBRegion; + BoxPtr pbox; + int nbox; + + if (what == PW_BACKGROUND && pWin->backgroundState == BackgroundPixel) { + pixel = pWin->background.pixel; + } else if (what == PW_BORDER && pWin->borderIsPixel) { + pixel = pWin->border.pixel; + } else { + /* + * The caller has guaranteed that this case has been excluded, + * but the compiler doesn't know that. So this line is just to + * eliminate the compiler warning. + */ + pixel = 0; + } + + REGION_INIT(pWin->drawable.pScreen, &drawRegion, NullBox, 0); + REGION_INIT(pWin->drawable.pScreen, &BBRegion, pBB, 1); + REGION_INTERSECT(pWin->drawable.pScreen, &drawRegion, pRegion, &BBRegion); + pbox = REGION_RECTS(&drawRegion); + nbox = REGION_NUM_RECTS(&drawRegion); + while (nbox) { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_FILL); + vmwareWriteWordToFIFO(pVMWARE, pixel); + vmwareWriteWordToFIFO(pVMWARE, pbox->x1); + vmwareWriteWordToFIFO(pVMWARE, pbox->y1); + vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1); + vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1); + pbox++; + nbox--; + } + REGION_UNINIT(pWin->drawable.pScreen, &BBRegion); + REGION_UNINIT(pWin->drawable.pScreen, &drawRegion); +} + +void +vmwarePaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) +{ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + + TRACEPOINT + /* Accelerate solid fills */ + if ((pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) && + ((what == PW_BACKGROUND && pWin->backgroundState == BackgroundPixel) + || (what == PW_BORDER && pWin->borderIsPixel))) { + BoxPtr pBB; + Bool hidden = pVMWARE->mouseHidden; + + pBB = REGION_EXTENTS(pWin->drawable.pScreen, pRegion); + if (!hidden) { + HIDE_CURSOR(pVMWARE, *pBB); + } + accelPaintWindow(pVMWARE, pWin, pRegion, what, pBB); + if (!hidden) { + SHOW_CURSOR(pVMWARE, *pBB); + } + UPDATE_ACCEL_AREA(pVMWARE, *pBB); + /* vmwareWaitForFB(); */ /* XXX */ + return; + } + if (pVMWARE->vmwareBBLevel == 0) { + BoxPtr pBB; + + pBB = REGION_EXTENTS(pWin->drawable.pScreen, pRegion); + HIDE_CURSOR(pVMWARE, *pBB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + pVMWARE->ScrnFuncs.PaintWindowBackground(pWin, pRegion, what); + pVMWARE->vmwareBBLevel--; + vmwareSendSVGACmdUpdate(pVMWARE, pBB); + SHOW_CURSOR(pVMWARE, *pBB); + } else { + VmwareLog(("vmwarePaintWindow not called at top level\n")); + vmwareWaitForFB(pVMWARE); + pVMWARE->ScrnFuncs.PaintWindowBackground(pWin, pRegion, what); + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c new file mode 100644 index 000000000..fb50612ad --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c @@ -0,0 +1,62 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarezerarc[] = + + "Id: vmwarezerarc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBarc(DrawablePtr pDrawable, + GCPtr pGC, int narcs, xArc * parcs, BoxPtr pBB) +{ + if (narcs <= 0) + return; + pBB->x1 = parcs->x; + pBB->y1 = parcs->y; + pBB->x2 = parcs->x + parcs->width + 1; + pBB->y2 = parcs->y + parcs->height + 1; + while (--narcs) { + parcs++; + if (parcs->x < pBB->x1) + pBB->x1 = parcs->x; + if (parcs->y < pBB->y1) + pBB->y1 = parcs->y; + if ((parcs->x + parcs->width + 1) > pBB->x2) + pBB->x2 = parcs->x + parcs->width + 1; + if ((parcs->y + parcs->height + 1) > pBB->y2) + pBB->y2 = parcs->y + parcs->height + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBarc(pDrawable, pGC, narcs, parcs, &BB), + GC_OPS(pGC)->PolyArc(pDrawable, pGC, narcs, parcs)); +} diff --git a/xc/programs/Xserver/hw/xfree86/etc/Imakefile b/xc/programs/Xserver/hw/xfree86/etc/Imakefile index 944a1096d..842334b2d 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.37 2000/07/30 17:12:21 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.38 2001/03/21 17:36:47 dawes Exp $ #include <Server.tmpl> #if SystemV @@ -43,7 +43,7 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.37 2000/07/30 1 # endif #endif -#if !BuildServersOnly +#if !BuildServersOnly && BuildClients #ifdef SunArchitecture TERMFILES = xterm.termcap xterm.terminfo #else @@ -128,7 +128,7 @@ InstallNamedProg(svr4_patch,svr4_patch,$(LIBDIR)/etc) InstallNamedProg(svr4_rem_pch,svr4_patch_rem,$(LIBDIR)/etc) #endif -#if !BuildServersOnly +#if !BuildServersOnly && BuildClients LinkFile(xterm.termcap,$(PROGRAMSRC)/xterm/termcap) LinkFile(xterm.terminfo,$(PROGRAMSRC)/xterm/terminfo) #endif diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def index b5c6671f8..371566bc9 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def @@ -1,7 +1,7 @@ /* * Host.def for building Linux/alpha bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def,v 1.5 2000/12/18 14:34:58 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def,v 1.6 2001/03/17 18:41:32 dawes Exp $ */ #define InstallEmptyHostDef @@ -14,3 +14,5 @@ #define BuildXF86DRI YES +#define ForceNormalLib YES + diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def index 4059b1755..6cb9eb81c 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def @@ -1,7 +1,7 @@ /* * Host.def for building Linux/ix86 bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def,v 1.6 2000/03/17 15:59:46 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def,v 1.7 2001/03/17 18:41:32 dawes Exp $ */ #define InstallEmptyHostDef @@ -16,3 +16,5 @@ #define BuildXF86DRI YES +#define ForceNormalLib YES + diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def index d4553c823..2c8e5a311 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def @@ -1,8 +1,10 @@ /* * Host.def for building Linux/m68k bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def,v 1.4 2000/03/07 14:47:34 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def,v 1.5 2001/03/17 18:41:33 dawes Exp $ */ #define InstallEmptyHostDef +#define ForceNormalLib YES + diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def index 4e3d78ad3..03b7f5fa2 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def @@ -1,8 +1,10 @@ /* * Host.def for building Linux/ppc bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def,v 1.3 2000/03/07 14:47:36 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def,v 1.4 2001/03/17 18:41:33 dawes Exp $ */ #define InstallEmptyHostDef +#define ForceNormalLib YES + diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def index fdeeb09ae..c89665d4b 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def @@ -1,8 +1,10 @@ /* * Host.def for building SVR4.0 bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.3 2000/03/07 14:47:37 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.4 2001/03/17 18:41:33 dawes Exp $ */ #define InstallEmptyHostDef +#define ForceNormalLib YES + diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def index 2392ea639..4fba95ca7 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def @@ -1,8 +1,10 @@ /* * Host.def for building Solaris bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.3 2000/03/07 14:47:38 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.4 2001/03/17 18:41:33 dawes Exp $ */ #define InstallEmptyHostDef +#define ForceNormalLib YES + diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def index 647056fc1..9bf96d029 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def @@ -1,8 +1,10 @@ /* * Host.def for building UnixWare bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.3 2000/03/07 14:47:39 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.4 2001/03/17 18:41:33 dawes Exp $ */ #define InstallEmptyHostDef +#define ForceNormalLib YES + diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c index 34cc1ab50..37f1a1d61 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.22 2001/01/21 21:19:37 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.24 2001/04/06 18:16:31 dawes Exp $ */ /* all driver need this */ #include "xf86.h" @@ -527,7 +527,7 @@ fbdevHWUseBuildinMode(ScrnInfoPtr pScrn) void calculateFbmem_len(fbdevHWPtr fPtr) { - fPtr->fboff = (unsigned int) fPtr->fix.smem_start & ~PAGE_MASK; + fPtr->fboff = (unsigned long) fPtr->fix.smem_start & ~PAGE_MASK; fPtr->fbmem_len = (fPtr->fboff+fPtr->fix.smem_len+~PAGE_MASK) & PAGE_MASK; } @@ -596,7 +596,7 @@ fbdevHWMapMMIO(ScrnInfoPtr pScrn) perror("FBIOPUT_VSCREENINFO"); return FALSE; } - mmio_off = (unsigned int) fPtr->fix.mmio_start & ~PAGE_MASK; + mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK; fPtr->mmio_len = (mmio_off+fPtr->fix.mmio_len+~PAGE_MASK) & PAGE_MASK; if (NULL == fPtr->fbmem) @@ -812,3 +812,21 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)fbmode)) perror("ioctl FBIOBLANK"); } + +Bool +fbdevHWSaveScreen(ScreenPtr pScreen, int mode) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); + unsigned long unblank; + + if (!pScrn->vtSema) + return; + + unblank = xf86IsUnblank(mode); + + if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)(1-unblank))) + return FALSE; + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h index 151b64ae7..d2acfcd4c 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.9 2000/11/18 19:37:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.10 2001/04/06 18:16:31 dawes Exp $ */ #ifndef _FBDEVHW_H_ #define _FBDEVHW_H_ @@ -47,4 +47,6 @@ Bool fbdevHWEnterVT(int scrnIndex, int flags); void fbdevHWLeaveVT(int scrnIndex, int flags); void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); +Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode); + #endif diff --git a/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c b/xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c index 8fdeb1b47..cf0be9823 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.9 2000/10/20 14:59:01 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.10 2001/04/06 18:16:31 dawes Exp $ */ #include "xf86.h" #include "xf86cmap.h" @@ -161,3 +161,8 @@ void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) { } + +Bool +fbdevHWSaveScreen(ScreenPtr pScreen, int mode) +{ +} diff --git a/xc/programs/Xserver/hw/xfree86/input/citron/citron.c b/xc/programs/Xserver/hw/xfree86/input/citron/citron.c index 5fb55c3e4..9d12f26b6 100644 --- a/xc/programs/Xserver/hw/xfree86/input/citron/citron.c +++ b/xc/programs/Xserver/hw/xfree86/input/citron/citron.c @@ -1,4 +1,4 @@ -/* +/* Id: citron.c,v 1.8 2001/03/28 08:24:38 pk Exp $ * Copyright (c) 1998 Metro Link Incorporated * * Permission is hereby granted, free of charge, to any person obtaining a @@ -25,13 +25,13 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.5 2000/11/21 23:10:37 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.6 2001/04/05 17:42:34 dawes Exp $ */ /* * Based, in part, on code with the following copyright notice: * - * Copyright 1999-2000 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de> - * Copyright 1999-2000 by Peter Kunzmann, Citron GmbH, Germany. <support@citron.de> + * Copyright 1999-2001 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de> + * Copyright 1999-2001 by Peter Kunzmann, Citron GmbH, Germany. <kunzmann@citron.de> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -95,6 +95,21 @@ "cit_ParseCommand" to set the variables not only on the touch side but also in the priv rec pk 2.04 19.10.00 reconnect enhanced pk + 2.05 27.02.01 QueryHardware enhanced, connection faster pk + 2.06 15.03.01 cit_SetBlockDuration added, cit_Flush modified pk + 2.07 16.03.01 The problem that the touch didn't connect to the + X-server was a hardware problem + with the winbond chip (interrupt was dead after + receiving spurious characters when the touch screen + is switched on). The SIO has to be reinitialized to + get rid of that problem. pk + 2.08 20.03.01 if cit_GetPacket has an overrun + cit_ReinitSerial has to be called, Vmin set to "1" + cit_SuperVisionTimer, cit_SetEnterCount added + debuglevel, entercount(z) from external now poss. + enter_touched not reset by coord_exit pk + 2.09 25.03.01 enter_touched also reset by press_exit, a new + command (SetPWMFreq) for backlight dimming added pk ============================================================================ */ @@ -104,30 +119,31 @@ #define PK 0 #define INITT 0 /* Initialisation of touch in first loop */ -/* ODD version number enables the debug macros */ -/* EVEN version number is for release */ -#define CITOUCH_VERSION 0x204 -char version[]="Touch Driver V2.04 (c) 1999-2000 Citron GmbH"; +#define CITOUCH_VERSION 0x209 +char version[]="Touch Driver V2.09 (c) 1999-2001 Citron GmbH"; + +#define CITOUCH_VERSION_MAJOR ((CITOUCH_VERSION >> 8) & 0xf) +#define CITOUCH_VERSION_MINOR ((CITOUCH_VERSION >> 4) & 0xf) +#define CITOUCH_VERSION_PATCH ((CITOUCH_VERSION >> 0) & 0xf) /***************************************************************************** * Standard Headers ****************************************************************************/ -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #define NEED_XF86_TYPES -/*#include <xf86Version.h>*/ -#include <xf86_ansic.h> -#include <xf86_OSproc.h> -#include <xf86Optrec.h> -#include <xf86Xinput.h> -#include <xisb.h> -#include <exevents.h> /* Needed for InitValuator/Proximity stuff*/ +#include "xf86_ansic.h" +#include "xf86_OSproc.h" +#include "xf86Optrec.h" +#include "xf86Xinput.h" +#include "xisb.h" +#include "exevents.h" /* Needed for InitValuator/Proximity stuff*/ -/* #define CI_TIM */ /* Enable timer */ +/* #define CIT_TIM */ /* Enable timer */ #define CIT_BEEP /* enable beep feature */ /***************************************************************************** @@ -162,9 +178,13 @@ char version[]="Touch Driver V2.04 (c) 1999-2000 Citron GmbH"; #endif static int debug_level = 0; -#if CITOUCH_VERSION & 0x0001 + +/* + debug is always on, because we can set the debug-level + in XF86Config (Option DebugLevel) +*/ #define DEBUG -#endif + #ifdef DEBUG #define DBG(lvl, f) {if ((lvl) <= debug_level) f;} #else @@ -237,10 +257,10 @@ static XF86ModuleVersionInfo VersionRec = MODULEVENDORSTRING, /* vendor specific string */ MODINFOSTRING1, MODINFOSTRING2, - XF86_VERSION_CURRENT, /* Module-specific current version */ - 0, /* Module-specific major version */ - 1, /* Module-specific minor version */ - 1, /* Module-specific patch level */ + XF86_VERSION_CURRENT, /* Current XFree version */ + CITOUCH_VERSION_MAJOR, /* Module-specific major version */ + CITOUCH_VERSION_MINOR, /* Module-specific minor version */ + CITOUCH_VERSION_PATCH, /* Module-specific patch level */ ABI_CLASS_XINPUT, ABI_XINPUT_VERSION, MOD_CLASS_XINPUT, @@ -297,7 +317,45 @@ static const char *default_options[] = "StopBits", "1", "DataBits", "8", "Parity", "None", - "Vmin", "3", +/* + In non-canonical input processing mode, input is not assembled into + lines and input processing (erase, kill, delete, etc.) does not occur. + Two parameters control the behavior of this mode: c_cc[VTIME] sets the + character timer, and c_cc[VMIN] sets the minimum number of characters + to receive before satisfying the read. + + If MIN > 0 and TIME = 0, MIN sets the number of characters to receive + before the read is satisfied. As TIME is zero, the timer is not used. + + If MIN = 0 and TIME > 0, TIME serves as a timeout value. The read will + be satisfied if a single character is read, or TIME is exceeded (t = + TIME *0.1 s). If TIME is exceeded, no character will be returned. + + + If MIN > 0 and TIME > 0, TIME serves as an inter-character timer. The + read will be satisfied if MIN characters are received, or the time + between two characters exceeds TIME. The timer is restarted every time + a character is received and only becomes active after the first + character has been received. + + If MIN = 0 and TIME = 0, read will be satisfied immediately. The + number of characters currently available, or the number of characters + requested will be returned. According to Antonino (see contributions), + you could issue a fcntl(fd, F_SETFL, FNDELAY); before reading to get + the same result. + + By modifying newtio.c_cc[VTIME] and newtio.c_cc[VMIN] all modes + described above can be tested. + (Copied from serial-programming-howto) +*/ + + +/* Vmin was set to 3 (Three characters have to arrive until Read_Input is called). + I set it to 1 because of the winbond SIO (maybe the interrupt disappears after 1 character + and X waits for another two. +*/ + + "Vmin", "1", /* blocking read until 1 chars received */ "Vtime", "1", "FlowControl", "None", "ClearDTR", "" @@ -325,7 +383,7 @@ cit_SendtoTouch(DeviceIntPtr dev) unsigned char buf[MAX_BYTES_TO_TRANSFER*2+2]; DBG(DDS, ErrorF("%scit_SendtoTouch(numbytes=0x%02X, data[0]=%02x, data[1]=%02x, data[2]=%02x, data[3]=%02x, ...)\n", CI_INFO, priv->dds.numbytes, - priv->dds.data[0], priv->dds.data[1], priv->dds.data[2], priv->dds.data[3],)); + priv->dds.data[0], priv->dds.data[1], priv->dds.data[2], priv->dds.data[3])); j=0; buf[j++] = CTS_STX; /* transmit start of packet */ @@ -377,12 +435,17 @@ cit_ParseCommand(DeviceIntPtr dev) DBG(DDS, ErrorF("%scit_ParseCommand(PWM Active:%d PWM Sleep:%d \n", CI_INFO, priv->pwm_active, priv->pwm_sleep)); break; + case C_SETPWMFREQ: + priv->pwm_freq = (int)priv->dds.data[1] | (int)(priv->dds.data[2] << 8); + DBG(DDS, ErrorF("%scit_ParseCommand: PWM Freq:%d\n", CI_INFO, priv->pwm_freq)); + break; + case C_SETSLEEPMODE: if(priv->dds.data[1] == 0) { priv->sleep_time_act = priv->dds.data[2] | (priv->dds.data[3] << 8); } - DBG(DDS, ErrorF("%scit_ParseCommand(Sleep Time act:%d \n", CI_INFO, priv->sleep_time_act)); + DBG(DDS, ErrorF("%scit_ParseCommand: Sleep Time act:%d \n", CI_INFO, priv->sleep_time_act)); break; case C_SETDOZEMODE: @@ -390,13 +453,18 @@ cit_ParseCommand(DeviceIntPtr dev) { priv->doze_time_act = priv->dds.data[2] | (priv->dds.data[3] << 8); } - DBG(DDS, ErrorF("%scit_ParseCommand(Doze Time act:%d \n", CI_INFO, priv->doze_time_act)); + DBG(DDS, ErrorF("%scit_ParseCommand: Doze Time act:%d \n", CI_INFO, priv->doze_time_act)); break; case C_SETAREAPRESSURE: priv->button_threshold = priv->dds.data[1]; - DBG(DDS, ErrorF("%scit_ParseCommand(Button Threshold:%d \n", CI_INFO, priv->button_threshold)); + DBG(DDS, ErrorF("%scit_ParseCommand: Button Threshold:%d \n", CI_INFO, priv->button_threshold)); + break; + + default: + DBG(DDS, ErrorF("%scit_ParseCommand: Command %d not found\n", CI_INFO, priv->dds.data[0])); break; + } } @@ -418,6 +486,7 @@ cit_DriverComm(DeviceIntPtr dev) case D_SETCLICKMODE: priv->click_mode = priv->dds.data[i++]; ErrorF("%sClick Mode: %d\n", CI_INFO, priv->click_mode); + cit_SetEnterCount(priv); /* set enter_count according to click_mode */ break; case D_BEEP: @@ -444,9 +513,26 @@ cit_DriverComm(DeviceIntPtr dev) ErrorF("%sBeep Release Duration: %d\n", CI_INFO, priv->rel_dur); break; - default: - ErrorF("%sNot known command: %d\n", CI_WARNING, priv->dds.data[1]); + case D_DEBUG: + debug_level = priv->dds.data[i++]; + ErrorF("%sDebug level set to %d \n", CI_INFO, debug_level); + break; + + case D_ENTERCOUNT: + priv->enter_count_no_Z = priv->dds.data[i++]; + cit_SetEnterCount(priv); /* set enter_count according click_mode */ + ErrorF("%sEnterCount set to %d \n", CI_INFO, priv->enter_count_no_Z); + break; + + case D_ZENTERCOUNT: + priv->enter_count_Z = priv->dds.data[i++]; + cit_SetEnterCount(priv); /* set enter_count according click_mode */ + ErrorF("%sZEnterCount set to %d \n", CI_INFO, priv->enter_count_Z); + break; + default: + ErrorF("%sNot known command: %d - Get a recent driver\n", CI_WARNING, priv->dds.data[1]); + break; } } @@ -563,17 +649,17 @@ static void hexdump (void *ioaddr, int len) } #endif -#ifdef CIT_TIM + /***************************************************************************** * [cit_StartTimer] ****************************************************************************/ static void -cit_StartTimer(cit_PrivatePtr priv) +cit_StartTimer(cit_PrivatePtr priv, int nr) { - priv->timer_ptr = TimerSet(priv->timer_ptr, 0, priv->timer_val1, - priv->timer_callback, (pointer)priv); - DBG(5, ErrorF ("%scit_StartTimer called PTR=%08x\n", CI_INFO, priv->timer_ptr)); + priv->timer_ptr[nr] = TimerSet(priv->timer_ptr[nr], 0, priv->timer_val1[nr], + priv->timer_callback[nr], (pointer)priv); + DBG(5, ErrorF ("%scit_StartTimer[%d] called PTR=%08x\n", CI_INFO, nr, priv->timer_ptr)); } @@ -581,20 +667,43 @@ cit_StartTimer(cit_PrivatePtr priv) * [cit_CloseTimer] ****************************************************************************/ static void -cit_CloseTimer(cit_PrivatePtr priv) +cit_CloseTimer(cit_PrivatePtr priv, int nr) { - DBG(5, ErrorF ("%scit_CloseTimer called PTR=%08x\n", CI_INFO, priv->timer_ptr)); - if(priv->timer_ptr) + DBG(5, ErrorF ("%scit_CloseTimer[%d] called PTR=%08x\n", CI_INFO, nr, priv->timer_ptr)); + if(priv->timer_ptr[nr]) { - TimerFree(priv->timer_ptr); - priv->timer_ptr = NULL; + TimerFree(priv->timer_ptr[nr]); + priv->timer_ptr[nr] = NULL; } else - DBG(5, ErrorF ("%scit_CloseTimer: Nothing to close\n", CI_WARNING)); + DBG(5, ErrorF ("%scit_CloseTimer[%d]: Nothing to close\n", CI_WARNING, nr)); +} + + + +/***************************************************************************** + * [cit_SuperVisionTimer] If called reset Serial device + ****************************************************************************/ +static CARD32 +cit_SuperVisionTimer(OsTimerPtr timer, CARD32 now, pointer arg) +{ + cit_PrivatePtr priv = (cit_PrivatePtr) arg; + int sigstate; + + DBG(5, ErrorF ("%scit_SuperVisionTimer called %d\n", CI_INFO, GetTimeInMillis())); + + sigstate = xf86BlockSIGIO (); + + cit_ReinitSerial(priv); + + xf86UnblockSIGIO (sigstate); + + return (0); /* stop timer */ } +#ifdef CIT_TIM /***************************************************************************** * [cit_DualTouchTimer] @@ -648,6 +757,8 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags) goto SetupProc_fail; } + priv->local = local; /* save local device pointer */ + /* this results in an xf86strdup that must be freed later */ local->name = xf86SetStrOption(local->options, "DeviceName", "CiTouch"); @@ -762,10 +873,16 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags) ErrorF("%sBeam Timeout: %d\n", CI_CONFIG, priv->beam_timeout); priv->touch_time = xf86SetIntOption(local->options, "TouchTime", 0) & 0xff; ErrorF("%sTouch Time: %d\n", CI_CONFIG, priv->touch_time); - priv->enter_count = xf86SetIntOption(local->options, "EnterCount", 3); - ErrorF("%sEnter Count: %d\n", CI_CONFIG, priv->enter_count); priv->max_dual_count = xf86SetIntOption(local->options, "DualCount", MAX_DUAL_TOUCH_COUNT); ErrorF("%sDual Count: %d\n", CI_CONFIG, priv->max_dual_count); + priv->enter_count_no_Z = xf86SetIntOption(priv->local->options, "EnterCount", 3); + ErrorF("%sEnterCount: %d\n", CI_CONFIG, priv->enter_count_no_Z); + priv->enter_count_Z = xf86SetIntOption(priv->local->options, "ZEnterCount", 2); + ErrorF("%sZEnterCount: %d\n", CI_CONFIG, priv->enter_count_Z); + priv->pwm_freq = xf86SetIntOption(priv->local->options, "PWMFreq", -1); + ErrorF("%sPWMFreq: %d\n", CI_CONFIG, priv->pwm_freq); + + cit_SetEnterCount(priv); /* set enter_count according click_mode */ /* trace the min and max values */ priv->raw_min_x = CIT_DEF_MAX_X; @@ -775,15 +892,18 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags) #ifdef CIT_TIM /* preset timer values */ - priv->timer_ptr = NULL; - priv->timer_val1 = 0; - priv->timer_val2 = 0; - priv->timer_callback = NULL; + priv->timer_ptr[FAKE_TIMER] = NULL; + priv->timer_val1[FAKE_TIMER] = 0; + priv->timer_val2[FAKE_TIMER] = 0; + priv->timer_callback[FAKE_TIMER] = NULL; #endif + priv->timer_ptr[SV_TIMER] = NULL; + priv->timer_val1[SV_TIMER] = 0; + priv->timer_val2[SV_TIMER] = 0; + priv->timer_callback[SV_TIMER] = NULL; priv->fake_exit = FALSE; priv->enter_touched = 0; /* preset */ - priv->local = local; /* save local device pointer */ DBG(6, ErrorF("%s\t+ options read\n", CI_INFO)); s = xf86FindOptionValue (local->options, "ReportingMode"); @@ -845,6 +965,8 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags) priv->buffer = NULL; } xf86CloseSerial(local->fd); + local->fd = 0; + #endif } @@ -860,7 +982,10 @@ CitronPreInit (InputDriverPtr drv, IDevPtr dev, int flags) SetupProc_fail: #if(INITT) if ((local) && (local->fd)) + { xf86CloseSerial (local->fd); + local->fd = 0; + } #endif if ((local) && (local->name)) xfree (local->name); @@ -910,6 +1035,7 @@ DeviceControl (DeviceIntPtr dev, int mode) ErrorF ("%sDeviceControl Mode (%d) not found\n", CI_ERROR, mode); RetVal = BadValue; } + DBG(2, ErrorF ("%sDeviceControl: RetVal = %d\n", CI_INFO, RetVal)); return(RetVal); } @@ -928,7 +1054,7 @@ DeviceOn (DeviceIntPtr dev) local->fd = xf86OpenSerial(local->options); if (local->fd == -1) { - xf86Msg(X_WARNING, "%s%s: cannot open input device\n", CI_ERROR, local->name); + DBG(5, ErrorF("%s%s: cannot open input device\n", CI_ERROR, local->name)); goto DeviceOn_fail; } priv->buffer = XisbNew (local->fd, CIT_BUFFER_SIZE); @@ -937,22 +1063,29 @@ DeviceOn (DeviceIntPtr dev) xf86FlushInput(local->fd); + cit_SendCommand(priv->buffer, C_SOFTRESET, 0); /* Make a Reset in case of a connected touch */ + if (QueryHardware (local, &errmaj, &errmin) != Success) { - ErrorF ("%s\t- Unable to query/initialize Citron hardware.\n", CI_ERROR); + ErrorF ("%s\t- DeviceOn: Unable to query/initialize hardware.\n", CI_ERROR); goto DeviceOn_fail; } - AddEnabledDevice (local->fd); + AddEnabledDevice(local->fd); dev->public.on = TRUE; + DBG(5, ErrorF ("%sDeviceOn Success\n", CI_INFO)); return (Success); /* * If something went wrong, cleanup */ DeviceOn_fail: + if ((local) && (local->fd)) + { xf86CloseSerial (local->fd); + local->fd = 0; + } if ((local) && (local->name)) xfree (local->name); @@ -970,9 +1103,6 @@ DeviceOn (DeviceIntPtr dev) } ErrorF ("%sDeviceOn failed\n", CI_ERROR); return (!Success); - - - } /***************************************************************************** @@ -997,14 +1127,16 @@ DeviceClose (DeviceIntPtr dev) DBG(5, ErrorF ("%sDeviceClose called\n",CI_INFO)); - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_SOFTRESET, 0); #ifdef CIT_TIM - cit_CloseTimer(priv); /* Close timer if started */ + cit_CloseTimer(priv, FAKE_TIMER); /* Close timer if started */ #endif + cit_CloseTimer(priv, SV_TIMER); /* Do not know if it is running, close anyway */ + XisbTrace(priv->buffer, 1); /* trace on */ - XisbBlockDuration (priv->buffer, 500000); + cit_SetBlockDuration (priv, 500000); c = XisbRead (priv->buffer); if(c == CTS_NAK) { @@ -1154,8 +1286,7 @@ ReadInput (LocalDevicePtr local) */ if(!priv->fake_exit) { - XisbBlockDuration (priv->buffer, -1); - DBG(RI, ErrorF("%sXisbBlockDuration = -1\n", CI_INFO)); + cit_SetBlockDuration (priv, -1); } while ( #ifdef CIT_TIM @@ -1243,7 +1374,6 @@ ReadInput (LocalDevicePtr local) xf86PostButtonEvent (local->dev, TRUE, priv->button_number, 0, 0, 2, x, y); cit_Beep(priv, 0); - priv->enter_touched = 0; /* reset coordinate report counter */ DBG(RI, ErrorF("%s\tPostButtonEvent(UP, x=%d, y=%d)\n", CI_INFO, x, y)); priv->button_down = FALSE; } @@ -1396,142 +1526,107 @@ QueryHardware (LocalDevicePtr local, int *errmaj, int *errmin) unsigned char x; int i, cnt; int err; /* for WAIT */ - int init = FALSE; + /* Reset the IRT from any mode and wait for end of warmstart */ DBG(5, ErrorF("%sQueryHardware called\n", CI_INFO)); -/* Will not work with XFree86 4.0 */ -/* xf86SerialSendBreak (local->fd, 2); */ - cit_Flush(priv->buffer); - -/* Test if touch is already initialized */ - cit_SendCommand(priv->buffer, C_GETORIGIN, 0); - - /* wait max. 0.5 seconds for acknowledge */ - DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO)); -/* WAIT(50); */ - XisbBlockDuration (priv->buffer, 500000); - cnt = 0; - err = FALSE; - - while ((i=XisbRead(priv->buffer)) != -1) - { - DBG(7, ErrorF("%s\t* 0x%02X received - cnt %d\n",CI_INFO, i, cnt)); - { - switch (cnt) - { - - case 0: - if ((unsigned char)i != CTS_STX) - init = TRUE; - break; - case 1: - if ((unsigned char)i != (CMD_REP_CONV & C_GETORIGIN)) - init = TRUE; - break; - case 2: - if ((unsigned char)i > 3) - init = TRUE; - break; +/* Will not work with XFree86 4.0.1 */ +/* xf86SerialSendBreak (local->fd, 2); */ + cit_Flush(priv); - case 3: - if ((unsigned char)i != CTS_ETX) - init = TRUE; - break; - } - } - cnt++; - if(init) - break; - } - /* Touch is physically not connected or sio problem or break */ - cit_Flush(priv->buffer); /* flush the buffer and wait for break */ - if(cnt < 3) - { - WAIT(150); - /* if we have 0 in the buffer I assume we got a break */ - if (XisbRead(priv->buffer) == 0) - { - - DBG(6, ErrorF("%s+ BREAK detected - cnt=%d\n", CI_INFO, cnt)); - init = TRUE; - } - else /* if nothing is in the buffer I assume the touch is not connected */ - { - ErrorF("%sTouch not connected - please connect - cnt=%d\n", CI_ERROR, cnt); - return(Success); /* If success is returned we can later connect */ - } /* the touch again when it was reconnected without */ - } /* restarting X */ - /* if init is true, we have to (re)initialize the touch */ - if (init) - { - ErrorF("%sTouch not initialized yet\n",CI_INFO); /* * IRT signals end of startup by sending BREAKS with 100 ms length. * wait a maximum of 2 seconds for at least 2 consecutive breaks * to be sure the IRT is really initialized */ - cit_Flush(priv->buffer); /* clear the buffer and wait for break */ - DBG(6, ErrorF("%s\t* waiting for BREAKS...\n", CI_INFO)); - for (i=0, cnt=0; (i<20) && (cnt<2); i++) + cit_Flush(priv); /* clear the buffer and wait for break */ + DBG(6, ErrorF("%s\t* waiting for BREAKS...\n", CI_INFO)); + + cit_SetBlockDuration (priv, 1); + + for (i=0, cnt=0; (i<20) && (cnt<3); i++) + { + cit_Flush(priv); /* clear the buffer and wait for break */ + WAIT(150); /* wait a little bit longer than 100 ms */ + DBG(7, ErrorF("%s\t (loop %d)\n", CI_INFO, i)); + if (XisbRead(priv->buffer) == 0) { -/* millisleep (105); */ - WAIT(120); /* wait a little bit longer than 100 ms */ - DBG(7, ErrorF("%s\t (loop %d)\n", CI_INFO, i)); - if (XisbRead(priv->buffer) == 0) - { - cnt++; - DBG(6, ErrorF("%s\t+ BREAK %d detected\n", CI_INFO, cnt)); - } - else - { - cnt = 0; - } + cnt++; + DBG(6, ErrorF("%s\t+ BREAK %d detected\n", CI_INFO, cnt)); } - if (cnt < 2) + else { - ErrorF("%sCannot reset Citron Infrared Touch!\n", CI_ERROR); -/* *errmaj = LDR_NOHARDWARE; */ - return (!Success); + cnt = 0; + } + if ( i == 12) + { + cit_SendCommand(priv->buffer, C_SOFTRESET, 0); + DBG(6, ErrorF("%s\t+ SOFTRESET sent\n", CI_INFO)); } - /* Now initialize IRT to CTS Protocol */ - DBG(6, ErrorF("%s\t* initializing to CTS mode\n", CI_INFO)); - x = 0x0d; - for (i=0; i<2; i++) +#if(0) + /* maybe we are in Debug Mode and have to sent a soft reset */ + if(i == 15) { + XisbWrite(priv->buffer, (unsigned char *)"r2", 2); + x = 0x0d; XisbWrite(priv->buffer, &x, 1); -/* millisleep (50); */ - WAIT(50); + DBG(6, ErrorF("%s\t+ DEBUG-MODE SOFTRESET sent\n", CI_INFO)); } - x = MODE_D; +#endif + } + if (cnt < 2) + { + ErrorF("%sCannot reset Citron Infrared Touch!\n", CI_ERROR); + +/* Workaround - bugfix + Normally when the touch is connected and the driver thinks it didn't sent + breaks we have the problem, that spurious characters, which are sent at + the startup of the touch screen make the winbond SIO chip not to sent + any further interrupts. To overcome this problem we reinitialize the + winbond chip with a close and open of the serial line. + Thanks a lot winbond team. Without it I wouldn't have + written these wonderful lines of source code ;-). +*/ + cit_ReinitSerial(priv); + return (!Success); + } + /* Now initialize IRT to CTS Protocol */ + DBG(6, ErrorF("%s\t* initializing to CTS mode\n", CI_INFO)); + x = 0x0d; + for (i=0; i<2; i++) + { XisbWrite(priv->buffer, &x, 1); + WAIT(50); + } + x = MODE_D; + XisbWrite(priv->buffer, &x, 1); - /* wait max. 0.5 seconds for acknowledge */ - DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO)); - XisbBlockDuration (priv->buffer, 500000); - cnt = 0; - while ((i=XisbRead(priv->buffer)) != -1) - { - DBG(7, ErrorF("%s\t* 0x%02X received - waiting for CTS_XON\n",CI_INFO, i)); - if ((unsigned char)i == CTS_XON) - break; - if(cnt++ > 100) return (Success); /* emergency stop */ - } - if ((unsigned char)i != CTS_XON) - { - ErrorF("%sNo acknowledge from Citron Infrared Touch!\n", CI_ERROR); -/* *errmaj = LDR_NOHARDWARE; */ - return (!Success); - } + /* wait max. 0.5 seconds for acknowledge */ + DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO)); + cit_SetBlockDuration (priv, 500000); + cnt = 0; + while ((i=XisbRead(priv->buffer)) != -1) + { + DBG(7, ErrorF("%s\t* 0x%02X received - waiting for CTS_XON\n",CI_INFO, i)); + if ((unsigned char)i == CTS_XON) + break; + if(cnt++ > 50) return (Success); /* emergency stop */ } + if ((unsigned char)i != CTS_XON) + { + ErrorF("%sNo acknowledge from Citron Infrared Touch!\n", CI_ERROR); + cit_ReinitSerial(priv); + return (!Success); + } + /* now we have the touch connected, do the initialization stuff */ DBG(6, ErrorF("%s\t+ Touch connected!\n",CI_INFO)); - cit_Flush(priv->buffer); + cit_Flush(priv); DBG(6, ErrorF("%s\t+ requesting pressure sensors report\n",CI_INFO)); if (cit_GetPressureSensors(priv)!=Success) @@ -1540,10 +1635,11 @@ QueryHardware (LocalDevicePtr local, int *errmaj, int *errmin) } DBG(5, ErrorF("%s ClickMode is %d\n",CI_INFO, priv->click_mode)); - if(priv->click_mode == NO_CLICK_MODE) /* no click mode set in XF86Config */ + if(priv->click_mode == NO_CLICK_MODE) /* if no click mode set in XF86Config set it automatically */ { priv->click_mode = (priv->pressure_sensors > 0) ? CM_ZPRESS : CM_ENTER; DBG(5, ErrorF("%sClickMode set to %d\n",CI_INFO, priv->click_mode)); + cit_SetEnterCount(priv); } cit_SendCommand(priv->buffer, C_SETAREAFLAGS, 1, AOF_ADDEXIT @@ -1593,6 +1689,7 @@ QueryHardware (LocalDevicePtr local, int *errmaj, int *errmin) cit_SendCommand(priv->buffer, C_SETTRANSMISSION, 1, TM_TRANSMIT); cit_SendCommand(priv->buffer, C_SETSCANNING, 1, 1); + cit_SendPWMFreq(priv); /* Set PWM Frequency */ if(priv->query_state == 0) /* do error reporting only 1 time */ { @@ -1665,7 +1762,7 @@ cit_GetPacket (cit_PrivatePtr priv) { int c; int errmaj, errmin; - + int loop = 0; DBG(GP, ErrorF("%scit_GetPacket called\n", CI_INFO)); DBG(GP, ErrorF("%s\t* initial lex_mode =%d (%s)\n", CI_INFO, priv->lex_mode, priv->lex_mode==cit_idle ?"idle": @@ -1677,7 +1774,8 @@ cit_GetPacket (cit_PrivatePtr priv) { #if(0) DBG(GP, ErrorF("%s c=%d\n",CI_INFO, c)); -#endif +#endif + loop++; if (c == CTS_STX) { DBG(GP, ErrorF("%s\t+ STX detected\n", CI_INFO)); @@ -1686,6 +1784,11 @@ cit_GetPacket (cit_PrivatePtr priv) DBG(7, ErrorF("%s\t- no ETX received before this STX!\n", CI_WARNING)); priv->lex_mode = cit_getID; DBG(GP, ErrorF("%s\t+ new lex_mode == getID\n", CI_INFO)); + /* Start supervision timer at the beginning of a command */ + priv->timer_val1[SV_TIMER] = 2000; /* Timer delay [ms] 2s */ + priv->timer_callback[SV_TIMER] = (OsTimerCallback)cit_SuperVisionTimer; /* timer callback routine */ + cit_StartTimer(priv, SV_TIMER); + } else if (c == CTS_ETX) { @@ -1697,6 +1800,7 @@ cit_GetPacket (cit_PrivatePtr priv) { DBG(GP, ErrorF("%s\t+ Good report received\n", CI_INFO)); priv->lex_mode = cit_idle; + cit_CloseTimer(priv, SV_TIMER); /* stop supervision */ return (Success); } DBG(GP, ErrorF("%s\t- unexpected ETX received!\n", CI_WARNING)); @@ -1741,45 +1845,81 @@ cit_GetPacket (cit_PrivatePtr priv) } else { - DBG(GP, ErrorF("%s\t- command buffer overrun\n", CI_ERROR)); + DBG(GP, ErrorF("%s\t- command buffer overrun, loop[%d]\n", CI_ERROR, loop)); /* let's reinitialize the touch - maybe it sends breaks */ - cit_Flush(priv->buffer); + /* The touch assembles breaks until the buffer has an overrun */ + /* 100ms x 256 -> 26 seconds */ + + priv->lex_mode = cit_idle; + cit_ReinitSerial(priv); } } else { /* this happens e.g. when the touch sends breaks, so we try to reconnect */ - DBG(GP, ErrorF("%s\t- unexpected non control received!\n", CI_WARNING)); + DBG(GP, ErrorF("%s\t- unexpected non control received! [%d, 0x%02x, loop[%d]]\n", CI_WARNING, c, c, loop)); DBG(GP, ErrorF("%s\t- Device not connected - trying to reconnect ...\n", CI_WARNING)); if (QueryHardware (priv->local, &errmaj, &errmin) != Success) ErrorF ("%s\t- Unable to query/initialize Citron Touch hardware.\n", CI_ERROR); else ErrorF ("%s\t- Citron Touch reconnected\n", CI_INFO); + return(!Success); } } else if (c != CTS_XON && c != CTS_XOFF) { - DBG(GP, ErrorF("%s\t- unhandled control character received!\n", CI_WARNING)); + DBG(GP, ErrorF("%s\t- unhandled control character received! loop[%d]\n", CI_WARNING, loop)); } - } - DBG(GP, ErrorF("%scit_GetPacket exit !Success\n", CI_INFO)); + } /* end while */ + DBG(GP, ErrorF("%scit_GetPacket exit !Success - loop[%d]\n", CI_INFO, loop)); + return (!Success); } /***************************************************************************** + * [cit_ReinitSerial] Reinitialize serial port + ****************************************************************************/ +static void +cit_ReinitSerial(cit_PrivatePtr priv) +{ + if(priv->local->fd) + { + xf86CloseSerial(priv->local->fd); + priv->local->fd = 0; + priv->local->fd = xf86OpenSerial (priv->local->options); + DBG(6, ErrorF("%s\t* cit_ReinitSerial: Serial connection reinitialized\n", CI_INFO)); + } + else + DBG(6, ErrorF("%s\t* cit_ReinitSerial: Serial connection not opened\n", CI_ERROR)); +} + +/***************************************************************************** * [cit_Flush] ****************************************************************************/ static void -cit_Flush (XISBuffer *b) +cit_Flush (cit_PrivatePtr priv) { + int old_block_duration; + DBG(7, ErrorF("%scit_Flush called\n", CI_INFO)); - XisbBlockDuration(b, 0); - while (XisbRead(b) > 0); + old_block_duration = priv->buffer->block_duration; + XisbBlockDuration(priv->buffer, 1000); /* wait for at least 10ms for the next character */ + while (XisbRead(priv->buffer) >= 0); + cit_SetBlockDuration(priv, old_block_duration); /* Restore the last set block duration (cit_SetBlockDuration) */ } +/***************************************************************************** + * [cit_SetBlockDuration] + ****************************************************************************/ +static void +cit_SetBlockDuration (cit_PrivatePtr priv, int block_duration) +{ + DBG(7, ErrorF("%scit_SetBlockDuration called [%d]\n", CI_INFO, block_duration)); + XisbBlockDuration(priv->buffer, block_duration); +} /***************************************************************************** @@ -1852,7 +1992,7 @@ static Bool cit_GetInitialErrors(cit_PrivatePtr priv) int i; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETERRORS, 1, GE_INITIAL); /* touch responds within 1 millisecond, @@ -1860,7 +2000,7 @@ static Bool cit_GetInitialErrors(cit_PrivatePtr priv) */ for (i=0; i<5; i++) { - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); res = cit_GetPacket(priv); if ((res == Success) || (priv->lex_mode == cit_idle)); break; @@ -1979,7 +2119,7 @@ static Bool cit_GetDefectiveBeams(cit_PrivatePtr priv) int i; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETERRORS, 1, GE_DEFECTBEAMS); /* touch responds within 1 millisecond, @@ -1987,7 +2127,7 @@ static Bool cit_GetDefectiveBeams(cit_PrivatePtr priv) */ for (i=0; i<5; i++) { - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); res = cit_GetPacket(priv); if ((res == Success) || (priv->lex_mode == cit_idle)); break; @@ -2060,7 +2200,7 @@ static Bool cit_GetDesignator(cit_PrivatePtr priv) int i,n; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETREVISIONS, 1, GR_DESIGNATOR); /* touch responds within 1 millisecond, @@ -2068,7 +2208,7 @@ static Bool cit_GetDesignator(cit_PrivatePtr priv) */ for (i=0; i<5; i++) { - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); res = cit_GetPacket(priv); if ((res == Success) || (priv->lex_mode == cit_idle)); break; @@ -2126,13 +2266,13 @@ static Bool cit_GetRevision(cit_PrivatePtr priv, int selection) int i,n; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETREVISIONS, 1, (unsigned char)selection); /* touch responds within 1 millisecond, but it takes some time, until the command is sent and received! */ - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); while (((res = cit_GetPacket(priv)) != Success) && (priv->lex_mode != cit_idle)); if (res != Success) { @@ -2192,9 +2332,9 @@ static void cit_ProcessPacket(cit_PrivatePtr priv) priv->dual_flg = TRUE; /* Dual Touch Error occurred */ #ifdef CIT_TIM - priv->timer_val1 = 1000; /* Timer delay [ms]*/ - priv->timer_callback = (OsTimerCallback)cit_DualTouchTimer; /* timer callback routine */ - cit_StartTimer(priv); + priv->timer_val1[FAKE_TIMER] = 1000; /* Timer delay [ms]*/ + priv->timer_callback[FAKE_TIMER] = (OsTimerCallback)cit_DualTouchTimer; /* timer callback routine */ + cit_StartTimer(priv, FAKE_TIMER); #endif switch (priv->packet[0]) @@ -2234,12 +2374,13 @@ static void cit_ProcessPacket(cit_PrivatePtr priv) priv->state &= ~(CIT_TOUCHED | CIT_PRESSED); priv->dual_touch_count = 0; + priv->enter_touched = 0; /* reset coordinate report counter */ priv->raw_x = 0x0001U * priv->packet[1] + 0x0100U * priv->packet[2]; priv->raw_y = 0x0001U * priv->packet[3] + 0x0100U * priv->packet[4]; #ifdef CIT_TIM - cit_CloseTimer(priv); /* close timer if exit message was received */ + cit_CloseTimer(priv, FAKE_TIMER); /* close timer if exit message was received */ #endif DBG(PP, ErrorF("%s\t+ EXIT message (%d,%d)\n", CI_INFO, priv->raw_x, priv->raw_y)); break; @@ -2261,6 +2402,7 @@ static void cit_ProcessPacket(cit_PrivatePtr priv) priv->state |= CIT_PRESSED; else if(priv->packet[1] == PRESS_BELOW) { + priv->enter_touched = 0; /* reset coordinate report counter */ priv->state &= ~CIT_PRESSED; } else @@ -2368,7 +2510,7 @@ static Bool cit_GetPressureSensors(cit_PrivatePtr priv) int i; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETHARDWARE, 1, GH_SENSORCOUNT); /* touch responds within 1 millisecond, @@ -2376,7 +2518,7 @@ static Bool cit_GetPressureSensors(cit_PrivatePtr priv) */ for (i=0; i<5; i++) { - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); res = cit_GetPacket(priv); if ((res == Success) || (priv->lex_mode == cit_idle)); break; @@ -2413,3 +2555,45 @@ static Bool cit_GetPressureSensors(cit_PrivatePtr priv) } +/***************************************************************************** + * [cit_ZPress] tell if click mode is ZPress (True if ZPress) + ****************************************************************************/ +static int cit_ZPress(cit_PrivatePtr priv) +{ + if((priv->click_mode == CM_ZPRESS) || (priv->click_mode == CM_ZPRESSEXIT)) + return (TRUE); + else + return (FALSE); +} + + +/***************************************************************************** + * [cit_SetEnterCount] set enter_count according click_mode + ****************************************************************************/ +static void cit_SetEnterCount(cit_PrivatePtr priv) +{ + if(cit_ZPress(priv)) /* Test if 3D Mode is active and set Options according */ + priv->enter_count = priv->enter_count_Z; + else priv->enter_count = priv->enter_count_no_Z; + ErrorF("%scit_SetEnterCount: Count=%d\n", CI_CONFIG, priv->enter_count); +} + + +/***************************************************************************** + * [cit_SendPWMFreq] send pwm frequency of PWM signal to the touch + ****************************************************************************/ +static void cit_SendPWMFreq(cit_PrivatePtr priv) +{ + if(priv->pwm_freq >= 0) /* -1 is switched off (no SetPWMFreq set in XF86Config */ + { + cit_SendCommand(priv->buffer, C_SETPWMFREQ, 2, + LOBYTE(priv->pwm_freq), + HIBYTE(priv->pwm_freq)); + DBG(3,ErrorF("%scit_SendPWMFreq: Freq=%d\n", CI_CONFIG, priv->pwm_freq)); + } + else + DBG(3,ErrorF("%scit_SendPWMFreq: Frequency not set\n", CI_CONFIG)); +} + + + diff --git a/xc/programs/Xserver/hw/xfree86/input/citron/citron.h b/xc/programs/Xserver/hw/xfree86/input/citron/citron.h index b43d45ce6..f89d08102 100644 --- a/xc/programs/Xserver/hw/xfree86/input/citron/citron.h +++ b/xc/programs/Xserver/hw/xfree86/input/citron/citron.h @@ -1,4 +1,4 @@ -/* +/* Id: citron.h,v 1.3 2001/03/28 08:24:38 pk Exp $ * Copyright (c) 1998 Metro Link Incorporated * * Permission is hereby granted, free of charge, to any person obtaining a @@ -25,12 +25,12 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.h,v 1.1 2000/11/02 02:51:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.h,v 1.2 2001/04/05 17:42:34 dawes Exp $ */ /* * Based, in part, on code with the following copyright notice: * - * Copyright 1999-2000 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de> + * Copyright 1999-2001 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -247,7 +247,9 @@ #define D_SETCLICKMODE 0x00 #define D_BEEP 0x01 #define D_SETBEEP 0x02 - +#define D_DEBUG 0x03 +#define D_ENTERCOUNT 0x04 +#define D_ZENTERCOUNT 0x05 /* Message identifiers */ #define R_DUALTOUCHERROR 0x18 /* Invalid multiple touches are detected */ @@ -337,6 +339,8 @@ #define C_SETSLEEPMODE 0xf7 #define C_GETDOZEMODE 0xf8 #define C_SETDOZEMODE 0xf9 +#define C_SETPWMFREQ 0xfa +#define C_GETPWMFREQ 0xfb /* touch states */ #define CIT_TOUCHED 0x01 @@ -434,6 +438,7 @@ typedef struct _cit_privateRec int sleep_time_scan; /* time interval between two scans */ int pwm_sleep; /* PWM duty cycle during touch saver mode */ int pwm_active; /* PWM duty cycle during regular operation */ + int pwm_freq; /* PWM base frequency */ int state; /* additional parameters */ int last_x; /* last cooked data */ @@ -456,6 +461,8 @@ typedef struct _cit_privateRec int touch_time; /* minimum time span for a valid interruption */ int enter_touched; /* button is down due to an enter event */ int enter_count; /* number of jumed coord reports before a ButtonPress event is sent */ + int enter_count_no_Z; /* number of jumped over coords before ButtonPress event in not pressure sensitive mode */ + int enter_count_Z; /* number of jumped over coords before ButtonPress event in pressure sensitive mode */ int max_dual_count; /* number of jumed dualtouch error reports before a ButtonPress event is sent */ int dual_flg; /* Flag set if dualtouch error report is received , reset by counter */ int raw_min_x; /* min x,y max x,y value accumulated over the whole session */ @@ -464,12 +471,17 @@ typedef struct _cit_privateRec int raw_min_y; int raw_max_y; int pressure_sensors; /* number of pressure sensors */ - OsTimerPtr timer_ptr; /* Timer for general purposes */ - CARD32 timer_val1; /* Timer 1st delay */ - CARD32 timer_val2; /* Timer second delay */ - OsTimerCallback timer_callback; /* timer callback routine */ + +#define MAX_TIMER 2 /* Max. concurrent timers */ +#define FAKE_TIMER 0 /* Timer for faked exit message */ +#define SV_TIMER 1 /* Supervision timer for command timeout suopervision */ + OsTimerPtr timer_ptr[MAX_TIMER]; /* Timer for general purposes */ + CARD32 timer_val1[MAX_TIMER]; /* Timer 1st delay */ + CARD32 timer_val2[MAX_TIMER]; /* Timer second delay */ + OsTimerCallback timer_callback[MAX_TIMER]; /* timer callback routine */ int fake_exit; /* tell the ReadInput function there is a exit message (from timer) */ /* end additional parameters */ + LocalDevicePtr local; /* Pointer to local device */ Bool button_down; /* is the "button" currently down */ Bool proximity; @@ -499,7 +511,7 @@ static int SwitchMode (ClientPtr, DeviceIntPtr, int); static Bool ConvertProc (LocalDevicePtr, int, int, int, int, int, int, int, int, int *, int *); static Bool QueryHardware (LocalDevicePtr, int *, int *); static Bool cit_GetPacket (cit_PrivatePtr); -static void cit_Flush(XISBuffer *); +static void cit_Flush(cit_PrivatePtr); static void cit_SendCommand(XISBuffer *, unsigned char, int, ...); static Bool cit_GetInitialErrors(cit_PrivatePtr); static Bool cit_GetDefectiveBeams(cit_PrivatePtr); @@ -508,9 +520,16 @@ static Bool cit_GetPressureSensors(cit_PrivatePtr); static Bool cit_GetRevision(cit_PrivatePtr, int); static void cit_ProcessPacket(cit_PrivatePtr); static void cit_Beep(cit_PrivatePtr priv, int press); +static void cit_SetBlockDuration (cit_PrivatePtr priv, int block_duration); +static void cit_ReinitSerial(cit_PrivatePtr priv); +static int cit_ZPress(cit_PrivatePtr priv); +static void cit_SetEnterCount(cit_PrivatePtr priv); +static void cit_SendPWMFreq(cit_PrivatePtr priv); + #ifdef CIT_TIM -static void cit_StartTimer(cit_PrivatePtr priv); -static void cit_CloseTimer(cit_PrivatePtr priv); +static void cit_StartTimer(cit_PrivatePtr priv, int nr); +static void cit_CloseTimer(cit_PrivatePtr priv, int nr); +static CARD32 cit_SuperVisionTimer(OsTimerPtr timer, CARD32 now, pointer arg); static CARD32 cit_DualTouchTimer(OsTimerPtr timer, CARD32 now, pointer arg); #endif diff --git a/xc/programs/Xserver/hw/xfree86/input/citron/citron.man b/xc/programs/Xserver/hw/xfree86/input/citron/citron.man index c35e1778b..6498a734d 100644 --- a/xc/programs/Xserver/hw/xfree86/input/citron/citron.man +++ b/xc/programs/Xserver/hw/xfree86/input/citron/citron.man @@ -1,6 +1,6 @@ -.\" Copyright (c) 2000 Peter Kunzmann <support@@citron.de> +.\" Copyright (c) 2000-2001 Peter Kunzmann <support@@citron.de> .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.man,v 1.2 2001/01/27 18:20:57 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.man,v 1.3 2001/04/05 17:42:34 dawes Exp $ .\" .\" shorthand for double quote that works everywhere. .ds q \N'34' @@ -281,6 +281,20 @@ Higher values result in longer pulse widths. .RE .TP 7 +.BI "Option \*qPWMFreq\*q \*q" value \*q +This value determines the +.I PWM +frequency in Hertz. +.RS 7 +.PP +.I Range: +"39" - "9803" +.PP +.I Default: +"9803" (max. frequency) + +.RE +.TP 7 .BI "Option \*qClickMode\*q \*q" mode \*q With mode one can select between 5 .I ClickModes @@ -610,6 +624,20 @@ every 20ms. .RE .TP 7 +.BI "Option \*qZEnterCount\*q \*q" count \*q +Number of skipped "enter reports" while in pressure +sensitive mode. Reports are sent approx. every 20ms. +.RS 7 +.PP +.I Range: +"0" - "31" +.PP +.I Default: +"1" (1 skipped messages = 20ms) + + +.RE +.TP 7 .BI "Option \*qDualCount\*q \*q" count \*q Number of skipped "dual touch error". Reports are sent approx. every 20ms. This option is only available for "ZPress" and @@ -626,4 +654,4 @@ every 20ms. This option is only available for "ZPress" and .SH "SEE ALSO" XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). .SH AUTHORS -2000 - written by Citron GmbH (support@citron.de) +2000-2001 \- written by Citron GmbH (support@citron.de) diff --git a/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c b/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c index 7f1476a6d..d223c14f8 100644 --- a/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c +++ b/xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c @@ -30,9 +30,9 @@ * 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c,v 1.3 2001/04/01 14:00:12 tsi Exp $ */ -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 1 @@ -46,25 +46,23 @@ #include <errno.h> #endif -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #define NEED_XF86_TYPES #if !defined(DGUX) -#include <xf86_ansic.h> -#include <xisb.h> +#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> +#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> +#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) @@ -135,7 +133,6 @@ static InputDriverPtr dedgeDrv; #include "xf86_Config.h" #include "xf86Xinput.h" #include "atKeynames.h" -#include "xf86Version.h" #endif #if !defined(sun) || defined(i386) @@ -1191,9 +1188,9 @@ static LocalDevicePtr xf86SumAllocate() local->history_size = 0; #if defined(sun) && !defined(i386) - if (def_name) { + if (dev_name) { priv->dedgeDevice = (char *) xalloc(strlen(dev_name) + 1); - strcpy(priv->dedgeDevice, device_name); + strcpy(priv->dedgeDevice, dev_name); ErrorF("xf86SumOpen port changed to '%s'\n", priv->dedgeDevice); } else { priv->dedgeDevice = ""; diff --git a/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c b/xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c index 4c47793c2..80bd23121 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.11 2000/08/11 19:10:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.13 2001/04/01 14:00:13 tsi Exp $ */ /* ******************************************************************************* @@ -46,7 +46,7 @@ ******************************************************************************* */ -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 #endif @@ -58,17 +58,17 @@ #include <errno.h> #endif -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #if !defined(DGUX) -#include <xf86_ansic.h> +#include "xf86_ansic.h" #endif -#include <xf86_OSproc.h> -#include <xf86Xinput.h> -#include <exevents.h> +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" #ifdef XFree86LOADER -#include <xf86Module.h> +#include "xf86Module.h" #endif #else /* XFREE86_V4 */ @@ -100,7 +100,6 @@ #include "xf86_OSlib.h" #include "xf86_Config.h" #include "xf86Xinput.h" -#include "xf86Version.h" #endif /* defined(sun) && !defined(i386) */ #if !defined(sun) || defined(i386) @@ -1196,7 +1195,7 @@ xf86EloControl(DeviceIntPtr dev, case DEVICE_INIT: { -#if defined(sun) && !defined(i386) +#if defined(sun) && !defined(i386) && !defined(XFREE86_V4) char *name = (char *) getenv("ELO_DEV"); char *calib = (char *) getenv("ELO_CALIB"); char *speed = (char *) getenv("ELO_SPEED"); @@ -1205,7 +1204,7 @@ xf86EloControl(DeviceIntPtr dev, DBG(2, ErrorF("Elographics touchscreen init...\n")); -#if defined(sun) && !defined(i386) +#if defined(sun) && !defined(i386) && !defined(XFREE86_V4) if (name) { priv->input_dev = strdup(name); ErrorF("Elographics touchscreen port changed to '%s'\n", diff --git a/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c b/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c index 0fdf42ee0..224a0e350 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.38 2000/12/18 15:52:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.41 2001/03/07 16:21:05 paulo Exp $ */ /* * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -898,7 +898,7 @@ SetupMouse(InputInfoPtr pInfo) case PROT_IMPS2: /* IntelliMouse */ { - static unsigned char s[] = { 243, 200, 243, 100, 243, 80, }; + static unsigned char s[] = { 243, 200, 243, 100, 243, 80, 242 }; param = s; paramlen = sizeof(s); @@ -907,7 +907,7 @@ SetupMouse(InputInfoPtr pInfo) case PROT_EXPPS2: /* IntelliMouse Explorer */ { - static unsigned char s[] = { 243, 200, 243, 200, 243, 80, }; + static unsigned char s[] = { 243, 200, 243, 200, 243, 80, 242 }; param = s; paramlen = sizeof(s); @@ -1406,7 +1406,7 @@ MouseReadInput(InputInfoPtr pInfo) (pBuf[0] & 0x01) << 2 | /* Left */ ((pBuf[0] & 0x08) ? 0x08 : 0);/* fourth button */ pBuf[1] |= (pBuf[0] & 0x40) ? 0x80 : 0x00; - dx = (pBuf[0] & 0x10) ? pBuf[1] : pBuf[1]; + dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1]; dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2]; break; @@ -1594,101 +1594,140 @@ MouseConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2, return TRUE; } -static CARD32 -buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - int sigstate; - - pInfo = arg; - pMse = pInfo->private; - - sigstate = xf86BlockSIGIO (); - pMse->PostEvent(pInfo, pMse->truebuttons, 0, 0, 0, 0); - xf86UnblockSIGIO (sigstate); - return 0; -} - /* - * Lets create a simple finite-state machine: + * Lets create a simple finite-state machine for 3 button emulation: + * + * We track buttons 1 and 3 (left and right). There are 11 states: + * 0 ground - initial state + * 1 delayed left - left pressed, waiting for right + * 2 delayed right - right pressed, waiting for left + * 3 pressed middle - right and left pressed, emulated middle sent + * 4 pressed left - left pressed and sent + * 5 pressed right - right pressed and sent + * 6 released left - left released after emulated middle + * 7 released right - right released after emulated middle + * 8 repressed left - left pressed after released left + * 9 repressed right - right pressed after released right + * 10 pressed both - both pressed, not emulating middle + * + * At each state, we need handlers for the following events + * 0: no buttons down + * 1: left button down + * 2: right button down + * 3: both buttons down + * 4: emulate3Timeout passed without a button change + * Note that button events are not deltas, they are the set of buttons being + * pressed now. It's possible (ie, mouse hardware does it) to go from (eg) + * left down to right down without anything in between, so all cases must be + * handled. * - * state[?][0]: action1 - * state[?][1]: action2 - * state[?][2]: next state + * a handler consists of three values: + * 0: action1 + * 1: action2 + * 2: new emulation state * - * action > 0: ButtonPress - * action = 0: nothing - * action < 0: ButtonRelease + * action > 0: ButtonPress + * action = 0: nothing + * action < 0: ButtonRelease * - * Why this stuff ??? Normally you cannot press both mousebuttons together, so - * the mouse reports both pressed at the same time ... + * The comment preceeding each section is the current emulation state. + * The comments to the right are of the form + * <button state> (<events>) -> <new emulation state> + * which should be read as + * If the buttons are in <button state>, generate <events> then go to + * <new emulation state>. */ - -static signed char stateTab[48][3] = { - -/* nothing pressed */ - { 0, 0, 0 }, - { 0, 0, 8 }, /* 1 right -> delayed right */ - { 0, 0, 0 }, /* 2 nothing */ - { 0, 0, 8 }, /* 3 right -> delayed right */ - { 0, 0, 16 }, /* 4 left -> delayed left */ - { 2, 0, 24 }, /* 5 left & right (middle press) -> middle pressed */ - { 0, 0, 16 }, /* 6 left -> delayed left */ - { 2, 0, 24 }, /* 7 left & right (middle press) -> middle pressed */ - -/* delayed right */ - { 1, -1, 0 }, /* 8 nothing (right event) -> init */ - { 1, 0, 32 }, /* 9 right (right press) -> right pressed */ - { 1, -1, 0 }, /* 10 nothing (right event) -> init */ - { 1, 0, 32 }, /* 11 right (right press) -> right pressed */ - { 1, -1, 16 }, /* 12 left (right event) -> delayed left */ - { 2, 0, 24 }, /* 13 left & right (middle press) -> middle pressed */ - { 1, -1, 16 }, /* 14 left (right event) -> delayed left */ - { 2, 0, 24 }, /* 15 left & right (middle press) -> middle pressed */ - -/* delayed left */ - { 3, -3, 0 }, /* 16 nothing (left event) -> init */ - { 3, -3, 8 }, /* 17 right (left event) -> delayed right */ - { 3, -3, 0 }, /* 18 nothing (left event) -> init */ - { 3, -3, 8 }, /* 19 right (left event) -> delayed right */ - { 3, 0, 40 }, /* 20 left (left press) -> pressed left */ - { 2, 0, 24 }, /* 21 left & right (middle press) -> pressed middle */ - { 3, 0, 40 }, /* 22 left (left press) -> pressed left */ - { 2, 0, 24 }, /* 23 left & right (middle press) -> pressed middle */ - -/* pressed middle */ - { -2, 0, 0 }, /* 24 nothing (middle release) -> init */ - { -2, 0, 0 }, /* 25 right (middle release) -> init */ - { -2, 0, 0 }, /* 26 nothing (middle release) -> init */ - { -2, 0, 0 }, /* 27 right (middle release) -> init */ - { -2, 0, 0 }, /* 28 left (middle release) -> init */ - { 0, 0, 24 }, /* 29 left & right -> pressed middle */ - { -2, 0, 0 }, /* 30 left (middle release) -> init */ - { 0, 0, 24 }, /* 31 left & right -> pressed middle */ - -/* pressed right */ - { -1, 0, 0 }, /* 32 nothing (right release) -> init */ - { 0, 0, 32 }, /* 33 right -> pressed right */ - { -1, 0, 0 }, /* 34 nothing (right release) -> init */ - { 0, 0, 32 }, /* 35 right -> pressed right */ - { -1, 0, 16 }, /* 36 left (right release) -> delayed left */ - { -1, 2, 24 }, /* 37 left & right (r rel, m prs) -> middle pressed */ - { -1, 0, 16 }, /* 38 left (right release) -> delayed left */ - { -1, 2, 24 }, /* 39 left & right (r rel, m prs) -> middle pressed */ - -/* pressed left */ - { -3, 0, 0 }, /* 40 nothing (left release) -> init */ - { -3, 0, 8 }, /* 41 right (left release) -> delayed right */ - { -3, 0, 0 }, /* 42 nothing (left release) -> init */ - { -3, 0, 8 }, /* 43 right (left release) -> delayed right */ - { 0, 0, 40 }, /* 44 left -> left pressed */ - { -3, 2, 24 }, /* 45 left & right (l rel, mprs) -> middle pressed */ - { 0, 0, 40 }, /* 46 left -> left pressed */ - { -3, 2, 24 }, /* 47 left & right (l rel, mprs) -> middle pressed */ +static signed char stateTab[11][5][3] = { +/* 0 ground */ + { + { 0, 0, 0 }, /* nothing -> ground (no change) */ + { 0, 0, 1 }, /* left -> delayed left */ + { 0, 0, 2 }, /* right -> delayed right */ + { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */ + { 0, 0, -1 } /* timeout N/A */ + }, +/* 1 delayed left */ + { + { 1, -1, 0 }, /* nothing (left event) -> ground */ + { 0, 0, 1 }, /* left -> delayed left (no change) */ + { 1, -1, 2 }, /* right (left event) -> delayed right */ + { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */ + { 1, 0, 4 }, /* timeout (left press) -> pressed left */ + }, +/* 2 delayed right */ + { + { 3, -3, 0 }, /* nothing (right event) -> ground */ + { 3, -3, 1 }, /* left (right event) -> delayed left (no change) */ + { 0, 0, 2 }, /* right -> delayed right (no change) */ + { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */ + { 3, 0, 5 }, /* timeout (right press) -> pressed right */ + }, +/* 3 pressed middle */ + { + { -2, 0, 0 }, /* nothing (middle release) -> ground */ + { 0, 0, 7 }, /* left -> released right */ + { 0, 0, 6 }, /* right -> released left */ + { 0, 0, 3 }, /* left & right -> pressed middle (no change) */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 4 pressed left */ + { + { -1, 0, 0 }, /* nothing (left release) -> ground */ + { 0, 0, 4 }, /* left -> pressed left (no change) */ + { -1, 0, 2 }, /* right (left release) -> delayed right */ + { 3, 0, 10 }, /* left & right (right press) -> pressed both */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 5 pressed right */ + { + { -3, 0, 0 }, /* nothing (right release) -> ground */ + { -3, 0, 1 }, /* left (right release) -> delayed left */ + { 0, 0, 5 }, /* right -> pressed right (no change) */ + { 1, 0, 10 }, /* left & right (left press) -> pressed both */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 6 released left */ + { + { -2, 0, 0 }, /* nothing (middle release) -> ground */ + { -2, 0, 1 }, /* left (middle release) -> delayed left */ + { 0, 0, 6 }, /* right -> released left (no change) */ + { 1, 0, 8 }, /* left & right (left press) -> repressed left */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 7 released right */ + { + { -2, 0, 0 }, /* nothing (middle release) -> ground */ + { 0, 0, 7 }, /* left -> released right (no change) */ + { -2, 0, 2 }, /* right (middle release) -> delayed right */ + { 3, 0, 9 }, /* left & right (right press) -> repressed right */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 8 repressed left */ + { + { -2, -1, 0 }, /* nothing (middle release, left release) -> ground */ + { -2, 0, 4 }, /* left (middle release) -> pressed left */ + { -1, 0, 6 }, /* right (left release) -> released left */ + { 0, 0, 8 }, /* left & right -> repressed left (no change) */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 9 repressed right */ + { + { -2, -3, 0 }, /* nothing (middle release, right release) -> ground */ + { -3, 0, 7 }, /* left (right release) -> released right */ + { -2, 0, 5 }, /* right (middle release) -> pressed right */ + { 0, 0, 9 }, /* left & right -> repressed right (no change) */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 10 pressed both */ + { + { -1, -3, 0 }, /* nothing (left release, right release) -> ground */ + { -3, 0, 4 }, /* left (right release) -> pressed left */ + { -1, 0, 5 }, /* right (left release) -> pressed right */ + { 0, 0, 10 }, /* left & right -> pressed both (no change) */ + { 0, 0, -1 }, /* timeout N/A */ + }, }; - /* * Table to allow quick reversal of natural button mapping to correct mapping */ @@ -1715,12 +1754,36 @@ static char hitachMap[16] = { 0, 2, 1, 3, #define reverseBits(map, b) (((b) & ~0x0f) | map[(b) & 0x0f]) +static CARD32 +buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg) +{ + InputInfoPtr pInfo; + MouseDevPtr pMse; + int sigstate; + int id; + + pInfo = arg; + pMse = pInfo->private; + + sigstate = xf86BlockSIGIO (); + + if ((id = stateTab[pMse->emulateState][4][0]) != 0) {ErrorF("0\n"); + xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + pMse->emulateState = stateTab[pMse->emulateState][4][2]; + } else { + ErrorF("Got unexpected buttonTimer in state %d\n", pMse->emulateState); + } + + xf86UnblockSIGIO (sigstate); + return 0; +} + static void MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) { static OsTimerPtr timer = NULL; MouseDevPtr pMse; - int truebuttons; + int truebuttons, emulateButtons; int id, change; pMse = pInfo->private; @@ -1734,69 +1797,51 @@ MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) if (dx || dy) xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy); - if (pMse->emulate3Buttons) { - /* - * Hack to operate the middle button even with Emulate3Buttons set. - * Modifying the state table to keep track of the middle button state - * would nearly double its size, so I'll stick with this fix. - TJW - */ + if (truebuttons != pMse->lastButtons) { + if (pMse->protocolID == PROT_MMHIT) change = buttons ^ reverseBits(hitachMap, pMse->lastButtons); else change = buttons ^ reverseBits(reverseMap, pMse->lastButtons); - /* - * process button 2, 4 and above - */ - change &= ~0x05; - while (change) { - id = ffs(change); - change &= ~(1 << (id - 1)); - xf86PostButtonEvent(pInfo->dev, 0, id, - (buttons & (1 << (id - 1))), 0, 0); - } + if (pMse->emulate3Buttons) { - /* - * emulate the third button by the other two - */ - buttons &= 0x07; - if ((id = stateTab[buttons + pMse->emulateState][0]) != 0) - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); - - if ((id = stateTab[buttons + pMse->emulateState][1]) != 0) - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); - - pMse->emulateState = stateTab[buttons + pMse->emulateState][2]; - if (stateTab[buttons + pMse->emulateState][0] || - stateTab[buttons + pMse->emulateState][1]) { - pMse->truebuttons = truebuttons; - timer = TimerSet(timer, 0, pMse->emulate3Timeout, buttonTimer, + /* handle all but buttons 1 & 3 normally */ + + change &= ~05; + + /* emulate the third button by the other two */ + + emulateButtons = (buttons & 01) | ((buttons &04) >> 1); + + if ((id = stateTab[pMse->emulateState][emulateButtons][0]) != 0) + xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + if ((id = stateTab[pMse->emulateState][emulateButtons][1]) != 0) + xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + + pMse->emulateState = + stateTab[pMse->emulateState][emulateButtons][2]; + + if (stateTab[pMse->emulateState][4][0] != 0) { + timer = TimerSet(timer, 0, pMse->emulate3Timeout, buttonTimer, pInfo); - } else { - if (timer) { - TimerFree(timer); - timer = NULL; - } - } - } else { - /* - * real three button event - * Note that pMse.lastButtons has the hardware button mapping which - * is the reverse of the button mapping reported to the server. - */ - if (pMse->protocolID == PROT_MMHIT) - change = buttons ^ reverseBits(hitachMap, pMse->lastButtons); - else - change = buttons ^ reverseBits(reverseMap, pMse->lastButtons); + } else { + if (timer) { + TimerFree(timer); + timer = NULL; + } + } + } + while (change) { id = ffs(change); change &= ~(1 << (id - 1)); xf86PostButtonEvent(pInfo->dev, 0, id, (buttons & (1 << (id - 1))), 0, 0); } - } - pMse->lastButtons = truebuttons; + pMse->lastButtons = truebuttons; + } } static void diff --git a/xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c b/xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c index 9f0fc9f8c..8c7b05004 100644 --- a/xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c +++ b/xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c @@ -21,7 +21,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c,v 1.12 2000/06/07 22:03:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c,v 1.13 2001/04/01 14:00:13 tsi Exp $ */ /* ******************************************************************************* @@ -42,23 +42,23 @@ ******************************************************************************* */ -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 #endif #ifdef XFREE86_V4 -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #if !defined(DGUX) -#include <xf86_ansic.h> +#include "xf86_ansic.h" #endif -#include <xf86_OSproc.h> -#include <xf86Xinput.h> -#include <exevents.h> +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" #ifdef XFree86LOADER -#include <xf86Module.h> +#include "xf86Module.h" #endif #else /* XFREE86_V4 */ @@ -82,7 +82,6 @@ #include "xf86_OSlib.h" #include "xf86_Config.h" #include "xf86Xinput.h" -#include "xf86Version.h" #include "os.h" #include "osdep.h" diff --git a/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c b/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c index c23975d73..f3de89f06 100644 --- a/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c +++ b/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c @@ -1,6 +1,10 @@ /* * Copyright 1996 by Steven Lang <tiger@tyger.org> * + * AceCad tablet support ported by Arpad Gereoffy <arpi@esp-team.scene.hu> + * originally written by Shane Watts <shane@bofh.asn.au> + * and Fredrik Chabot <fhc@f6.nl> + * * 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 @@ -20,11 +24,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.4 2000/08/11 19:10:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.8 2001/04/05 17:42:34 dawes Exp $ */ static const char identification[] = "$Identification: 18 $"; -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 1 @@ -38,25 +42,23 @@ static const char identification[] = "$Identification: 18 $"; #include <errno.h> #endif -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #define NEED_XF86_TYPES #if !defined(DGUX) -#include <xf86_ansic.h> -#include <xisb.h> +#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> +#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> +#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) @@ -123,7 +125,6 @@ static InputDriverPtr sumDrv; #include "xf86Config.h" #include "xf86Xinput.h" #include "atKeynames.h" -#include "xf86Version.h" #endif #if !defined(sun) || defined(i386) @@ -154,10 +155,14 @@ static int debug_level = 5; #endif /* -** Device records +** Device records (flag bits) */ -#define ABSOLUTE_FLAG 1 -#define STYLUS_FLAG 2 +#define ABSOLUTE_FLAG 1 /* default */ +#define STYLUS_FLAG 2 /* not default */ +#define COMPATIBLE_FLAG 4 /* not default */ +#define H1217D_FLAG 8 /* not default */ +#define Z_AXIS_FLAG 16 /* not default */ +#define INITIALIZED 32 typedef struct { @@ -166,6 +171,7 @@ typedef struct int sumButTrans; /* button translation flags */ int sumOldX; /* previous X position */ int sumOldY; /* previous Y position */ + int sumOldZ; /* previous Z position */ int sumOldProximity; /* previous proximity */ int sumOldButtons; /* previous buttons state */ int sumMaxX; /* max X value */ @@ -177,7 +183,7 @@ typedef struct int sumRes; /* resolution in lines per inch */ int flags; /* various flags */ int sumIndex; /* number of bytes read */ - unsigned char sumData[5]; /* data read on the device */ + unsigned char sumData[7]; /* data read on the device */ } SummaDeviceRec, *SummaDevicePtr; /* @@ -198,6 +204,9 @@ typedef struct #define ALWAYS_CORE 9 #define ACTIVE_AREA 10 #define ACTIVE_OFFSET 11 +#define COMPATIBLE 12 +#define RESOLUTION 13 +#define HITACHI_1217D 14 #if !defined(sun) || defined(i386) static SymTabRec SumTab[] = { @@ -213,6 +222,9 @@ static SymTabRec SumTab[] = { {ALWAYS_CORE, "alwayscore"}, {ACTIVE_AREA, "activearea"}, {ACTIVE_OFFSET, "activeoffset"}, + {COMPATIBLE, "compatible"}, + {RESOLUTION, "resolution"}, + {HITACHI_1217D, "hitachi_1217d"}, {-1, ""} }; @@ -254,7 +266,6 @@ static SymTabRec SumPointTabRec[] = { #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 */ @@ -273,6 +284,9 @@ static const char * ss_initstr = SS_TABID0 SS_UPPER_ORIGIN SS_BINARY_FMT SS_STRE #define BUTTON_BITS 0x07 #define COORD_BITS 0x7f +/* macro from counts/inch to counts/meter */ +#define LPI2CPM(res) (res * 1000 / 25.4) + /* ** External declarations */ @@ -316,7 +330,7 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) int token; int mtoken; - DBG(1, ErrorF("xf86SumConfig\n")); + DBG(2, ErrorF("xf86SumConfig\n")); while ((token = xf86GetToken(SumTab)) != ENDSUBSECTION) { switch(token) { @@ -414,6 +428,18 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) dev->history_size); break; + case HITACHI_1217D: + priv->flags |= H1217D_FLAG; + priv->sumInc = 0; + if(xf86Verbose) + ErrorF("%s Hitach_1217D, compatible enforced.\n", XCONFIG_GIVEN); + + case COMPATIBLE: + priv->flags |= COMPATIBLE_FLAG; + if(xf86Verbose) + ErrorF("%s SummaSketch compatible - will not query firmware ID\n", XCONFIG_GIVEN); + break; + case ALWAYS_CORE: xf86AlwaysCore(dev, TRUE); if (xf86Verbose) @@ -424,29 +450,38 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) case ACTIVE_AREA: if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Option number expected"); - priv->sumXSize = val->num; + priv->sumXSize = val->realnum * 100; if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Option number expected"); - priv->sumYSize = val->num; + priv->sumYSize = val->realnum * 100; if (xf86Verbose) - ErrorF("%s SummaSketch active area set to %d.%1dx%d.%1d" - " inches\n", XCONFIG_GIVEN, priv->sumXSize / 10, - priv->sumXSize % 10, priv->sumYSize / 10, - priv->sumYSize % 10); + ErrorF("%s SummaSketch active area: %d.%02dx%d.%02d" + " inches\n", XCONFIG_GIVEN, priv->sumXSize / 100, + priv->sumXSize % 100, priv->sumYSize / 100, + priv->sumYSize % 100); break; case ACTIVE_OFFSET: if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Option number expected"); - priv->sumXOffset = val->num; + priv->sumXOffset = val->realnum * 100; if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Option number expected"); - priv->sumYOffset = val->num; + priv->sumYOffset = val->realnum * 100; if (xf86Verbose) - ErrorF("%s SummaSketch active area offset set to %d.%1dx%d.%1d" - " inches\n", XCONFIG_GIVEN, priv->sumXOffset / 10, - priv->sumXOffset % 10, priv->sumYOffset / 10, - priv->sumYOffset % 10); + ErrorF("%s SummaSketch active offsets: %d.%02d %d.%02d" + " inches\n", XCONFIG_GIVEN, priv->sumXOffset / 100, + priv->sumXOffset % 100, priv->sumYOffset / 100, + priv->sumYOffset % 100); + break; + + case RESOLUTION: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->sumRes = val->num; + if (xf86Verbose) + ErrorF("%s SummaSketch resolution set to %d\n", XCONFIG_GIVEN, + priv->sumRes); break; case EOF: @@ -459,7 +494,7 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) } } - DBG(1, ErrorF("xf86SumConfig name=%s\n", priv->sumDevice)); + DBG(2, ErrorF("xf86SumConfig name=%s\n", priv->sumDevice)); return Success; } @@ -468,7 +503,7 @@ xf86SumConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) /* ** xf86SumConvert -** Convert valuators to X and Y. +** Convert device valuator values to screen X and Y. */ static Bool xf86SumConvert(LocalDevicePtr local, @@ -488,12 +523,10 @@ xf86SumConvert(LocalDevicePtr local, if (first != 0 || num == 1) return FALSE; - *x = (v0 - priv->sumXOffset) * screenInfo.screens[0]->width / priv->sumXSize; - *y = (v1 - priv->sumYOffset) * screenInfo.screens[0]->height / priv->sumYSize; - if (*x < 0) - *x = 0; - if (*y < 0) - *y = 0; + *x = (v0 * screenInfo.screens[0]->width) / priv->sumXSize; + *y = (v1 * screenInfo.screens[0]->height) / priv->sumYSize; + if (*x < 0) *x = 0; + if (*y < 0) *y = 0; if (*x > screenInfo.screens[0]->width) *x = screenInfo.screens[0]->width; if (*y > screenInfo.screens[0]->height) @@ -513,8 +546,8 @@ xf86SumReadInput(LocalDevicePtr local) { SummaDevicePtr priv = (SummaDevicePtr) local->private; int len, loop; - int is_absolute; - int x, y, buttons, prox; + int is_absolute, num_ax; + int x, y, z, buttons, prox; DeviceIntPtr device; unsigned char buffer[BUFFER_SIZE]; @@ -554,6 +587,23 @@ xf86SumReadInput(LocalDevicePtr local) Byte 5 (Absolute mode only) bit 7 Always 0 bits 6-0 = Y13 - Y7 + --------------------------------- + Flair extends this with + --------------------------------- + Byte 6 + bit 7 Always 0 + bits 6-0 = Z8-2 + + Byte 7 + bit 7-5 Always 0 + bit 4 = Z0 + bit 3-2 = Cr1-0 + Controler 00 = 4 button puck + 01 = 3 button stylus (default) + 10 = 16 button puck (how? only 4bits) + 11 = reserved + bit 1 = Button status + bit 0 = Z1 */ if ((priv->sumIndex == 0) && !(buffer[loop] & PHASING_BIT)) { /* magic bit is not OK */ @@ -563,38 +613,54 @@ xf86SumReadInput(LocalDevicePtr local) priv->sumData[priv->sumIndex++] = buffer[loop]; - if (priv->sumIndex == (priv->flags & ABSOLUTE_FLAG? 5: 3)) { + if (priv->sumIndex == ( (priv->flags & ABSOLUTE_FLAG) ? + ((priv->flags & Z_AXIS_FLAG)?7:5) : 3)) { /* the packet is OK */ /* reset char count for next read */ priv->sumIndex = 0; + prox = (priv->sumData[0] & PROXIMITY_BIT)? 0: 1; + buttons = (priv->sumData[0] & BUTTON_BITS); if (priv->flags & ABSOLUTE_FLAG) { x = (int)priv->sumData[1] + ((int)priv->sumData[2] << 7); y = (int)priv->sumData[3] + ((int)priv->sumData[4] << 7); + if(priv->flags & Z_AXIS_FLAG){ + z = ((int)priv->sumData[5] << 2) | + ((int)priv->sumData[6] & 0x01 << 1) | + ((int)priv->sumData[6] & 0x10); + buttons |= ((int)priv->sumData[6] & 0x02 << 2); + } else z = 0; } else { x = priv->sumData[0] & XSIGN_BIT? priv->sumData[1]: -priv->sumData[1]; y = priv->sumData[0] & YSIGN_BIT? priv->sumData[2]: -priv->sumData[2]; + z = 0; } - prox = (priv->sumData[0] & PROXIMITY_BIT)? 0: 1; - buttons = (priv->sumData[0] & BUTTON_BITS); + /* adj x/y by user given offsets; z untouched */ + x -= priv->sumXOffset; + y -= priv->sumYOffset; + if (x < 0) x = 0; + if (y < 0) y = 0; + if (x > priv->sumXSize) x = priv->sumXSize; + if (y > priv->sumYSize) y = priv->sumYSize; device = local->dev; - DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tbuttons=%d\n", - prox ? "true" : "false", x, y, buttons)); + DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tz=%d\tbuttons=%d\n", + prox ? "true" : "false", x, y, z, buttons)); is_absolute = (priv->flags & ABSOLUTE_FLAG); + num_ax = (priv->flags & Z_AXIS_FLAG)? 3 : 2; -/* coordonates are ready we can send events */ +/* coordinates are ready we can send events */ if (prox) { if (!(priv->sumOldProximity)) - xf86PostProximityEvent(device, 1, 0, 2, x, y); + xf86PostProximityEvent(device, 1, 0, num_ax, x, y, z); - if ((is_absolute && ((priv->sumOldX != x) || (priv->sumOldY != y))) + if ((is_absolute && ((priv->sumOldX != x) || (priv->sumOldY != y) || (priv->sumOldZ != z))) || (!is_absolute && (x || y))) { if (is_absolute || priv->sumOldProximity) { - xf86PostMotionEvent(device, is_absolute, 0, 2, x, y); + xf86PostMotionEvent(device, is_absolute, 0, num_ax, x, y, z); } } if (priv->sumOldButtons != buttons) { @@ -610,17 +676,18 @@ xf86SumReadInput(LocalDevicePtr local) delta)); xf86PostButtonEvent(device, is_absolute, button, - (delta > 0), 0, 2, x, y); + (delta > 0), 0, num_ax, x, y, z); } } priv->sumOldButtons = buttons; priv->sumOldX = x; priv->sumOldY = y; + priv->sumOldZ = z; priv->sumOldProximity = prox; } else { /* !PROXIMITY */ /* Any changes in buttons are ignored when !proximity */ if (priv->sumOldProximity) - xf86PostProximityEvent(device, 0, 0, 2, x, y); + xf86PostProximityEvent(device, 0, 0, num_ax, x, y, z); priv->sumOldProximity = 0; } } @@ -669,7 +736,7 @@ xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); #else - err = xf86WaitForInput(fd, 1000); + err = xf86WaitForInput(fd, 200000); #endif if (err == -1) { Error("SummaSketch select"); @@ -699,6 +766,47 @@ xf86SumWriteAndRead(int fd, char *data, char *buffer, int len, int cr_term) return buffer; } +/* xf86SumSetResCode + * Set Summa MM mode resolution code letter. +*/ +static void +xf86SumSetResCode (int *res, char *buffer, int index) +{ + switch (*res) { + case 1: buffer[index] = 'l'; break; + case 2: buffer[index] = 'n'; break; + case 4: buffer[index] = 'p'; break; + case 100: buffer[index] = 'd'; break; + case 200: buffer[index] = 'e'; break; + case 10: /* 10 lpmm */ + *res = 254; + case 254: + buffer[index] = 'f'; break; + case 400: + buffer[index] = 'g'; break; + case 20: /* 20 lpmm */ + *res = 508; + case 508: + buffer[index] = 'i'; break; + case 1000: + buffer[index] = 'j'; break; + case 40: /* 40 lpmm */ + *res = 1016; + case 1016: + buffer[index] = 'q'; break; + case 2000: + buffer[index] = 's'; break; + case 2032: + buffer[index] = 'u'; break; + case 2540: /* note: for 12x12 tablet only */ + buffer[index] = 'v'; break; + + default: /* default to 500 lpi */ + *res = 500; + buffer[index] = 'h'; break; + } + buffer[index+1] = 0; +} /* ** xf86SumOpen @@ -711,11 +819,13 @@ xf86SumOpen(LocalDevicePtr local) struct termios termios_tty; struct timeval timeout; #endif - char buffer[256]; + char buffer[256], dbuffer[4]; int err, idx; + int res100; + double sratio, tratio; SummaDevicePtr priv = (SummaDevicePtr)local->private; - DBG(1, ErrorF("opening %s\n", priv->sumDevice)); + DBG(2, ErrorF("opening %s\n", priv->sumDevice)); #ifdef XFREE86_V4 local->fd = xf86OpenSerial(local->options); #else @@ -738,7 +848,7 @@ xf86SumOpen(LocalDevicePtr local) termios_tty.c_cflag = B9600|CS8|CREAD|CLOCAL|HUPCL|PARENB|PARODD; termios_tty.c_lflag = 0; -/* I wonder what these all do, anyway */ + /* prevent tty term discipline processing */ termios_tty.c_cc[VINTR] = 0; termios_tty.c_cc[VQUIT] = 0; termios_tty.c_cc[VERASE] = 0; @@ -773,21 +883,20 @@ xf86SumOpen(LocalDevicePtr local) #else #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")); +#endif /* xf_v4 */ + + DBG(2, ErrorF("initializing SummaSketch tablet\n")); -/* Send reset (NULL) to the tablet */ - SYSCALL(err = write(local->fd, "", 1)); + /* send ASCII spaces in case tablet can auto-baud */ + for (idx = 0; idx < 10; idx++) buffer[idx] = ' '; + SYSCALL(err = write(local->fd, buffer, 10)); if (err == -1) { Error("SummaSketch write"); return !Success; } + buffer[0] = 0; + SYSCALL(err = write(local->fd, buffer, 1)); /* wait 200 mSecs, just in case */ #ifndef XFREE86_V4 @@ -814,63 +923,88 @@ xf86SumOpen(LocalDevicePtr local) #else xf86FlushInput(local->fd); #endif - DBG(2, ErrorF("reading firmware ID\n")); - if (!xf86SumWriteAndRead(local->fd, SS_FIRMID, buffer, 255, 1)) - return !Success; - DBG(2, ErrorF("%s\n", buffer)); + if ((priv->flags & COMPATIBLE_FLAG) == 0) { + DBG(2, ErrorF("reading firmware ID\n")); + if (!xf86SumWriteAndRead(local->fd, SS_FIRMID, buffer, 255, 1)) + return !Success; + DBG(2, ErrorF("%s\n", buffer)); + if (xf86Verbose) + ErrorF("%s %s firmware ID : %s\n", XCONFIG_PROBED, local->name, buffer); + } - if (xf86Verbose) - ErrorF("%s SummaSketch firmware ID : %s\n", XCONFIG_PROBED, buffer); + DBG(2, ErrorF("setting up resolution\n")); + xf86SumSetResCode (&priv->sumRes, dbuffer, 0); + dbuffer[1] = 'a'; /* config cmd */ + dbuffer[2] = 0; DBG(2, ErrorF("reading max coordinates\n")); - if (!xf86SumWriteAndRead(local->fd, SS_500LPI SS_CONFIG, buffer, 5, 0)) + if (!xf86SumWriteAndRead(local->fd, dbuffer, buffer, + (priv->flags&Z_AXIS_FLAG)?7:5, 0)) return !Success; - priv->sumMaxX = (int)buffer[1] + ((int)buffer[2] << 7); - priv->sumMaxY = (int)buffer[3] + ((int)buffer[4] << 7); + + priv->sumMaxX = (buffer[1] & 0x7f) | (buffer[2] << 7); + priv->sumMaxY = (buffer[3] & 0x7f) | (buffer[4] << 7); + + if (priv->flags & H1217D_FLAG) { + /* the numbers below are from Hitachi 1217D spec sheet */ + priv->sumMaxX = (432.4 / 25.4) * priv->sumRes; + priv->sumMaxY = (297.6 / 25.4) * priv->sumRes; + } if (xf86Verbose) - ErrorF("%s SummaSketch tablet size is %d.%1dinx%d.%1din, %dx%d " - "lines of resolution\n", XCONFIG_PROBED, - priv->sumMaxX / 500, (priv->sumMaxX / 50) % 10, - priv->sumMaxY / 500, (priv->sumMaxY / 50) % 10, + ErrorF("%s %s: tablet size is %d.%02din. x %d.%02din., %dx%d " + "lines of resolution\n", XCONFIG_PROBED, local->name, + priv->sumMaxX / priv->sumRes, + (priv->sumMaxX * 100 / priv->sumRes) % 100, + priv->sumMaxY / priv->sumRes, + (priv->sumMaxY * 100 / priv->sumRes) % 100, priv->sumMaxX, priv->sumMaxY); + res100 = priv->sumRes / 100; + if (priv->sumXOffset >= 0 && priv->sumYOffset >= 0) { + priv->sumXOffset *= res100; + priv->sumYOffset *= res100; + priv->sumMaxX -= priv->sumXOffset; + priv->sumMaxY -= priv->sumYOffset; + } + if (priv->sumXSize > 0 && priv->sumYSize > 0) { - if (priv->sumXSize * 50 < priv->sumMaxX && - priv->sumYSize * 50 < priv->sumMaxY) { - priv->sumXSize *= 50; - priv->sumYSize *= 50; + if ((priv->sumXSize * res100) <= priv->sumMaxX && + (priv->sumYSize * res100) <= priv->sumMaxY) { + priv->sumXSize *= res100; + priv->sumYSize *= res100; } else { - ErrorF("%s SummaSketch active area bigger than tablet, " - "assuming maximum\n", XCONFIG_PROBED); + ErrorF("%s %s: active area bigger than tablet, " + "assuming maximum\n", XCONFIG_PROBED, local->name); priv->sumXSize = priv->sumMaxX; - priv->sumYSize = priv->sumMaxX; + priv->sumYSize = priv->sumMaxY; } } else { priv->sumXSize = priv->sumMaxX; priv->sumYSize = priv->sumMaxY; } - if (priv->sumXOffset > 0 && priv->sumYOffset > 0) { - if (priv->sumXSize * 50 < priv->sumMaxX - priv->sumXOffset && - priv->sumYSize * 50 < priv->sumMaxY - priv->sumYOffset) { - priv->sumXOffset *= 50; - priv->sumYOffset *= 50; - } else { - ErrorF("%s SummaSketch offset sets active area off tablet, " - "centering\n", XCONFIG_PROBED); - priv->sumXOffset = (priv->sumMaxX - priv->sumXSize) / 2; - priv->sumYOffset = (priv->sumMaxY - priv->sumYSize) / 2; - } - } else { - priv->sumXOffset = (priv->sumMaxX - priv->sumXSize) / 2; - priv->sumYOffset = (priv->sumMaxY - priv->sumYSize) / 2; - } + /* map tablet area by screen aspect ratio */ + sratio = (double)screenInfo.screens[0]->height / + (double)screenInfo.screens[0]->width; + tratio = (double)priv->sumMaxY / (double)priv->sumMaxX; + + if (tratio <= 1.0) { /* tablet horizontal > vertical */ + priv->sumXSize = (double)priv->sumYSize / sratio; + if (priv->sumXSize > priv->sumMaxX) priv->sumXSize = priv->sumMaxX; + } + else { + priv->sumYSize = (double)priv->sumXSize / sratio; + if (priv->sumYSize > priv->sumMaxY) priv->sumYSize = priv->sumMaxY; + } + ErrorF("%s %s: using tablet area %d by %d, at res %d lpi\n", + XCONFIG_PROBED, local->name, priv->sumXSize, priv->sumYSize, + priv->sumRes); if (priv->sumInc > 95) priv->sumInc = 95; - if (priv->sumInc < 1) { + if (priv->sumInc < 0) { /* increment not given by user */ /* Make a guess as to the best increment value given video mode */ if (priv->sumXSize / screenInfo.screens[0]->width < priv->sumYSize / screenInfo.screens[0]->height) @@ -880,8 +1014,8 @@ xf86SumOpen(LocalDevicePtr local) if (priv->sumInc < 1) priv->sumInc = 1; if (xf86Verbose) - ErrorF("%s Using increment value of %d\n", XCONFIG_PROBED, - priv->sumInc); + ErrorF("%s %s: Using increment value of %d\n", XCONFIG_PROBED, + local->name, priv->sumInc); } /* Sets up the tablet mode to increment, stream, and such */ @@ -928,21 +1062,63 @@ xf86SumOpenDevice(DeviceIntPtr pSum) /* Set the real values */ InitValuatorAxisStruct(pSum, 0, - 0, /* min val */ - priv->sumMaxX, /* max val */ - 500000, /* resolution */ - 0, /* min_res */ - 500000); /* max_res */ + 0, /* min val */ + priv->sumXSize, /* max val in use */ + LPI2CPM(priv->sumRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->sumRes)); /* max_res */ InitValuatorAxisStruct(pSum, 1, - 0, /* min val */ - priv->sumMaxY, /* max val */ - 500000, /* resolution */ - 0, /* min_res */ - 500000); /* max_res */ + 0, /* min val */ + priv->sumYSize, /* max val in use */ + LPI2CPM(priv->sumRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->sumRes)); /* max_res */ + if(priv->flags&Z_AXIS_FLAG) + InitValuatorAxisStruct(pSum, + 2, + 0, /* min val */ + 512, /* max val */ + LPI2CPM(priv->sumRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->sumRes)); /* max_res */ + return (local->fd != -1); } +/* initialize start-up values */ +static void +xf86SumInitPrivate (SummaDevicePtr priv) +{ + if (priv == NULL) return; + +#if defined(sun) && !defined(i386) + if (dev_name) { + priv->sumDevice = xalloc(strlen(dev_name) + 1); + strcpy(priv->sumDevice, dev_name); + ErrorF("xf86SumOpen port changed to '%s'\n", priv->sumDevice); + } else { + priv->sumDevice = ""; + } +#else + priv->sumDevice = ""; /* device file name */ +#endif + priv->sumRes = 500; /* default 500 lpi */ + priv->sumInc = -1; /* event trigger delta moves thrshold */ + priv->sumOldX = -1; /* previous X position */ + priv->sumOldY = -1; /* previous Y position */ + priv->sumOldProximity = 0; /* previous proximity */ + priv->sumOldButtons = 0; /* previous buttons state */ + priv->sumMaxX = -1; /* max X value */ + priv->sumMaxY = -1; /* max Y value */ + priv->sumXSize = 0; /* active area X size */ + priv->sumXOffset = 0; /* active area X offset */ + priv->sumYSize = 0; /* active area Y size */ + priv->sumYOffset = 0; /* active area Y offset */ + priv->sumIndex = 0; /* number of bytes read */ + priv->flags = ABSOLUTE_FLAG; /* various flags -- default absolute */ +} + /* ** xf86SumProc ** Handle requests to do stuff to the driver. @@ -961,10 +1137,12 @@ xf86SumProc(DeviceIntPtr pSum, int what) switch (what) { case DEVICE_INIT: - DBG(1, ErrorF("xf86SumProc pSum=0x%x what=INIT\n", pSum)); + DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=INIT\n", pSum, + local->fd)); + if (priv->flags & INITIALIZED) break; /* already done */ - nbaxes = 2; /* X, Y */ - nbbuttons = (priv->flags & STYLUS_FLAG)? 2: 4; + nbaxes = (priv->flags & Z_AXIS_FLAG)?3:2; /* X, Y [,Z] */ + nbbuttons = (priv->flags & STYLUS_FLAG)? ((priv->flags & Z_AXIS_FLAG)?3:2): 4; for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop; @@ -1000,24 +1178,39 @@ xf86SumProc(DeviceIntPtr pSum, int what) ErrorF("unable to allocate Valuator class device\n"); return !Success; } -/* allocate the motion history buffer if needed */ + /* 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 */ + /* open the device to gather informations */ xf86SumOpenDevice(pSum); + priv->flags |= INITIALIZED; break; case DEVICE_ON: - DBG(1, ErrorF("xf86SumProc pSum=0x%x what=ON\n", pSum)); + DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=ON\n", pSum, + local->fd)); + if (pSum->public.on) break; /* already on */ if ((local->fd < 0) && (!xf86SumOpenDevice(pSum))) { return !Success; } + + /* send prompt character to start the reports */ SYSCALL(write(local->fd, SS_PROMPT, strlen(SS_PROMPT))); -#ifdef XFREE86_V4 + +/* note: using xf86Add/Remove EnabledDevice() somehow causes the tablet + * to stop responding after a VT switch, and cannot be restored w/o + * cycling tablet power. until we figure out what's going on, do not + * enagae signal handlers yet. -huver@amgraf.com mar/12/2001. +*/ +#if 0 + #ifdef XFREE86_V4 xf86AddEnabledDevice(local); + #else + AddEnabledDevice(local->fd); + #endif #else AddEnabledDevice(local->fd); #endif @@ -1025,11 +1218,16 @@ xf86SumProc(DeviceIntPtr pSum, int what) break; case DEVICE_OFF: - DBG(1, ErrorF("xf86SumProc pSum=0x%x what=%s\n", pSum, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); + DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=OFF\n", pSum, + local->fd)); + if (! pSum->public.on) break; /* already off */ if (local->fd >= 0) -#ifdef XFREE86_V4 +#if 0 + #ifdef XFREE86_V4 xf86RemoveEnabledDevice(local); + #else + RemoveEnabledDevice(local->fd); + #endif #else RemoveEnabledDevice(local->fd); #endif @@ -1037,10 +1235,12 @@ xf86SumProc(DeviceIntPtr pSum, int what) 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; + DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=CLOSE\n", pSum, + local->fd)); + if (local->fd != -1) { + SYSCALL(close(local->fd)); + local->fd = -1; + } break; default: @@ -1060,10 +1260,16 @@ xf86SumProc(DeviceIntPtr pSum, int what) static void xf86SumClose(LocalDevicePtr local) { + DBG(2, ErrorF("xf86SumClose local = %lx, ->fd = %d\n", local, local->fd)); if (local->fd >= 0) { +#ifdef XFREE86_V4 + xf86CloseSerial(local->fd); +#else SYSCALL(close(local->fd)); +#endif } local->fd = -1; + xf86SumInitPrivate (local->private); } /* @@ -1110,7 +1316,7 @@ xf86SumSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) break; default: - DBG(1, ErrorF("xf86SumSwitchMode dev=0x%x invalid mode=%d\n", + DBG(2, ErrorF("xf86SumSwitchMode dev=0x%x invalid mode=%d\n", dev, mode)); return BadMatch; } @@ -1123,7 +1329,7 @@ xf86SumSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) ** Allocates the device structures for the SummaSketch. */ static LocalDevicePtr -xf86SumAllocate() +xf86SumAllocate(void) { LocalDevicePtr local; SummaDevicePtr priv; @@ -1167,32 +1373,7 @@ xf86SumAllocate() local->history_size = 0; local->old_x = -1; local->old_y = -1; - -#if defined(sun) && !defined(i386) - if (def_name) { - priv->sumDevice = xalloc(strlen(dev_name) + 1); - strcpy(priv->sumDevice, device_name); - ErrorF("xf86SumOpen port changed to '%s'\n", priv->sumDevice); - } else { - priv->sumDevice = ""; - } -#else - priv->sumDevice = ""; /* device file name */ -#endif - priv->sumInc = -1; /* re-transmit position on increment */ - priv->sumOldX = -1; /* previous X position */ - priv->sumOldY = -1; /* previous Y position */ - priv->sumOldProximity = 0; /* previous proximity */ - priv->sumOldButtons = 0; /* previous buttons state */ - priv->sumMaxX = -1; /* max X value */ - priv->sumMaxY = -1; /* max Y value */ - priv->sumXSize = -1; /* active area X */ - 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->sumIndex = 0; /* number of bytes read */ - + xf86SumInitPrivate (priv); return local; } @@ -1229,9 +1410,9 @@ init_xf86Summa(unsigned long server_version) return 1; } } -#endif +#endif /* dynamic_module */ -#else +#else /* below for xfree86_v4 */ /* * xf86SumUninit -- @@ -1245,7 +1426,7 @@ xf86SumUninit(InputDriverPtr drv, { SummaDevicePtr priv = (SummaDevicePtr) local->private; - DBG(1, ErrorF("xf86SumUninit\n")); + DBG(2, ErrorF("xf86SumUninit\n")); xf86SumProc(local->dev, DEVICE_OFF); @@ -1269,7 +1450,7 @@ xf86SumInit(InputDriverPtr drv, sumDrv = drv; - DBG(1, ErrorF("xf86SumInit allocating...\n")); + DBG(2, ErrorF("xf86SumInit allocating...\n")); local = xf86SumAllocate(); if (!local) @@ -1277,17 +1458,16 @@ xf86SumInit(InputDriverPtr drv, local->conf_idev = dev; - DBG(1, ErrorF("xf86SumInit CollectInputOptions...\n")); + DBG(2, ErrorF("xf86SumInit CollectInputOptions... ")); xf86CollectInputOptions(local, default_options, NULL); - DBG(1, ErrorF("done.\n")); + DBG(2, ErrorF("done.\n")); xf86OptionListReport( local->options ); - priv = (SummaDevicePtr) local->private; local->name = dev->identifier; - /* Serial Device is mandatory */ + /* Serial Device name is mandatory */ priv->sumDevice = xf86FindOptionValue(local->options, "Device"); if (!priv->sumDevice) { @@ -1300,7 +1480,7 @@ xf86SumInit(InputDriverPtr drv, /* Optional configuration */ - xf86Msg(X_CONFIG, "%s serial device is %s\n", dev->identifier, + xf86Msg(X_CONFIG, "%s: serial device is %s\n", dev->identifier, priv->sumDevice); debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); @@ -1308,7 +1488,11 @@ xf86SumInit(InputDriverPtr drv, xf86Msg(X_CONFIG, "Summa: debug level set to %d\n", debug_level); } - + s = xf86FindOptionValue(local->options, "Resolution"); + if (s) { + priv->sumRes=atoi(s); + xf86Msg(X_CONFIG, "%s: resolution given %d\n", local->name, priv->sumRes); + } s = xf86FindOptionValue(local->options, "Mode"); @@ -1322,9 +1506,29 @@ xf86SumInit(InputDriverPtr drv, 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, + xf86Msg(X_CONFIG, "%s: set for %s mode\n", local->name, (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); + s = xf86FindOption(local->options, "Compatible"); + if (s) { + priv->flags|=COMPATIBLE_FLAG; + } + + if (xf86FindOption(local->options, "Hitachi_1217D") != NULL) { + priv->flags |= H1217D_FLAG | COMPATIBLE_FLAG; + priv->sumInc = 0; /* this must be zero for Hitachi 1217D */ + xf86Msg(X_CONFIG, "%s: Hitachi 1217D, Compatible mode and Increment 0 implied\n", + local->name); + } + if (priv->flags & COMPATIBLE_FLAG) { + xf86Msg(X_CONFIG, "%s: will not query firmware ID.\n", local->name); + } + + s = xf86FindOptionValue(local->options, "ZAxis"); + if(s){ + priv->flags|=Z_AXIS_FLAG; + xf86Msg(X_CONFIG, "Tablet has Z axis (AceCad Flair or compatible)\n"); + } s = xf86FindOptionValue(local->options, "Cursor"); @@ -1338,31 +1542,33 @@ xf86SumInit(InputDriverPtr drv, 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, + xf86Msg(X_CONFIG, "%s: cursor mode is %s\n", local->name, (priv->flags & STYLUS_FLAG) ? "cursor" : "puck"); - priv->sumXSize = xf86SetIntOption(local->options, "XSize", 0); + priv->sumXSize = xf86SetRealOption(local->options, "XSize", 0.0) * 100; if (priv->sumXSize != 0) { - xf86Msg(X_CONFIG, "%s: XSize = %d\n", - dev->identifier, priv->sumXSize); + xf86Msg(X_CONFIG, "%s: XSize = %d.%02din.\n", + dev->identifier, priv->sumXSize/100, priv->sumXSize%100); } - priv->sumYSize = xf86SetIntOption(local->options, "YSize", 0); + priv->sumYSize = xf86SetRealOption(local->options, "YSize", 0.0) * 100; if (priv->sumYSize != 0) { - xf86Msg(X_CONFIG, "%s: YSize = %d\n", - dev->identifier, priv->sumYSize); + xf86Msg(X_CONFIG, "%s: YSize = %d.%02din.\n", + dev->identifier, priv->sumYSize/100, priv->sumYSize%100); } - priv->sumXOffset = xf86SetIntOption(local->options, "XOffset", 0); + priv->sumXOffset = xf86SetRealOption(local->options, "XOffset", 0.0) * 100; if (priv->sumXOffset != 0) { - xf86Msg(X_CONFIG, "%s: XOffset = %d\n", - dev->identifier, priv->sumXOffset); + xf86Msg(X_CONFIG, "%s: XOffset = %d.%02din.\n", + dev->identifier, priv->sumXOffset / 100, + priv->sumXOffset % 100); } - priv->sumYOffset = xf86SetIntOption(local->options, "YOffset", 0); + priv->sumYOffset = xf86SetRealOption(local->options, "YOffset", 0.0) * 100; if (priv->sumYOffset != 0) { - xf86Msg(X_CONFIG, "%s: YOffset = %d\n", - dev->identifier, priv->sumYOffset); + xf86Msg(X_CONFIG, "%s: YOffset = %d.%02din.\n", + dev->identifier, priv->sumYOffset / 100, + priv->sumYOffset % 100); } /* mark the device configured */ @@ -1407,7 +1613,7 @@ InputDriverRec SUMMA = { static void xf86SumUnplug(pointer p) { - DBG(1, ErrorF("xf86SumUnplug\n")); + DBG(2, ErrorF("xf86SumUnplug\n")); } /* @@ -1421,7 +1627,7 @@ xf86SumPlug(pointer module, int *errmaj, int *errmin) { - DBG(1, ErrorF("xf86SumPlug\n")); + DBG(2, ErrorF("xf86SumPlug\n")); xf86AddInputDriver(&SUMMA, module, 0); @@ -1452,3 +1658,4 @@ XF86ModuleData summaModuleData = {&xf86SumVersionRec, /* end of xf86Summa.c */ + diff --git a/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c b/xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c index e9b570494..ed9aa453c 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.25 2001/02/13 19:19:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.26 2001/04/01 14:00:13 tsi Exp $ */ /* * This driver is only able to handle the Wacom IV and Wacom V protocols. @@ -58,7 +58,7 @@ static const char identification[] = "$Identification: 20 $"; -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 1 @@ -85,21 +85,21 @@ static const char identification[] = "$Identification: 20 $"; #include <errno.h> #endif -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #define NEED_XF86_TYPES #if !defined(DGUX) -#include <xf86_ansic.h> -#include <xisb.h> +#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> +#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> +#include "xf86Module.h" #endif #undef sleep @@ -170,7 +170,6 @@ static InputDriverPtr wcmDrv; #include "xf86_Config.h" #include "xf86Xinput.h" #include "atKeynames.h" -#include "xf86Version.h" #endif #if !defined(sun) || defined(i386) diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c b/xc/programs/Xserver/hw/xfree86/int10/helper_exec.c index d8ab6ebe5..edcfedb0e 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.14 2001/02/15 19:37:26 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.15 2001/03/25 05:32:13 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -274,19 +274,15 @@ x_inb(CARD16 port) { CARD8 val; - if (port >= 0x0100) { - val = inb(port); -#ifdef PRINT_PORT - ErrorF(" inb(%#x) = %2.2x\n", port, val); -#endif - } else if (port == 0x40) { + if (port == 0x40) { Int10Current->inb40time++; val = (CARD8)(Int10Current->inb40time >> ((Int10Current->inb40time & 1) << 3)); #ifdef PRINT_PORT ErrorF(" inb(%#x) = %2.2x\n", port, val); #endif - } else { /* Don't interfere with mainboard */ +#ifdef __NOT_YET__ + } else if (port < 0x0100) { /* Don't interfere with mainboard */ val = 0; xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, "inb 0x%4.4x\n", port); @@ -294,6 +290,12 @@ x_inb(CARD16 port) dump_registers(Int10Current); stack_trace(Int10Current); } +#endif /* __NOT_YET__ */ + } else { + val = inb(port); +#ifdef PRINT_PORT + ErrorF(" inb(%#x) = %2.2x\n", port, val); +#endif } return val; } @@ -323,14 +325,9 @@ x_inw(CARD16 port) void x_outb(CARD16 port, CARD8 val) { - if (port >= 0x0100) { -#ifdef PRINT_PORT - ErrorF(" outb(%#x, %2.2x)\n", port, val); -#endif - outb(port, val); - } else if ((port == 0x43) && (val == 0)) { + if ((port == 0x43) && (val == 0)) { /* - * Emulate a PC's timer. Such timers typically have a resolution of + * Emulate a PC's timer 0. Such timers typically have a resolution of * some .838 usec per tick, but this can only provide 1 usec per tick. * (Not that this matters much, given inherent emulation delays.) Use * the bottom bit as a byte select. See inb(0x40) above. @@ -341,13 +338,20 @@ x_outb(CARD16 port, CARD8 val) #ifdef PRINT_PORT ErrorF(" outb(%#x, %2.2x)\n", port, val); #endif - } else { /* Don't interfere with mainboard */ +#ifdef __NOT_YET__ + } else if (port < 0x0100) { /* Don't interfere with mainboard */ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, "outb 0x%4.4x,0x%2.2x\n", port, val); if (xf86GetVerbosity() > 3) { dump_registers(Int10Current); stack_trace(Int10Current); } +#endif /* __NOT_YET__ */ + } else { +#ifdef PRINT_PORT + ErrorF(" outb(%#x, %2.2x)\n", port, val); +#endif + outb(port, val); } } diff --git a/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c b/xc/programs/Xserver/hw/xfree86/int10/helper_mem.c index 2d0bd6ff2..cd434bf9e 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.17 2001/02/15 19:37:26 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.18 2001/03/03 22:46:32 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -101,7 +101,7 @@ setup_int_vect(xf86Int10InfoPtr pInt) #endif int -setup_system_bios(memType base_addr) +setup_system_bios(void *base_addr) { char *base = (char *) base_addr; diff --git a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c index e68a3c0f3..e61c2ae6f 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c +++ b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.6 2001/01/06 20:19:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.7 2001/03/25 05:32:13 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -570,10 +570,10 @@ int42_handler(xf86Int10InfoPtr pInt) break; default: - /* Various extensions */ + /* Various extensions */ /* Enter: Various */ /* Leave: Various */ - /* Ignored */ + /* Ignored */ break; } diff --git a/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h b/xc/programs/Xserver/hw/xfree86/int10/xf86int10.h index 0c7432faa..b2ffd420d 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.18 2001/02/16 10:04:31 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.19 2001/03/03 22:46:32 tsi Exp $ */ /* * XFree86 int10 module @@ -151,7 +151,7 @@ void Mem_wl(int addr, CARD32 val); /* helper_mem.c */ void setup_int_vect(xf86Int10InfoPtr pInt); -int setup_system_bios(unsigned long base_addr); +int setup_system_bios(void *base_addr); void reset_int_vect(xf86Int10InfoPtr pInt); void set_return_trap(xf86Int10InfoPtr pInt); Bool int10skip(ScrnInfoPtr pScrn, int entityIndex); diff --git a/xc/programs/Xserver/hw/xfree86/loader/dixsym.c b/xc/programs/Xserver/hw/xfree86/loader/dixsym.c index 34a386bd3..50ce4d1a8 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/dixsym.c +++ b/xc/programs/Xserver/hw/xfree86/loader/dixsym.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.36 2001/01/21 21:19:37 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.38 2001/04/05 17:42:34 dawes Exp $ */ /* @@ -39,6 +39,8 @@ #include "scrnintstr.h" #include "windowstr.h" #include "extension.h" +#define EVENT_SWAP_PTR +#define EXTENSION_PROC_ARGS void * #include "extnsionst.h" #include "swaprep.h" #include "swapreq.h" @@ -168,6 +170,7 @@ LOOKUP dixLookupTab[] = { SYMVAR(XvScreenInitProc) SYMVAR(XvGetScreenIndexProc) SYMVAR(XvGetRTPortProc) + SYMVAR(XvMCScreenInitProc) #endif SYMVAR(ScreenSaverBlanking) SYMVAR(WindowTable) diff --git a/xc/programs/Xserver/hw/xfree86/loader/elfloader.c b/xc/programs/Xserver/hw/xfree86/loader/elfloader.c index 32125dfa4..773665b37 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/elfloader.c +++ b/xc/programs/Xserver/hw/xfree86/loader/elfloader.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.35 2001/01/11 03:36:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.36 2001/04/01 14:00:14 tsi Exp $ */ /* * @@ -71,6 +71,10 @@ typedef Elf64_Sym Elf_Sym; typedef Elf64_Rel Elf_Rel; typedef Elf64_Rela Elf_Rela; typedef Elf64_Addr Elf_Addr; +typedef Elf64_Half Elf_Half; +typedef Elf64_Off Elf_Off; +typedef Elf64_Sword Elf_Sword; +typedef Elf64_Word Elf_Word; #define ELF_ST_BIND ELF64_ST_BIND #define ELF_ST_TYPE ELF64_ST_TYPE #define ELF_R_SYM ELF64_R_SYM @@ -132,6 +136,10 @@ typedef Elf32_Sym Elf_Sym; typedef Elf32_Rel Elf_Rel; typedef Elf32_Rela Elf_Rela; typedef Elf32_Addr Elf_Addr; +typedef Elf32_Half Elf_Half; +typedef Elf32_Off Elf_Off; +typedef Elf32_Sword Elf_Sword; +typedef Elf32_Word Elf_Word; #define ELF_ST_BIND ELF32_ST_BIND #define ELF_ST_TYPE ELF32_ST_TYPE #define ELF_R_SYM ELF32_R_SYM @@ -237,7 +245,7 @@ typedef struct { typedef struct _elf_reloc { Elf_Rel_t *rel; ELFModulePtr file; - unsigned char *secp; + Elf_Word secn; struct _elf_reloc *next; } ELFRelocRec; @@ -259,14 +267,14 @@ static int ELFhashCleanOut(void *, itemPtr); static char *ElfGetStringIndex(ELFModulePtr, int, int); static char *ElfGetString(ELFModulePtr, int); static char *ElfGetSectionName(ELFModulePtr, int); -static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rel_t *); +static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, Elf_Word, Elf_Rel_t *); static ELFCommonPtr ElfAddCOMMON(Elf_Sym *); static int ElfCOMMONSize(void); static int ElfCreateCOMMON(ELFModulePtr,LOOKUP *); static char *ElfGetSymbolNameIndex(ELFModulePtr, int, int); static char *ElfGetSymbolName(ELFModulePtr, int); static Elf_Addr ElfGetSymbolValue(ELFModulePtr, int); -static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rel_t *, int); +static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, Elf_Word, Elf_Rel_t *, int); static ELFRelocPtr ELFCollectRelocations(ELFModulePtr, int); static LOOKUP *ELF_GetSymbols(ELFModulePtr, unsigned short **); static void ELFCollectSections(ELFModulePtr, int, int *, int *); @@ -340,9 +348,9 @@ itemPtr item ; * Manage listResolv */ static ELFRelocPtr -ElfDelayRelocation(elffile,secp,rel) +ElfDelayRelocation(elffile, secn, rel) ELFModulePtr elffile; -unsigned char *secp; +Elf_Word secn; Elf_Rel_t *rel; { ELFRelocPtr reloc; @@ -352,13 +360,13 @@ Elf_Rel_t *rel; return 0; } reloc->file=elffile; - reloc->secp=secp; + reloc->secn=secn; reloc->rel=rel; reloc->next=0; #ifdef ELFDEBUG - ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %lx," + ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %d," " r_offset 0x%lx, r_info 0x%x", - reloc, elffile, secp, rel->r_offset, rel->r_info); + reloc, elffile, secn, rel->r_offset, rel->r_info); #if defined(__powerpc__) || \ defined(__mc68000__) || \ defined(__alpha__) || \ @@ -799,6 +807,10 @@ int maxalign; ELFGotPtr gots; #endif int gotsize; + + /* + * XXX: Is it REALLY needed to ensure GOT's are non-null? + */ #ifdef ELFDEBUG ELFDEBUG( "ELFCreateGOT: %x entries in the GOT\n", elffile->gotsize/8 ); @@ -1069,6 +1081,7 @@ long value; case 2: memcpy((char *)data128 + 10, &data, 6); break; default: FatalError("Unexpected slot in IA64InstallReloc()\n"); } + ia64_flush_cache(data128); #ifdef ELFDEBUG ELFDEBUG( "After [%016lx%016lx]\n", data128[1], data128[0]); #endif @@ -1083,12 +1096,13 @@ long value; * LoaderDefaultFunc) otherwise, the relocation will be deferred. */ static ELFRelocPtr -Elf_RelocateEntry(elffile, secp, rel, force) +Elf_RelocateEntry(elffile, secn, rel, force) ELFModulePtr elffile; -unsigned char *secp; /* Begining of the target section */ +Elf_Word secn; Elf_Rel_t *rel; int force; { + unsigned char *secp = elffile->saddr[secn]; unsigned int *dest32; /* address of the 32 bit place being modified */ #if defined(__powerpc__) || defined(__mc68000__) || defined(__sparc__) unsigned short *dest16; /* address of the 16 bit place being modified */ @@ -1132,7 +1146,7 @@ int force; ELFDEBUG("***Unable to resolve symbol %s\n", ElfGetSymbolName(elffile, ELF_R_SYM(rel->r_info))); #endif - return ElfDelayRelocation(elffile,secp,rel); + return ElfDelayRelocation(elffile, secn, rel); } } } @@ -1975,6 +1989,7 @@ int force; if (rel->r_addend) FatalError("\nAddend not supported for R_IA64_FPTR64LSB\n"); *dest64 = symval; + ia64_flush_cache(dest64); break; case R_IA64_DIR64LSB: @@ -1987,6 +2002,7 @@ int force; ELFDEBUG( "dest64=%lx\n", dest64 ); #endif *dest64 = symval + rel->r_addend; + ia64_flush_cache(dest64); break; case R_IA64_GPREL22: @@ -2022,14 +2038,9 @@ int index; /* The section to use as relocation data */ Elf_Shdr *sect=&(elffile->sections[index]); Elf_Rel_t *rel=(Elf_Rel_t *)elffile->saddr[index]; Elf_Sym *syms; - unsigned char *secp; /* Begining of the target section */ ELFRelocPtr reloc_head = NULL; ELFRelocPtr tmp; - secp=(unsigned char *)elffile->saddr[sect->sh_info]; - if (secp == NULL) { - secp=(unsigned char *)(long)sect->sh_info; - } syms = (Elf_Sym *) elffile->saddr[elffile->symndx]; numrel=sect->sh_size/sect->sh_entsize; @@ -2055,7 +2066,7 @@ int index; /* The section to use as relocation data */ } } #endif - tmp = ElfDelayRelocation(elffile,secp,&(rel[i])); + tmp = ElfDelayRelocation(elffile, sect->sh_info, &(rel[i])); tmp->next = reloc_head; reloc_head = tmp; } @@ -2840,11 +2851,6 @@ LOOKUP **ppLookup; } xf86loaderfree(secttable); - for (elf_reloc = _LoaderGetRelocations(v)->elf_reloc; - elf_reloc; elf_reloc = elf_reloc->next) - if ((unsigned long)elf_reloc->secp < elffile->numsh) - elf_reloc->secp = (unsigned char *)elffile->saddr[(unsigned long)elf_reloc->secp]; - #if defined(__ia64__) ELFCreateOPD(elffile); #endif @@ -2886,10 +2892,10 @@ void *mod; newlist = 0; for (p = _LoaderGetRelocations(mod)->elf_reloc; p; ) { #ifdef ELFDEBUG - ErrorF("ResolveSymbols: file %lx, sec %lx, r_offset 0x%x, r_info 0x%lx\n", - p->file, p->secp, p->rel->r_offset, p->rel->r_info); + ErrorF("ResolveSymbols: file %lx, sec %d, r_offset 0x%x, r_info 0x%lx\n", + p->file, p->secn, p->rel->r_offset, p->rel->r_info); #endif - tmp = Elf_RelocateEntry(p->file, p->secp, p->rel, FALSE); + tmp = Elf_RelocateEntry(p->file, p->secn, p->rel, FALSE); if (tmp) { /* Failed to relocate. Keep it in the list. */ tmp->next = newlist; @@ -2914,7 +2920,7 @@ void *mod; return 0; while( erel ) { - Elf_RelocateEntry(erel->file, erel->secp, erel->rel, TRUE); + Elf_RelocateEntry(erel->file, erel->secn, erel->rel, TRUE); name = ElfGetSymbolName(erel->file, ELF_R_SYM(erel->rel->r_info)); flag = _LoaderHandleUnresolved( name, _LoaderHandleToName(erel->file->handle)); diff --git a/xc/programs/Xserver/hw/xfree86/loader/hash.c b/xc/programs/Xserver/hw/xfree86/loader/hash.c index ab5e22aad..997bc3ffd 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/hash.c +++ b/xc/programs/Xserver/hw/xfree86/loader/hash.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/hash.c,v 1.17 2001/02/17 11:36:52 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/hash.c,v 1.18 2001/02/22 23:17:09 dawes Exp $ */ /* * @@ -135,12 +135,9 @@ int handle; int module; LOOKUP *list ; { - LOOKUP *l = list; - itemPtr i; + LOOKUP *l = list, *exports = NULL; + itemPtr i, exportsItem = NULL; char *modname; - char **exports = NULL; - char **e; - int found = 0; if (!list) return; @@ -160,11 +157,9 @@ LOOKUP *list ; sprintf(exportname, "%sExportedSymbols", modname); while (l->symName) { if (strcmp(l->symName, exportname) == 0) { - exports = (char **)l->offset; -#ifdef DEBUG + exports = l; ErrorF("LoaderAddSymbols: %s: %s found\n", modname, exportname); -#endif break; } l++; @@ -173,42 +168,35 @@ LOOKUP *list ; } /* - * Visit every symbol in the lookup table, - * and add it to the given namespace if appropriate based on the - * presence and content of an export list. + * Allocate the exports list item first. + */ + if (exports) { + exportsItem = xf86loadermalloc( sizeof( itemRec )) ; + exportsItem->name = exports->symName ; + exportsItem->address = (char *) exports->offset ; + exportsItem->handle = handle ; + exportsItem->module = module ; + exportsItem->exports = NULL; + LoaderHashAdd( exportsItem ); + } + + /* + * Visit every symbol in the lookup table, tagging it with the + * reference to the export list, if present. */ l = list; while ( l->symName ) { - /* XXX This might be slow if lots of symbols are exported. */ - if (exports) { - found = 0; - for (e = exports; *e != NULL; e++) { - if (strcmp(l->symName, *e) == 0) { - found = 1; - break; - } - } - } else { - found = 1; - } -#ifdef DEBUG - ErrorF("LoaderAddSymbols: modname: Symbol \"%s\" %sexported\n", - l->symName, found ? "" : "NOT"); -#endif - if (found) { + if (l != exports) { i = xf86loadermalloc( sizeof( itemRec )) ; i->name = l->symName ; i->address = (char *) l->offset ; i->handle = handle ; i->module = module ; + i->exports = exportsItem; LoaderHashAdd( i ); } l ++ ; } - /* - * XXX It might be useful to check for exported symbols that weren't - * actually present in the module, and print a warning for them. - */ } itemPtr diff --git a/xc/programs/Xserver/hw/xfree86/loader/loader.c b/xc/programs/Xserver/hw/xfree86/loader/loader.c index 8af5fc48e..210213ff7 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/loader.c +++ b/xc/programs/Xserver/hw/xfree86/loader/loader.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.52 2001/02/16 02:14:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.53 2001/04/05 15:55:28 dawes Exp $ */ /* * @@ -365,7 +365,7 @@ _GetModuleType(int fd, long offset) #endif if (strncmp((char *) buf, ELFMAG, SELFMAG) == 0) { - if( buf[ELFDLOFF] == ELFDLMAG ) { + if( *((Elf32_Half *)(buf + ELFDLOFF)) == ELFDLMAG ) { return LD_ELFDLOBJECT; } else { return LD_ELFOBJECT; @@ -1249,8 +1249,10 @@ LoaderCheckUnresolved(int delay_flag ) return ret; } +void xf86LoaderTrap(void); + void -xf86LoaderTrap() +xf86LoaderTrap(void) { } diff --git a/xc/programs/Xserver/hw/xfree86/loader/loader.h b/xc/programs/Xserver/hw/xfree86/loader/loader.h index c9af8f011..a814544b8 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/loader.h +++ b/xc/programs/Xserver/hw/xfree86/loader/loader.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.h,v 1.24 2001/02/16 01:36:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.h,v 1.25 2001/02/22 23:17:09 dawes Exp $ */ /* * @@ -84,12 +84,14 @@ typedef struct _LoaderReloc { AOUTRelocPtr aout_reloc; } LoaderRelocRec, *LoaderRelocPtr; +typedef struct _loader_item *itemPtr; typedef struct _loader_item { char *name ; void *address ; - struct _loader_item *next ; + itemPtr next ; int handle ; int module ; + itemPtr exports; #if defined(__powerpc__) /* * PowerPC file formats require special routines in some circumstances @@ -101,7 +103,7 @@ typedef struct _loader_item { unsigned short glink[14]; /* XCOFF */ } code ; #endif - } itemRec, *itemPtr ; + } itemRec ; /* The following structures provide an interface to GDB (note that GDB has copies of the definitions - if you change anything here make diff --git a/xc/programs/Xserver/hw/xfree86/loader/loadmod.c b/xc/programs/Xserver/hw/xfree86/loader/loadmod.c index 1df228a80..48e008a7a 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/loadmod.c +++ b/xc/programs/Xserver/hw/xfree86/loader/loadmod.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.63 2001/02/16 01:43:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.64 2001/03/27 23:42:17 dawes Exp $ */ /* * @@ -553,7 +553,7 @@ CheckVersion (const char *module, XF86ModuleVersionInfo *data, data->modname ? data->modname : "UNKNOWN!", data->vendor ? data->vendor : "UNKNOWN!"); - if (ver < 40000000) { + if (ver > (4 << 24)) { /* 4.0.x and earlier */ verstr[1] = verstr[3] = 0; verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0; diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c index 227ab0777..2be9e1c01 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.184 2001/02/18 16:41:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.190 2001/04/05 17:42:34 dawes Exp $ */ /* * @@ -43,6 +43,7 @@ #endif #include "xf86OSmouse.h" #include "xf86xv.h" +#include "xf86xvmc.h" #include "xf86cmap.h" #include "xf86fbman.h" #include "dgaproc.h" @@ -52,7 +53,6 @@ #define DONT_DEFINE_WRAPPERS #include "xf86_ansic.h" #include "xisb.h" -#include "xf86Priv.h" #include "vbe.h" #include "xf86sbusBus.h" #include "compiler.h" @@ -266,6 +266,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86FindScreenForEntity) SYMFUNC(xf86FindPciDeviceVendor) SYMFUNC(xf86FindPciClass) + SYMFUNC(xf86EnablePciBusMaster) SYMFUNC(xf86RegisterStateChangeNotificationCallback) SYMFUNC(xf86DeregisterStateChangeNotificationCallback) SYMFUNC(xf86NoSharedResources) @@ -459,6 +460,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86OptionValue) SYMFUNC(xf86OptionListReport) SYMFUNC(xf86SetIntOption) + SYMFUNC(xf86SetRealOption) SYMFUNC(xf86SetStrOption) SYMFUNC(xf86ReplaceIntOption) SYMFUNC(xf86ReplaceStrOption) @@ -516,6 +518,9 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86XVAllocateVideoAdaptorRec) SYMFUNC(xf86XVFreeVideoAdaptorRec) + /* xf86xvmc.c */ + SYMFUNC(xf86XvMCScreenInit) + /* xf86VidMode.c */ SYMFUNC(VidModeExtensionInit) #ifdef XF86VIDMODE @@ -563,8 +568,8 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(GetTimeInMillis) /* xf86Xinput.c */ - SYMFUNC(xf86ProcessCommonOptions) #ifdef XINPUT + SYMFUNC(xf86ProcessCommonOptions) SYMFUNC(xf86IsCorePointer) SYMFUNC(xf86PostMotionEvent) SYMFUNC(xf86PostProximityEvent) @@ -878,7 +883,6 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86WriteMmioNB32) SYMFUNC(xf86WriteMmioNB16) SYMFUNC(xf86WriteMmioNB8) - SYMFUNC(memcpy) #endif #if defined(sun) && defined(SVR4) SYMFUNC(inb) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c index 81af01648..ec95306e8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c,v 1.1 2000/03/05 16:59:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c,v 1.2 2001/02/27 23:05:00 alanh Exp $ */ #include "X.h" #include "input.h" @@ -29,18 +29,21 @@ writeDense32(int Value, pointer Base, register unsigned long Offset); int readDense8(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD8*) ((unsigned long)Base+(Offset)); } int readDense16(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD16*) ((unsigned long)Base+(Offset)); } int readDense32(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD32*)((unsigned long)Base+(Offset)); } @@ -65,20 +68,20 @@ writeDenseNB32(int Value, pointer Base, register unsigned long Offset) void writeDense8(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } void writeDense16(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } void writeDense32(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } diff --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 2744d770e..f20bbaba1 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.41 2001/02/15 19:34:19 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.42 2001/02/27 23:05:00 alanh Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -1511,6 +1511,7 @@ readSparse8(pointer Base, register unsigned long Offset) register unsigned long result, shift; register unsigned long msb; + mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; shift = (Offset & 0x3) << 3; if (Offset >= (hae_thresh)) { @@ -1533,6 +1534,7 @@ readSparse16(pointer Base, register unsigned long Offset) register unsigned long result, shift; register unsigned long msb; + mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; shift = (Offset & 0x2) << 3; if (Offset >= (hae_thresh)) { @@ -1551,6 +1553,7 @@ readSparse16(pointer Base, register unsigned long Offset) static int readSparse32(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(vuip)((unsigned long)Base+(Offset)); } @@ -1560,6 +1563,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) register unsigned long msb; register unsigned int b = Value & 0xffU; + write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -1570,7 +1574,6 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) } } *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; - mem_barrier(); } static void @@ -1579,6 +1582,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) register unsigned long msb; register unsigned int w = Value & 0xffffU; + write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -1590,15 +1594,14 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) } *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = w * 0x00010001; - mem_barrier(); } static void writeSparse32(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(vuip)((unsigned long)Base + (Offset)) = Value; - mem_barrier(); return; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd index ff26c7628..61cba175f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR = drm tdfx gamma +SUBDIR = drm tdfx mga gamma .include <bsd.subdir.mk> diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c index a26990112..37d17be54 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c @@ -135,12 +135,12 @@ int drm_getmagic(dev_t kdev, u_long cmd, caddr_t data, if (priv->magic) { auth.magic = priv->magic; } else { - simple_lock(&lock); do { + simple_lock(&lock); if (!sequence) ++sequence; /* reserve 0 */ auth.magic = sequence++; - } while (drm_find_file(dev, auth.magic)); simple_unlock(&lock); + } while (drm_find_file(dev, auth.magic)); priv->magic = auth.magic; drm_add_magic(dev, priv, auth.magic); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c index 61becaa12..b9722973e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c @@ -121,6 +121,7 @@ int drm_freelist_create(drm_freelist_t *bl, int count) bl->low_mark = 0; bl->high_mark = 0; atomic_set(&bl->wfh, 0); +/* bl->lock = SPIN_LOCK_UNLOCKED; */ ++bl->initialized; return 0; } @@ -159,6 +160,7 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf) drm_histogram_compute(dev, buf); #endif buf->list = DRM_LIST_FREE; +/* do { old = (unsigned long)bl->next; buf->next = (void *)old; @@ -169,6 +171,13 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf) return 1; } } while (failed); +*/ + + simple_lock(&bl->lock); + buf->next = bl->next; + bl->next = buf; + simple_unlock(&bl->lock); + atomic_inc(&bl->count); if (atomic_read(&bl->count) > dma->buf_count) { DRM_ERROR("%d of %d buffers free after addition of %d\n", @@ -195,6 +204,7 @@ static drm_buf_t *drm_freelist_try(drm_freelist_t *bl) if (!bl) return NULL; /* Get buffer */ +/* do { old = (unsigned int)bl->next; if (!old) { @@ -210,6 +220,16 @@ static drm_buf_t *drm_freelist_try(drm_freelist_t *bl) atomic_dec(&bl->count); buf = (drm_buf_t *)old; +*/ + simple_lock(&bl->lock); + if(!bl->next){ + simple_unlock(&bl->lock); + return NULL; + } + buf = bl->next; + bl->next = bl->next->next; + simple_unlock(&bl->lock); + atomic_dec(&bl->count); buf->next = NULL; buf->list = DRM_LIST_NONE; DRM_DEBUG("%d, count = %d, wfh = %d, w%d, p%d\n", diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c index 1affcd1d0..ec295b2b2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c @@ -135,9 +135,12 @@ static int drm_flush_queue(drm_device_t *dev, int context) if (atomic_read(&q->use_count) > 1) { atomic_inc(&q->block_write); atomic_inc(&q->block_count); - error = tsleep(&q->flush_queue, PCATCH|PZERO, "drmfq", 0); - if (error) - return error; + for (;;) { + if (!DRM_BUFCOUNT(&q->waitlist)) break; + error = tsleep(&q->flush_queue, PCATCH|PZERO, "drmfq", 0); + if (error) + return error; + } atomic_dec(&q->block_count); } atomic_dec(&q->use_count); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c index 81c1b1a04..f60e21289 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c @@ -95,7 +95,7 @@ void drm_mem_init(void) /* drm_mem_info is called whenever a process reads /dev/drm/mem. */ -static int _drm_mem_info SYSCTL_HANDLER_ARGS +static int _drm_mem_info DRM_SYSCTL_HANDLER_ARGS { drm_mem_stats_t *pt; char buf[128]; @@ -127,7 +127,7 @@ static int _drm_mem_info SYSCTL_HANDLER_ARGS return 0; } -int drm_mem_info SYSCTL_HANDLER_ARGS +int drm_mem_info DRM_SYSCTL_HANDLER_ARGS { int ret; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c index 3f6616ef7..6ca3fabc1 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c @@ -25,7 +25,7 @@ * DEALINGS IN THE SOFTWARE. * * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c,v 1.1 2000/06/17 00:03:30 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c,v 1.2 2001/03/02 02:45:38 dawes Exp $ * */ @@ -165,7 +165,7 @@ static int _drm_vm_info(char *buf, char **start, off_t offset, int len, { drm_device_t *dev = (drm_device_t *)data; drm_map_t *map; - const char *types[] = { "FB", "REG", "SHM" }; + const char *types[] = { "FB", "REG", "SHM", "AGP" }; const char *type; int i; @@ -176,7 +176,7 @@ static int _drm_vm_info(char *buf, char **start, off_t offset, int len, "address mtrr\n\n"); for (i = 0; i < dev->map_count; i++) { map = dev->maplist[i]; - if (map->type < 0 || map->type > 2) type = "??"; + if (map->type < 0 || map->type > 3) type = "??"; else type = types[map->type]; DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", i, @@ -226,7 +226,7 @@ static int _drm_queues_info(char *buf, char **start, off_t offset, int len, atomic_inc(&q->use_count); DRM_PROC_PRINT_RET(atomic_dec(&q->use_count), "%5d/0x%03x %5d %5d" - " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n", + " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n", i, q->flags, atomic_read(&q->use_count), diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c index a890abac4..0bc04d222 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c @@ -25,7 +25,7 @@ * DEALINGS IN THE SOFTWARE. * * $PI$ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c,v 1.1 2000/06/17 00:03:31 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c,v 1.2 2001/03/02 02:45:38 dawes Exp $ * */ @@ -35,21 +35,21 @@ SYSCTL_NODE(_hw, OID_AUTO, dri, CTLFLAG_RW, 0, "DRI Graphics"); -static int drm_name_info SYSCTL_HANDLER_ARGS; -static int drm_vm_info SYSCTL_HANDLER_ARGS; -static int drm_clients_info SYSCTL_HANDLER_ARGS; -static int drm_queues_info SYSCTL_HANDLER_ARGS; -static int drm_bufs_info SYSCTL_HANDLER_ARGS; +static int drm_name_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS; #if DRM_DEBUG_CODExx -static int drm_vma_info SYSCTL_HANDLER_ARGS; +static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS; #endif #if DRM_DMA_HISTOGRAM -static int drm_histo_info SYSCTL_HANDLER_ARGS; +static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS; #endif struct drm_sysctl_list { const char *name; - int (*f) SYSCTL_HANDLER_ARGS; + int (*f) DRM_SYSCTL_HANDLER_ARGS; } drm_sysctl_list[] = { { "name", drm_name_info }, { "mem", drm_mem_info }, @@ -137,7 +137,7 @@ int drm_sysctl_cleanup(drm_device_t *dev) return 0; } -static int drm_name_info SYSCTL_HANDLER_ARGS +static int drm_name_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; char buf[128]; @@ -155,11 +155,11 @@ static int drm_name_info SYSCTL_HANDLER_ARGS return 0; } -static int _drm_vm_info SYSCTL_HANDLER_ARGS +static int _drm_vm_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_map_t *map; - const char *types[] = { "FB", "REG", "SHM" }; + const char *types[] = { "FB", "REG", "SHM", "AGP" }; const char *type; int i; char buf[128]; @@ -172,7 +172,7 @@ static int _drm_vm_info SYSCTL_HANDLER_ARGS for (i = 0; i < dev->map_count; i++) { map = dev->maplist[i]; - if (map->type < 0 || map->type > 2) type = "??"; + if (map->type < 0 || map->type > 3) type = "??"; else type = types[map->type]; DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", i, @@ -192,7 +192,7 @@ static int _drm_vm_info SYSCTL_HANDLER_ARGS return 0; } -static int drm_vm_info SYSCTL_HANDLER_ARGS +static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -205,7 +205,7 @@ static int drm_vm_info SYSCTL_HANDLER_ARGS } -static int _drm_queues_info SYSCTL_HANDLER_ARGS +static int _drm_queues_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int i; @@ -221,7 +221,7 @@ static int _drm_queues_info SYSCTL_HANDLER_ARGS atomic_inc(&q->use_count); DRM_SYSCTL_PRINT_RET(atomic_dec(&q->use_count), "%5d/0x%03x %5d %5d" - " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n", + " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n", i, q->flags, atomic_read(&q->use_count), @@ -243,7 +243,7 @@ static int _drm_queues_info SYSCTL_HANDLER_ARGS return 0; } -static int drm_queues_info SYSCTL_HANDLER_ARGS +static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -257,7 +257,7 @@ static int drm_queues_info SYSCTL_HANDLER_ARGS /* drm_bufs_info is called whenever a process reads hw.dri.0.bufs. */ -static int _drm_bufs_info SYSCTL_HANDLER_ARGS +static int _drm_bufs_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_device_dma_t *dma = dev->dma; @@ -293,7 +293,7 @@ static int _drm_bufs_info SYSCTL_HANDLER_ARGS return 0; } -static int drm_bufs_info SYSCTL_HANDLER_ARGS +static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -305,7 +305,7 @@ static int drm_bufs_info SYSCTL_HANDLER_ARGS } -static int _drm_clients_info SYSCTL_HANDLER_ARGS +static int _drm_clients_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_file_t *priv; @@ -327,7 +327,7 @@ static int _drm_clients_info SYSCTL_HANDLER_ARGS return 0; } -static int drm_clients_info SYSCTL_HANDLER_ARGS +static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -340,7 +340,7 @@ static int drm_clients_info SYSCTL_HANDLER_ARGS #if DRM_DEBUG_CODExx -static int _drm_vma_info SYSCTL_HANDLER_ARGS +static int _drm_vma_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_vma_entry_t *pt; @@ -412,7 +412,7 @@ static int _drm_vma_info SYSCTL_HANDLER_ARGS return 0; } -static int drm_vma_info SYSCTL_HANDLER_ARGS +static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -426,7 +426,7 @@ static int drm_vma_info SYSCTL_HANDLER_ARGS #if DRM_DMA_HISTOGRAM -static int _drm_histo_info SYSCTL_HANDLER_ARGS +static int _drm_histo_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_device_dma_t *dma = dev->dma; @@ -498,9 +498,9 @@ static int _drm_histo_info SYSCTL_HANDLER_ARGS } else { DRM_SYSCTL_PRINT("lock none\n"); } - DRM_SYSCTL_PRINT("context_flag 0x%08x\n", dev->context_flag); - DRM_SYSCTL_PRINT("interrupt_flag 0x%08x\n", dev->interrupt_flag); - DRM_SYSCTL_PRINT("dma_flag 0x%08x\n", dev->dma_flag); + DRM_SYSCTL_PRINT("context_flag 0x%08lx\n", dev->context_flag); + DRM_SYSCTL_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag); + DRM_SYSCTL_PRINT("dma_flag 0x%08lx\n", dev->dma_flag); DRM_SYSCTL_PRINT("queue_count %10d\n", dev->queue_count); DRM_SYSCTL_PRINT("last_context %10d\n", dev->last_context); @@ -541,7 +541,7 @@ static int _drm_histo_info SYSCTL_HANDLER_ARGS return 0; } -static int drm_histo_info SYSCTL_HANDLER_ARGS +static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h index b62aff08d..7a1159c78 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h @@ -25,7 +25,7 @@ * DEALINGS IN THE SOFTWARE. * * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.1 2000/06/17 00:03:28 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.3 2001/03/06 16:45:26 dawes Exp $ * */ @@ -49,11 +49,11 @@ #include <sys/sysctl.h> #include <sys/select.h> #include <sys/bus.h> -#if __FreeBSD_version >= 500005 +#if __FreeBSD_version >= 400005 #include <sys/taskqueue.h> #endif -#if __FreeBSD_version >= 500006 +#if __FreeBSD_version >= 400006 #define DRM_AGP #endif @@ -73,6 +73,11 @@ typedef u_int32_t spinlock_t; #define atomic_add(n, p) atomic_add_int(p, n) #define atomic_sub(n, p) atomic_subtract_int(p, n) +/* The version number here is a guess */ +#if __FreeBSD_version >= 500010 +#define callout_init(a) callout_init(a, 0) +#endif + /* Fake this */ static __inline u_int32_t test_and_set_bit(int b, volatile u_int32_t *p) @@ -128,14 +133,14 @@ find_first_zero_bit(volatile u_int32_t *p, int max) * Fake out the module macros for versions of FreeBSD where they don't * exist. */ -#if __FreeBSD_version < 500002 +#if __FreeBSD_version < 400002 #define MODULE_VERSION(a,b) struct __hack #define MODULE_DEPEND(a,b,c,d,e) struct __hack #endif -#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then +#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then also include looping detection. */ #define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */ @@ -340,6 +345,7 @@ typedef struct drm_freelist { int low_mark; /* Low water mark */ int high_mark; /* High water mark */ atomic_t wfh; /* If waiting for high mark */ + struct simplelock lock; /* hope this doesn't need to be linux compatible */ } drm_freelist_t; typedef struct drm_buf_entry { @@ -509,15 +515,15 @@ typedef struct drm_device { /* Context support */ struct resource *irq; /* Interrupt used by board */ void *irqh; /* Handle from bus_setup_intr */ - __volatile__ int context_flag; /* Context swapping flag */ - __volatile__ int interrupt_flag;/* Interruption handler flag */ - __volatile__ int dma_flag; /* DMA dispatch flag */ + __volatile__ long context_flag; /* Context swapping flag */ + __volatile__ long interrupt_flag;/* Interruption handler flag */ + __volatile__ long dma_flag; /* DMA dispatch flag */ struct callout timer; /* Timer for delaying ctx switch */ int context_wait; /* Processes waiting on ctx switch */ int last_checked; /* Last context checked for DMA */ int last_context; /* Last current context */ int last_switch; /* Time at last context switch */ -#if __FreeBSD_version >= 500005 +#if __FreeBSD_version >= 400005 struct task task; #endif struct timespec ctx_start; @@ -594,7 +600,13 @@ extern int drm_sysctl_cleanup(drm_device_t *dev); /* Memory management support (memory.c) */ extern void drm_mem_init(void); -extern int drm_mem_info SYSCTL_HANDLER_ARGS; + +#if __FreeBSD_version < 411000 +#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS +#else +#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS) +#endif +extern int drm_mem_info DRM_SYSCTL_HANDLER_ARGS; extern void *drm_alloc(size_t size, int area); extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile index f5635910b..37f3f5e7b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile @@ -3,7 +3,7 @@ KMOD = gamma SRCS = gamma_drv.c gamma_dma.c SRCS += device_if.h bus_if.h pci_if.h -CFLAGS += ${DEBUG_FLAGS} -I.. +CFLAGS += ${DEBUG_FLAGS} -I. -I.. KMODDEPS = drm @: diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c index 63f1b42b1..63515bab3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c @@ -188,7 +188,11 @@ int mga_rmctx(dev_t kdev, u_long cmd, caddr_t data, int flags, struct proc *p) ctx = *(drm_ctx_t *) data; DRM_DEBUG("%d\n", ctx.handle); - if(ctx.handle != DRM_KERNEL_CONTEXT) { +/* + if(ctx.handle == DRM_KERNEL_CONTEXT+1) + priv->remove_auth_on_close = 1; +*/ + if(ctx.handle != DRM_KERNEL_CONTEXT ) { drm_ctxbitmap_free(dev, ctx.handle); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c index 7055d28da..85c29df7e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c @@ -130,7 +130,6 @@ static int mga_freelist_init(drm_device_t *dev) item->buf = buf; buf_priv->my_freelist = item; buf_priv->discard = 0; - buf_priv->dispatched = 0; dev_priv->head->next = item; } @@ -176,7 +175,7 @@ static __inline void mga_dma_quiescent(drm_device_t *dev) atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); DRM_ERROR("lockup\n"); - goto out_nolock; + return; } for (i = 0 ; i < 2000 ; i++) mga_delay(); } @@ -188,15 +187,15 @@ static __inline void mga_dma_quiescent(drm_device_t *dev) atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); DRM_ERROR("lockup\n"); - goto out_status; + clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); + return; } for (i = 0 ; i < 2000 ; i++) mga_delay(); } sarea_priv->dirty |= MGA_DMA_FLUSH; -out_status: clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); -out_nolock: + DRM_DEBUG("exit, dispatch_status = 0x%02x\n",dev_priv->dispatch_status); } static void mga_reset_freelist(drm_device_t *dev) @@ -236,20 +235,22 @@ drm_buf_t *mga_freelist_get(drm_device_t *dev) set_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); for (;;) { mga_dma_schedule(dev, 0); - if(!test_bit(MGA_IN_GETBUF, - &dev_priv->dispatch_status)) +/* if(!test_bit(MGA_IN_GETBUF, + &dev_priv->dispatch_status)) */ + if(dev_priv->tail->age < dev_priv->last_prim_age) break; atomic_inc(&dev->total_sleeps); ret = tsleep(&dev_priv->buf_queue, PZERO|PCATCH, "mgafg", 0); - if (ret) { + if (ret == EINTR) { clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); - splx(s); - goto failed_getbuf; + break; } } splx(s); + clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); + if (ret) return NULL; } if(dev_priv->tail->age < dev_priv->last_prim_age) { @@ -263,7 +264,6 @@ drm_buf_t *mga_freelist_get(drm_device_t *dev) return next->buf; } -failed_getbuf: failed++; return NULL; } @@ -520,61 +520,55 @@ int mga_advance_primary(drm_device_t *dev) static __inline int mga_decide_to_fire(drm_device_t *dev) { drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_device_dma_t *dma = dev->dma; DRM_DEBUG("%s\n", __FUNCTION__); if(test_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status)) { - atomic_inc(&dma->total_prio); return 1; } if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && dev_priv->next_prim->num_dwords) { - atomic_inc(&dma->total_prio); return 1; } if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && dev_priv->next_prim->num_dwords) { - atomic_inc(&dma->total_prio); return 1; } if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS - 1) { if(test_bit(MGA_BUF_SWAP_PENDING, &dev_priv->next_prim->buffer_status)) { - atomic_inc(&dma->total_dmas); return 1; } } if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS / 2) { if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 8) { - atomic_inc(&dma->total_hit); return 1; } } if(atomic_read(&dev_priv->pending_bufs) >= MGA_NUM_PRIM_BUFS / 2) { if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 4) { - atomic_inc(&dma->total_missed_free); return 1; } } - atomic_inc(&dma->total_tried); return 0; } int mga_dma_schedule(drm_device_t *dev, int locked) { drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_device_dma_t *dma = dev->dma; + int retval =0 ; + + if (!dev_priv) return EBUSY; if (test_and_set_bit(0, &dev->dma_flag)) { - atomic_inc(&dma->total_missed_dma); - return EBUSY; + retval = EBUSY; + goto sch_out_wakeup; } DRM_DEBUG("%s\n", __FUNCTION__); @@ -591,17 +585,15 @@ int mga_dma_schedule(drm_device_t *dev, int locked) if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { - atomic_inc(&dma->total_missed_lock); clear_bit(0, &dev->dma_flag); DRM_DEBUG("Not locked\n"); - return EBUSY; + retval = EBUSY; + goto sch_out_wakeup; } - DRM_DEBUG("I'm locked\n"); if(!test_and_set_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status)) { /* Fire dma buffer */ if(mga_decide_to_fire(dev)) { - DRM_DEBUG("idx :%d\n", dev_priv->next_prim->idx); clear_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status); if(dev_priv->current_prim == dev_priv->next_prim) { @@ -613,8 +605,6 @@ int mga_dma_schedule(drm_device_t *dev, int locked) } else { clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); } - } else { - DRM_DEBUG("I can't get the dispatch lock\n"); } if (!locked) { @@ -623,9 +613,9 @@ int mga_dma_schedule(drm_device_t *dev, int locked) DRM_ERROR("\n"); } } - + clear_bit(0, &dev->dma_flag); +sch_out_wakeup: if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords == 0 && atomic_read(&dev_priv->pending_bufs) == 0) { /* Everything has been processed by the hardware */ clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); @@ -633,18 +623,10 @@ int mga_dma_schedule(drm_device_t *dev, int locked) } if(test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && - dev_priv->tail->age < dev_priv->last_prim_age) { - clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); - DRM_DEBUG("Waking up buf queue\n"); + dev_priv->tail->age < dev_priv->last_prim_age) wakeup(&dev_priv->buf_queue); - } else if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) { - DRM_DEBUG("Not waking buf_queue on %d %d\n", - atomic_read(&dev->total_irq), - dev_priv->last_prim_age); - } - clear_bit(0, &dev->dma_flag); - return 0; + return retval; } static void mga_dma_service(void *arg) @@ -653,7 +635,6 @@ static void mga_dma_service(void *arg) drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; drm_mga_prim_buf_t *last_prim_buffer; - DRM_DEBUG("%s\n", __FUNCTION__); atomic_inc(&dev->total_irq); if((MGA_READ(MGAREG_STATUS) & 0x00000001) != 0x00000001) return; MGA_WRITE(MGAREG_ICLEAR, 0x00000001); @@ -663,11 +644,11 @@ static void mga_dma_service(void *arg) dev_priv->sarea_priv->last_dispatch = dev_priv->last_prim_age = last_prim_buffer->prim_age; clear_bit(MGA_BUF_IN_USE, &last_prim_buffer->buffer_status); - wakeup(&dev_priv->wait_queue); clear_bit(MGA_BUF_SWAP_PENDING, &last_prim_buffer->buffer_status); clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); atomic_dec(&dev_priv->pending_bufs); taskqueue_enqueue(taskqueue_swi, &dev->task); + wakeup(&dev_priv->wait_queue); } static void mga_dma_task_queue(void *device, int pending) @@ -684,6 +665,8 @@ int mga_dma_cleanup(drm_device_t *dev) drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; + if (dev->irq) mga_flush_queue(dev); + mga_dma_quiescent(dev); if(dev_priv->ioremap) { int temp = (dev_priv->warp_ucode_size + dev_priv->primary_size + @@ -723,9 +706,6 @@ int mga_dma_cleanup(drm_device_t *dev) static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) { drm_mga_private_t *dev_priv; drm_map_t *sarea_map = NULL; - int i; - - DRM_DEBUG("%s\n", __FUNCTION__); dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); if(dev_priv == NULL) return ENOMEM; @@ -760,8 +740,8 @@ static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) { dev_priv->mAccess = init->mAccess; dev_priv->flush_queue = 0; - dev_priv->buf_queue = 0; - dev_priv->WarpPipe = -1; + dev_priv->WarpPipe = 0xff000000; + dev_priv->vertexsize = 0; DRM_DEBUG("chipset: %d ucode_size: %d backOffset: %x depthOffset: %x\n", dev_priv->chipset, dev_priv->warp_ucode_size, @@ -773,13 +753,6 @@ static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) { memcpy(&dev_priv->WarpIndex, &init->WarpIndex, sizeof(drm_mga_warp_index_t) * MGA_MAX_WARP_PIPES); - for (i = 0 ; i < MGA_MAX_WARP_PIPES ; i++) - DRM_DEBUG("warp pipe %d: installed: %d phys: %lx size: %x\n", - i, - dev_priv->WarpIndex[i].installed, - dev_priv->WarpIndex[i].phys_addr, - dev_priv->WarpIndex[i].size); - if(mga_init_primary_bufs(dev, init) != 0) { DRM_ERROR("Can not initialize primary buffers\n"); mga_dma_cleanup(dev); @@ -951,9 +924,7 @@ static int mga_flush_queue(drm_device_t *dev) DRM_DEBUG("%s\n", __FUNCTION__); - if(dev_priv == NULL) { - return 0; - } + if(!dev_priv) return 0; if(dev_priv->next_prim->num_dwords != 0) { s = splsofttq(); @@ -1065,7 +1036,7 @@ int mga_lock(dev_t kdev, u_long cmd, caddr_t data, } } - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); + if (ret) DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); return ret; } @@ -1086,16 +1057,16 @@ int mga_flush_ioctl(dev_t kdev, u_long cmd, caddr_t data, } if(lock.flags & _DRM_LOCK_FLUSH || lock.flags & _DRM_LOCK_FLUSH_ALL) { - drm_mga_prim_buf_t *temp_buf = - dev_priv->prim_bufs[dev_priv->current_prim_idx]; + drm_mga_prim_buf_t *temp_buf; + temp_buf = dev_priv->current_prim; - if(temp_buf && temp_buf->num_dwords) { s = splsofttq(); + if(temp_buf && temp_buf->num_dwords) { set_bit(MGA_BUF_FORCE_FIRE, &temp_buf->buffer_status); mga_advance_primary(dev); + } mga_dma_schedule(dev, 1); splx(s); - } } if(lock.flags & _DRM_LOCK_QUIESCENT) { mga_flush_queue(dev); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c index 099372012..77d7c4409 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c @@ -40,8 +40,8 @@ MODULE_DEPEND(mga, agp, 1, 1, 1); #define MGA_NAME "mga" #define MGA_DESC "Matrox g200/g400" -#define MGA_DATE "19991213" -#define MGA_MAJOR 1 +#define MGA_DATE "20000928" +#define MGA_MAJOR 2 #define MGA_MINOR 0 #define MGA_PATCHLEVEL 0 diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h index 05c4d9d2e..9e51a20d0 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h @@ -39,8 +39,8 @@ typedef struct { u_int32_t buffer_status; - unsigned int num_dwords; - unsigned int max_dwords; + int num_dwords; + int max_dwords; u_int32_t *current_dma_ptr; u_int32_t *head; u_int32_t phys_head; @@ -50,7 +50,7 @@ typedef struct { } drm_mga_prim_buf_t; typedef struct _drm_mga_freelist { - unsigned int age; + __volatile__ unsigned int age; drm_buf_t *buf; struct _drm_mga_freelist *next; struct _drm_mga_freelist *prev; @@ -82,6 +82,7 @@ typedef struct _drm_mga_private { int use_agp; drm_mga_warp_index_t WarpIndex[MGA_MAX_G400_PIPES]; unsigned int WarpPipe; + unsigned int vertexsize; atomic_t pending_bufs; void *status_page; unsigned long real_status_page; @@ -191,12 +192,20 @@ typedef struct { &tmp_buf->buffer_status)) { \ mga_advance_primary(dev); \ mga_dma_schedule(dev, 1); \ + tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ } else if( tmp_buf->max_dwords - tmp_buf->num_dwords < length ||\ tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \ set_bit(MGA_BUF_FORCE_FIRE, &tmp_buf->buffer_status); \ mga_advance_primary(dev); \ mga_dma_schedule(dev, 1); \ + tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ } \ + if(MGA_VERBOSE) \ + DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \ + dma_ptr = tmp_buf->current_dma_ptr; \ + num_dwords = tmp_buf->num_dwords; \ + phys_head = tmp_buf->phys_head; \ + outcount = 0; \ } while(0) #define PRIMGETPTR(dev_priv) do { \ @@ -344,6 +353,73 @@ drm_mga_prim_buf_t *tmp_buf = \ #define MGAREG_YTOP 0x1c98 #define MGAREG_ZORG 0x1c0c +/* Warp registers */ +#define MGAREG_WR0 0x2d00 +#define MGAREG_WR1 0x2d04 +#define MGAREG_WR2 0x2d08 +#define MGAREG_WR3 0x2d0c +#define MGAREG_WR4 0x2d10 +#define MGAREG_WR5 0x2d14 +#define MGAREG_WR6 0x2d18 +#define MGAREG_WR7 0x2d1c +#define MGAREG_WR8 0x2d20 +#define MGAREG_WR9 0x2d24 +#define MGAREG_WR10 0x2d28 +#define MGAREG_WR11 0x2d2c +#define MGAREG_WR12 0x2d30 +#define MGAREG_WR13 0x2d34 +#define MGAREG_WR14 0x2d38 +#define MGAREG_WR15 0x2d3c +#define MGAREG_WR16 0x2d40 +#define MGAREG_WR17 0x2d44 +#define MGAREG_WR18 0x2d48 +#define MGAREG_WR19 0x2d4c +#define MGAREG_WR20 0x2d50 +#define MGAREG_WR21 0x2d54 +#define MGAREG_WR22 0x2d58 +#define MGAREG_WR23 0x2d5c +#define MGAREG_WR24 0x2d60 +#define MGAREG_WR25 0x2d64 +#define MGAREG_WR26 0x2d68 +#define MGAREG_WR27 0x2d6c +#define MGAREG_WR28 0x2d70 +#define MGAREG_WR29 0x2d74 +#define MGAREG_WR30 0x2d78 +#define MGAREG_WR31 0x2d7c +#define MGAREG_WR32 0x2d80 +#define MGAREG_WR33 0x2d84 +#define MGAREG_WR34 0x2d88 +#define MGAREG_WR35 0x2d8c +#define MGAREG_WR36 0x2d90 +#define MGAREG_WR37 0x2d94 +#define MGAREG_WR38 0x2d98 +#define MGAREG_WR39 0x2d9c +#define MGAREG_WR40 0x2da0 +#define MGAREG_WR41 0x2da4 +#define MGAREG_WR42 0x2da8 +#define MGAREG_WR43 0x2dac +#define MGAREG_WR44 0x2db0 +#define MGAREG_WR45 0x2db4 +#define MGAREG_WR46 0x2db8 +#define MGAREG_WR47 0x2dbc +#define MGAREG_WR48 0x2dc0 +#define MGAREG_WR49 0x2dc4 +#define MGAREG_WR50 0x2dc8 +#define MGAREG_WR51 0x2dcc +#define MGAREG_WR52 0x2dd0 +#define MGAREG_WR53 0x2dd4 +#define MGAREG_WR54 0x2dd8 +#define MGAREG_WR55 0x2ddc +#define MGAREG_WR56 0x2de0 +#define MGAREG_WR57 0x2de4 +#define MGAREG_WR58 0x2de8 +#define MGAREG_WR59 0x2dec +#define MGAREG_WR60 0x2df0 +#define MGAREG_WR61 0x2df4 +#define MGAREG_WR62 0x2df8 +#define MGAREG_WR63 0x2dfc + + #define PDEA_pagpxfer_enable 0x2 #define WIA_wmode_suspend 0x0 diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c index 73029bbe1..fb3656310 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c @@ -37,6 +37,20 @@ typedef u_int16_t u16; typedef u_int32_t u32; +#define MGAEMITCLIP_SIZE 10 +#define MGAEMITCTX_SIZE 20 +#define MGAG200EMITTEX_SIZE 20 +#define MGAG400EMITTEX0_SIZE 30 +#define MGAG400EMITTEX1_SIZE 25 +#define MGAG400EMITPIPE_SIZE 50 +#define MGAG200EMITPIPE_SIZE 15 + +#define MAX_STATE_SIZE ((MGAEMITCLIP_SIZE * MGA_NR_SAREA_CLIPRECTS) + \ + MGAEMITCTX_SIZE + MGAG400EMITTEX0_SIZE + \ + MGAG400EMITTEX1_SIZE + MGAG400EMITPIPE_SIZE) + + + static void mgaEmitClipRect(drm_mga_private_t * dev_priv, drm_clip_rect_t * box) { @@ -49,6 +63,7 @@ static void mgaEmitClipRect(drm_mga_private_t * dev_priv, PRIMGETPTR(dev_priv); /* Force reset of dwgctl (eliminates clip disable) */ + if (dev_priv->chipset == MGA_CARD_TYPE_G400) { #if 0 PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DWGSYNC, 0); @@ -60,11 +75,11 @@ static void mgaEmitClipRect(drm_mga_private_t * dev_priv, PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000); #endif - + } PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_CXBNDRY, ((box->x2) << 16) | (box->x1)); - PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / 2); - PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / 2); + PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / dev_priv->cpp); + PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / dev_priv->cpp); PRIMADVANCE(dev_priv); } @@ -76,7 +91,7 @@ static void mgaEmitContext(drm_mga_private_t * dev_priv) PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - /* This takes a max of 15 dwords */ + /* This takes a max of 20 dwords */ PRIMGETPTR(dev_priv); PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]); @@ -94,6 +109,12 @@ static void mgaEmitContext(drm_mga_private_t * dev_priv) PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]); PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]); PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); + + PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]); + PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + } else { PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -128,9 +149,9 @@ static void mgaG200EmitTex(drm_mga_private_t * dev_priv) PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(0x2d00 + 24 * 4, regs[MGA_TEXREG_WIDTH]); + PRIMOUTREG(MGAREG_WR24, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(0x2d00 + 34 * 4, regs[MGA_TEXREG_HEIGHT]); + PRIMOUTREG(MGAREG_WR34, regs[MGA_TEXREG_HEIGHT]); PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -138,11 +159,12 @@ static void mgaG200EmitTex(drm_mga_private_t * dev_priv) PRIMADVANCE(dev_priv); } +#define TMC_dualtex_enable 0x80 + static void mgaG400EmitTex0(drm_mga_private_t * dev_priv) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->TexState[0]; - int multitex = sarea_priv->WarpPipe & MGA_T2; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -163,22 +185,21 @@ static void mgaG400EmitTex0(drm_mga_private_t * dev_priv) PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(0x2d00 + 49 * 4, 0); + PRIMOUTREG(MGAREG_WR49, 0); + + PRIMOUTREG(MGAREG_WR57, 0); + PRIMOUTREG(MGAREG_WR53, 0); + PRIMOUTREG(MGAREG_WR61, 0); + PRIMOUTREG(MGAREG_WR52, 0x40); - PRIMOUTREG(0x2d00 + 57 * 4, 0); - PRIMOUTREG(0x2d00 + 53 * 4, 0); - PRIMOUTREG(0x2d00 + 61 * 4, 0); + PRIMOUTREG(MGAREG_WR60, 0x40); + PRIMOUTREG(MGAREG_WR54, regs[MGA_TEXREG_WIDTH] | 0x40); + PRIMOUTREG(MGAREG_WR62, regs[MGA_TEXREG_HEIGHT] | 0x40); PRIMOUTREG(MGAREG_DMAPAD, 0); - if (!multitex) { - PRIMOUTREG(0x2d00 + 52 * 4, 0x40); - PRIMOUTREG(0x2d00 + 60 * 4, 0x40); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); - } - PRIMOUTREG(0x2d00 + 54 * 4, regs[MGA_TEXREG_WIDTH] | 0x40); - PRIMOUTREG(0x2d00 + 62 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40); PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); @@ -212,14 +233,15 @@ static void mgaG400EmitTex1(drm_mga_private_t * dev_priv) PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(0x2d00 + 49 * 4, 0); + PRIMOUTREG(MGAREG_WR49, 0); + + PRIMOUTREG(MGAREG_WR57, 0); + PRIMOUTREG(MGAREG_WR53, 0); + PRIMOUTREG(MGAREG_WR61, 0); + PRIMOUTREG(MGAREG_WR52, regs[MGA_TEXREG_WIDTH] | 0x40); - PRIMOUTREG(0x2d00 + 57 * 4, 0); - PRIMOUTREG(0x2d00 + 53 * 4, 0); - PRIMOUTREG(0x2d00 + 61 * 4, 0); - PRIMOUTREG(0x2d00 + 52 * 4, regs[MGA_TEXREG_WIDTH] | 0x40); + PRIMOUTREG(MGAREG_WR60, regs[MGA_TEXREG_HEIGHT] | 0x40); - PRIMOUTREG(0x2d00 + 60 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40); PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); @@ -227,12 +249,17 @@ static void mgaG400EmitTex1(drm_mga_private_t * dev_priv) PRIMADVANCE(dev_priv); } +#define MAGIC_FPARAM_HEX_VALUE 0x46480000 +/* This is the hex value of 12800.0f which is a magic value we must + * set in wr56. + */ + + #define EMIT_PIPE 50 static void mgaG400EmitPipe(drm_mga_private_t * dev_priv) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int pipe = sarea_priv->WarpPipe; - float fParam = 12800.0f; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -266,14 +293,14 @@ static void mgaG400EmitPipe(drm_mga_private_t * dev_priv) PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); - PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000); PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000); + PRIMOUTREG(MGAREG_DMAPAD, 0); } PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807); @@ -289,18 +316,20 @@ static void mgaG400EmitPipe(drm_mga_private_t * dev_priv) PRIMOUTREG(MGAREG_WFLAG, 0); PRIMOUTREG(MGAREG_WFLAG1, 0); - PRIMOUTREG(0x2d00 + 56 * 4, *((u32 *) (&fParam))); + PRIMOUTREG(MGAREG_WR56, MAGIC_FPARAM_HEX_VALUE); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(0x2d00 + 49 * 4, 0); /* Tex stage 0 */ - PRIMOUTREG(0x2d00 + 57 * 4, 0); /* Tex stage 0 */ - PRIMOUTREG(0x2d00 + 53 * 4, 0); /* Tex stage 1 */ - PRIMOUTREG(0x2d00 + 61 * 4, 0); /* Tex stage 1 */ + PRIMOUTREG(MGAREG_WR49, 0); /* Tex stage 0 */ + PRIMOUTREG(MGAREG_WR57, 0); /* Tex stage 0 */ + PRIMOUTREG(MGAREG_WR53, 0); /* Tex stage 1 */ + PRIMOUTREG(MGAREG_WR61, 0); /* Tex stage 1 */ + + + PRIMOUTREG(MGAREG_WR54, 0x40); /* Tex stage 0 : w */ + PRIMOUTREG(MGAREG_WR62, 0x40); /* Tex stage 0 : h */ + PRIMOUTREG(MGAREG_WR52, 0x40); /* Tex stage 1 : w */ + PRIMOUTREG(MGAREG_WR60, 0x40); /* Tex stage 1 : h */ - PRIMOUTREG(0x2d00 + 54 * 4, 0x40); /* Tex stage 0 : w */ - PRIMOUTREG(0x2d00 + 62 * 4, 0x40); /* Tex stage 0 : h */ - PRIMOUTREG(0x2d00 + 52 * 4, 0x40); /* Tex stage 1 : w */ - PRIMOUTREG(0x2d00 + 60 * 4, 0x40); /* Tex stage 1 : h */ /* Dma pading required due to hw bug */ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); @@ -326,12 +355,12 @@ static void mgaG200EmitPipe(drm_mga_private_t * dev_priv) PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend); PRIMOUTREG(MGAREG_WVRTXSZ, 7); PRIMOUTREG(MGAREG_WFLAG, 0); - PRIMOUTREG(0x2d00 + 24 * 4, 0); /* tex w/h */ + PRIMOUTREG(MGAREG_WR24, 0); /* tex w/h */ - PRIMOUTREG(0x2d00 + 25 * 4, 0x100); - PRIMOUTREG(0x2d00 + 34 * 4, 0); /* tex w/h */ - PRIMOUTREG(0x2d00 + 42 * 4, 0xFFFF); - PRIMOUTREG(0x2d00 + 60 * 4, 0xFFFF); + PRIMOUTREG(MGAREG_WR25, 0x100); + PRIMOUTREG(MGAREG_WR34, 0); /* tex w/h */ + PRIMOUTREG(MGAREG_WR42, 0xFFFF); + PRIMOUTREG(MGAREG_WR60, 0xFFFF); /* Dma pading required due to hw bug */ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); @@ -495,7 +524,6 @@ static void mga_dma_dispatch_tex_blit(drm_device_t * dev, y2 = length / 64; PRIM_OVERFLOW(dev, dev_priv, 30); - PRIMGETPTR(dev_priv); PRIMOUTREG(MGAREG_DSTORG, destOrg); PRIMOUTREG(MGAREG_MACCESS, 0x00000000); @@ -513,10 +541,11 @@ static void mga_dma_dispatch_tex_blit(drm_device_t * dev, PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16)); PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2); + PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_SRCORG, 0); PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + PRIMADVANCE(dev_priv); } @@ -529,7 +558,6 @@ static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) int length = buf->used; int use_agp = PDEA_pagpxfer_enable; int i = 0; - int primary_needed; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -545,11 +573,16 @@ static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; - primary_needed = (50 + 15 + 15 + 30 + 25 + - 10 + 15 * MGA_NR_SAREA_CLIPRECTS); - PRIM_OVERFLOW(dev, dev_priv, primary_needed); + PRIM_OVERFLOW(dev, dev_priv, + (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); mgaEmitState(dev_priv); +#if 0 + length = dev_priv->vertexsize * 3 * 4; +#endif + + + do { if (i < sarea_priv->nbox) { DRM_DEBUG("idx %d Emit box %d/%d:" @@ -597,7 +630,6 @@ static void mga_dma_dispatch_indices(drm_device_t * dev, unsigned int address = (unsigned int) buf->bus_address; int use_agp = PDEA_pagpxfer_enable; int i = 0; - int primary_needed; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -611,9 +643,9 @@ static void mga_dma_dispatch_indices(drm_device_t * dev, * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; - primary_needed = (50 + 15 + 15 + 30 + 25 + - 10 + 15 * MGA_NR_SAREA_CLIPRECTS); - PRIM_OVERFLOW(dev, dev_priv, primary_needed); + PRIM_OVERFLOW(dev, dev_priv, + (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); + mgaEmitState(dev_priv); do { @@ -639,6 +671,7 @@ static void mga_dma_dispatch_indices(drm_device_t * dev, SETADD_mode_vertlist)); PRIMOUTREG(MGAREG_SETUPEND, ((address + end) | use_agp)); + PRIMADVANCE(dev_priv); } while (++i < sarea_priv->nbox); } @@ -653,7 +686,10 @@ static void mga_dma_dispatch_indices(drm_device_t * dev, static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, unsigned int clear_color, - unsigned int clear_zval) + unsigned int clear_zval, + unsigned int clear_colormask, + unsigned int clear_depthmask) + { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; @@ -662,7 +698,6 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, drm_clip_rect_t *pbox = sarea_priv->boxes; unsigned int cmd; int i; - int primary_needed; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -671,11 +706,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, else cmd = MGA_CLEAR_CMD | DC_atype_rstr; - primary_needed = nbox * 70; - if (primary_needed == 0) - primary_needed = 70; - PRIM_OVERFLOW(dev, dev_priv, primary_needed); - PRIMGETPTR(dev_priv); + PRIM_OVERFLOW(dev, dev_priv, 35 * MGA_NR_SAREA_CLIPRECTS); for (i = 0; i < nbox; i++) { unsigned int height = pbox[i].y2 - pbox[i].y1; @@ -687,7 +718,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, if (flags & MGA_FRONT) { DRM_DEBUG("clear front\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_colormask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -702,7 +733,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, if (flags & MGA_BACK) { DRM_DEBUG("clear back\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_colormask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -717,7 +748,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, if (flags & MGA_DEPTH) { DRM_DEBUG("clear depth\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_depthmask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -746,31 +777,32 @@ static void mga_dma_dispatch_swap(drm_device_t * dev) int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; int i; - int primary_needed; + int pixel_stride = dev_priv->stride / dev_priv->cpp; + PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - primary_needed = nbox * 5; - primary_needed += 60; - PRIM_OVERFLOW(dev, dev_priv, primary_needed); - PRIMGETPTR(dev_priv); + PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20); + + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7100); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess); PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset); - PRIMOUTREG(MGAREG_AR5, dev_priv->stride / 2); + PRIMOUTREG(MGAREG_AR5, pixel_stride); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); + for (i = 0; i < nbox; i++) { unsigned int h = pbox[i].y2 - pbox[i].y1; - unsigned int start = pbox[i].y1 * dev_priv->stride / 2; - - DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", - pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2); + unsigned int start = pbox[i].y1 * pixel_stride; PRIMOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1); PRIMOUTREG(MGAREG_AR3, start + pbox[i].x1); @@ -814,7 +846,10 @@ int mga_clear_bufs(dev_t kdev, u_long cmd, caddr_t data, */ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; mga_dma_dispatch_clear(dev, clear.flags, - clear.clear_color, clear.clear_depth); + clear.clear_color, + clear.clear_depth, + clear.clear_color_mask, + clear.clear_depth_mask); PRIMUPDATE(dev_priv); mga_flush_write_combine(); s = splsofttq(); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile index 471a5fbfd..4362a5ba4 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile @@ -3,7 +3,7 @@ KMOD = tdfx SRCS = tdfx_drv.c tdfx_context.c SRCS += device_if.h bus_if.h pci_if.h -CFLAGS += ${DEBUG_FLAGS} -I.. +CFLAGS += ${DEBUG_FLAGS} -I. -I.. KMODDEPS = drm @: diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c index 91e7d5603..202df7c34 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c @@ -42,7 +42,7 @@ MODULE_DEPEND(tdfx, agp, 1, 1, 1); #define TDFX_NAME "tdfx" #define TDFX_DESC "tdfx" -#define TDFX_DATE "19991009" +#define TDFX_DATE "20000928" #define TDFX_MAJOR 1 #define TDFX_MINOR 0 #define TDFX_PATCHLEVEL 0 @@ -64,6 +64,9 @@ static int tdfx_probe(device_t dev) case 0x0005121a: s = "3Dfx Voodoo 3 graphics accelerator"; break; + case 0x0009121a: + s = "3Dfx Voodoo 5 graphics accelerator"; + break; } if (s) { 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 5fe6fa30a..c849eb7c5 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.43 2001/01/06 20:19:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.45 2001/03/25 05:32:13 tsi Exp $ */ /* * Pci.c - New server PCI access functions * @@ -559,7 +559,7 @@ pciGetBaseSize(PCITAG tag, int index, Bool destructive, Bool *min) else mask1 = PCIGETIO(mask1); else - mask1 = PCIGETROM(mask1); + mask1 = PCIGETROM(mask1); if (mask1 == 0) return 0; bits = 0; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel index 9fe0038fc..a39b3cc51 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel @@ -62,7 +62,7 @@ obj-$(CONFIG_DRM_MGA) += mga.o obj-$(CONFIG_DRM_I810) += i810.o -# When linking into the kernel, link the library just once. +# When linking into the kernel, link the library just once. # If making modules, we include the library into each module lib-objs-mod := $(patsubst %.o,%-mod.o,$(lib-objs)) @@ -75,7 +75,7 @@ endif include $(TOPDIR)/Rules.make -$(patsubst %.o,%.c,$(lib-objs-mod)): +$(patsubst %.o,%.c,$(lib-objs-mod)): @ln -sf $(subst -mod,,$@) $@ drmlib-mod.a: $(lib-objs-mod) 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 9cea44db6..470c25b38 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 @@ -23,7 +23,7 @@ # 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. -# +# # # ***** NOTE NOTE NOTE NOTE NOTE ***** # To override the automatic Linux source tree determination, pass the @@ -47,32 +47,34 @@ # **** End of SMP/MODVERSIONS detection -MODS= gamma.o tdfx.o r128.o radeon.o -LIBS= libdrm.a +MODS = gamma.o tdfx.o +LIBS = -DRMOBJS= init.o memory.o proc.o auth.o context.o drawable.o bufs.o \ - lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o -DRMHEADERS= drm.h drmP.h compat-pre24.h +DRMTEMPLATES = drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \ + drm_drv.h drm_fops.h drm_init.h drm_ioctl.h drm_lists.h \ + drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h +DRMHEADERS = drm.h drmP.h compat-pre24.h -GAMMAOBJS= gamma_drv.o gamma_dma.o -GAMMAHEADERS= gamma_drv.h $(DRMHEADERS) +GAMMAOBJS = gamma_drv.o gamma_dma.o +GAMMAHEADERS = gamma_drv.h $(DRMHEADERS) $(DRMTEMPLATES) -TDFXOBJS= tdfx_drv.o tdfx_context.o -TDFXHEADERS= tdfx_drv.h $(DRMHEADERS) +TDFXOBJS = tdfx_drv.o +TDFXHEADERS = tdfx.h $(DRMHEADERS) -INC= /usr/include +INC = /usr/include -CFLAGS= -O2 $(WARNINGS) -WARNINGS= -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \ +CFLAGS = -O2 $(WARNINGS) +WARNINGS = -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \ -Wstrict-prototypes -Wnested-externs \ -Wpointer-arith # -Wshadow -Winline -- make output too noisy -MODCFLAGS= $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer -PRGCFLAGS= $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \ +MODCFLAGS = $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer +PRGCFLAGS = $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \ -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \ -I../../../../../../include -I../../../../../../../../include \ - -I../../../../../../../../programs/Xserver/hw/xfree86/common -PRGLIBS= + -I../../../../../../../../programs/Xserver/hw/xfree86/common \ + -I. -I../../.. -I../../../../../../../../lib/X11 +PRGLIBS = # **** Start of SMP/MODVERSIONS detection @@ -128,25 +130,29 @@ endif ifeq ($(AGP),1) MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE -DRMOBJS += agpsupport.o -MODS += mga.o +DRMTEMPLATES += drm_agpsupport.h +DRMHEADERS += agpsupport-pre24.h +MODS += mga.o r128.o radeon.o ifeq ($(MACHINE),i386) MODS += i810.o endif +ifeq ($(MACHINE),i686) +MODS += i810.o +endif -MGAOBJS= mga_drv.o mga_dma.o mga_bufs.o mga_context.o mga_state.o -MGAHEADERS= mga_drv.h $(DRMHEADERS) +MGAOBJS = mga_drv.o mga_dma.o mga_state.o mga_warp.o +MGAHEADERS = mga.h mga_drv.h mga_drm.h $(DRMHEADERS) $(DRMTEMPLATES) -I810OBJS= i810_drv.o i810_dma.o i810_bufs.o i810_context.o -I810HEADERS= i810_drv.h $(DRMHEADERS) +I810OBJS = i810_drv.o i810_dma.o +I810HEADERS = i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES) -R128OBJS= r128_drv.o r128_cce.o r128_bufs.o r128_context.o r128_state.o -R128HEADERS= r128_drv.h r128_drm.h $(DRMHEADERS) +R128OBJS = r128_drv.o r128_cce.o r128_state.o +R128HEADERS = r128.h r128_drv.h r128_drm.h $(DRMHEADERS) $(DRMTEMPLATES) -RADEONOBJS= radeon_drv.o radeon_cp.o radeon_bufs.o radeon_context.o \ - radeon_state.o -RADEONHEADERS= radeon_drv.h radeon_drm.h $(DRMHEADERS) +RADEONOBJS = radeon_drv.o radeon_cp.o radeon_state.o +RADEONHEADERS = radeon.h radeon_drv.h radeon_drm.h $(DRMHEADERS) \ + $(DRMTEMPLATES) endif ifeq ($(SIS),1) @@ -167,6 +173,9 @@ all::;@echo === KERNEL HEADERS IN $(TREE) all::;@echo === SMP=${SMP} MODULES=${MODULES} MODVERSIONS=${MODVERSIONS} AGP=${AGP} all::;@echo === kill_fasync has $(PARAMS) parameters all::;@echo === Compiling for machine $(MACHINE) +all::;@echo === WARNING +all::;@echo === WARNING 2.4.0 kernels before 2.4.0-test11 DO NOT WORK +all::;@echo === WARNING ifeq ($(MODULES),0) all::;@echo @@ -193,13 +202,12 @@ endif # **** End of configuration -libdrm.a: $(DRMOBJS) - -$(RM) -f $@ - $(AR) rcs $@ $(DRMOBJS) +dristat: dristat.c + $(CC) $(PRGCFLAGS) $< -o $@ gamma_drv.o: gamma_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ -gamma.o: $(GAMMAOBJS) $(LIBS) +gamma.o: $(GAMMAOBJS) $(LD) -r $^ -o $@ tdfx_drv.o: tdfx_drv.c @@ -213,7 +221,7 @@ sis.o: $(SISOBJS) $(LIBS) ifeq ($(AGP),1) mga_drv.o: mga_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ -mga.o: $(MGAOBJS) $(LIBS) +mga.o: $(MGAOBJS) $(LD) -r $^ -o $@ i810_drv.o: i810_drv.c @@ -245,7 +253,6 @@ ChangeLog: %.o: %.c $(CC) $(MODCFLAGS) -I$(TREE) -c $< -o $@ -$(DRMOBJS): $(DRMHEADERS) $(GAMMAOBJS): $(GAMMAHEADERS) $(TDFXOBJS): $(TDFXHEADERS) ifeq ($(AGP),1) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h index f6dae008d..0ad96b12a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h @@ -45,6 +45,7 @@ /* This is a hack that only works for this code base -- because we always call this with dev->tq.* */ +#undef INIT_LIST_HEAD #define INIT_LIST_HEAD(pointer) dev->tq.next = NULL #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c new file mode 100644 index 000000000..47193ab46 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c @@ -0,0 +1,280 @@ +/* dristat.c -- + * Created: Mon Jan 15 05:05:07 2001 by faith@acm.org + * + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * 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@valinux.com> + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include "../../../xf86drm.h" +#include "../xf86drmRandom.c" +#include "../xf86drmHash.c" +#include "../xf86drm.c" + +#define DRM_VERSION 0x00000001 +#define DRM_MEMORY 0x00000002 +#define DRM_CLIENTS 0x00000004 +#define DRM_STATS 0x00000008 +#define DRM_BUSID 0x00000010 + +static void getversion(int fd) +{ + drmVersionPtr version; + + version = drmGetVersion(fd); + if (version) { + printf(" Version information:\n"); + printf(" Name: %s\n", version->name ? version->name : "?"); + printf(" Version: %d.%d.%d\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + printf(" Date: %s\n", version->date ? version->date : "?"); + printf(" Desc: %s\n", version->desc ? version->desc : "?"); + drmFreeVersion(version); + } else { + printf(" No version information available\n"); + } +} + +static void getbusid(int fd) +{ + const char *busid = drmGetBusid(fd); + + printf(" Busid: %s\n", *busid ? busid : "(not set)"); + drmFreeBusid(busid); +} + +#if 0 +typedef struct { + unsigned long offset; /* Requested physical address (0 for SAREA)*/ + unsigned long size; /* Requested physical size (bytes) */ + drm_map_type_t type; /* Type of memory to map */ + drm_map_flags_t flags; /* Flags */ + void *handle; /* User-space: "Handle" to pass to mmap */ + /* Kernel-space: kernel-virtual address */ + int mtrr; /* MTRR slot used */ + /* Private data */ +} drmVmRec, *drmVmPtr; +#endif + +static void getvm(int fd) +{ + int i; + const char *typename; + char flagname[33]; + drmHandle offset; + drmSize size; + drmMapType type; + drmMapFlags flags; + drmHandle handle; + int mtrr; + + printf(" VM map information (Restricted locked kernel WC Lock):\n"); + printf(" slot offset size type flags address mtrr\n"); + + for (i = 0; + !drmGetMap(fd, i, &offset, &size, &type, &flags, &handle, &mtrr); + i++) { + + switch (type) { + case DRM_FRAME_BUFFER: typename = "FB"; break; + case DRM_REGISTERS: typename = "REG"; break; + case DRM_SHM: typename = "SHM"; break; + case DRM_AGP: typename = "AGP"; break; + default: typename = "???"; break; + } + + flagname[0] = (flags & DRM_RESTRICTED) ? 'R' : ' '; + flagname[1] = (flags & DRM_READ_ONLY) ? 'r' : 'w'; + flagname[2] = (flags & DRM_LOCKED) ? 'l' : ' '; + flagname[3] = (flags & DRM_KERNEL) ? 'k' : ' '; + flagname[4] = (flags & DRM_WRITE_COMBINING) ? 'W' : ' '; + flagname[5] = (flags & DRM_CONTAINS_LOCK) ? 'L' : ' '; + flagname[6] = '\0'; + + printf(" %4d 0x%08lx 0x%08lx %3.3s %6.6s 0x%08lx ", + i, offset, (unsigned long)size, typename, flagname, handle); + if (mtrr < 0) printf("none\n"); + else printf("%4d\n", mtrr); + } +} + +static void getclients(int fd) +{ + int i; + int auth; + int pid; + int uid; + unsigned long magic; + unsigned long iocs; + char buf[64]; + char cmd[40]; + int procfd; + + printf(" DRI client information:\n"); + printf(" a pid uid magic ioctls prog\n"); + + for (i = 0; !drmGetClient(fd, i, &auth, &pid, &uid, &magic, &iocs); i++) { + sprintf(buf, "/proc/%d/cmdline", pid); + memset(cmd, sizeof(cmd), 0); + if ((procfd = open(buf, O_RDONLY, 0)) >= 0) { + read(procfd, cmd, sizeof(cmd)-1); + close(procfd); + } + if (*cmd) { + char *pt; + + for (pt = cmd; *pt; pt++) if (!isprint(*pt)) *pt = ' '; + printf(" %c %5d %5d %10lu %10lu %s\n", + auth ? 'y' : 'n', pid, uid, magic, iocs, cmd); + } else { + printf(" %c %5d %5d %10lu %10lu\n", + auth ? 'y' : 'n', pid, uid, magic, iocs); + } + } +} + +static void printhuman(unsigned long value, const char *name, int mult) +{ + const char *p; + double f; + /* Print width 5 number in width 6 space */ + if (value < 100000) { + printf(" %5lu", value); + return; + } + + p = name; + f = (double)value / (double)mult; + if (f < 10.0) { + printf(" %4.2f%c", f, *p); + return; + } + + p++; + f = (double)value / (double)mult; + if (f < 10.0) { + printf(" %4.2f%c", f, *p); + return; + } + + p++; + f = (double)value / (double)mult; + if (f < 10.0) { + printf(" %4.2f%c", f, *p); + return; + } +} + +static void getstats(int fd, int i) +{ + drmStatsT prev, curr; + int j; + double rate; + + printf(" System statistics:\n"); + + if (drmGetStats(fd, &prev)) return; + if (!i) { + for (j = 0; j < prev.count; j++) { + printf(" "); + printf(prev.data[j].long_format, prev.data[j].long_name); + if (prev.data[j].isvalue) printf(" 0x%08lx\n", prev.data[j].value); + else printf(" %10lu\n", prev.data[j].value); + } + return; + } + + printf(" "); + for (j = 0; j < prev.count; j++) + if (!prev.data[j].verbose) { + printf(" "); + printf(prev.data[j].rate_format, prev.data[j].rate_name); + } + printf("\n"); + + for (;;) { + sleep(i); + if (drmGetStats(fd, &curr)) return; + printf(" "); + for (j = 0; j < curr.count; j++) { + if (curr.data[j].verbose) continue; + if (curr.data[j].isvalue) { + printf(" %08lx", curr.data[j].value); + } else { + rate = (curr.data[j].value - prev.data[j].value) / (double)i; + printhuman(rate, curr.data[j].mult_names, curr.data[j].mult); + } + } + printf("\n"); + memcpy(&prev, &curr, sizeof(prev)); + } + +} + +int main(int argc, char **argv) +{ + int c; + int mask = 0; + int minor = 0; + int interval = 0; + int fd; + char buf[64]; + int i; + + while ((c = getopt(argc, argv, "avmcsbM:i:")) != EOF) + switch (c) { + case 'a': mask = ~0; break; + case 'v': mask |= DRM_VERSION; break; + case 'm': mask |= DRM_MEMORY; break; + case 'c': mask |= DRM_CLIENTS; break; + case 's': mask |= DRM_STATS; break; + case 'b': mask |= DRM_BUSID; break; + case 'i': interval = strtol(optarg, NULL, 0); break; + case 'M': minor = strtol(optarg, NULL, 0); break; + default: + fprintf( stderr, "Usage: dristat [options]\n" ); + return 1; + } + + for (i = 0; i < 16; i++) if (!minor || i == minor) { + sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i); + fd = drmOpenMinor(i, 1); + if (fd >= 0) { + printf("%s\n", buf); + if (mask & DRM_BUSID) getbusid(fd); + if (mask & DRM_VERSION) getversion(fd); + if (mask & DRM_MEMORY) getvm(fd); + if (mask & DRM_CLIENTS) getclients(fd); + if (mask & DRM_STATS) getstats(fd, interval); + close(fd); + } + } + + return 0; +} 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 dc3d262d4..f1abaabff 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 @@ -19,10 +19,10 @@ * 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 + * VA LINUX SYSTEMS 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. + * 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@valinux.com> @@ -36,6 +36,7 @@ #define _DRM_H_ #if defined(__linux__) +#include <linux/config.h> #include <asm/ioctl.h> /* For _IO* macros */ #define DRM_IOCTL_NR(n) _IOC_NR(n) #elif defined(__FreeBSD__) @@ -43,15 +44,8 @@ #define DRM_IOCTL_NR(n) ((n) & 0xff) #endif -#define DRM_PROC_DEVICES "/proc/devices" -#define DRM_PROC_MISC "/proc/misc" -#define DRM_PROC_DRM "/proc/drm" -#define DRM_DEV_DRM "/dev/drm" -#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) -#define DRM_DEV_UID 0 -#define DRM_DEV_GID 0 - - +#define DRM_MAJOR 226 +#define DRM_MAX_MINOR 15 #define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */ @@ -72,12 +66,20 @@ typedef unsigned int drm_magic_t; * XF86DRIClipRectRec in the server as well */ typedef struct drm_clip_rect { - unsigned short x1; - unsigned short y1; - unsigned short x2; - unsigned short y2; + unsigned short x1; + unsigned short y1; + unsigned short x2; + unsigned short y2; } drm_clip_rect_t; +typedef struct drm_tex_region { + unsigned char next; + unsigned char prev; + unsigned char in_use; + unsigned char padding; + unsigned int age; +} drm_tex_region_t; + /* Seperate include files for the i810/mga/r128 specific structures */ #include "mga_drm.h" #include "i810_drm.h" @@ -136,9 +138,15 @@ typedef enum drm_map_flags { _DRM_LOCKED = 0x04, /* shared, cached, locked */ _DRM_KERNEL = 0x08, /* kernel requires access */ _DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */ - _DRM_CONTAINS_LOCK = 0x20 /* SHM page that contains lock */ + _DRM_CONTAINS_LOCK = 0x20, /* SHM page that contains lock */ + _DRM_REMOVABLE = 0x40 /* Removable mapping */ } drm_map_flags_t; +typedef struct drm_ctx_priv_map { + unsigned int ctx_id; /* Context requesting private mapping */ + void *handle; /* Handle of map */ +} drm_ctx_priv_map_t; + typedef struct drm_map { unsigned long offset; /* Requested physical address (0 for SAREA)*/ unsigned long size; /* Requested physical size (bytes) */ @@ -150,6 +158,44 @@ typedef struct drm_map { /* Private data */ } drm_map_t; +typedef struct drm_client { + int idx; /* Which client desired? */ + int auth; /* Is client authenticated? */ + unsigned long pid; /* Process id */ + unsigned long uid; /* User id */ + unsigned long magic; /* Magic */ + unsigned long iocs; /* Ioctl count */ +} drm_client_t; + +typedef enum { + _DRM_STAT_LOCK, + _DRM_STAT_OPENS, + _DRM_STAT_CLOSES, + _DRM_STAT_IOCTLS, + _DRM_STAT_LOCKS, + _DRM_STAT_UNLOCKS, + _DRM_STAT_VALUE, /* Generic value */ + _DRM_STAT_BYTE, /* Generic byte counter (1024bytes/K) */ + _DRM_STAT_COUNT, /* Generic non-byte counter (1000/k) */ + + _DRM_STAT_IRQ, /* IRQ */ + _DRM_STAT_PRIMARY, /* Primary DMA bytes */ + _DRM_STAT_SECONDARY, /* Secondary DMA bytes */ + _DRM_STAT_DMA, /* DMA */ + _DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */ + _DRM_STAT_MISSED /* Missed DMA opportunity */ + + /* Add to the *END* of the list */ +} drm_stat_type_t; + +typedef struct drm_stats { + unsigned long count; + struct { + unsigned long value; + drm_stat_type_t type; + } data[15]; +} drm_stats_t; + typedef enum drm_lock_flags { _DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */ _DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */ @@ -309,6 +355,9 @@ typedef struct drm_agp_info { #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t) #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t) +#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t) +#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t) +#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t) @@ -322,6 +371,11 @@ typedef struct drm_agp_info { #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t) #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t) +#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t) + +#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t) +#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t) + #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t) @@ -345,17 +399,18 @@ typedef struct drm_agp_info { #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) -/* Mga specific ioctls */ +/* MGA specific ioctls */ #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) -#define DRM_IOCTL_MGA_SWAP DRM_IOW( 0x41, drm_mga_swap_t) -#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x42, drm_mga_clear_t) -#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x43, drm_mga_iload_t) -#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x44, drm_mga_vertex_t) -#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x45, drm_lock_t ) +#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) +#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42) +#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43) +#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t) +#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t) #define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) -#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x47, drm_mga_blit_t) +#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t) +#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t) -/* I810 specific ioctls */ +/* i810 specific ioctls */ #define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) #define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) #define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) @@ -395,7 +450,7 @@ typedef struct drm_agp_info { #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) #define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) -#define DRM_IOCTL_RADEON_BLIT DRM_IOW( 0x4b, drm_radeon_blit_t) +#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4b, drm_radeon_texture_t) #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h index affeae705..274e318aa 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h @@ -11,22 +11,22 @@ * 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 + * VA LINUX SYSTEMS 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. - * + * 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@valinux.com> - * + * Gareth Hughes <gareth@valinux.com> */ #ifndef _DRM_P_H_ @@ -73,11 +73,46 @@ #if LINUX_VERSION_CODE < 0x020400 #include "compat-pre24.h" #endif +#include <asm/pgalloc.h> #include "drm.h" +/* DRM template customization defaults + */ +#ifndef __HAVE_AGP +#define __HAVE_AGP 0 +#endif +#ifndef __HAVE_MTRR +#define __HAVE_MTRR 0 +#endif +#ifndef __HAVE_CTX_BITMAP +#define __HAVE_CTX_BITMAP 0 +#endif +#ifndef __HAVE_DMA +#define __HAVE_DMA 0 +#endif +#ifndef __HAVE_DMA_IRQ +#define __HAVE_DMA_IRQ 0 +#endif +#ifndef __HAVE_DMA_WAITLIST +#define __HAVE_DMA_WAITLIST 0 +#endif +#ifndef __HAVE_DMA_FREELIST +#define __HAVE_DMA_FREELIST 0 +#endif +#ifndef __HAVE_DMA_HISTOGRAM +#define __HAVE_DMA_HISTOGRAM 0 +#endif + +#define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \ + defined(CONFIG_AGP_MODULE))) +#define __REALLY_HAVE_MTRR (__HAVE_MTRR && defined(CONFIG_MTRR)) + + +/* Begin the DRM... + */ + #define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then also include looping detection. */ -#define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */ #define DRM_HASH_SIZE 16 /* Size of key hash table */ #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ @@ -109,6 +144,7 @@ #define DRM_MEM_TOTALAGP 16 #define DRM_MEM_BOUNDAGP 17 #define DRM_MEM_CTXBITMAP 18 +#define DRM_MEM_STUB 19 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) @@ -259,16 +295,16 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg) #define DRM_MEM_ERROR(area, fmt, arg...) \ printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \ - drm_mem_stats[area].name , ##arg) + DRM(mem_stats)[area].name , ##arg) #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg) #if DRM_DEBUG_CODE -#define DRM_DEBUG(fmt, arg...) \ - do { \ - if (drm_flags&DRM_FLAG_DEBUG) \ - printk(KERN_DEBUG \ - "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ - ##arg); \ +#define DRM_DEBUG(fmt, arg...) \ + do { \ + if ( DRM(flags) & DRM_FLAG_DEBUG ) \ + printk(KERN_DEBUG \ + "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ + ##arg); \ } while (0) #else #define DRM_DEBUG(fmt, arg...) do { } while (0) @@ -276,13 +312,36 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, #define DRM_PROC_LIMIT (PAGE_SIZE-80) -#define DRM_PROC_PRINT(fmt, arg...) \ - len += sprintf(&buf[len], fmt , ##arg); \ - if (len > DRM_PROC_LIMIT) return len; +#define DRM_PROC_PRINT(fmt, arg...) \ + len += sprintf(&buf[len], fmt , ##arg); \ + if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; } + +#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \ + len += sprintf(&buf[len], fmt , ##arg); \ + if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; } + + /* Mapping helper macros */ +#define DRM_IOREMAP(map) \ + (map)->handle = DRM(ioremap)( (map)->offset, (map)->size ) + +#define DRM_IOREMAPFREE(map) \ + do { \ + if ( (map)->handle && (map)->size ) \ + DRM(ioremapfree)( (map)->handle, (map)->size ); \ + } while (0) -#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \ - len += sprintf(&buf[len], fmt , ##arg); \ - if (len > DRM_PROC_LIMIT) { ret; return len; } +#define DRM_FIND_MAP(_map, _o) \ +do { \ + struct list_head *_list; \ + list_for_each( _list, &dev->maplist->head ) { \ + drm_map_list_t *_entry = (drm_map_list_t *)_list; \ + if ( _entry->map && \ + _entry->map->offset == (_o) ) { \ + (_map) = _entry->map; \ + break; \ + } \ + } \ +} while(0) /* Internal types and structures */ #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) @@ -293,8 +352,12 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist) -typedef int drm_ioctl_t(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ + (_map) = (_dev)->context_sareas[_ctx]; \ +} while(0) + +typedef int drm_ioctl_t( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); typedef struct drm_ioctl_desc { drm_ioctl_t *func; @@ -304,7 +367,7 @@ typedef struct drm_ioctl_desc { typedef struct drm_devstate { pid_t owner; /* X server pid holding x_lock */ - + } drm_devstate_t; typedef struct drm_magic_entry { @@ -365,14 +428,14 @@ typedef struct drm_buf { #define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10) typedef struct drm_histogram { atomic_t total; - + atomic_t queued_to_dispatched[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t dispatched_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t completed_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - + atomic_t queued_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t queued_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - + atomic_t dma[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t schedule[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t ctx[DRM_DMA_HISTOGRAM_SLOTS]; @@ -396,7 +459,7 @@ typedef struct drm_freelist { int initialized; /* Freelist in use */ atomic_t count; /* Number of free buffers */ drm_buf_t *next; /* End pointer */ - + wait_queue_head_t waiting; /* Processes waiting on free bufs */ int low_mark; /* Low water mark */ int high_mark; /* High water mark */ @@ -442,9 +505,11 @@ typedef struct drm_queue { wait_queue_head_t read_queue; /* Processes waiting on block_read */ atomic_t block_write; /* Queue blocked for writes */ wait_queue_head_t write_queue; /* Processes waiting on block_write */ +#if 1 atomic_t total_queued; /* Total queued statistic */ atomic_t total_flushed;/* Total flushes statistic */ atomic_t total_locks; /* Total locks statistics */ +#endif drm_ctx_flags_t flags; /* Context preserving and 2D-only */ drm_waitlist_t waitlist; /* Pending buffers */ wait_queue_head_t flush_queue; /* Processes waiting until flush */ @@ -458,11 +523,12 @@ typedef struct drm_lock_data { } drm_lock_data_t; typedef struct drm_device_dma { +#if 0 /* Performance Counters */ atomic_t total_prio; /* Total DRM_DMA_PRIORITY */ atomic_t total_bytes; /* Total bytes DMA'd */ atomic_t total_dmas; /* Total DMA buffers dispatched */ - + atomic_t total_missed_dma; /* Missed drm_do_dma */ atomic_t total_missed_lock; /* Missed lock in drm_do_dma */ atomic_t total_missed_free; /* Missed drm_free_this_buffer */ @@ -471,16 +537,17 @@ typedef struct drm_device_dma { atomic_t total_tried; /* Tried next_buffer */ atomic_t total_hit; /* Sent next_buffer */ atomic_t total_lost; /* Lost interrupt */ +#endif drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; int buf_count; drm_buf_t **buflist; /* Vector of pointers info bufs */ - int seg_count; + int seg_count; int page_count; unsigned long *pagelist; unsigned long byte_count; enum { - _DRM_DMA_USE_AGP = 0x01 + _DRM_DMA_USE_AGP = 0x01 } flags; /* DMA support */ @@ -490,7 +557,7 @@ typedef struct drm_device_dma { wait_queue_head_t waiting; /* Processes waiting on free bufs */ } drm_device_dma_t; -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) +#if __REALLY_HAVE_AGP typedef struct drm_agp_mem { unsigned long handle; agp_memory *memory; @@ -517,13 +584,18 @@ typedef struct drm_sigdata { drm_hw_lock_t *lock; } drm_sigdata_t; +typedef struct drm_map_list { + struct list_head head; + drm_map_t *map; +} drm_map_list_t; + typedef struct drm_device { const char *name; /* Simple driver name */ char *unique; /* Unique identifier: e.g., busid */ int unique_len; /* Length of unique field */ dev_t device; /* Device number for mknod */ char *devname; /* For /proc/interrupts */ - + int blocked; /* Blocked due to VC switch? */ struct proc_dir_entry *root; /* Root for this device's entries */ @@ -538,17 +610,10 @@ typedef struct drm_device { int buf_use; /* Buffers in use -- cannot alloc */ atomic_t buf_alloc; /* Buffer allocation in progress */ - /* Performance Counters */ - atomic_t total_open; - atomic_t total_close; - atomic_t total_ioctl; - atomic_t total_irq; /* Total interruptions */ - atomic_t total_ctx; /* Total context switches */ - - atomic_t total_locks; - atomic_t total_unlocks; - atomic_t total_contends; - atomic_t total_sleeps; + /* Performance counters */ + unsigned long counters; + drm_stat_type_t types[15]; + atomic_t counts[15]; /* Authentication */ drm_file_t *file_first; @@ -556,9 +621,12 @@ typedef struct drm_device { drm_magic_head_t magiclist[DRM_HASH_SIZE]; /* Memory management */ - drm_map_t **maplist; /* Vector of pointers to regions */ + drm_map_list_t *maplist; /* Linked list of regions */ int map_count; /* Number of mappable regions */ + drm_map_t **context_sareas; + int max_context; + drm_vma_entry_t *vmalist; /* List of vmas (for debugging) */ drm_lock_data_t lock; /* Information on hardware lock */ @@ -582,10 +650,10 @@ typedef struct drm_device { struct tq_struct tq; cycles_t ctx_start; cycles_t lck_start; -#if DRM_DMA_HISTOGRAM +#if __HAVE_DMA_HISTOGRAM drm_histogram_t histo; #endif - + /* Callback to X server for context switch and for heavy-handed reset. */ char buf[DRM_BSZ]; /* Output buffer */ @@ -595,8 +663,8 @@ typedef struct drm_device { struct fasync_struct *buf_async;/* Processes waiting for SIGIO */ wait_queue_head_t buf_readers; /* Processes waiting to read */ wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) + +#if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif unsigned long *ctx_bitmap; @@ -606,230 +674,278 @@ typedef struct drm_device { } drm_device_t; - /* Internal function definitions */ - - /* Misc. support (init.c) */ -extern int drm_flags; -extern void drm_parse_options(char *s); -extern int drm_cpu_valid(void); +/* ================================================================ + * Internal function definitions + */ + /* Misc. support (drm_init.h) */ +extern int DRM(flags); +extern void DRM(parse_options)( char *s ); +extern int DRM(cpu_valid)( void ); - /* Device support (fops.c) */ -extern int drm_open_helper(struct inode *inode, struct file *filp, - drm_device_t *dev); -extern int drm_flush(struct file *filp); -extern int drm_release(struct inode *inode, struct file *filp); -extern int drm_fasync(int fd, struct file *filp, int on); -extern ssize_t drm_read(struct file *filp, char *buf, size_t count, - loff_t *off); -extern int drm_write_string(drm_device_t *dev, const char *s); -extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); + /* Driver support (drm_drv.h) */ +extern int DRM(version)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(open)(struct inode *inode, struct file *filp); +extern int DRM(release)(struct inode *inode, struct file *filp); +extern int DRM(ioctl)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(lock)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(unlock)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); - /* Mapping support (vm.c) */ + /* Device support (drm_fops.h) */ +extern int DRM(open_helper)(struct inode *inode, struct file *filp, + drm_device_t *dev); +extern int DRM(flush)(struct file *filp); +extern int DRM(release_fuck)(struct inode *inode, struct file *filp); +extern int DRM(fasync)(int fd, struct file *filp, int on); +extern ssize_t DRM(read)(struct file *filp, char *buf, size_t count, + loff_t *off); +extern int DRM(write_string)(drm_device_t *dev, const char *s); +extern unsigned int DRM(poll)(struct file *filp, + struct poll_table_struct *wait); + + /* Mapping support (drm_vm.h) */ #if LINUX_VERSION_CODE < 0x020317 -extern unsigned long drm_vm_nopage(struct vm_area_struct *vma, +extern unsigned long DRM(vm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access); +extern unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access); +extern unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access); +#else + /* Return type changed in 2.3.23 */ +extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access); -extern unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma, +extern struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access); -extern unsigned long drm_vm_shm_nopage_lock(struct vm_area_struct *vma, - unsigned long address, - int write_access); -extern unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma, +extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access); -#else - /* Return type changed in 2.3.23 */ -extern struct page *drm_vm_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access); -extern struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access); -extern struct page *drm_vm_shm_nopage_lock(struct vm_area_struct *vma, - unsigned long address, - int write_access); -extern struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access); -#endif -extern void drm_vm_open(struct vm_area_struct *vma); -extern void drm_vm_close(struct vm_area_struct *vma); -extern int drm_mmap_dma(struct file *filp, - struct vm_area_struct *vma); -extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); - - - /* Proc support (proc.c) */ -extern int drm_proc_init(drm_device_t *dev); -extern int drm_proc_cleanup(void); - - /* Memory management support (memory.c) */ -extern void drm_mem_init(void); -extern int drm_mem_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -extern void *drm_alloc(size_t size, int area); -extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, - int area); -extern char *drm_strdup(const char *s, int area); -extern void drm_strfree(const char *s, int area); -extern void drm_free(void *pt, size_t size, int area); -extern unsigned long drm_alloc_pages(int order, int area); -extern void drm_free_pages(unsigned long address, int order, - int area); -extern void *drm_ioremap(unsigned long offset, unsigned long size); -extern void drm_ioremapfree(void *pt, unsigned long size); - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) -extern agp_memory *drm_alloc_agp(int pages, u32 type); -extern int drm_free_agp(agp_memory *handle, int pages); -extern int drm_bind_agp(agp_memory *handle, unsigned int start); -extern int drm_unbind_agp(agp_memory *handle); +#endif +extern void DRM(vm_open)(struct vm_area_struct *vma); +extern void DRM(vm_close)(struct vm_area_struct *vma); +extern void DRM(vm_shm_close)(struct vm_area_struct *vma); +extern int DRM(mmap_dma)(struct file *filp, + struct vm_area_struct *vma); +extern int DRM(mmap)(struct file *filp, struct vm_area_struct *vma); + + /* Memory management support (drm_memory.h) */ +extern void DRM(mem_init)(void); +extern int DRM(mem_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +extern void *DRM(alloc)(size_t size, int area); +extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, + int area); +extern char *DRM(strdup)(const char *s, int area); +extern void DRM(strfree)(const char *s, int area); +extern void DRM(free)(void *pt, size_t size, int area); +extern unsigned long DRM(alloc_pages)(int order, int area); +extern void DRM(free_pages)(unsigned long address, int order, + int area); +extern void *DRM(ioremap)(unsigned long offset, unsigned long size); +extern void DRM(ioremapfree)(void *pt, unsigned long size); + +#if __REALLY_HAVE_AGP +extern agp_memory *DRM(alloc_agp)(int pages, u32 type); +extern int DRM(free_agp)(agp_memory *handle, int pages); +extern int DRM(bind_agp)(agp_memory *handle, unsigned int start); +extern int DRM(unbind_agp)(agp_memory *handle); #endif - - /* Buffer management support (bufs.c) */ -extern int drm_order(unsigned long size); -extern int drm_addmap(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_addbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_infobufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_markbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_freebufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_mapbufs(struct inode *inode, struct file *filp, + /* Misc. IOCTL support (drm_ioctl.h) */ +extern int DRM(irq_busid)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(getunique)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(setunique)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(getmap)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +extern int DRM(getclient)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(getstats)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); - - /* Buffer list management support (lists.c) */ -extern int drm_waitlist_create(drm_waitlist_t *bl, int count); -extern int drm_waitlist_destroy(drm_waitlist_t *bl); -extern int drm_waitlist_put(drm_waitlist_t *bl, drm_buf_t *buf); -extern drm_buf_t *drm_waitlist_get(drm_waitlist_t *bl); - -extern int drm_freelist_create(drm_freelist_t *bl, int count); -extern int drm_freelist_destroy(drm_freelist_t *bl); -extern int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, - drm_buf_t *buf); -extern drm_buf_t *drm_freelist_get(drm_freelist_t *bl, int block); - - /* DMA support (gen_dma.c) */ -extern void drm_dma_setup(drm_device_t *dev); -extern void drm_dma_takedown(drm_device_t *dev); -extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf); -extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid); -extern int drm_context_switch(drm_device_t *dev, int old, int new); -extern int drm_context_switch_complete(drm_device_t *dev, int new); -extern void drm_clear_next_buffer(drm_device_t *dev); -extern int drm_select_queue(drm_device_t *dev, - void (*wrapper)(unsigned long)); -extern int drm_dma_enqueue(drm_device_t *dev, drm_dma_t *dma); -extern int drm_dma_get_buffers(drm_device_t *dev, drm_dma_t *dma); -#if DRM_DMA_HISTOGRAM -extern int drm_histogram_slot(unsigned long count); -extern void drm_histogram_compute(drm_device_t *dev, drm_buf_t *buf); + /* Context IOCTL support (drm_context.h) */ +extern int DRM(resctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(addctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(modctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(getctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(switchctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(newctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(rmctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + +extern int DRM(context_switch)(drm_device_t *dev, int old, int new); +extern int DRM(context_switch_complete)(drm_device_t *dev, int new); + +#if __HAVE_CTX_BITMAP +extern int DRM(ctxbitmap_init)( drm_device_t *dev ); +extern void DRM(ctxbitmap_cleanup)( drm_device_t *dev ); #endif +extern int DRM(setsareactx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(getsareactx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); - /* Misc. IOCTL support (ioctl.c) */ -extern int drm_irq_busid(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_getunique(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_setunique(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); + /* Drawable IOCTL support (drm_drawable.h) */ +extern int DRM(adddraw)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(rmdraw)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); - /* Context IOCTL support (context.c) */ -extern int drm_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_switchctx(struct inode *inode, struct file *filp, + /* Authentication IOCTL support (drm_auth.h) */ +extern int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, + drm_magic_t magic); +extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); +extern int DRM(getmagic)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +extern int DRM(authmagic)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); - /* Drawable IOCTL support (drawable.c) */ -extern int drm_adddraw(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_rmdraw(struct inode *inode, struct file *filp, + /* Locking IOCTL support (drm_lock.h) */ +extern int DRM(block)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); - - - /* Authentication IOCTL support (auth.c) */ -extern int drm_add_magic(drm_device_t *dev, drm_file_t *priv, - drm_magic_t magic); -extern int drm_remove_magic(drm_device_t *dev, drm_magic_t magic); -extern int drm_getmagic(struct inode *inode, struct file *filp, +extern int DRM(unblock)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_authmagic(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - - - /* Locking IOCTL support (lock.c) */ -extern int drm_block(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_unblock(struct inode *inode, struct file *filp, +extern int DRM(lock_take)(__volatile__ unsigned int *lock, + unsigned int context); +extern int DRM(lock_transfer)(drm_device_t *dev, + __volatile__ unsigned int *lock, + unsigned int context); +extern int DRM(lock_free)(drm_device_t *dev, + __volatile__ unsigned int *lock, + unsigned int context); +extern int DRM(finish)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_lock_take(__volatile__ unsigned int *lock, - unsigned int context); -extern int drm_lock_transfer(drm_device_t *dev, - __volatile__ unsigned int *lock, - unsigned int context); -extern int drm_lock_free(drm_device_t *dev, - __volatile__ unsigned int *lock, - unsigned int context); -extern int drm_finish(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_flush_unblock(drm_device_t *dev, int context, - drm_lock_flags_t flags); -extern int drm_flush_block_and_flush(drm_device_t *dev, int context, - drm_lock_flags_t flags); -extern int drm_notifier(void *priv); - - /* Context Bitmap support (ctxbitmap.c) */ -extern int drm_ctxbitmap_init(drm_device_t *dev); -extern void drm_ctxbitmap_cleanup(drm_device_t *dev); -extern int drm_ctxbitmap_next(drm_device_t *dev); -extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle); +extern int DRM(flush_unblock)(drm_device_t *dev, int context, + drm_lock_flags_t flags); +extern int DRM(flush_block_and_flush)(drm_device_t *dev, int context, + drm_lock_flags_t flags); +extern int DRM(notifier)(void *priv); + + /* Buffer management support (drm_bufs.h) */ +extern int DRM(order)( unsigned long size ); +extern int DRM(addmap)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(rmmap)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +#if __HAVE_DMA +extern int DRM(addbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(infobufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(markbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(freebufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(mapbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + + /* DMA support (drm_dma.h) */ +extern int DRM(dma_setup)(drm_device_t *dev); +extern void DRM(dma_takedown)(drm_device_t *dev); +extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf); +extern void DRM(reclaim_buffers)(drm_device_t *dev, pid_t pid); +#if __HAVE_OLD_DMA +/* GH: This is a dirty hack for now... + */ +extern void DRM(clear_next_buffer)(drm_device_t *dev); +extern int DRM(select_queue)(drm_device_t *dev, + void (*wrapper)(unsigned long)); +extern int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *dma); +extern int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma); +#endif +#if __HAVE_DMA_IRQ +extern int DRM(control)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(irq_install)( drm_device_t *dev, int irq ); +extern int DRM(irq_uninstall)( drm_device_t *dev ); +extern void DRM(dma_service)( int irq, void *device, + struct pt_regs *regs ); +#if __HAVE_DMA_IRQ_BH +extern void DRM(dma_immediate_bh)( void *dev ); +#endif +#endif +#if DRM_DMA_HISTOGRAM +extern int DRM(histogram_slot)(unsigned long count); +extern void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf); +#endif -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - /* AGP/GART support (agpsupport.c) */ -extern drm_agp_head_t *drm_agp_init(void); -extern void drm_agp_uninit(void); -extern int drm_agp_acquire(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern void _drm_agp_release(void); -extern int drm_agp_release(struct inode *inode, struct file *filp, + /* Buffer list support (drm_lists.h) */ +#if __HAVE_DMA_WAITLIST +extern int DRM(waitlist_create)(drm_waitlist_t *bl, int count); +extern int DRM(waitlist_destroy)(drm_waitlist_t *bl); +extern int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf); +extern drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl); +#endif +#if __HAVE_DMA_FREELIST +extern int DRM(freelist_create)(drm_freelist_t *bl, int count); +extern int DRM(freelist_destroy)(drm_freelist_t *bl); +extern int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, + drm_buf_t *buf); +extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block); +#endif +#endif /* __HAVE_DMA */ + +#if __REALLY_HAVE_AGP + /* AGP/GART support (drm_agpsupport.h) */ +extern drm_agp_head_t *DRM(agp_init)(void); +extern void DRM(agp_uninit)(void); +extern int DRM(agp_acquire)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern void DRM(agp_do_release)(void); +extern int DRM(agp_release)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(agp_enable)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_agp_enable(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_agp_info(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_agp_alloc(struct inode *inode, struct file *filp, +extern int DRM(agp_info)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_agp_free(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_agp_unbind(struct inode *inode, struct file *filp, +extern int DRM(agp_alloc)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_agp_bind(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern agp_memory *drm_agp_allocate_memory(size_t pages, u32 type); -extern int drm_agp_free_memory(agp_memory *handle); -extern int drm_agp_bind_memory(agp_memory *handle, off_t start); -extern int drm_agp_unbind_memory(agp_memory *handle); -#endif +extern int DRM(agp_free)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(agp_unbind)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(agp_bind)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type); +extern int DRM(agp_free_memory)(agp_memory *handle); +extern int DRM(agp_bind_memory)(agp_memory *handle, off_t start); +extern int DRM(agp_unbind_memory)(agp_memory *handle); #endif + + /* Stub support (drm_stub.h) */ +int DRM(stub_register)(const char *name, + struct file_operations *fops, + drm_device_t *dev); +int DRM(stub_unregister)(int minor); + + /* Proc support (drm_proc.h) */ +extern struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, + int minor, + struct proc_dir_entry *root, + struct proc_dir_entry **dev_root); +extern int DRM(proc_cleanup)(int minor, + struct proc_dir_entry *root, + struct proc_dir_entry *dev_root); + +#endif /* __KERNEL__ */ #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h new file mode 100644 index 000000000..dfd0d8fc2 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h @@ -0,0 +1,335 @@ +/* drm_agpsupport.h -- DRM support for AGP/GART backend -*- linux-c -*- + * Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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. + * + * Author: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" +#include <linux/module.h> + +#if __REALLY_HAVE_AGP + +#if LINUX_VERSION_CODE < 0x020400 +#include "agpsupport-pre24.h" +#else +#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp") +#define DRM_AGP_PUT inter_module_put("drm_agp") +#endif + +static const drm_agp_t *drm_agp = NULL; + +int DRM(agp_info)(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; + agp_kern_info *kern; + drm_agp_info_t info; + + if (!dev->agp->acquired || !drm_agp->copy_info) return -EINVAL; + + kern = &dev->agp->agp_info; + info.agp_version_major = kern->version.major; + info.agp_version_minor = kern->version.minor; + info.mode = kern->mode; + info.aperture_base = kern->aper_base; + info.aperture_size = kern->aper_size * 1024 * 1024; + info.memory_allowed = kern->max_memory << PAGE_SHIFT; + info.memory_used = kern->current_memory << PAGE_SHIFT; + info.id_vendor = kern->device->vendor; + info.id_device = kern->device->device; + + if (copy_to_user((drm_agp_info_t *)arg, &info, sizeof(info))) + return -EFAULT; + return 0; +} + +int DRM(agp_acquire)(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; + int retcode; + + if (!dev->agp|| dev->agp->acquired || !drm_agp->acquire) return -EINVAL; + if ((retcode = drm_agp->acquire())) return retcode; + dev->agp->acquired = 1; + return 0; +} + +int DRM(agp_release)(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; + + if (!dev->agp->acquired || !drm_agp->release) return -EINVAL; + drm_agp->release(); + dev->agp->acquired = 0; + return 0; + +} + +void DRM(agp_do_release)(void) +{ + if (drm_agp->release) drm_agp->release(); +} + +int DRM(agp_enable)(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_agp_mode_t mode; + + if (!dev->agp->acquired || !drm_agp->enable) return -EINVAL; + + if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode))) + return -EFAULT; + + dev->agp->mode = mode.mode; + drm_agp->enable(mode.mode); + dev->agp->base = dev->agp->agp_info.aper_base; + dev->agp->enabled = 1; + return 0; +} + +int DRM(agp_alloc)(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_agp_buffer_t request; + drm_agp_mem_t *entry; + agp_memory *memory; + unsigned long pages; + u32 type; + + if (!dev->agp->acquired) return -EINVAL; + if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS))) + return -ENOMEM; + + memset(entry, 0, sizeof(*entry)); + + pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + type = (u32) request.type; + + if (!(memory = DRM(alloc_agp)(pages, type))) { + DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return -ENOMEM; + } + + entry->handle = (unsigned long)memory->memory; + entry->memory = memory; + entry->bound = 0; + entry->pages = pages; + entry->prev = NULL; + entry->next = dev->agp->memory; + if (dev->agp->memory) dev->agp->memory->prev = entry; + dev->agp->memory = entry; + + request.handle = entry->handle; + request.physical = memory->physical; + + if (copy_to_user((drm_agp_buffer_t *)arg, &request, sizeof(request))) { + dev->agp->memory = entry->next; + dev->agp->memory->prev = NULL; + DRM(free_agp)(memory, pages); + DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return -EFAULT; + } + return 0; +} + +static drm_agp_mem_t *DRM(agp_lookup_entry)(drm_device_t *dev, + unsigned long handle) +{ + drm_agp_mem_t *entry; + + for (entry = dev->agp->memory; entry; entry = entry->next) { + if (entry->handle == handle) return entry; + } + return NULL; +} + +int DRM(agp_unbind)(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_agp_binding_t request; + drm_agp_mem_t *entry; + + if (!dev->agp->acquired) return -EINVAL; + if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) + return -EINVAL; + if (!entry->bound) return -EINVAL; + return DRM(unbind_agp)(entry->memory); +} + +int DRM(agp_bind)(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_agp_binding_t request; + drm_agp_mem_t *entry; + int retcode; + int page; + + if (!dev->agp->acquired || !drm_agp->bind_memory) return -EINVAL; + if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) + return -EINVAL; + if (entry->bound) return -EINVAL; + page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; + if ((retcode = DRM(bind_agp)(entry->memory, page))) return retcode; + entry->bound = dev->agp->base + (page << PAGE_SHIFT); + DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", + dev->agp->base, entry->bound); + return 0; +} + +int DRM(agp_free)(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_agp_buffer_t request; + drm_agp_mem_t *entry; + + if (!dev->agp->acquired) return -EINVAL; + if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) + return -EINVAL; + if (entry->bound) DRM(unbind_agp)(entry->memory); + + if (entry->prev) entry->prev->next = entry->next; + else dev->agp->memory = entry->next; + if (entry->next) entry->next->prev = entry->prev; + DRM(free_agp)(entry->memory, entry->pages); + DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return 0; +} + +drm_agp_head_t *DRM(agp_init)(void) +{ + drm_agp_head_t *head = NULL; + + drm_agp = DRM_AGP_GET; + if (drm_agp) { + if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS))) + return NULL; + memset((void *)head, 0, sizeof(*head)); + drm_agp->copy_info(&head->agp_info); + if (head->agp_info.chipset == NOT_SUPPORTED) { + DRM(free)(head, sizeof(*head), DRM_MEM_AGPLISTS); + return NULL; + } + head->memory = NULL; + switch (head->agp_info.chipset) { + case INTEL_GENERIC: head->chipset = "Intel"; break; + case INTEL_LX: head->chipset = "Intel 440LX"; break; + case INTEL_BX: head->chipset = "Intel 440BX"; break; + case INTEL_GX: head->chipset = "Intel 440GX"; break; + case INTEL_I810: head->chipset = "Intel i810"; break; + +#if LINUX_VERSION_CODE >= 0x020400 + case INTEL_I840: head->chipset = "Intel i840"; break; +#endif + + case VIA_GENERIC: head->chipset = "VIA"; break; + case VIA_VP3: head->chipset = "VIA VP3"; break; + case VIA_MVP3: head->chipset = "VIA MVP3"; break; + +#if LINUX_VERSION_CODE >= 0x020400 + case VIA_MVP4: head->chipset = "VIA MVP4"; break; + case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133"; + break; + case VIA_APOLLO_KT133: head->chipset = "VIA Apollo KT133"; + break; +#endif + + case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; + break; + case SIS_GENERIC: head->chipset = "SiS"; break; + case AMD_GENERIC: head->chipset = "AMD"; break; + case AMD_IRONGATE: head->chipset = "AMD Irongate"; break; + case ALI_GENERIC: head->chipset = "ALi"; break; + case ALI_M1541: head->chipset = "ALi M1541"; break; + default: head->chipset = "Unknown"; break; + } + DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", + head->agp_info.version.major, + head->agp_info.version.minor, + head->chipset, + head->agp_info.aper_base, + head->agp_info.aper_size); + } + return head; +} + +void DRM(agp_uninit)(void) +{ + DRM_AGP_PUT; + drm_agp = NULL; +} + +agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type) +{ + if (!drm_agp->allocate_memory) return NULL; + return drm_agp->allocate_memory(pages, type); +} + +int DRM(agp_free_memory)(agp_memory *handle) +{ + if (!handle || !drm_agp->free_memory) return 0; + drm_agp->free_memory(handle); + return 1; +} + +int DRM(agp_bind_memory)(agp_memory *handle, off_t start) +{ + if (!handle || !drm_agp->bind_memory) return -EINVAL; + return drm_agp->bind_memory(handle, start); +} + +int DRM(agp_unbind_memory)(agp_memory *handle) +{ + if (!handle || !drm_agp->unbind_memory) return -EINVAL; + return drm_agp->unbind_memory(handle); +} + +#endif /* __REALLY_HAVE_AGP */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h new file mode 100644 index 000000000..2636e6179 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h @@ -0,0 +1,162 @@ +/* drm_auth.h -- IOCTLs for authentication -*- linux-c -*- + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +static int DRM(hash_magic)(drm_magic_t magic) +{ + return magic & (DRM_HASH_SIZE-1); +} + +static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic) +{ + drm_file_t *retval = NULL; + drm_magic_entry_t *pt; + int hash = DRM(hash_magic)(magic); + + down(&dev->struct_sem); + for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { + if (pt->magic == magic) { + retval = pt->priv; + break; + } + } + up(&dev->struct_sem); + return retval; +} + +int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) +{ + int hash; + drm_magic_entry_t *entry; + + DRM_DEBUG("%d\n", magic); + + hash = DRM(hash_magic)(magic); + entry = DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); + if (!entry) return -ENOMEM; + entry->magic = magic; + entry->priv = priv; + entry->next = NULL; + + down(&dev->struct_sem); + if (dev->magiclist[hash].tail) { + dev->magiclist[hash].tail->next = entry; + dev->magiclist[hash].tail = entry; + } else { + dev->magiclist[hash].head = entry; + dev->magiclist[hash].tail = entry; + } + up(&dev->struct_sem); + + return 0; +} + +int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) +{ + drm_magic_entry_t *prev = NULL; + drm_magic_entry_t *pt; + int hash; + + DRM_DEBUG("%d\n", magic); + hash = DRM(hash_magic)(magic); + + down(&dev->struct_sem); + for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { + if (pt->magic == magic) { + if (dev->magiclist[hash].head == pt) { + dev->magiclist[hash].head = pt->next; + } + if (dev->magiclist[hash].tail == pt) { + dev->magiclist[hash].tail = prev; + } + if (prev) { + prev->next = pt->next; + } + up(&dev->struct_sem); + return 0; + } + } + up(&dev->struct_sem); + + DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); + + return -EINVAL; +} + +int DRM(getmagic)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + static drm_magic_t sequence = 0; + static spinlock_t lock = SPIN_LOCK_UNLOCKED; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_auth_t auth; + + /* Find unique magic */ + if (priv->magic) { + auth.magic = priv->magic; + } else { + do { + spin_lock(&lock); + if (!sequence) ++sequence; /* reserve 0 */ + auth.magic = sequence++; + spin_unlock(&lock); + } while (DRM(find_file)(dev, auth.magic)); + priv->magic = auth.magic; + DRM(add_magic)(dev, priv, auth.magic); + } + + DRM_DEBUG("%u\n", auth.magic); + if (copy_to_user((drm_auth_t *)arg, &auth, sizeof(auth))) + return -EFAULT; + return 0; +} + +int DRM(authmagic)(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_auth_t auth; + drm_file_t *file; + + if (copy_from_user(&auth, (drm_auth_t *)arg, sizeof(auth))) + return -EFAULT; + DRM_DEBUG("%u\n", auth.magic); + if ((file = DRM(find_file)(dev, auth.magic))) { + file->authenticated = 1; + DRM(remove_magic)(dev, auth.magic); + return 0; + } + return -EINVAL; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h new file mode 100644 index 000000000..63cfb0d44 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h @@ -0,0 +1,829 @@ +/* drm_bufs.h -- Generic buffer template -*- linux-c -*- + * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include <linux/vmalloc.h> +#include "drmP.h" + +#ifndef __HAVE_PCI_DMA +#define __HAVE_PCI_DMA 0 +#endif + +#ifndef DRIVER_BUF_PRIV_T +#define DRIVER_BUF_PRIV_T u32 +#endif +#ifndef DRIVER_AGP_BUFFERS_MAP +#if __HAVE_AGP && __HAVE_DMA +#error "You must define DRIVER_AGP_BUFFERS_MAP()" +#else +#define DRIVER_AGP_BUFFERS_MAP( dev ) NULL +#endif +#endif + +/* + * Compute order. Can be made faster. + */ +int DRM(order)( unsigned long size ) +{ + int order; + unsigned long tmp; + + for ( order = 0, tmp = size ; tmp >>= 1 ; ++order ); + + if ( size & ~(1 << order) ) + ++order; + + return order; +} + +int DRM(addmap)( 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_map_t *map; + drm_map_list_t *list; + + if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */ + + map = DRM(alloc)( sizeof(*map), DRM_MEM_MAPS ); + if ( !map ) + return -ENOMEM; + + if ( copy_from_user( map, (drm_map_t *)arg, sizeof(*map) ) ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EFAULT; + } + + /* Only allow shared memory to be removable since we only keep enough + * book keeping information about shared memory to allow for removal + * when processes fork. + */ + if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } + DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n", + map->offset, map->size, map->type ); + if ( (map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK)) ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } + map->mtrr = -1; + map->handle = 0; + + switch ( map->type ) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#ifndef __sparc__ + if ( map->offset + map->size < map->offset || + map->offset < virt_to_phys(high_memory) ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } +#endif +#if __REALLY_HAVE_MTRR + if ( map->type == _DRM_FRAME_BUFFER || + (map->flags & _DRM_WRITE_COMBINING) ) { + map->mtrr = mtrr_add( map->offset, map->size, + MTRR_TYPE_WRCOMB, 1 ); + } +#endif + map->handle = DRM(ioremap)( map->offset, map->size ); + break; + + case _DRM_SHM: + map->handle = vmalloc_32(map->size); + DRM_DEBUG( "%ld %d %p\n", + map->size, DRM(order)( map->size ), map->handle ); + if ( !map->handle ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -ENOMEM; + } + map->offset = (unsigned long)map->handle; + if ( map->flags & _DRM_CONTAINS_LOCK ) { + dev->lock.hw_lock = map->handle; /* Pointer to lock */ + } + break; +#if __REALLY_HAVE_AGP + case _DRM_AGP: + map->offset = map->offset + dev->agp->base; + map->mtrr = dev->agp->agp_mtrr; /* for getmap */ + break; +#endif + default: + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } + + list = DRM(alloc)(sizeof(*list), DRM_MEM_MAPS); + if(!list) { + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + return -EINVAL; + } + memset(list, 0, sizeof(*list)); + list->map = map; + + down(&dev->struct_sem); + list_add(&list->head, &dev->maplist->head); + up(&dev->struct_sem); + + if ( copy_to_user( (drm_map_t *)arg, map, sizeof(*map) ) ) + return -EFAULT; + if ( map->type != _DRM_SHM ) { + if ( copy_to_user( &((drm_map_t *)arg)->handle, + &map->offset, + sizeof(map->offset) ) ) + return -EFAULT; + } + return 0; +} + + +/* Remove a map private from list and deallocate resources if the mapping + * isn't in use. + */ + +int DRM(rmmap)(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; + struct list_head *list; + drm_map_list_t *r_list; + drm_vma_entry_t *pt, *prev; + drm_map_t *map; + drm_map_t request; + int found_maps = 0; + + if (copy_from_user(&request, (drm_map_t *)arg, + sizeof(request))) { + return -EFAULT; + } + + down(&dev->struct_sem); + list = &dev->maplist->head; + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *) list; + + if(r_list->map && + r_list->map->handle == request.handle && + r_list->map->flags & _DRM_REMOVABLE) break; + } + + /* List has wrapped around to the head pointer, or its empty we didn't + * find anything. + */ + if(list == (&dev->maplist->head)) { + up(&dev->struct_sem); + return -EINVAL; + } + map = r_list->map; + list_del(list); + DRM(free)(list, sizeof(*list), DRM_MEM_MAPS); + + for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { +#if LINUX_VERSION_CODE >= 0x020300 + if (pt->vma->vm_private_data == map) found_maps++; +#else + if (pt->vma->vm_pte == map) found_maps++; +#endif + } + + if(!found_maps) { + switch (map->type) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#if __REALLY_HAVE_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: + vfree(map->handle); + break; + case _DRM_AGP: + break; + } + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + } + up(&dev->struct_sem); + return 0; +} + +#if __HAVE_DMA + +#if __REALLY_HAVE_AGP +int DRM(addbufs_agp)( 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_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + drm_buf_entry_t *entry; + drm_buf_t *buf; + unsigned long offset; + unsigned long agp_offset; + int count; + int order; + int size; + int alignment; + int page_order; + int total; + int byte_count; + int i; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + count = request.count; + order = DRM(order)( request.size ); + size = 1 << order; + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? PAGE_ALIGN(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + byte_count = 0; + agp_offset = dev->agp->base + request.agp_start; + + DRM_DEBUG( "count: %d\n", count ); + DRM_DEBUG( "order: %d\n", order ); + DRM_DEBUG( "size: %d\n", size ); + DRM_DEBUG( "agp_offset: %ld\n", agp_offset ); + DRM_DEBUG( "alignment: %d\n", alignment ); + DRM_DEBUG( "page_order: %d\n", page_order ); + DRM_DEBUG( "total: %d\n", total ); + + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + if ( dev->queue_count ) return -EBUSY; /* Not while in use */ + + spin_lock( &dev->count_lock ); + if ( dev->buf_use ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + atomic_inc( &dev->buf_alloc ); + spin_unlock( &dev->count_lock ); + + down( &dev->struct_sem ); + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; /* May only call once for each order */ + } + + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); + + entry->buf_size = size; + entry->page_order = page_order; + + offset = 0; + + while ( entry->buf_count < count ) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + + buf->offset = (dma->byte_count + offset); + buf->bus_address = agp_offset + offset; + buf->address = (void *)(agp_offset + offset); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head( &buf->dma_wait ); + buf->pid = 0; + + buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T); + buf->dev_private = DRM(alloc)( sizeof(DRIVER_BUF_PRIV_T), + DRM_MEM_BUFS ); + memset( buf->dev_private, 0, buf->dev_priv_size ); + +#if __HAVE_DMA_HISTOGRAM + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; +#endif + DRM_DEBUG( "buffer %d @ %p\n", + entry->buf_count, buf->address ); + + offset += alignment; + entry->buf_count++; + byte_count += PAGE_SIZE << page_order; + } + + DRM_DEBUG( "byte_count: %d\n", byte_count ); + + dma->buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dma->buflist[i + dma->buf_count] = &entry->buflist[i]; + } + + dma->buf_count += entry->buf_count; + dma->byte_count += byte_count; + + DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); + DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); + +#if __HAVE_DMA_FREELIST + DRM(freelist_create)( &entry->freelist, entry->buf_count ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + } +#endif + up( &dev->struct_sem ); + + request.count = entry->buf_count; + request.size = size; + + if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) ) + return -EFAULT; + + dma->flags = _DRM_DMA_USE_AGP; + + atomic_dec( &dev->buf_alloc ); + return 0; +} +#endif /* __REALLY_HAVE_AGP */ + +#if __HAVE_PCI_DMA +int DRM(addbufs_pci)( 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_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + int count; + int order; + int size; + int total; + int page_order; + drm_buf_entry_t *entry; + unsigned long page; + drm_buf_t *buf; + int alignment; + unsigned long offset; + int i; + int byte_count; + int page_count; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + count = request.count; + order = DRM(order)( request.size ); + size = 1 << order; + + DRM_DEBUG( "count=%d, size=%d (%d), order=%d, queue_count=%d\n", + request.count, request.size, size, + order, dev->queue_count ); + + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + if ( dev->queue_count ) return -EBUSY; /* Not while in use */ + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? PAGE_ALIGN(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + spin_lock( &dev->count_lock ); + if ( dev->buf_use ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + atomic_inc( &dev->buf_alloc ); + spin_unlock( &dev->count_lock ); + + down( &dev->struct_sem ); + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; /* May only call once for each order */ + } + + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); + + entry->seglist = DRM(alloc)( count * sizeof(*entry->seglist), + DRM_MEM_SEGS ); + if ( !entry->seglist ) { + DRM(free)( entry->buflist, + count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->seglist, 0, count * sizeof(*entry->seglist) ); + + dma->pagelist = DRM(realloc)( dma->pagelist, + dma->page_count * sizeof(*dma->pagelist), + (dma->page_count + (count << page_order)) + * sizeof(*dma->pagelist), + DRM_MEM_PAGES ); + DRM_DEBUG( "pagelist: %d entries\n", + dma->page_count + (count << page_order) ); + + entry->buf_size = size; + entry->page_order = page_order; + byte_count = 0; + page_count = 0; + + while ( entry->buf_count < count ) { + page = DRM(alloc_pages)( page_order, DRM_MEM_DMA ); + if ( !page ) break; + entry->seglist[entry->seg_count++] = page; + for ( i = 0 ; i < (1 << page_order) ; i++ ) { + DRM_DEBUG( "page %d @ 0x%08lx\n", + dma->page_count + page_count, + page + PAGE_SIZE * i ); + dma->pagelist[dma->page_count + page_count++] + = page + PAGE_SIZE * i; + } + for ( offset = 0 ; + offset + size <= total && entry->buf_count < count ; + offset += alignment, ++entry->buf_count ) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + buf->offset = (dma->byte_count + byte_count + offset); + buf->address = (void *)(page + offset); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head( &buf->dma_wait ); + buf->pid = 0; +#if __HAVE_DMA_HISTOGRAM + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; +#endif + DRM_DEBUG( "buffer %d @ %p\n", + entry->buf_count, buf->address ); + } + byte_count += PAGE_SIZE << page_order; + } + + dma->buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dma->buflist[i + dma->buf_count] = &entry->buflist[i]; + } + + dma->buf_count += entry->buf_count; + dma->seg_count += entry->seg_count; + dma->page_count += entry->seg_count << page_order; + dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); + +#if __HAVE_DMA_FREELIST + DRM(freelist_create)( &entry->freelist, entry->buf_count ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + } +#endif + up( &dev->struct_sem ); + + request.count = entry->buf_count; + request.size = size; + + if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) ) + return -EFAULT; + + atomic_dec( &dev->buf_alloc ); + return 0; +} +#endif /* __HAVE_PCI_DMA */ + +int DRM(addbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_buf_desc_t request; + + if ( copy_from_user( &request, (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + +#if __REALLY_HAVE_AGP + if ( request.flags & _DRM_AGP_BUFFER ) + return DRM(addbufs_agp)( inode, filp, cmd, arg ); + else +#endif +#if __HAVE_PCI_DMA + return DRM(addbufs_pci)( inode, filp, cmd, arg ); +#else + return -EINVAL; +#endif +} + +int DRM(infobufs)( 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_device_dma_t *dma = dev->dma; + drm_buf_info_t request; + int i; + int count; + + if ( !dma ) return -EINVAL; + + spin_lock( &dev->count_lock ); + if ( atomic_read( &dev->buf_alloc ) ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + ++dev->buf_use; /* Can't allocate more after this call */ + spin_unlock( &dev->count_lock ); + + if ( copy_from_user( &request, + (drm_buf_info_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { + if ( dma->bufs[i].buf_count ) ++count; + } + + DRM_DEBUG( "count = %d\n", count ); + + if ( request.count >= count ) { + for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { + if ( dma->bufs[i].buf_count ) { + drm_buf_desc_t *to = &request.list[count]; + drm_buf_entry_t *from = &dma->bufs[i]; + drm_freelist_t *list = &dma->bufs[i].freelist; + if ( copy_to_user( &to->count, + &from->buf_count, + sizeof(from->buf_count) ) || + copy_to_user( &to->size, + &from->buf_size, + sizeof(from->buf_size) ) || + copy_to_user( &to->low_mark, + &list->low_mark, + sizeof(list->low_mark) ) || + copy_to_user( &to->high_mark, + &list->high_mark, + sizeof(list->high_mark) ) ) + return -EFAULT; + + DRM_DEBUG( "%d %d %d %d %d\n", + i, + dma->bufs[i].buf_count, + dma->bufs[i].buf_size, + dma->bufs[i].freelist.low_mark, + dma->bufs[i].freelist.high_mark ); + ++count; + } + } + } + request.count = count; + + if ( copy_to_user( (drm_buf_info_t *)arg, + &request, + sizeof(request) ) ) + return -EFAULT; + + return 0; +} + +int DRM(markbufs)( 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_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + int order; + drm_buf_entry_t *entry; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, + (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + DRM_DEBUG( "%d, %d, %d\n", + request.size, request.low_mark, request.high_mark ); + order = DRM(order)( request.size ); + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + entry = &dma->bufs[order]; + + if ( request.low_mark < 0 || request.low_mark > entry->buf_count ) + return -EINVAL; + if ( request.high_mark < 0 || request.high_mark > entry->buf_count ) + return -EINVAL; + + entry->freelist.low_mark = request.low_mark; + entry->freelist.high_mark = request.high_mark; + + return 0; +} + +int DRM(freebufs)( 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_device_dma_t *dma = dev->dma; + drm_buf_free_t request; + int i; + int idx; + drm_buf_t *buf; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, + (drm_buf_free_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", request.count ); + for ( i = 0 ; i < request.count ; i++ ) { + if ( copy_from_user( &idx, + &request.list[i], + sizeof(idx) ) ) + return -EFAULT; + if ( idx < 0 || idx >= dma->buf_count ) { + DRM_ERROR( "Index %d (of %d max)\n", + idx, dma->buf_count - 1 ); + return -EINVAL; + } + buf = dma->buflist[idx]; + if ( buf->pid != current->pid ) { + DRM_ERROR( "Process %d freeing buffer owned by %d\n", + current->pid, buf->pid ); + return -EINVAL; + } + DRM(free_buffer)( dev, buf ); + } + + return 0; +} + +int DRM(mapbufs)( 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_device_dma_t *dma = dev->dma; + int retcode = 0; + const int zero = 0; + unsigned long virtual; + unsigned long address; + drm_buf_map_t request; + int i; + + if ( !dma ) return -EINVAL; + + spin_lock( &dev->count_lock ); + if ( atomic_read( &dev->buf_alloc ) ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + dev->buf_use++; /* Can't allocate more after this call */ + spin_unlock( &dev->count_lock ); + + if ( copy_from_user( &request, (drm_buf_map_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + if ( request.count >= dma->buf_count ) { + if ( __HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP) ) { + drm_map_t *map = DRIVER_AGP_BUFFERS_MAP( dev ); + + if ( !map ) { + retcode = -EINVAL; + goto done; + } + + down( ¤t->mm->mmap_sem ); + virtual = do_mmap( filp, 0, map->size, + PROT_READ | PROT_WRITE, + MAP_SHARED, + (unsigned long)map->offset ); + up( ¤t->mm->mmap_sem ); + } else { + down( ¤t->mm->mmap_sem ); + virtual = do_mmap( filp, 0, dma->byte_count, + PROT_READ | PROT_WRITE, + MAP_SHARED, 0 ); + up( ¤t->mm->mmap_sem ); + } + if ( virtual > -1024UL ) { + /* Real error */ + retcode = (signed long)virtual; + goto done; + } + request.virtual = (void *)virtual; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + if ( copy_to_user( &request.list[i].idx, + &dma->buflist[i]->idx, + sizeof(request.list[0].idx) ) ) { + retcode = -EFAULT; + goto done; + } + if ( copy_to_user( &request.list[i].total, + &dma->buflist[i]->total, + sizeof(request.list[0].total) ) ) { + retcode = -EFAULT; + goto done; + } + if ( copy_to_user( &request.list[i].used, + &zero, + sizeof(zero) ) ) { + retcode = -EFAULT; + goto done; + } + address = virtual + dma->buflist[i]->offset; /* *** */ + if ( copy_to_user( &request.list[i].address, + &address, + sizeof(address) ) ) { + retcode = -EFAULT; + goto done; + } + } + } + done: + request.count = dma->buf_count; + DRM_DEBUG( "%d buffers, retcode = %d\n", request.count, retcode ); + + if ( copy_to_user( (drm_buf_map_t *)arg, &request, sizeof(request) ) ) + return -EFAULT; + + return retcode; +} + +#endif /* __HAVE_DMA */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h new file mode 100644 index 000000000..4ac896ef5 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h @@ -0,0 +1,760 @@ +/* drm_context.h -- IOCTLs for generic contexts -*- linux-c -*- + * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#if __HAVE_CTX_BITMAP + +/* ================================================================ + * Context bitmap support + */ + +void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle ) +{ + if ( ctx_handle < 0 ) goto failed; + if ( !dev->ctx_bitmap ) goto failed; + + if ( ctx_handle < DRM_MAX_CTXBITMAP ) { + down(&dev->struct_sem); + clear_bit( ctx_handle, dev->ctx_bitmap ); + dev->context_sareas[ctx_handle] = NULL; + up(&dev->struct_sem); + return; + } +failed: + DRM_ERROR( "Attempt to free invalid context handle: %d\n", + ctx_handle ); + return; +} + +int DRM(ctxbitmap_next)( drm_device_t *dev ) +{ + int bit; + + if(!dev->ctx_bitmap) return -1; + + down(&dev->struct_sem); + bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP ); + if ( bit < DRM_MAX_CTXBITMAP ) { + set_bit( bit, dev->ctx_bitmap ); + DRM_DEBUG( "drm_ctxbitmap_next bit : %d\n", bit ); + if((bit+1) > dev->max_context) { + dev->max_context = (bit+1); + if(dev->context_sareas) { + dev->context_sareas = DRM(realloc)( + dev->context_sareas, + (dev->max_context - 1) * + sizeof(*dev->context_sareas), + dev->max_context * + sizeof(*dev->context_sareas), + DRM_MEM_MAPS); + dev->context_sareas[bit] = NULL; + } else { + /* max_context == 1 at this point */ + dev->context_sareas = DRM(alloc)( + dev->max_context * + sizeof(*dev->context_sareas), + DRM_MEM_MAPS); + dev->context_sareas[bit] = NULL; + } + } + up(&dev->struct_sem); + return bit; + } + up(&dev->struct_sem); + return -1; +} + +int DRM(ctxbitmap_init)( drm_device_t *dev ) +{ + int i; + int temp; + + down(&dev->struct_sem); + dev->ctx_bitmap = (unsigned long *) DRM(alloc)( PAGE_SIZE, + DRM_MEM_CTXBITMAP ); + if ( dev->ctx_bitmap == NULL ) { + up(&dev->struct_sem); + return -ENOMEM; + } + memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE ); + dev->context_sareas = NULL; + dev->max_context = -1; + up(&dev->struct_sem); + + for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + temp = DRM(ctxbitmap_next)( dev ); + DRM_DEBUG( "drm_ctxbitmap_init : %d\n", temp ); + } + + return 0; +} + +void DRM(ctxbitmap_cleanup)( drm_device_t *dev ) +{ + down(&dev->struct_sem); + if( dev->context_sareas ) DRM(free)( dev->context_sareas, + sizeof(*dev->context_sareas) * + dev->max_context, + DRM_MEM_MAPS ); + DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP ); + up(&dev->struct_sem); +} + +/* ================================================================ + * Per Context SAREA Support + */ + +int DRM(getsareactx)(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_priv_map_t request; + drm_map_t *map; + + if (copy_from_user(&request, + (drm_ctx_priv_map_t *)arg, + sizeof(request))) + return -EFAULT; + + down(&dev->struct_sem); + if ((int)request.ctx_id >= dev->max_context) { + up(&dev->struct_sem); + return -EINVAL; + } + + map = dev->context_sareas[request.ctx_id]; + up(&dev->struct_sem); + + request.handle = map->handle; + if (copy_to_user((drm_ctx_priv_map_t *)arg, &request, sizeof(request))) + return -EFAULT; + return 0; +} + +int DRM(setsareactx)(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_priv_map_t request; + drm_map_t *map = NULL; + drm_map_list_t *r_list; + struct list_head *list; + + if (copy_from_user(&request, + (drm_ctx_priv_map_t *)arg, + sizeof(request))) + return -EFAULT; + + down(&dev->struct_sem); + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + if(r_list->map && + r_list->map->handle == request.handle) break; + } + if (list == &(dev->maplist->head)) { + up(&dev->struct_sem); + return -EINVAL; + } + map = r_list->map; + up(&dev->struct_sem); + + if (!map) return -EINVAL; + + down(&dev->struct_sem); + if ((int)request.ctx_id >= dev->max_context) { + up(&dev->struct_sem); + return -EINVAL; + } + dev->context_sareas[request.ctx_id] = map; + up(&dev->struct_sem); + return 0; +} + +/* ================================================================ + * The actual DRM context handling routines + */ + +int DRM(context_switch)( drm_device_t *dev, int old, int new ) +{ + char buf[64]; + + if ( test_and_set_bit( 0, &dev->context_flag ) ) { + DRM_ERROR( "Reentering -- FIXME\n" ); + return -EBUSY; + } + +#if __HAVE_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 ) { + DRM(context_switch_complete)( dev, new ); + } else { + sprintf( buf, "C %d %d\n", old, new ); + DRM(write_string)( dev, buf ); + } + + return 0; +} + +int DRM(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 __HAVE_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 DRM(resctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_ctx_res_t res; + drm_ctx_t ctx; + int i; + + if ( copy_from_user( &res, (drm_ctx_res_t *)arg, sizeof(res) ) ) + return -EFAULT; + + if ( res.count >= DRM_RESERVED_CONTEXTS ) { + memset( &ctx, 0, sizeof(ctx) ); + for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + ctx.handle = i; + if ( copy_to_user( &res.contexts[i], + &i, sizeof(i) ) ) + return -EFAULT; + } + } + res.count = DRM_RESERVED_CONTEXTS; + + if ( copy_to_user( (drm_ctx_res_t *)arg, &res, sizeof(res) ) ) + return -EFAULT; + return 0; +} + +int DRM(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; + + if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) ) + return -EFAULT; + + ctx.handle = DRM(ctxbitmap_next)( dev ); + if ( ctx.handle == DRM_KERNEL_CONTEXT ) { + /* Skip kernel's context and get a new one. */ + ctx.handle = DRM(ctxbitmap_next)( dev ); + } + DRM_DEBUG( "%d\n", ctx.handle ); + if ( ctx.handle == -1 ) { + DRM_DEBUG( "Not enough free contexts.\n" ); + /* Should this return -EBUSY instead? */ + return -ENOMEM; + } + + if ( copy_to_user( (drm_ctx_t *)arg, &ctx, sizeof(ctx) ) ) + return -EFAULT; + return 0; +} + +int DRM(modctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + /* This does nothing */ + return 0; +} + +int DRM(getctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t*)arg, sizeof(ctx) ) ) + return -EFAULT; + + /* This is 0, because we don't handle any context flags */ + ctx.flags = 0; + + if ( copy_to_user( (drm_ctx_t*)arg, &ctx, sizeof(ctx) ) ) + return -EFAULT; + return 0; +} + +int DRM(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; + + if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + return DRM(context_switch)( dev, dev->last_context, ctx.handle ); +} + +int DRM(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; + + if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + DRM(context_switch_complete)( dev, ctx.handle ); + + return 0; +} + +int DRM(rmctx)( 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; + + if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + if ( ctx.handle == DRM_KERNEL_CONTEXT + 1 ) { + priv->remove_auth_on_close = 1; + } + if ( ctx.handle != DRM_KERNEL_CONTEXT ) { + DRM(ctxbitmap_free)( dev, ctx.handle ); + } + + return 0; +} + + +#else /* __HAVE_CTX_BITMAP */ + +/* ================================================================ + * Old-style context support + */ + + +int DRM(context_switch)(drm_device_t *dev, int old, int new) +{ + char buf[64]; + drm_queue_t *q; + +#if 0 + atomic_inc(&dev->total_ctx); +#endif + + if (test_and_set_bit(0, &dev->context_flag)) { + DRM_ERROR("Reentering -- FIXME\n"); + return -EBUSY; + } + +#if __HAVE_DMA_HISTOGRAM + dev->ctx_start = get_cycles(); +#endif + + DRM_DEBUG("Context switch from %d to %d\n", old, new); + + if (new >= dev->queue_count) { + clear_bit(0, &dev->context_flag); + return -EINVAL; + } + + if (new == dev->last_context) { + clear_bit(0, &dev->context_flag); + return 0; + } + + q = dev->queuelist[new]; + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) == 1) { + atomic_dec(&q->use_count); + clear_bit(0, &dev->context_flag); + return -EINVAL; + } + + if (DRM(flags) & DRM_FLAG_NOCTX) { + DRM(context_switch_complete)(dev, new); + } else { + sprintf(buf, "C %d %d\n", old, new); + DRM(write_string)(dev, buf); + } + + atomic_dec(&q->use_count); + + return 0; +} + +int DRM(context_switch_complete)(drm_device_t *dev, int new) +{ + drm_device_dma_t *dma = dev->dma; + + 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 (!dma || !(dma->next_buffer && dma->next_buffer->while_locked)) { + if (DRM(lock_free)(dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT)) { + DRM_ERROR("Cannot free lock\n"); + } + } + +#if __HAVE_DMA_HISTOGRAM + atomic_inc(&dev->histo.ctx[DRM(histogram_slot)(get_cycles() + - dev->ctx_start)]); + +#endif + clear_bit(0, &dev->context_flag); + wake_up_interruptible(&dev->context_wait); + + return 0; +} + +static int DRM(init_queue)(drm_device_t *dev, drm_queue_t *q, drm_ctx_t *ctx) +{ + DRM_DEBUG("\n"); + + if (atomic_read(&q->use_count) != 1 + || atomic_read(&q->finalization) + || atomic_read(&q->block_count)) { + DRM_ERROR("New queue is already in use: u%d f%d b%d\n", + atomic_read(&q->use_count), + atomic_read(&q->finalization), + atomic_read(&q->block_count)); + } + + atomic_set(&q->finalization, 0); + atomic_set(&q->block_count, 0); + atomic_set(&q->block_read, 0); + atomic_set(&q->block_write, 0); + atomic_set(&q->total_queued, 0); + atomic_set(&q->total_flushed, 0); + atomic_set(&q->total_locks, 0); + + init_waitqueue_head(&q->write_queue); + init_waitqueue_head(&q->read_queue); + init_waitqueue_head(&q->flush_queue); + + q->flags = ctx->flags; + + DRM(waitlist_create)(&q->waitlist, dev->dma->buf_count); + + return 0; +} + + +/* drm_alloc_queue: +PRE: 1) dev->queuelist[0..dev->queue_count] is allocated and will not + disappear (so all deallocation must be done after IOCTLs are off) + 2) dev->queue_count < dev->queue_slots + 3) dev->queuelist[i].use_count == 0 and + dev->queuelist[i].finalization == 0 if i not in use +POST: 1) dev->queuelist[i].use_count == 1 + 2) dev->queue_count < dev->queue_slots */ + +static int DRM(alloc_queue)(drm_device_t *dev) +{ + int i; + drm_queue_t *queue; + int oldslots; + int newslots; + /* Check for a free queue */ + for (i = 0; i < dev->queue_count; i++) { + atomic_inc(&dev->queuelist[i]->use_count); + if (atomic_read(&dev->queuelist[i]->use_count) == 1 + && !atomic_read(&dev->queuelist[i]->finalization)) { + DRM_DEBUG("%d (free)\n", i); + return i; + } + atomic_dec(&dev->queuelist[i]->use_count); + } + /* Allocate a new queue */ + down(&dev->struct_sem); + + queue = gamma_alloc(sizeof(*queue), DRM_MEM_QUEUES); + memset(queue, 0, sizeof(*queue)); + atomic_set(&queue->use_count, 1); + + ++dev->queue_count; + if (dev->queue_count >= dev->queue_slots) { + oldslots = dev->queue_slots * sizeof(*dev->queuelist); + if (!dev->queue_slots) dev->queue_slots = 1; + dev->queue_slots *= 2; + newslots = dev->queue_slots * sizeof(*dev->queuelist); + + dev->queuelist = DRM(realloc)(dev->queuelist, + oldslots, + newslots, + DRM_MEM_QUEUES); + if (!dev->queuelist) { + up(&dev->struct_sem); + DRM_DEBUG("out of memory\n"); + return -ENOMEM; + } + } + dev->queuelist[dev->queue_count-1] = queue; + + up(&dev->struct_sem); + DRM_DEBUG("%d (new)\n", dev->queue_count - 1); + return dev->queue_count - 1; +} + +int DRM(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); + if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) + return -EFAULT; + if (res.count >= DRM_RESERVED_CONTEXTS) { + memset(&ctx, 0, sizeof(ctx)); + for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { + ctx.handle = i; + if (copy_to_user(&res.contexts[i], + &i, + sizeof(i))) + return -EFAULT; + } + } + res.count = DRM_RESERVED_CONTEXTS; + if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) + return -EFAULT; + return 0; +} + +int DRM(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; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + if ((ctx.handle = DRM(alloc_queue)(dev)) == DRM_KERNEL_CONTEXT) { + /* Init kernel's context and get a new one. */ + DRM(init_queue)(dev, dev->queuelist[ctx.handle], &ctx); + ctx.handle = DRM(alloc_queue)(dev); + } + DRM(init_queue)(dev, dev->queuelist[ctx.handle], &ctx); + DRM_DEBUG("%d\n", ctx.handle); + if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) + return -EFAULT; + return 0; +} + +int DRM(modctx)(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; + drm_queue_t *q; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle < 0 || ctx.handle >= dev->queue_count) return -EINVAL; + q = dev->queuelist[ctx.handle]; + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) == 1) { + /* No longer in use */ + atomic_dec(&q->use_count); + return -EINVAL; + } + + if (DRM_BUFCOUNT(&q->waitlist)) { + atomic_dec(&q->use_count); + return -EBUSY; + } + + q->flags = ctx.flags; + + atomic_dec(&q->use_count); + return 0; +} + +int DRM(getctx)(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; + drm_queue_t *q; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle >= dev->queue_count) return -EINVAL; + q = dev->queuelist[ctx.handle]; + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) == 1) { + /* No longer in use */ + atomic_dec(&q->use_count); + return -EINVAL; + } + + ctx.flags = q->flags; + atomic_dec(&q->use_count); + + if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) + return -EFAULT; + + return 0; +} + +int DRM(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; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + DRM_DEBUG("%d\n", ctx.handle); + return DRM(context_switch)(dev, dev->last_context, ctx.handle); +} + +int DRM(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; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + DRM_DEBUG("%d\n", ctx.handle); + DRM(context_switch_complete)(dev, ctx.handle); + + return 0; +} + +int DRM(rmctx)(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; + drm_queue_t *q; + drm_buf_t *buf; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle >= dev->queue_count) return -EINVAL; + q = dev->queuelist[ctx.handle]; + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) == 1) { + /* No longer in use */ + atomic_dec(&q->use_count); + return -EINVAL; + } + + atomic_inc(&q->finalization); /* Mark queue in finalization state */ + atomic_sub(2, &q->use_count); /* Mark queue as unused (pending + finalization) */ + + while (test_and_set_bit(0, &dev->interrupt_flag)) { + schedule(); + if (signal_pending(current)) { + clear_bit(0, &dev->interrupt_flag); + return -EINTR; + } + } + /* Remove queued buffers */ + while ((buf = DRM(waitlist_get)(&q->waitlist))) { + DRM(free_buffer)(dev, buf); + } + clear_bit(0, &dev->interrupt_flag); + + /* Wakeup blocked processes */ + wake_up_interruptible(&q->read_queue); + wake_up_interruptible(&q->write_queue); + wake_up_interruptible(&q->flush_queue); + + /* Finalization over. Queue is made + available when both use_count and + finalization become 0, which won't + happen until all the waiting processes + stop waiting. */ + atomic_dec(&q->finalization); + return 0; +} + +#endif /* __HAVE_CTX_BITMAP */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h new file mode 100644 index 000000000..e715bd416 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h @@ -0,0 +1,594 @@ +/* drm_dma.c -- DMA IOCTL and function support -*- linux-c -*- + * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#include <linux/interrupt.h> /* For task queue support */ + +#ifndef __HAVE_DMA_WAITQUEUE +#define __HAVE_DMA_WAITQUEUE 0 +#endif +#ifndef __HAVE_DMA_RECLAIM +#define __HAVE_DMA_RECLAIM 0 +#endif + +#if __HAVE_DMA + +int DRM(dma_setup)( drm_device_t *dev ) +{ + int i; + + dev->dma = DRM(alloc)( sizeof(*dev->dma), DRM_MEM_DRIVER ); + if ( !dev->dma ) + return -ENOMEM; + + memset( dev->dma, 0, sizeof(*dev->dma) ); + + for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ ) + memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0])); + + return 0; +} + +void DRM(dma_takedown)(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + int i, j; + + if (!dma) return; + + /* Clear dma buffers */ + for (i = 0; i <= DRM_MAX_ORDER; i++) { + if (dma->bufs[i].seg_count) { + DRM_DEBUG("order %d: buf_count = %d," + " seg_count = %d\n", + i, + dma->bufs[i].buf_count, + dma->bufs[i].seg_count); + for (j = 0; j < dma->bufs[i].seg_count; j++) { + DRM(free_pages)(dma->bufs[i].seglist[j], + dma->bufs[i].page_order, + DRM_MEM_DMA); + } + DRM(free)(dma->bufs[i].seglist, + dma->bufs[i].seg_count + * sizeof(*dma->bufs[0].seglist), + DRM_MEM_SEGS); + } + if(dma->bufs[i].buf_count) { + for(j = 0; j < dma->bufs[i].buf_count; j++) { + if(dma->bufs[i].buflist[j].dev_private) { + DRM(free)(dma->bufs[i].buflist[j].dev_private, + dma->bufs[i].buflist[j].dev_priv_size, + DRM_MEM_BUFS); + } + } + DRM(free)(dma->bufs[i].buflist, + dma->bufs[i].buf_count * + sizeof(*dma->bufs[0].buflist), + DRM_MEM_BUFS); +#if __HAVE_DMA_FREELIST + DRM(freelist_destroy)(&dma->bufs[i].freelist); +#endif + } + } + + if (dma->buflist) { + DRM(free)(dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + DRM_MEM_BUFS); + } + + if (dma->pagelist) { + DRM(free)(dma->pagelist, + dma->page_count * sizeof(*dma->pagelist), + DRM_MEM_PAGES); + } + DRM(free)(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER); + dev->dma = NULL; +} + + +#if __HAVE_DMA_HISTOGRAM +/* This is slow, but is useful for debugging. */ +int DRM(histogram_slot)(unsigned long count) +{ + int value = DRM_DMA_HISTOGRAM_INITIAL; + int slot; + + for (slot = 0; + slot < DRM_DMA_HISTOGRAM_SLOTS; + ++slot, value = DRM_DMA_HISTOGRAM_NEXT(value)) { + if (count < value) return slot; + } + return DRM_DMA_HISTOGRAM_SLOTS - 1; +} + +void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf) +{ + cycles_t queued_to_dispatched; + cycles_t dispatched_to_completed; + cycles_t completed_to_freed; + int q2d, d2c, c2f, q2c, q2f; + + if (buf->time_queued) { + queued_to_dispatched = (buf->time_dispatched + - buf->time_queued); + dispatched_to_completed = (buf->time_completed + - buf->time_dispatched); + completed_to_freed = (buf->time_freed + - buf->time_completed); + + q2d = DRM(histogram_slot)(queued_to_dispatched); + d2c = DRM(histogram_slot)(dispatched_to_completed); + c2f = DRM(histogram_slot)(completed_to_freed); + + q2c = DRM(histogram_slot)(queued_to_dispatched + + dispatched_to_completed); + q2f = DRM(histogram_slot)(queued_to_dispatched + + dispatched_to_completed + + completed_to_freed); + + atomic_inc(&dev->histo.total); + atomic_inc(&dev->histo.queued_to_dispatched[q2d]); + atomic_inc(&dev->histo.dispatched_to_completed[d2c]); + atomic_inc(&dev->histo.completed_to_freed[c2f]); + + atomic_inc(&dev->histo.queued_to_completed[q2c]); + atomic_inc(&dev->histo.queued_to_freed[q2f]); + + } + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; +} +#endif + +void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf) +{ + if (!buf) return; + + buf->waiting = 0; + buf->pending = 0; + buf->pid = 0; + buf->used = 0; +#if __HAVE_DMA_HISTOGRAM + buf->time_completed = get_cycles(); +#endif + + if ( __HAVE_DMA_WAITQUEUE && waitqueue_active(&buf->dma_wait)) { + wake_up_interruptible(&buf->dma_wait); + } +#if __HAVE_DMA_FREELIST + else { + drm_device_dma_t *dma = dev->dma; + /* If processes are waiting, the last one + to wake will put the buffer on the free + list. If no processes are waiting, we + put the buffer on the freelist here. */ + DRM(freelist_put)(dev, &dma->bufs[buf->order].freelist, buf); + } +#endif +} + +#if !__HAVE_DMA_RECLAIM +void DRM(reclaim_buffers)(drm_device_t *dev, pid_t pid) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma) return; + for (i = 0; i < dma->buf_count; i++) { + if (dma->buflist[i]->pid == pid) { + switch (dma->buflist[i]->list) { + case DRM_LIST_NONE: + DRM(free_buffer)(dev, dma->buflist[i]); + break; + case DRM_LIST_WAIT: + dma->buflist[i]->list = DRM_LIST_RECLAIM; + break; + default: + /* Buffer already on hardware. */ + break; + } + } + } +} +#endif + + +/* GH: This is a big hack for now... + */ +#if __HAVE_OLD_DMA + +void DRM(clear_next_buffer)(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + + dma->next_buffer = NULL; + if (dma->next_queue && !DRM_BUFCOUNT(&dma->next_queue->waitlist)) { + wake_up_interruptible(&dma->next_queue->flush_queue); + } + dma->next_queue = NULL; +} + +int DRM(select_queue)(drm_device_t *dev, void (*wrapper)(unsigned long)) +{ + int i; + int candidate = -1; + int j = jiffies; + + if (!dev) { + DRM_ERROR("No device\n"); + return -1; + } + if (!dev->queuelist || !dev->queuelist[DRM_KERNEL_CONTEXT]) { + /* This only happens between the time the + interrupt is initialized and the time + the queues are initialized. */ + return -1; + } + + /* Doing "while locked" DMA? */ + if (DRM_WAITCOUNT(dev, DRM_KERNEL_CONTEXT)) { + return DRM_KERNEL_CONTEXT; + } + + /* If there are buffers on the last_context + queue, and we have not been executing + this context very long, continue to + execute this context. */ + if (dev->last_switch <= j + && dev->last_switch + DRM_TIME_SLICE > j + && DRM_WAITCOUNT(dev, dev->last_context)) { + return dev->last_context; + } + + /* Otherwise, find a candidate */ + for (i = dev->last_checked + 1; i < dev->queue_count; i++) { + if (DRM_WAITCOUNT(dev, i)) { + candidate = dev->last_checked = i; + break; + } + } + + if (candidate < 0) { + for (i = 0; i < dev->queue_count; i++) { + if (DRM_WAITCOUNT(dev, i)) { + candidate = dev->last_checked = i; + break; + } + } + } + + if (wrapper + && candidate >= 0 + && candidate != dev->last_context + && dev->last_switch <= j + && dev->last_switch + DRM_TIME_SLICE > j) { + if (dev->timer.expires != dev->last_switch + DRM_TIME_SLICE) { + del_timer(&dev->timer); + dev->timer.function = wrapper; + dev->timer.data = (unsigned long)dev; + dev->timer.expires = dev->last_switch+DRM_TIME_SLICE; + add_timer(&dev->timer); + } + return -1; + } + + return candidate; +} + + +int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *d) +{ + int i; + drm_queue_t *q; + drm_buf_t *buf; + int idx; + int while_locked = 0; + drm_device_dma_t *dma = dev->dma; + DECLARE_WAITQUEUE(entry, current); + + DRM_DEBUG("%d\n", d->send_count); + + if (d->flags & _DRM_DMA_WHILE_LOCKED) { + int context = dev->lock.hw_lock->lock; + + if (!_DRM_LOCK_IS_HELD(context)) { + DRM_ERROR("No lock held during \"while locked\"" + " request\n"); + return -EINVAL; + } + if (d->context != _DRM_LOCKING_CONTEXT(context) + && _DRM_LOCKING_CONTEXT(context) != DRM_KERNEL_CONTEXT) { + DRM_ERROR("Lock held by %d while %d makes" + " \"while locked\" request\n", + _DRM_LOCKING_CONTEXT(context), + d->context); + return -EINVAL; + } + q = dev->queuelist[DRM_KERNEL_CONTEXT]; + while_locked = 1; + } else { + q = dev->queuelist[d->context]; + } + + + atomic_inc(&q->use_count); + if (atomic_read(&q->block_write)) { + add_wait_queue(&q->write_queue, &entry); + atomic_inc(&q->block_count); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if (!atomic_read(&q->block_write)) break; + schedule(); + if (signal_pending(current)) { + atomic_dec(&q->use_count); + remove_wait_queue(&q->write_queue, &entry); + return -EINTR; + } + } + atomic_dec(&q->block_count); + current->state = TASK_RUNNING; + remove_wait_queue(&q->write_queue, &entry); + } + + for (i = 0; i < d->send_count; i++) { + idx = d->send_indices[i]; + if (idx < 0 || idx >= dma->buf_count) { + atomic_dec(&q->use_count); + DRM_ERROR("Index %d (of %d max)\n", + d->send_indices[i], dma->buf_count - 1); + return -EINVAL; + } + buf = dma->buflist[ idx ]; + if (buf->pid != current->pid) { + atomic_dec(&q->use_count); + DRM_ERROR("Process %d using buffer owned by %d\n", + current->pid, buf->pid); + return -EINVAL; + } + if (buf->list != DRM_LIST_NONE) { + atomic_dec(&q->use_count); + DRM_ERROR("Process %d using buffer %d on list %d\n", + current->pid, buf->idx, buf->list); + } + buf->used = d->send_sizes[i]; + buf->while_locked = while_locked; + buf->context = d->context; + if (!buf->used) { + DRM_ERROR("Queueing 0 length buffer\n"); + } + if (buf->pending) { + atomic_dec(&q->use_count); + DRM_ERROR("Queueing pending buffer:" + " buffer %d, offset %d\n", + d->send_indices[i], i); + return -EINVAL; + } + if (buf->waiting) { + atomic_dec(&q->use_count); + DRM_ERROR("Queueing waiting buffer:" + " buffer %d, offset %d\n", + d->send_indices[i], i); + return -EINVAL; + } + buf->waiting = 1; + if (atomic_read(&q->use_count) == 1 + || atomic_read(&q->finalization)) { + DRM(free_buffer)(dev, buf); + } else { + DRM(waitlist_put)(&q->waitlist, buf); + atomic_inc(&q->total_queued); + } + } + atomic_dec(&q->use_count); + + return 0; +} + +static int DRM(dma_get_buffers_of_order)(drm_device_t *dev, drm_dma_t *d, + int order) +{ + int i; + drm_buf_t *buf; + drm_device_dma_t *dma = dev->dma; + + for (i = d->granted_count; i < d->request_count; i++) { + buf = DRM(freelist_get)(&dma->bufs[order].freelist, + d->flags & _DRM_DMA_WAIT); + if (!buf) break; + if (buf->pending || buf->waiting) { + DRM_ERROR("Free buffer %d in use by %d (w%d, p%d)\n", + buf->idx, + buf->pid, + buf->waiting, + buf->pending); + } + buf->pid = current->pid; + if (copy_to_user(&d->request_indices[i], + &buf->idx, + sizeof(buf->idx))) + return -EFAULT; + + if (copy_to_user(&d->request_sizes[i], + &buf->total, + sizeof(buf->total))) + return -EFAULT; + + ++d->granted_count; + } + return 0; +} + + +int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma) +{ + int order; + int retcode = 0; + int tmp_order; + + order = DRM(order)(dma->request_size); + + dma->granted_count = 0; + retcode = DRM(dma_get_buffers_of_order)(dev, dma, order); + + if (dma->granted_count < dma->request_count + && (dma->flags & _DRM_DMA_SMALLER_OK)) { + for (tmp_order = order - 1; + !retcode + && dma->granted_count < dma->request_count + && tmp_order >= DRM_MIN_ORDER; + --tmp_order) { + + retcode = DRM(dma_get_buffers_of_order)(dev, dma, + tmp_order); + } + } + + if (dma->granted_count < dma->request_count + && (dma->flags & _DRM_DMA_LARGER_OK)) { + for (tmp_order = order + 1; + !retcode + && dma->granted_count < dma->request_count + && tmp_order <= DRM_MAX_ORDER; + ++tmp_order) { + + retcode = DRM(dma_get_buffers_of_order)(dev, dma, + tmp_order); + } + } + return 0; +} + +#endif /* __HAVE_OLD_DMA */ + + +#if __HAVE_DMA_IRQ + +int DRM(irq_install)( drm_device_t *dev, int irq ) +{ + int ret; + + if ( !irq ) + return -EINVAL; + + down( &dev->struct_sem ); + if ( dev->irq ) { + up( &dev->struct_sem ); + return -EBUSY; + } + dev->irq = irq; + up( &dev->struct_sem ); + + DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); + + dev->context_flag = 0; + dev->interrupt_flag = 0; + dev->dma_flag = 0; + + dev->dma->next_buffer = NULL; + dev->dma->next_queue = NULL; + dev->dma->this_buffer = NULL; + +#if __HAVE_DMA_IRQ_BH + INIT_LIST_HEAD( &dev->tq.list ); + dev->tq.sync = 0; + dev->tq.routine = DRM(dma_immediate_bh); + dev->tq.data = dev; +#endif + + /* Before installing handler */ + DRIVER_PREINSTALL(); + + /* Install handler */ + ret = request_irq( dev->irq, DRM(dma_service), + 0, dev->devname, dev ); + if ( ret < 0 ) { + down( &dev->struct_sem ); + dev->irq = 0; + up( &dev->struct_sem ); + return ret; + } + + /* After installing handler */ + DRIVER_POSTINSTALL(); + + return 0; +} + +int DRM(irq_uninstall)( drm_device_t *dev ) +{ + int irq; + + down( &dev->struct_sem ); + irq = dev->irq; + dev->irq = 0; + up( &dev->struct_sem ); + + if ( !irq ) + return -EINVAL; + + DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); + + DRIVER_UNINSTALL(); + + free_irq( irq, dev ); + + return 0; +} + +int DRM(control)( 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_control_t ctl; + + if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) ) + return -EFAULT; + + switch ( ctl.func ) { + case DRM_INST_HANDLER: + return DRM(irq_install)( dev, ctl.irq ); + case DRM_UNINST_HANDLER: + return DRM(irq_uninstall)( dev ); + default: + return -EINVAL; + } +} + +#endif /* __HAVE_DMA_IRQ */ + +#endif /* __HAVE_DMA */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h new file mode 100644 index 000000000..13e46b9fd --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h @@ -0,0 +1,51 @@ +/* drm_drawable.h -- IOCTLs for drawables -*- linux-c -*- + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +int DRM(adddraw)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_draw_t draw; + + draw.handle = 0; /* NOOP */ + DRM_DEBUG("%d\n", draw.handle); + if (copy_to_user((drm_draw_t *)arg, &draw, sizeof(draw))) + return -EFAULT; + return 0; +} + +int DRM(rmdraw)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + return 0; /* NOOP */ +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h new file mode 100644 index 000000000..7447ca6d4 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h @@ -0,0 +1,938 @@ +/* drm_drv.h -- Generic driver template -*- linux-c -*- + * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +/* + * To use this template, you must at least define the following (samples + * given for the MGA driver): + * + * #define DRIVER_AUTHOR "VA Linux Systems, Inc." + * + * #define DRIVER_NAME "mga" + * #define DRIVER_DESC "Matrox G200/G400" + * #define DRIVER_DATE "20001127" + * + * #define DRIVER_MAJOR 2 + * #define DRIVER_MINOR 0 + * #define DRIVER_PATCHLEVEL 2 + * + * #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( mga_ioctls ) + * + * #define DRM(x) mga_##x + */ + +#ifndef __MUST_HAVE_AGP +#define __MUST_HAVE_AGP 0 +#endif +#ifndef __HAVE_CTX_BITMAP +#define __HAVE_CTX_BITMAP 0 +#endif +#ifndef __HAVE_DMA_IRQ +#define __HAVE_DMA_IRQ 0 +#endif +#ifndef __HAVE_DMA_QUEUE +#define __HAVE_DMA_QUEUE 0 +#endif +#ifndef __HAVE_MULTIPLE_DMA_QUEUES +#define __HAVE_MULTIPLE_DMA_QUEUES 0 +#endif +#ifndef __HAVE_DMA_SCHEDULE +#define __HAVE_DMA_SCHEDULE 0 +#endif +#ifndef __HAVE_DMA_FLUSH +#define __HAVE_DMA_FLUSH 0 +#endif +#ifndef __HAVE_DMA_READY +#define __HAVE_DMA_READY 0 +#endif +#ifndef __HAVE_DMA_QUIESCENT +#define __HAVE_DMA_QUIESCENT 0 +#endif +#ifndef __HAVE_RELEASE +#define __HAVE_RELEASE 0 +#endif +#ifndef __HAVE_COUNTERS +#define __HAVE_COUNTERS 0 +#endif + +#ifndef DRIVER_PREINIT +#define DRIVER_PREINIT() +#endif +#ifndef DRIVER_POSTINIT +#define DRIVER_POSTINIT() +#endif +#ifndef DRIVER_PRERELEASE +#define DRIVER_PRERELEASE() +#endif +#ifndef DRIVER_PRETAKEDOWN +#define DRIVER_PRETAKEDOWN() +#endif +#ifndef DRIVER_IOCTLS +#define DRIVER_IOCTLS +#endif + + +static drm_device_t DRM(device); +static int DRM(minor); + +static struct file_operations DRM(fops) = { +#if LINUX_VERSION_CODE >= 0x020400 + /* This started being used during 2.4.0-test */ + owner: THIS_MODULE, +#endif + open: DRM(open), + flush: DRM(flush), + release: DRM(release), + ioctl: DRM(ioctl), + mmap: DRM(mmap), + read: DRM(read), + fasync: DRM(fasync), + poll: DRM(poll), +}; + + +static drm_ioctl_desc_t DRM(ioctls)[] = { + [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(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_GET_MAP)] = { DRM(getmap), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { DRM(getclient), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { DRM(getstats), 0, 0 }, + + [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_RM_MAP)] = { DRM(rmmap), 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { DRM(setsareactx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { DRM(getsareactx), 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { DRM(addctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { DRM(rmctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { DRM(modctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { DRM(getctx), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { DRM(switchctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { DRM(newctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { DRM(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)] = { DRM(lock), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { DRM(unlock), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { DRM(finish), 1, 0 }, + +#if __HAVE_DMA + [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { DRM(addbufs), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { DRM(markbufs), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { DRM(infobufs), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { DRM(mapbufs), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { DRM(freebufs), 1, 0 }, + + /* The DRM_IOCTL_DMA ioctl should be defined by the driver. + */ +#if __HAVE_DMA_IRQ + [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, +#endif +#endif + +#if __REALLY_HAVE_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 + + DRIVER_IOCTLS +}; + +#define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( DRM(ioctls) ) + +#ifdef MODULE +static char *drm_opts = NULL; +#endif + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_PARM( drm_opts, "s" ); + +#ifndef MODULE +/* DRM(options) 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_drm. + */ + +static int __init DRM(options)( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", DRM(options) ); +#endif + +static int DRM(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 ); + +#if __HAVE_DMA + i = DRM(dma_setup)( dev ); + if ( i < 0 ) + return i; +#endif + + dev->counters = 6 + __HAVE_COUNTERS; + dev->types[0] = _DRM_STAT_LOCK; + dev->types[1] = _DRM_STAT_OPENS; + dev->types[2] = _DRM_STAT_CLOSES; + dev->types[3] = _DRM_STAT_IOCTLS; + dev->types[4] = _DRM_STAT_LOCKS; + dev->types[5] = _DRM_STAT_UNLOCKS; +#ifdef __HAVE_COUNTER6 + dev->types[6] = __HAVE_COUNTER6; +#endif +#ifdef __HAVE_COUNTER7 + dev->types[7] = __HAVE_COUNTER7; +#endif +#ifdef __HAVE_COUNTER8 + dev->types[8] = __HAVE_COUNTER8; +#endif +#ifdef __HAVE_COUNTER9 + dev->types[9] = __HAVE_COUNTER9; +#endif +#ifdef __HAVE_COUNTER10 + dev->types[10] = __HAVE_COUNTER10; +#endif +#ifdef __HAVE_COUNTER11 + dev->types[11] = __HAVE_COUNTER11; +#endif +#ifdef __HAVE_COUNTER12 + dev->types[12] = __HAVE_COUNTER12; +#endif +#ifdef __HAVE_COUNTER13 + dev->types[13] = __HAVE_COUNTER13; +#endif +#ifdef __HAVE_COUNTER14 + dev->types[14] = __HAVE_COUNTER14; +#endif +#ifdef __HAVE_COUNTER15 + dev->types[14] = __HAVE_COUNTER14; +#endif + + for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ ) + atomic_set( &dev->counts[i], 0 ); + + for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) { + dev->magiclist[i].head = NULL; + dev->magiclist[i].tail = NULL; + } + + dev->maplist = DRM(alloc)(sizeof(*dev->maplist), + DRM_MEM_MAPS); + if(dev->maplist == NULL) return -ENOMEM; + memset(dev->maplist, 0, sizeof(*dev->maplist)); + INIT_LIST_HEAD(&dev->maplist->head); + 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_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 ); + + 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 DRM(takedown)( drm_device_t *dev ) +{ + drm_magic_entry_t *pt, *next; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list; + drm_vma_entry_t *vma, *vma_next; + int i; + + DRM_DEBUG( "\n" ); + + DRIVER_PRETAKEDOWN(); +#if __HAVE_DMA_IRQ + if ( dev->irq ) DRM(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; + } + +#if __REALLY_HAVE_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 drv_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_do_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; + } + + if( dev->maplist ) { + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + map = r_list->map; + DRM(free)(r_list, sizeof(*r_list), DRM_MEM_MAPS); + if(!map) continue; + + switch ( map->type ) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#if __REALLY_HAVE_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: + vfree(map->handle); + 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, sizeof(*dev->maplist), DRM_MEM_MAPS); + dev->maplist = NULL; + } + +#if __HAVE_DMA_QUEUE || __HAVE_MULTIPLE_DMA_QUEUES + if ( dev->queuelist ) { + for ( i = 0 ; i < dev->queue_count ; i++ ) { + DRM(waitlist_destroy)( &dev->queuelist[i]->waitlist ); + if ( dev->queuelist[i] ) { + DRM(free)( dev->queuelist[i], + sizeof(*dev->queuelist[0]), + DRM_MEM_QUEUES ); + dev->queuelist[i] = NULL; + } + } + DRM(free)( dev->queuelist, + dev->queue_slots * sizeof(*dev->queuelist), + DRM_MEM_QUEUES ); + dev->queuelist = NULL; + } + dev->queue_count = 0; +#endif + +#if __HAVE_DMA + DRM(dma_takedown)( dev ); +#endif + 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; +} + +/* drm_init is called via init_module at module load time, or via + * linux/init/main.c (this is not currently supported). + */ +static int __init drm_init( void ) +{ + drm_device_t *dev = &DRM(device); +#if __HAVE_CTX_BITMAP + int retcode; +#endif + 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)( drm_opts ); +#endif + DRIVER_PREINIT(); + + DRM(mem_init)(); + + if ((DRM(minor) = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) + return -EPERM; + dev->device = MKDEV(DRM_MAJOR, DRM(minor) ); + dev->name = DRIVER_NAME; + +#if __REALLY_HAVE_AGP + dev->agp = DRM(agp_init)(); +#if __MUST_HAVE_AGP + if ( dev->agp == NULL ) { + DRM_ERROR( "Cannot initialize the agpgart module.\n" ); + DRM(stub_unregister)(DRM(minor)); + DRM(takedown)( dev ); + return -ENOMEM; + } +#endif +#if __REALLY_HAVE_MTRR + if (dev->agp) + 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 + +#if __HAVE_CTX_BITMAP + retcode = DRM(ctxbitmap_init)( dev ); + if( retcode ) { + DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); + DRM(stub_unregister)(DRM(minor)); + DRM(takedown)( dev ); + return retcode; + } +#endif + + DRIVER_POSTINIT(); + + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + DRM(minor) ); + + return 0; +} + +/* drm_cleanup is called via cleanup_module at module unload time. + */ +static void __exit drm_cleanup( void ) +{ + drm_device_t *dev = &DRM(device); + + DRM_DEBUG( "\n" ); + + if ( DRM(stub_unregister)(DRM(minor)) ) { + DRM_ERROR( "Cannot unload module\n" ); + } else { + DRM_INFO( "Module unloaded\n" ); + } +#if __HAVE_CTX_BITMAP + DRM(ctxbitmap_cleanup)( dev ); +#endif + +#if __REALLY_HAVE_AGP && __REALLY_HAVE_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 + + DRM(takedown)( dev ); + +#if __REALLY_HAVE_AGP + if ( dev->agp ) { + DRM(agp_uninit)(); + DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS ); + dev->agp = NULL; + } +#endif +} + +module_init( drm_init ); +module_exit( drm_cleanup ); + + +int DRM(version)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_version_t version; + int len; + + if ( copy_from_user( &version, + (drm_version_t *)arg, + sizeof(version) ) ) + return -EFAULT; + +#define DRM_COPY( name, value ) \ + len = strlen( value ); \ + if ( len > name##_len ) len = name##_len; \ + name##_len = strlen( value ); \ + if ( len && name ) { \ + if ( copy_to_user( name, value, len ) ) \ + return -EFAULT; \ + } + + version.version_major = DRIVER_MAJOR; + version.version_minor = DRIVER_MINOR; + version.version_patchlevel = DRIVER_PATCHLEVEL; + + DRM_COPY( version.name, DRIVER_NAME ); + DRM_COPY( version.date, DRIVER_DATE ); + DRM_COPY( version.desc, DRIVER_DESC ); + + if ( copy_to_user( (drm_version_t *)arg, + &version, + sizeof(version) ) ) + return -EFAULT; + return 0; +} + +int DRM(open)( struct inode *inode, struct file *filp ) +{ + drm_device_t *dev = &DRM(device); + int retcode = 0; + + DRM_DEBUG( "open_count = %d\n", dev->open_count ); + + retcode = DRM(open_helper)( inode, filp, dev ); + if ( !retcode ) { +#if LINUX_VERSION_CODE < 0x020333 + MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + atomic_inc( &dev->counts[_DRM_STAT_OPENS] ); + spin_lock( &dev->count_lock ); + if ( !dev->open_count++ ) { + spin_unlock( &dev->count_lock ); + return DRM(setup)( dev ); + } + spin_unlock( &dev->count_lock ); + } + + return retcode; +} + +int DRM(release)( struct inode *inode, struct file *filp ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev; + int retcode = 0; + + lock_kernel(); + dev = priv->dev; + + DRM_DEBUG( "open_count = %d\n", dev->open_count ); + + DRIVER_PRERELEASE(); + + /* ======================================================== + * Begin inline drm_release + */ + + DRM_DEBUG( "pid = %d, device = 0x%x, open_count = %d\n", + current->pid, dev->device, dev->open_count ); + + if ( dev->lock.hw_lock && + _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) && + dev->lock.pid == current->pid ) { + DRM_DEBUG( "Process %d dead, freeing lock for context %d\n", + current->pid, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) ); +#if __HAVE_RELEASE + DRIVER_RELEASE(); +#endif + DRM(lock_free)( dev, &dev->lock.hw_lock->lock, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) ); + + /* FIXME: may require heavy-handed reset of + hardware at this point, possibly + processed via a callback to the X + server. */ + } +#if __HAVE_RELEASE + else if ( dev->lock.hw_lock ) { + /* The lock is required to reclaim buffers */ + DECLARE_WAITQUEUE( entry, current ); + add_wait_queue( &dev->lock.lock_queue, &entry ); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if ( !dev->lock.hw_lock ) { + /* Device has been unregistered */ + retcode = -EINTR; + break; + } + if ( DRM(lock_take)( &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ) ) { + dev->lock.pid = priv->pid; + dev->lock.lock_time = jiffies; + atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); + break; /* Got lock */ + } + /* Contention */ +#if 0 + atomic_inc( &dev->total_sleeps ); +#endif + schedule(); + if ( signal_pending( current ) ) { + retcode = -ERESTARTSYS; + break; + } + } + current->state = TASK_RUNNING; + remove_wait_queue( &dev->lock.lock_queue, &entry ); + if( !retcode ) { + DRIVER_RELEASE(); + DRM(lock_free)( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ); + } + } +#elif __HAVE_DMA + DRM(reclaim_buffers)( dev, priv->pid ); +#endif + + DRM(fasync)( -1, filp, 0 ); + + down( &dev->struct_sem ); + if ( priv->remove_auth_on_close == 1 ) { + drm_file_t *temp = dev->file_first; + while ( temp ) { + temp->authenticated = 0; + temp = temp->next; + } + } + if ( priv->prev ) { + priv->prev->next = priv->next; + } else { + dev->file_first = priv->next; + } + if ( priv->next ) { + priv->next->prev = priv->prev; + } else { + dev->file_last = priv->prev; + } + up( &dev->struct_sem ); + + DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES ); + + /* ======================================================== + * End inline drm_release + */ + +#if LINUX_VERSION_CODE < 0x020333 + MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); + 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 ); + unlock_kernel(); + return -EBUSY; + } + spin_unlock( &dev->count_lock ); + unlock_kernel(); + return DRM(takedown)( dev ); + } + spin_unlock( &dev->count_lock ); + + unlock_kernel(); + return retcode; +} + +/* DRM(ioctl) is called whenever a process performs an ioctl on /dev/drm. + */ +int DRM(ioctl)( 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_ioctl_desc_t *ioctl; + drm_ioctl_t *func; + int nr = DRM_IOCTL_NR(cmd); + int retcode = 0; + + atomic_inc( &dev->ioctl_count ); + atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] ); + ++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 >= DRIVER_IOCTL_COUNT ) { + retcode = -EINVAL; + } else { + ioctl = &DRM(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 DRM(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 ); + drm_lock_t lock; + int ret = 0; +#if __HAVE_MULTIPLE_DMA_QUEUES + drm_queue_t *q; +#endif +#if __HAVE_DMA_HISTOGRAM + cycles_t start; + + dev->lck_start = start = get_cycles(); +#endif + + if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) ) + return -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 __HAVE_DMA_QUEUE + if ( lock.context < 0 ) + return -EINVAL; +#elif __HAVE_MULTIPLE_DMA_QUEUES + if ( lock.context < 0 || lock.context >= dev->queue_count ) + return -EINVAL; + q = dev->queuelist[lock.context]; +#endif + +#if __HAVE_DMA_FLUSH + ret = DRM(flush_block_and_flush)( dev, lock.context, lock.flags ); +#endif + if ( !ret ) { + add_wait_queue( &dev->lock.lock_queue, &entry ); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + 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->counts[_DRM_STAT_LOCKS] ); + break; /* Got lock */ + } + + /* Contention */ + schedule(); + if ( signal_pending( current ) ) { + ret = -ERESTARTSYS; + break; + } + } + current->state = TASK_RUNNING; + remove_wait_queue( &dev->lock.lock_queue, &entry ); + } + +#if __HAVE_DMA_FLUSH + DRM(flush_unblock)( dev, lock.context, lock.flags ); /* cleanup phase */ +#endif + + if ( !ret ) { + sigemptyset( &dev->sigmask ); + sigaddset( &dev->sigmask, SIGSTOP ); + sigaddset( &dev->sigmask, SIGTSTP ); + sigaddset( &dev->sigmask, SIGTTIN ); + sigaddset( &dev->sigmask, SIGTTOU ); + dev->sigdata.context = lock.context; + dev->sigdata.lock = dev->lock.hw_lock; + block_all_signals( DRM(notifier), + &dev->sigdata, &dev->sigmask ); + +#if __HAVE_DMA_READY + if ( lock.flags & _DRM_LOCK_READY ) { + DRIVER_DMA_READY(); + } +#endif +#if __HAVE_DMA_QUIESCENT + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { + DRIVER_DMA_QUIESCENT(); + } +#endif + } + + DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" ); + +#if __HAVE_DMA_HISTOGRAM + atomic_inc(&dev->histo.lacq[DRM(histogram_slot)(get_cycles()-start)]); +#endif + return ret; +} + + +int DRM(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; + + if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) ) + return -EFAULT; + + if ( lock.context == DRM_KERNEL_CONTEXT ) { + DRM_ERROR( "Process %d using kernel context %d\n", + current->pid, lock.context ); + return -EINVAL; + } + + atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); + + DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ); +#if __HAVE_DMA_SCHEDULE + DRM(dma_schedule)( dev, 1 ); +#endif + + /* FIXME: Do we ever really need to check this??? + */ + if ( 1 /* !dev->context_flag */ ) { + if ( DRM(lock_free)( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ) ) { + DRM_ERROR( "\n" ); + } + } + + unblock_all_signals(); + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h new file mode 100644 index 000000000..dd5747669 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h @@ -0,0 +1,208 @@ +/* drm_fops.h -- File operations for DRM -*- linux-c -*- + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Daryll Strauss <daryll@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" +#include <linux/poll.h> + +/* drm_open is called whenever a process opens /dev/drm. */ + +int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev) +{ + kdev_t minor = MINOR(inode->i_rdev); + drm_file_t *priv; + + if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ + if (!DRM(cpu_valid)()) return -EINVAL; + + DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); + + priv = DRM(alloc)(sizeof(*priv), DRM_MEM_FILES); + memset(priv, 0, sizeof(*priv)); + filp->private_data = priv; + priv->uid = current->euid; + priv->pid = current->pid; + priv->minor = minor; + priv->dev = dev; + priv->ioctl_count = 0; + priv->authenticated = capable(CAP_SYS_ADMIN); + + down(&dev->struct_sem); + if (!dev->file_last) { + priv->next = NULL; + priv->prev = NULL; + dev->file_first = priv; + dev->file_last = priv; + } else { + priv->next = NULL; + priv->prev = dev->file_last; + dev->file_last->next = priv; + dev->file_last = priv; + } + up(&dev->struct_sem); + + return 0; +} + +int DRM(flush)(struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", + current->pid, dev->device, dev->open_count); + return 0; +} + +int DRM(fasync)(int fd, struct file *filp, int on) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode; + + DRM_DEBUG("fd = %d, device = 0x%x\n", fd, dev->device); + retcode = fasync_helper(fd, filp, on, &dev->buf_async); + if (retcode < 0) return retcode; + return 0; +} + + +/* The drm_read and drm_write_string code (especially that which manages + the circular buffer), is based on Alessandro Rubini's LINUX DEVICE + DRIVERS (Cambridge: O'Reilly, 1998), pages 111-113. */ + +ssize_t DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int left; + int avail; + int send; + int cur; + + DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); + + while (dev->buf_rp == dev->buf_wp) { + DRM_DEBUG(" sleeping\n"); + if (filp->f_flags & O_NONBLOCK) { + return -EAGAIN; + } + interruptible_sleep_on(&dev->buf_readers); + if (signal_pending(current)) { + DRM_DEBUG(" interrupted\n"); + return -ERESTARTSYS; + } + DRM_DEBUG(" awake\n"); + } + + left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; + avail = DRM_BSZ - left; + send = DRM_MIN(avail, count); + + while (send) { + if (dev->buf_wp > dev->buf_rp) { + cur = DRM_MIN(send, dev->buf_wp - dev->buf_rp); + } else { + cur = DRM_MIN(send, dev->buf_end - dev->buf_rp); + } + if (copy_to_user(buf, dev->buf_rp, cur)) + return -EFAULT; + dev->buf_rp += cur; + if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf; + send -= cur; + } + + wake_up_interruptible(&dev->buf_writers); + return DRM_MIN(avail, count);; +} + +int DRM(write_string)(drm_device_t *dev, const char *s) +{ + int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; + int send = strlen(s); + int count; + + DRM_DEBUG("%d left, %d to send (%p, %p)\n", + left, send, dev->buf_rp, dev->buf_wp); + + if (left == 1 || dev->buf_wp != dev->buf_rp) { + DRM_ERROR("Buffer not empty (%d left, wp = %p, rp = %p)\n", + left, + dev->buf_wp, + dev->buf_rp); + } + + while (send) { + if (dev->buf_wp >= dev->buf_rp) { + count = DRM_MIN(send, dev->buf_end - dev->buf_wp); + if (count == left) --count; /* Leave a hole */ + } else { + count = DRM_MIN(send, dev->buf_rp - dev->buf_wp - 1); + } + strncpy(dev->buf_wp, s, count); + dev->buf_wp += count; + if (dev->buf_wp == dev->buf_end) dev->buf_wp = dev->buf; + send -= count; + } + +#if LINUX_VERSION_CODE < 0x020315 && !defined(KILLFASYNCHASTHREEPARAMETERS) + /* The extra parameter to kill_fasync was added in 2.3.21, and is + _not_ present in _stock_ 2.2.14 and 2.2.15. However, some + distributions patch 2.2.x kernels to add this parameter. The + Makefile.linux attempts to detect this addition and defines + KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */ + if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO); +#else + + /* Parameter added in 2.3.21. */ +#if LINUX_VERSION_CODE < 0x020400 + if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN); +#else + /* Type of first parameter changed in + Linux 2.4.0-test2... */ + if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN); +#endif +#endif + DRM_DEBUG("waking\n"); + wake_up_interruptible(&dev->buf_readers); + return 0; +} + +unsigned int DRM(poll)(struct file *filp, struct poll_table_struct *wait) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + poll_wait(filp, &dev->buf_readers, wait); + if (dev->buf_wp != dev->buf_rp) return POLLIN | POLLRDNORM; + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h new file mode 100644 index 000000000..9ae984147 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h @@ -0,0 +1,112 @@ +/* drm_init.h -- Setup/Cleanup for DRM -*- linux-c -*- + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +int DRM(flags) = 0; + +/* drm_parse_option parses a single option. See description for + * drm_parse_options for details. + */ +static void DRM(parse_option)(char *s) +{ + char *c, *r; + + DRM_DEBUG("\"%s\"\n", s); + if (!s || !*s) return; + for (c = s; *c && *c != ':'; c++); /* find : or \0 */ + if (*c) r = c + 1; else r = NULL; /* remember remainder */ + *c = '\0'; /* terminate */ + if (!strcmp(s, "noctx")) { + DRM(flags) |= DRM_FLAG_NOCTX; + DRM_INFO("Server-mediated context switching OFF\n"); + return; + } + if (!strcmp(s, "debug")) { + DRM(flags) |= DRM_FLAG_DEBUG; + DRM_INFO("Debug messages ON\n"); + return; + } + DRM_ERROR("\"%s\" is not a valid option\n", s); + return; +} + +/* drm_parse_options parse the insmod "drm=" options, or the command-line + * options passed to the kernel via LILO. The grammar of the format is as + * follows: + * + * drm ::= 'drm=' option_list + * option_list ::= option [ ';' option_list ] + * option ::= 'device:' major + * | 'debug' + * | 'noctx' + * major ::= INTEGER + * + * Note that 's' contains option_list without the 'drm=' part. + * + * device=major,minor specifies the device number used for /dev/drm + * if major == 0 then the misc device is used + * if major == 0 and minor == 0 then dynamic misc allocation is used + * debug=on specifies that debugging messages will be printk'd + * debug=trace specifies that each function call will be logged via printk + * debug=off turns off all debugging options + * + */ + +void DRM(parse_options)(char *s) +{ + char *h, *t, *n; + + DRM_DEBUG("\"%s\"\n", s ?: ""); + if (!s || !*s) return; + + for (h = t = n = s; h && *h; h = n) { + for (; *t && *t != ';'; t++); /* find ; or \0 */ + if (*t) n = t + 1; else n = NULL; /* remember next */ + *t = '\0'; /* terminate */ + DRM(parse_option)(h); /* parse */ + } +} + +/* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0 + * otherwise. + */ +int DRM(cpu_valid)(void) +{ +#if defined(__i386__) + if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */ +#endif +#if defined(__sparc__) && !defined(__sparc_v9__) + return 0; /* No cmpxchg before v9 sparc. */ +#endif + return 1; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h new file mode 100644 index 000000000..2fba6b0c2 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h @@ -0,0 +1,210 @@ +/* drm_ioctl.h -- IOCTL processing for DRM -*- linux-c -*- + * Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +int DRM(irq_busid)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_irq_busid_t p; + struct pci_dev *dev; + + if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p))) + return -EFAULT; + dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum)); + if (dev) p.irq = dev->irq; + else p.irq = 0; + DRM_DEBUG("%d:%d:%d => IRQ %d\n", + p.busnum, p.devnum, p.funcnum, p.irq); + if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p))) + return -EFAULT; + return 0; +} + +int DRM(getunique)(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_unique_t u; + + if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) + return -EFAULT; + if (u.unique_len >= dev->unique_len) { + if (copy_to_user(u.unique, dev->unique, dev->unique_len)) + return -EFAULT; + } + u.unique_len = dev->unique_len; + if (copy_to_user((drm_unique_t *)arg, &u, sizeof(u))) + return -EFAULT; + return 0; +} + +int DRM(setunique)(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_unique_t u; + + if (dev->unique_len || dev->unique) + return -EBUSY; + + if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) + return -EFAULT; + + if (!u.unique_len) + return -EINVAL; + + dev->unique_len = u.unique_len; + dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER); + if (copy_from_user(dev->unique, u.unique, dev->unique_len)) + return -EFAULT; + dev->unique[dev->unique_len] = '\0'; + + dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2, + DRM_MEM_DRIVER); + sprintf(dev->devname, "%s@%s", dev->name, dev->unique); + + return 0; +} + + +int DRM(getmap)( 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_map_t map; + drm_map_list_t *r_list = NULL; + struct list_head *list; + int idx; + int i; + + if (copy_from_user(&map, (drm_map_t *)arg, sizeof(map))) + return -EFAULT; + idx = map.offset; + + down(&dev->struct_sem); + if (idx < 0 || idx >= dev->map_count) { + up(&dev->struct_sem); + return -EINVAL; + } + + i = 0; + list_for_each(list, &dev->maplist->head) { + if(i == idx) { + r_list = (drm_map_list_t *)list; + break; + } + i++; + } + if(!r_list || !r_list->map) { + up(&dev->struct_sem); + return -EINVAL; + } + + map.offset = r_list->map->offset; + map.size = r_list->map->size; + map.type = r_list->map->type; + map.flags = r_list->map->flags; + map.handle = r_list->map->handle; + map.mtrr = r_list->map->mtrr; + up(&dev->struct_sem); + + if (copy_to_user((drm_map_t *)arg, &map, sizeof(map))) return -EFAULT; + return 0; +} + +int DRM(getclient)( 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_client_t client; + drm_file_t *pt; + int idx; + int i; + + if (copy_from_user(&client, (drm_client_t *)arg, sizeof(client))) + return -EFAULT; + idx = client.idx; + down(&dev->struct_sem); + for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) + ; + + if (!pt) { + up(&dev->struct_sem); + return -EINVAL; + } + client.auth = pt->authenticated; + client.pid = pt->pid; + client.uid = pt->uid; + client.magic = pt->magic; + client.iocs = pt->ioctl_count; + up(&dev->struct_sem); + + if (copy_to_user((drm_client_t *)arg, &client, sizeof(client))) + return -EFAULT; + return 0; +} + +int DRM(getstats)( 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_stats_t stats; + int i; + + memset(&stats, 0, sizeof(stats)); + + down(&dev->struct_sem); + + for (i = 0; i < dev->counters; i++) { + if (dev->types[i] == _DRM_STAT_LOCK) + stats.data[i].value + = (dev->lock.hw_lock + ? dev->lock.hw_lock->lock : 0); + else + stats.data[i].value = atomic_read(&dev->counts[i]); + stats.data[i].type = dev->types[i]; + } + + stats.count = dev->counters; + + up(&dev->struct_sem); + + if (copy_to_user((drm_stats_t *)arg, &stats, sizeof(stats))) + return -EFAULT; + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h new file mode 100644 index 000000000..f8dbaaa71 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h @@ -0,0 +1,227 @@ +/* drm_lists.h -- Buffer list handling routines -*- linux-c -*- + * Created: Mon Apr 19 20:54:22 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#if __HAVE_DMA_WAITLIST + +int DRM(waitlist_create)(drm_waitlist_t *bl, int count) +{ + if (bl->count) return -EINVAL; + + bl->count = count; + bl->bufs = DRM(alloc)((bl->count + 2) * sizeof(*bl->bufs), + DRM_MEM_BUFLISTS); + bl->rp = bl->bufs; + bl->wp = bl->bufs; + bl->end = &bl->bufs[bl->count+1]; + bl->write_lock = SPIN_LOCK_UNLOCKED; + bl->read_lock = SPIN_LOCK_UNLOCKED; + return 0; +} + +int DRM(waitlist_destroy)(drm_waitlist_t *bl) +{ + if (bl->rp != bl->wp) return -EINVAL; + if (bl->bufs) DRM(free)(bl->bufs, + (bl->count + 2) * sizeof(*bl->bufs), + DRM_MEM_BUFLISTS); + bl->count = 0; + bl->bufs = NULL; + bl->rp = NULL; + bl->wp = NULL; + bl->end = NULL; + return 0; +} + +int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf) +{ + int left; + unsigned long flags; + + left = DRM_LEFTCOUNT(bl); + if (!left) { + DRM_ERROR("Overflow while adding buffer %d from pid %d\n", + buf->idx, buf->pid); + return -EINVAL; + } +#if __HAVE_DMA_HISTOGRAM + buf->time_queued = get_cycles(); +#endif + buf->list = DRM_LIST_WAIT; + + spin_lock_irqsave(&bl->write_lock, flags); + *bl->wp = buf; + if (++bl->wp >= bl->end) bl->wp = bl->bufs; + spin_unlock_irqrestore(&bl->write_lock, flags); + + return 0; +} + +drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl) +{ + drm_buf_t *buf; + unsigned long flags; + + spin_lock_irqsave(&bl->read_lock, flags); + buf = *bl->rp; + if (bl->rp == bl->wp) { + spin_unlock_irqrestore(&bl->read_lock, flags); + return NULL; + } + if (++bl->rp >= bl->end) bl->rp = bl->bufs; + spin_unlock_irqrestore(&bl->read_lock, flags); + + return buf; +} + +#endif /* __HAVE_DMA_WAITLIST */ + + +#if __HAVE_DMA_FREELIST + +int DRM(freelist_create)(drm_freelist_t *bl, int count) +{ + atomic_set(&bl->count, 0); + bl->next = NULL; + init_waitqueue_head(&bl->waiting); + bl->low_mark = 0; + bl->high_mark = 0; + atomic_set(&bl->wfh, 0); + bl->lock = SPIN_LOCK_UNLOCKED; + ++bl->initialized; + return 0; +} + +int DRM(freelist_destroy)(drm_freelist_t *bl) +{ + atomic_set(&bl->count, 0); + bl->next = NULL; + return 0; +} + +int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf) +{ + drm_device_dma_t *dma = dev->dma; + + if (!dma) { + DRM_ERROR("No DMA support\n"); + return 1; + } + + if (buf->waiting || buf->pending || buf->list == DRM_LIST_FREE) { + DRM_ERROR("Freed buffer %d: w%d, p%d, l%d\n", + buf->idx, buf->waiting, buf->pending, buf->list); + } + if (!bl) return 1; +#if __HAVE_DMA_HISTOGRAM + buf->time_freed = get_cycles(); + DRM(histogram_compute)(dev, buf); +#endif + buf->list = DRM_LIST_FREE; + + spin_lock(&bl->lock); + buf->next = bl->next; + bl->next = buf; + spin_unlock(&bl->lock); + + atomic_inc(&bl->count); + if (atomic_read(&bl->count) > dma->buf_count) { + DRM_ERROR("%d of %d buffers free after addition of %d\n", + atomic_read(&bl->count), dma->buf_count, buf->idx); + return 1; + } + /* Check for high water mark */ + if (atomic_read(&bl->wfh) && atomic_read(&bl->count)>=bl->high_mark) { + atomic_set(&bl->wfh, 0); + wake_up_interruptible(&bl->waiting); + } + return 0; +} + +static drm_buf_t *DRM(freelist_try)(drm_freelist_t *bl) +{ + drm_buf_t *buf; + + if (!bl) return NULL; + + /* Get buffer */ + spin_lock(&bl->lock); + if (!bl->next) { + spin_unlock(&bl->lock); + return NULL; + } + buf = bl->next; + bl->next = bl->next->next; + spin_unlock(&bl->lock); + + atomic_dec(&bl->count); + buf->next = NULL; + buf->list = DRM_LIST_NONE; + if (buf->waiting || buf->pending) { + DRM_ERROR("Free buffer %d: w%d, p%d, l%d\n", + buf->idx, buf->waiting, buf->pending, buf->list); + } + + return buf; +} + +drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block) +{ + drm_buf_t *buf = NULL; + DECLARE_WAITQUEUE(entry, current); + + if (!bl || !bl->initialized) return NULL; + + /* Check for low water mark */ + if (atomic_read(&bl->count) <= bl->low_mark) /* Became low */ + atomic_set(&bl->wfh, 1); + if (atomic_read(&bl->wfh)) { + if (block) { + add_wait_queue(&bl->waiting, &entry); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if (!atomic_read(&bl->wfh) + && (buf = DRM(freelist_try)(bl))) break; + schedule(); + if (signal_pending(current)) break; + } + current->state = TASK_RUNNING; + remove_wait_queue(&bl->waiting, &entry); + } + return buf; + } + + return DRM(freelist_try)(bl); +} + +#endif /* __HAVE_DMA_FREELIST */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h new file mode 100644 index 000000000..c10cfe2c0 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h @@ -0,0 +1,251 @@ +/* lock.c -- IOCTLs for locking -*- linux-c -*- + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +int DRM(block)(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + DRM_DEBUG("\n"); + return 0; +} + +int DRM(unblock)(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + DRM_DEBUG("\n"); + return 0; +} + +int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + + do { + old = *lock; + if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT; + else new = context | _DRM_LOCK_HELD; + prev = cmpxchg(lock, old, new); + } while (prev != old); + if (_DRM_LOCKING_CONTEXT(old) == context) { + if (old & _DRM_LOCK_HELD) { + if (context != DRM_KERNEL_CONTEXT) { + DRM_ERROR("%d holds heavyweight lock\n", + context); + } + return 0; + } + } + if (new == (context | _DRM_LOCK_HELD)) { + /* Have lock */ + return 1; + } + return 0; +} + +/* This takes a lock forcibly and hands it to context. Should ONLY be used + inside *_unlock to give lock to kernel before calling *_dma_schedule. */ +int DRM(lock_transfer)(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + + dev->lock.pid = 0; + do { + old = *lock; + new = context | _DRM_LOCK_HELD; + prev = cmpxchg(lock, old, new); + } while (prev != old); + return 1; +} + +int DRM(lock_free)(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + pid_t pid = dev->lock.pid; + + dev->lock.pid = 0; + do { + old = *lock; + new = 0; + prev = cmpxchg(lock, old, new); + } while (prev != old); + if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) { + DRM_ERROR("%d freed heavyweight lock held by %d (pid %d)\n", + context, + _DRM_LOCKING_CONTEXT(old), + pid); + return 1; + } + wake_up_interruptible(&dev->lock.lock_queue); + return 0; +} + +static int DRM(flush_queue)(drm_device_t *dev, int context) +{ + DECLARE_WAITQUEUE(entry, current); + int ret = 0; + drm_queue_t *q = dev->queuelist[context]; + + DRM_DEBUG("\n"); + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) > 1) { + atomic_inc(&q->block_write); + add_wait_queue(&q->flush_queue, &entry); + atomic_inc(&q->block_count); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if (!DRM_BUFCOUNT(&q->waitlist)) break; + schedule(); + if (signal_pending(current)) { + ret = -EINTR; /* Can't restart */ + break; + } + } + atomic_dec(&q->block_count); + current->state = TASK_RUNNING; + remove_wait_queue(&q->flush_queue, &entry); + } + atomic_dec(&q->use_count); + + /* NOTE: block_write is still incremented! + Use drm_flush_unlock_queue to decrement. */ + return ret; +} + +static int DRM(flush_unblock_queue)(drm_device_t *dev, int context) +{ + drm_queue_t *q = dev->queuelist[context]; + + DRM_DEBUG("\n"); + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) > 1) { + if (atomic_read(&q->block_write)) { + atomic_dec(&q->block_write); + wake_up_interruptible(&q->write_queue); + } + } + atomic_dec(&q->use_count); + return 0; +} + +int DRM(flush_block_and_flush)(drm_device_t *dev, int context, + drm_lock_flags_t flags) +{ + int ret = 0; + int i; + + DRM_DEBUG("\n"); + + if (flags & _DRM_LOCK_FLUSH) { + ret = DRM(flush_queue)(dev, DRM_KERNEL_CONTEXT); + if (!ret) ret = DRM(flush_queue)(dev, context); + } + if (flags & _DRM_LOCK_FLUSH_ALL) { + for (i = 0; !ret && i < dev->queue_count; i++) { + ret = DRM(flush_queue)(dev, i); + } + } + return ret; +} + +int DRM(flush_unblock)(drm_device_t *dev, int context, drm_lock_flags_t flags) +{ + int ret = 0; + int i; + + DRM_DEBUG("\n"); + + if (flags & _DRM_LOCK_FLUSH) { + ret = DRM(flush_unblock_queue)(dev, DRM_KERNEL_CONTEXT); + if (!ret) ret = DRM(flush_unblock_queue)(dev, context); + } + if (flags & _DRM_LOCK_FLUSH_ALL) { + for (i = 0; !ret && i < dev->queue_count; i++) { + ret = DRM(flush_unblock_queue)(dev, i); + } + } + + return ret; +} + +int DRM(finish)(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; + int ret = 0; + drm_lock_t lock; + + DRM_DEBUG("\n"); + + if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) + return -EFAULT; + ret = DRM(flush_block_and_flush)(dev, lock.context, lock.flags); + DRM(flush_unblock)(dev, lock.context, lock.flags); + return ret; +} + +/* If we get here, it means that the process has called DRM_IOCTL_LOCK + without calling DRM_IOCTL_UNLOCK. + + If the lock is not held, then let the signal proceed as usual. + + If the lock is held, then set the contended flag and keep the signal + blocked. + + + Return 1 if the signal should be delivered normally. + Return 0 if the signal should be blocked. */ + +int DRM(notifier)(void *priv) +{ + drm_sigdata_t *s = (drm_sigdata_t *)priv; + unsigned int old, new, prev; + + + /* Allow signal delivery if lock isn't held */ + if (!_DRM_LOCK_IS_HELD(s->lock->lock) + || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1; + + /* Otherwise, set flag to force call to + drmUnlock */ + do { + old = s->lock->lock; + new = old | _DRM_LOCK_CONT; + prev = cmpxchg(&s->lock->lock, old, new); + } while (prev != old); + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h new file mode 100644 index 000000000..1763d9b41 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h @@ -0,0 +1,458 @@ +/* drm_memory.h -- Memory management wrappers for DRM -*- linux-c -*- + * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include <linux/config.h> +#include "drmP.h" +#include <linux/wrapper.h> + +typedef struct drm_mem_stats { + const char *name; + int succeed_count; + int free_count; + int fail_count; + unsigned long bytes_allocated; + unsigned long bytes_freed; +} drm_mem_stats_t; + +static spinlock_t DRM(mem_lock) = SPIN_LOCK_UNLOCKED; +static unsigned long DRM(ram_available) = 0; /* In pages */ +static unsigned long DRM(ram_used) = 0; +static drm_mem_stats_t DRM(mem_stats)[] = { + [DRM_MEM_DMA] = { "dmabufs" }, + [DRM_MEM_SAREA] = { "sareas" }, + [DRM_MEM_DRIVER] = { "driver" }, + [DRM_MEM_MAGIC] = { "magic" }, + [DRM_MEM_IOCTLS] = { "ioctltab" }, + [DRM_MEM_MAPS] = { "maplist" }, + [DRM_MEM_VMAS] = { "vmalist" }, + [DRM_MEM_BUFS] = { "buflist" }, + [DRM_MEM_SEGS] = { "seglist" }, + [DRM_MEM_PAGES] = { "pagelist" }, + [DRM_MEM_FILES] = { "files" }, + [DRM_MEM_QUEUES] = { "queues" }, + [DRM_MEM_CMDS] = { "commands" }, + [DRM_MEM_MAPPINGS] = { "mappings" }, + [DRM_MEM_BUFLISTS] = { "buflists" }, + [DRM_MEM_AGPLISTS] = { "agplist" }, + [DRM_MEM_TOTALAGP] = { "totalagp" }, + [DRM_MEM_BOUNDAGP] = { "boundagp" }, + [DRM_MEM_CTXBITMAP] = { "ctxbitmap"}, + [DRM_MEM_STUB] = { "stub" }, + { NULL, 0, } /* Last entry must be null */ +}; + +void DRM(mem_init)(void) +{ + drm_mem_stats_t *mem; + struct sysinfo si; + + for (mem = DRM(mem_stats); mem->name; ++mem) { + mem->succeed_count = 0; + mem->free_count = 0; + mem->fail_count = 0; + mem->bytes_allocated = 0; + mem->bytes_freed = 0; + } + + si_meminfo(&si); +#if LINUX_VERSION_CODE < 0x020317 + /* Changed to page count in 2.3.23 */ + DRM(ram_available) = si.totalram >> PAGE_SHIFT; +#else + DRM(ram_available) = si.totalram; +#endif + DRM(ram_used) = 0; +} + +/* drm_mem_info is called whenever a process reads /dev/drm/mem. */ + +static int DRM(_mem_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_mem_stats_t *pt; + int len = 0; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *eof = 0; + *start = &buf[offset]; + + DRM_PROC_PRINT(" total counts " + " | outstanding \n"); + DRM_PROC_PRINT("type alloc freed fail bytes freed" + " | allocs bytes\n\n"); + DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", + "system", 0, 0, 0, + DRM(ram_available) << (PAGE_SHIFT - 10)); + DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", + "locked", 0, 0, 0, DRM(ram_used) >> 10); + DRM_PROC_PRINT("\n"); + for (pt = DRM(mem_stats); pt->name; pt++) { + DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n", + pt->name, + pt->succeed_count, + pt->free_count, + pt->fail_count, + pt->bytes_allocated, + pt->bytes_freed, + pt->succeed_count - pt->free_count, + (long)pt->bytes_allocated + - (long)pt->bytes_freed); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +int DRM(mem_info)(char *buf, char **start, off_t offset, + int len, int *eof, void *data) +{ + int ret; + + spin_lock(&DRM(mem_lock)); + ret = DRM(_mem_info)(buf, start, offset, len, eof, data); + spin_unlock(&DRM(mem_lock)); + return ret; +} + +void *DRM(alloc)(size_t size, int area) +{ + void *pt; + + if (!size) { + DRM_MEM_ERROR(area, "Allocating 0 bytes\n"); + return NULL; + } + + if (!(pt = kmalloc(size, GFP_KERNEL))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[area].fail_count; + spin_unlock(&DRM(mem_lock)); + return NULL; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[area].succeed_count; + DRM(mem_stats)[area].bytes_allocated += size; + spin_unlock(&DRM(mem_lock)); + return pt; +} + +void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area) +{ + void *pt; + + if (!(pt = DRM(alloc)(size, area))) return NULL; + if (oldpt && oldsize) { + memcpy(pt, oldpt, oldsize); + DRM(free)(oldpt, oldsize, area); + } + return pt; +} + +char *DRM(strdup)(const char *s, int area) +{ + char *pt; + int length = s ? strlen(s) : 0; + + if (!(pt = DRM(alloc)(length+1, area))) return NULL; + strcpy(pt, s); + return pt; +} + +void DRM(strfree)(const char *s, int area) +{ + unsigned int size; + + if (!s) return; + + size = 1 + (s ? strlen(s) : 0); + DRM(free)((void *)s, size, area); +} + +void DRM(free)(void *pt, size_t size, int area) +{ + int alloc_count; + int free_count; + + if (!pt) DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n"); + else kfree(pt); + spin_lock(&DRM(mem_lock)); + DRM(mem_stats)[area].bytes_freed += size; + free_count = ++DRM(mem_stats)[area].free_count; + alloc_count = DRM(mem_stats)[area].succeed_count; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } +} + +unsigned long DRM(alloc_pages)(int order, int area) +{ + unsigned long address; + unsigned long bytes = PAGE_SIZE << order; + unsigned long addr; + unsigned int sz; + + spin_lock(&DRM(mem_lock)); + if ((DRM(ram_used) >> PAGE_SHIFT) + > (DRM_RAM_PERCENT * DRM(ram_available)) / 100) { + spin_unlock(&DRM(mem_lock)); + return 0; + } + spin_unlock(&DRM(mem_lock)); + + address = __get_free_pages(GFP_KERNEL, order); + if (!address) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[area].fail_count; + spin_unlock(&DRM(mem_lock)); + return 0; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[area].succeed_count; + DRM(mem_stats)[area].bytes_allocated += bytes; + DRM(ram_used) += bytes; + spin_unlock(&DRM(mem_lock)); + + + /* Zero outside the lock */ + memset((void *)address, 0, bytes); + + /* Reserve */ + for (addr = address, sz = bytes; + sz > 0; + addr += PAGE_SIZE, sz -= PAGE_SIZE) { +#if LINUX_VERSION_CODE >= 0x020400 + /* Argument type changed in 2.4.0-test6/pre8 */ + mem_map_reserve(virt_to_page(addr)); +#else + mem_map_reserve(MAP_NR(addr)); +#endif + } + + return address; +} + +void DRM(free_pages)(unsigned long address, int order, int area) +{ + unsigned long bytes = PAGE_SIZE << order; + int alloc_count; + int free_count; + unsigned long addr; + unsigned int sz; + + if (!address) { + DRM_MEM_ERROR(area, "Attempt to free address 0\n"); + } else { + /* Unreserve */ + for (addr = address, sz = bytes; + sz > 0; + addr += PAGE_SIZE, sz -= PAGE_SIZE) { +#if LINUX_VERSION_CODE >= 0x020400 + /* Argument type changed in 2.4.0-test6/pre8 */ + mem_map_unreserve(virt_to_page(addr)); +#else + mem_map_unreserve(MAP_NR(addr)); +#endif + } + free_pages(address, order); + } + + spin_lock(&DRM(mem_lock)); + free_count = ++DRM(mem_stats)[area].free_count; + alloc_count = DRM(mem_stats)[area].succeed_count; + DRM(mem_stats)[area].bytes_freed += bytes; + DRM(ram_used) -= bytes; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(area, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } +} + +void *DRM(ioremap)(unsigned long offset, unsigned long size) +{ + void *pt; + + if (!size) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Mapping 0 bytes at 0x%08lx\n", offset); + return NULL; + } + + if (!(pt = ioremap(offset, size))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; + spin_unlock(&DRM(mem_lock)); + return NULL; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; + spin_unlock(&DRM(mem_lock)); + return pt; +} + +void DRM(ioremapfree)(void *pt, unsigned long size) +{ + int alloc_count; + int free_count; + + if (!pt) + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Attempt to free NULL pointer\n"); + else + iounmap(pt); + + spin_lock(&DRM(mem_lock)); + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_freed += size; + free_count = ++DRM(mem_stats)[DRM_MEM_MAPPINGS].free_count; + alloc_count = DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } +} + +#if __REALLY_HAVE_AGP + +agp_memory *DRM(alloc_agp)(int pages, u32 type) +{ + agp_memory *handle; + + if (!pages) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n"); + return NULL; + } + + if ((handle = DRM(agp_allocate_memory)(pages, type))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_allocated + += pages << PAGE_SHIFT; + spin_unlock(&DRM(mem_lock)); + return handle; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_TOTALAGP].fail_count; + spin_unlock(&DRM(mem_lock)); + return NULL; +} + +int DRM(free_agp)(agp_memory *handle, int pages) +{ + int alloc_count; + int free_count; + int retval = -EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, + "Attempt to free NULL AGP handle\n"); + return retval;; + } + + if (DRM(agp_free_memory)(handle)) { + spin_lock(&DRM(mem_lock)); + free_count = ++DRM(mem_stats)[DRM_MEM_TOTALAGP].free_count; + alloc_count = DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_freed + += pages << PAGE_SHIFT; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } + return 0; + } + return retval; +} + +int DRM(bind_agp)(agp_memory *handle, unsigned int start) +{ + int retcode = -EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Attempt to bind NULL AGP handle\n"); + return retcode; + } + + if (!(retcode = DRM(agp_bind_memory)(handle, start))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_allocated + += handle->page_count << PAGE_SHIFT; + spin_unlock(&DRM(mem_lock)); + return retcode; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].fail_count; + spin_unlock(&DRM(mem_lock)); + return retcode; +} + +int DRM(unbind_agp)(agp_memory *handle) +{ + int alloc_count; + int free_count; + int retcode = -EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Attempt to unbind NULL AGP handle\n"); + return retcode; + } + + if ((retcode = DRM(agp_unbind_memory)(handle))) return retcode; + spin_lock(&DRM(mem_lock)); + free_count = ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].free_count; + alloc_count = DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_freed + += handle->page_count << PAGE_SHIFT; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } + return retcode; +} +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h new file mode 100644 index 000000000..f65f42b71 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h @@ -0,0 +1,630 @@ +/* drm_proc.h -- /proc support for DRM -*- linux-c -*- + * Created: Mon Jan 11 09:48:47 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * + * Acknowledgements: + * Matthew J Sottek <matthew.j.sottek@intel.com> sent in a patch to fix + * the problem with the proc files not outputting all their information. + */ + +#define __NO_VERSION__ +#include "drmP.h" + +static int DRM(name_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int DRM(vm_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int DRM(clients_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int DRM(queues_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int DRM(bufs_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +#if DRM_DEBUG_CODE +static int DRM(vma_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +#endif +#if __HAVE_DMA_HISTOGRAM +static int DRM(histo_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +#endif + +struct drm_proc_list { + const char *name; + int (*f)(char *, char **, off_t, int, int *, void *); +} DRM(proc_list)[] = { + { "name", DRM(name_info) }, + { "mem", DRM(mem_info) }, + { "vm", DRM(vm_info) }, + { "clients", DRM(clients_info) }, + { "queues", DRM(queues_info) }, + { "bufs", DRM(bufs_info) }, +#if DRM_DEBUG_CODE + { "vma", DRM(vma_info) }, +#endif +#if __HAVE_DMA_HISTOGRAM + { "histo", DRM(histo_info) }, +#endif +}; +#define DRM_PROC_ENTRIES (sizeof(DRM(proc_list))/sizeof(DRM(proc_list)[0])) + +struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, int minor, + struct proc_dir_entry *root, + struct proc_dir_entry **dev_root) +{ + struct proc_dir_entry *ent; + int i, j; + char name[64]; + + if (!minor) root = create_proc_entry("dri", S_IFDIR, NULL); + if (!root) { + DRM_ERROR("Cannot create /proc/dri\n"); + return NULL; + } + + sprintf(name, "%d", minor); + *dev_root = create_proc_entry(name, S_IFDIR, root); + if (!*dev_root) { + DRM_ERROR("Cannot create /proc/%s\n", name); + return NULL; + } + + for (i = 0; i < DRM_PROC_ENTRIES; i++) { + ent = create_proc_entry(DRM(proc_list)[i].name, + S_IFREG|S_IRUGO, *dev_root); + if (!ent) { + DRM_ERROR("Cannot create /proc/dri/%s/%s\n", + name, DRM(proc_list)[i].name); + for (j = 0; j < i; j++) + remove_proc_entry(DRM(proc_list)[i].name, + *dev_root); + remove_proc_entry(name, root); + if (!minor) remove_proc_entry("dri", NULL); + return NULL; + } + ent->read_proc = DRM(proc_list)[i].f; + ent->data = dev; + } + + return root; +} + + +int DRM(proc_cleanup)(int minor, struct proc_dir_entry *root, + struct proc_dir_entry *dev_root) +{ + int i; + char name[64]; + + if (!root || !dev_root) return 0; + + for (i = 0; i < DRM_PROC_ENTRIES; i++) + remove_proc_entry(DRM(proc_list)[i].name, dev_root); + sprintf(name, "%d", minor); + remove_proc_entry(name, root); + if (!minor) remove_proc_entry("dri", NULL); + + return 0; +} + +static int DRM(name_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + if (dev->unique) { + DRM_PROC_PRINT("%s 0x%x %s\n", + dev->name, dev->device, dev->unique); + } else { + DRM_PROC_PRINT("%s 0x%x\n", dev->name, dev->device); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(_vm_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list; + + /* Hardcoded from _DRM_FRAME_BUFFER, + _DRM_REGISTERS, _DRM_SHM, and + _DRM_AGP. */ + const char *types[] = { "FB", "REG", "SHM", "AGP" }; + const char *type; + int i; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("slot offset size type flags " + "address mtrr\n\n"); + i = 0; + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + map = r_list->map; + if(!map) continue; + if (map->type < 0 || map->type > 3) type = "??"; + else type = types[map->type]; + DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", + i, + map->offset, + map->size, + type, + map->flags, + (unsigned long)map->handle); + if (map->mtrr < 0) { + DRM_PROC_PRINT("none\n"); + } else { + DRM_PROC_PRINT("%4d\n", map->mtrr); + } + i++; + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(vm_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_vm_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + + +static int DRM(_queues_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + int i; + drm_queue_t *q; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT(" ctx/flags use fin" + " blk/rw/rwf wait flushed queued" + " locks\n\n"); + for (i = 0; i < dev->queue_count; i++) { + q = dev->queuelist[i]; + atomic_inc(&q->use_count); + DRM_PROC_PRINT_RET(atomic_dec(&q->use_count), + "%5d/0x%03x %5d %5d" + " %5d/%c%c/%c%c%c %5Zd\n", + i, + q->flags, + atomic_read(&q->use_count), + atomic_read(&q->finalization), + atomic_read(&q->block_count), + atomic_read(&q->block_read) ? 'r' : '-', + atomic_read(&q->block_write) ? 'w' : '-', + waitqueue_active(&q->read_queue) ? 'r':'-', + waitqueue_active(&q->write_queue) ? 'w':'-', + waitqueue_active(&q->flush_queue) ? 'f':'-', + DRM_BUFCOUNT(&q->waitlist)); + atomic_dec(&q->use_count); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(queues_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_queues_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + +/* drm_bufs_info is called whenever a process reads + /dev/dri/<dev>/bufs. */ + +static int DRM(_bufs_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma || offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT(" o size count free segs pages kB\n\n"); + for (i = 0; i <= DRM_MAX_ORDER; i++) { + if (dma->bufs[i].buf_count) + DRM_PROC_PRINT("%2d %8d %5d %5d %5d %5d %5ld\n", + i, + dma->bufs[i].buf_size, + dma->bufs[i].buf_count, + atomic_read(&dma->bufs[i] + .freelist.count), + dma->bufs[i].seg_count, + dma->bufs[i].seg_count + *(1 << dma->bufs[i].page_order), + (dma->bufs[i].seg_count + * (1 << dma->bufs[i].page_order)) + * PAGE_SIZE / 1024); + } + DRM_PROC_PRINT("\n"); + for (i = 0; i < dma->buf_count; i++) { + if (i && !(i%32)) DRM_PROC_PRINT("\n"); + DRM_PROC_PRINT(" %d", dma->buflist[i]->list); + } + DRM_PROC_PRINT("\n"); + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(bufs_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_bufs_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + + +static int DRM(_clients_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_file_t *priv; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n"); + for (priv = dev->file_first; priv; priv = priv->next) { + DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n", + priv->authenticated ? 'y' : 'n', + priv->minor, + priv->pid, + priv->uid, + priv->magic, + priv->ioctl_count); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(clients_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_clients_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + +#if DRM_DEBUG_CODE + +#define DRM_VMA_VERBOSE 0 + +static int DRM(_vma_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_vma_entry_t *pt; + struct vm_area_struct *vma; +#if DRM_VMA_VERBOSE + unsigned long i; + unsigned long address; + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; +#endif +#if defined(__i386__) + unsigned int pgprot; +#endif + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n", + atomic_read(&dev->vma_count), + high_memory, virt_to_phys(high_memory)); + for (pt = dev->vmalist; pt; pt = pt->next) { + if (!(vma = pt->vma)) continue; + DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx", + pt->pid, + vma->vm_start, + vma->vm_end, + vma->vm_flags & VM_READ ? 'r' : '-', + vma->vm_flags & VM_WRITE ? 'w' : '-', + vma->vm_flags & VM_EXEC ? 'x' : '-', + vma->vm_flags & VM_MAYSHARE ? 's' : 'p', + vma->vm_flags & VM_LOCKED ? 'l' : '-', + vma->vm_flags & VM_IO ? 'i' : '-', + VM_OFFSET(vma)); + +#if defined(__i386__) + pgprot = pgprot_val(vma->vm_page_prot); + DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c", + pgprot & _PAGE_PRESENT ? 'p' : '-', + pgprot & _PAGE_RW ? 'w' : 'r', + pgprot & _PAGE_USER ? 'u' : 's', + pgprot & _PAGE_PWT ? 't' : 'b', + pgprot & _PAGE_PCD ? 'u' : 'c', + pgprot & _PAGE_ACCESSED ? 'a' : '-', + pgprot & _PAGE_DIRTY ? 'd' : '-', + pgprot & _PAGE_PSE ? 'm' : 'k', + pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); +#endif + DRM_PROC_PRINT("\n"); +#if 0 + for (i = vma->vm_start; i < vma->vm_end; i += PAGE_SIZE) { + pgd = pgd_offset(vma->vm_mm, i); + pmd = pmd_offset(pgd, i); + pte = pte_offset(pmd, i); + if (pte_present(*pte)) { + address = __pa(pte_page(*pte)) + + (i & (PAGE_SIZE-1)); + DRM_PROC_PRINT(" 0x%08lx -> 0x%08lx" + " %c%c%c%c%c\n", + i, + address, + pte_read(*pte) ? 'r' : '-', + pte_write(*pte) ? 'w' : '-', + pte_exec(*pte) ? 'x' : '-', + pte_dirty(*pte) ? 'd' : '-', + pte_young(*pte) ? 'a' : '-' ); + } else { + DRM_PROC_PRINT(" 0x%08lx\n", i); + } + } +#endif + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(vma_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_vma_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} +#endif + + +#if __HAVE_DMA_HISTOGRAM +static int DRM(_histo_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_device_dma_t *dma = dev->dma; + int i; + unsigned long slot_value = DRM_DMA_HISTOGRAM_INITIAL; + unsigned long prev_value = 0; + drm_buf_t *buffer; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("general statistics:\n"); + DRM_PROC_PRINT("total %10u\n", atomic_read(&dev->histo.total)); + DRM_PROC_PRINT("open %10u\n", + atomic_read(&dev->counts[_DRM_STAT_OPENS])); + DRM_PROC_PRINT("close %10u\n", + atomic_read(&dev->counts[_DRM_STAT_CLOSES])); + DRM_PROC_PRINT("ioctl %10u\n", + atomic_read(&dev->counts[_DRM_STAT_IOCTLS])); + + DRM_PROC_PRINT("\nlock statistics:\n"); + DRM_PROC_PRINT("locks %10u\n", + atomic_read(&dev->counts[_DRM_STAT_LOCKS])); + DRM_PROC_PRINT("unlocks %10u\n", + atomic_read(&dev->counts[_DRM_STAT_UNLOCKS])); + + if (dma) { +#if 0 + DRM_PROC_PRINT("\ndma statistics:\n"); + DRM_PROC_PRINT("prio %10u\n", + atomic_read(&dma->total_prio)); + DRM_PROC_PRINT("bytes %10u\n", + atomic_read(&dma->total_bytes)); + DRM_PROC_PRINT("dmas %10u\n", + atomic_read(&dma->total_dmas)); + DRM_PROC_PRINT("missed:\n"); + DRM_PROC_PRINT(" dma %10u\n", + atomic_read(&dma->total_missed_dma)); + DRM_PROC_PRINT(" lock %10u\n", + atomic_read(&dma->total_missed_lock)); + DRM_PROC_PRINT(" free %10u\n", + atomic_read(&dma->total_missed_free)); + DRM_PROC_PRINT(" sched %10u\n", + atomic_read(&dma->total_missed_sched)); + DRM_PROC_PRINT("tried %10u\n", + atomic_read(&dma->total_tried)); + DRM_PROC_PRINT("hit %10u\n", + atomic_read(&dma->total_hit)); + DRM_PROC_PRINT("lost %10u\n", + atomic_read(&dma->total_lost)); +#endif + + buffer = dma->next_buffer; + if (buffer) { + DRM_PROC_PRINT("next_buffer %7d\n", buffer->idx); + } else { + DRM_PROC_PRINT("next_buffer none\n"); + } + buffer = dma->this_buffer; + if (buffer) { + DRM_PROC_PRINT("this_buffer %7d\n", buffer->idx); + } else { + DRM_PROC_PRINT("this_buffer none\n"); + } + } + + + DRM_PROC_PRINT("\nvalues:\n"); + if (dev->lock.hw_lock) { + DRM_PROC_PRINT("lock 0x%08x\n", + dev->lock.hw_lock->lock); + } else { + DRM_PROC_PRINT("lock none\n"); + } + DRM_PROC_PRINT("context_flag 0x%08lx\n", dev->context_flag); + DRM_PROC_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag); + DRM_PROC_PRINT("dma_flag 0x%08lx\n", dev->dma_flag); + + DRM_PROC_PRINT("queue_count %10d\n", dev->queue_count); + DRM_PROC_PRINT("last_context %10d\n", dev->last_context); + DRM_PROC_PRINT("last_switch %10lu\n", dev->last_switch); + DRM_PROC_PRINT("last_checked %10d\n", dev->last_checked); + + + DRM_PROC_PRINT("\n q2d d2c c2f" + " q2c q2f dma sch" + " ctx lacq lhld\n\n"); + for (i = 0; i < DRM_DMA_HISTOGRAM_SLOTS; i++) { + DRM_PROC_PRINT("%s %10lu %10u %10u %10u %10u %10u" + " %10u %10u %10u %10u %10u\n", + i == DRM_DMA_HISTOGRAM_SLOTS - 1 ? ">=" : "< ", + i == DRM_DMA_HISTOGRAM_SLOTS - 1 + ? prev_value : slot_value , + + atomic_read(&dev->histo + .queued_to_dispatched[i]), + atomic_read(&dev->histo + .dispatched_to_completed[i]), + atomic_read(&dev->histo + .completed_to_freed[i]), + + atomic_read(&dev->histo + .queued_to_completed[i]), + atomic_read(&dev->histo + .queued_to_freed[i]), + atomic_read(&dev->histo.dma[i]), + atomic_read(&dev->histo.schedule[i]), + atomic_read(&dev->histo.ctx[i]), + atomic_read(&dev->histo.lacq[i]), + atomic_read(&dev->histo.lhld[i])); + prev_value = slot_value; + slot_value = DRM_DMA_HISTOGRAM_NEXT(slot_value); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(histo_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_histo_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h new file mode 100644 index 000000000..bc9587963 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h @@ -0,0 +1,152 @@ +/* drm_stub.h -- -*- linux-c -*- + * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org + * + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. + * 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@valinux.com> + * + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#if LINUX_VERSION_CODE < 0x020400 +#include "stubsupport-pre24.h" +#endif + +#define DRM_STUB_MAXCARDS 16 /* Enough for one machine */ + +static struct drm_stub_list { + const char *name; + struct file_operations *fops; + struct proc_dir_entry *dev_root; +} *DRM(stub_list); + +static struct proc_dir_entry *DRM(stub_root); + +static struct drm_stub_info { + int (*info_register)(const char *name, struct file_operations *fops, + drm_device_t *dev); + int (*info_unregister)(int minor); +} DRM(stub_info); + +static int DRM(stub_open)(struct inode *inode, struct file *filp) +{ + int minor = MINOR(inode->i_rdev); + int err = -ENODEV; + struct file_operations *old_fops; + + if (!DRM(stub_list) || !DRM(stub_list)[minor].fops) return -ENODEV; + old_fops = filp->f_op; + filp->f_op = fops_get(DRM(stub_list)[minor].fops); + if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { + fops_put(filp->f_op); + filp->f_op = fops_get(old_fops); + } + fops_put(old_fops); + + return err; +} + +static struct file_operations DRM(stub_fops) = { +#if LINUX_VERSION_CODE >= 0x020400 + owner: THIS_MODULE, +#endif + open: DRM(stub_open) +}; + +static int DRM(stub_getminor)(const char *name, struct file_operations *fops, + drm_device_t *dev) +{ + int i; + + if (!DRM(stub_list)) { + DRM(stub_list) = DRM(alloc)(sizeof(*DRM(stub_list)) + * DRM_STUB_MAXCARDS, DRM_MEM_STUB); + for (i = 0; i < DRM_STUB_MAXCARDS; i++) { + DRM(stub_list)[i].name = NULL; + DRM(stub_list)[i].fops = NULL; + } + } + for (i = 0; i < DRM_STUB_MAXCARDS; i++) { + if (!DRM(stub_list)[i].fops) { + DRM(stub_list)[i].name = name; + DRM(stub_list)[i].fops = fops; + DRM(stub_root) = DRM(proc_init)(dev, i, DRM(stub_root), + &DRM(stub_list)[i] + .dev_root); + return i; + } + } + return -1; +} + +static int DRM(stub_putminor)(int minor) +{ + if (minor < 0 || minor >= DRM_STUB_MAXCARDS) return -1; + DRM(stub_list)[minor].name = NULL; + DRM(stub_list)[minor].fops = NULL; + DRM(proc_cleanup)(minor, DRM(stub_root), + DRM(stub_list)[minor].dev_root); + if (minor) { + inter_module_put("drm"); + } else { + inter_module_unregister("drm"); + DRM(free)(DRM(stub_list), + sizeof(*DRM(stub_list)) * DRM_STUB_MAXCARDS, + DRM_MEM_STUB); + unregister_chrdev(DRM_MAJOR, "drm"); + } + return 0; +} + +int DRM(stub_register)(const char *name, struct file_operations *fops, + drm_device_t *dev) +{ + struct drm_stub_info *i = NULL; + + if (register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops))) + i = (struct drm_stub_info *)inter_module_get("drm"); + + if (i) { + /* Already registered */ + DRM(stub_info).info_register = i->info_register; + DRM(stub_info).info_unregister = i->info_unregister; + } else { + DRM(stub_info).info_register = DRM(stub_getminor); + DRM(stub_info).info_unregister = DRM(stub_putminor); + inter_module_register("drm", THIS_MODULE, &DRM(stub_info)); + } + if (DRM(stub_info).info_register) + return DRM(stub_info).info_register(name, fops, dev); + return -1; +} + +int DRM(stub_unregister)(int minor) +{ + DRM_DEBUG("%d\n", minor); + if (DRM(stub_info).info_unregister) + return DRM(stub_info).info_unregister(minor); + return -1; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h new file mode 100644 index 000000000..fb51926ba --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h @@ -0,0 +1,416 @@ +/* drm_vm.h -- Memory mapping for DRM -*- linux-c -*- + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +struct vm_operations_struct drm_vm_ops = { + nopage: DRM(vm_nopage), + open: DRM(vm_open), + close: DRM(vm_close), +}; + +struct vm_operations_struct drm_vm_shm_ops = { + nopage: DRM(vm_shm_nopage), + open: DRM(vm_open), + close: DRM(vm_shm_close), +}; + +struct vm_operations_struct drm_vm_dma_ops = { + nopage: DRM(vm_dma_nopage), + open: DRM(vm_open), + close: DRM(vm_close), +}; + +#if LINUX_VERSION_CODE < 0x020317 +unsigned long DRM(vm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *DRM(vm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif +{ + return NOPAGE_SIGBUS; /* Disallow mremap */ +} + +#if LINUX_VERSION_CODE < 0x020317 +unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif +{ +#if LINUX_VERSION_CODE >= 0x020300 + drm_map_t *map = (drm_map_t *)vma->vm_private_data; +#else + drm_map_t *map = (drm_map_t *)vma->vm_pte; +#endif + unsigned long physical; + unsigned long offset; + unsigned long i; + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; + + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!map) return NOPAGE_OOM; /* Nothing allocated */ + + offset = address - vma->vm_start; + i = (unsigned long)map->handle + offset; + /* We have to walk page tables here because we need large SAREA's, and + * they need to be virtually contigious in kernel space. + */ + pgd = pgd_offset_k( i ); + if( !pgd_present( *pgd ) ) return NOPAGE_OOM; + pmd = pmd_offset( pgd, i ); + if( !pmd_present( *pmd ) ) return NOPAGE_OOM; + pte = pte_offset( pmd, i ); + if( !pte_present( *pte ) ) return NOPAGE_OOM; + physical = (unsigned long)pte_page( *pte )->virtual; + atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */ + + DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical); +#if LINUX_VERSION_CODE < 0x020317 + return physical; +#else + return virt_to_page(physical); +#endif +} + +/* Special close routine which deletes map information if we are the last + * person to close a mapping and its not in the global maplist. + */ + +void DRM(vm_shm_close)(struct vm_area_struct *vma) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *pt, *prev; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list; + int found_maps = 0; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); +#if LINUX_VERSION_CODE < 0x020333 + MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + atomic_dec(&dev->vma_count); + +#if LINUX_VERSION_CODE >= 0x020300 + map = vma->vm_private_data; +#else + map = vma->vm_pte; +#endif + + down(&dev->struct_sem); + for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { +#if LINUX_VERSION_CODE >= 0x020300 + if (pt->vma->vm_private_data == map) found_maps++; +#else + if (pt->vma->vm_pte == map) found_maps++; +#endif + if (pt->vma == vma) { + if (prev) { + prev->next = pt->next; + } else { + dev->vmalist = pt->next; + } + DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS); + } + } + /* We were the only map that was found */ + if(found_maps == 1 && + map->flags & _DRM_REMOVABLE) { + /* Check to see if we are in the maplist, if we are not, then + * we delete this mappings information. + */ + found_maps = 0; + list = &dev->maplist->head; + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *) list; + if (r_list->map == map) found_maps++; + } + + if(!found_maps) { + switch (map->type) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#if __REALLY_HAVE_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: + vfree(map->handle); + break; + case _DRM_AGP: + break; + } + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + } + } + up(&dev->struct_sem); +} + +#if LINUX_VERSION_CODE < 0x020317 +unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + unsigned long physical; + unsigned long offset; + unsigned long page; + + if (!dma) return NOPAGE_SIGBUS; /* Error */ + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ + + offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ + page = offset >> PAGE_SHIFT; + physical = dma->pagelist[page] + (offset & (~PAGE_MASK)); + atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */ + + DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical); +#if LINUX_VERSION_CODE < 0x020317 + return physical; +#else + return virt_to_page(physical); +#endif +} + +void DRM(vm_open)(struct vm_area_struct *vma) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *vma_entry; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); + atomic_inc(&dev->vma_count); +#if LINUX_VERSION_CODE < 0x020333 + /* The map can exist after the fd is closed. */ + MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + + vma_entry = DRM(alloc)(sizeof(*vma_entry), DRM_MEM_VMAS); + if (vma_entry) { + down(&dev->struct_sem); + vma_entry->vma = vma; + vma_entry->next = dev->vmalist; + vma_entry->pid = current->pid; + dev->vmalist = vma_entry; + up(&dev->struct_sem); + } +} + +void DRM(vm_close)(struct vm_area_struct *vma) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *pt, *prev; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); +#if LINUX_VERSION_CODE < 0x020333 + MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + atomic_dec(&dev->vma_count); + + down(&dev->struct_sem); + for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { + if (pt->vma == vma) { + if (prev) { + prev->next = pt->next; + } else { + dev->vmalist = pt->next; + } + DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS); + break; + } + } + up(&dev->struct_sem); +} + +int DRM(mmap_dma)(struct file *filp, struct vm_area_struct *vma) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev; + drm_device_dma_t *dma; + unsigned long length = vma->vm_end - vma->vm_start; + + lock_kernel(); + dev = priv->dev; + dma = dev->dma; + DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); + + /* Length must match exact page count */ + if (!dma || (length >> PAGE_SHIFT) != dma->page_count) { + unlock_kernel(); + return -EINVAL; + } + unlock_kernel(); + + vma->vm_ops = &drm_vm_dma_ops; + vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ + +#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */ + /* In Linux 2.2.3 and above, this is + handled in do_mmap() in mm/mmap.c. */ + ++filp->f_count; +#endif + vma->vm_file = filp; /* Needed for drm_vm_open() */ + DRM(vm_open)(vma); + return 0; +} + +int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_map_t *map = NULL; + drm_map_list_t *r_list; + struct list_head *list; + + DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); + + if (!VM_OFFSET(vma)) return DRM(mmap_dma)(filp, vma); + + /* A sequential search of a linked list is + fine here because: 1) there will only be + about 5-10 entries in the list and, 2) a + DRI client only has to do this mapping + once, so it doesn't have to be optimized + for performance, even if the list was a + bit longer. */ + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + map = r_list->map; + if (!map) continue; + if (map->offset == VM_OFFSET(vma)) break; + } + + if (!map || ((map->flags&_DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) + return -EPERM; + + /* Check for valid size. */ + if (map->size != vma->vm_end - vma->vm_start) return -EINVAL; + + if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) { + vma->vm_flags &= VM_MAYWRITE; +#if defined(__i386__) + pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; +#else + /* Ye gads this is ugly. With more thought + we could move this up higher and use + `protection_map' instead. */ + vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect( + __pte(pgprot_val(vma->vm_page_prot))))); +#endif + } + + switch (map->type) { + case _DRM_FRAME_BUFFER: + case _DRM_REGISTERS: + case _DRM_AGP: + if (VM_OFFSET(vma) >= __pa(high_memory)) { +#if defined(__i386__) + if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) { + pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; + pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; + } +#elif defined(__ia64__) + if (map->type != _DRM_AGP) + vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); +#endif + vma->vm_flags |= VM_IO; /* not in core dump */ + } + if (remap_page_range(vma->vm_start, + VM_OFFSET(vma), + vma->vm_end - vma->vm_start, + vma->vm_page_prot)) + return -EAGAIN; + DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," + " offset = 0x%lx\n", + map->type, + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); + vma->vm_ops = &drm_vm_ops; + break; + case _DRM_SHM: + vma->vm_ops = &drm_vm_shm_ops; +#if LINUX_VERSION_CODE >= 0x020300 + vma->vm_private_data = (void *)map; +#else + vma->vm_pte = (unsigned long)map; +#endif + /* Don't let this area swap. Change when + DRM_KERNEL advisory is supported. */ + vma->vm_flags |= VM_LOCKED; + break; + default: + return -EINVAL; /* This should never happen. */ + } + vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ + +#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */ + /* In Linux 2.2.3 and above, this is + handled in do_mmap() in mm/mmap.c. */ + ++filp->f_count; +#endif + vma->vm_file = filp; /* Needed for drm_vm_open() */ + DRM(vm_open)(vma); + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h new file mode 100644 index 000000000..232ed018b --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h @@ -0,0 +1,93 @@ +/* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*- + * Created: Mon Jan 4 08:58:31 1999 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __GAMMA_H__ +#define __GAMMA_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) gamma_##x + +/* General customization: + */ +#define __HAVE_MTRR 1 + +/* DMA customization: + */ +#define __HAVE_DMA 1 +#define __HAVE_OLD_DMA 1 +#define __HAVE_PCI_DMA 1 + +#define __HAVE_MULTIPLE_DMA_QUEUES 1 +#define __HAVE_DMA_WAITQUEUE 1 + +#define __HAVE_DMA_WAITLIST 1 +#define __HAVE_DMA_FREELIST 1 + +#define __HAVE_DMA_FLUSH 1 +#define __HAVE_DMA_SCHEDULE 1 + +#define __HAVE_DMA_READY 1 +#define DRIVER_DMA_READY() do { \ + gamma_dma_ready(dev); \ +} while (0) + +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + /* FIXME ! */ \ + gamma_dma_quiescent_dual(dev); \ + return 0; \ +} while (0) + +#define __HAVE_DMA_IRQ 1 +#define __HAVE_DMA_IRQ_BH 1 +#define DRIVER_PREINSTALL() do { \ + drm_gamma_private_t *dev_priv = \ + (drm_gamma_private_t *)dev->dev_private;\ + GAMMA_WRITE( GAMMA_GCOMMANDMODE, 0x00000000 ); \ + GAMMA_WRITE( GAMMA_GDMACONTROL, 0x00000000 ); \ +} while (0) + +#define DRIVER_POSTINSTALL() do { \ + drm_gamma_private_t *dev_priv = \ + (drm_gamma_private_t *)dev->dev_private;\ + GAMMA_WRITE( GAMMA_GINTENABLE, 0x00002001 ); \ + GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000008 ); \ + GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00039090 ); \ +} while (0) + +#define DRIVER_UNINSTALL() do { \ + drm_gamma_private_t *dev_priv = \ + (drm_gamma_private_t *)dev->dev_private;\ + GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00000000 ); \ + GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000000 ); \ + GAMMA_WRITE( GAMMA_GINTENABLE, 0x00000000 ); \ +} while (0) + +#endif /* __GAMMA_H__ */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c index 4854c56d5..d3a9414d7 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c @@ -11,11 +11,11 @@ * 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 @@ -23,73 +23,38 @@ * 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@valinux.com> * */ #define __NO_VERSION__ +#include "gamma.h" #include "drmP.h" #include "gamma_drv.h" #include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> -/* WARNING!!! MAGIC NUMBER!!! The number of regions already added to the - kernel must be specified here. Currently, the number is 2. This must - match the order the X server uses for instantiating register regions , - or must be passed in a new ioctl. */ -#define GAMMA_REG(reg) \ - (2 \ - + ((reg < 0x1000) \ - ? 0 \ - : ((reg < 0x10000) ? 1 : ((reg < 0x11000) ? 2 : 3)))) - -#define GAMMA_OFF(reg) \ - ((reg < 0x1000) \ - ? reg \ - : ((reg < 0x10000) \ - ? (reg - 0x1000) \ - : ((reg < 0x11000) \ - ? (reg - 0x10000) \ - : (reg - 0x11000)))) - -#define GAMMA_BASE(reg) ((unsigned long)dev->maplist[GAMMA_REG(reg)]->handle) -#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg)) -#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg) -#define GAMMA_READ(reg) GAMMA_DEREF(reg) -#define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0) - -#define GAMMA_BROADCASTMASK 0x9378 -#define GAMMA_COMMANDINTENABLE 0x0c48 -#define GAMMA_DMAADDRESS 0x0028 -#define GAMMA_DMACOUNT 0x0030 -#define GAMMA_FILTERMODE 0x8c00 -#define GAMMA_GCOMMANDINTFLAGS 0x0c50 -#define GAMMA_GCOMMANDMODE 0x0c40 -#define GAMMA_GCOMMANDSTATUS 0x0c60 -#define GAMMA_GDELAYTIMER 0x0c38 -#define GAMMA_GDMACONTROL 0x0060 -#define GAMMA_GINTENABLE 0x0808 -#define GAMMA_GINTFLAGS 0x0810 -#define GAMMA_INFIFOSPACE 0x0018 -#define GAMMA_OUTFIFOWORDS 0x0020 -#define GAMMA_OUTPUTFIFO 0x2000 -#define GAMMA_SYNC 0x8c40 -#define GAMMA_SYNC_TAG 0x0188 - static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address, unsigned long length) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + GAMMA_WRITE(GAMMA_DMAADDRESS, virt_to_phys((void *)address)); while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4) ; GAMMA_WRITE(GAMMA_DMACOUNT, length / 4); } -static inline void gamma_dma_quiescent_single(drm_device_t *dev) +void gamma_dma_quiescent_single(drm_device_t *dev) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)) ; while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) @@ -97,15 +62,18 @@ static inline void gamma_dma_quiescent_single(drm_device_t *dev) GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); GAMMA_WRITE(GAMMA_SYNC, 0); - + do { while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)) ; } while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG); } -static inline void gamma_dma_quiescent_dual(drm_device_t *dev) +void gamma_dma_quiescent_dual(drm_device_t *dev) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)) ; while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) @@ -115,13 +83,13 @@ static inline void gamma_dma_quiescent_dual(drm_device_t *dev) GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); GAMMA_WRITE(GAMMA_SYNC, 0); - + /* Read from first MX */ do { while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)) ; } while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG); - + /* Read from second MX */ do { while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000)) @@ -129,34 +97,39 @@ static inline void gamma_dma_quiescent_dual(drm_device_t *dev) } while (GAMMA_READ(GAMMA_OUTPUTFIFO + 0x10000) != GAMMA_SYNC_TAG); } -static inline void gamma_dma_ready(drm_device_t *dev) +void gamma_dma_ready(drm_device_t *dev) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)) ; } static inline int gamma_dma_is_ready(drm_device_t *dev) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + return !GAMMA_READ(GAMMA_DMACOUNT); } -static void gamma_dma_service(int irq, void *device, struct pt_regs *regs) +void gamma_dma_service(int irq, void *device, struct pt_regs *regs) { - drm_device_t *dev = (drm_device_t *)device; - drm_device_dma_t *dma = dev->dma; - - atomic_inc(&dev->total_irq); + drm_device_t *dev = (drm_device_t *)device; + drm_device_dma_t *dma = dev->dma; + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + + atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */ GAMMA_WRITE(GAMMA_GDELAYTIMER, 0xc350/2); /* 0x05S */ GAMMA_WRITE(GAMMA_GCOMMANDINTFLAGS, 8); GAMMA_WRITE(GAMMA_GINTFLAGS, 0x2001); if (gamma_dma_is_ready(dev)) { /* Free previous buffer */ - if (test_and_set_bit(0, &dev->dma_flag)) { - atomic_inc(&dma->total_missed_free); - return; - } + if (test_and_set_bit(0, &dev->dma_flag)) return; if (dma->this_buffer) { - drm_free_buffer(dev, dma->this_buffer); + gamma_free_buffer(dev, dma->this_buffer); dma->this_buffer = NULL; } clear_bit(0, &dev->dma_flag); @@ -179,11 +152,8 @@ static int gamma_do_dma(drm_device_t *dev, int locked) cycles_t dma_start, dma_stop; #endif - if (test_and_set_bit(0, &dev->dma_flag)) { - atomic_inc(&dma->total_missed_dma); - return -EBUSY; - } - + if (test_and_set_bit(0, &dev->dma_flag)) return -EBUSY; + #if DRM_DMA_HISTOGRAM dma_start = get_cycles(); #endif @@ -202,20 +172,20 @@ static int gamma_do_dma(drm_device_t *dev, int locked) buf->context, buf->idx, length); if (buf->list == DRM_LIST_RECLAIM) { - drm_clear_next_buffer(dev); - drm_free_buffer(dev, buf); + gamma_clear_next_buffer(dev); + gamma_free_buffer(dev, buf); clear_bit(0, &dev->dma_flag); return -EINVAL; } if (!length) { DRM_ERROR("0 length buffer\n"); - drm_clear_next_buffer(dev); - drm_free_buffer(dev, buf); + gamma_clear_next_buffer(dev); + gamma_free_buffer(dev, buf); clear_bit(0, &dev->dma_flag); return 0; } - + if (!gamma_dma_is_ready(dev)) { clear_bit(0, &dev->dma_flag); return -EBUSY; @@ -228,9 +198,8 @@ static int gamma_do_dma(drm_device_t *dev, int locked) buf->idx, buf->pid); } } else { - if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock, + if (!locked && !gamma_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { - atomic_inc(&dma->total_missed_lock); clear_bit(0, &dev->dma_flag); return -EBUSY; } @@ -240,13 +209,14 @@ static int gamma_do_dma(drm_device_t *dev, int locked) && !(dev->queuelist[buf->context]->flags & _DRM_CONTEXT_PRESERVED)) { /* PRE: dev->last_context != buf->context */ - if (drm_context_switch(dev, dev->last_context, buf->context)) { - drm_clear_next_buffer(dev); - drm_free_buffer(dev, buf); + if (DRM(context_switch)(dev, dev->last_context, + buf->context)) { + DRM(clear_next_buffer)(dev); + DRM(free_buffer)(dev, buf); } retcode = -EBUSY; goto cleanup; - + /* POST: we will wait for the context switch and will dispatch on a later call when dev->last_context == buf->context. @@ -254,7 +224,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked) TIME! */ } - drm_clear_next_buffer(dev); + gamma_clear_next_buffer(dev); buf->pending = 1; buf->waiting = 0; buf->list = DRM_LIST_PEND; @@ -263,14 +233,14 @@ static int gamma_do_dma(drm_device_t *dev, int locked) #endif gamma_dma_dispatch(dev, address, length); - drm_free_buffer(dev, dma->this_buffer); + gamma_free_buffer(dev, dma->this_buffer); dma->this_buffer = buf; - atomic_add(length, &dma->total_bytes); - atomic_inc(&dma->total_dmas); + atomic_inc(&dev->counts[7]); /* _DRM_STAT_DMA */ + atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */ if (!buf->while_locked && !dev->context_flag && !locked) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, + if (gamma_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { DRM_ERROR("\n"); } @@ -281,18 +251,18 @@ cleanup: #if DRM_DMA_HISTOGRAM dma_stop = get_cycles(); - atomic_inc(&dev->histo.dma[drm_histogram_slot(dma_stop - dma_start)]); + atomic_inc(&dev->histo.dma[gamma_histogram_slot(dma_stop - dma_start)]); #endif return retcode; } -static void gamma_dma_schedule_timer_wrapper(unsigned long dev) +static void gamma_dma_timer_bh(unsigned long dev) { gamma_dma_schedule((drm_device_t *)dev, 0); } -static void gamma_dma_schedule_tq_wrapper(void *dev) +void gamma_dma_immediate_bh(void *dev) { gamma_dma_schedule(dev, 0); } @@ -313,10 +283,10 @@ int gamma_dma_schedule(drm_device_t *dev, int locked) if (test_and_set_bit(0, &dev->interrupt_flag)) { /* Not reentrant */ - atomic_inc(&dma->total_missed_sched); + atomic_inc(&dev->counts[10]); /* _DRM_STAT_MISSED */ return -EBUSY; } - missed = atomic_read(&dma->total_missed_sched); + missed = atomic_read(&dev->counts[10]); #if DRM_DMA_HISTOGRAM schedule_start = get_cycles(); @@ -333,23 +303,18 @@ again: because the lock could not be obtained or the DMA engine wasn't ready. Try again. */ - atomic_inc(&dma->total_tried); - if (!(retcode = gamma_do_dma(dev, locked))) { - atomic_inc(&dma->total_hit); - ++processed; - } + if (!(retcode = gamma_do_dma(dev, locked))) ++processed; } else { do { - next = drm_select_queue(dev, - gamma_dma_schedule_timer_wrapper); + next = gamma_select_queue(dev, gamma_dma_timer_bh); if (next >= 0) { q = dev->queuelist[next]; - buf = drm_waitlist_get(&q->waitlist); + buf = gamma_waitlist_get(&q->waitlist); dma->next_buffer = buf; dma->next_queue = q; if (buf && buf->list == DRM_LIST_RECLAIM) { - drm_clear_next_buffer(dev); - drm_free_buffer(dev, buf); + gamma_clear_next_buffer(dev); + gamma_free_buffer(dev, buf); } } } while (next >= 0 && !dma->next_buffer); @@ -361,21 +326,19 @@ again: } if (--expire) { - if (missed != atomic_read(&dma->total_missed_sched)) { - atomic_inc(&dma->total_lost); + if (missed != atomic_read(&dev->counts[10])) { if (gamma_dma_is_ready(dev)) goto again; } if (processed && gamma_dma_is_ready(dev)) { - atomic_inc(&dma->total_lost); processed = 0; goto again; } } - + clear_bit(0, &dev->interrupt_flag); - + #if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.schedule[drm_histogram_slot(get_cycles() + atomic_inc(&dev->histo.schedule[gamma_histogram_slot(get_cycles() - schedule_start)]); #endif return retcode; @@ -400,7 +363,7 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d) if (signal_pending(current)) return -EINTR; } if (!(d->flags & _DRM_DMA_WHILE_LOCKED)) { - while (!drm_lock_take(&dev->lock.hw_lock->lock, + while (!gamma_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { schedule(); if (signal_pending(current)) { @@ -410,7 +373,6 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d) } ++must_free; } - atomic_inc(&dma->total_prio); for (i = 0; i < d->send_count; i++) { idx = d->send_indices[i]; @@ -461,15 +423,15 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d) goto cleanup; } buf->pending = 1; - + if (dev->last_context != buf->context && !(dev->queuelist[buf->context]->flags & _DRM_CONTEXT_PRESERVED)) { add_wait_queue(&dev->context_wait, &entry); current->state = TASK_INTERRUPTIBLE; /* PRE: dev->last_context != buf->context */ - drm_context_switch(dev, dev->last_context, - buf->context); + DRM(context_switch)(dev, dev->last_context, + buf->context); /* POST: we will wait for the context switch and will dispatch on a later call when dev->last_context == buf->context. @@ -494,11 +456,11 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d) buf->time_dispatched = buf->time_queued; #endif gamma_dma_dispatch(dev, address, length); - atomic_add(length, &dma->total_bytes); - atomic_inc(&dma->total_dmas); - + atomic_inc(&dev->counts[9]); /* _DRM_STAT_SPECIAL */ + atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */ + if (last_buf) { - drm_free_buffer(dev, last_buf); + gamma_free_buffer(dev, last_buf); } last_buf = buf; } @@ -507,11 +469,11 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d) cleanup: if (last_buf) { gamma_dma_ready(dev); - drm_free_buffer(dev, last_buf); + gamma_free_buffer(dev, last_buf); } - + if (must_free && !dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, + if (gamma_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { DRM_ERROR("\n"); } @@ -531,15 +493,15 @@ static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d) last_buf = dma->buflist[d->send_indices[d->send_count-1]]; add_wait_queue(&last_buf->dma_wait, &entry); } - - if ((retcode = drm_dma_enqueue(dev, d))) { + + if ((retcode = gamma_dma_enqueue(dev, d))) { if (d->flags & _DRM_DMA_BLOCK) remove_wait_queue(&last_buf->dma_wait, &entry); return retcode; } - + gamma_dma_schedule(dev, 0); - + if (d->flags & _DRM_DMA_BLOCK) { DRM_DEBUG("%d waiting\n", current->pid); for (;;) { @@ -558,7 +520,7 @@ static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d) if (!retcode || (last_buf->list==DRM_LIST_PEND && !last_buf->pending)) { if (!waitqueue_active(&last_buf->dma_wait)) { - drm_free_buffer(dev, last_buf); + gamma_free_buffer(dev, last_buf); } } if (retcode) { @@ -585,21 +547,19 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd, int retcode = 0; drm_dma_t d; +#if 0 + LOCK_TEST_WITH_RETURN( dev ); +#endif + if (copy_from_user(&d, (drm_dma_t *)arg, sizeof(d))) return -EFAULT; - DRM_DEBUG("%d %d: %d send, %d req\n", - current->pid, d.context, d.send_count, d.request_count); - if (d.context == DRM_KERNEL_CONTEXT || d.context >= dev->queue_slots) { - DRM_ERROR("Process %d using context %d\n", - current->pid, d.context); - return -EINVAL; - } if (d.send_count < 0 || d.send_count > dma->buf_count) { DRM_ERROR("Process %d trying to send %d buffers (of %d max)\n", current->pid, d.send_count, dma->buf_count); return -EINVAL; } + if (d.request_count < 0 || d.request_count > dma->buf_count) { DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", current->pid, d.request_count, dma->buf_count); @@ -609,14 +569,14 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd, if (d.send_count) { if (d.flags & _DRM_DMA_PRIORITY) retcode = gamma_dma_priority(dev, &d); - else + else retcode = gamma_dma_send_buffers(dev, &d); } d.granted_count = 0; if (!retcode && d.request_count) { - retcode = drm_dma_get_buffers(dev, &d); + retcode = gamma_dma_get_buffers(dev, &d); } DRM_DEBUG("%d returning, granted = %d\n", @@ -626,211 +586,3 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd, return retcode; } - -int gamma_irq_install(drm_device_t *dev, int irq) -{ - int retcode; - - if (!irq) return -EINVAL; - - down(&dev->struct_sem); - if (dev->irq) { - up(&dev->struct_sem); - return -EBUSY; - } - dev->irq = irq; - up(&dev->struct_sem); - - DRM_DEBUG("%d\n", irq); - - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - - dev->dma->next_buffer = NULL; - dev->dma->next_queue = NULL; - dev->dma->this_buffer = NULL; - - INIT_LIST_HEAD(&dev->tq.list); - dev->tq.sync = 0; - dev->tq.routine = gamma_dma_schedule_tq_wrapper; - dev->tq.data = dev; - - - /* Before installing handler */ - GAMMA_WRITE(GAMMA_GCOMMANDMODE, 0); - GAMMA_WRITE(GAMMA_GDMACONTROL, 0); - - /* Install handler */ - if ((retcode = request_irq(dev->irq, - gamma_dma_service, - 0, - dev->devname, - dev))) { - down(&dev->struct_sem); - dev->irq = 0; - up(&dev->struct_sem); - return retcode; - } - - /* After installing handler */ - GAMMA_WRITE(GAMMA_GINTENABLE, 0x2001); - GAMMA_WRITE(GAMMA_COMMANDINTENABLE, 0x0008); - GAMMA_WRITE(GAMMA_GDELAYTIMER, 0x39090); - - return 0; -} - -int gamma_irq_uninstall(drm_device_t *dev) -{ - int irq; - - down(&dev->struct_sem); - irq = dev->irq; - dev->irq = 0; - up(&dev->struct_sem); - - if (!irq) return -EINVAL; - - DRM_DEBUG("%d\n", irq); - - GAMMA_WRITE(GAMMA_GDELAYTIMER, 0); - GAMMA_WRITE(GAMMA_COMMANDINTENABLE, 0); - GAMMA_WRITE(GAMMA_GINTENABLE, 0); - free_irq(irq, dev); - - return 0; -} - - -int gamma_control(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_control_t ctl; - int retcode; - - if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl))) - return -EFAULT; - - switch (ctl.func) { - case DRM_INST_HANDLER: - if ((retcode = gamma_irq_install(dev, ctl.irq))) - return retcode; - break; - case DRM_UNINST_HANDLER: - if ((retcode = gamma_irq_uninstall(dev))) - return retcode; - break; - default: - return -EINVAL; - } - return 0; -} - -int gamma_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; - drm_queue_t *q; -#if DRM_DMA_HISTOGRAM - cycles_t start; - - dev->lck_start = start = get_cycles(); -#endif - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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 (lock.context < 0 || lock.context >= dev->queue_count) - return -EINVAL; - q = dev->queuelist[lock.context]; - - ret = drm_flush_block_and_flush(dev, lock.context, lock.flags); - - if (!ret) { - if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) - != lock.context) { - long j = jiffies - dev->lock.lock_time; - - if (j > 0 && j <= DRM_LOCK_SLICE) { - /* Can't take lock if we just had it and - there is contention. */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(j); - } - } - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - 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); - atomic_inc(&q->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - - drm_flush_unblock(dev, lock.context, lock.flags); /* cleanup phase */ - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_READY) - gamma_dma_ready(dev); - if (lock.flags & _DRM_LOCK_QUIESCENT) { - if (gamma_found() == 1) { - gamma_dma_quiescent_single(dev); - } else { - gamma_dma_quiescent_dual(dev); - } - } - } - 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; -} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c index a17bc1a9f..98916bc53 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c @@ -26,546 +26,48 @@ * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> - * + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "gamma.h" #include "drmP.h" #include "gamma_drv.h" -#ifndef PCI_DEVICE_ID_3DLABS_GAMMA -#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008 -#endif -#ifndef PCI_DEVICE_ID_3DLABS_MX -#define PCI_DEVICE_ID_3DLABS_MX 0x0006 -#endif - -#define GAMMA_NAME "gamma" -#define GAMMA_DESC "3dlabs GMX 2000" -#define GAMMA_DATE "20000910" -#define GAMMA_MAJOR 1 -#define GAMMA_MINOR 0 -#define GAMMA_PATCHLEVEL 0 - -static drm_device_t gamma_device; - -static struct file_operations gamma_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: gamma_open, - flush: drm_flush, - release: gamma_release, - ioctl: gamma_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice gamma_misc = { - minor: MISC_DYNAMIC_MINOR, - name: GAMMA_NAME, - fops: &gamma_fops, -}; - -static drm_ioctl_desc_t gamma_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { gamma_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_CONTROL)] = { gamma_control, 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_BUFS)] = { drm_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { drm_mapbufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { drm_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { drm_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { drm_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { drm_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { drm_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { drm_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { drm_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_DMA)] = { gamma_dma, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { gamma_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { gamma_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -}; -#define GAMMA_IOCTL_COUNT DRM_ARRAY_SIZE(gamma_ioctls) - -#ifdef MODULE -static char *gamma = NULL; -#endif -static int devices = 0; - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("3dlabs GMX 2000"); -MODULE_PARM(gamma, "s"); -MODULE_PARM(devices, "i"); -MODULE_PARM_DESC(devices, - "devices=x, where x is the number of MX chips on card\n"); -#ifndef MODULE -/* gamma_options 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 gamma_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("gamma=", gamma_options); -#endif - -static int gamma_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); - - drm_dma_setup(dev); - - 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_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_timer(&dev->timer); - init_waitqueue_head(&dev->context_wait); -#if DRM_DMA_HISTO - memset(&dev->histo, 0, sizeof(dev->histo)); -#endif - 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); - - 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 gamma_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 (dev->irq) gamma_irq_uninstall(dev); - - 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; - } - - /* 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->queuelist) { - for (i = 0; i < dev->queue_count; i++) { - drm_waitlist_destroy(&dev->queuelist[i]->waitlist); - if (dev->queuelist[i]) { - drm_free(dev->queuelist[i], - sizeof(*dev->queuelist[0]), - DRM_MEM_QUEUES); - dev->queuelist[i] = NULL; - } - } - drm_free(dev->queuelist, - dev->queue_slots * sizeof(*dev->queuelist), - DRM_MEM_QUEUES); - dev->queuelist = NULL; - } - - drm_dma_takedown(dev); - - dev->queue_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; -} - -int gamma_found(void) -{ - return devices; -} - -int gamma_find_devices(void) -{ - struct pci_dev *d = NULL, *one = NULL, *two = NULL; - - d = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_GAMMA,d); - if (!d) return 0; - - one = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_MX,d); - if (!one) return 0; - - /* Make sure it's on the same card, if not - no MX's found */ - if (PCI_SLOT(d->devfn) != PCI_SLOT(one->devfn)) return 0; - - two = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_MX,one); - if (!two) return 1; - - /* Make sure it's on the same card, if not - only 1 MX found */ - if (PCI_SLOT(d->devfn) != PCI_SLOT(two->devfn)) return 1; - - /* Two MX's found - we don't currently support more than 2 */ - return 2; -} - -/* gamma_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init gamma_init(void) -{ - int retcode; - drm_device_t *dev = &gamma_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(gamma); -#endif - devices = gamma_find_devices(); - if (devices == 0) return -1; - - if ((retcode = misc_register(&gamma_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", GAMMA_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, gamma_misc.minor); - dev->name = GAMMA_NAME; - - drm_mem_init(); - drm_proc_init(dev); - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d with %d MX devices\n", - GAMMA_NAME, - GAMMA_MAJOR, - GAMMA_MINOR, - GAMMA_PATCHLEVEL, - GAMMA_DATE, - gamma_misc.minor, - devices); - - return 0; -} - -/* gamma_cleanup is called via cleanup_module at module unload time. */ - -static void __exit gamma_cleanup(void) -{ - drm_device_t *dev = &gamma_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&gamma_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - gamma_takedown(dev); -} - -module_init(gamma_init); -module_exit(gamma_cleanup); - - -int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = GAMMA_MAJOR; - version.version_minor = GAMMA_MINOR; - version.version_patchlevel = GAMMA_PATCHLEVEL; - - DRM_COPY(version.name, GAMMA_NAME); - DRM_COPY(version.date, GAMMA_DATE); - DRM_COPY(version.desc, GAMMA_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int gamma_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &gamma_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return gamma_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int gamma_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_release(inode, filp))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - 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); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return gamma_takedown(dev); - } - spin_unlock(&dev->count_lock); - } - unlock_kernel(); - return retcode; -} - -/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int gamma_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 >= GAMMA_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &gamma_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 gamma_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; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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); - gamma_dma_schedule(dev, 1); - if (!dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles() - - dev->lck_start)]); -#endif - - unblock_all_signals(); - return 0; -} +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "gamma" +#define DRIVER_DESC "3DLabs gamma" +#define DRIVER_DATE "20010216" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 } + + +#define __HAVE_COUNTERS 5 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_DMA +#define __HAVE_COUNTER8 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER9 _DRM_STAT_SPECIAL +#define __HAVE_COUNTER10 _DRM_STAT_MISSED + + +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lists.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h index e9ce39589..68b520700 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h @@ -11,11 +11,11 @@ * 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 @@ -23,36 +23,83 @@ * 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@valinux.com> - * + * */ #ifndef _GAMMA_DRV_H_ #define _GAMMA_DRV_H_ - /* gamma_drv.c */ -extern int gamma_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int gamma_open(struct inode *inode, struct file *filp); -extern int gamma_release(struct inode *inode, struct file *filp); -extern int gamma_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int gamma_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int gamma_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); + +typedef struct drm_gamma_private { + drm_map_t *buffers; + drm_map_t *mmio0; + drm_map_t *mmio1; + drm_map_t *mmio2; + drm_map_t *mmio3; +} drm_gamma_private_t; + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != current->pid ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return -EINVAL; \ + } \ +} while (0) + + +extern void gamma_dma_ready(drm_device_t *dev); +extern void gamma_dma_quiescent_single(drm_device_t *dev); +extern void gamma_dma_quiescent_dual(drm_device_t *dev); /* gamma_dma.c */ extern int gamma_dma_schedule(drm_device_t *dev, int locked); extern int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int gamma_irq_install(drm_device_t *dev, int irq); -extern int gamma_irq_uninstall(drm_device_t *dev); -extern int gamma_control(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); extern int gamma_find_devices(void); extern int gamma_found(void); + +#define GAMMA_OFF(reg) \ + ((reg < 0x1000) \ + ? reg \ + : ((reg < 0x10000) \ + ? (reg - 0x1000) \ + : ((reg < 0x11000) \ + ? (reg - 0x10000) \ + : (reg - 0x11000)))) + +#define GAMMA_BASE(reg) ((unsigned long) \ + ((reg < 0x1000) ? dev_priv->mmio0->handle : \ + ((reg < 0x10000) ? dev_priv->mmio1->handle : \ + ((reg < 0x11000) ? dev_priv->mmio2->handle : \ + dev_priv->mmio3->handle)))) + +#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg)) +#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg) +#define GAMMA_READ(reg) GAMMA_DEREF(reg) +#define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0) + +#define GAMMA_BROADCASTMASK 0x9378 +#define GAMMA_COMMANDINTENABLE 0x0c48 +#define GAMMA_DMAADDRESS 0x0028 +#define GAMMA_DMACOUNT 0x0030 +#define GAMMA_FILTERMODE 0x8c00 +#define GAMMA_GCOMMANDINTFLAGS 0x0c50 +#define GAMMA_GCOMMANDMODE 0x0c40 +#define GAMMA_GCOMMANDSTATUS 0x0c60 +#define GAMMA_GDELAYTIMER 0x0c38 +#define GAMMA_GDMACONTROL 0x0060 +#define GAMMA_GINTENABLE 0x0808 +#define GAMMA_GINTFLAGS 0x0810 +#define GAMMA_INFIFOSPACE 0x0018 +#define GAMMA_OUTFIFOWORDS 0x0020 +#define GAMMA_OUTPUTFIFO 0x2000 +#define GAMMA_SYNC 0x8c40 +#define GAMMA_SYNC_TAG 0x0188 + #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h new file mode 100644 index 000000000..ed25b2a99 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h @@ -0,0 +1,112 @@ +/* i810.h -- Intel i810/i815 DRM template customization -*- linux-c -*- + * Created: Thu Feb 15 00:01:12 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __I810_H__ +#define __I810_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) i810_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 1 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +/* Driver customization: + */ +#define __HAVE_RELEASE 1 +#define DRIVER_RELEASE() do { \ + i810_reclaim_buffers( dev, priv->pid ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 +#define __HAVE_DMA_QUEUE 1 +#define __HAVE_DMA_WAITLIST 1 +#define __HAVE_DMA_RECLAIM 1 + +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + i810_dma_quiescent( dev ); \ +} while (0) + +#define __HAVE_DMA_IRQ 1 +#define __HAVE_DMA_IRQ_BH 1 +#define DRIVER_PREINSTALL() do { \ + drm_i810_private_t *dev_priv = \ + (drm_i810_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I810_READ16( I810REG_HWSTAM ); \ + tmp = tmp & 0x6000; \ + I810_WRITE16( I810REG_HWSTAM, tmp ); \ + \ + tmp = I810_READ16( I810REG_INT_MASK_R ); \ + tmp = tmp & 0x6000; /* Unmask interrupts */ \ + I810_WRITE16( I810REG_INT_MASK_R, tmp ); \ + tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ +} while (0) + +#define DRIVER_POSTINSTALL() do { \ + drm_i810_private_t *dev_priv = \ + (drm_i810_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; \ + tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \ + I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ +} while (0) + +#define DRIVER_UNINSTALL() do { \ + drm_i810_private_t *dev_priv = \ + (drm_i810_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I810_READ16( I810REG_INT_IDENTITY_R ); \ + tmp = tmp & ~(0x6000); /* Clear all interrupts */ \ + if ( tmp != 0 ) I810_WRITE16( I810REG_INT_IDENTITY_R, tmp ); \ + \ + tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ +} while (0) + +/* Buffer customization: + */ + +#define DRIVER_BUF_PRIV_T drm_i810_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_i810_private_t *)((dev)->dev_private))->buffer_map + +#endif 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 aa824a79c..4c90496a7 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 @@ -11,11 +11,11 @@ * 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 @@ -31,6 +31,7 @@ */ #define __NO_VERSION__ +#include "i810.h" #include "drmP.h" #include "i810_drv.h" #include <linux/interrupt.h> /* For task queue support */ @@ -47,17 +48,6 @@ #define I810_BUF_UNMAPPED 0 #define I810_BUF_MAPPED 1 -#define I810_REG(reg) 2 -#define I810_BASE(reg) ((unsigned long) \ - dev->maplist[I810_REG(reg)]->handle) -#define I810_ADDR(reg) (I810_BASE(reg) + reg) -#define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg) -#define I810_READ(reg) I810_DEREF(reg) -#define I810_WRITE(reg,val) do { I810_DEREF(reg) = val; } while (0) -#define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg) -#define I810_READ16(reg) I810_DEREF16(reg) -#define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0) - #define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; #define BEGIN_LP_RING(n) do { \ @@ -107,14 +97,14 @@ static drm_buf_t *i810_freelist_get(drm_device_t *dev) drm_device_dma_t *dma = dev->dma; int i; int used; - + /* Linear search might not be the best solution */ for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; /* In use is already a pointer */ - used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, + used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, I810_BUF_CLIENT); if(used == I810_BUF_FREE) { return buf; @@ -131,26 +121,26 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf) { drm_i810_buf_priv_t *buf_priv = buf->dev_private; int used; - + /* In use is already a pointer */ used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE); if(used != I810_BUF_CLIENT) { DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); return -EINVAL; } - + return 0; } static struct file_operations i810_buffer_fops = { - open: i810_open, - flush: drm_flush, - release: i810_release, - ioctl: i810_ioctl, + open: DRM(open), + flush: DRM(flush), + release: DRM(release), + ioctl: DRM(ioctl), mmap: i810_mmap_buffers, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, + read: DRM(read), + fasync: DRM(fasync), + poll: DRM(poll), }; int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) @@ -166,10 +156,10 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) dev_priv = dev->dev_private; buf = dev_priv->mmap_buffer; buf_priv = buf->dev_private; - + vma->vm_flags |= (VM_IO | VM_DONTCOPY); vma->vm_file = filp; - + buf_priv->currently_mapped = I810_BUF_MAPPED; unlock_kernel(); @@ -196,9 +186,9 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp) 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, + buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, PROT_READ|PROT_WRITE, - MAP_SHARED, + MAP_SHARED, buf->bus_address); dev_priv->mmap_buffer = NULL; filp->f_op = old_fops; @@ -222,15 +212,15 @@ static int i810_unmap_buffer(drm_buf_t *buf) int retcode = 0; if(VM_DONTCOPY != 0) { - if(buf_priv->currently_mapped != I810_BUF_MAPPED) + 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, + retcode = do_munmap((unsigned long)buf_priv->virtual, (size_t) buf->total); #else - retcode = do_munmap(current->mm, - (unsigned long)buf_priv->virtual, + retcode = do_munmap(current->mm, + (unsigned long)buf_priv->virtual, (size_t) buf->total); #endif up(¤t->mm->mmap_sem); @@ -241,7 +231,7 @@ static int i810_unmap_buffer(drm_buf_t *buf) return retcode; } -static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, +static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, struct file *filp) { drm_file_t *priv = filp->private_data; @@ -255,7 +245,7 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, DRM_DEBUG("retcode=%d\n", retcode); return retcode; } - + retcode = i810_map_buffer(buf, filp); if(retcode) { i810_freelist_put(dev, buf); @@ -263,7 +253,7 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, return retcode; } buf->pid = priv->pid; - buf_priv = buf->dev_private; + buf_priv = buf->dev_private; d->granted = 1; d->request_idx = buf->idx; d->request_size = buf->total; @@ -275,22 +265,22 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, static unsigned long i810_alloc_page(drm_device_t *dev) { unsigned long address; - + address = __get_free_page(GFP_KERNEL); - if(address == 0UL) + if(address == 0UL) return 0; - + atomic_inc(&virt_to_page(address)->count); set_bit(PG_locked, &virt_to_page(address)->flags); - + return address; } static void i810_free_page(drm_device_t *dev, unsigned long page) { - if(page == 0UL) + if(page == 0UL) return; - + atomic_dec(&virt_to_page(page)->count); clear_bit(PG_locked, &virt_to_page(page)->flags); wake_up(&virt_to_page(page)->wait); @@ -304,26 +294,26 @@ static int i810_dma_cleanup(drm_device_t *dev) if(dev->dev_private) { int i; - drm_i810_private_t *dev_priv = + drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; - + if(dev_priv->ring.virtual_start) { - drm_ioremapfree((void *) dev_priv->ring.virtual_start, - dev_priv->ring.Size); + DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, + dev_priv->ring.Size); } if(dev_priv->hw_status_page != 0UL) { i810_free_page(dev, dev_priv->hw_status_page); /* Need to rewrite hardware status page */ I810_WRITE(0x02080, 0x1ffff000); } - drm_free(dev->dev_private, sizeof(drm_i810_private_t), + DRM(free)(dev->dev_private, sizeof(drm_i810_private_t), DRM_MEM_DRIVER); dev->dev_private = NULL; for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - drm_ioremapfree(buf_priv->kernel_virtual, buf->total); + DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total); } } return 0; @@ -340,14 +330,14 @@ static int i810_wait_ring(drm_device_t *dev, int n) end = jiffies + (HZ*3); while (ring->space < n) { int i; - + ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; ring->space = ring->head - (ring->tail+8); if (ring->space < 0) ring->space += ring->Size; - + if (ring->head != last_head) end = jiffies + (HZ*3); - + iters++; if((signed)(end - jiffies) <= 0) { DRM_ERROR("space: %d wanted %d\n", ring->space, n); @@ -358,7 +348,7 @@ static int i810_wait_ring(drm_device_t *dev, int n) for (i = 0 ; i < 2000 ; i++) ; } -out_wait_ring: +out_wait_ring: return iters; } @@ -366,7 +356,7 @@ static void i810_kernel_lost_context(drm_device_t *dev) { drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_ring_buffer_t *ring = &(dev_priv->ring); - + ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; ring->tail = I810_READ(LP_RING + RING_TAIL); ring->space = ring->head - (ring->tail+8); @@ -380,7 +370,7 @@ static int i810_freelist_init(drm_device_t *dev) int my_idx = 24; u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx); int i; - + if(dma->buf_count > 1019) { /* Not enough space in the status page for the freelist */ return -EINVAL; @@ -389,55 +379,58 @@ static int i810_freelist_init(drm_device_t *dev) for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - + buf_priv->in_use = hw_status++; buf_priv->my_use_idx = my_idx; my_idx += 4; *buf_priv->in_use = I810_BUF_FREE; - buf_priv->kernel_virtual = drm_ioremap(buf->bus_address, - buf->total); + buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, + buf->total); } return 0; } -static int i810_dma_initialize(drm_device_t *dev, +static int i810_dma_initialize(drm_device_t *dev, drm_i810_private_t *dev_priv, drm_i810_init_t *init) { - drm_map_t *sarea_map; + struct list_head *list; dev->dev_private = (void *) dev_priv; memset(dev_priv, 0, sizeof(drm_i810_private_t)); - if (init->ring_map_idx >= dev->map_count || - init->buffer_map_idx >= dev->map_count) { - i810_dma_cleanup(dev); - DRM_ERROR("ring_map or buffer_map are invalid\n"); - return -EINVAL; - } - - dev_priv->ring_map_idx = init->ring_map_idx; - dev_priv->buffer_map_idx = init->buffer_map_idx; - sarea_map = dev->maplist[0]; - dev_priv->sarea_priv = (drm_i810_sarea_t *) - ((u8 *)sarea_map->handle + + list_for_each(list, &dev->maplist->head) { + drm_map_list_t *r_list = (drm_map_list_t *)list; + if( r_list->map && + r_list->map->type == _DRM_SHM && + r_list->map->flags & _DRM_CONTAINS_LOCK ) { + dev_priv->sarea_map = r_list->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); + DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); + + dev_priv->sarea_priv = (drm_i810_sarea_t *) + ((u8 *)dev_priv->sarea_map->handle + init->sarea_priv_offset); atomic_set(&dev_priv->flush_done, 0); init_waitqueue_head(&dev_priv->flush_queue); - + dev_priv->ring.Start = init->ring_start; dev_priv->ring.End = init->ring_end; dev_priv->ring.Size = init->ring_size; - dev_priv->ring.virtual_start = drm_ioremap(dev->agp->base + - init->ring_start, - init->ring_size); + dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base + + init->ring_start, + init->ring_size); dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; - + if (dev_priv->ring.virtual_start == NULL) { i810_dma_cleanup(dev); DRM_ERROR("can not ioremap virtual address for" @@ -454,8 +447,8 @@ static int i810_dma_initialize(drm_device_t *dev, dev_priv->front_di1 = init->front_offset | init->pitch_bits; dev_priv->back_di1 = init->back_offset | init->pitch_bits; dev_priv->zi1 = init->depth_offset | init->pitch_bits; - - + + /* Program Hardware Status Page */ dev_priv->hw_status_page = i810_alloc_page(dev); memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); @@ -465,10 +458,10 @@ static int i810_dma_initialize(drm_device_t *dev, return -ENOMEM; } DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page); - + I810_WRITE(0x02080, virt_to_bus((void *)dev_priv->hw_status_page)); DRM_DEBUG("Enabled hardware status page\n"); - + /* Now we need to init our freelist */ if(i810_freelist_init(dev) != 0) { i810_dma_cleanup(dev); @@ -487,13 +480,13 @@ int i810_dma_init(struct inode *inode, struct file *filp, drm_i810_private_t *dev_priv; drm_i810_init_t init; int retcode = 0; - + if (copy_from_user(&init, (drm_i810_init_t *)arg, sizeof(init))) return -EFAULT; - + switch(init.func) { case I810_INIT_DMA: - dev_priv = drm_alloc(sizeof(drm_i810_private_t), + dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), DRM_MEM_DRIVER); if(dev_priv == NULL) return -ENOMEM; retcode = i810_dma_initialize(dev, dev_priv, &init); @@ -505,7 +498,7 @@ int i810_dma_init(struct inode *inode, struct file *filp, retcode = -EINVAL; break; } - + return retcode; } @@ -517,9 +510,9 @@ int i810_dma_init(struct inode *inode, struct file *filp, * Use 'volatile' & local var tmp to force the emitted values to be * identical to the verified ones. */ -static void i810EmitContextVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ +static void i810EmitContextVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ drm_i810_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; @@ -537,22 +530,22 @@ static void i810EmitContextVerified( drm_device_t *dev, tmp = code[i]; if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) + (tmp & (0x1f<<24)) < (0x1d<<24)) { - OUT_RING( tmp ); + OUT_RING( tmp ); j++; - } + } } - if (j & 1) - OUT_RING( 0 ); + if (j & 1) + OUT_RING( 0 ); ADVANCE_LP_RING(); } -static void i810EmitTexVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ +static void i810EmitTexVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ drm_i810_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; @@ -569,15 +562,15 @@ static void i810EmitTexVerified( drm_device_t *dev, tmp = code[i]; if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) + (tmp & (0x1f<<24)) < (0x1d<<24)) { - OUT_RING( tmp ); + OUT_RING( tmp ); j++; } - } - - if (j & 1) - OUT_RING( 0 ); + } + + if (j & 1) + OUT_RING( 0 ); ADVANCE_LP_RING(); } @@ -585,9 +578,9 @@ static void i810EmitTexVerified( drm_device_t *dev, /* Need to do some additional checking when setting the dest buffer. */ -static void i810EmitDestVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ +static void i810EmitDestVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ drm_i810_private_t *dev_priv = dev->dev_private; unsigned int tmp; RING_LOCALS; @@ -651,9 +644,9 @@ static void i810EmitState( drm_device_t *dev ) -/* need to verify +/* need to verify */ -static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, +static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, unsigned int clear_color, unsigned int clear_zval ) { @@ -684,10 +677,10 @@ static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, pbox->y2 > dev_priv->h) continue; - if ( flags & I810_FRONT ) { + if ( flags & I810_FRONT ) { DRM_DEBUG("clear front\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | + BEGIN_LP_RING( 6 ); + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); OUT_RING( (height << 16) | width ); @@ -699,8 +692,8 @@ static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, if ( flags & I810_BACK ) { DRM_DEBUG("clear back\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | + BEGIN_LP_RING( 6 ); + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); OUT_RING( (height << 16) | width ); @@ -712,8 +705,8 @@ static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, if ( flags & I810_DEPTH ) { DRM_DEBUG("clear depth\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | + BEGIN_LP_RING( 6 ); + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); OUT_RING( (height << 16) | width ); @@ -744,7 +737,7 @@ static void i810_dma_dispatch_swap( drm_device_t *dev ) if (nbox > I810_NR_SAREA_CLIPRECTS) nbox = I810_NR_SAREA_CLIPRECTS; - for (i = 0 ; i < nbox; i++, pbox++) + for (i = 0 ; i < nbox; i++, pbox++) { unsigned int w = pbox->x2 - pbox->x1; unsigned int h = pbox->y2 - pbox->y1; @@ -756,7 +749,7 @@ static void i810_dma_dispatch_swap( drm_device_t *dev ) pbox->x2 > dev_priv->w || pbox->y2 > dev_priv->h) continue; - + DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2); @@ -766,14 +759,14 @@ static void i810_dma_dispatch_swap( drm_device_t *dev ) OUT_RING( pitch | (0xCC << 16)); OUT_RING( (h << 16) | (w * cpp)); OUT_RING( dst ); - OUT_RING( pitch ); + OUT_RING( pitch ); OUT_RING( start ); ADVANCE_LP_RING(); } } -static void i810_dma_dispatch_vertex(drm_device_t *dev, +static void i810_dma_dispatch_vertex(drm_device_t *dev, drm_buf_t *buf, int discard, int used) @@ -784,30 +777,30 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev, drm_clip_rect_t *box = sarea_priv->boxes; int nbox = sarea_priv->nbox; unsigned long address = (unsigned long)buf->bus_address; - unsigned long start = address - dev->agp->base; + unsigned long start = address - dev->agp->base; int i = 0, u; RING_LOCALS; i810_kernel_lost_context(dev); - if (nbox > I810_NR_SAREA_CLIPRECTS) + if (nbox > I810_NR_SAREA_CLIPRECTS) nbox = I810_NR_SAREA_CLIPRECTS; if (discard) { - u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, + u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_HARDWARE); if(u != I810_BUF_CLIENT) { DRM_DEBUG("xxxx 2\n"); } } - if (used > 4*1024) + if (used > 4*1024) used = 0; if (sarea_priv->dirty) i810EmitState( dev ); - DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", + DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", address, used, nbox); dev_priv->counter++; @@ -821,7 +814,7 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev, *(u32 *)buf_priv->virtual = (GFX_OP_PRIMITIVE | sarea_priv->vertex_prim | ((used/4)-2)); - + if (used & 4) { *(u32 *)((u32)buf_priv->virtual + used) = 0; used += 4; @@ -829,26 +822,26 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev, i810_unmap_buffer(buf); } - + if (used) { do { if (i < nbox) { BEGIN_LP_RING(4); - OUT_RING( GFX_OP_SCISSOR | SC_UPDATE_SCISSOR | + OUT_RING( GFX_OP_SCISSOR | SC_UPDATE_SCISSOR | SC_ENABLE ); OUT_RING( GFX_OP_SCISSOR_INFO ); OUT_RING( box[i].x1 | (box[i].y1<<16) ); OUT_RING( (box[i].x2-1) | ((box[i].y2-1)<<16) ); ADVANCE_LP_RING(); } - + BEGIN_LP_RING(4); OUT_RING( CMD_OP_BATCH_BUFFER ); OUT_RING( start | BB1_PROTECTED ); OUT_RING( start + used - 4 ); OUT_RING( 0 ); ADVANCE_LP_RING(); - + } while (++i < nbox); } @@ -872,24 +865,25 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev, /* Interrupts are only for flushing */ -static void i810_dma_service(int irq, void *device, struct pt_regs *regs) +void i810_dma_service(int irq, void *device, struct pt_regs *regs) { drm_device_t *dev = (drm_device_t *)device; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; u16 temp; - - atomic_inc(&dev->total_irq); + + atomic_inc(&dev->counts[_DRM_STAT_IRQ]); temp = I810_READ16(I810REG_INT_IDENTITY_R); temp = temp & ~(0x6000); - if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R, + if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R, temp); /* Clear all interrupts */ else return; - + queue_task(&dev->tq, &tq_immediate); mark_bh(IMMEDIATE_BH); } -static void i810_dma_task_queue(void *device) +void i810_dma_immediate_bh(void *device) { drm_device_t *dev = (drm_device_t *) device; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; @@ -898,129 +892,6 @@ static void i810_dma_task_queue(void *device) wake_up_interruptible(&dev_priv->flush_queue); } -int i810_irq_install(drm_device_t *dev, int irq) -{ - int retcode; - u16 temp; - - if (!irq) return -EINVAL; - - down(&dev->struct_sem); - if (dev->irq) { - up(&dev->struct_sem); - return -EBUSY; - } - dev->irq = irq; - up(&dev->struct_sem); - - DRM_DEBUG( "Interrupt Install : %d\n", irq); - DRM_DEBUG("%d\n", irq); - - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - - dev->dma->next_buffer = NULL; - dev->dma->next_queue = NULL; - dev->dma->this_buffer = NULL; - - INIT_LIST_HEAD(&dev->tq.list); - dev->tq.sync = 0; - dev->tq.routine = i810_dma_task_queue; - dev->tq.data = dev; - - /* Before installing handler */ - temp = I810_READ16(I810REG_HWSTAM); - temp = temp & 0x6000; - I810_WRITE16(I810REG_HWSTAM, temp); - - temp = I810_READ16(I810REG_INT_MASK_R); - temp = temp & 0x6000; - I810_WRITE16(I810REG_INT_MASK_R, temp); /* Unmask interrupts */ - temp = I810_READ16(I810REG_INT_ENABLE_R); - temp = temp & 0x6000; - I810_WRITE16(I810REG_INT_ENABLE_R, temp); /* Disable all interrupts */ - - /* Install handler */ - if ((retcode = request_irq(dev->irq, - i810_dma_service, - SA_SHIRQ, - dev->devname, - dev))) { - down(&dev->struct_sem); - dev->irq = 0; - up(&dev->struct_sem); - return retcode; - } - temp = I810_READ16(I810REG_INT_ENABLE_R); - temp = temp & 0x6000; - temp = temp | 0x0003; - I810_WRITE16(I810REG_INT_ENABLE_R, - temp); /* Enable bp & user interrupts */ - return 0; -} - -int i810_irq_uninstall(drm_device_t *dev) -{ - int irq; - u16 temp; - - -/* return 0; */ - - down(&dev->struct_sem); - irq = dev->irq; - dev->irq = 0; - up(&dev->struct_sem); - - if (!irq) return -EINVAL; - - DRM_DEBUG( "Interrupt UnInstall: %d\n", irq); - DRM_DEBUG("%d\n", irq); - - temp = I810_READ16(I810REG_INT_IDENTITY_R); - temp = temp & ~(0x6000); - if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R, - temp); /* Clear all interrupts */ - - temp = I810_READ16(I810REG_INT_ENABLE_R); - temp = temp & 0x6000; - I810_WRITE16(I810REG_INT_ENABLE_R, - temp); /* Disable all interrupts */ - - free_irq(irq, dev); - - return 0; -} - -int i810_control(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_control_t ctl; - int retcode; - - DRM_DEBUG( "i810_control\n"); - - if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl))) - return -EFAULT; - - switch (ctl.func) { - case DRM_INST_HANDLER: - if ((retcode = i810_irq_install(dev, ctl.irq))) - return retcode; - break; - case DRM_UNINST_HANDLER: - if ((retcode = i810_irq_uninstall(dev))) - return retcode; - break; - default: - return -EINVAL; - } - return 0; -} - static inline void i810_dma_emit_flush(drm_device_t *dev) { drm_i810_private_t *dev_priv = dev->dev_private; @@ -1057,11 +928,11 @@ static inline void i810_dma_quiescent_emit(drm_device_t *dev) /* wake_up_interruptible(&dev_priv->flush_queue); */ } -static void i810_dma_quiescent(drm_device_t *dev) +void i810_dma_quiescent(drm_device_t *dev) { DECLARE_WAITQUEUE(entry, current); drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - unsigned long end; + unsigned long end; if(dev_priv == NULL) { return; @@ -1069,7 +940,7 @@ static void i810_dma_quiescent(drm_device_t *dev) atomic_set(&dev_priv->flush_done, 0); add_wait_queue(&dev_priv->flush_queue, &entry); end = jiffies + (HZ*3); - + for (;;) { current->state = TASK_INTERRUPTIBLE; i810_dma_quiescent_emit(dev); @@ -1077,16 +948,16 @@ static void i810_dma_quiescent(drm_device_t *dev) if((signed)(end - jiffies) <= 0) { DRM_ERROR("lockup\n"); break; - } + } schedule_timeout(HZ*3); if (signal_pending(current)) { break; } } - + current->state = TASK_RUNNING; remove_wait_queue(&dev_priv->flush_queue, &entry); - + return; } @@ -1096,7 +967,7 @@ static int i810_flush_queue(drm_device_t *dev) drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_device_dma_t *dma = dev->dma; unsigned long end; - int i, ret = 0; + int i, ret = 0; if(dev_priv == NULL) { return 0; @@ -1111,14 +982,14 @@ static int i810_flush_queue(drm_device_t *dev) if((signed)(end - jiffies) <= 0) { DRM_ERROR("lockup\n"); break; - } + } schedule_timeout(HZ*3); if (signal_pending(current)) { ret = -EINTR; /* Can't restart */ break; } } - + current->state = TASK_RUNNING; remove_wait_queue(&dev_priv->flush_queue, &entry); @@ -1126,8 +997,8 @@ static int i810_flush_queue(drm_device_t *dev) for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - - int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE, + + int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE, I810_BUF_FREE); if (used == I810_BUF_HARDWARE) @@ -1154,9 +1025,9 @@ void i810_reclaim_buffers(drm_device_t *dev, pid_t pid) for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - + if (buf->pid == pid && buf_priv) { - int used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, + int used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE); if (used == I810_BUF_CLIENT) @@ -1167,91 +1038,12 @@ void i810_reclaim_buffers(drm_device_t *dev, pid_t pid) } } -int i810_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 (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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 (lock.context < 0) { - return -EINVAL; - } - /* Only one queue: - */ - - if (!ret) { - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - 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); - DRM_DEBUG("Calling lock schedule\n"); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_QUIESCENT) { - DRM_DEBUG("_DRM_LOCK_QUIESCENT\n"); - DRM_DEBUG("fred\n"); - i810_dma_quiescent(dev); - } - } - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); - return ret; -} - -int i810_flush_ioctl(struct inode *inode, struct file *filp, +int i810_flush_ioctl(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_DEBUG("i810_flush_ioctl\n"); if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_flush_ioctl called without lock held\n"); @@ -1271,8 +1063,8 @@ int i810_dma_vertex(struct inode *inode, struct file *filp, drm_device_dma_t *dma = dev->dma; 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_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; drm_i810_vertex_t vertex; if (copy_from_user(&vertex, (drm_i810_vertex_t *)arg, sizeof(vertex))) @@ -1286,15 +1078,15 @@ int i810_dma_vertex(struct inode *inode, struct file *filp, DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", vertex.idx, vertex.used, vertex.discard); - i810_dma_dispatch_vertex( dev, - dma->buflist[ vertex.idx ], + i810_dma_dispatch_vertex( dev, + dma->buflist[ vertex.idx ], vertex.discard, vertex.used ); - atomic_add(vertex.used, &dma->total_bytes); - atomic_inc(&dma->total_dmas); + atomic_add(vertex.used, &dev->counts[_DRM_STAT_SECONDARY]); + atomic_inc(&dev->counts[_DRM_STAT_DMA]); sarea_priv->last_enqueue = dev_priv->counter-1; sarea_priv->last_dispatch = (int) hw_status[5]; - + return 0; } @@ -1309,14 +1101,14 @@ int i810_clear_bufs(struct inode *inode, struct file *filp, if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear))) return -EFAULT; - + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_clear_bufs called without lock held\n"); return -EINVAL; } - i810_dma_dispatch_clear( dev, clear.flags, - clear.clear_color, + i810_dma_dispatch_clear( dev, clear.flags, + clear.clear_color, clear.clear_depth ); return 0; } @@ -1326,7 +1118,7 @@ int i810_swap_bufs(struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - + DRM_DEBUG("i810_swap_bufs\n"); if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { @@ -1345,8 +1137,8 @@ int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, drm_device_t *dev = priv->dev; 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_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; sarea_priv->last_dispatch = (int) hw_status[5]; return 0; @@ -1361,18 +1153,18 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, drm_i810_dma_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_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; DRM_DEBUG("getbuf\n"); if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d))) return -EFAULT; - + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_dma called without lock held\n"); return -EINVAL; } - + d.granted = 0; retcode = i810_dma_get_buffer(dev, &d, filp); @@ -1395,8 +1187,8 @@ int i810_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, 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_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; @@ -1405,7 +1197,7 @@ int i810_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, DRM_ERROR("i810_dma called without lock held\n"); return -EINVAL; } - + if (copy_from_user(&d, (drm_i810_copy_t *)arg, sizeof(d))) return -EFAULT; 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 c5f51c9ad..cee189b7b 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 @@ -98,8 +98,8 @@ typedef struct _drm_i810_init { I810_INIT_DMA = 0x01, I810_CLEANUP_DMA = 0x02 } func; - int ring_map_idx; - int buffer_map_idx; + unsigned int mmio_offset; + unsigned int buffers_offset; int sarea_priv_offset; unsigned int ring_start; unsigned int ring_end; 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 7152eac3a..12a59dbf3 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 @@ -19,630 +19,64 @@ * 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 + * VA LINUX SYSTEMS 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@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> + * 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@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "i810.h" #include "drmP.h" #include "i810_drv.h" -#define I810_NAME "i810" -#define I810_DESC "Intel I810" -#define I810_DATE "20000928" -#define I810_MAJOR 1 -#define I810_MINOR 1 -#define I810_PATCHLEVEL 0 - -static drm_device_t i810_device; -drm_ctx_t i810_res_ctx; - -static struct file_operations i810_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: i810_open, - flush: drm_flush, - release: i810_release, - ioctl: i810_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice i810_misc = { - minor: MISC_DYNAMIC_MINOR, - name: I810_NAME, - fops: &i810_fops, -}; - -static drm_ioctl_desc_t i810_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { i810_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_CONTROL)] = { i810_control, 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_BUFS)] = { i810_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { i810_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { i810_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { i810_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { i810_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { i810_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { i810_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { i810_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { i810_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { i810_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { i810_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)] = { i810_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { i810_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, - - [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 }, - - [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl,1, 0 }, - [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) - -#ifdef MODULE -static char *i810 = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("Intel I810"); -MODULE_PARM(i810, "s"); - -#ifndef MODULE -/* i810_options 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_drm. - */ - -static int __init i810_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("i810=", i810_options); -#endif - -static int i810_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); - - drm_dma_setup(dev); - - 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_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_timer(&dev->timer); - init_waitqueue_head(&dev->context_wait); -#if DRM_DMA_HISTO - memset(&dev->histo, 0, sizeof(dev->histo)); -#endif - 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); - - 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 i810_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 (dev->irq) i810_irq_uninstall(dev); - - 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; - } - /* 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 r128_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(); - - dev->agp->acquired = 0; - dev->agp->enabled = 0; - } - /* 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: - 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->queuelist) { - for (i = 0; i < dev->queue_count; i++) { - drm_waitlist_destroy(&dev->queuelist[i]->waitlist); - if (dev->queuelist[i]) { - drm_free(dev->queuelist[i], - sizeof(*dev->queuelist[0]), - DRM_MEM_QUEUES); - dev->queuelist[i] = NULL; - } - } - drm_free(dev->queuelist, - dev->queue_slots * sizeof(*dev->queuelist), - DRM_MEM_QUEUES); - dev->queuelist = NULL; - } - - drm_dma_takedown(dev); - - dev->queue_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; -} - -/* i810_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init i810_init(void) -{ - int retcode; - drm_device_t *dev = &i810_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(i810); -#endif - DRM_DEBUG("doing misc_register\n"); - if ((retcode = misc_register(&i810_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", I810_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, i810_misc.minor); - dev->name = I810_NAME; - - DRM_DEBUG("doing mem init\n"); - drm_mem_init(); - DRM_DEBUG("doing proc init\n"); - drm_proc_init(dev); - DRM_DEBUG("doing agp init\n"); - dev->agp = drm_agp_init(); - if(dev->agp == NULL) { - DRM_INFO("The i810 drm module requires the agpgart module" - " to function correctly\nPlease load the agpgart" - " module before you load the i810 module\n"); - drm_proc_cleanup(); - misc_deregister(&i810_misc); - i810_takedown(dev); - return -ENOMEM; - } - DRM_DEBUG("doing ctxbitmap init\n"); - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&i810_misc); - i810_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - I810_NAME, - I810_MAJOR, - I810_MINOR, - I810_PATCHLEVEL, - I810_DATE, - i810_misc.minor); - - return 0; -} - -/* i810_cleanup is called via cleanup_module at module unload time. */ - -static void __exit i810_cleanup(void) -{ - drm_device_t *dev = &i810_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&i810_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); - i810_takedown(dev); - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -} - -module_init(i810_init); -module_exit(i810_cleanup); - - -int i810_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = I810_MAJOR; - version.version_minor = I810_MINOR; - version.version_patchlevel = I810_PATCHLEVEL; - - DRM_COPY(version.name, I810_NAME); - DRM_COPY(version.date, I810_DATE); - DRM_COPY(version.desc, I810_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int i810_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &i810_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return i810_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int i810_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", - current->pid, dev->device, dev->open_count); - - if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) - && dev->lock.pid == current->pid) { - i810_reclaim_buffers(dev, priv->pid); - DRM_ERROR("Process %d dead, freeing lock for context %d\n", - current->pid, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - drm_lock_free(dev, - &dev->lock.hw_lock->lock, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - - /* FIXME: may require heavy-handed reset of - hardware at this point, possibly - processed via a callback to the X - server. */ - } else if (dev->lock.hw_lock) { - /* The lock is required to reclaim buffers */ - DECLARE_WAITQUEUE(entry, current); - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - retcode = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - dev->lock.pid = priv->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - /* Contention */ - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - retcode = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - if(!retcode) { - i810_reclaim_buffers(dev, priv->pid); - drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT); - } - } - drm_fasync(-1, filp, 0); - - down(&dev->struct_sem); - if (priv->prev) priv->prev->next = priv->next; - else dev->file_first = priv->next; - if (priv->next) priv->next->prev = priv->prev; - else dev->file_last = priv->prev; - up(&dev->struct_sem); - - drm_free(priv, sizeof(*priv), DRM_MEM_FILES); -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - 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); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return i810_takedown(dev); - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return retcode; -} - -/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int i810_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 >= I810_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &i810_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 i810_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; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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); - if (!dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles() - - dev->lck_start)]); -#endif - - unblock_all_signals(); - return 0; -} +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "i810" +#define DRIVER_DESC "Intel i810" +#define DRIVER_DATE "20010215" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl, 1, 0 }, \ + [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 __HAVE_COUNTERS 4 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY +#define __HAVE_COUNTER9 _DRM_STAT_DMA + + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_lists.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" 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 1c9574017..e1b17148e 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 @@ -11,11 +11,11 @@ * 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 @@ -54,11 +54,12 @@ typedef struct _drm_i810_ring_buffer{ } drm_i810_ring_buffer_t; typedef struct drm_i810_private { - int ring_map_idx; - int buffer_map_idx; + drm_map_t *sarea_map; + drm_map_t *buffer_map; + drm_map_t *mmio_map; - drm_i810_ring_buffer_t ring; drm_i810_sarea_t *sarea_priv; + drm_i810_ring_buffer_t ring; unsigned long hw_status_page; unsigned long counter; @@ -67,78 +68,33 @@ typedef struct drm_i810_private { wait_queue_head_t flush_queue; /* Processes waiting until flush */ drm_buf_t *mmap_buffer; - + u32 front_di1, back_di1, zi1; - + int back_offset; int depth_offset; int w, h; int pitch; } drm_i810_private_t; - /* i810_drv.c */ -extern int i810_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_open(struct inode *inode, struct file *filp); -extern int i810_release(struct inode *inode, struct file *filp); -extern int i810_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - /* i810_dma.c */ extern int i810_dma_schedule(drm_device_t *dev, int locked); extern int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int i810_irq_install(drm_device_t *dev, int irq); -extern int i810_irq_uninstall(drm_device_t *dev); -extern int i810_control(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); extern int i810_dma_init(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int i810_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); 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, +extern int i810_getage(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, +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_infobufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_markbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_freebufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_addmap(struct inode *inode, struct file *filp, +extern int i810_docopy(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); - /* i810_context.c */ -extern int i810_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int i810_context_switch(drm_device_t *dev, int old, int new); -extern int i810_context_switch_complete(drm_device_t *dev, int new); +extern void i810_dma_quiescent(drm_device_t *dev); #define I810_VERBOSE 0 @@ -152,6 +108,18 @@ int i810_swap_bufs(struct inode *inode, struct file *filp, int i810_clear_bufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); + +#define I810_BASE(reg) ((unsigned long) \ + dev_priv->mmio_map->handle) +#define I810_ADDR(reg) (I810_BASE(reg) + reg) +#define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg) +#define I810_READ(reg) I810_DEREF(reg) +#define I810_WRITE(reg,val) do { I810_DEREF(reg) = val; } while (0) +#define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg) +#define I810_READ16(reg) I810_DEREF16(reg) +#define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0) + + #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) #define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23)) #define CMD_REPORT_HEAD (7<<23) @@ -184,7 +152,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp, #define RING_START 0x08 #define START_ADDR 0x00FFFFF8 #define RING_LEN 0x0C -#define RING_NR_PAGES 0x000FF000 +#define RING_NR_PAGES 0x000FF000 #define RING_REPORT_MASK 0x00000006 #define RING_REPORT_64K 0x00000002 #define RING_REPORT_128K 0x00000004 @@ -222,4 +190,3 @@ int i810_clear_bufs(struct inode *inode, struct file *filp, #endif - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h new file mode 100644 index 000000000..277aa2029 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h @@ -0,0 +1,67 @@ +/* mga.h -- Matrox G200/G400 DRM template customization -*- linux-c -*- + * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_H__ +#define __MGA_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) mga_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 1 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +/* Driver customization: + */ +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) mga_do_cleanup_dma( dev ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 + +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + drm_mga_private_t *dev_priv = dev->dev_private; \ + return mga_do_wait_for_idle( dev_priv ); \ +} while (0) + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_mga_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_mga_private_t *)((dev)->dev_private))->buffers + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c index 356376ca9..8b0a67a2d 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c @@ -24,1028 +24,695 @@ * 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@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> */ #define __NO_VERSION__ +#include "mga.h" #include "drmP.h" #include "mga_drv.h" #include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> -#define MGA_REG(reg) 2 -#define MGA_BASE(reg) ((unsigned long) \ - ((drm_device_t *)dev)->maplist[MGA_REG(reg)]->handle) -#define MGA_ADDR(reg) (MGA_BASE(reg) + reg) -#define MGA_DEREF(reg) *(__volatile__ int *)MGA_ADDR(reg) -#define MGA_READ(reg) MGA_DEREF(reg) -#define MGA_WRITE(reg,val) do { MGA_DEREF(reg) = val; } while (0) +#define MGA_DEFAULT_USEC_TIMEOUT 10000 -#define PDEA_pagpxfer_enable 0x2 -static int mga_flush_queue(drm_device_t *dev); +/* ================================================================ + * Engine control + */ -static unsigned long mga_alloc_page(drm_device_t *dev) +int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ) { - unsigned long address; + u32 status = 0; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - address = __get_free_page(GFP_KERNEL); - if(address == 0UL) { - return 0; + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; + if ( status == MGA_ENDPRDMASTS ) { + MGA_WRITE8( MGA_CRTC_INDEX, 0 ); + return 0; + } + udelay( 1 ); } - atomic_inc(&virt_to_page(address)->count); - set_bit(PG_reserved, &virt_to_page(address)->flags); - return address; + DRM_DEBUG( "failed! status=0x%08x\n", status ); + return -EBUSY; } -static void mga_free_page(drm_device_t *dev, unsigned long page) +int mga_do_dma_idle( drm_mga_private_t *dev_priv ) { - if(!page) return; - atomic_dec(&virt_to_page(page)->count); - clear_bit(PG_reserved, &virt_to_page(page)->flags); - free_page(page); - return; + u32 status = 0; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + status = MGA_READ( MGA_STATUS ) & MGA_DMA_IDLE_MASK; + if ( status == MGA_ENDPRDMASTS ) return 0; + udelay( 1 ); + } + + DRM_DEBUG( "failed! status=0x%08x\n", status ); + return -EBUSY; } -static void mga_delay(void) +int mga_do_dma_reset( drm_mga_private_t *dev_priv ) { - return; -} + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_primary_buffer_t *primary = &dev_priv->prim; -/* These are two age tags that will never be sent to - * the hardware */ -#define MGA_BUF_USED 0xffffffff -#define MGA_BUF_FREE 0 + DRM_DEBUG( "%s\n", __FUNCTION__ ); -static int mga_freelist_init(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_freelist_t *item; - int i; - - dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); - if(dev_priv->head == NULL) return -ENOMEM; - memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); - dev_priv->head->age = MGA_BUF_USED; - - for (i = 0; i < dma->buf_count; i++) { - buf = dma->buflist[ i ]; - buf_priv = buf->dev_private; - item = drm_alloc(sizeof(drm_mga_freelist_t), - DRM_MEM_DRIVER); - if(item == NULL) return -ENOMEM; - memset(item, 0, sizeof(drm_mga_freelist_t)); - item->age = MGA_BUF_FREE; - item->prev = dev_priv->head; - item->next = dev_priv->head->next; - if(dev_priv->head->next != NULL) - dev_priv->head->next->prev = item; - if(item->next == NULL) dev_priv->tail = item; - item->buf = buf; - buf_priv->my_freelist = item; - buf_priv->discard = 0; - buf_priv->dispatched = 0; - dev_priv->head->next = item; - } + /* The primary DMA stream should look like new right about now. + */ + primary->tail = 0; + primary->space = primary->size; + primary->last_flush = 0; - return 0; -} + sarea_priv->last_wrap = 0; -static void mga_freelist_cleanup(drm_device_t *dev) -{ - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_freelist_t *item; - drm_mga_freelist_t *prev; - - item = dev_priv->head; - while(item) { - prev = item; - item = item->next; - drm_free(prev, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); - } + /* FIXME: Reset counters, buffer ages etc... + */ + + /* FIXME: What else do we need to reinitialize? WARP stuff? + */ - dev_priv->head = dev_priv->tail = NULL; + return 0; } -/* Frees dispatch lock */ -static inline void mga_dma_quiescent(drm_device_t *dev) +int mga_do_engine_reset( drm_mga_private_t *dev_priv ) { - drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned long end; - int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - DRM_DEBUG("dispatch_status = 0x%02lx\n", dev_priv->dispatch_status); - end = jiffies + (HZ*3); - while(1) { - if(!test_and_set_bit(MGA_IN_DISPATCH, - &dev_priv->dispatch_status)) { - break; - } - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup: dispatch_status = 0x%02lx," - " jiffies = %lu, end = %lu\n", - dev_priv->dispatch_status, jiffies, end); - return; - } - for (i = 0 ; i < 2000 ; i++) mga_delay(); - } - end = jiffies + (HZ*3); - DRM_DEBUG("quiescent status : %x\n", MGA_READ(MGAREG_STATUS)); - while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup\n"); - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - return; - } - for (i = 0 ; i < 2000 ; i++) mga_delay(); - } - sarea_priv->dirty |= MGA_DMA_FLUSH; + /* Okay, so we've completely screwed up and locked the engine. + * How about we clean up after ourselves? + */ + MGA_WRITE( MGA_RST, MGA_SOFTRESET ); + udelay( 15 ); /* Wait at least 10 usecs */ + MGA_WRITE( MGA_RST, 0 ); + + /* Initialize the registers that get clobbered by the soft + * reset. Many of the core register values survive a reset, + * but the drawing registers are basically all gone. + * + * 3D clients should probably die after calling this. The X + * server should reset the engine state to known values. + */ +#if 0 + MGA_WRITE( MGA_PRIMPTR, + virt_to_bus((void *)dev_priv->prim.status_page) | + MGA_PRIMPTREN0 | + MGA_PRIMPTREN1 ); +#endif - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - DRM_DEBUG("exit, dispatch_status = 0x%02lx\n", - dev_priv->dispatch_status); -} + MGA_WRITE( MGA_ICLEAR, MGA_SOFTRAPICLR ); + MGA_WRITE( MGA_IEN, MGA_SOFTRAPIEN ); -static void mga_reset_freelist(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - int i; + /* The primary DMA stream should look like new right about now. + */ + mga_do_dma_reset( dev_priv ); - for (i = 0; i < dma->buf_count; i++) { - buf = dma->buflist[ i ]; - buf_priv = buf->dev_private; - buf_priv->my_freelist->age = MGA_BUF_FREE; - } + /* This bad boy will never fail. + */ + return 0; } -/* Least recently used : - * These operations are not atomic b/c they are protected by the - * hardware lock */ -drm_buf_t *mga_freelist_get(drm_device_t *dev) +/* ================================================================ + * Primary DMA stream + */ + +void mga_do_dma_flush( drm_mga_private_t *dev_priv ) { - DECLARE_WAITQUEUE(entry, current); - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; - drm_mga_freelist_t *prev; - drm_mga_freelist_t *next; - static int failed = 0; - int return_null = 0; - - if(failed >= 1000 && dev_priv->tail->age >= dev_priv->last_prim_age) { - DRM_DEBUG("Waiting on freelist," - " tail->age = %d, last_prim_age= %d\n", - dev_priv->tail->age, - dev_priv->last_prim_age); - add_wait_queue(&dev_priv->buf_queue, &entry); - set_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - mga_dma_schedule(dev, 0); - if(dev_priv->tail->age < dev_priv->last_prim_age) - break; - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - ++return_null; - break; - } - } - clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->buf_queue, &entry); - if (return_null) return NULL; - } + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + u32 head, tail; + DMA_LOCALS; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); - if(dev_priv->tail->age < dev_priv->last_prim_age) { - prev = dev_priv->tail->prev; - next = dev_priv->tail; - prev->next = NULL; - next->prev = next->next = NULL; - dev_priv->tail = prev; - next->age = MGA_BUF_USED; - failed = 0; - return next->buf; + if ( primary->tail == primary->last_flush ) { + DRM_DEBUG( " bailing out...\n" ); + return; } - failed++; - return NULL; -} + tail = primary->tail + dev_priv->primary->offset; -int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf) -{ - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_freelist_t *prev; - drm_mga_freelist_t *head; - drm_mga_freelist_t *next; + /* We need to pad the stream between flushes, as the card + * actually (partially?) reads the first of these commands. + * See page 4-16 in the G400 manual, middle of the page or so. + */ + BEGIN_DMA( 1 ); - if(buf_priv->my_freelist->age == MGA_BUF_USED) { - /* Discarded buffer, put it on the tail */ - next = buf_priv->my_freelist; - next->age = MGA_BUF_FREE; - prev = dev_priv->tail; - prev->next = next; - next->prev = prev; - next->next = NULL; - dev_priv->tail = next; + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + ADVANCE_DMA(); + + primary->last_flush = primary->tail; + + head = MGA_READ( MGA_PRIMADDRESS ); + + if ( head <= tail ) { + primary->space = primary->size - primary->tail; } else { - /* Normally aged buffer, put it on the head + 1, - * as the real head is a sentinal element - */ - next = buf_priv->my_freelist; - head = dev_priv->head; - prev = head->next; - head->next = next; - prev->prev = next; - next->prev = head; - next->next = prev; + primary->space = head - tail; } - return 0; + DRM_DEBUG( " head = 0x%06lx\n", head - dev_priv->primary->offset ); + DRM_DEBUG( " tail = 0x%06lx\n", tail - dev_priv->primary->offset ); + DRM_DEBUG( " space = 0x%06x\n", primary->space ); + + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); + + DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } -static int mga_init_primary_bufs(drm_device_t *dev, drm_mga_init_t *init) +void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) { - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_prim_buf_t *prim_buffer; - int i, temp, size_of_buf; - int offset = init->reserved_map_agpstart; - - dev_priv->primary_size = ((init->primary_size + PAGE_SIZE - 1) / - PAGE_SIZE) * PAGE_SIZE; - size_of_buf = dev_priv->primary_size / MGA_NUM_PRIM_BUFS; - dev_priv->warp_ucode_size = init->warp_ucode_size; - dev_priv->prim_bufs = drm_alloc(sizeof(drm_mga_prim_buf_t *) * - (MGA_NUM_PRIM_BUFS + 1), - DRM_MEM_DRIVER); - if(dev_priv->prim_bufs == NULL) { - DRM_ERROR("Unable to allocate memory for prim_buf\n"); - return -ENOMEM; - } - memset(dev_priv->prim_bufs, - 0, sizeof(drm_mga_prim_buf_t *) * (MGA_NUM_PRIM_BUFS + 1)); + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + u32 head, tail; + DMA_LOCALS; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); - temp = init->warp_ucode_size + dev_priv->primary_size; - temp = ((temp + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; + BEGIN_DMA_WRAP(); - dev_priv->ioremap = drm_ioremap(dev->agp->base + offset, - temp); - if(dev_priv->ioremap == NULL) { - DRM_ERROR("Ioremap failed\n"); - return -ENOMEM; - } - init_waitqueue_head(&dev_priv->wait_queue); - - for(i = 0; i < MGA_NUM_PRIM_BUFS; i++) { - prim_buffer = drm_alloc(sizeof(drm_mga_prim_buf_t), - DRM_MEM_DRIVER); - if(prim_buffer == NULL) return -ENOMEM; - memset(prim_buffer, 0, sizeof(drm_mga_prim_buf_t)); - prim_buffer->phys_head = offset + dev->agp->base; - prim_buffer->current_dma_ptr = - prim_buffer->head = - (u32 *) (dev_priv->ioremap + - offset - - init->reserved_map_agpstart); - prim_buffer->num_dwords = 0; - prim_buffer->max_dwords = size_of_buf / sizeof(u32); - prim_buffer->max_dwords -= 5; /* Leave room for the softrap */ - prim_buffer->sec_used = 0; - prim_buffer->idx = i; - prim_buffer->prim_age = i + 1; - offset = offset + size_of_buf; - dev_priv->prim_bufs[i] = prim_buffer; - } - dev_priv->current_prim_idx = 0; - dev_priv->next_prim = - dev_priv->last_prim = - dev_priv->current_prim = - dev_priv->prim_bufs[0]; - dev_priv->next_prim_age = 2; - dev_priv->last_prim_age = 1; - set_bit(MGA_BUF_IN_USE, &dev_priv->current_prim->buffer_status); - return 0; -} + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x12345678 ); -void mga_fire_primary(drm_device_t *dev, drm_mga_prim_buf_t *prim) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - int use_agp = PDEA_pagpxfer_enable; - unsigned long end; - int i; - int next_idx; - PRIMLOCALS; - - dev_priv->last_prim = prim; - - /* We never check for overflow, b/c there is always room */ - PRIMPTR(prim); - if(num_dwords <= 0) { - DRM_ERROR("num_dwords == 0 when dispatched\n"); - goto out_prim_wait; - } - PRIMOUTREG( MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_SOFTRAP, 0); - PRIMFINISH(prim); - - end = jiffies + (HZ*3); - if(sarea_priv->dirty & MGA_DMA_FLUSH) { - while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup (flush)\n"); - goto out_prim_wait; - } - - for (i = 0 ; i < 4096 ; i++) mga_delay(); - } - sarea_priv->dirty &= ~(MGA_DMA_FLUSH); - } else { - while((MGA_READ(MGAREG_STATUS) & 0x00020001) != 0x00020000) { - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup (wait)\n"); - goto out_prim_wait; - } - - for (i = 0 ; i < 4096 ; i++) mga_delay(); - } - } + ADVANCE_DMA(); - mga_flush_write_combine(); - atomic_inc(&dev_priv->pending_bufs); - MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL); - MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp); - prim->num_dwords = 0; - sarea_priv->last_enqueue = prim->prim_age; - - next_idx = prim->idx + 1; - if(next_idx >= MGA_NUM_PRIM_BUFS) - next_idx = 0; - - dev_priv->next_prim = dev_priv->prim_bufs[next_idx]; - return; - - out_prim_wait: - prim->num_dwords = 0; - prim->sec_used = 0; - clear_bit(MGA_BUF_IN_USE, &prim->buffer_status); - wake_up_interruptible(&dev_priv->wait_queue); - clear_bit(MGA_BUF_SWAP_PENDING, &prim->buffer_status); - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); -} + tail = primary->tail + dev_priv->primary->offset; -int mga_advance_primary(drm_device_t *dev) -{ - DECLARE_WAITQUEUE(entry, current); - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_prim_buf_t *prim_buffer; - drm_device_dma_t *dma = dev->dma; - int next_prim_idx; - int ret = 0; - - /* This needs to reset the primary buffer if available, - * we should collect stats on how many times it bites - * it's tail */ - - next_prim_idx = dev_priv->current_prim_idx + 1; - if(next_prim_idx >= MGA_NUM_PRIM_BUFS) - next_prim_idx = 0; - prim_buffer = dev_priv->prim_bufs[next_prim_idx]; - set_bit(MGA_IN_WAIT, &dev_priv->dispatch_status); - - /* In use is cleared in interrupt handler */ - - if(test_and_set_bit(MGA_BUF_IN_USE, &prim_buffer->buffer_status)) { - add_wait_queue(&dev_priv->wait_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - mga_dma_schedule(dev, 0); - if(!test_and_set_bit(MGA_BUF_IN_USE, - &prim_buffer->buffer_status)) - break; - atomic_inc(&dev->total_sleeps); - atomic_inc(&dma->total_missed_sched); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->wait_queue, &entry); - if(ret) return ret; - } - clear_bit(MGA_IN_WAIT, &dev_priv->dispatch_status); - - /* This primary buffer is now free to use */ - prim_buffer->current_dma_ptr = prim_buffer->head; - prim_buffer->num_dwords = 0; - prim_buffer->sec_used = 0; - prim_buffer->prim_age = dev_priv->next_prim_age++; - if(prim_buffer->prim_age == 0 || prim_buffer->prim_age == 0xffffffff) { - mga_flush_queue(dev); - mga_dma_quiescent(dev); - mga_reset_freelist(dev); - prim_buffer->prim_age = (dev_priv->next_prim_age += 2); + primary->tail = 0; + primary->last_flush = 0; + primary->last_wrap++; + + head = MGA_READ( MGA_PRIMADDRESS ); + + if ( head == dev_priv->primary->offset ) { + primary->space = primary->size; + } else { + primary->space = head - dev_priv->primary->offset; } - /* Reset all buffer status stuff */ - clear_bit(MGA_BUF_NEEDS_OVERFLOW, &prim_buffer->buffer_status); - clear_bit(MGA_BUF_FORCE_FIRE, &prim_buffer->buffer_status); - clear_bit(MGA_BUF_SWAP_PENDING, &prim_buffer->buffer_status); + DRM_DEBUG( " head = 0x%06lx\n", + head - dev_priv->primary->offset ); + DRM_DEBUG( " tail = 0x%06x\n", primary->tail ); + DRM_DEBUG( " wrap = %d\n", primary->last_wrap ); + DRM_DEBUG( " space = 0x%06x\n", primary->space ); + + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); - dev_priv->current_prim = prim_buffer; - dev_priv->current_prim_idx = next_prim_idx; - return 0; + DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } -/* More dynamic performance decisions */ -static inline int mga_decide_to_fire(drm_device_t *dev) +void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) { - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + u32 head = dev_priv->primary->offset; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); - if(test_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status)) { - return 1; - } + sarea_priv->last_wrap++; + DRM_DEBUG( " wrap = %d\n", sarea_priv->last_wrap ); - if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords) { - return 1; - } + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); - if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords) { - return 1; - } + DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); +} - if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS - 1) { - if(test_bit(MGA_BUF_SWAP_PENDING, - &dev_priv->next_prim->buffer_status)) { - return 1; - } - } - if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS / 2) { - if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 8) { - return 1; - } - } +/* ================================================================ + * Freelist management + */ - if(atomic_read(&dev_priv->pending_bufs) >= MGA_NUM_PRIM_BUFS / 2) { - if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 4) { - return 1; - } - } +#define MGA_BUFFER_USED ~0 +#define MGA_BUFFER_FREE 0 - return 0; +static void mga_freelist_print( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *entry; + + DRM_INFO( "\n" ); + DRM_INFO( "current dispatch: last=0x%x done=0x%x\n", + dev_priv->sarea_priv->last_dispatch, + (unsigned int)(MGA_READ( MGA_PRIMADDRESS ) - + dev_priv->primary->offset) ); + DRM_INFO( "current freelist:\n" ); + + for ( entry = dev_priv->head->next ; entry ; entry = entry->next ) { + DRM_INFO( " %p idx=%2d age=0x%x 0x%06lx\n", + entry, entry->buf->idx, entry->age.head, + entry->age.head - dev_priv->primary->offset ); + } + DRM_INFO( "\n" ); } -int mga_dma_schedule(drm_device_t *dev, int locked) +static int mga_freelist_init( drm_device_t *dev ) { - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - int retval = 0; - - if (!dev_priv) return -EBUSY; - - if (test_and_set_bit(0, &dev->dma_flag)) { - retval = -EBUSY; - goto sch_out_wakeup; - } + drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + drm_mga_freelist_t *entry; + int i; + DRM_DEBUG( "%s: count=%d\n", + __FUNCTION__, dma->buf_count ); - if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) || - test_bit(MGA_IN_WAIT, &dev_priv->dispatch_status) || - test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) { - locked = 1; - } + dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t), + DRM_MEM_DRIVER ); + if ( dev_priv->head == NULL ) + return -ENOMEM; - if (!locked && - !drm_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { - clear_bit(0, &dev->dma_flag); - retval = -EBUSY; - goto sch_out_wakeup; - } + memset( dev_priv->head, 0, sizeof(drm_mga_freelist_t) ); + SET_AGE( &dev_priv->head->age, MGA_BUFFER_USED, 0 ); - if(!test_and_set_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status)) { - /* Fire dma buffer */ - if(mga_decide_to_fire(dev)) { - clear_bit(MGA_BUF_FORCE_FIRE, - &dev_priv->next_prim->buffer_status); - if(dev_priv->current_prim == dev_priv->next_prim) { - /* Schedule overflow for a later time */ - set_bit(MGA_BUF_NEEDS_OVERFLOW, - &dev_priv->next_prim->buffer_status); - } - mga_fire_primary(dev, dev_priv->next_prim); - } else { - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - } - } + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; - if (!locked) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } + entry = DRM(alloc)( sizeof(drm_mga_freelist_t), + DRM_MEM_DRIVER ); + if ( entry == NULL ) + return -ENOMEM; - clear_bit(0, &dev->dma_flag); + memset( entry, 0, sizeof(drm_mga_freelist_t) ); -sch_out_wakeup: - if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && - atomic_read(&dev_priv->pending_bufs) == 0) { - /* Everything has been processed by the hardware */ - clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); - wake_up_interruptible(&dev_priv->flush_queue); - } + entry->next = dev_priv->head->next; + entry->prev = dev_priv->head; + SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); + entry->buf = buf; + + if ( dev_priv->head->next != NULL ) + dev_priv->head->next->prev = entry; + if ( entry->next == NULL ) + dev_priv->tail = entry; + + buf_priv->list_entry = entry; + buf_priv->discard = 0; + buf_priv->dispatched = 0; - if(test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) - && dev_priv->tail->age < dev_priv->last_prim_age) - wake_up_interruptible(&dev_priv->buf_queue); + dev_priv->head->next = entry; + } - return retval; + return 0; } -static void mga_dma_service(int irq, void *device, struct pt_regs *regs) +static void mga_freelist_cleanup( drm_device_t *dev ) { - drm_device_t *dev = (drm_device_t *)device; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_prim_buf_t *last_prim_buffer; - - atomic_inc(&dev->total_irq); - if((MGA_READ(MGAREG_STATUS) & 0x00000001) != 0x00000001) return; - MGA_WRITE(MGAREG_ICLEAR, 0x00000001); - last_prim_buffer = dev_priv->last_prim; - last_prim_buffer->num_dwords = 0; - last_prim_buffer->sec_used = 0; - dev_priv->sarea_priv->last_dispatch = - dev_priv->last_prim_age = last_prim_buffer->prim_age; - clear_bit(MGA_BUF_IN_USE, &last_prim_buffer->buffer_status); - clear_bit(MGA_BUF_SWAP_PENDING, &last_prim_buffer->buffer_status); - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - atomic_dec(&dev_priv->pending_bufs); - queue_task(&dev->tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); - wake_up_interruptible(&dev_priv->wait_queue); + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *entry; + drm_mga_freelist_t *next; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + entry = dev_priv->head; + while ( entry ) { + next = entry->next; + DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); + entry = next; + } + + dev_priv->head = dev_priv->tail = NULL; } -static void mga_dma_task_queue(void *device) +static void mga_freelist_reset( drm_device_t *dev ) { - mga_dma_schedule((drm_device_t *)device, 0); + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + int i; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + SET_AGE( &buf_priv->list_entry->age, + MGA_BUFFER_FREE, 0 ); + } } -int mga_dma_cleanup(drm_device_t *dev) +static drm_buf_t *mga_freelist_get( drm_device_t *dev ) { - if(dev->dev_private) { - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *next; + drm_mga_freelist_t *prev; + drm_mga_freelist_t *tail = dev_priv->tail; + u32 head, wrap; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); - if (dev->irq) mga_flush_queue(dev); - mga_dma_quiescent(dev); + head = MGA_READ( MGA_PRIMADDRESS ); + wrap = dev_priv->sarea_priv->last_wrap; - if(dev_priv->ioremap) { - int temp = (dev_priv->warp_ucode_size + - dev_priv->primary_size + - PAGE_SIZE - 1) / PAGE_SIZE * PAGE_SIZE; + DRM_DEBUG( " tail=0x%06lx %d\n", + tail->age.head ? + tail->age.head - dev_priv->primary->offset : 0, + tail->age.wrap ); + DRM_DEBUG( " head=0x%06lx %d\n", + head - dev_priv->primary->offset, wrap ); - drm_ioremapfree((void *) dev_priv->ioremap, temp); - } - if(dev_priv->status_page != NULL) { - iounmap(dev_priv->status_page); - } - if(dev_priv->real_status_page != 0UL) { - mga_free_page(dev, dev_priv->real_status_page); - } - if(dev_priv->prim_bufs != NULL) { - int i; - for(i = 0; i < MGA_NUM_PRIM_BUFS; i++) { - if(dev_priv->prim_bufs[i] != NULL) { - drm_free(dev_priv->prim_bufs[i], - sizeof(drm_mga_prim_buf_t), - DRM_MEM_DRIVER); - } - } - drm_free(dev_priv->prim_bufs, sizeof(void *) * - (MGA_NUM_PRIM_BUFS + 1), - DRM_MEM_DRIVER); - } - if(dev_priv->head != NULL) { - mga_freelist_cleanup(dev); - } + if ( TEST_AGE( &tail->age, head, wrap ) ) { + prev = dev_priv->tail->prev; + next = dev_priv->tail; + prev->next = NULL; + next->prev = next->next = NULL; + dev_priv->tail = prev; + SET_AGE( &next->age, MGA_BUFFER_USED, 0 ); + return next->buf; + } + DRM_DEBUG( "returning NULL!\n" ); + return NULL; +} - drm_free(dev->dev_private, sizeof(drm_mga_private_t), - DRM_MEM_DRIVER); - dev->dev_private = NULL; +int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_freelist_t *head, *entry, *prev; + + DRM_DEBUG( "%s: age=0x%06lx wrap=%d\n", + __FUNCTION__, + buf_priv->list_entry->age.head - + dev_priv->primary->offset, + buf_priv->list_entry->age.wrap ); + + entry = buf_priv->list_entry; + head = dev_priv->head; + + if ( buf_priv->list_entry->age.head == MGA_BUFFER_USED ) { + SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); + prev = dev_priv->tail; + prev->next = entry; + entry->prev = prev; + entry->next = NULL; + } else { + prev = head->next; + head->next = entry; + prev->prev = entry; + entry->prev = head; + entry->next = prev; } return 0; } -static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) { - drm_mga_private_t *dev_priv; - drm_map_t *sarea_map = NULL; - dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); - if(dev_priv == NULL) return -ENOMEM; - dev->dev_private = (void *) dev_priv; +/* ================================================================ + * DMA initialization, cleanup + */ - memset(dev_priv, 0, sizeof(drm_mga_private_t)); +static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) +{ + drm_mga_private_t *dev_priv; + struct list_head *list; + int ret; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - if((init->reserved_map_idx >= dev->map_count) || - (init->buffer_map_idx >= dev->map_count)) { - mga_dma_cleanup(dev); - return -EINVAL; - } + dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); + if ( !dev_priv ) + return -ENOMEM; + dev->dev_private = (void *)dev_priv; - dev_priv->reserved_map_idx = init->reserved_map_idx; - dev_priv->buffer_map_idx = init->buffer_map_idx; - sarea_map = dev->maplist[0]; - dev_priv->sarea_priv = (drm_mga_sarea_t *) - ((u8 *)sarea_map->handle + - init->sarea_priv_offset); + memset( dev_priv, 0, sizeof(drm_mga_private_t) ); - /* Scale primary size to the next page */ dev_priv->chipset = init->chipset; - dev_priv->frontOffset = init->frontOffset; - dev_priv->backOffset = init->backOffset; - dev_priv->depthOffset = init->depthOffset; - dev_priv->textureOffset = init->textureOffset; - dev_priv->textureSize = init->textureSize; - dev_priv->cpp = init->cpp; - dev_priv->sgram = init->sgram; - dev_priv->stride = init->stride; - - dev_priv->mAccess = init->mAccess; - init_waitqueue_head(&dev_priv->flush_queue); - init_waitqueue_head(&dev_priv->buf_queue); - dev_priv->WarpPipe = 0xff000000; - dev_priv->vertexsize = 0; - - DRM_DEBUG("chipset=%d ucode_size=%d backOffset=%x depthOffset=%x\n", - dev_priv->chipset, dev_priv->warp_ucode_size, - dev_priv->backOffset, dev_priv->depthOffset); - DRM_DEBUG("cpp: %d sgram: %d stride: %d maccess: %x\n", - dev_priv->cpp, dev_priv->sgram, dev_priv->stride, - dev_priv->mAccess); - - memcpy(&dev_priv->WarpIndex, &init->WarpIndex, - sizeof(drm_mga_warp_index_t) * MGA_MAX_WARP_PIPES); - - if(mga_init_primary_bufs(dev, init) != 0) { - DRM_ERROR("Can not initialize primary buffers\n"); - mga_dma_cleanup(dev); - return -ENOMEM; + + dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; + + if ( init->sgram ) { + dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_BLK; + } else { + dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_RSTR; + } + dev_priv->maccess = init->maccess; + + dev_priv->fb_cpp = init->fb_cpp; + dev_priv->front_offset = init->front_offset; + dev_priv->front_pitch = init->front_pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->back_pitch = init->back_pitch; + + dev_priv->depth_cpp = init->depth_cpp; + dev_priv->depth_offset = init->depth_offset; + dev_priv->depth_pitch = init->depth_pitch; + + list_for_each( list, &dev->maplist->head ) { + drm_map_list_t *entry = (drm_map_list_t *)list; + if ( entry->map && + entry->map->type == _DRM_SHM && + (entry->map->flags & _DRM_CONTAINS_LOCK) ) { + dev_priv->sarea = entry->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + DRM_FIND_MAP( dev_priv->status, init->status_offset ); + + DRM_FIND_MAP( dev_priv->warp, init->warp_offset ); + DRM_FIND_MAP( dev_priv->primary, init->primary_offset ); + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + + dev_priv->sarea_priv = + (drm_mga_sarea_t *)((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + DRM_IOREMAP( dev_priv->warp ); + DRM_IOREMAP( dev_priv->primary ); + DRM_IOREMAP( dev_priv->buffers ); + + ret = mga_warp_install_microcode( dev ); + if ( ret < 0 ) { + DRM_ERROR( "failed to install WARP ucode!\n" ); + mga_do_cleanup_dma( dev ); + return ret; } - dev_priv->real_status_page = mga_alloc_page(dev); - if(dev_priv->real_status_page == 0UL) { - mga_dma_cleanup(dev); - DRM_ERROR("Can not allocate status page\n"); - return -ENOMEM; + + ret = mga_warp_init( dev ); + if ( ret < 0 ) { + DRM_ERROR( "failed to init WARP engine!\n" ); + mga_do_cleanup_dma( dev ); + return ret; } - dev_priv->status_page = - ioremap_nocache(virt_to_bus((void *)dev_priv->real_status_page), - PAGE_SIZE); + dev_priv->prim.status = (u32 *)dev_priv->status->handle; - if(dev_priv->status_page == NULL) { - mga_dma_cleanup(dev); - DRM_ERROR("Can not remap status page\n"); - return -ENOMEM; - } + mga_do_wait_for_idle( dev_priv ); + + /* Init the primary DMA registers. + */ + MGA_WRITE( MGA_PRIMADDRESS, + dev_priv->primary->offset | MGA_DMA_GENERAL ); +#if 0 + MGA_WRITE( MGA_PRIMPTR, + virt_to_bus((void *)dev_priv->prim.status) | + MGA_PRIMPTREN0 | /* Soft trap, SECEND, SETUPEND */ + MGA_PRIMPTREN1 ); /* DWGSYNC */ +#endif + + dev_priv->prim.start = (u8 *)dev_priv->primary->handle; + dev_priv->prim.end = ((u8 *)dev_priv->primary->handle + + dev_priv->primary->size); + dev_priv->prim.size = dev_priv->primary->size; - /* Write status page when secend or softrap occurs */ - MGA_WRITE(MGAREG_PRIMPTR, - virt_to_bus((void *)dev_priv->real_status_page) | 0x00000003); + dev_priv->prim.tail = 0; + dev_priv->prim.space = dev_priv->prim.size; + dev_priv->prim.last_flush = 0; + dev_priv->prim.last_wrap = 0; - /* Private is now filled in, initialize the hardware */ - { - PRIMLOCALS; - PRIMGETPTR( dev_priv ); + dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE; - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0x0100); - PRIMOUTREG(MGAREG_SOFTRAP, 0); - /* Poll for the first buffer to insure that - * the status register will be correct - */ + spin_lock_init( &dev_priv->prim.list_lock ); - mga_flush_write_combine(); - MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL); + dev_priv->prim.status[0] = dev_priv->primary->offset; + dev_priv->prim.status[1] = 0; - MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) | - PDEA_pagpxfer_enable)); + dev_priv->sarea_priv->last_wrap = 0; + dev_priv->sarea_priv->last_frame.head = 0; + dev_priv->sarea_priv->last_frame.wrap = 0; - while(MGA_READ(MGAREG_DWGSYNC) != 0x0100) ; + if ( mga_freelist_init( dev ) < 0 ) { + DRM_ERROR( "could not initialize freelist\n" ); + mga_do_cleanup_dma( dev ); + return -ENOMEM; } - if(mga_freelist_init(dev) != 0) { - DRM_ERROR("Could not initialize freelist\n"); - mga_dma_cleanup(dev); - return -ENOMEM; + return 0; +} + +int mga_do_cleanup_dma( drm_device_t *dev ) +{ + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( dev->dev_private ) { + drm_mga_private_t *dev_priv = dev->dev_private; + + DRM_IOREMAPFREE( dev_priv->warp ); + DRM_IOREMAPFREE( dev_priv->primary ); + DRM_IOREMAPFREE( dev_priv->buffers ); + + if ( dev_priv->head != NULL ) { + mga_freelist_cleanup( dev ); + } + + DRM(free)( dev->dev_private, sizeof(drm_mga_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; } + return 0; } -int mga_dma_init(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_init( 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_mga_init_t init; - if (copy_from_user(&init, (drm_mga_init_t *)arg, sizeof(init))) + if ( copy_from_user( &init, (drm_mga_init_t *)arg, sizeof(init) ) ) return -EFAULT; - switch(init.func) { + switch ( init.func ) { case MGA_INIT_DMA: - return mga_dma_initialize(dev, &init); + return mga_do_init_dma( dev, &init ); case MGA_CLEANUP_DMA: - return mga_dma_cleanup(dev); + return mga_do_cleanup_dma( dev ); } return -EINVAL; } -int mga_irq_install(drm_device_t *dev, int irq) -{ - int retcode; - - if (!irq) return -EINVAL; - down(&dev->struct_sem); - if (dev->irq) { - up(&dev->struct_sem); - return -EBUSY; - } - dev->irq = irq; - up(&dev->struct_sem); - - DRM_DEBUG("install irq handler %d\n", irq); - - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - dev->dma->next_buffer = NULL; - dev->dma->next_queue = NULL; - dev->dma->this_buffer = NULL; - INIT_LIST_HEAD(&dev->tq.list); - dev->tq.sync = 0; - dev->tq.routine = mga_dma_task_queue; - dev->tq.data = dev; - - /* Before installing handler */ - MGA_WRITE(MGAREG_IEN, 0); - /* Install handler */ - if ((retcode = request_irq(dev->irq, - mga_dma_service, - SA_SHIRQ, - dev->devname, - dev))) { - down(&dev->struct_sem); - dev->irq = 0; - up(&dev->struct_sem); - return retcode; - } - /* After installing handler */ - MGA_WRITE(MGAREG_ICLEAR, 0x00000001); - MGA_WRITE(MGAREG_IEN, 0x00000001); - return 0; -} +/* ================================================================ + * Primary DMA stream management + */ -int mga_irq_uninstall(drm_device_t *dev) +int mga_dma_flush( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { - int irq; - - down(&dev->struct_sem); - irq = dev->irq; - dev->irq = 0; - up(&dev->struct_sem); - - if (!irq) return -EINVAL; - DRM_DEBUG("remove irq handler %d\n", irq); - MGA_WRITE(MGAREG_ICLEAR, 0x00000001); - MGA_WRITE(MGAREG_IEN, 0); - free_irq(irq, dev); - return 0; -} + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_lock_t lock; -int mga_control(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_control_t ctl; + LOCK_TEST_WITH_RETURN( dev ); - if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl))) + if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) ) return -EFAULT; - switch (ctl.func) { - case DRM_INST_HANDLER: - return mga_irq_install(dev, ctl.irq); - case DRM_UNINST_HANDLER: - return mga_irq_uninstall(dev); - default: - return -EINVAL; - } -} + DRM_DEBUG( "%s: %s%s%s\n", + __FUNCTION__, + (lock.flags & _DRM_LOCK_FLUSH) ? "flush, " : "", + (lock.flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "", + (lock.flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "" ); -static int mga_flush_queue(drm_device_t *dev) -{ - DECLARE_WAITQUEUE(entry, current); - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - int ret = 0; - - if(!dev_priv) return 0; - - if(dev_priv->next_prim->num_dwords != 0) { - add_wait_queue(&dev_priv->flush_queue, &entry); - if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status)) - DRM_ERROR("Incorrect mga_flush_queue logic\n"); - set_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); - mga_dma_schedule(dev, 0); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!test_bit(MGA_IN_FLUSH, - &dev_priv->dispatch_status)) - break; - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - ret = -EINTR; /* Can't restart */ - clear_bit(MGA_IN_FLUSH, - &dev_priv->dispatch_status); - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); + WRAP_TEST_WITH_RETURN( dev_priv ); + +#if 0 + if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { + mga_do_dma_flush( dev_priv ); + } +#endif + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { + return mga_do_wait_for_idle( dev_priv ); + } else { + return 0; } - return ret; } -/* Must be called with the lock held */ -void mga_reclaim_buffers(drm_device_t *dev, pid_t pid) +int mga_dma_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { - drm_device_dma_t *dma = dev->dma; - int i; - - if (!dma) return; - if(dev->dev_private == NULL) return; - if(dma->buflist == NULL) return; - - DRM_DEBUG("buf_count=%d\n", dma->buf_count); - - mga_flush_queue(dev); - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - - /* Only buffers that need to get reclaimed ever - * get set to free - */ - if (buf->pid == pid && buf_priv) { - if(buf_priv->my_freelist->age == MGA_BUF_USED) - buf_priv->my_freelist->age = MGA_BUF_FREE; - } - } + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + + LOCK_TEST_WITH_RETURN( dev ); + + return mga_do_dma_reset( dev_priv ); } -int mga_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 (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; +/* ================================================================ + * DMA buffer management + */ - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } +static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d ) +{ + drm_buf_t *buf; + int i; - if (lock.context < 0) return -EINVAL; + for ( i = d->granted_count ; i < d->request_count ; i++ ) { + buf = mga_freelist_get( dev ); + if ( !buf ) return -EAGAIN; - /* Only one queue: - */ + buf->pid = current->pid; - if (!ret) { - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - 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); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } + if ( copy_to_user( &d->request_indices[i], + &buf->idx, sizeof(buf->idx) ) ) + return -EFAULT; + if ( copy_to_user( &d->request_sizes[i], + &buf->total, sizeof(buf->total) ) ) + return -EFAULT; - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_QUIESCENT) { - DRM_DEBUG("_DRM_LOCK_QUIESCENT\n"); - mga_flush_queue(dev); - mga_dma_quiescent(dev); - } + d->granted_count++; } - - if (ret) DRM_DEBUG("%d %s\n", lock.context, - ret ? "interrupted" : "has lock"); - return ret; + return 0; } -int mga_flush_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_buffers( 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; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_dma_t d; + int ret = 0; - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) ) return -EFAULT; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("lock not held\n"); + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + current->pid, d.send_count ); return -EINVAL; } - if(lock.flags & _DRM_LOCK_FLUSH || lock.flags & _DRM_LOCK_FLUSH_ALL) { - drm_mga_prim_buf_t *temp_buf; + /* We'll send you buffers. + */ + if ( d.request_count < 0 || d.request_count > dma->buf_count ) { + DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", + current->pid, d.request_count, dma->buf_count ); + return -EINVAL; + } - temp_buf = dev_priv->current_prim; + d.granted_count = 0; - if(temp_buf && temp_buf->num_dwords) { - set_bit(MGA_BUF_FORCE_FIRE, &temp_buf->buffer_status); - mga_advance_primary(dev); - } - mga_dma_schedule(dev, 1); - } - if(lock.flags & _DRM_LOCK_QUIESCENT) { - mga_flush_queue(dev); - mga_dma_quiescent(dev); + if ( d.request_count ) { + ret = mga_dma_get_buffers( dev, &d ); } - return 0; + if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) ) + return -EFAULT; + + return ret; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h index 538133937..066b4e480 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h @@ -11,197 +11,178 @@ * 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 + * VA LINUX SYSTEMS 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. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * Authors: Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Authors: + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> */ -#ifndef _MGA_DRM_H_ -#define _MGA_DRM_H_ +#ifndef __MGA_DRM_H__ +#define __MGA_DRM_H__ /* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmMga.h) - */ -#ifndef _MGA_DEFINES_ -#define _MGA_DEFINES_ - -#define MGA_F 0x1 /* fog */ -#define MGA_A 0x2 /* alpha */ -#define MGA_S 0x4 /* specular */ -#define MGA_T2 0x8 /* multitexture */ - -#define MGA_WARP_TGZ 0 -#define MGA_WARP_TGZF (MGA_F) -#define MGA_WARP_TGZA (MGA_A) -#define MGA_WARP_TGZAF (MGA_F|MGA_A) -#define MGA_WARP_TGZS (MGA_S) -#define MGA_WARP_TGZSF (MGA_S|MGA_F) -#define MGA_WARP_TGZSA (MGA_S|MGA_A) -#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) -#define MGA_WARP_T2GZ (MGA_T2) -#define MGA_WARP_T2GZF (MGA_T2|MGA_F) -#define MGA_WARP_T2GZA (MGA_T2|MGA_A) -#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) -#define MGA_WARP_T2GZS (MGA_T2|MGA_S) -#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) -#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) -#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) - -#define MGA_MAX_G400_PIPES 16 -#define MGA_MAX_G200_PIPES 8 /* no multitex */ -#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES - -#define MGA_CARD_TYPE_G200 1 -#define MGA_CARD_TYPE_G400 2 - -#define MGA_FRONT 0x1 -#define MGA_BACK 0x2 -#define MGA_DEPTH 0x4 - -/* 3d state excluding texture units: - */ -#define MGA_CTXREG_DSTORG 0 /* validated */ -#define MGA_CTXREG_MACCESS 1 -#define MGA_CTXREG_PLNWT 2 -#define MGA_CTXREG_DWGCTL 3 -#define MGA_CTXREG_ALPHACTRL 4 -#define MGA_CTXREG_FOGCOLOR 5 -#define MGA_CTXREG_WFLAG 6 -#define MGA_CTXREG_TDUAL0 7 -#define MGA_CTXREG_TDUAL1 8 -#define MGA_CTXREG_FCOL 9 -#define MGA_CTXREG_STENCIL 10 -#define MGA_CTXREG_STENCILCTL 11 -#define MGA_CTX_SETUP_SIZE 12 - -/* 2d state + * defines in the Xserver file (mga_sarea.h) */ -#define MGA_2DREG_PITCH 0 -#define MGA_2D_SETUP_SIZE 1 +#ifndef __MGA_SAREA_DEFINES__ +#define __MGA_SAREA_DEFINES__ -/* Each texture unit has a state: +/* WARP pipe flags */ -#define MGA_TEXREG_CTL 0 -#define MGA_TEXREG_CTL2 1 -#define MGA_TEXREG_FILTER 2 -#define MGA_TEXREG_BORDERCOL 3 -#define MGA_TEXREG_ORG 4 /* validated */ -#define MGA_TEXREG_ORG1 5 -#define MGA_TEXREG_ORG2 6 -#define MGA_TEXREG_ORG3 7 -#define MGA_TEXREG_ORG4 8 -#define MGA_TEXREG_WIDTH 9 -#define MGA_TEXREG_HEIGHT 10 -#define MGA_TEX_SETUP_SIZE 11 +#define MGA_F 0x1 /* fog */ +#define MGA_A 0x2 /* alpha */ +#define MGA_S 0x4 /* specular */ +#define MGA_T2 0x8 /* multitexture */ + +#define MGA_WARP_TGZ 0 +#define MGA_WARP_TGZF (MGA_F) +#define MGA_WARP_TGZA (MGA_A) +#define MGA_WARP_TGZAF (MGA_F|MGA_A) +#define MGA_WARP_TGZS (MGA_S) +#define MGA_WARP_TGZSF (MGA_S|MGA_F) +#define MGA_WARP_TGZSA (MGA_S|MGA_A) +#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) +#define MGA_WARP_T2GZ (MGA_T2) +#define MGA_WARP_T2GZF (MGA_T2|MGA_F) +#define MGA_WARP_T2GZA (MGA_T2|MGA_A) +#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) +#define MGA_WARP_T2GZS (MGA_T2|MGA_S) +#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) +#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) +#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) + +#define MGA_MAX_G200_PIPES 8 /* no multitex */ +#define MGA_MAX_G400_PIPES 16 +#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES +#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ + +#define MGA_CARD_TYPE_G200 1 +#define MGA_CARD_TYPE_G400 2 + + +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 /* What needs to be changed for the current vertex dma buffer? */ -#define MGA_UPLOAD_CTX 0x1 -#define MGA_UPLOAD_TEX0 0x2 -#define MGA_UPLOAD_TEX1 0x4 -#define MGA_UPLOAD_PIPE 0x8 -#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ -#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ -#define MGA_UPLOAD_2D 0x40 -#define MGA_WAIT_AGE 0x80 /* handled client-side */ -#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ -#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock - quiescent */ +#define MGA_UPLOAD_CONTEXT 0x1 +#define MGA_UPLOAD_TEX0 0x2 +#define MGA_UPLOAD_TEX1 0x4 +#define MGA_UPLOAD_PIPE 0x8 +#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ +#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ +#define MGA_UPLOAD_2D 0x40 +#define MGA_WAIT_AGE 0x80 /* handled client-side */ +#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ +#if 0 +#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock + quiescent */ +#endif /* 32 buffers of 64k each, total 2 meg. */ -#define MGA_DMA_BUF_ORDER 16 -#define MGA_DMA_BUF_SZ (1<<MGA_DMA_BUF_ORDER) -#define MGA_DMA_BUF_NR 31 +#define MGA_BUFFER_SIZE (1 << 16) +#define MGA_NUM_BUFFERS 128 /* Keep these small for testing. */ -#define MGA_NR_SAREA_CLIPRECTS 8 +#define MGA_NR_SAREA_CLIPRECTS 8 /* 2 heaps (1 for card, 1 for agp), each divided into upto 128 - * regions, subject to a minimum region size of (1<<16) == 64k. + * regions, subject to a minimum region size of (1<<16) == 64k. * * Clients may subdivide regions internally, but when sharing between - * clients, the region size is the minimum granularity. + * clients, the region size is the minimum granularity. */ -#define MGA_CARD_HEAP 0 -#define MGA_AGP_HEAP 1 -#define MGA_NR_TEX_HEAPS 2 -#define MGA_NR_TEX_REGIONS 16 -#define MGA_LOG_MIN_TEX_REGION_SIZE 16 -#endif +#define MGA_CARD_HEAP 0 +#define MGA_AGP_HEAP 1 +#define MGA_NR_TEX_HEAPS 2 +#define MGA_NR_TEX_REGIONS 16 +#define MGA_LOG_MIN_TEX_REGION_SIZE 16 -typedef struct _drm_mga_warp_index { - int installed; - unsigned long phys_addr; - int size; -} drm_mga_warp_index_t; +#endif /* __MGA_SAREA_DEFINES__ */ -typedef struct drm_mga_init { - enum { - MGA_INIT_DMA = 0x01, - MGA_CLEANUP_DMA = 0x02 - } func; - int reserved_map_agpstart; - int reserved_map_idx; - int buffer_map_idx; - int sarea_priv_offset; - int primary_size; - int warp_ucode_size; - unsigned int frontOffset; - unsigned int backOffset; - unsigned int depthOffset; - unsigned int textureOffset; - unsigned int textureSize; - unsigned int agpTextureOffset; - unsigned int agpTextureSize; - unsigned int cpp; - unsigned int stride; - int sgram; - int chipset; - drm_mga_warp_index_t WarpIndex[MGA_MAX_WARP_PIPES]; - unsigned int mAccess; -} drm_mga_init_t; -/* Warning: if you change the sarea structure, you must change the Xserver - * structures as well */ +/* Setup registers for 3D context + */ +typedef struct { + unsigned int dstorg; + unsigned int maccess; + unsigned int plnwt; + unsigned int dwgctl; + unsigned int alphactrl; + unsigned int fogcolor; + unsigned int wflag; + unsigned int tdualstage0; + unsigned int tdualstage1; + unsigned int fcol; + unsigned int stencil; + unsigned int stencilctl; +} drm_mga_context_regs_t; + +/* Setup registers for 2D, X server + */ +typedef struct { + unsigned int pitch; +} drm_mga_server_regs_t; -typedef struct _drm_mga_tex_region { - unsigned char next, prev; - unsigned char in_use; - unsigned int age; -} drm_mga_tex_region_t; +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int texctl; + unsigned int texctl2; + unsigned int texfilter; + unsigned int texbordercol; + unsigned int texorg; + unsigned int texwidth; + unsigned int texheight; + unsigned int texorg1; + unsigned int texorg2; + unsigned int texorg3; + unsigned int texorg4; +} drm_mga_texture_regs_t; + +/* General aging mechanism + */ +typedef struct { + unsigned int head; /* Position of head pointer */ + unsigned int wrap; /* Primary DMA wrap count */ +} drm_mga_age_t; typedef struct _drm_mga_sarea { /* The channel for communication of state information to the kernel * on firing a vertex dma buffer. */ - unsigned int ContextState[MGA_CTX_SETUP_SIZE]; - unsigned int ServerState[MGA_2D_SETUP_SIZE]; - unsigned int TexState[2][MGA_TEX_SETUP_SIZE]; - unsigned int WarpPipe; + drm_mga_context_regs_t context_state; + drm_mga_server_regs_t server_state; + drm_mga_texture_regs_t tex_state[2]; + unsigned int warp_pipe; unsigned int dirty; + unsigned int vertsize; - unsigned int nbox; + /* The current cliprects, or a subset thereof. + */ drm_clip_rect_t boxes[MGA_NR_SAREA_CLIPRECTS]; - + unsigned int nbox; /* Information about the most recently used 3d drawable. The - * client fills in the req_* fields, the server fills in the + * client fills in the req_* fields, the server fills in the * exported_ fields and puts the cliprects into boxes, above. * * The client clears the exported_drawable field before @@ -210,71 +191,116 @@ typedef struct _drm_mga_sarea { unsigned int req_drawable; /* the X drawable id */ unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ - unsigned int exported_drawable; - unsigned int exported_index; - unsigned int exported_stamp; - unsigned int exported_buffers; + unsigned int exported_drawable; + unsigned int exported_index; + unsigned int exported_stamp; + unsigned int exported_buffers; unsigned int exported_nfront; unsigned int exported_nback; - int exported_back_x, exported_front_x, exported_w; + int exported_back_x, exported_front_x, exported_w; int exported_back_y, exported_front_y, exported_h; drm_clip_rect_t exported_boxes[MGA_NR_SAREA_CLIPRECTS]; - + /* Counters for aging textures and for client-side throttling. */ + unsigned int status[4]; + unsigned int last_wrap; + + drm_mga_age_t last_frame; unsigned int last_enqueue; /* last time a buffer was enqueued */ unsigned int last_dispatch; /* age of the most recently dispatched buffer */ unsigned int last_quiescent; /* */ - - /* LRU lists for texture memory in agp space and on the card + /* LRU lists for texture memory in agp space and on the card. */ - drm_mga_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; + drm_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; unsigned int texAge[MGA_NR_TEX_HEAPS]; - + /* Mechanism to validate card state. */ int ctxOwner; - int vertexsize; -} drm_mga_sarea_t; +} drm_mga_sarea_t; -/* Device specific ioctls: + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmMga.h) */ -typedef struct _drm_mga_clear { +typedef struct _drm_mga_warp_index { + int installed; + unsigned long phys_addr; + int size; +} drm_mga_warp_index_t; + +typedef struct drm_mga_init { + enum { + MGA_INIT_DMA = 0x01, + MGA_CLEANUP_DMA = 0x02 + } func; + + int sarea_priv_offset; + + int chipset; + int sgram; + + unsigned int maccess; + + unsigned int fb_cpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset, depth_pitch; + + unsigned int texture_offset[MGA_NR_TEX_HEAPS]; + unsigned int texture_size[MGA_NR_TEX_HEAPS]; + + unsigned int fb_offset; + unsigned int mmio_offset; + unsigned int status_offset; + unsigned int warp_offset; + unsigned int primary_offset; + unsigned int buffers_offset; +} drm_mga_init_t; + +typedef struct drm_mga_fullscreen { + enum { + MGA_INIT_FULLSCREEN = 0x01, + MGA_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_mga_fullscreen_t; + +typedef struct drm_mga_clear { + unsigned int flags; unsigned int clear_color; unsigned int clear_depth; - unsigned int flags; - unsigned int clear_depth_mask; - unsigned int clear_color_mask; + unsigned int color_mask; + unsigned int depth_mask; } drm_mga_clear_t; -typedef struct _drm_mga_swap { - int dummy; -} drm_mga_swap_t; - -typedef struct _drm_mga_iload { - int idx; - int length; - unsigned int destOrg; -} drm_mga_iload_t; - -typedef struct _drm_mga_vertex { - int idx; /* buffer to queue */ - int used; /* bytes in use */ - int discard; /* client finished with buffer? */ +typedef struct drm_mga_vertex { + int idx; /* buffer to queue */ + int used; /* bytes in use */ + int discard; /* client finished with buffer? */ } drm_mga_vertex_t; -typedef struct _drm_mga_indices { - int idx; /* buffer to queue */ - unsigned int start; - unsigned int end; - int discard; /* client finished with buffer? */ +typedef struct drm_mga_indices { + int idx; /* buffer to queue */ + unsigned int start; + unsigned int end; + int discard; /* client finished with buffer? */ } drm_mga_indices_t; +typedef struct drm_mga_iload { + int idx; + unsigned int dstorg; + unsigned int length; +} drm_mga_iload_t; + typedef struct _drm_mga_blit { unsigned int planemask; - unsigned int source; - unsigned int dest; + unsigned int srcorg; + unsigned int dstorg; + int src_pitch, dst_pitch; int delta_sx, delta_sy; int delta_dx, delta_dy; int height, ydir; /* flip image vertically */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c index d1c39e999..42794e829 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c @@ -1,4 +1,4 @@ -/* mga_drv.c -- Matrox g200/g400 driver -*- linux-c -*- +/* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -19,648 +19,62 @@ * 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 + * VA LINUX SYSTEMS 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@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * + * 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@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "mga.h" #include "drmP.h" #include "mga_drv.h" -#define MGA_NAME "mga" -#define MGA_DESC "Matrox G200/G400" -#define MGA_DATE "20000928" -#define MGA_MAJOR 2 -#define MGA_MINOR 1 -#define MGA_PATCHLEVEL 1 - -static drm_device_t mga_device; -drm_ctx_t mga_res_ctx; - -static struct file_operations mga_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: mga_open, - flush: drm_flush, - release: mga_release, - ioctl: mga_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice mga_misc = { - minor: MISC_DYNAMIC_MINOR, - name: MGA_NAME, - fops: &mga_fops, -}; - -static drm_ioctl_desc_t mga_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { mga_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_CONTROL)] = { mga_control, 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_BUFS)] = { mga_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { mga_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { mga_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { mga_mapbufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { mga_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { mga_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { mga_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { mga_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { mga_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { mga_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { mga_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { mga_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_DMA)] = { mga_dma, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { mga_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { mga_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, - - [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 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_swap_bufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_clear_bufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_iload, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_vertex, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_flush_ioctl, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_indices, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_blit, 1, 0 }, -}; - -#define MGA_IOCTL_COUNT DRM_ARRAY_SIZE(mga_ioctls) - -#ifdef MODULE -static char *mga = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("Matrox G200/G400"); -MODULE_PARM(mga, "s"); - -#ifndef MODULE -/* mga_options 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_drm. - */ - -static int __init mga_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("mga=", mga_options); -#endif - -static int mga_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); - - drm_dma_setup(dev); - - 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_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); - - 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 mga_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 (dev->dev_private) mga_dma_cleanup(dev); - if (dev->irq) mga_irq_uninstall(dev); - - 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; - } - /* 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(); - - dev->agp->acquired = 0; - dev->agp->enabled = 0; - } - /* 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: - 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->queuelist) { - for (i = 0; i < dev->queue_count; i++) { - drm_waitlist_destroy(&dev->queuelist[i]->waitlist); - if (dev->queuelist[i]) { - drm_free(dev->queuelist[i], - sizeof(*dev->queuelist[0]), - DRM_MEM_QUEUES); - dev->queuelist[i] = NULL; - } - } - drm_free(dev->queuelist, - dev->queue_slots * sizeof(*dev->queuelist), - DRM_MEM_QUEUES); - dev->queuelist = NULL; - } - - drm_dma_takedown(dev); - - dev->queue_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; -} - -/* mga_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init mga_init(void) -{ - int retcode; - drm_device_t *dev = &mga_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(mga); -#endif - if ((retcode = misc_register(&mga_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", MGA_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, mga_misc.minor); - dev->name = MGA_NAME; - - drm_mem_init(); - drm_proc_init(dev); - dev->agp = drm_agp_init(); - if(dev->agp == NULL) { - DRM_INFO("The mga 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(&mga_misc); - mga_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 - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&mga_misc); - mga_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - MGA_NAME, - MGA_MAJOR, - MGA_MINOR, - MGA_PATCHLEVEL, - MGA_DATE, - mga_misc.minor); - - return 0; -} - -/* mga_cleanup is called via cleanup_module at module unload time. */ - -static void __exit mga_cleanup(void) -{ - drm_device_t *dev = &mga_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&mga_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); -#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 - - mga_takedown(dev); - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -} - -module_init(mga_init); -module_exit(mga_cleanup); - - -int mga_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = MGA_MAJOR; - version.version_minor = MGA_MINOR; - version.version_patchlevel = MGA_PATCHLEVEL; - - DRM_COPY(version.name, MGA_NAME); - DRM_COPY(version.date, MGA_DATE); - DRM_COPY(version.desc, MGA_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int mga_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &mga_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return mga_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int mga_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", - current->pid, dev->device, dev->open_count); - - if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) - && dev->lock.pid == current->pid) { - mga_reclaim_buffers(dev, priv->pid); - DRM_INFO("Process %d dead (ctx %d, d_s = 0x%02lx)\n", - current->pid, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock), - dev->dev_private ? - ((drm_mga_private_t *)dev->dev_private) - ->dispatch_status - : 0); - - if (dev->dev_private) - ((drm_mga_private_t *)dev->dev_private) - ->dispatch_status &= MGA_IN_DISPATCH; - - drm_lock_free(dev, - &dev->lock.hw_lock->lock, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - } else if (dev->lock.hw_lock) { - /* The lock is required to reclaim buffers */ - DECLARE_WAITQUEUE(entry, current); - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - retcode = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - dev->lock.pid = priv->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - /* Contention */ - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - retcode = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - if(!retcode) { - mga_reclaim_buffers(dev, priv->pid); - if (dev->dev_private) - ((drm_mga_private_t *)dev->dev_private) - ->dispatch_status &= MGA_IN_DISPATCH; - drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT); - } - } - drm_fasync(-1, filp, 0); - - down(&dev->struct_sem); - if (priv->remove_auth_on_close == 1) { - drm_file_t *temp = dev->file_first; - while(temp) { - temp->authenticated = 0; - temp = temp->next; - } - } - if (priv->prev) priv->prev->next = priv->next; - else dev->file_first = priv->next; - if (priv->next) priv->next->prev = priv->prev; - else dev->file_last = priv->prev; - up(&dev->struct_sem); - - drm_free(priv, sizeof(*priv), DRM_MEM_FILES); -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - 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); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return mga_takedown(dev); - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return retcode; -} - - -/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int mga_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; - - if (nr >= MGA_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &mga_ioctls[nr]; - func = ioctl->func; - - if (!func) { - DRM_DEBUG("no function: pid = %d, cmd = 0x%02x," - " nr = 0x%02x, dev 0x%x, auth = %d\n", - current->pid, cmd, nr, dev->device, - priv->authenticated); - 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 mga_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; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - 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); - mga_dma_schedule(dev, 1); - - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) DRM_ERROR("\n"); - - unblock_all_signals(); - return 0; -} +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." + +#define DRIVER_NAME "mga" +#define DRIVER_DESC "Matrox G200/G400" +#define DRIVER_DATE "20010319" + +#define DRIVER_MAJOR 3 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 1 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_RESET)] = { mga_dma_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, + + +#define __HAVE_COUNTERS 3 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY + + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h index d7bf63263..bd33d9d1e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h @@ -1,4 +1,4 @@ -/* mga_drv.h -- Private header for the Matrox g200/g400 driver -*- linux-c -*- +/* mga_drv.h -- Private header for the Matrox G200/G400 driver -*- linux-c -*- * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -19,182 +19,140 @@ * 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 + * VA LINUX SYSTEMS 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@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Gareth Hughes <gareth@valinux.com> */ -#ifndef _MGA_DRV_H_ -#define _MGA_DRV_H_ +#ifndef __MGA_DRV_H__ +#define __MGA_DRV_H__ -#define MGA_BUF_IN_USE 0 -#define MGA_BUF_SWAP_PENDING 1 -#define MGA_BUF_FORCE_FIRE 2 -#define MGA_BUF_NEEDS_OVERFLOW 3 +typedef struct drm_mga_primary_buffer { + u8 *start; + u8 *end; + int size; -typedef struct { - long buffer_status; /* long req'd for set_bit() --RR */ - int num_dwords; - int max_dwords; - u32 *current_dma_ptr; - u32 *head; - u32 phys_head; - unsigned int prim_age; - int sec_used; - int idx; -} drm_mga_prim_buf_t; - -typedef struct _drm_mga_freelist { - __volatile__ unsigned int age; + u32 tail; + int space; + + volatile u32 *status; + + u32 last_flush; + u32 last_wrap; + + u32 high_mark; + + spinlock_t list_lock; +} drm_mga_primary_buffer_t; + +typedef struct drm_mga_freelist { + struct drm_mga_freelist *next; + struct drm_mga_freelist *prev; + drm_mga_age_t age; drm_buf_t *buf; - struct _drm_mga_freelist *next; - struct _drm_mga_freelist *prev; } drm_mga_freelist_t; -#define MGA_IN_DISPATCH 0 -#define MGA_IN_FLUSH 1 -#define MGA_IN_WAIT 2 -#define MGA_IN_GETBUF 3 - -typedef struct _drm_mga_private { - long dispatch_status; /* long req'd for set_bit() --RR */ - unsigned int next_prim_age; - __volatile__ unsigned int last_prim_age; - int reserved_map_idx; - int buffer_map_idx; - drm_mga_sarea_t *sarea_priv; - int primary_size; - int warp_ucode_size; - int chipset; - unsigned int frontOffset; - unsigned int backOffset; - unsigned int depthOffset; - unsigned int textureOffset; - unsigned int textureSize; - int cpp; - unsigned int stride; - int sgram; - int use_agp; - drm_mga_warp_index_t WarpIndex[MGA_MAX_G400_PIPES]; - unsigned int WarpPipe; - unsigned int vertexsize; - atomic_t pending_bufs; - void *status_page; - unsigned long real_status_page; - u8 *ioremap; - drm_mga_prim_buf_t **prim_bufs; - drm_mga_prim_buf_t *next_prim; - drm_mga_prim_buf_t *last_prim; - drm_mga_prim_buf_t *current_prim; - int current_prim_idx; +typedef struct { + drm_mga_freelist_t *list_entry; + int discard; + int dispatched; +} drm_mga_buf_priv_t; + +typedef struct drm_mga_private { + drm_mga_primary_buffer_t prim; + drm_mga_sarea_t *sarea_priv; + drm_mga_freelist_t *head; drm_mga_freelist_t *tail; - wait_queue_head_t flush_queue; /* Processes waiting until flush */ - wait_queue_head_t wait_queue; /* Processes waiting until interrupt */ - wait_queue_head_t buf_queue; /* Processes waiting for a free buf */ - /* Some validated register values: - */ - u32 mAccess; -} drm_mga_private_t; - /* mga_drv.c */ -extern int mga_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_open(struct inode *inode, struct file *filp); -extern int mga_release(struct inode *inode, struct file *filp); -extern int mga_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); + unsigned int warp_pipe; + unsigned long warp_pipe_phys[MGA_MAX_WARP_PIPES]; + + int chipset; + int usec_timeout; + + u32 clear_cmd; + u32 maccess; + + unsigned int fb_cpp; + unsigned int front_offset; + unsigned int front_pitch; + unsigned int back_offset; + unsigned int back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset; + unsigned int depth_pitch; + + unsigned int texture_offset; + unsigned int texture_size; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *status; + drm_map_t *warp; + drm_map_t *primary; + drm_map_t *buffers; + drm_map_t *agp_textures; +} drm_mga_private_t; /* mga_dma.c */ -extern int mga_dma_schedule(drm_device_t *dev, int locked); -extern int mga_dma(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_irq_install(drm_device_t *dev, int irq); -extern int mga_irq_uninstall(drm_device_t *dev); -extern int mga_control(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -/* mga_dma_init does init and release */ -extern int mga_dma_init(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_dma_cleanup(drm_device_t *dev); -extern int mga_flush_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern unsigned int mga_create_sync_tag(drm_device_t *dev); -extern drm_buf_t *mga_freelist_get(drm_device_t *dev); -extern int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf); -extern int mga_advance_primary(drm_device_t *dev); -extern void mga_reclaim_buffers(drm_device_t *dev, pid_t pid); - - - /* mga_bufs.c */ -extern int mga_addbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_infobufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_markbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_freebufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_mapbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_addmap(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +extern int mga_dma_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_flush( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_buffers( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + +extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ); +extern int mga_do_dma_idle( drm_mga_private_t *dev_priv ); +extern int mga_do_dma_reset( drm_mga_private_t *dev_priv ); +extern int mga_do_engine_reset( drm_mga_private_t *dev_priv ); +extern int mga_do_cleanup_dma( drm_device_t *dev ); + +extern void mga_do_dma_flush( drm_mga_private_t *dev_priv ); +extern void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ); +extern void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ); + +extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ); + + /* mga_state.c */ -extern int mga_clear_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_swap_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_iload(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_vertex(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_indices(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_blit(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - /* mga_context.c */ -extern int mga_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int mga_context_switch(drm_device_t *dev, int old, int new); -extern int mga_context_switch_complete(drm_device_t *dev, int new); +extern int mga_dma_clear( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_swap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_vertex( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_indices( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_iload( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_blit( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + + /* mga_warp.c */ +extern int mga_warp_install_microcode( drm_device_t *dev ); +extern int mga_warp_init( drm_device_t *dev ); #define mga_flush_write_combine() mb() -typedef enum { - TT_GENERAL, - TT_BLIT, - TT_VECTOR, - TT_VERTEX -} transferType_t; -typedef struct { - drm_mga_freelist_t *my_freelist; - int discard; - int dispatched; -} drm_mga_buf_priv_t; +#define MGA_BASE( reg ) ((u32)(dev_priv->mmio->handle)) +#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) + +#define MGA_DEREF( reg ) *(volatile u32 *)MGA_ADDR( reg ) +#define MGA_READ( reg ) MGA_DEREF( reg ) +#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0) +#define MGA_DEREF8( reg ) *(volatile u8 *)MGA_ADDR( reg ) +#define MGA_WRITE8( reg, val ) do { MGA_DEREF8( reg ) = val; } while (0) #define DWGREG0 0x1c00 #define DWGREG0_END 0x1dff @@ -202,328 +160,443 @@ typedef struct { #define DWGREG1_END 0x2dff #define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END) -#define ADRINDEX0(r) (u8)((r - DWGREG0) >> 2) -#define ADRINDEX1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) -#define ADRINDEX(r) (ISREG0(r) ? ADRINDEX0(r) : ADRINDEX1(r)) - -#define MGA_VERBOSE 0 -#define MGA_NUM_PRIM_BUFS 8 - -#define PRIMLOCALS u8 tempIndex[4]; u32 *dma_ptr; u32 phys_head; \ - int outcount, num_dwords - -#define PRIM_OVERFLOW(dev, dev_priv, length) do { \ - drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - if( test_bit(MGA_BUF_NEEDS_OVERFLOW, &tmp_buf->buffer_status)) { \ - mga_advance_primary(dev); \ - mga_dma_schedule(dev, 1); \ - tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - } else if( tmp_buf->max_dwords - tmp_buf->num_dwords < length || \ - tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \ - set_bit(MGA_BUF_FORCE_FIRE, &tmp_buf->buffer_status); \ - mga_advance_primary(dev); \ - mga_dma_schedule(dev, 1); \ - tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - } \ - if(MGA_VERBOSE) \ - DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \ - dma_ptr = tmp_buf->current_dma_ptr; \ - num_dwords = tmp_buf->num_dwords; \ - phys_head = tmp_buf->phys_head; \ - outcount = 0; \ -} while(0) - -#define PRIMGETPTR(dev_priv) do { \ - drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - if(MGA_VERBOSE) \ - DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \ - dma_ptr = tmp_buf->current_dma_ptr; \ - num_dwords = tmp_buf->num_dwords; \ - phys_head = tmp_buf->phys_head; \ - outcount = 0; \ -} while(0) - -#define PRIMPTR(prim_buf) do { \ - if(MGA_VERBOSE) \ - DRM_DEBUG("PRIMPTR in %s\n", __FUNCTION__); \ - dma_ptr = prim_buf->current_dma_ptr; \ - num_dwords = prim_buf->num_dwords; \ - phys_head = prim_buf->phys_head; \ - outcount = 0; \ -} while(0) - -#define PRIMFINISH(prim_buf) do { \ - if (MGA_VERBOSE) { \ - DRM_DEBUG( "PRIMFINISH in %s\n", __FUNCTION__); \ - if (outcount & 3) \ - DRM_DEBUG(" --- truncation\n"); \ - } \ - prim_buf->num_dwords = num_dwords; \ - prim_buf->current_dma_ptr = dma_ptr; \ -} while(0) - -#define PRIMADVANCE(dev_priv) do { \ -drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - if (MGA_VERBOSE) { \ - DRM_DEBUG("PRIMADVANCE in %s\n", __FUNCTION__); \ - if (outcount & 3) \ - DRM_DEBUG(" --- truncation\n"); \ - } \ - tmp_buf->num_dwords = num_dwords; \ - tmp_buf->current_dma_ptr = dma_ptr; \ +#define DMAREG0(r) (u8)((r - DWGREG0) >> 2) +#define DMAREG1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) +#define DMAREG(r) (ISREG0(r) ? DMAREG0(r) : DMAREG1(r)) + + + +/* ================================================================ + * Helper macross... + */ + +#define MGA_EMIT_STATE( dev_priv, dirty ) \ +do { \ + if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) { \ + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { \ + mga_g400_emit_state( dev_priv ); \ + } else { \ + mga_g200_emit_state( dev_priv ); \ + } \ + } \ +} while (0) + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != current->pid ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return -EINVAL; \ + } \ +} while (0) + +#define WRAP_TEST_WITH_RETURN( dev_priv ) \ +do { \ + if ( dev_priv->sarea_priv->last_wrap < \ + dev_priv->prim.last_wrap ) { \ + if ( mga_do_wait_for_idle( dev_priv ) < 0 ) \ + return -EBUSY; \ + mga_do_dma_wrap_end( dev_priv ); \ + } \ +} while (0) + + +/* ================================================================ + * Primary DMA command stream + */ + +#define MGA_VERBOSE 0 + +#define DMA_LOCALS unsigned int write; volatile u8 *prim; + +#define DMA_BLOCK_SIZE (5 * sizeof(u32)) + +#define BEGIN_DMA( n ) \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "BEGIN_DMA( %d ) in %s\n", \ + (n), __FUNCTION__ ); \ + DRM_INFO( " space=0x%x req=0x%x\n", \ + dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ + } \ + prim = dev_priv->prim.start; \ + write = dev_priv->prim.tail; \ +} while (0) + +#define BEGIN_DMA_WRAP() \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "BEGIN_DMA() in %s\n", __FUNCTION__ ); \ + DRM_INFO( " space=0x%x\n", dev_priv->prim.space ); \ + } \ + prim = dev_priv->prim.start; \ + write = dev_priv->prim.tail; \ +} while (0) + +#define ADVANCE_DMA() \ +do { \ + dev_priv->prim.tail = write; \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "ADVANCE_DMA() tail=0x%05x sp=0x%x\n", \ + write, dev_priv->prim.space ); \ + } \ +} while (0) + +#define FLUSH_DMA() \ +do { \ + if ( 0 ) { \ + DRM_INFO( __FUNCTION__ ":\n" ); \ + DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ + dev_priv->prim.tail, \ + MGA_READ( MGA_PRIMADDRESS ) - \ + dev_priv->primary->offset ); \ + } \ + if ( dev_priv->prim.space < dev_priv->prim.high_mark ) { \ + mga_do_dma_wrap_start( dev_priv ); \ + } else { \ + mga_do_dma_flush( dev_priv ); \ + } \ } while (0) -#define PRIMUPDATE(dev_priv) do { \ - drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - tmp_buf->sec_used++; \ +/* Never use this, always use DMA_BLOCK(...) for primary DMA output. + */ +#define DMA_WRITE( offset, val ) \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04x\n", \ + (u32)(val), write + (offset) * sizeof(u32) ); \ + } \ + *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \ } while (0) -#define AGEBUF(dev_priv, buf_priv) do { \ - drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - buf_priv->my_freelist->age = tmp_buf->prim_age; \ +#define DMA_BLOCK( reg0, val0, reg1, val1, reg2, val2, reg3, val3 ) \ +do { \ + DMA_WRITE( 0, ((DMAREG( reg0 ) << 0) | \ + (DMAREG( reg1 ) << 8) | \ + (DMAREG( reg2 ) << 16) | \ + (DMAREG( reg3 ) << 24)) ); \ + DMA_WRITE( 1, val0 ); \ + DMA_WRITE( 2, val1 ); \ + DMA_WRITE( 3, val2 ); \ + DMA_WRITE( 4, val3 ); \ + write += DMA_BLOCK_SIZE; \ } while (0) -#define PRIMOUTREG(reg, val) do { \ - tempIndex[outcount]=ADRINDEX(reg); \ - dma_ptr[1+outcount] = val; \ - if (MGA_VERBOSE) \ - DRM_DEBUG(" PRIMOUT %d: 0x%x -- 0x%x\n", \ - num_dwords + 1 + outcount, ADRINDEX(reg), val); \ - if( ++outcount == 4) { \ - outcount = 0; \ - dma_ptr[0] = *(unsigned long *)tempIndex; \ - dma_ptr+=5; \ - num_dwords += 5; \ +/* Buffer aging via primary DMA stream head pointer. + */ + +#define SET_AGE( age, h, w ) \ +do { \ + (age)->head = h; \ + (age)->wrap = w; \ +} while (0) + +#define TEST_AGE( age, h, w ) ( (age)->wrap < w || \ + ( (age)->wrap == w && \ + (age)->head < h ) ) + +#define AGE_BUFFER( buf_priv ) \ +do { \ + drm_mga_freelist_t *entry = (buf_priv)->list_entry; \ + if ( (buf_priv)->dispatched ) { \ + entry->age.head = (dev_priv->prim.tail + \ + dev_priv->primary->offset); \ + entry->age.wrap = dev_priv->sarea_priv->last_wrap; \ + } else { \ + entry->age.head = 0; \ + entry->age.wrap = 0; \ } \ -}while (0) +} while (0) + + +#define MGA_ENGINE_IDLE_MASK (MGA_SOFTRAPEN | \ + MGA_DWGENGSTS | \ + MGA_ENDPRDMASTS) +#define MGA_DMA_IDLE_MASK (MGA_SOFTRAPEN | \ + MGA_ENDPRDMASTS) + +#define MGA_DMA_SOFTRAP_SIZE 32 * DMA_BLOCK_SIZE + + /* A reduced set of the mga registers. */ +#define MGA_CRTC_INDEX 0x1fd4 + +#define MGA_ALPHACTRL 0x2c7c +#define MGA_AR0 0x1c60 +#define MGA_AR1 0x1c64 +#define MGA_AR2 0x1c68 +#define MGA_AR3 0x1c6c +#define MGA_AR4 0x1c70 +#define MGA_AR5 0x1c74 +#define MGA_AR6 0x1c78 + +#define MGA_CXBNDRY 0x1c80 +#define MGA_CXLEFT 0x1ca0 +#define MGA_CXRIGHT 0x1ca4 + +#define MGA_DMAPAD 0x1c54 +#define MGA_DSTORG 0x2cb8 +#define MGA_DWGCTL 0x1c00 +# define MGA_OPCOD_MASK (15 << 0) +# define MGA_OPCOD_TRAP (4 << 0) +# define MGA_OPCOD_TEXTURE_TRAP (6 << 0) +# define MGA_OPCOD_BITBLT (8 << 0) +# define MGA_OPCOD_ILOAD (9 << 0) +# define MGA_ATYPE_MASK (7 << 4) +# define MGA_ATYPE_RPL (0 << 4) +# define MGA_ATYPE_RSTR (1 << 4) +# define MGA_ATYPE_ZI (3 << 4) +# define MGA_ATYPE_BLK (4 << 4) +# define MGA_ATYPE_I (7 << 4) +# define MGA_LINEAR (1 << 7) +# define MGA_ZMODE_MASK (7 << 8) +# define MGA_ZMODE_NOZCMP (0 << 8) +# define MGA_ZMODE_ZE (2 << 8) +# define MGA_ZMODE_ZNE (3 << 8) +# define MGA_ZMODE_ZLT (4 << 8) +# define MGA_ZMODE_ZLTE (5 << 8) +# define MGA_ZMODE_ZGT (6 << 8) +# define MGA_ZMODE_ZGTE (7 << 8) +# define MGA_SOLID (1 << 11) +# define MGA_ARZERO (1 << 12) +# define MGA_SGNZERO (1 << 13) +# define MGA_SHIFTZERO (1 << 14) +# define MGA_BOP_MASK (15 << 16) +# define MGA_BOP_ZERO (0 << 16) +# define MGA_BOP_DST (10 << 16) +# define MGA_BOP_SRC (12 << 16) +# define MGA_BOP_ONE (15 << 16) +# define MGA_TRANS_SHIFT 20 +# define MGA_TRANS_MASK (15 << 20) +# define MGA_BLTMOD_MASK (15 << 25) +# define MGA_BLTMOD_BMONOLEF (0 << 25) +# define MGA_BLTMOD_BMONOWF (4 << 25) +# define MGA_BLTMOD_PLAN (1 << 25) +# define MGA_BLTMOD_BFCOL (2 << 25) +# define MGA_BLTMOD_BU32BGR (3 << 25) +# define MGA_BLTMOD_BU32RGB (7 << 25) +# define MGA_BLTMOD_BU24BGR (11 << 25) +# define MGA_BLTMOD_BU24RGB (15 << 25) +# define MGA_PATTERN (1 << 29) +# define MGA_TRANSC (1 << 30) +# define MGA_CLIPDIS (1 << 31) +#define MGA_DWGSYNC 0x2c4c + +#define MGA_FCOL 0x1c24 +#define MGA_FIFOSTATUS 0x1e10 +#define MGA_FOGCOL 0x1cf4 +#define MGA_FXBNDRY 0x1c84 +#define MGA_FXLEFT 0x1ca8 +#define MGA_FXRIGHT 0x1cac + +#define MGA_ICLEAR 0x1e18 +# define MGA_SOFTRAPICLR (1 << 0) +#define MGA_IEN 0x1e1c +# define MGA_SOFTRAPIEN (1 << 0) + +#define MGA_LEN 0x1c5c + +#define MGA_MACCESS 0x1c04 + +#define MGA_PITCH 0x1c8c +#define MGA_PLNWT 0x1c1c +#define MGA_PRIMADDRESS 0x1e58 +# define MGA_DMA_GENERAL (0 << 0) +# define MGA_DMA_BLIT (1 << 0) +# define MGA_DMA_VECTOR (2 << 0) +# define MGA_DMA_VERTEX (3 << 0) +#define MGA_PRIMEND 0x1e5c +# define MGA_PRIMNOSTART (1 << 0) +# define MGA_PAGPXFER (1 << 1) +#define MGA_PRIMPTR 0x1e50 +# define MGA_PRIMPTREN0 (1 << 0) +# define MGA_PRIMPTREN1 (1 << 1) + +#define MGA_RST 0x1e40 +# define MGA_SOFTRESET (1 << 0) +# define MGA_SOFTEXTRST (1 << 1) + +#define MGA_SECADDRESS 0x2c40 +#define MGA_SECEND 0x2c44 +#define MGA_SETUPADDRESS 0x2cd0 +#define MGA_SETUPEND 0x2cd4 +#define MGA_SGN 0x1c58 +#define MGA_SOFTRAP 0x2c48 +#define MGA_SRCORG 0x2cb4 +# define MGA_SRMMAP_MASK (1 << 0) +# define MGA_SRCMAP_FB (0 << 0) +# define MGA_SRCMAP_SYSMEM (1 << 0) +# define MGA_SRCACC_MASK (1 << 1) +# define MGA_SRCACC_PCI (0 << 1) +# define MGA_SRCACC_AGP (1 << 1) +#define MGA_STATUS 0x1e14 +# define MGA_SOFTRAPEN (1 << 0) +# define MGA_DWGENGSTS (1 << 16) +# define MGA_ENDPRDMASTS (1 << 17) +#define MGA_STENCIL 0x2cc8 +#define MGA_STENCILCTL 0x2ccc + +#define MGA_TDUALSTAGE0 0x2cf8 +#define MGA_TDUALSTAGE1 0x2cfc +#define MGA_TEXBORDERCOL 0x2c5c +#define MGA_TEXCTL 0x2c30 +#define MGA_TEXCTL2 0x2c3c +# define MGA_DUALTEX (1 << 7) +# define MGA_G400_TC2_MAGIC (1 << 15) +# define MGA_MAP1_ENABLE (1 << 31) +#define MGA_TEXFILTER 0x2c58 +#define MGA_TEXHEIGHT 0x2c2c +#define MGA_TEXORG 0x2c24 +# define MGA_TEXORGMAP_MASK (1 << 0) +# define MGA_TEXORGMAP_FB (0 << 0) +# define MGA_TEXORGMAP_SYSMEM (1 << 0) +# define MGA_TEXORGACC_MASK (1 << 1) +# define MGA_TEXORGACC_PCI (0 << 1) +# define MGA_TEXORGACC_AGP (1 << 1) +#define MGA_TEXORG1 0x2ca4 +#define MGA_TEXORG2 0x2ca8 +#define MGA_TEXORG3 0x2cac +#define MGA_TEXORG4 0x2cb0 +#define MGA_TEXTRANS 0x2c34 +#define MGA_TEXTRANSHIGH 0x2c38 +#define MGA_TEXWIDTH 0x2c28 + +#define MGA_WACCEPTSEQ 0x1dd4 +#define MGA_WCODEADDR 0x1e6c +#define MGA_WFLAG 0x1dc4 +#define MGA_WFLAG1 0x1de0 +#define MGA_WFLAGNB 0x1e64 +#define MGA_WFLAGNB1 0x1e08 +#define MGA_WGETMSB 0x1dc8 +#define MGA_WIADDR 0x1dc0 +#define MGA_WIADDR2 0x1dd8 +# define MGA_WMODE_SUSPEND (0 << 0) +# define MGA_WMODE_RESUME (1 << 0) +# define MGA_WMODE_JUMP (2 << 0) +# define MGA_WMODE_START (3 << 0) +# define MGA_WAGP_ENABLE (1 << 2) +#define MGA_WMISC 0x1e70 +# define MGA_WUCODECACHE_ENABLE (1 << 0) +# define MGA_WMASTER_ENABLE (1 << 1) +# define MGA_WCACHEFLUSH_ENABLE (1 << 3) +#define MGA_WVRTXSZ 0x1dcc + +#define MGA_YBOT 0x1c9c +#define MGA_YDST 0x1c90 +#define MGA_YDSTLEN 0x1c88 +#define MGA_YDSTORG 0x1c94 +#define MGA_YTOP 0x1c98 + +#define MGA_ZORG 0x1c0c + +/* This finishes the current batch of commands + */ +#define MGA_EXEC 0x0100 -#define MGAREG_MGA_EXEC 0x0100 -#define MGAREG_ALPHACTRL 0x2c7c -#define MGAREG_AR0 0x1c60 -#define MGAREG_AR1 0x1c64 -#define MGAREG_AR2 0x1c68 -#define MGAREG_AR3 0x1c6c -#define MGAREG_AR4 0x1c70 -#define MGAREG_AR5 0x1c74 -#define MGAREG_AR6 0x1c78 -#define MGAREG_CXBNDRY 0x1c80 -#define MGAREG_CXLEFT 0x1ca0 -#define MGAREG_CXRIGHT 0x1ca4 -#define MGAREG_DMAPAD 0x1c54 -#define MGAREG_DSTORG 0x2cb8 -#define MGAREG_DWGCTL 0x1c00 -#define MGAREG_DWGSYNC 0x2c4c -#define MGAREG_FCOL 0x1c24 -#define MGAREG_FIFOSTATUS 0x1e10 -#define MGAREG_FOGCOL 0x1cf4 -#define MGAREG_FXBNDRY 0x1c84 -#define MGAREG_FXLEFT 0x1ca8 -#define MGAREG_FXRIGHT 0x1cac -#define MGAREG_ICLEAR 0x1e18 -#define MGAREG_IEN 0x1e1c -#define MGAREG_LEN 0x1c5c -#define MGAREG_MACCESS 0x1c04 -#define MGAREG_PITCH 0x1c8c -#define MGAREG_PLNWT 0x1c1c -#define MGAREG_PRIMADDRESS 0x1e58 -#define MGAREG_PRIMEND 0x1e5c -#define MGAREG_PRIMPTR 0x1e50 -#define MGAREG_SECADDRESS 0x2c40 -#define MGAREG_SECEND 0x2c44 -#define MGAREG_SETUPADDRESS 0x2cd0 -#define MGAREG_SETUPEND 0x2cd4 -#define MGAREG_SGN 0x1c58 -#define MGAREG_SOFTRAP 0x2c48 -#define MGAREG_SRCORG 0x2cb4 -#define MGAREG_STATUS 0x1e14 -#define MGAREG_STENCIL 0x2cc8 -#define MGAREG_STENCILCTL 0x2ccc -#define MGAREG_TDUALSTAGE0 0x2cf8 -#define MGAREG_TDUALSTAGE1 0x2cfc -#define MGAREG_TEXBORDERCOL 0x2c5c -#define MGAREG_TEXCTL 0x2c30 -#define MGAREG_TEXCTL2 0x2c3c -#define MGAREG_TEXFILTER 0x2c58 -#define MGAREG_TEXHEIGHT 0x2c2c -#define MGAREG_TEXORG 0x2c24 -#define MGAREG_TEXORG1 0x2ca4 -#define MGAREG_TEXORG2 0x2ca8 -#define MGAREG_TEXORG3 0x2cac -#define MGAREG_TEXORG4 0x2cb0 -#define MGAREG_TEXTRANS 0x2c34 -#define MGAREG_TEXTRANSHIGH 0x2c38 -#define MGAREG_TEXWIDTH 0x2c28 -#define MGAREG_WACCEPTSEQ 0x1dd4 -#define MGAREG_WCODEADDR 0x1e6c -#define MGAREG_WFLAG 0x1dc4 -#define MGAREG_WFLAG1 0x1de0 -#define MGAREG_WFLAGNB 0x1e64 -#define MGAREG_WFLAGNB1 0x1e08 -#define MGAREG_WGETMSB 0x1dc8 -#define MGAREG_WIADDR 0x1dc0 -#define MGAREG_WIADDR2 0x1dd8 -#define MGAREG_WMISC 0x1e70 -#define MGAREG_WVRTXSZ 0x1dcc -#define MGAREG_YBOT 0x1c9c -#define MGAREG_YDST 0x1c90 -#define MGAREG_YDSTLEN 0x1c88 -#define MGAREG_YDSTORG 0x1c94 -#define MGAREG_YTOP 0x1c98 -#define MGAREG_ZORG 0x1c0c - -/* Warp registers */ -#define MGAREG_WR0 0x2d00 -#define MGAREG_WR1 0x2d04 -#define MGAREG_WR2 0x2d08 -#define MGAREG_WR3 0x2d0c -#define MGAREG_WR4 0x2d10 -#define MGAREG_WR5 0x2d14 -#define MGAREG_WR6 0x2d18 -#define MGAREG_WR7 0x2d1c -#define MGAREG_WR8 0x2d20 -#define MGAREG_WR9 0x2d24 -#define MGAREG_WR10 0x2d28 -#define MGAREG_WR11 0x2d2c -#define MGAREG_WR12 0x2d30 -#define MGAREG_WR13 0x2d34 -#define MGAREG_WR14 0x2d38 -#define MGAREG_WR15 0x2d3c -#define MGAREG_WR16 0x2d40 -#define MGAREG_WR17 0x2d44 -#define MGAREG_WR18 0x2d48 -#define MGAREG_WR19 0x2d4c -#define MGAREG_WR20 0x2d50 -#define MGAREG_WR21 0x2d54 -#define MGAREG_WR22 0x2d58 -#define MGAREG_WR23 0x2d5c -#define MGAREG_WR24 0x2d60 -#define MGAREG_WR25 0x2d64 -#define MGAREG_WR26 0x2d68 -#define MGAREG_WR27 0x2d6c -#define MGAREG_WR28 0x2d70 -#define MGAREG_WR29 0x2d74 -#define MGAREG_WR30 0x2d78 -#define MGAREG_WR31 0x2d7c -#define MGAREG_WR32 0x2d80 -#define MGAREG_WR33 0x2d84 -#define MGAREG_WR34 0x2d88 -#define MGAREG_WR35 0x2d8c -#define MGAREG_WR36 0x2d90 -#define MGAREG_WR37 0x2d94 -#define MGAREG_WR38 0x2d98 -#define MGAREG_WR39 0x2d9c -#define MGAREG_WR40 0x2da0 -#define MGAREG_WR41 0x2da4 -#define MGAREG_WR42 0x2da8 -#define MGAREG_WR43 0x2dac -#define MGAREG_WR44 0x2db0 -#define MGAREG_WR45 0x2db4 -#define MGAREG_WR46 0x2db8 -#define MGAREG_WR47 0x2dbc -#define MGAREG_WR48 0x2dc0 -#define MGAREG_WR49 0x2dc4 -#define MGAREG_WR50 0x2dc8 -#define MGAREG_WR51 0x2dcc -#define MGAREG_WR52 0x2dd0 -#define MGAREG_WR53 0x2dd4 -#define MGAREG_WR54 0x2dd8 -#define MGAREG_WR55 0x2ddc -#define MGAREG_WR56 0x2de0 -#define MGAREG_WR57 0x2de4 -#define MGAREG_WR58 0x2de8 -#define MGAREG_WR59 0x2dec -#define MGAREG_WR60 0x2df0 -#define MGAREG_WR61 0x2df4 -#define MGAREG_WR62 0x2df8 -#define MGAREG_WR63 0x2dfc - -#define PDEA_pagpxfer_enable 0x2 - -#define WIA_wmode_suspend 0x0 -#define WIA_wmode_start 0x3 -#define WIA_wagp_agp 0x4 - -#define DC_opcod_line_open 0x0 -#define DC_opcod_autoline_open 0x1 -#define DC_opcod_line_close 0x2 -#define DC_opcod_autoline_close 0x3 -#define DC_opcod_trap 0x4 -#define DC_opcod_texture_trap 0x6 -#define DC_opcod_bitblt 0x8 -#define DC_opcod_iload 0x9 -#define DC_atype_rpl 0x0 -#define DC_atype_rstr 0x10 -#define DC_atype_zi 0x30 -#define DC_atype_blk 0x40 -#define DC_atype_i 0x70 -#define DC_linear_xy 0x0 -#define DC_linear_linear 0x80 -#define DC_zmode_nozcmp 0x0 -#define DC_zmode_ze 0x200 -#define DC_zmode_zne 0x300 -#define DC_zmode_zlt 0x400 -#define DC_zmode_zlte 0x500 -#define DC_zmode_zgt 0x600 -#define DC_zmode_zgte 0x700 -#define DC_solid_disable 0x0 -#define DC_solid_enable 0x800 -#define DC_arzero_disable 0x0 -#define DC_arzero_enable 0x1000 -#define DC_sgnzero_disable 0x0 -#define DC_sgnzero_enable 0x2000 -#define DC_shftzero_disable 0x0 -#define DC_shftzero_enable 0x4000 -#define DC_bop_SHIFT 16 -#define DC_trans_SHIFT 20 -#define DC_bltmod_bmonolef 0x0 -#define DC_bltmod_bmonowf 0x8000000 -#define DC_bltmod_bplan 0x2000000 -#define DC_bltmod_bfcol 0x4000000 -#define DC_bltmod_bu32bgr 0x6000000 -#define DC_bltmod_bu32rgb 0xe000000 -#define DC_bltmod_bu24bgr 0x16000000 -#define DC_bltmod_bu24rgb 0x1e000000 -#define DC_pattern_disable 0x0 -#define DC_pattern_enable 0x20000000 -#define DC_transc_disable 0x0 -#define DC_transc_enable 0x40000000 -#define DC_clipdis_disable 0x0 -#define DC_clipdis_enable 0x80000000 - - -#define SO_srcacc_pci 0x0 -#define SO_srcacc_agp 0x2 -#define SO_srcmap_fb 0x0 -#define SO_srcmap_sys 0x1 - - -#define SETADD_mode_vertlist 0x0 - - -#define MGA_CLEAR_CMD (DC_opcod_trap | DC_arzero_enable | \ - DC_sgnzero_enable | DC_shftzero_enable | \ - (0xC << DC_bop_SHIFT) | DC_clipdis_enable | \ - DC_solid_enable | DC_transc_enable) - - -#define MGA_COPY_CMD (DC_opcod_bitblt | DC_atype_rpl | DC_linear_xy | \ - DC_solid_disable | DC_arzero_disable | \ - DC_sgnzero_enable | DC_shftzero_enable | \ - (0xC << DC_bop_SHIFT) | DC_bltmod_bfcol | \ - DC_pattern_disable | DC_transc_disable | \ - DC_clipdis_enable) \ - -#define MGA_FLUSH_CMD (DC_opcod_texture_trap | (0xF << DC_trans_SHIFT) |\ - DC_arzero_enable | DC_sgnzero_enable | \ - DC_atype_i) +/* Warp registers + */ +#define MGA_WR0 0x2d00 +#define MGA_WR1 0x2d04 +#define MGA_WR2 0x2d08 +#define MGA_WR3 0x2d0c +#define MGA_WR4 0x2d10 +#define MGA_WR5 0x2d14 +#define MGA_WR6 0x2d18 +#define MGA_WR7 0x2d1c +#define MGA_WR8 0x2d20 +#define MGA_WR9 0x2d24 +#define MGA_WR10 0x2d28 +#define MGA_WR11 0x2d2c +#define MGA_WR12 0x2d30 +#define MGA_WR13 0x2d34 +#define MGA_WR14 0x2d38 +#define MGA_WR15 0x2d3c +#define MGA_WR16 0x2d40 +#define MGA_WR17 0x2d44 +#define MGA_WR18 0x2d48 +#define MGA_WR19 0x2d4c +#define MGA_WR20 0x2d50 +#define MGA_WR21 0x2d54 +#define MGA_WR22 0x2d58 +#define MGA_WR23 0x2d5c +#define MGA_WR24 0x2d60 +#define MGA_WR25 0x2d64 +#define MGA_WR26 0x2d68 +#define MGA_WR27 0x2d6c +#define MGA_WR28 0x2d70 +#define MGA_WR29 0x2d74 +#define MGA_WR30 0x2d78 +#define MGA_WR31 0x2d7c +#define MGA_WR32 0x2d80 +#define MGA_WR33 0x2d84 +#define MGA_WR34 0x2d88 +#define MGA_WR35 0x2d8c +#define MGA_WR36 0x2d90 +#define MGA_WR37 0x2d94 +#define MGA_WR38 0x2d98 +#define MGA_WR39 0x2d9c +#define MGA_WR40 0x2da0 +#define MGA_WR41 0x2da4 +#define MGA_WR42 0x2da8 +#define MGA_WR43 0x2dac +#define MGA_WR44 0x2db0 +#define MGA_WR45 0x2db4 +#define MGA_WR46 0x2db8 +#define MGA_WR47 0x2dbc +#define MGA_WR48 0x2dc0 +#define MGA_WR49 0x2dc4 +#define MGA_WR50 0x2dc8 +#define MGA_WR51 0x2dcc +#define MGA_WR52 0x2dd0 +#define MGA_WR53 0x2dd4 +#define MGA_WR54 0x2dd8 +#define MGA_WR55 0x2ddc +#define MGA_WR56 0x2de0 +#define MGA_WR57 0x2de4 +#define MGA_WR58 0x2de8 +#define MGA_WR59 0x2dec +#define MGA_WR60 0x2df0 +#define MGA_WR61 0x2df4 +#define MGA_WR62 0x2df8 +#define MGA_WR63 0x2dfc +# define MGA_G400_WR_MAGIC (1 << 6) +# define MGA_G400_WR56_MAGIC 0x46480000 /* 12800.0f */ + + +#define MGA_ILOAD_ALIGN 64 +#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1) + +#define MGA_DWGCTL_FLUSH (MGA_OPCOD_TEXTURE_TRAP | \ + MGA_ATYPE_I | \ + MGA_ZMODE_NOZCMP | \ + MGA_ARZERO | \ + MGA_SGNZERO | \ + MGA_BOP_SRC | \ + (15 << MGA_TRANS_SHIFT)) + +#define MGA_DWGCTL_CLEAR (MGA_OPCOD_TRAP | \ + MGA_ZMODE_NOZCMP | \ + MGA_SOLID | \ + MGA_ARZERO | \ + MGA_SGNZERO | \ + MGA_SHIFTZERO | \ + MGA_BOP_SRC | \ + (0 << MGA_TRANS_SHIFT) | \ + MGA_BLTMOD_BMONOLEF | \ + MGA_TRANSC | \ + MGA_CLIPDIS) + +#define MGA_DWGCTL_COPY (MGA_OPCOD_BITBLT | \ + MGA_ATYPE_RPL | \ + MGA_SGNZERO | \ + MGA_SHIFTZERO | \ + MGA_BOP_SRC | \ + (0 << MGA_TRANS_SHIFT) | \ + MGA_BLTMOD_BFCOL | \ + MGA_CLIPDIS) #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c index bba8fa35b..4c9c9c058 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c @@ -1,4 +1,4 @@ -/* mga_state.c -- State support for mga g200/g400 -*- linux-c -*- +/* mga_state.c -- State support for MGA G200/G400 -*- linux-c -*- * Created: Thu Jan 27 02:53:43 2000 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -19,404 +19,400 @@ * 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 + * VA LINUX SYSTEMS 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. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * Authors: Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Authors: + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> */ #define __NO_VERSION__ +#include "mga.h" #include "drmP.h" #include "mga_drv.h" #include "drm.h" -/* If you change the functions to set state, PLEASE - * change these values - */ - -#define MGAEMITCLIP_SIZE 10 -#define MGAEMITCTX_SIZE 20 -#define MGAG200EMITTEX_SIZE 20 -#define MGAG400EMITTEX0_SIZE 30 -#define MGAG400EMITTEX1_SIZE 25 -#define MGAG400EMITPIPE_SIZE 50 -#define MGAG200EMITPIPE_SIZE 15 -#define MAX_STATE_SIZE ((MGAEMITCLIP_SIZE * MGA_NR_SAREA_CLIPRECTS) + \ - MGAEMITCTX_SIZE + MGAG400EMITTEX0_SIZE + \ - MGAG400EMITTEX1_SIZE + MGAG400EMITPIPE_SIZE) +/* ================================================================ + * DMA hardware state programming functions + */ -static void mgaEmitClipRect(drm_mga_private_t * dev_priv, - drm_clip_rect_t * box) +static void mga_emit_clip_rect( drm_mga_private_t *dev_priv, + drm_clip_rect_t *box ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - PRIMLOCALS; - - /* This takes 10 dwords */ - PRIMGETPTR(dev_priv); - - /* Force reset of dwgctl on G400 (eliminates clip disable bit) */ - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { -#if 0 - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); -#else - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000); -#endif - } - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_CXBNDRY, ((box->x2) << 16) | (box->x1)); - PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / dev_priv->cpp); - PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / dev_priv->cpp); + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + unsigned int pitch = dev_priv->front_pitch; + DMA_LOCALS; - PRIMADVANCE(dev_priv); -} + BEGIN_DMA( 2 ); -static void mgaEmitContext(drm_mga_private_t * dev_priv) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - PRIMLOCALS; - - /* This takes a max of 20 dwords */ - PRIMGETPTR(dev_priv); - - PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]); - PRIMOUTREG(MGAREG_MACCESS, regs[MGA_CTXREG_MACCESS]); - PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); - - PRIMOUTREG(MGAREG_ALPHACTRL, regs[MGA_CTXREG_ALPHACTRL]); - PRIMOUTREG(MGAREG_FOGCOL, regs[MGA_CTXREG_FOGCOLOR]); - PRIMOUTREG(MGAREG_WFLAG, regs[MGA_CTXREG_WFLAG]); - PRIMOUTREG(MGAREG_ZORG, dev_priv->depthOffset); /* invarient */ - - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - PRIMOUTREG(MGAREG_WFLAG1, regs[MGA_CTXREG_WFLAG]); - PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]); - PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]); - PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); - - PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]); - PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - } else { - PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + /* Force reset of DWGCTL on G400 (eliminates clip disable bit). + */ + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { + DMA_BLOCK( MGA_DWGCTL, ctx->dwgctl, + MGA_LEN + MGA_EXEC, 0x80000000, + MGA_DWGCTL, ctx->dwgctl, + MGA_LEN + MGA_EXEC, 0x80000000 ); } + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_CXBNDRY, (box->x2 << 16) | box->x1, + MGA_YTOP, box->y1 * pitch, + MGA_YBOT, box->y2 * pitch ); - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -static void mgaG200EmitTex(drm_mga_private_t * dev_priv) +static inline void mga_g200_emit_context( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[0]; - PRIMLOCALS; - - PRIMGETPTR(dev_priv); + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + DMA_LOCALS; - /* This takes 20 dwords */ + BEGIN_DMA( 3 ); - PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2]); - PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); - PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); - PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); + DMA_BLOCK( MGA_DSTORG, ctx->dstorg, + MGA_MACCESS, ctx->maccess, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); - PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); - PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); - PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); - PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); + DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, + MGA_FOGCOL, ctx->fogcolor, + MGA_WFLAG, ctx->wflag, + MGA_ZORG, dev_priv->depth_offset ); - PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); - PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_WR24, regs[MGA_TEXREG_WIDTH]); + DMA_BLOCK( MGA_FCOL, ctx->fcol, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); - PRIMOUTREG(MGAREG_WR34, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); - PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -#define TMC_dualtex_enable 0x80 - -static void mgaG400EmitTex0(drm_mga_private_t * dev_priv) +static inline void mga_g400_emit_context( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[0]; - PRIMLOCALS; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + DMA_LOCALS; - PRIMGETPTR(dev_priv); + BEGIN_DMA( 4 ); - /* This takes 30 dwords */ + DMA_BLOCK( MGA_DSTORG, ctx->dstorg, + MGA_MACCESS, ctx->maccess, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); - PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); - PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); - PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); - PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); + DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, + MGA_FOGCOL, ctx->fogcolor, + MGA_WFLAG, ctx->wflag, + MGA_ZORG, dev_priv->depth_offset ); - PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); - PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); - PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); - PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); + DMA_BLOCK( MGA_WFLAG1, ctx->wflag, + MGA_TDUALSTAGE0, ctx->tdualstage0, + MGA_TDUALSTAGE1, ctx->tdualstage1, + MGA_FCOL, ctx->fcol ); - PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); - PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_WR49, 0); + DMA_BLOCK( MGA_STENCIL, ctx->stencil, + MGA_STENCILCTL, ctx->stencilctl, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); - PRIMOUTREG(MGAREG_WR57, 0); - PRIMOUTREG(MGAREG_WR53, 0); - PRIMOUTREG(MGAREG_WR61, 0); - PRIMOUTREG(MGAREG_WR52, 0x40); - - PRIMOUTREG(MGAREG_WR60, 0x40); - PRIMOUTREG(MGAREG_WR54, regs[MGA_TEXREG_WIDTH] | 0x40); - PRIMOUTREG(MGAREG_WR62, regs[MGA_TEXREG_HEIGHT] | 0x40); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); - PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); - - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -#define TMC_map1_enable 0x80000000 - -static void mgaG400EmitTex1(drm_mga_private_t * dev_priv) +static inline void mga_g200_emit_tex0( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[1]; - PRIMLOCALS; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; + DMA_LOCALS; - PRIMGETPTR(dev_priv); + BEGIN_DMA( 4 ); - /* This takes 25 dwords */ + DMA_BLOCK( MGA_TEXCTL2, tex->texctl2, + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); - PRIMOUTREG(MGAREG_TEXCTL2, - regs[MGA_TEXREG_CTL2] | TMC_map1_enable | 0x00008000); - PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); - PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); - PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); - PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); - PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); - PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); - PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR24, tex->texwidth ); - PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); - PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_WR49, 0); + DMA_BLOCK( MGA_WR34, tex->texheight, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff, + MGA_DMAPAD, 0x00000000 ); - PRIMOUTREG(MGAREG_WR57, 0); - PRIMOUTREG(MGAREG_WR53, 0); - PRIMOUTREG(MGAREG_WR61, 0); - PRIMOUTREG(MGAREG_WR52, regs[MGA_TEXREG_WIDTH] | 0x40); - - PRIMOUTREG(MGAREG_WR60, regs[MGA_TEXREG_HEIGHT] | 0x40); - PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); - PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); - PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); + ADVANCE_DMA(); +} - PRIMADVANCE(dev_priv); +static inline void mga_g400_emit_tex0( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; + DMA_LOCALS; + + BEGIN_DMA( 6 ); + + DMA_BLOCK( MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC, + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); + + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); + + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR49, 0x00000000 ); + + DMA_BLOCK( MGA_WR57, 0x00000000, + MGA_WR53, 0x00000000, + MGA_WR61, 0x00000000, + MGA_WR52, MGA_G400_WR_MAGIC ); + + DMA_BLOCK( MGA_WR60, MGA_G400_WR_MAGIC, + MGA_WR54, tex->texwidth | MGA_G400_WR_MAGIC, + MGA_WR62, tex->texheight | MGA_G400_WR_MAGIC, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff ); + + ADVANCE_DMA(); } -#define MAGIC_FPARAM_HEX_VALUE 0x46480000 -/* This is the hex value of 12800.0f which is a magic value we must - * set in wr56. - */ +static inline void mga_g400_emit_tex1( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[1]; + DMA_LOCALS; + + BEGIN_DMA( 5 ); + + DMA_BLOCK( MGA_TEXCTL2, (tex->texctl2 | + MGA_MAP1_ENABLE | + MGA_G400_TC2_MAGIC), + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); + + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); + + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR49, 0x00000000 ); + + DMA_BLOCK( MGA_WR57, 0x00000000, + MGA_WR53, 0x00000000, + MGA_WR61, 0x00000000, + MGA_WR52, tex->texwidth | MGA_G400_WR_MAGIC ); + + DMA_BLOCK( MGA_WR60, tex->texheight | MGA_G400_WR_MAGIC, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff, + MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC ); + + ADVANCE_DMA(); +} -static void mgaG400EmitPipe(drm_mga_private_t * dev_priv) +static inline void mga_g200_emit_pipe( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int pipe = sarea_priv->WarpPipe; - PRIMLOCALS; + unsigned int pipe = sarea_priv->warp_pipe; + DMA_LOCALS; - PRIMGETPTR(dev_priv); + BEGIN_DMA( 3 ); - /* This takes 50 dwords */ + DMA_BLOCK( MGA_WIADDR, MGA_WMODE_SUSPEND, + MGA_WVRTXSZ, 0x00000007, + MGA_WFLAG, 0x00000000, + MGA_WR24, 0x00000000 ); - /* Establish vertex size. + DMA_BLOCK( MGA_WR25, 0x00000100, + MGA_WR34, 0x00000000, + MGA_WR42, 0x0000ffff, + MGA_WR60, 0x0000ffff ); + + /* Padding required to to hardware bug. */ - PRIMOUTREG(MGAREG_WIADDR2, WIA_wmode_suspend); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - if (pipe & MGA_T2) { - PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001e09); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x1e000000); + DMA_BLOCK( MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_WIADDR, (dev_priv->warp_pipe_phys[pipe] | + MGA_WMODE_START | + MGA_WAGP_ENABLE) ); + + ADVANCE_DMA(); +} + +static inline void mga_g400_emit_pipe( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int pipe = sarea_priv->warp_pipe; + DMA_LOCALS; + + BEGIN_DMA( 10 ); + + DMA_BLOCK( MGA_WIADDR2, MGA_WMODE_SUSPEND, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + if ( pipe & MGA_T2 ) { + DMA_BLOCK( MGA_WVRTXSZ, 0x00001e09, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x1e000000 ); } else { - if (dev_priv->WarpPipe & MGA_T2) { + if ( dev_priv->warp_pipe & MGA_T2 ) { /* Flush the WARP pipe */ - PRIMOUTREG(MGAREG_YDST, 0); - PRIMOUTREG(MGAREG_FXLEFT, 0); - PRIMOUTREG(MGAREG_FXRIGHT, 1); - PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); - - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); - - PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); - PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000); - PRIMOUTREG(MGAREG_DMAPAD, 0); + DMA_BLOCK( MGA_YDST, 0x00000000, + MGA_FXLEFT, 0x00000000, + MGA_FXRIGHT, 0x00000001, + MGA_DWGCTL, MGA_DWGCTL_FLUSH ); + + DMA_BLOCK( MGA_LEN + MGA_EXEC, 0x00000001, + MGA_DWGSYNC, 0x00007000, + MGA_TEXCTL2, MGA_G400_TC2_MAGIC, + MGA_LEN + MGA_EXEC, 0x00000000 ); + + DMA_BLOCK( MGA_TEXCTL2, (MGA_DUALTEX | + MGA_G400_TC2_MAGIC), + MGA_LEN + MGA_EXEC, 0x00000000, + MGA_TEXCTL2, MGA_G400_TC2_MAGIC, + MGA_DMAPAD, 0x00000000 ); } - PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + DMA_BLOCK( MGA_WVRTXSZ, 0x00001807, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x18000000); + DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x18000000 ); } - PRIMOUTREG(MGAREG_WFLAG, 0); - PRIMOUTREG(MGAREG_WFLAG1, 0); - PRIMOUTREG(MGAREG_WR56, MAGIC_FPARAM_HEX_VALUE); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMOUTREG(MGAREG_WR49, 0); /* Tex stage 0 */ - PRIMOUTREG(MGAREG_WR57, 0); /* Tex stage 0 */ - PRIMOUTREG(MGAREG_WR53, 0); /* Tex stage 1 */ - PRIMOUTREG(MGAREG_WR61, 0); /* Tex stage 1 */ - - PRIMOUTREG(MGAREG_WR54, 0x40); /* Tex stage 0 : w */ - PRIMOUTREG(MGAREG_WR62, 0x40); /* Tex stage 0 : h */ - PRIMOUTREG(MGAREG_WR52, 0x40); /* Tex stage 1 : w */ - PRIMOUTREG(MGAREG_WR60, 0x40); /* Tex stage 1 : h */ - - /* Dma pading required due to hw bug */ - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_WIADDR2, - (u32) (dev_priv->WarpIndex[pipe]. - phys_addr | WIA_wmode_start | WIA_wagp_agp)); - PRIMADVANCE(dev_priv); + DMA_BLOCK( MGA_WFLAG, 0x00000000, + MGA_WFLAG1, 0x00000000, + MGA_WR56, MGA_G400_WR56_MAGIC, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_WR49, 0x00000000, /* tex0 */ + MGA_WR57, 0x00000000, /* tex0 */ + MGA_WR53, 0x00000000, /* tex1 */ + MGA_WR61, 0x00000000 ); /* tex1 */ + + DMA_BLOCK( MGA_WR54, MGA_G400_WR_MAGIC, /* tex0 width */ + MGA_WR62, MGA_G400_WR_MAGIC, /* tex0 height */ + MGA_WR52, MGA_G400_WR_MAGIC, /* tex1 width */ + MGA_WR60, MGA_G400_WR_MAGIC ); /* tex1 height */ + + /* Padding required to to hardware bug */ + DMA_BLOCK( MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_WIADDR2, (dev_priv->warp_pipe_phys[pipe] | + MGA_WMODE_START | + MGA_WAGP_ENABLE) ); + + ADVANCE_DMA(); } -static void mgaG200EmitPipe(drm_mga_private_t * dev_priv) +static void mga_g200_emit_state( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int pipe = sarea_priv->WarpPipe; - PRIMLOCALS; - - PRIMGETPTR(dev_priv); - - /* This takes 15 dwords */ - - PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend); - PRIMOUTREG(MGAREG_WVRTXSZ, 7); - PRIMOUTREG(MGAREG_WFLAG, 0); - PRIMOUTREG(MGAREG_WR24, 0); /* tex w/h */ + unsigned int dirty = sarea_priv->dirty; - PRIMOUTREG(MGAREG_WR25, 0x100); - PRIMOUTREG(MGAREG_WR34, 0); /* tex w/h */ - PRIMOUTREG(MGAREG_WR42, 0xFFFF); - PRIMOUTREG(MGAREG_WR60, 0xFFFF); + if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { + mga_g200_emit_pipe( dev_priv ); + dev_priv->warp_pipe = sarea_priv->warp_pipe; + } - /* Dma pading required due to hw bug */ - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_WIADDR, - (u32) (dev_priv->WarpIndex[pipe]. - phys_addr | WIA_wmode_start | WIA_wagp_agp)); + if ( dirty & MGA_UPLOAD_CONTEXT ) { + mga_g200_emit_context( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; + } - PRIMADVANCE( dev_priv ); + if ( dirty & MGA_UPLOAD_TEX0 ) { + mga_g200_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; + } } -static void mgaEmitState(drm_mga_private_t * dev_priv) +static void mga_g400_emit_state( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int dirty = sarea_priv->dirty; + int multitex = sarea_priv->warp_pipe & MGA_T2; - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - int multitex = sarea_priv->WarpPipe & MGA_T2; - - if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { - mgaG400EmitPipe(dev_priv); - dev_priv->WarpPipe = sarea_priv->WarpPipe; - } - - if (dirty & MGA_UPLOAD_CTX) { - mgaEmitContext(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_CTX; - } - - if (dirty & MGA_UPLOAD_TEX0) { - mgaG400EmitTex0(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; - } + if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { + mga_g400_emit_pipe( dev_priv ); + dev_priv->warp_pipe = sarea_priv->warp_pipe; + } - if ((dirty & MGA_UPLOAD_TEX1) && multitex) { - mgaG400EmitTex1(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; - } - } else { - if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { - mgaG200EmitPipe(dev_priv); - dev_priv->WarpPipe = sarea_priv->WarpPipe; - } + if ( dirty & MGA_UPLOAD_CONTEXT ) { + mga_g400_emit_context( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; + } - if (dirty & MGA_UPLOAD_CTX) { - mgaEmitContext(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_CTX; - } + if ( dirty & MGA_UPLOAD_TEX0 ) { + mga_g400_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; + } - if (dirty & MGA_UPLOAD_TEX0) { - mgaG200EmitTex(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; - } + if ( (dirty & MGA_UPLOAD_TEX1) && multitex ) { + mga_g400_emit_tex1( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; } } + +/* ================================================================ + * SAREA state verification + */ + /* Disallow all write destinations except the front and backbuffer. */ -static int mgaVerifyContext(drm_mga_private_t * dev_priv) +static int mga_verify_context( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - - if (regs[MGA_CTXREG_DSTORG] != dev_priv->frontOffset && - regs[MGA_CTXREG_DSTORG] != dev_priv->backOffset) { - DRM_DEBUG("BAD DSTORG: %x (front %x, back %x)\n\n", - regs[MGA_CTXREG_DSTORG], dev_priv->frontOffset, - dev_priv->backOffset); - regs[MGA_CTXREG_DSTORG] = 0; - return -1; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + + if ( ctx->dstorg != dev_priv->front_offset && + ctx->dstorg != dev_priv->back_offset ) { + DRM_DEBUG( "*** bad DSTORG: %x (front %x, back %x)\n\n", + ctx->dstorg, dev_priv->front_offset, + dev_priv->back_offset ); + ctx->dstorg = 0; + return -EINVAL; } return 0; @@ -424,720 +420,644 @@ static int mgaVerifyContext(drm_mga_private_t * dev_priv) /* Disallow texture reads from PCI space. */ -static int mgaVerifyTex(drm_mga_private_t * dev_priv, int unit) +static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[unit]; + unsigned int org; - if ((sarea_priv->TexState[unit][MGA_TEXREG_ORG] & 0x3) == 0x1) { - DRM_DEBUG("BAD TEXREG_ORG: %x, unit %d\n", - sarea_priv->TexState[unit][MGA_TEXREG_ORG], - unit); - sarea_priv->TexState[unit][MGA_TEXREG_ORG] = 0; - return -1; + org = tex->texorg & (MGA_TEXORGMAP_MASK | MGA_TEXORGACC_MASK); + + if ( org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI) ) { + DRM_DEBUG( "*** bad TEXORG: 0x%x, unit %d\n", + tex->texorg, unit ); + tex->texorg = 0; + return -EINVAL; } return 0; } -static int mgaVerifyState(drm_mga_private_t * dev_priv) +static int mga_verify_state( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int dirty = sarea_priv->dirty; - int rv = 0; + int ret = 0; - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - if (dirty & MGA_UPLOAD_CTX) - rv |= mgaVerifyContext(dev_priv); + if ( dirty & MGA_UPLOAD_CONTEXT ) + ret |= mga_verify_context( dev_priv ); - if (dirty & MGA_UPLOAD_TEX0) - rv |= mgaVerifyTex(dev_priv, 0); + if ( dirty & MGA_UPLOAD_TEX0 ) + ret |= mga_verify_tex( dev_priv, 0 ); - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - if (dirty & MGA_UPLOAD_TEX1) - rv |= mgaVerifyTex(dev_priv, 1); + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { + if ( dirty & MGA_UPLOAD_TEX1 ) + ret |= mga_verify_tex( dev_priv, 1 ); - if (dirty & MGA_UPLOAD_PIPE) - rv |= (sarea_priv->WarpPipe > MGA_MAX_G400_PIPES); + if ( dirty & MGA_UPLOAD_PIPE ) + ret |= ( sarea_priv->warp_pipe > MGA_MAX_G400_PIPES ); } else { - if (dirty & MGA_UPLOAD_PIPE) - rv |= (sarea_priv->WarpPipe > MGA_MAX_G200_PIPES); + if ( dirty & MGA_UPLOAD_PIPE ) + ret |= ( sarea_priv->warp_pipe > MGA_MAX_G200_PIPES ); } - return rv == 0; + return ( ret == 0 ); } -static int mgaVerifyIload(drm_mga_private_t * dev_priv, - unsigned long bus_address, - unsigned int dstOrg, int length) +static int mga_verify_iload( drm_mga_private_t *dev_priv, + unsigned int dstorg, unsigned int length ) { - if (dstOrg < dev_priv->textureOffset || - dstOrg + length > - (dev_priv->textureOffset + dev_priv->textureSize)) { + if ( dstorg < dev_priv->texture_offset || + dstorg + length > (dev_priv->texture_offset + + dev_priv->texture_size) ) { return -EINVAL; } - if (length % 64) { + + if ( length & MGA_ILOAD_MASK ) { + return -EINVAL; + } + + return 0; +} + +static int mga_verify_blit( drm_mga_private_t *dev_priv, + unsigned int srcorg, unsigned int dstorg ) +{ + if ( (srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || + (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) { return -EINVAL; } return 0; } -/* This copies a 64 byte aligned agp region to the frambuffer - * with a standard blit, the ioctl needs to do checking */ -static void mga_dma_dispatch_tex_blit(drm_device_t * dev, - unsigned long bus_address, - int length, unsigned int destOrg) +/* ================================================================ + * + */ + +static void mga_dma_dispatch_clear( drm_device_t *dev, + drm_mga_clear_t *clear ) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - int use_agp = PDEA_pagpxfer_enable | 0x00000001; - u16 y2; - PRIMLOCALS; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int nbox = sarea_priv->nbox; + int i; + DMA_LOCALS; + DRM_DEBUG( __FUNCTION__ ":\n" ); - y2 = length / 64; + for ( i = 0 ; i < nbox ; i++ ) { + drm_clip_rect_t *box = &pbox[i]; + u32 height = box->y2 - box->y1; + + DRM_DEBUG( " from=%d,%d to=%d,%d\n", + box->x1, box->y1, box->x2, box->y2 ); + + if ( clear->flags & MGA_FRONT ) { + BEGIN_DMA( 2 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->color_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_color, + MGA_DSTORG, dev_priv->front_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); + + ADVANCE_DMA(); + } + + + if ( clear->flags & MGA_BACK ) { + BEGIN_DMA( 2 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->color_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_color, + MGA_DSTORG, dev_priv->back_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); + + ADVANCE_DMA(); + } + + if ( clear->flags & MGA_DEPTH ) { + BEGIN_DMA( 2 ); - PRIM_OVERFLOW(dev, dev_priv, 30); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->depth_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); - PRIMOUTREG(MGAREG_DSTORG, destOrg); - PRIMOUTREG(MGAREG_MACCESS, 0x00000000); - PRIMOUTREG(MGAREG_SRCORG, (u32) bus_address | use_agp); - PRIMOUTREG(MGAREG_AR5, 64); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_depth, + MGA_DSTORG, dev_priv->depth_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); - PRIMOUTREG(MGAREG_PITCH, 64); - PRIMOUTREG(MGAREG_PLNWT, ~0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); + ADVANCE_DMA(); + } + + } + + BEGIN_DMA( 1 ); - PRIMOUTREG(MGAREG_AR0, 63); - PRIMOUTREG(MGAREG_AR3, 0); - PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16)); - PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2); + /* Force reset of DWGCTL */ + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); + + ADVANCE_DMA(); - PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]); - PRIMOUTREG(MGAREG_SRCORG, 0); - PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - PRIMADVANCE(dev_priv); + FLUSH_DMA(); } -static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) +static void mga_dma_dispatch_swap( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int nbox = sarea_priv->nbox; + int i; + DMA_LOCALS; + DRM_DEBUG( __FUNCTION__ ":\n" ); + + sarea_priv->last_frame.head = dev_priv->prim.tail; + sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap; + + BEGIN_DMA( 4 + nbox ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + DMA_BLOCK( MGA_DSTORG, dev_priv->front_offset, + MGA_MACCESS, dev_priv->maccess, + MGA_SRCORG, dev_priv->back_offset, + MGA_AR5, dev_priv->front_pitch ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_PLNWT, 0xffffffff, + MGA_DWGCTL, MGA_DWGCTL_COPY ); + + for ( i = 0 ; i < nbox ; i++ ) { + drm_clip_rect_t *box = &pbox[i]; + u32 height = box->y2 - box->y1; + u32 start = box->y1 * dev_priv->front_pitch; + + DRM_DEBUG( " from=%d,%d to=%d,%d\n", + box->x1, box->y1, box->x2, box->y2 ); + + DMA_BLOCK( MGA_AR0, start + box->x2 - 1, + MGA_AR3, start + box->x1, + MGA_FXBNDRY, ((box->x2 - 1) << 16) | box->x1, + MGA_YDSTLEN + MGA_EXEC, + (box->y1 << 16) | height ); + } + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_SRCORG, dev_priv->front_offset, + MGA_DWGCTL, ctx->dwgctl ); + + ADVANCE_DMA(); + + FLUSH_DMA(); + + DRM_DEBUG( "%s... done.\n", __FUNCTION__ ); +} + +static void mga_dma_dispatch_vertex( drm_device_t *dev, drm_buf_t *buf ) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned long address = (unsigned long) buf->bus_address; - int length = buf->used; - int use_agp = PDEA_pagpxfer_enable; + u32 address = (u32) buf->bus_address; + u32 length = (u32) buf->used; int i = 0; - PRIMLOCALS; + DMA_LOCALS; + DRM_DEBUG( "vertex: buf=%d used=%d\n", buf->idx, buf->used ); - if (buf->used) { - /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). - */ + if ( buf->used ) { buf_priv->dispatched = 1; - PRIM_OVERFLOW(dev, dev_priv, - (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); - mgaEmitState(dev_priv); -#if 0 - length = dev_priv->vertexsize * 3 * 4; -#endif + MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); do { - if (i < sarea_priv->nbox) { - mgaEmitClipRect(dev_priv, - &sarea_priv->boxes[i]); + if ( i < sarea_priv->nbox ) { + mga_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); } - PRIMGETPTR(dev_priv); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_SECADDRESS, - ((u32) address) | TT_VERTEX); - PRIMOUTREG(MGAREG_SECEND, - (((u32) (address + length)) | use_agp)); - PRIMADVANCE(dev_priv); - } while (++i < sarea_priv->nbox); + BEGIN_DMA( 1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_SECADDRESS, (address | + MGA_DMA_VERTEX), + MGA_SECEND, ((address + length) | + MGA_PAGPXFER) ); + + ADVANCE_DMA(); + } while ( ++i < sarea_priv->nbox ); } - if (buf_priv->discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); + + if ( buf_priv->discard ) { + AGE_BUFFER( buf_priv ); + buf->pending = 0; + buf->used = 0; buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); - } + mga_freelist_put( dev, buf ); + } + FLUSH_DMA(); } - -static void mga_dma_dispatch_indices(drm_device_t * dev, - drm_buf_t * buf, - unsigned int start, unsigned int end) +static void mga_dma_dispatch_indices( drm_device_t *dev, drm_buf_t *buf, + unsigned int start, unsigned int end ) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int address = (unsigned int) buf->bus_address; - int use_agp = PDEA_pagpxfer_enable; + u32 address = (u32) buf->bus_address; int i = 0; - PRIMLOCALS; + DMA_LOCALS; + DRM_DEBUG( "indices: buf=%d start=%d end=%d\n", buf->idx, start, end ); - if (start != end) { - /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). - */ + if ( start != end ) { buf_priv->dispatched = 1; - PRIM_OVERFLOW(dev, dev_priv, - (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); - mgaEmitState(dev_priv); + + MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); do { - if (i < sarea_priv->nbox) { - mgaEmitClipRect(dev_priv, - &sarea_priv->boxes[i]); + if ( i < sarea_priv->nbox ) { + mga_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); } - PRIMGETPTR(dev_priv); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_SETUPADDRESS, - ((address + start) | - SETADD_mode_vertlist)); - PRIMOUTREG(MGAREG_SETUPEND, - ((address + end) | use_agp)); -/* ((address + start + 12) | use_agp)); */ - PRIMADVANCE(dev_priv); - } while (++i < sarea_priv->nbox); - } - if (buf_priv->discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); - buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); - } -} + BEGIN_DMA( 1 ); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_SETUPADDRESS, address + start, + MGA_SETUPEND, ((address + end) | + MGA_PAGPXFER) ); -static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, - unsigned int clear_color, - unsigned int clear_zval, - unsigned int clear_colormask, - unsigned int clear_depthmask) -{ - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - unsigned int cmd; - int i; - PRIMLOCALS; - - if (dev_priv->sgram) - cmd = MGA_CLEAR_CMD | DC_atype_blk; - else - cmd = MGA_CLEAR_CMD | DC_atype_rstr; - - PRIM_OVERFLOW(dev, dev_priv, 35 * MGA_NR_SAREA_CLIPRECTS); - - for (i = 0; i < nbox; i++) { - unsigned int height = pbox[i].y2 - pbox[i].y1; - - if (flags & MGA_FRONT) { - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, clear_colormask); - PRIMOUTREG(MGAREG_YDSTLEN, - (pbox[i].y1 << 16) | height); - PRIMOUTREG(MGAREG_FXBNDRY, - (pbox[i].x2 << 16) | pbox[i].x1); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_FCOL, clear_color); - PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); - PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); - } + ADVANCE_DMA(); + } while ( ++i < sarea_priv->nbox ); + } - if (flags & MGA_BACK) { - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, clear_colormask); - PRIMOUTREG(MGAREG_YDSTLEN, - (pbox[i].y1 << 16) | height); - PRIMOUTREG(MGAREG_FXBNDRY, - (pbox[i].x2 << 16) | pbox[i].x1); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_FCOL, clear_color); - PRIMOUTREG(MGAREG_DSTORG, dev_priv->backOffset); - PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); - } + if ( buf_priv->discard ) { + AGE_BUFFER( buf_priv ); + buf->pending = 0; + buf->used = 0; + buf_priv->dispatched = 0; - if (flags & MGA_DEPTH) { - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, clear_depthmask); - PRIMOUTREG(MGAREG_YDSTLEN, - (pbox[i].y1 << 16) | height); - PRIMOUTREG(MGAREG_FXBNDRY, - (pbox[i].x2 << 16) | pbox[i].x1); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_FCOL, clear_zval); - PRIMOUTREG(MGAREG_DSTORG, dev_priv->depthOffset); - PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); - } + mga_freelist_put( dev, buf ); } - /* Force reset of DWGCTL */ - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); - PRIMADVANCE(dev_priv); + FLUSH_DMA(); } -static void mga_dma_dispatch_swap(drm_device_t * dev) +/* This copies a 64 byte aligned agp region to the frambuffer with a + * standard blit, the ioctl needs to do checking. + */ +static void mga_dma_dispatch_iload( drm_device_t *dev, drm_buf_t *buf, + unsigned int dstorg, unsigned int length ) { drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - int i; - int pixel_stride = dev_priv->stride / dev_priv->cpp; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_context_regs_t *ctx = &dev_priv->sarea_priv->context_state; + u32 srcorg = buf->bus_address | MGA_SRCACC_AGP | MGA_SRCMAP_SYSMEM; + u32 y2; + DMA_LOCALS; + DRM_DEBUG( "%s: buf=%d used=%d\n", + __FUNCTION__, buf->idx, buf->used ); + + y2 = length / 64; - PRIMLOCALS; + BEGIN_DMA( 4 ); - PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20); + DMA_BLOCK( MGA_DSTORG, dstorg, + MGA_MACCESS, 0x00000000, + MGA_SRCORG, srcorg, + MGA_AR5, 64 ); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7100); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + DMA_BLOCK( MGA_PITCH, 64, + MGA_PLNWT, 0xffffffff, + MGA_DMAPAD, 0x00000000, + MGA_DWGCTL, MGA_DWGCTL_COPY ); - PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); - PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess); - PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset); - PRIMOUTREG(MGAREG_AR5, pixel_stride); + DMA_BLOCK( MGA_AR0, 63, + MGA_AR3, 0, + MGA_FXBNDRY, (63 << 16) | 0, + MGA_YDSTLEN + MGA_EXEC, y2 ); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, ~0); - PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); + DMA_BLOCK( MGA_PLNWT, ctx->plnwt, + MGA_SRCORG, dev_priv->front_offset, + MGA_PITCH, dev_priv->front_pitch, + MGA_DWGSYNC, 0x00007000 ); - for (i = 0; i < nbox; i++) { - unsigned int h = pbox[i].y2 - pbox[i].y1; - unsigned int start = pbox[i].y1 * pixel_stride; + ADVANCE_DMA(); - PRIMOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1); - PRIMOUTREG(MGAREG_AR3, start + pbox[i].x1); - PRIMOUTREG(MGAREG_FXBNDRY, - pbox[i].x1 | ((pbox[i].x2 - 1) << 16)); - PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, - (pbox[i].y1 << 16) | h); - } + AGE_BUFFER( buf_priv ); - /* Force reset of DWGCTL */ - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]); - PRIMOUTREG(MGAREG_SRCORG, 0); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + buf->pending = 0; + buf->used = 0; + buf_priv->dispatched = 0; + + mga_freelist_put( dev, buf ); - PRIMADVANCE(dev_priv); + FLUSH_DMA(); } -/* #define BLIT_LEFT 1 */ -/* #define BLIT_UP 4 */ - -static void mga_dma_dispatch_blit(drm_device_t * dev, - unsigned int planemask, - unsigned int source, - unsigned int dest, - int delta_sx, int delta_sy, - int delta_dx, int delta_dy, - int source_pitch, - int dest_pitch, - int height, - int ydir) +static void mga_dma_dispatch_blit( drm_device_t *dev, + drm_mga_blit_t *blit ) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - int nbox = sarea_priv->nbox; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; drm_clip_rect_t *pbox = sarea_priv->boxes; - int pixel_stride = dev_priv->stride / dev_priv->cpp; + int nbox = sarea_priv->nbox; u32 scandir = 0, i; - - PRIMLOCALS; - - PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7100); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - - PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); - PRIMOUTREG(MGAREG_PLNWT, planemask); - PRIMOUTREG(MGAREG_SRCORG, source); - PRIMOUTREG(MGAREG_DSTORG, dest); - - PRIMOUTREG(MGAREG_SGN, scandir); - PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess); - PRIMOUTREG(MGAREG_AR5, ydir * source_pitch); - PRIMOUTREG(MGAREG_PITCH, dest_pitch); - - for (i = 0; i < nbox; i++) { - int srcx = pbox[i].x1 + delta_sx; - int srcy = pbox[i].y1 + delta_sy; - int dstx = pbox[i].x1 + delta_dx; - int dsty = pbox[i].y1 + delta_dy; + DMA_LOCALS; + DRM_DEBUG( __FUNCTION__ ":\n" ); + + BEGIN_DMA( 4 + nbox ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + DMA_BLOCK( MGA_DWGCTL, MGA_DWGCTL_COPY, + MGA_PLNWT, blit->planemask, + MGA_SRCORG, blit->srcorg, + MGA_DSTORG, blit->dstorg ); + + DMA_BLOCK( MGA_SGN, scandir, + MGA_MACCESS, dev_priv->maccess, + MGA_AR5, blit->ydir * blit->src_pitch, + MGA_PITCH, blit->dst_pitch ); + + for ( i = 0 ; i < nbox ; i++ ) { + int srcx = pbox[i].x1 + blit->delta_sx; + int srcy = pbox[i].y1 + blit->delta_sy; + int dstx = pbox[i].x1 + blit->delta_dx; + int dsty = pbox[i].y1 + blit->delta_dy; int h = pbox[i].y2 - pbox[i].y1; int w = pbox[i].x2 - pbox[i].x1 - 1; int start; - if (ydir == -1) { - srcy = height - srcy - 1; + if ( blit->ydir == -1 ) { + srcy = blit->height - srcy - 1; } - start = srcy * source_pitch + srcx; + start = srcy * blit->src_pitch + srcx; - PRIMOUTREG(MGAREG_AR0, start + w); - PRIMOUTREG(MGAREG_AR3, start); - PRIMOUTREG(MGAREG_FXBNDRY, ((dstx+w) << 16) | (dstx & 0xffff)); - PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, (dsty << 16) | h); + DMA_BLOCK( MGA_AR0, start + w, + MGA_AR3, start, + MGA_FXBNDRY, ((dstx + w) << 16) | (dstx & 0xffff), + MGA_YDSTLEN + MGA_EXEC, (dsty << 16) | h ); } /* Do something to flush AGP? */ /* Force reset of DWGCTL */ - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]); - PRIMOUTREG(MGAREG_PITCH, pixel_stride); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_PITCH, dev_priv->front_pitch, + MGA_DWGCTL, ctx->dwgctl ); - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -int mga_blit(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +/* ================================================================ + * + */ + +int mga_dma_clear( 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_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_blit_t blit; + drm_mga_clear_t clear; - if (copy_from_user(&blit, (drm_mga_blit_t *) arg, sizeof(blit))) - return -EFAULT; - - DRM_DEBUG("%s\n", __FUNCTION__); + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_blit_bufs called without lock held\n"); - return -EINVAL; - } + if ( copy_from_user( &clear, (drm_mga_clear_t *) arg, sizeof(clear) ) ) + return -EFAULT; - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; - - if ((blit.source & 0x3) != (SO_srcmap_sys|SO_srcacc_pci) && - (blit.dest & 0x3) != (SO_srcmap_sys|SO_srcacc_pci)) - { - mga_dma_dispatch_blit(dev, - blit.planemask, - blit.source, - blit.dest, - blit.delta_sx, blit.delta_sy, - blit.delta_dx, blit.delta_dy, - blit.source_pitch, - blit.dest_pitch, - blit.height, - blit.ydir); - } + WRAP_TEST_WITH_RETURN( dev_priv ); + mga_dma_dispatch_clear( dev, &clear ); - PRIMUPDATE(dev_priv); + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; -#ifdef __i386__ - mga_flush_write_combine(); -#endif - mga_dma_schedule(dev, 1); return 0; } - -int mga_clear_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_swap( 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_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_mga_clear_t clear; - - if (copy_from_user(&clear, (drm_mga_clear_t *) arg, sizeof(clear))) - return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_clear_bufs called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; - mga_dma_dispatch_clear(dev, clear.flags, - clear.clear_color, - clear.clear_depth, - clear.clear_color_mask, - clear.clear_depth_mask); - PRIMUPDATE(dev_priv); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); - return 0; -} - -int mga_swap_bufs(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_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_swap_bufs called without lock held\n"); - return -EINVAL; - } + WRAP_TEST_WITH_RETURN( dev_priv ); - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + mga_dma_dispatch_swap( dev ); /* Make sure we restore the 3D state next time. */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; - mga_dma_dispatch_swap(dev); - PRIMUPDATE(dev_priv); - set_bit(MGA_BUF_SWAP_PENDING, - &dev_priv->current_prim->buffer_status); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + return 0; } -int mga_iload(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_vertex( 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_mga_private_t *dev_priv = dev->dev_private; drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_buf_t *buf; drm_mga_buf_priv_t *buf_priv; - drm_mga_iload_t iload; - unsigned long bus_address; + drm_mga_vertex_t vertex; - if (copy_from_user(&iload, (drm_mga_iload_t *) arg, sizeof(iload))) - return -EFAULT; + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_iload called without lock held\n"); - return -EINVAL; - } + if ( copy_from_user( &vertex, + (drm_mga_vertex_t *)arg, + sizeof(vertex) ) ) + return -EFAULT; - buf = dma->buflist[iload.idx]; + buf = dma->buflist[vertex.idx]; buf_priv = buf->dev_private; - bus_address = buf->bus_address; - if (mgaVerifyIload(dev_priv, - bus_address, iload.destOrg, iload.length)) { - mga_freelist_put(dev, buf); + buf->used = vertex.used; + buf_priv->discard = vertex.discard; + + if ( !mga_verify_state( dev_priv ) ) { + if ( vertex.discard ) { + if ( buf_priv->dispatched == 1 ) + AGE_BUFFER( buf_priv ); + buf_priv->dispatched = 0; + mga_freelist_put( dev, buf ); + } return -EINVAL; } - sarea_priv->dirty |= MGA_UPLOAD_CTX; + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_vertex( dev, buf ); - mga_dma_dispatch_tex_blit(dev, bus_address, iload.length, - iload.destOrg); - AGEBUF(dev_priv, buf_priv); - buf_priv->discard = 1; - mga_freelist_put(dev, buf); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); return 0; } -int mga_vertex(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_indices( 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_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; drm_device_dma_t *dma = dev->dma; drm_buf_t *buf; drm_mga_buf_priv_t *buf_priv; - drm_mga_vertex_t vertex; + drm_mga_indices_t indices; - if (copy_from_user(&vertex, (drm_mga_vertex_t *) arg, sizeof(vertex))) - return -EFAULT; + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_vertex called without lock held\n"); - return -EINVAL; - } + if ( copy_from_user( &indices, + (drm_mga_indices_t *)arg, + sizeof(indices) ) ) + return -EFAULT; - buf = dma->buflist[vertex.idx]; + buf = dma->buflist[indices.idx]; buf_priv = buf->dev_private; - buf->used = vertex.used; - buf_priv->discard = vertex.discard; + buf_priv->discard = indices.discard; - if (!mgaVerifyState(dev_priv)) { - if (vertex.discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); + if ( !mga_verify_state( dev_priv ) ) { + if ( indices.discard ) { + if ( buf_priv->dispatched == 1 ) + AGE_BUFFER( buf_priv ); buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); + mga_freelist_put( dev, buf ); } return -EINVAL; } - mga_dma_dispatch_vertex(dev, buf); + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_indices( dev, buf, indices.start, indices.end ); - PRIMUPDATE(dev_priv); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); return 0; } - -int mga_indices(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_iload( 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_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = dev->dev_private; drm_buf_t *buf; drm_mga_buf_priv_t *buf_priv; - drm_mga_indices_t indices; + drm_mga_iload_t iload; + DRM_DEBUG( __FUNCTION__ ":\n" ); - if (copy_from_user(&indices, - (drm_mga_indices_t *)arg, sizeof(indices))) + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &iload, (drm_mga_iload_t *)arg, sizeof(iload) ) ) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_indices called without lock held\n"); - return -EINVAL; - } + if ( mga_do_wait_for_idle( dev_priv ) < 0 ) + return -EBUSY; - buf = dma->buflist[indices.idx]; + buf = dma->buflist[iload.idx]; buf_priv = buf->dev_private; - buf_priv->discard = indices.discard; - - if (!mgaVerifyState(dev_priv)) { - if (indices.discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); - buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); - } +#if 0 + DRM_INFO( " verifying iload...\n" ); + if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) { + mga_freelist_put( dev, buf ); return -EINVAL; } + DRM_INFO( " verifying iload... done.\n" ); +#endif - mga_dma_dispatch_indices(dev, buf, indices.start, indices.end); - - PRIMUPDATE(dev_priv); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); - return 0; -} - + WRAP_TEST_WITH_RETURN( dev_priv ); + mga_dma_dispatch_iload( dev, buf, iload.dstorg, iload.length ); -static int mga_dma_get_buffers(drm_device_t * dev, drm_dma_t * d) -{ - int i; - drm_buf_t *buf; + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - for (i = d->granted_count; i < d->request_count; i++) { - buf = mga_freelist_get(dev); - if (!buf) - break; - buf->pid = current->pid; - if (copy_to_user(&d->request_indices[i], - &buf->idx, sizeof(buf->idx))) - return -EFAULT; - if (copy_to_user(&d->request_sizes[i], - &buf->total, sizeof(buf->total))) - return -EFAULT; - ++d->granted_count; - } return 0; } -int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int mga_dma_blit( 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_device_dma_t *dma = dev->dma; - int retcode = 0; - drm_dma_t d; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_blit_t blit; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); - if (copy_from_user(&d, (drm_dma_t *) arg, sizeof(d))) + if ( copy_from_user( &blit, (drm_mga_blit_t *)arg, sizeof(blit) ) ) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_dma called without lock held\n"); - return -EINVAL; - } + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - /* Please don't send us buffers. - */ - if (d.send_count != 0) { - DRM_ERROR - ("Process %d trying to send %d buffers via drmDMA\n", - current->pid, d.send_count); + if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) ) return -EINVAL; - } - /* We'll send you buffers. - */ - if (d.request_count < 0 || d.request_count > dma->buf_count) { - DRM_ERROR - ("Process %d trying to get %d buffers (of %d max)\n", - current->pid, d.request_count, dma->buf_count); - return -EINVAL; - } + WRAP_TEST_WITH_RETURN( dev_priv ); - d.granted_count = 0; + mga_dma_dispatch_blit( dev, &blit ); - if (d.request_count) { - retcode = mga_dma_get_buffers(dev, &d); - } + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - if (copy_to_user((drm_dma_t *) arg, &d, sizeof(d))) - return -EFAULT; - return retcode; + return 0; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h new file mode 100644 index 000000000..fa0f82ec9 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h @@ -0,0 +1,11645 @@ +/* mga_ucode.h -- Matrox G200/G400 WARP engine microcode -*- linux-c -*- + * Created: Thu Jan 11 21:20:43 2001 by gareth@valinux.com + * + * Copyright 1999 Matrox Graphics Inc. + * 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 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 + * MATROX GRAPHICS INC., 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. + * + * Kernel-based WARP engine management: + * Gareth Hughes <gareth@valinux.com> + */ + +/* + * WARP pipes are named according to the functions they perform, where: + * + * - T stands for computation of texture stage 0 + * - T2 stands for computation of both texture stage 0 and texture stage 1 + * - G stands for computation of triangle intensity (Gouraud interpolation) + * - Z stands for computation of Z buffer interpolation + * - S stands for computation of specular highlight + * - A stands for computation of the alpha channel + * - F stands for computation of vertex fog interpolation + */ + +static unsigned char warp_g200_tgz[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x72, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x60, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x03, 0x80, 0x0A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x57, 0x39, 0x20, 0xE9, +0x28, 0x19, 0x60, 0xEC, + +0x2B, 0x32, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0xB3, 0x05, +0x00, 0xE0, +0x16, 0x28, 0x20, 0xE9, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x2B, 0x20, 0xE9, + +0x1C, 0x80, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x85, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x84, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x82, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x7F, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgza[] = { + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x7D, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x1F, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x3F, 0x3D, 0x5D, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x00, 0x80, 0x00, 0xE8, + +0x23, 0x3B, 0x33, 0xAD, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0x26, 0x1F, 0xDF, +0x9D, 0x1F, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x9E, 0x3F, 0x4F, 0xE9, + +0x07, 0x07, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x9C, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x7A, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x79, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x77, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x74, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzaf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x83, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6F, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x00, 0xE0, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0x17, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x2D, 0x20, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x1F, 0x62, 0x57, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x3F, 0x3D, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x17, 0x26, 0x17, 0xDF, + +0x23, 0x3B, 0x33, 0xAD, +0x35, 0x17, 0x4F, 0xE9, + +0x1F, 0x26, 0x1F, 0xDF, +0x9D, 0x1F, 0x4F, 0xE9, + +0x9E, 0x3F, 0x4F, 0xE9, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x07, 0x07, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x9C, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x74, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x73, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x71, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x6E, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x7F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x17, 0x50, 0x56, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x00, 0x80, 0x00, 0xE8, + +0x23, 0x3B, 0x33, 0xAD, +0x00, 0x80, 0x00, 0xE8, + +0x17, 0x26, 0x17, 0xDF, +0x35, 0x17, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x78, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x77, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x75, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x72, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzs[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8B, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x77, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x8F, 0x20, + +0xA5, 0x37, 0x4F, 0xE9, +0x0F, 0x17, 0x0F, 0xAF, + +0x06, 0xC0, 0x21, 0xC4, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x06, 0x06, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x6C, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x6B, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x69, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsa[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x7B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x44, 0x4C, 0xB6, +0x05, 0x44, 0x54, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x00, 0x80, 0x00, 0xE8, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2F, 0xC0, 0x44, 0xC6, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0x9D, 0x17, 0x4F, 0xE9, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x00, 0xE0, +0xAF, 0x20, + +0x9E, 0x37, 0x4F, 0xE9, +0x2F, 0x17, 0x2F, 0xAF, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x9C, 0x80, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x68, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x67, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x65, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsaf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x94, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x80, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x2D, 0x20, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x3E, 0x3D, 0x5D, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x2F, 0x20, +0x00, 0xE0, +0xA3, 0x0F, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0xA1, 0x1F, 0x4F, 0xE9, + +0x1E, 0x26, 0x1E, 0xDF, +0x9D, 0x1E, 0x4F, 0xE9, + +0x35, 0x17, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x07, 0x07, 0x1E, 0xAF, + +0xA0, 0x80, 0x4F, 0xE9, +0x9E, 0x3E, 0x4F, 0xE9, + +0x31, 0x80, 0x4F, 0xE9, +0x9C, 0x80, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x63, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x60, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x5D, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x7B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2F, 0x20, +0x00, 0xE0, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0x35, 0x17, 0x4F, 0xE9, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x68, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x67, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x65, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g400_t2gz[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x78, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x69, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x25, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9F, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBE, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x7D, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gza[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x7C, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x6D, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x29, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x74, 0xC6, +0x3D, 0xCF, 0x74, 0xC2, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9B, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBA, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x79, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzaf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x81, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x72, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x37, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x0F, 0xCF, 0x74, 0xC6, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x75, 0xC6, +0x00, 0x80, 0x00, 0xE8, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x45, 0x55, 0xB6, +0x02, 0x45, 0x65, 0xB6, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x96, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xB5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x74, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x7D, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x6E, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x39, 0xE5, 0x2C, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x88, 0x73, 0x5E, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0F, 0xCF, 0x75, 0xC6, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x28, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x45, 0x55, 0xB6, +0x1A, 0x45, 0x65, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9A, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBB, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x78, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzs[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x85, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x76, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x31, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x20, +0x1A, 0x20, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0xA7, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x92, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xB2, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x70, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsa[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8A, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7B, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x36, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x8D, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xAD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x6B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsaf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8E, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7F, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x3A, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x45, 0x55, 0xB6, +0x02, 0x45, 0x65, 0xB6, + +0x3D, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x89, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xA9, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x67, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8A, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7B, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x36, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB6, +0x1A, 0x45, 0x65, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x8D, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xAD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x6B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgz[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x58, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4A, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x1D, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAF, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD6, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x9D, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgza[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x5C, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4E, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x27, 0xCF, 0x74, 0xC6, +0x3D, 0xCF, 0x74, 0xC2, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x20, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAB, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD3, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x99, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzaf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x61, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x53, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x37, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x26, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x27, 0xCF, 0x74, 0xC6, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x75, 0xC6, +0x00, 0x80, 0x00, 0xE8, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x45, 0x4D, 0xB6, +0x02, 0x45, 0x55, 0xB6, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xA6, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xCD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x94, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x5D, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4F, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x39, 0xE5, 0x2C, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x88, 0x73, 0x5E, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x27, 0xCF, 0x75, 0xC6, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x20, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x45, 0x4D, 0xB6, +0x1A, 0x45, 0x55, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAA, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD3, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x98, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzs[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x65, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x57, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x29, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0xA7, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xA2, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xCA, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x90, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsa[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6A, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x5C, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x9D, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x8B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsaf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6E, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x60, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x32, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x45, 0x4D, 0xB6, +0x02, 0x45, 0x55, 0xB6, + +0x3D, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x99, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC1, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x87, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6A, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x5C, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB6, +0x1A, 0x45, 0x55, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x9D, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x8B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c new file mode 100644 index 000000000..5994ab0c0 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c @@ -0,0 +1,215 @@ +/* mga_warp.c -- Matrox G200/G400 WARP engine management -*- linux-c -*- + * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "mga.h" +#include "drmP.h" +#include "mga_drv.h" +#include "mga_ucode.h" + + +#define MGA_WARP_CODE_ALIGN 256 /* in bytes */ + +#define WARP_UCODE_SIZE( which ) \ + ((sizeof(which) / MGA_WARP_CODE_ALIGN + 1) * MGA_WARP_CODE_ALIGN) + +#define WARP_UCODE_INSTALL( which, where ) \ +do { \ + DRM_DEBUG( " pcbase = 0x%08lx vcbase = %p\n", pcbase, vcbase );\ + dev_priv->warp_pipe_phys[where] = pcbase; \ + memcpy( vcbase, which, sizeof(which) ); \ + pcbase += WARP_UCODE_SIZE( which ); \ + vcbase += WARP_UCODE_SIZE( which ); \ +} while (0) + + +static unsigned int mga_warp_g400_microcode_size( drm_mga_private_t *dev_priv ) +{ + unsigned int size; + + size = ( WARP_UCODE_SIZE( warp_g400_tgz ) + + WARP_UCODE_SIZE( warp_g400_tgza ) + + WARP_UCODE_SIZE( warp_g400_tgzaf ) + + WARP_UCODE_SIZE( warp_g400_tgzf ) + + WARP_UCODE_SIZE( warp_g400_tgzs ) + + WARP_UCODE_SIZE( warp_g400_tgzsa ) + + WARP_UCODE_SIZE( warp_g400_tgzsaf ) + + WARP_UCODE_SIZE( warp_g400_tgzsf ) + + WARP_UCODE_SIZE( warp_g400_t2gz ) + + WARP_UCODE_SIZE( warp_g400_t2gza ) + + WARP_UCODE_SIZE( warp_g400_t2gzaf ) + + WARP_UCODE_SIZE( warp_g400_t2gzf ) + + WARP_UCODE_SIZE( warp_g400_t2gzs ) + + WARP_UCODE_SIZE( warp_g400_t2gzsa ) + + WARP_UCODE_SIZE( warp_g400_t2gzsaf ) + + WARP_UCODE_SIZE( warp_g400_t2gzsf ) ); + + size = PAGE_ALIGN( size ); + + DRM_DEBUG( "G400 ucode size = %d bytes\n", size ); + return size; +} + +static unsigned int mga_warp_g200_microcode_size( drm_mga_private_t *dev_priv ) +{ + unsigned int size; + + size = ( WARP_UCODE_SIZE( warp_g200_tgz ) + + WARP_UCODE_SIZE( warp_g200_tgza ) + + WARP_UCODE_SIZE( warp_g200_tgzaf ) + + WARP_UCODE_SIZE( warp_g200_tgzf ) + + WARP_UCODE_SIZE( warp_g200_tgzs ) + + WARP_UCODE_SIZE( warp_g200_tgzsa ) + + WARP_UCODE_SIZE( warp_g200_tgzsaf ) + + WARP_UCODE_SIZE( warp_g200_tgzsf ) ); + + size = PAGE_ALIGN( size ); + + DRM_DEBUG( "G200 ucode size = %d bytes\n", size ); + return size; +} + +static int mga_warp_install_g400_microcode( drm_mga_private_t *dev_priv ) +{ + unsigned char *vcbase = dev_priv->warp->handle; + unsigned long pcbase = dev_priv->warp->offset; + unsigned int size; + + size = mga_warp_g400_microcode_size( dev_priv ); + if ( size > dev_priv->warp->size ) { + DRM_ERROR( "microcode too large! (%u > %lu)\n", + size, dev_priv->warp->size ); + return -ENOMEM; + } + + memset( dev_priv->warp_pipe_phys, 0, + sizeof(dev_priv->warp_pipe_phys) ); + + WARP_UCODE_INSTALL( warp_g400_tgz, MGA_WARP_TGZ ); + WARP_UCODE_INSTALL( warp_g400_tgzf, MGA_WARP_TGZF ); + WARP_UCODE_INSTALL( warp_g400_tgza, MGA_WARP_TGZA ); + WARP_UCODE_INSTALL( warp_g400_tgzaf, MGA_WARP_TGZAF ); + WARP_UCODE_INSTALL( warp_g400_tgzs, MGA_WARP_TGZS ); + WARP_UCODE_INSTALL( warp_g400_tgzsf, MGA_WARP_TGZSF ); + WARP_UCODE_INSTALL( warp_g400_tgzsa, MGA_WARP_TGZSA ); + WARP_UCODE_INSTALL( warp_g400_tgzsaf, MGA_WARP_TGZSAF ); + + WARP_UCODE_INSTALL( warp_g400_t2gz, MGA_WARP_T2GZ ); + WARP_UCODE_INSTALL( warp_g400_t2gzf, MGA_WARP_T2GZF ); + WARP_UCODE_INSTALL( warp_g400_t2gza, MGA_WARP_T2GZA ); + WARP_UCODE_INSTALL( warp_g400_t2gzaf, MGA_WARP_T2GZAF ); + WARP_UCODE_INSTALL( warp_g400_t2gzs, MGA_WARP_T2GZS ); + WARP_UCODE_INSTALL( warp_g400_t2gzsf, MGA_WARP_T2GZSF ); + WARP_UCODE_INSTALL( warp_g400_t2gzsa, MGA_WARP_T2GZSA ); + WARP_UCODE_INSTALL( warp_g400_t2gzsaf, MGA_WARP_T2GZSAF ); + + return 0; +} + +static int mga_warp_install_g200_microcode( drm_mga_private_t *dev_priv ) +{ + unsigned char *vcbase = dev_priv->warp->handle; + unsigned long pcbase = dev_priv->warp->offset; + unsigned int size; + + size = mga_warp_g200_microcode_size( dev_priv ); + if ( size > dev_priv->warp->size ) { + DRM_ERROR( "microcode too large! (%u > %lu)\n", + size, dev_priv->warp->size ); + return -ENOMEM; + } + + memset( dev_priv->warp_pipe_phys, 0, + sizeof(dev_priv->warp_pipe_phys) ); + + WARP_UCODE_INSTALL( warp_g200_tgz, MGA_WARP_TGZ ); + WARP_UCODE_INSTALL( warp_g200_tgzf, MGA_WARP_TGZF ); + WARP_UCODE_INSTALL( warp_g200_tgza, MGA_WARP_TGZA ); + WARP_UCODE_INSTALL( warp_g200_tgzaf, MGA_WARP_TGZAF ); + WARP_UCODE_INSTALL( warp_g200_tgzs, MGA_WARP_TGZS ); + WARP_UCODE_INSTALL( warp_g200_tgzsf, MGA_WARP_TGZSF ); + WARP_UCODE_INSTALL( warp_g200_tgzsa, MGA_WARP_TGZSA ); + WARP_UCODE_INSTALL( warp_g200_tgzsaf, MGA_WARP_TGZSAF ); + + return 0; +} + +int mga_warp_install_microcode( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + switch ( dev_priv->chipset ) { + case MGA_CARD_TYPE_G400: + return mga_warp_install_g400_microcode( dev_priv ); + case MGA_CARD_TYPE_G200: + return mga_warp_install_g200_microcode( dev_priv ); + default: + return -EINVAL; + } +} + +#define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) + +int mga_warp_init( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + u32 wmisc; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + /* FIXME: Get rid of these damned magic numbers... + */ + switch ( dev_priv->chipset ) { + case MGA_CARD_TYPE_G400: + MGA_WRITE( MGA_WIADDR2, MGA_WMODE_SUSPEND ); + MGA_WRITE( MGA_WGETMSB, 0x00000E00 ); + MGA_WRITE( MGA_WVRTXSZ, 0x00001807 ); + MGA_WRITE( MGA_WACCEPTSEQ, 0x18000000 ); + break; + case MGA_CARD_TYPE_G200: + MGA_WRITE( MGA_WIADDR, MGA_WMODE_SUSPEND ); + MGA_WRITE( MGA_WGETMSB, 0x1606 ); + MGA_WRITE( MGA_WVRTXSZ, 7 ); + break; + default: + return -EINVAL; + } + + MGA_WRITE( MGA_WMISC, (MGA_WUCODECACHE_ENABLE | + MGA_WMASTER_ENABLE | + MGA_WCACHEFLUSH_ENABLE) ); + wmisc = MGA_READ( MGA_WMISC ); + if ( wmisc != WMISC_EXPECTED ) { + DRM_ERROR( "WARP engine config failed! 0x%x != 0x%x\n", + wmisc, WMISC_EXPECTED ); + return -EINVAL; + } + + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h new file mode 100644 index 000000000..83e002afa --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h @@ -0,0 +1,79 @@ +/* r128.h -- ATI Rage 128 DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __R128_H__ +#define __R128_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) r128_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 1 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +/* Driver customization: + */ +#define DRIVER_PRERELEASE() do { \ + if ( dev->dev_private ) { \ + drm_r128_private_t *dev_priv = dev->dev_private; \ + if ( dev_priv->page_flipping ) { \ + r128_do_cleanup_pageflip( dev ); \ + } \ + } \ +} while (0) + +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) r128_do_cleanup_cce( dev ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 + +#if 0 +/* GH: Remove this for now... */ +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + drm_r128_private_t *dev_priv = dev->dev_private; \ + return r128_do_cce_idle( dev_priv ); \ +} while (0) +#endif + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_r128_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_r128_private_t *)((dev)->dev_private))->buffers + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c index 6df2b45ad..c0e20c213 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c @@ -25,11 +25,11 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> - * + * Gareth Hughes <gareth@valinux.com> */ #define __NO_VERSION__ +#include "r128.h" #include "drmP.h" #include "r128_drv.h" @@ -85,26 +85,6 @@ static u32 r128_cce_microcode[] = { }; -#define DO_IOREMAP(_m) (_m)->handle = drm_ioremap((_m)->offset, (_m)->size) - -#define DO_IOREMAPFREE(_m) \ - do { \ - if ((_m)->handle && (_m)->size) \ - drm_ioremapfree((_m)->handle, (_m)->size); \ - } while (0) - -#define DO_FIND_MAP(_m, _o) \ - do { \ - int _i; \ - for (_i = 0; _i < dev->map_count; _i++) { \ - if (dev->maplist[_i]->offset == _o) { \ - _m = dev->maplist[_i]; \ - break; \ - } \ - } \ - } while (0) - - int R128_READ_PLL(drm_device_t *dev, int addr) { drm_r128_private_t *dev_priv = dev->dev_private; @@ -169,7 +149,7 @@ static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries ) return -EBUSY; } -static int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) +int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) { int i, ret; @@ -223,7 +203,7 @@ static void r128_do_cce_flush( drm_r128_private_t *dev_priv ) /* Wait for the CCE to go idle. */ -static int r128_do_cce_idle( drm_r128_private_t *dev_priv ) +int r128_do_cce_idle( drm_r128_private_t *dev_priv ) { int i; @@ -364,9 +344,9 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev ) static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) { drm_r128_private_t *dev_priv; - int i; + struct list_head *list; - dev_priv = drm_alloc( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); + dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); if ( dev_priv == NULL ) return -ENOMEM; dev->dev_private = (void *)dev_priv; @@ -380,7 +360,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) * the CCE ring code. */ if ( dev_priv->is_pci ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; } @@ -388,7 +368,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) dev_priv->usec_timeout = init->usec_timeout; if ( dev_priv->usec_timeout < 1 || dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; } @@ -407,7 +387,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) ( init->cce_mode != R128_PM4_128BM_64INDBM ) && ( init->cce_mode != R128_PM4_64BM_128INDBM ) && ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; } @@ -433,13 +413,30 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) break; } - dev_priv->fb_bpp = init->fb_bpp; + switch ( init->fb_bpp ) { + case 16: + dev_priv->color_fmt = R128_DATATYPE_RGB565; + break; + case 32: + default: + dev_priv->color_fmt = R128_DATATYPE_ARGB8888; + break; + } dev_priv->front_offset = init->front_offset; dev_priv->front_pitch = init->front_pitch; dev_priv->back_offset = init->back_offset; dev_priv->back_pitch = init->back_pitch; - dev_priv->depth_bpp = init->depth_bpp; + switch ( init->depth_bpp ) { + case 16: + dev_priv->depth_fmt = R128_DATATYPE_RGB565; + break; + case 24: + case 32: + default: + dev_priv->depth_fmt = R128_DATATYPE_ARGB8888; + break; + } dev_priv->depth_offset = init->depth_offset; dev_priv->depth_pitch = init->depth_pitch; dev_priv->span_offset = init->span_offset; @@ -454,39 +451,34 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | (dev_priv->span_offset >> 5)); - /* FIXME: We want multiple shared areas, including one shared - * only by the X Server and kernel module. - */ - for ( i = 0 ; i < dev->map_count ; i++ ) { - if ( dev->maplist[i]->type == _DRM_SHM ) { - dev_priv->sarea = dev->maplist[i]; - break; - } - } - - DO_FIND_MAP( dev_priv->fb, init->fb_offset ); - DO_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - DO_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); - DO_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); - DO_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + list_for_each(list, &dev->maplist->head) { + drm_map_list_t *r_list = (drm_map_list_t *)list; + if( r_list->map && + r_list->map->type == _DRM_SHM && + r_list->map->flags & _DRM_CONTAINS_LOCK ) { + dev_priv->sarea = r_list->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + DRM_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); + DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); if ( !dev_priv->is_pci ) { - DO_FIND_MAP( dev_priv->agp_textures, - init->agp_textures_offset ); + DRM_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); } dev_priv->sarea_priv = (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + init->sarea_priv_offset); - DO_IOREMAP( dev_priv->cce_ring ); - DO_IOREMAP( dev_priv->ring_rptr ); - DO_IOREMAP( dev_priv->buffers ); -#if 0 - if ( !dev_priv->is_pci ) { - DO_IOREMAP( dev_priv->agp_textures ); - } -#endif + DRM_IOREMAP( dev_priv->cce_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); dev_priv->ring.head = ((__volatile__ u32 *) dev_priv->ring_rptr->handle); @@ -495,11 +487,13 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle + init->ring_size / sizeof(u32)); dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 ); + dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1; + dev_priv->ring.high_mark = 128; + dev_priv->sarea_priv->last_frame = 0; R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame ); @@ -514,22 +508,17 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) return 0; } -static int r128_do_cleanup_cce( drm_device_t *dev ) +int r128_do_cleanup_cce( drm_device_t *dev ) { if ( dev->dev_private ) { drm_r128_private_t *dev_priv = dev->dev_private; - DO_IOREMAPFREE( dev_priv->cce_ring ); - DO_IOREMAPFREE( dev_priv->ring_rptr ); - DO_IOREMAPFREE( dev_priv->buffers ); -#if 0 - if ( !dev_priv->is_pci ) { - DO_IOREMAPFREE( dev_priv->agp_textures ); - } -#endif + DRM_IOREMAPFREE( dev_priv->cce_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); - drm_free( dev->dev_private, sizeof(drm_r128_private_t), - DRM_MEM_DRIVER ); + DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), + DRM_MEM_DRIVER ); dev->dev_private = NULL; } @@ -564,11 +553,8 @@ int r128_cce_start( struct inode *inode, struct file *filp, drm_r128_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) { DRM_DEBUG( "%s while CCE running\n", __FUNCTION__ ); return 0; @@ -592,11 +578,7 @@ int r128_cce_stop( struct inode *inode, struct file *filp, int ret; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &stop, (drm_r128_init_t *)arg, sizeof(stop) ) ) return -EFAULT; @@ -638,11 +620,8 @@ int r128_cce_reset( struct inode *inode, struct file *filp, drm_r128_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( !dev_priv ) { DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); return -EINVAL; @@ -664,11 +643,7 @@ int r128_cce_idle( struct inode *inode, struct file *filp, drm_r128_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( dev_priv->cce_running ) { r128_do_cce_flush( dev_priv ); @@ -684,11 +659,7 @@ int r128_engine_reset( struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); return r128_do_engine_reset( dev ); } @@ -737,11 +708,7 @@ int r128_fullscreen( struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; drm_r128_fullscreen_t fs; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &fs, (drm_r128_fullscreen_t *)arg, sizeof(fs) ) ) return -EFAULT; @@ -773,8 +740,8 @@ static int r128_freelist_init( drm_device_t *dev ) drm_r128_freelist_t *entry; int i; - dev_priv->head = drm_alloc( sizeof(drm_r128_freelist_t), - DRM_MEM_DRIVER ); + dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); if ( dev_priv->head == NULL ) return -ENOMEM; @@ -785,8 +752,8 @@ static int r128_freelist_init( drm_device_t *dev ) buf = dma->buflist[i]; buf_priv = buf->dev_private; - entry = drm_alloc( sizeof(drm_r128_freelist_t), - DRM_MEM_DRIVER ); + entry = DRM(alloc)( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); if ( !entry ) return -ENOMEM; entry->age = R128_BUFFER_FREE; @@ -872,13 +839,9 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) int i; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - ring->space = *ring->head - ring->tail; - if ( ring->space <= 0 ) - ring->space += ring->size; - + r128_update_ring_snapshot( ring ); if ( ring->space >= n ) return 0; - udelay( 1 ); } @@ -887,19 +850,6 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) return -EBUSY; } -void r128_update_ring_snapshot( drm_r128_private_t *dev_priv ) -{ - drm_r128_ring_buffer_t *ring = &dev_priv->ring; - - ring->space = *ring->head - ring->tail; -#if R128_PERFORMANCE_BOXES - if ( ring->space == 0 ) - atomic_inc( &dev_priv->idle_count ); -#endif - if ( ring->space <= 0 ) - ring->space += ring->size; -} - static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d ) { int i; @@ -932,15 +882,11 @@ int r128_cce_buffers( struct inode *inode, struct file *filp, int ret = 0; drm_dma_t d; + LOCK_TEST_WITH_RETURN( dev ); + if ( copy_from_user( &d, (drm_dma_t *) arg, sizeof(d) ) ) return -EFAULT; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } - /* Please don't send us buffers. */ if ( d.send_count != 0 ) { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h index 94dba1ed9..86aba175f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h @@ -25,9 +25,8 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> - * + * Kevin E. Martin <martin@valinux.com> */ #ifndef __R128_DRM_H__ @@ -142,12 +141,6 @@ typedef struct { } drm_r128_texture_regs_t; -typedef struct drm_tex_region { - unsigned char next, prev; - unsigned char in_use; - int age; -} drm_tex_region_t; - typedef struct drm_r128_sarea { /* The channel for communication of state information to the kernel * on firing a vertex buffer. @@ -218,9 +211,10 @@ typedef struct drm_r128_fullscreen { typedef struct drm_r128_clear { unsigned int flags; - int x, y, w, h; unsigned int clear_color; unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; } drm_r128_clear_t; typedef struct drm_r128_vertex { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c index cf2589251..daae0f875 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c @@ -1,7 +1,7 @@ /* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*- * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * @@ -19,693 +19,72 @@ * 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 + * VA LINUX SYSTEMS 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. + * 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@valinux.com> - * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> - * */ #include <linux/config.h> +#include "r128.h" #include "drmP.h" #include "r128_drv.h" -#define R128_NAME "r128" -#define R128_DESC "ATI Rage 128" -#define R128_DATE "20010101" -#define R128_MAJOR 2 -#define R128_MINOR 1 -#define R128_PATCHLEVEL 4 - -static drm_device_t r128_device; -drm_ctx_t r128_res_ctx; - -static struct file_operations r128_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: r128_open, - flush: drm_flush, - release: r128_release, - ioctl: r128_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice r128_misc = { - minor: MISC_DYNAMIC_MINOR, - name: R128_NAME, - fops: &r128_fops, -}; - -static drm_ioctl_desc_t r128_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { r128_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_BUFS)] = { r128_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { r128_mapbufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { r128_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { r128_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { r128_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { r128_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { r128_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { r128_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { r128_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_DMA)] = { r128_cce_buffers, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { r128_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - [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 - - [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)]= { r128_fullscreen, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, -}; -#define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls) - -#ifdef MODULE -static char *r128 = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("r128"); -MODULE_PARM(r128, "s"); - -#ifndef MODULE -/* r128_options 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_drm. - */ - -static int __init r128_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("r128=", r128_options); -#endif - -static int r128_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); - - drm_dma_setup(dev); - - 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_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); - - r128_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 r128_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"); - - 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; - } - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - /* 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 r128_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(); - - 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; - } - - drm_dma_takedown(dev); - - dev->queue_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; -} - -/* r128_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init r128_init(void) -{ - int retcode; - drm_device_t *dev = &r128_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(r128); -#endif - - if ((retcode = misc_register(&r128_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", R128_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, r128_misc.minor); - dev->name = R128_NAME; - - drm_mem_init(); - drm_proc_init(dev); - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - dev->agp = drm_agp_init(); - if (dev->agp == NULL) { - DRM_ERROR("Cannot initialize agpgart module.\n"); - drm_proc_cleanup(); - misc_deregister(&r128_misc); - r128_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 - - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&r128_misc); - r128_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - R128_NAME, - R128_MAJOR, - R128_MINOR, - R128_PATCHLEVEL, - R128_DATE, - r128_misc.minor); - - return 0; -} - -/* r128_cleanup is called via cleanup_module at module unload time. */ - -static void __exit r128_cleanup(void) -{ - drm_device_t *dev = &r128_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&r128_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); - r128_takedown(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -#endif -} - -module_init(r128_init); -module_exit(r128_cleanup); - - -int r128_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = R128_MAJOR; - version.version_minor = R128_MINOR; - version.version_patchlevel = R128_PATCHLEVEL; - - DRM_COPY(version.name, R128_NAME); - DRM_COPY(version.date, R128_DATE); - DRM_COPY(version.desc, R128_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int r128_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &r128_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return r128_setup(dev); - } - spin_unlock(&dev->count_lock); - } - - return retcode; -} - -int r128_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - - /* Force the cleanup of page flipping when required */ - if ( dev->dev_private ) { - drm_r128_private_t *dev_priv = dev->dev_private; - if ( dev_priv->page_flipping ) { - r128_do_cleanup_pageflip( dev ); - } - } - - if (!(retcode = drm_release(inode, filp))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - 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); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return r128_takedown(dev); - } - spin_unlock(&dev->count_lock); - } - - unlock_kernel(); - return retcode; -} - -/* r128_ioctl is called whenever a process performs an ioctl on /dev/drm. */ -int r128_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; +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." + +#define DRIVER_NAME "r128" +#define DRIVER_DESC "ATI Rage 128" +#define DRIVER_DATE "20010308" + +#define DRIVER_MAJOR 2 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 5 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)] = { r128_fullscreen, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, - 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 >= R128_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &r128_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); - } - } - -#if 0 - if ( retcode ) { - DRM_INFO( "%s 0x%x ret = %d\n", __FUNCTION__, nr, retcode ); - } -#endif - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -int r128_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 - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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 (lock.context < 0) - return -EINVAL; - - if (!ret) { - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - 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); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - if (lock.flags & _DRM_LOCK_READY) { - /* Wait for space in DMA/FIFO */ - } - if (lock.flags & _DRM_LOCK_QUIESCENT) { - /* Make hardware quiescent */ - DRM_DEBUG( "not quiescent!\n" ); #if 0 - r128_quiescent(dev); -#endif - } - } - -#if LINUX_VERSION_CODE < 0x020400 - if (lock.context != r128_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY/4; - } -#endif - 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 r128_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; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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 LINUX_VERSION_CODE < 0x020400 - if (lock.context != r128_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY; - } -#endif - unblock_all_signals(); - return 0; -} +/* GH: Count data sent to card via ring or vertex/indirect buffers. + */ +#define __HAVE_COUNTERS 3 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY +#endif + + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h index 08ef5dc92..6216b9a1b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h @@ -25,10 +25,9 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - * + * Rickard E. (Rik) Faith <faith@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ #ifndef __R128_DRV_H__ @@ -51,6 +50,8 @@ typedef struct drm_r128_ring_buffer { u32 tail; u32 tail_mask; int space; + + int high_mark; } drm_r128_ring_buffer_t; typedef struct drm_r128_private { @@ -74,13 +75,13 @@ typedef struct drm_r128_private { u32 crtc_offset; u32 crtc_offset_cntl; - unsigned int fb_bpp; + u32 color_fmt; unsigned int front_offset; unsigned int front_pitch; unsigned int back_offset; unsigned int back_pitch; - unsigned int depth_bpp; + u32 depth_fmt; unsigned int depth_offset; unsigned int depth_pitch; unsigned int span_offset; @@ -107,18 +108,6 @@ typedef struct drm_r128_buf_priv { drm_r128_freelist_t *list_entry; } drm_r128_buf_priv_t; - /* r128_drv.c */ -extern int r128_version( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_open( struct inode *inode, struct file *filp ); -extern int r128_release( struct inode *inode, struct file *filp ); -extern int r128_ioctl( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_lock( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_unlock( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - /* r128_cce.c */ extern int r128_cce_init( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); @@ -141,8 +130,17 @@ extern void r128_freelist_reset( drm_device_t *dev ); extern drm_buf_t *r128_freelist_get( drm_device_t *dev ); extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); -extern void r128_update_ring_snapshot( drm_r128_private_t *dev_priv ); +static inline void +r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring ) +{ + ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; +} + +extern int r128_do_cce_idle( drm_r128_private_t *dev_priv ); +extern int r128_do_cleanup_cce( drm_device_t *dev ); extern int r128_do_cleanup_pageflip( drm_device_t *dev ); /* r128_state.c */ @@ -163,31 +161,6 @@ extern int r128_cce_stipple( struct inode *inode, struct file *filp, extern int r128_cce_indirect( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); - /* r128_bufs.c */ -extern int r128_addbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_mapbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - - /* r128_context.c */ -extern int r128_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int r128_context_switch(drm_device_t *dev, int old, int new); -extern int r128_context_switch_complete(drm_device_t *dev, int new); - /* Register definitions, register access macros and drmAddMap constants * for Rage 128 kernel driver. @@ -286,6 +259,8 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new); #define R128_TEX_CNTL_C 0x1c9c # define R128_TEX_CACHE_FLUSH (1 << 23) +#define R128_WAIT_UNTIL 0x1720 +# define R128_EVENT_CRTC_OFFSET (1 << 0) #define R128_WINDOW_XY_OFFSET 0x1bcc @@ -386,25 +361,29 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new); #define R128_WATERMARK_N 8 #define R128_WATERMARK_K 128 -#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ +#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ #define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0 #define R128_LAST_DISPATCH_REG R128_GUI_SCRATCH_REG1 #define R128_MAX_VB_AGE 0xffffffff - #define R128_MAX_VB_VERTS (0xffff) +#define R128_RING_HIGH_MARK 128 + +#define R128_PERFORMANCE_BOXES 0 + #define R128_BASE(reg) ((u32)(dev_priv->mmio->handle)) -#define R128_ADDR(reg) (R128_BASE(reg) + reg) +#define R128_ADDR(reg) (R128_BASE( reg ) + reg) -#define R128_DEREF(reg) *(__volatile__ int *)R128_ADDR(reg) -#define R128_READ(reg) R128_DEREF(reg) -#define R128_WRITE(reg,val) do { R128_DEREF(reg) = val; } while (0) +#define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg ) +#define R128_READ(reg) R128_DEREF( reg ) +#define R128_WRITE(reg,val) do { R128_DEREF( reg ) = val; } while (0) + +#define R128_DEREF8(reg) *(volatile u8 *)R128_ADDR( reg ) +#define R128_READ8(reg) R128_DEREF8( reg ) +#define R128_WRITE8(reg,val) do { R128_DEREF8( reg ) = val; } while (0) -#define R128_DEREF8(reg) *(__volatile__ char *)R128_ADDR(reg) -#define R128_READ8(reg) R128_DEREF8(reg) -#define R128_WRITE8(reg,val) do { R128_DEREF8(reg) = val; } while (0) #define R128_WRITE_PLL(addr,val) \ do { \ @@ -414,13 +393,6 @@ do { \ extern int R128_READ_PLL(drm_device_t *dev, int addr); -#define R128CCE0(p,r,n) ((p) | ((n) << 16) | ((r) >> 2)) -#define R128CCE1(p,r1,r2) ((p) | (((r2) >> 2) << 11) | ((r1) >> 2)) -#define R128CCE2(p) ((p)) -#define R128CCE3(p,n) ((p) | ((n) << 16)) - - - #define CCE_PACKET0( reg, n ) (R128_CCE_PACKET0 | \ ((n) << 16) | ((reg) >> 2)) @@ -431,19 +403,71 @@ extern int R128_READ_PLL(drm_device_t *dev, int addr); (pkt) | ((n) << 16)) -#define r128_flush_write_combine() mb() +/* ================================================================ + * Misc helper macros + */ + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != current->pid ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return -EINVAL; \ + } \ +} while (0) + +#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i; \ + if ( ring->space < ring->high_mark ) { \ + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ + r128_update_ring_snapshot( ring ); \ + if ( ring->space >= ring->high_mark ) \ + goto __ring_space_done; \ + udelay( 1 ); \ + } \ + DRM_ERROR( "ring space check failed!\n" ); \ + return -EBUSY; \ + } \ + __ring_space_done: \ +} while (0) + +#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; \ + if ( sarea_priv->last_dispatch >= R128_MAX_VB_AGE ) { \ + int __ret = r128_do_cce_idle( dev_priv ); \ + if ( __ret < 0 ) return __ret; \ + sarea_priv->last_dispatch = 0; \ + r128_freelist_reset( dev ); \ + } \ +} while (0) + +#define R128_WAIT_UNTIL_PAGE_FLIPPED() do { \ + OUT_RING( CCE_PACKET0( R128_WAIT_UNTIL, 0 ) ); \ + OUT_RING( R128_EVENT_CRTC_OFFSET ); \ +} while (0) + + +/* ================================================================ + * Ring control + */ + +#define r128_flush_write_combine() mb() #define R128_VERBOSE 0 -#define RING_LOCALS int write; unsigned int tail_mask; volatile u32 *ring; +#define RING_LOCALS \ + int write; unsigned int tail_mask; volatile u32 *ring; #define BEGIN_RING( n ) do { \ if ( R128_VERBOSE ) { \ DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ (n), __FUNCTION__ ); \ } \ - if ( dev_priv->ring.space < (n) * sizeof(u32) ) { \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \ } \ dev_priv->ring.space -= (n) * sizeof(u32); \ @@ -452,11 +476,23 @@ extern int R128_READ_PLL(drm_device_t *dev, int addr); tail_mask = dev_priv->ring.tail_mask; \ } while (0) +/* You can set this to zero if you want. If the card locks up, you'll + * need to keep this set. It works around a bug in early revs of the + * Rage 128 chipset, where the CCE would read 32 dwords past the end of + * the ring buffer before wrapping around. + */ +#define R128_BROKEN_CCE 1 + #define ADVANCE_RING() do { \ if ( R128_VERBOSE ) { \ DRM_INFO( "ADVANCE_RING() tail=0x%06x wr=0x%06x\n", \ write, dev_priv->ring.tail ); \ } \ + if ( R128_BROKEN_CCE && write < 32 ) { \ + memcpy( dev_priv->ring.end, \ + dev_priv->ring.start, \ + write * sizeof(u32) ); \ + } \ r128_flush_write_combine(); \ dev_priv->ring.tail = write; \ R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); \ @@ -471,6 +507,4 @@ extern int R128_READ_PLL(drm_device_t *dev, int addr); write &= tail_mask; \ } while (0) -#define R128_PERFORMANCE_BOXES 0 - #endif /* __R128_DRV_H__ */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c index ba0039293..9fc6b485c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c @@ -25,13 +25,14 @@ * * Authors: * Gareth Hughes <gareth@valinux.com> - * */ #define __NO_VERSION__ +#include "r128.h" #include "drmP.h" #include "r128_drv.h" #include "drm.h" +#include <linux/delay.h> /* ================================================================ @@ -360,45 +361,18 @@ static void r128_print_dirty( const char *msg, unsigned int flags ) } static void r128_cce_dispatch_clear( drm_device_t *dev, - unsigned int flags, - int cx, int cy, int cw, int ch, - unsigned int clear_color, - unsigned int clear_depth ) + drm_r128_clear_t *clear ) { drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; - u32 fb_bpp, depth_bpp; + unsigned int flags = clear->flags; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->fb_bpp ) { - case 16: - fb_bpp = R128_GMC_DST_16BPP; - break; - case 32: - fb_bpp = R128_GMC_DST_32BPP; - break; - default: - return; - } - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return; - } - - if ( dev_priv->page_flipping && dev_priv->current_page == 1) { + if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { unsigned int tmp = flags; flags &= ~(R128_FRONT | R128_BACK); @@ -420,7 +394,7 @@ static void r128_cce_dispatch_clear( drm_device_t *dev, BEGIN_RING( 2 ); OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); - OUT_RING( sarea_priv->context_state.plane_3d_mask_c ); + OUT_RING( clear->color_mask ); ADVANCE_RING(); } @@ -431,14 +405,14 @@ static void r128_cce_dispatch_clear( drm_device_t *dev, OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_SOLID_COLOR | - fb_bpp | + (dev_priv->color_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_P | R128_GMC_CLR_CMP_CNTL_DIS | R128_GMC_AUX_CLIP_DIS ); OUT_RING( dev_priv->front_pitch_offset_c ); - OUT_RING( clear_color ); + OUT_RING( clear->clear_color ); OUT_RING( (x << 16) | y ); OUT_RING( (w << 16) | h ); @@ -452,14 +426,14 @@ static void r128_cce_dispatch_clear( drm_device_t *dev, OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_SOLID_COLOR | - fb_bpp | + (dev_priv->color_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_P | R128_GMC_CLR_CMP_CNTL_DIS | R128_GMC_AUX_CLIP_DIS ); OUT_RING( dev_priv->back_pitch_offset_c ); - OUT_RING( clear_color ); + OUT_RING( clear->clear_color ); OUT_RING( (x << 16) | y ); OUT_RING( (w << 16) | h ); @@ -473,7 +447,7 @@ static void r128_cce_dispatch_clear( drm_device_t *dev, OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_SOLID_COLOR | - depth_bpp | + (dev_priv->depth_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_P | R128_GMC_CLR_CMP_CNTL_DIS | @@ -481,7 +455,7 @@ static void r128_cce_dispatch_clear( drm_device_t *dev, R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( clear_depth ); + OUT_RING( clear->clear_depth ); OUT_RING( (x << 16) | y ); OUT_RING( (w << 16) | h ); @@ -497,29 +471,16 @@ static void r128_cce_dispatch_swap( drm_device_t *dev ) drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; - u32 fb_bpp; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - #if R128_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ r128_cce_performance_boxes( dev_priv ); #endif - switch ( dev_priv->fb_bpp ) { - case 16: - fb_bpp = R128_GMC_DST_16BPP; - break; - case 32: - default: - fb_bpp = R128_GMC_DST_32BPP; - break; - } - for ( i = 0 ; i < nbox ; i++ ) { int x = pbox[i].x1; int y = pbox[i].y1; @@ -532,7 +493,7 @@ static void r128_cce_dispatch_swap( drm_device_t *dev ) OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_NONE | - fb_bpp | + (dev_priv->color_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_S | R128_DP_SRC_SOURCE_MEMORY | @@ -570,16 +531,15 @@ static void r128_cce_dispatch_flip( drm_device_t *dev ) RING_LOCALS; DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); - r128_update_ring_snapshot( dev_priv ); - #if R128_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ r128_cce_performance_boxes( dev_priv ); #endif - BEGIN_RING( 2 ); + BEGIN_RING( 4 ); + R128_WAIT_UNTIL_PAGE_FLIPPED(); OUT_RING( CCE_PACKET0( R128_CRTC_OFFSET, 0 ) ); if ( dev_priv->current_page == 0 ) { @@ -613,7 +573,7 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev, drm_r128_buf_priv_t *buf_priv = buf->dev_private; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; int format = sarea_priv->vc_format; - int offset = dev_priv->buffers->offset + buf->offset - dev->agp->base; + int offset = buf->bus_address; int size = buf->used; int prim = buf_priv->prim; int i = 0; @@ -621,8 +581,6 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev, DRM_DEBUG( "%s: buf=%d nbox=%d\n", __FUNCTION__, buf->idx, sarea_priv->nbox ); - r128_update_ring_snapshot( dev_priv ); - if ( 0 ) r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); @@ -676,22 +634,10 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev, dev_priv->sarea_priv->last_dispatch++; -#if 0 - if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { - ret = r128_do_cce_idle( dev_priv ); - if ( ret < 0 ) return ret; - dev_priv->submit_age = 0; - r128_freelist_reset( dev ); - } -#endif - sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; sarea_priv->nbox = 0; } - - - static void r128_cce_dispatch_indirect( drm_device_t *dev, drm_buf_t *buf, int start, int end ) @@ -702,11 +648,8 @@ static void r128_cce_dispatch_indirect( drm_device_t *dev, DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end ); - r128_update_ring_snapshot( dev_priv ); - if ( start != end ) { - int offset = (dev_priv->buffers->offset - dev->agp->base - + buf->offset + start); + int offset = buf->bus_address + start; int dwords = (end - start + 3) / sizeof(u32); /* Indirect buffer data must be an even number of @@ -750,15 +693,6 @@ static void r128_cce_dispatch_indirect( drm_device_t *dev, } dev_priv->sarea_priv->last_dispatch++; - -#if 0 - if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { - ret = r128_do_cce_idle( dev_priv ); - if ( ret < 0 ) return ret; - dev_priv->submit_age = 0; - r128_freelist_reset( dev ); - } -#endif } static void r128_cce_dispatch_indices( drm_device_t *dev, @@ -778,8 +712,6 @@ static void r128_cce_dispatch_indices( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - r128_update_ring_snapshot( dev_priv ); - if ( 0 ) r128_print_dirty( "dispatch_indices", sarea_priv->dirty ); @@ -839,15 +771,6 @@ static void r128_cce_dispatch_indices( drm_device_t *dev, dev_priv->sarea_priv->last_dispatch++; -#if 0 - if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { - ret = r128_do_cce_idle( dev_priv ); - if ( ret < 0 ) return ret; - dev_priv->submit_age = 0; - r128_freelist_reset( dev ); - } -#endif - sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; sarea_priv->nbox = 0; } @@ -864,8 +787,6 @@ static int r128_cce_dispatch_blit( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - /* The compiler won't optimize away a division by a variable, * even if the only legal values are powers of two. Thus, we'll * use a shift instead. @@ -972,25 +893,10 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev, int count, x, y; u32 *buffer; u8 *mask; - u32 depth_bpp; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return -EINVAL; - } - count = depth->n; if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { return -EFAULT; @@ -1028,7 +934,7 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev, OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_SOLID_COLOR | - depth_bpp | + (dev_priv->depth_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_P | R128_GMC_CLR_CMP_CNTL_DIS | @@ -1052,7 +958,7 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev, OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_SOLID_COLOR | - depth_bpp | + (dev_priv->depth_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_P | R128_GMC_CLR_CMP_CNTL_DIS | @@ -1080,25 +986,10 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev, int count, *x, *y; u32 *buffer; u8 *mask; - u32 depth_bpp; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return -EINVAL; - } - count = depth->n; x = kmalloc( count * sizeof(*x), 0 ); @@ -1159,7 +1050,7 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev, OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_SOLID_COLOR | - depth_bpp | + (dev_priv->depth_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_P | R128_GMC_CLR_CMP_CNTL_DIS | @@ -1183,7 +1074,7 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev, OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_SOLID_COLOR | - depth_bpp | + (dev_priv->depth_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_P | R128_GMC_CLR_CMP_CNTL_DIS | @@ -1211,24 +1102,9 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev, { drm_r128_private_t *dev_priv = dev->dev_private; int count, x, y; - u32 depth_bpp; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return -EINVAL; - } - count = depth->n; if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { return -EFAULT; @@ -1243,7 +1119,7 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev, OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_NONE | - depth_bpp | + (dev_priv->depth_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_S | R128_DP_SRC_SOURCE_MEMORY | @@ -1267,25 +1143,10 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev, { drm_r128_private_t *dev_priv = dev->dev_private; int count, *x, *y; - u32 depth_bpp; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return -EINVAL; - } - count = depth->n; if ( count > dev_priv->depth_pitch ) { count = dev_priv->depth_pitch; @@ -1318,7 +1179,7 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev, OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | R128_GMC_DST_PITCH_OFFSET_CNTL | R128_GMC_BRUSH_NONE | - depth_bpp | + (dev_priv->depth_fmt << 8) | R128_GMC_SRC_DATATYPE_COLOR | R128_ROP3_S | R128_DP_SRC_SOURCE_MEMORY | @@ -1353,8 +1214,6 @@ static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple ) RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - BEGIN_RING( 33 ); OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); @@ -1380,22 +1239,18 @@ int r128_cce_clear( struct inode *inode, struct file *filp, drm_r128_clear_t clear; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "r128_cce_clear called without lock held\n" ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &clear, (drm_r128_clear_t *) arg, sizeof(clear) ) ) return -EFAULT; + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; - r128_cce_dispatch_clear( dev, clear.flags, - clear.x, clear.y, clear.w, clear.h, - clear.clear_color, clear.clear_depth ); + r128_cce_dispatch_clear( dev, &clear ); /* Make sure we restore the 3D state next time. */ @@ -1413,11 +1268,9 @@ int r128_cce_swap( struct inode *inode, struct file *filp, drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "r128_cce_swap called without lock held\n" ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; @@ -1444,11 +1297,8 @@ int r128_cce_vertex( struct inode *inode, struct file *filp, drm_r128_buf_priv_t *buf_priv; drm_r128_vertex_t vertex; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( !dev_priv || dev_priv->is_pci ) { DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); return -EINVAL; @@ -1473,6 +1323,9 @@ int r128_cce_vertex( struct inode *inode, struct file *filp, return -EINVAL; } + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + buf = dma->buflist[vertex.idx]; buf_priv = buf->dev_private; @@ -1507,11 +1360,8 @@ int r128_cce_indices( struct inode *inode, struct file *filp, drm_r128_indices_t elts; int count; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( !dev_priv || dev_priv->is_pci ) { DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); return -EINVAL; @@ -1536,6 +1386,9 @@ int r128_cce_indices( struct inode *inode, struct file *filp, return -EINVAL; } + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + buf = dma->buflist[elts.idx]; buf_priv = buf->dev_private; @@ -1576,13 +1429,10 @@ int r128_cce_blit( struct inode *inode, struct file *filp, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_blit_t blit; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &blit, (drm_r128_blit_t *)arg, sizeof(blit) ) ) @@ -1597,6 +1447,9 @@ int r128_cce_blit( struct inode *inode, struct file *filp, return -EINVAL; } + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + return r128_cce_dispatch_blit( dev, &blit ); } @@ -1605,18 +1458,17 @@ int r128_cce_depth( struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_depth_t depth; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &depth, (drm_r128_depth_t *)arg, sizeof(depth) ) ) return -EFAULT; + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + switch ( depth.func ) { case R128_WRITE_SPAN: return r128_cce_dispatch_write_span( dev, &depth ); @@ -1636,14 +1488,11 @@ int r128_cce_stipple( struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_stipple_t stipple; u32 mask[32]; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &stipple, (drm_r128_stipple_t *)arg, sizeof(stipple) ) ) @@ -1653,6 +1502,8 @@ int r128_cce_stipple( struct inode *inode, struct file *filp, 32 * sizeof(u32) ) ) return -EFAULT; + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + r128_cce_dispatch_stipple( dev, mask ); return 0; @@ -1664,11 +1515,7 @@ int r128_cce_indirect( struct inode *inode, struct file *filp, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); /* Indirect buffer firing is not supported at this time. */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h new file mode 100644 index 000000000..db238b1b4 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h @@ -0,0 +1,79 @@ +/* radeon.h -- ATI Radeon DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 17:07:34 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __RADEON_H__ +#define __RADEON_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) radeon_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 1 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +/* Driver customization: + */ +#define DRIVER_PRERELEASE() do { \ + if ( dev->dev_private ) { \ + drm_radeon_private_t *dev_priv = dev->dev_private; \ + if ( dev_priv->page_flipping ) { \ + radeon_do_cleanup_pageflip( dev ); \ + } \ + } \ +} while (0) + +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) radeon_do_cleanup_cp( dev ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 + +#if 0 +/* GH: Remove this for now... */ +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + drm_radeon_private_t *dev_priv = dev->dev_private; \ + return radeon_do_cp_idle( dev_priv ); \ +} while (0) +#endif + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_radeon_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_radeon_private_t *)((dev)->dev_private))->buffers + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c index 5d662bc08..ed8b1bbca 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c @@ -24,12 +24,12 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - * + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ #define __NO_VERSION__ +#include "radeon.h" #include "drmP.h" #include "radeon_drv.h" @@ -300,26 +300,6 @@ static u32 radeon_cp_microcode[][2] = { }; -#define DO_IOREMAP(_m) (_m)->handle = drm_ioremap((_m)->offset, (_m)->size) - -#define DO_IOREMAPFREE(_m) \ - do { \ - if ((_m)->handle && (_m)->size) \ - drm_ioremapfree((_m)->handle, (_m)->size); \ - } while (0) - -#define DO_FIND_MAP(_m, _o) \ - do { \ - int _i; \ - for (_i = 0; _i < dev->map_count; _i++) { \ - if (dev->maplist[_i]->offset == _o) { \ - _m = dev->maplist[_i]; \ - break; \ - } \ - } \ - } while (0) - - int RADEON_READ_PLL(drm_device_t *dev, int addr) { drm_radeon_private_t *dev_priv = dev->dev_private; @@ -621,9 +601,9 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev ) static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) { drm_radeon_private_t *dev_priv; - int i; + struct list_head *list; - dev_priv = drm_alloc( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); + dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); if ( dev_priv == NULL ) return -ENOMEM; dev->dev_private = (void *)dev_priv; @@ -637,7 +617,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) * the CP ring code. */ if ( dev_priv->is_pci ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; } @@ -645,7 +625,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) dev_priv->usec_timeout = init->usec_timeout; if ( dev_priv->usec_timeout < 1 || dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; } @@ -662,7 +642,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) */ if ( ( init->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) && ( init->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; } @@ -722,49 +702,42 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) RADEON_BFACE_SOLID | RADEON_FFACE_SOLID | RADEON_FLAT_SHADE_VTX_LAST | - RADEON_DIFFUSE_SHADE_FLAT | RADEON_ALPHA_SHADE_FLAT | RADEON_SPECULAR_SHADE_FLAT | RADEON_FOG_SHADE_FLAT | - RADEON_VTX_PIX_CENTER_OGL | RADEON_ROUND_MODE_TRUNC | RADEON_ROUND_PREC_8TH_PIX); - /* FIXME: We want multiple shared areas, including one shared - * only by the X Server and kernel module. - */ - for ( i = 0 ; i < dev->map_count ; i++ ) { - if ( dev->maplist[i]->type == _DRM_SHM ) { - dev_priv->sarea = dev->maplist[i]; - break; - } - } - - DO_FIND_MAP( dev_priv->fb, init->fb_offset ); - DO_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - DO_FIND_MAP( dev_priv->cp_ring, init->ring_offset ); - DO_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); - DO_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + list_for_each(list, &dev->maplist->head) { + drm_map_list_t *r_list = (drm_map_list_t *)list; + if( r_list->map && + r_list->map->type == _DRM_SHM && + r_list->map->flags & _DRM_CONTAINS_LOCK ) { + dev_priv->sarea = r_list->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset ); + DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); if ( !dev_priv->is_pci ) { - DO_FIND_MAP( dev_priv->agp_textures, - init->agp_textures_offset ); + DRM_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); } dev_priv->sarea_priv = (drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle + init->sarea_priv_offset); - DO_IOREMAP( dev_priv->cp_ring ); - DO_IOREMAP( dev_priv->ring_rptr ); - DO_IOREMAP( dev_priv->buffers ); -#if 0 - if ( !dev_priv->is_pci ) { - DO_IOREMAP( dev_priv->agp_textures ); - } -#endif + DRM_IOREMAP( dev_priv->cp_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); dev_priv->agp_size = init->agp_size; dev_priv->agp_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE ); @@ -779,11 +752,13 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) dev_priv->ring.end = ((u32 *)dev_priv->cp_ring->handle + init->ring_size / sizeof(u32)); dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 ); + dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1; + dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; + #if 0 /* Initialize the scratch register pointer. This will cause * the scratch register values to be written out to memory @@ -823,22 +798,17 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) return 0; } -static int radeon_do_cleanup_cp( drm_device_t *dev ) +int radeon_do_cleanup_cp( drm_device_t *dev ) { if ( dev->dev_private ) { drm_radeon_private_t *dev_priv = dev->dev_private; - DO_IOREMAPFREE( dev_priv->cp_ring ); - DO_IOREMAPFREE( dev_priv->ring_rptr ); - DO_IOREMAPFREE( dev_priv->buffers ); -#if 0 - if ( !dev_priv->is_pci ) { - DO_IOREMAPFREE( dev_priv->agp_textures ); - } -#endif + DRM_IOREMAPFREE( dev_priv->cp_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); - drm_free( dev->dev_private, sizeof(drm_radeon_private_t), - DRM_MEM_DRIVER ); + DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t), + DRM_MEM_DRIVER ); dev->dev_private = NULL; } @@ -873,11 +843,8 @@ int radeon_cp_start( struct inode *inode, struct file *filp, drm_radeon_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( dev_priv->cp_running ) { DRM_DEBUG( "%s while CP running\n", __FUNCTION__ ); return 0; @@ -906,11 +873,7 @@ int radeon_cp_stop( struct inode *inode, struct file *filp, int ret; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &stop, (drm_radeon_init_t *)arg, sizeof(stop) ) ) return -EFAULT; @@ -952,11 +915,8 @@ int radeon_cp_reset( struct inode *inode, struct file *filp, drm_radeon_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( !dev_priv ) { DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); return -EINVAL; @@ -978,11 +938,7 @@ int radeon_cp_idle( struct inode *inode, struct file *filp, drm_radeon_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); return radeon_do_cp_idle( dev_priv ); } @@ -994,11 +950,7 @@ int radeon_engine_reset( struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); return radeon_do_engine_reset( dev ); } @@ -1048,11 +1000,7 @@ int radeon_fullscreen( struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; drm_radeon_fullscreen_t fs; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &fs, (drm_radeon_fullscreen_t *)arg, sizeof(fs) ) ) @@ -1085,8 +1033,8 @@ static int radeon_freelist_init( drm_device_t *dev ) drm_radeon_freelist_t *entry; int i; - dev_priv->head = drm_alloc( sizeof(drm_radeon_freelist_t), - DRM_MEM_DRIVER ); + dev_priv->head = DRM(alloc)( sizeof(drm_radeon_freelist_t), + DRM_MEM_DRIVER ); if ( dev_priv->head == NULL ) return -ENOMEM; @@ -1097,8 +1045,8 @@ static int radeon_freelist_init( drm_device_t *dev ) buf = dma->buflist[i]; buf_priv = buf->dev_private; - entry = drm_alloc( sizeof(drm_radeon_freelist_t), - DRM_MEM_DRIVER ); + entry = DRM(alloc)( sizeof(drm_radeon_freelist_t), + DRM_MEM_DRIVER ); if ( !entry ) return -ENOMEM; entry->age = RADEON_BUFFER_FREE; @@ -1218,13 +1166,9 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) int i; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - ring->space = *ring->head - ring->tail; - if ( ring->space <= 0 ) - ring->space += ring->size; - - if ( ring->space >= n ) + radeon_update_ring_snapshot( ring ); + if ( ring->space > n ) return 0; - udelay( 1 ); } @@ -1233,17 +1177,6 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) return -EBUSY; } -void radeon_update_ring_snapshot( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_ring_buffer_t *ring = &dev_priv->ring; - - ring->space = *ring->head - ring->tail; - if ( ring->space == 0 ) - atomic_inc( &dev_priv->idle_count ); - if ( ring->space <= 0 ) - ring->space += ring->size; -} - static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d ) { int i; @@ -1276,14 +1209,10 @@ int radeon_cp_buffers( struct inode *inode, struct file *filp, int ret = 0; drm_dma_t d; - if ( copy_from_user( &d, (drm_dma_t *) arg, sizeof(d) ) ) - return -EFAULT; + LOCK_TEST_WITH_RETURN( dev ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) ) + return -EFAULT; /* Please don't send us buffers. */ @@ -1307,7 +1236,7 @@ int radeon_cp_buffers( struct inode *inode, struct file *filp, ret = radeon_cp_get_buffers( dev, &d ); } - if ( copy_to_user( (drm_dma_t *) arg, &d, sizeof(d) ) ) + if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) ) return -EFAULT; return ret; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h index c5f9f66d1..50a7d6ed8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h @@ -26,7 +26,6 @@ * Authors: * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> - * */ #ifndef __RADEON_DRM_H__ @@ -74,7 +73,7 @@ /* Vertex/indirect buffer size */ -#define RADEON_BUFFER_SIZE 16384 +#define RADEON_BUFFER_SIZE 65536 /* Byte offsets for indirect buffer data */ @@ -276,15 +275,18 @@ typedef struct drm_radeon_fullscreen { #define CLEAR_Y2 3 #define CLEAR_DEPTH 4 +typedef union drm_radeon_clear_rect { + float f[5]; + unsigned int ui[5]; +} drm_radeon_clear_rect_t; + typedef struct drm_radeon_clear { unsigned int flags; - int x, y, w, h; unsigned int clear_color; unsigned int clear_depth; - union { - float f[5]; - unsigned int ui[5]; - } rect; + unsigned int color_mask; + unsigned int depth_mask; + drm_radeon_clear_rect_t *depth_boxes; } drm_radeon_clear_t; typedef struct drm_radeon_vertex { @@ -302,14 +304,20 @@ typedef struct drm_radeon_indices { int discard; /* Client finished with buffer? */ } drm_radeon_indices_t; -typedef struct drm_radeon_blit { - int idx; - int pitch; +typedef struct drm_radeon_tex_image { + unsigned int x, y; /* Blit coordinates */ + unsigned int width, height; + const void *data; +} drm_radeon_tex_image_t; + +typedef struct drm_radeon_texture { int offset; + int pitch; int format; - unsigned short x, y; - unsigned short width, height; -} drm_radeon_blit_t; + int width; /* Texture image coordinates */ + int height; + drm_radeon_tex_image_t *image; +} drm_radeon_texture_t; typedef struct drm_radeon_stipple { unsigned int *mask; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c index 0113ed97c..dba2037f9 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c @@ -1,7 +1,7 @@ /* radeon_drv.c -- ATI Radeon driver -*- linux-c -*- + * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -18,685 +18,70 @@ * 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 + * VA LINUX SYSTEMS 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: Kevin E. Martin <martin@valinux.com> - * Rickard E. (Rik) Faith <faith@valinux.com> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "radeon.h" #include "drmP.h" #include "radeon_drv.h" -#define RADEON_NAME "radeon" -#define RADEON_DESC "ATI Radeon" -#define RADEON_DATE "20010105" -#define RADEON_MAJOR 1 -#define RADEON_MINOR 0 -#define RADEON_PATCHLEVEL 0 - -static drm_device_t radeon_device; -drm_ctx_t radeon_res_ctx; - -static struct file_operations radeon_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: radeon_open, - flush: drm_flush, - release: radeon_release, - ioctl: radeon_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice radeon_misc = { - minor: MISC_DYNAMIC_MINOR, - name: RADEON_NAME, - fops: &radeon_fops, -}; - -static drm_ioctl_desc_t radeon_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { radeon_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_BUFS)] = { radeon_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { radeon_mapbufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { radeon_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { radeon_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { radeon_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { radeon_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { radeon_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { radeon_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { radeon_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_DMA)] = { radeon_cp_buffers, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { radeon_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { radeon_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - [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 - - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)] = { radeon_cp_start, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_BLIT)] = { radeon_cp_blit, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)]= { radeon_cp_indirect,1, 1 }, -}; -#define RADEON_IOCTL_COUNT DRM_ARRAY_SIZE(radeon_ioctls) - -#ifdef MODULE -static char *radeon = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("radeon"); -MODULE_PARM(radeon, "s"); - -#ifndef MODULE -/* radeon_options 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_drm. - */ - -static int __init radeon_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("radeon=", radeon_options); -#endif - -static int radeon_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); - - drm_dma_setup(dev); - - 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_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); - - radeon_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 radeon_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"); - - 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; - } - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - /* 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 radeon_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(); - - 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; - } - - drm_dma_takedown(dev); - - dev->queue_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; -} - -/* radeon_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init radeon_init(void) -{ - int retcode; - drm_device_t *dev = &radeon_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(radeon); -#endif - - if ((retcode = misc_register(&radeon_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", RADEON_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, radeon_misc.minor); - dev->name = RADEON_NAME; - - drm_mem_init(); - drm_proc_init(dev); - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - dev->agp = drm_agp_init(); - if (dev->agp == NULL) { - DRM_ERROR("Cannot initialize agpgart module.\n"); - drm_proc_cleanup(); - misc_deregister(&radeon_misc); - radeon_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 - - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&radeon_misc); - radeon_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - RADEON_NAME, - RADEON_MAJOR, - RADEON_MINOR, - RADEON_PATCHLEVEL, - RADEON_DATE, - radeon_misc.minor); - - return 0; -} - -/* radeon_cleanup is called via cleanup_module at module unload time. */ - -static void __exit radeon_cleanup(void) -{ - drm_device_t *dev = &radeon_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&radeon_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); - radeon_takedown(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -#endif -} - -module_init(radeon_init); -module_exit(radeon_cleanup); - - -int radeon_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = RADEON_MAJOR; - version.version_minor = RADEON_MINOR; - version.version_patchlevel = RADEON_PATCHLEVEL; - - DRM_COPY(version.name, RADEON_NAME); - DRM_COPY(version.date, RADEON_DATE); - DRM_COPY(version.desc, RADEON_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int radeon_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &radeon_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return radeon_setup(dev); - } - spin_unlock(&dev->count_lock); - } - - return retcode; -} - -int radeon_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - - /* Force the cleanup of page flipping when required */ - if ( dev->dev_private ) { - drm_radeon_private_t *dev_priv = dev->dev_private; - if ( dev_priv->page_flipping ) { - radeon_do_cleanup_pageflip( dev ); - } - } - - if (!(retcode = drm_release(inode, filp))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - 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); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return radeon_takedown(dev); - } - spin_unlock(&dev->count_lock); - } - - unlock_kernel(); - return retcode; -} +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." + +#define DRIVER_NAME "radeon" +#define DRIVER_DESC "ATI Radeon" +#define DRIVER_DATE "20010308" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 1 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)] = { radeon_cp_start, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_TEXTURE)] = { radeon_cp_texture, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)] = { radeon_cp_indirect, 1, 1 }, -/* radeon_ioctl is called whenever a process performs an ioctl on /dev/drm. */ -int radeon_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 >= RADEON_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &radeon_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 radeon_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 - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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 (lock.context < 0 /* || lock.context >= dev->queue_count */) - return -EINVAL; - - if (!ret) { - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - 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); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - if (lock.flags & _DRM_LOCK_READY) { - /* Wait for space in DMA/FIFO */ - } - if (lock.flags & _DRM_LOCK_QUIESCENT) { - /* Make hardware quiescent */ - DRM_DEBUG("not quiescent!\n"); #if 0 - radeon_quiescent(dev); -#endif - } - } - -#if LINUX_VERSION_CODE < 0x020400 - if (lock.context != radeon_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY/4; - } -#endif - 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 radeon_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; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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 LINUX_VERSION_CODE < 0x020400 - if (lock.context != radeon_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY; - } -#endif - unblock_all_signals(); - return 0; -} +/* GH: Count data sent to card via ring or vertex/indirect buffers. + */ +#define __HAVE_COUNTERS 3 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY +#endif + + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h index 06b541991..f176bb560 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h @@ -24,10 +24,8 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - * + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ #ifndef __RADEON_DRV_H__ @@ -50,6 +48,8 @@ typedef struct drm_radeon_ring_buffer { u32 tail; u32 tail_mask; int space; + + int high_mark; } drm_radeon_ring_buffer_t; typedef struct drm_radeon_depth_clear_t { @@ -91,13 +91,13 @@ typedef struct drm_radeon_private { u32 crtc_offset; u32 crtc_offset_cntl; - unsigned int color_fmt; + u32 color_fmt; unsigned int front_offset; unsigned int front_pitch; unsigned int back_offset; unsigned int back_pitch; - unsigned int depth_fmt; + u32 depth_fmt; unsigned int depth_offset; unsigned int depth_pitch; @@ -124,18 +124,6 @@ typedef struct drm_radeon_buf_priv { drm_radeon_freelist_t *list_entry; } drm_radeon_buf_priv_t; - /* radeon_drv.c */ -extern int radeon_version( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_open( struct inode *inode, struct file *filp ); -extern int radeon_release( struct inode *inode, struct file *filp ); -extern int radeon_ioctl( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_lock( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int radeon_unlock( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - /* radeon_cp.c */ extern int radeon_cp_init( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); @@ -158,9 +146,17 @@ extern void radeon_freelist_reset( drm_device_t *dev ); extern drm_buf_t *radeon_freelist_get( drm_device_t *dev ); extern int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ); -extern void radeon_update_ring_snapshot( drm_radeon_private_t *dev_priv ); + +static inline void +radeon_update_ring_snapshot( drm_radeon_ring_buffer_t *ring ) +{ + ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; +} extern int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ); +extern int radeon_do_cleanup_cp( drm_device_t *dev ); extern int radeon_do_cleanup_pageflip( drm_device_t *dev ); /* radeon_state.c */ @@ -172,38 +168,13 @@ extern int radeon_cp_vertex( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); extern int radeon_cp_indices( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int radeon_cp_blit( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); +extern int radeon_cp_texture( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); extern int radeon_cp_stipple( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); extern int radeon_cp_indirect( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); - /* radeon_bufs.c */ -extern int radeon_addbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int radeon_mapbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - - /* radeon_context.c */ -extern int radeon_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int radeon_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int radeon_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int radeon_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int radeon_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int radeon_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int radeon_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int radeon_context_switch(drm_device_t *dev, int old, int new); -extern int radeon_context_switch_complete(drm_device_t *dev, int new); - /* Register definitions, register access macros and drmAddMap constants * for Radeon kernel driver. @@ -514,14 +485,14 @@ extern int radeon_context_switch_complete(drm_device_t *dev, int new); #define RADEON_COLOR_FORMAT_RGB8 9 #define RADEON_COLOR_FORMAT_ARGB4444 15 -#define RADEON_TXF_8BPP_I 0 -#define RADEON_TXF_16BPP_AI88 1 -#define RADEON_TXF_8BPP_RGB332 2 -#define RADEON_TXF_16BPP_ARGB1555 3 -#define RADEON_TXF_16BPP_RGB565 4 -#define RADEON_TXF_16BPP_ARGB4444 5 -#define RADEON_TXF_32BPP_ARGB8888 6 -#define RADEON_TXF_32BPP_RGBA8888 7 +#define RADEON_TXFORMAT_I8 0 +#define RADEON_TXFORMAT_AI88 1 +#define RADEON_TXFORMAT_RGB332 2 +#define RADEON_TXFORMAT_ARGB1555 3 +#define RADEON_TXFORMAT_RGB565 4 +#define RADEON_TXFORMAT_ARGB4444 5 +#define RADEON_TXFORMAT_ARGB8888 6 +#define RADEON_TXFORMAT_RGBA8888 7 /* Constants */ #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ @@ -534,27 +505,27 @@ extern int radeon_context_switch_complete(drm_device_t *dev, int new); #define RADEON_MAX_VB_AGE 0x7fffffff #define RADEON_MAX_VB_VERTS (0xffff) +#define RADEON_RING_HIGH_MARK 128 + #define RADEON_BASE(reg) ((u32)(dev_priv->mmio->handle)) -#define RADEON_ADDR(reg) (RADEON_BASE(reg) + reg) +#define RADEON_ADDR(reg) (RADEON_BASE( reg ) + reg) -#define RADEON_DEREF(reg) *(__volatile__ u32 *)RADEON_ADDR(reg) -#define RADEON_READ(reg) RADEON_DEREF(reg) -#define RADEON_WRITE(reg,val) do { RADEON_DEREF(reg) = val; } while (0) +#define RADEON_DEREF(reg) *(volatile u32 *)RADEON_ADDR( reg ) +#define RADEON_READ(reg) RADEON_DEREF( reg ) +#define RADEON_WRITE(reg, val) do { RADEON_DEREF( reg ) = val; } while (0) -#define RADEON_DEREF8(reg) *(__volatile__ u8 *)RADEON_ADDR(reg) -#define RADEON_READ8(reg) RADEON_DEREF8(reg) -#define RADEON_WRITE8(reg,val) do { RADEON_DEREF8(reg) = val; } while (0) +#define RADEON_DEREF8(reg) *(volatile u8 *)RADEON_ADDR( reg ) +#define RADEON_READ8(reg) RADEON_DEREF8( reg ) +#define RADEON_WRITE8(reg, val) do { RADEON_DEREF8( reg ) = val; } while (0) -#define RADEON_WRITE_PLL(addr,val) \ -do { \ - RADEON_WRITE8(RADEON_CLOCK_CNTL_INDEX, \ - ((addr) & 0x1f) | RADEON_PLL_WR_EN); \ - RADEON_WRITE(RADEON_CLOCK_CNTL_DATA, (val)); \ +#define RADEON_WRITE_PLL( addr, val ) do { \ + RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \ + ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \ + RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \ } while (0) -extern int RADEON_READ_PLL(drm_device_t *dev, int addr); - +extern int RADEON_READ_PLL( drm_device_t *dev, int addr ); #define CP_PACKET0( reg, n ) \ @@ -573,54 +544,46 @@ extern int RADEON_READ_PLL(drm_device_t *dev, int addr); * Engine control helper macros */ -#define RADEON_WAIT_UNTIL_2D_IDLE() \ -do { \ +#define RADEON_WAIT_UNTIL_2D_IDLE() do { \ OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ RADEON_WAIT_HOST_IDLECLEAN) ); \ } while (0) -#define RADEON_WAIT_UNTIL_3D_IDLE() \ -do { \ +#define RADEON_WAIT_UNTIL_3D_IDLE() do { \ OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \ RADEON_WAIT_HOST_IDLECLEAN) ); \ } while (0) -#define RADEON_WAIT_UNTIL_IDLE() \ -do { \ +#define RADEON_WAIT_UNTIL_IDLE() do { \ OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ RADEON_WAIT_3D_IDLECLEAN | \ RADEON_WAIT_HOST_IDLECLEAN) ); \ } while (0) -#define RADEON_WAIT_UNTIL_PAGE_FLIPPED() \ -do { \ +#define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do { \ OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ OUT_RING( RADEON_WAIT_CRTC_PFLIP ); \ } while (0) -#define RADEON_FLUSH_CACHE() \ -do { \ +#define RADEON_FLUSH_CACHE() do { \ OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ OUT_RING( RADEON_RB2D_DC_FLUSH ); \ } while (0) -#define RADEON_PURGE_CACHE() \ -do { \ +#define RADEON_PURGE_CACHE() do { \ OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ OUT_RING( RADEON_RB2D_DC_FLUSH_ALL ); \ } while (0) -#define RADEON_FLUSH_ZCACHE() \ -do { \ +#define RADEON_FLUSH_ZCACHE() do { \ OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ OUT_RING( RADEON_RB3D_ZC_FLUSH ); \ } while (0) -#define RADEON_PURGE_ZCACHE() \ -do { \ +#define RADEON_PURGE_ZCACHE() do { \ OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \ } while (0) @@ -630,7 +593,33 @@ do { \ * Misc helper macros */ -#define VB_AGE_CHECK_WITH_RET( dev_priv ) \ +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != current->pid ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return -EINVAL; \ + } \ +} while (0) + +#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_radeon_ring_buffer_t *ring = &dev_priv->ring; int i; \ + if ( ring->space < ring->high_mark ) { \ + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ + radeon_update_ring_snapshot( ring ); \ + if ( ring->space >= ring->high_mark ) \ + goto __ring_space_done; \ + udelay( 1 ); \ + } \ + DRM_ERROR( "ring space check failed!\n" ); \ + return -EBUSY; \ + } \ + __ring_space_done: \ +} while (0) + +#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ do { \ drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; \ if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \ @@ -641,20 +630,17 @@ do { \ } \ } while (0) -#define RADEON_DISPATCH_AGE( age ) \ -do { \ +#define RADEON_DISPATCH_AGE( age ) do { \ OUT_RING( CP_PACKET0( RADEON_LAST_DISPATCH_REG, 0 ) ); \ OUT_RING( age ); \ } while (0) -#define RADEON_FRAME_AGE( age ) \ -do { \ +#define RADEON_FRAME_AGE( age ) do { \ OUT_RING( CP_PACKET0( RADEON_LAST_FRAME_REG, 0 ) ); \ OUT_RING( age ); \ } while (0) -#define RADEON_CLEAR_AGE( age ) \ -do { \ +#define RADEON_CLEAR_AGE( age ) do { \ OUT_RING( CP_PACKET0( RADEON_LAST_CLEAR_REG, 0 ) ); \ OUT_RING( age ); \ } while (0) @@ -676,7 +662,7 @@ do { \ DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ n, __FUNCTION__ ); \ } \ - if ( dev_priv->ring.space < (n) * sizeof(u32) ) { \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ radeon_wait_ring( dev_priv, (n) * sizeof(u32) ); \ } \ dev_priv->ring.space -= (n) * sizeof(u32); \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c index 7bfefb2ca..9360c43b0 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c @@ -23,12 +23,12 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> - * + * Kevin E. Martin <martin@valinux.com> */ #define __NO_VERSION__ +#include "radeon.h" #include "drmP.h" #include "radeon_drv.h" #include "drm.h" @@ -486,7 +486,8 @@ static void radeon_print_dirty( const char *msg, unsigned int flags ) } static void radeon_cp_dispatch_clear( drm_device_t *dev, - drm_radeon_clear_t *clear ) + drm_radeon_clear_t *clear, + drm_radeon_clear_rect_t *depth_boxes ) { drm_radeon_private_t *dev_priv = dev->dev_private; drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; @@ -497,8 +498,6 @@ static void radeon_cp_dispatch_clear( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - radeon_update_ring_snapshot( dev_priv ); - if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { unsigned int tmp = flags; @@ -525,7 +524,7 @@ static void radeon_cp_dispatch_clear( drm_device_t *dev, RADEON_WAIT_UNTIL_3D_IDLE(); OUT_RING( CP_PACKET0( RADEON_DP_WRITE_MASK, 0 ) ); - OUT_RING( sarea_priv->context_state.rb3d_planemask ); + OUT_RING( clear->color_mask ); ADVANCE_RING(); @@ -609,17 +608,17 @@ static void radeon_cp_dispatch_clear( drm_device_t *dev, RADEON_VTX_FMT_RADEON_MODE | (3 << RADEON_NUM_VERTICES_SHIFT)) ); - OUT_RING( clear->rect.ui[CLEAR_X1] ); - OUT_RING( clear->rect.ui[CLEAR_Y1] ); - OUT_RING( clear->rect.ui[CLEAR_DEPTH] ); + OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); - OUT_RING( clear->rect.ui[CLEAR_X1] ); - OUT_RING( clear->rect.ui[CLEAR_Y2] ); - OUT_RING( clear->rect.ui[CLEAR_DEPTH] ); + OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); - OUT_RING( clear->rect.ui[CLEAR_X2] ); - OUT_RING( clear->rect.ui[CLEAR_Y2] ); - OUT_RING( clear->rect.ui[CLEAR_DEPTH] ); + OUT_RING( depth_boxes[i].ui[CLEAR_X2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); ADVANCE_RING(); @@ -655,8 +654,6 @@ static void radeon_cp_dispatch_swap( drm_device_t *dev ) RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - radeon_update_ring_snapshot( dev_priv ); - #if RADEON_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ @@ -724,8 +721,6 @@ static void radeon_cp_dispatch_flip( drm_device_t *dev ) RING_LOCALS; DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); - radeon_update_ring_snapshot( dev_priv ); - #if RADEON_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ @@ -776,9 +771,7 @@ static void radeon_cp_dispatch_vertex( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s: nbox=%d\n", __FUNCTION__, sarea_priv->nbox ); - radeon_update_ring_snapshot( dev_priv ); - - if ( 1 ) + if ( 0 ) radeon_print_dirty( "dispatch_vertex", sarea_priv->dirty ); if ( buf->used ) { @@ -844,8 +837,6 @@ static void radeon_cp_dispatch_indirect( drm_device_t *dev, DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end ); - radeon_update_ring_snapshot( dev_priv ); - if ( start != end ) { int offset = (dev_priv->agp_buffers_offset + buf->offset + start); @@ -908,8 +899,6 @@ static void radeon_cp_dispatch_indices( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - radeon_update_ring_snapshot( dev_priv ); - if ( 0 ) radeon_print_dirty( "dispatch_indices", sarea_priv->dirty ); @@ -971,50 +960,67 @@ static void radeon_cp_dispatch_indices( drm_device_t *dev, sarea_priv->nbox = 0; } -static int radeon_cp_dispatch_blit( drm_device_t *dev, - drm_radeon_blit_t *blit ) +#define RADEON_MAX_TEXTURE_SIZE (RADEON_BUFFER_SIZE - 8 * sizeof(u32)) + +static int radeon_cp_dispatch_texture( drm_device_t *dev, + drm_radeon_texture_t *tex, + drm_radeon_tex_image_t *image ) { drm_radeon_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; drm_buf_t *buf; drm_radeon_buf_priv_t *buf_priv; u32 format; - u32 *data; - int dword_shift, dwords; + u32 *buffer; + u8 *data; + int size, dwords, tex_width, blit_width; + u32 y, height; + int ret = 0, i; RING_LOCALS; - DRM_DEBUG( "blit: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n", - blit->offset >> 10, blit->pitch, blit->format, - blit->x, blit->y, blit->width, blit->height ); - radeon_update_ring_snapshot( dev_priv ); + /* FIXME: Be smarter about this... + */ + buf = radeon_freelist_get( dev ); + if ( !buf ) return -EAGAIN; + + DRM_DEBUG( "tex: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n", + tex->offset >> 10, tex->pitch, tex->format, + image->x, image->y, image->width, image->height ); + + buf_priv = buf->dev_private; /* The compiler won't optimize away a division by a variable, * even if the only legal values are powers of two. Thus, we'll * use a shift instead. */ - switch ( blit->format ) { - case RADEON_TXF_32BPP_ARGB8888: - case RADEON_TXF_32BPP_RGBA8888: + switch ( tex->format ) { + case RADEON_TXFORMAT_ARGB8888: + case RADEON_TXFORMAT_RGBA8888: format = RADEON_COLOR_FORMAT_ARGB8888; - dword_shift = 0; + tex_width = tex->width * 4; + blit_width = image->width * 4; break; - case RADEON_TXF_16BPP_AI88: - case RADEON_TXF_16BPP_ARGB1555: - case RADEON_TXF_16BPP_RGB565: - case RADEON_TXF_16BPP_ARGB4444: + case RADEON_TXFORMAT_AI88: + case RADEON_TXFORMAT_ARGB1555: + case RADEON_TXFORMAT_RGB565: + case RADEON_TXFORMAT_ARGB4444: format = RADEON_COLOR_FORMAT_RGB565; - dword_shift = 1; + tex_width = tex->width * 2; + blit_width = image->width * 2; break; - case RADEON_TXF_8BPP_I: - case RADEON_TXF_8BPP_RGB332: + case RADEON_TXFORMAT_I8: + case RADEON_TXFORMAT_RGB332: format = RADEON_COLOR_FORMAT_CI8; - dword_shift = 2; + tex_width = tex->width * 1; + blit_width = image->width * 1; break; default: - DRM_ERROR( "invalid blit format %d\n", blit->format ); + DRM_ERROR( "invalid texture format %d\n", tex->format ); return -EINVAL; } + DRM_DEBUG( " tex=%dx%d blit=%d\n", + tex_width, tex->height, blit_width ); + /* Flush the pixel cache. This ensures no pixel data gets mixed * up with the texture data from the host data blit, otherwise * part of the texture image may be corrupted. @@ -1026,46 +1032,88 @@ static int radeon_cp_dispatch_blit( drm_device_t *dev, ADVANCE_RING(); - /* Dispatch the indirect buffer. + /* Make a copy of the parameters in case we have to update them + * for a multi-pass texture blit. */ - buf = dma->buflist[blit->idx]; - buf_priv = buf->dev_private; + y = image->y; + height = image->height; + data = (u8 *)image->data; - if ( buf->pid != current->pid ) { - DRM_ERROR( "process %d using buffer owned by %d\n", - current->pid, buf->pid ); - return -EINVAL; - } - if ( buf->pending ) { - DRM_ERROR( "sending pending buffer %d\n", blit->idx ); - return -EINVAL; - } + size = height * blit_width; - buf_priv->discard = 1; + if ( size > RADEON_MAX_TEXTURE_SIZE ) { + /* Texture image is too large, do a multipass upload */ + ret = -EAGAIN; - dwords = (blit->width * blit->height) >> dword_shift; - if ( !dwords ) dwords = 1; + /* Adjust the blit size to fit the indirect buffer */ + height = RADEON_MAX_TEXTURE_SIZE / blit_width; + size = height * blit_width; - data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); + /* Update the input parameters for next time */ + image->y += height; + image->height -= height; + image->data = (char *)image->data + size; - data[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 ); - data[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_BRUSH_NONE | - (format << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_ROP3_S | - RADEON_DP_SRC_SOURCE_HOST_DATA | - RADEON_GMC_CLR_CMP_CNTL_DIS | - RADEON_GMC_WR_MSK_DIS); + if ( copy_to_user( tex->image, image, sizeof(*image) ) ) { + DRM_ERROR( "EFAULT on tex->image\n" ); + return -EFAULT; + } + } else if ( size < 4 ) { + size = 4; + } - data[2] = (blit->pitch << 22) | (blit->offset >> 10); - data[3] = 0xffffffff; - data[4] = 0xffffffff; - data[5] = (blit->y << 16) | blit->x; - data[6] = (blit->height << 16) | blit->width; - data[7] = dwords; + dwords = size / 4; + /* Dispatch the indirect buffer. + */ + buffer = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); + + buffer[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 ); + buffer[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_NONE | + (format << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_S | + RADEON_DP_SRC_SOURCE_HOST_DATA | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_WR_MSK_DIS); + + buffer[2] = (tex->pitch << 22) | (tex->offset >> 10); + buffer[3] = 0xffffffff; + buffer[4] = 0xffffffff; + buffer[5] = (y << 16) | image->x; + buffer[6] = (height << 16) | image->width; + buffer[7] = dwords; + + buffer += 8; + + if ( tex_width >= 32 ) { + /* Texture image width is larger than the minimum, so we + * can upload it directly. + */ + if ( copy_from_user( buffer, data, dwords * sizeof(u32) ) ) { + DRM_ERROR( "EFAULT on data, %d dwords\n", dwords ); + return -EFAULT; + } + } else { + /* Texture image width is less than the minimum, so we + * need to pad out each image scanline to the minimum + * width. + */ + for ( i = 0 ; i < tex->height ; i++ ) { + if ( copy_from_user( buffer, data, tex_width ) ) { + DRM_ERROR( "EFAULT on pad, %d bytes\n", + tex_width ); + return -EFAULT; + } + buffer += 8; + data += tex_width; + } + } + + buf->pid = current->pid; buf->used = (dwords + 8) * sizeof(u32); + buf_priv->discard = 1; radeon_cp_dispatch_indirect( dev, buf, 0, buf->used ); @@ -1080,7 +1128,7 @@ static int radeon_cp_dispatch_blit( drm_device_t *dev, ADVANCE_RING(); - return 0; + return ret; } static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple ) @@ -1090,8 +1138,6 @@ static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple ) RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - radeon_update_ring_snapshot( dev_priv ); - BEGIN_RING( 35 ); OUT_RING( CP_PACKET0( RADEON_RE_STIPPLE_ADDR, 0 ) ); @@ -1118,22 +1164,25 @@ int radeon_cp_clear( struct inode *inode, struct file *filp, drm_radeon_private_t *dev_priv = dev->dev_private; drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_radeon_clear_t clear; + drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); - if ( copy_from_user( &clear, (drm_radeon_clear_t *) arg, + if ( copy_from_user( &clear, (drm_radeon_clear_t *)arg, sizeof(clear) ) ) return -EFAULT; + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; - radeon_cp_dispatch_clear( dev, &clear ); + if ( copy_from_user( &depth_boxes, clear.depth_boxes, + sarea_priv->nbox * sizeof(depth_boxes[0]) ) ) + return -EFAULT; + + radeon_cp_dispatch_clear( dev, &clear, depth_boxes ); return 0; } @@ -1147,11 +1196,9 @@ int radeon_cp_swap( struct inode *inode, struct file *filp, drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; @@ -1178,11 +1225,8 @@ int radeon_cp_vertex( struct inode *inode, struct file *filp, drm_radeon_buf_priv_t *buf_priv; drm_radeon_vertex_t vertex; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( !dev_priv || dev_priv->is_pci ) { DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); return -EINVAL; @@ -1207,7 +1251,8 @@ int radeon_cp_vertex( struct inode *inode, struct file *filp, return -EINVAL; } - VB_AGE_CHECK_WITH_RET( dev_priv ); + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); buf = dma->buflist[vertex.idx]; buf_priv = buf->dev_private; @@ -1243,11 +1288,8 @@ int radeon_cp_indices( struct inode *inode, struct file *filp, drm_radeon_indices_t elts; int count; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( !dev_priv || dev_priv->is_pci ) { DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); return -EINVAL; @@ -1272,7 +1314,8 @@ int radeon_cp_indices( struct inode *inode, struct file *filp, return -EINVAL; } - VB_AGE_CHECK_WITH_RET( dev_priv ); + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); buf = dma->buflist[elts.idx]; buf_priv = buf->dev_private; @@ -1308,37 +1351,34 @@ int radeon_cp_indices( struct inode *inode, struct file *filp, return 0; } -int radeon_cp_blit( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ) +int radeon_cp_texture( 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_radeon_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_radeon_blit_t blit; + drm_radeon_texture_t tex; + drm_radeon_tex_image_t image; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); - if ( copy_from_user( &blit, (drm_radeon_blit_t *)arg, - sizeof(blit) ) ) + if ( copy_from_user( &tex, (drm_radeon_texture_t *)arg, sizeof(tex) ) ) return -EFAULT; - DRM_DEBUG( "%s: pid=%d index=%d\n", - __FUNCTION__, current->pid, blit.idx ); - - if ( blit.idx < 0 || blit.idx > dma->buf_count ) { - DRM_ERROR( "sending %d buffers (of %d max)\n", - blit.idx, dma->buf_count ); + if ( tex.image == NULL ) { + DRM_ERROR( "null texture image!\n" ); return -EINVAL; } - VB_AGE_CHECK_WITH_RET( dev_priv ); + if ( copy_from_user( &image, + (drm_radeon_tex_image_t *)tex.image, + sizeof(image) ) ) + return -EFAULT; + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); - return radeon_cp_dispatch_blit( dev, &blit ); + return radeon_cp_dispatch_texture( dev, &tex, &image ); } int radeon_cp_stipple( struct inode *inode, struct file *filp, @@ -1346,23 +1386,21 @@ int radeon_cp_stipple( struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; drm_radeon_stipple_t stipple; u32 mask[32]; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &stipple, (drm_radeon_stipple_t *)arg, sizeof(stipple) ) ) return -EFAULT; - if ( copy_from_user( &mask, stipple.mask, - 32 * sizeof(u32) ) ) + if ( copy_from_user( &mask, stipple.mask, 32 * sizeof(u32) ) ) return -EFAULT; + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + radeon_cp_dispatch_stipple( dev, mask ); return 0; @@ -1380,11 +1418,8 @@ int radeon_cp_indirect( struct inode *inode, struct file *filp, drm_radeon_indirect_t indirect; RING_LOCALS; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( !dev_priv || dev_priv->is_pci ) { DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); return -EINVAL; @@ -1423,7 +1458,8 @@ int radeon_cp_indirect( struct inode *inode, struct file *filp, return -EINVAL; } - VB_AGE_CHECK_WITH_RET( dev_priv ); + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); buf->used = indirect.end; buf_priv->discard = indirect.discard; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h new file mode 100644 index 000000000..f5046f7f9 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h @@ -0,0 +1,44 @@ +/* stubsupport.h -- -*- linux-c -*- + * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org + * + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. + * 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@valinux.com> + * + */ + +#ifndef _STUBSUPPORT_PRE24_H_ +#define _STUBSUPPORT_PRE24_H_ +struct drm_stub_info *DRM(_stub_pointer) = NULL; +#define inter_module_put(x) +#define inter_module_unregister(x) +#define inter_module_get(x) DRM(_stub_pointer) +#define inter_module_register(x,y,z) do { DRM(_stub_pointer) = z; } while (0) + + /* This is a kludge for backward compatibility + that is only useful in DRM(stub_open) */ +#define fops_put(fops) MOD_DEC_USE_COUNT +#define fops_get(fops) (fops); MOD_INC_USE_COUNT + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h new file mode 100644 index 000000000..40aba8fb2 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h @@ -0,0 +1,42 @@ +/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * 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 + * VA LINUX SYSTEMS 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: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __TDFX_H__ +#define __TDFX_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) tdfx_##x + +/* General customization: + */ +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c index 7d79a013b..f478395f8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c @@ -27,670 +27,35 @@ * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * Daryll Strauss <daryll@valinux.com> - * + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "tdfx.h" #include "drmP.h" -#include "tdfx_drv.h" - -#define TDFX_NAME "tdfx" -#define TDFX_DESC "3dfx Banshee/Voodoo3+" -#define TDFX_DATE "20000928" -#define TDFX_MAJOR 1 -#define TDFX_MINOR 0 -#define TDFX_PATCHLEVEL 0 - -static drm_device_t tdfx_device; -drm_ctx_t tdfx_res_ctx; - -static struct file_operations tdfx_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: tdfx_open, - flush: drm_flush, - release: tdfx_release, - ioctl: tdfx_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice tdfx_misc = { - minor: MISC_DYNAMIC_MINOR, - name: TDFX_NAME, - fops: &tdfx_fops, -}; - -static drm_ioctl_desc_t tdfx_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { tdfx_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)] = { tdfx_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { tdfx_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { tdfx_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { tdfx_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { tdfx_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { tdfx_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { tdfx_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)] = { tdfx_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - [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, 1}, - [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_unbind, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_bind, 1, 1}, -#endif -}; -#define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls) - -#ifdef MODULE -static char *tdfx = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("tdfx"); -MODULE_PARM(tdfx, "s"); - -#ifndef MODULE -/* tdfx_options 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_drm. - */ - -static int __init tdfx_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("tdfx=", tdfx_options); -#endif - -static int tdfx_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); - - tdfx_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 tdfx_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"); - - 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; - } -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - /* Clear AGP information */ - if (dev->agp) { - drm_agp_mem_t *temp; - drm_agp_mem_t *temp_next; - - temp = dev->agp->memory; - while(temp != NULL) { - temp_next = temp->next; - drm_free_agp(temp->memory, temp->pages); - drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); - temp = temp_next; - } - if (dev->agp->acquired) _drm_agp_release(); - } -#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; -} - -/* tdfx_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init tdfx_init(void) -{ - int retcode; - drm_device_t *dev = &tdfx_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(tdfx); -#endif - - if ((retcode = misc_register(&tdfx_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", TDFX_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, tdfx_misc.minor); - dev->name = TDFX_NAME; - - drm_mem_init(); - drm_proc_init(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - dev->agp = drm_agp_init(); -#endif - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&tdfx_misc); - tdfx_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - TDFX_NAME, - TDFX_MAJOR, - TDFX_MINOR, - TDFX_PATCHLEVEL, - TDFX_DATE, - tdfx_misc.minor); - - return 0; -} - -/* tdfx_cleanup is called via cleanup_module at module unload time. */ - -static void __exit tdfx_cleanup(void) -{ - drm_device_t *dev = &tdfx_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&tdfx_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); - tdfx_takedown(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -#endif -} - -module_init(tdfx_init); -module_exit(tdfx_cleanup); - - -int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = TDFX_MAJOR; - version.version_minor = TDFX_MINOR; - version.version_patchlevel = TDFX_PATCHLEVEL; - - DRM_COPY(version.name, TDFX_NAME); - DRM_COPY(version.date, TDFX_DATE); - DRM_COPY(version.desc, TDFX_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int tdfx_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &tdfx_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return tdfx_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int tdfx_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_release(inode, filp))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - 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); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return tdfx_takedown(dev); - } - spin_unlock(&dev->count_lock); - } - - unlock_kernel(); - return retcode; -} - -/* tdfx_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int tdfx_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 >= TDFX_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &tdfx_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 tdfx_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 - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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 - tdfx. 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 == tdfx_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 (;;) { - current->state = TASK_INTERRUPTIBLE; - 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); -#if 1 - current->policy |= SCHED_YIELD; -#endif - 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 != tdfx_res_ctx.handle && - dev->last_context != tdfx_res_ctx.handle) { - add_wait_queue(&dev->context_wait, &entry); - current->state = TASK_INTERRUPTIBLE; - /* PRE: dev->last_context != lock.context */ - tdfx_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) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_READY) { - /* Wait for space in DMA/FIFO */ - } - if (lock.flags & _DRM_LOCK_QUIESCENT) { - /* Make hardware quiescent */ -#if 0 - tdfx_quiescent(dev); -#endif - } - } - -#if LINUX_VERSION_CODE < 0x020400 - if (lock.context != tdfx_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY/4; - } -#endif - 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 tdfx_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; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -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 LINUX_VERSION_CODE < 0x020400 - if (lock.context != tdfx_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY; - } -#endif - unblock_all_signals(); - return 0; -} +#define DRIVER_AUTHOR "VA Linux Systems Inc." + +#define DRIVER_NAME "tdfx" +#define DRIVER_DESC "3dfx Banshee/Voodoo3+" +#define DRIVER_DATE "20010216" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + + +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" 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 5c2c08c3b..a7be5031c 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 @@ -11,11 +11,11 @@ * 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 @@ -23,12 +23,12 @@ * 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@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.17 2000/09/24 13:51:32 alanh Exp $ - * + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.18 2001/03/21 18:08:54 dawes Exp $ + * */ #ifdef XFree86Server @@ -81,7 +81,18 @@ extern unsigned long _bus_base(void); #include "xf86drm.h" #include "drm.h" -#define DRM_FIXED_DEVICE_MAJOR 145 +#ifndef DRM_MAJOR +#define DRM_MAJOR 226 /* Linux */ +#endif + +#ifndef __linux__ +#undef DRM_MAJOR +#define DRM_MAJOR 145 /* Should set in drm.h for *BSD */ +#endif + +#ifndef DRM_MAX_MINOR +#define DRM_MAX_MINOR 16 +#endif #ifdef __linux__ #include <sys/sysmacros.h> /* for makedev() */ @@ -119,7 +130,7 @@ void drmFree(void *pt) static char *drmStrdup(const char *s) { char *retval = NULL; - + if (s) { retval = _DRM_MALLOC(strlen(s)+1); strcpy(retval, s); @@ -161,93 +172,108 @@ static drmHashEntry *drmGetEntry(int fd) return entry; } -/* drm_open is used to open the /dev/dri device */ - -static int drm_open(const char *file) -{ - int fd = open(file, O_RDWR, 0); - - if (fd >= 0) return fd; - return -errno; -} - -static int drmOpenDevice(const char *path, long dev, - mode_t mode, uid_t user, gid_t group) +static int drmOpenDevice(long dev, int minor) { #ifdef XFree86LOADER struct xf86stat st; #else struct stat st; #endif + char buf[64]; + int fd; + mode_t dirmode = DRM_DEV_DIRMODE; + mode_t devmode = DRM_DEV_MODE; + int isroot = !geteuid(); +#if defined(XFree86Server) + uid_t user = DRM_DEV_UID; + gid_t group = DRM_DEV_GID; +#endif - /* Fiddle mode to remove execute bits */ - mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); +#if defined(XFree86Server) + devmode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE; + dirmode = (devmode & S_IRUSR) ? S_IXUSR : 0; + dirmode |= (devmode & S_IRGRP) ? S_IXGRP : 0; + dirmode |= (devmode & S_IROTH) ? S_IXOTH : 0; + dirmode |= devmode; + devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); + group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID; +#endif - if (!stat(path, &st) && st.st_rdev == dev) { - if (!geteuid()) { - chown(path, user, group); - chmod(path, mode); - } - return drm_open(path); + if (stat(DRM_DIR_NAME, &st)) { + if (!isroot) return DRM_ERR_NOT_ROOT; + remove(DRM_DIR_NAME); + mkdir(DRM_DIR_NAME, dirmode); } +#if defined(XFree86Server) + chown(DRM_DIR_NAME, user, group); + chmod(DRM_DIR_NAME, dirmode); +#endif - if (geteuid()) return DRM_ERR_NOT_ROOT; - remove(path); - if (mknod(path, S_IFCHR, dev)) { - remove(path); - return DRM_ERR_NOT_ROOT; + sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor); + if (stat(buf, &st) || st.st_rdev != dev) { + if (!isroot) return DRM_ERR_NOT_ROOT; + remove(buf); + mknod(buf, S_IFCHR | devmode, dev); } - chown(path, user, group); - chmod(path, mode); - return drm_open(path); +#if defined(XFree86Server) + chown(buf, user, group); + chmod(buf, devmode); +#endif + + if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd; + remove(buf); + return -errno; } -/* drmAvailable looks for /proc/dri, and returns 1 if it is present. On - OSs that do not have a Linux-like /proc, this information will not be - available, and we'll have to create a device and check if the driver is - loaded that way. */ +int drmOpenMinor(int minor, int create) +{ + int fd; + char buf[64]; + + if (create) return drmOpenDevice(makedev(DRM_MAJOR, minor), minor); + + sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor); + if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd; + return -errno; +} + +/* drmAvailable looks for (DRM_MAJOR, 0) and returns 1 if it returns + information for DRM_IOCTL_VERSION. For backward compatibility with + older Linux implementations, /proc/dri is also checked. */ int drmAvailable(void) { - char dev_name[64]; drmVersionPtr version; int retval = 0; int fd; + + if ((fd = drmOpenMinor(0, 1)) < 0) { + /* Try proc for backward Linux compatibility */ + if (!access("/proc/dri/0", R_OK)) return 1; + return 0; + } - if (!access("/proc/dri/0", R_OK)) return 1; - - sprintf(dev_name, "/dev/dri-temp-%d", getpid()); - - remove(dev_name); - if ((fd = drmOpenDevice(dev_name, makedev(DRM_FIXED_DEVICE_MAJOR, 0), - S_IRUSR, geteuid(), getegid())) >= 0) { - /* Read version to make sure this is - actually a DRI device. */ - if ((version = drmGetVersion(fd))) { - retval = 1; - drmFreeVersion(version); - } - close(fd); + if ((version = drmGetVersion(fd))) { + retval = 1; + drmFreeVersion(version); } - remove(dev_name); + close(fd); return retval; } static int drmOpenByBusid(const char *busid) { - int i; - char dev_name[64]; - char *buf; - int fd; - - for (i = 0; i < 8; i++) { - sprintf(dev_name, "/dev/dri/card%d", i); - if ((fd = drm_open(dev_name)) >= 0) { + int i; + int fd; + const char *buf; + + for (i = 0; i < DRM_MAX_MINOR; i++) { + if ((fd = drmOpenMinor(i, 0)) >= 0) { buf = drmGetBusid(fd); if (buf && !strcmp(buf, busid)) { - drmFreeBusid(buf); - return fd; + drmFreeBusid(buf); + return fd; } if (buf) drmFreeBusid(buf); close(fd); @@ -258,54 +284,43 @@ static int drmOpenByBusid(const char *busid) static int drmOpenByName(const char *name) { - int i; - char proc_name[64]; - char dev_name[64]; - char buf[512]; - mode_t mode = DRM_DEV_MODE; - mode_t dirmode; - gid_t group = DRM_DEV_GID; - uid_t user = DRM_DEV_UID; - int fd; - char *pt; - char *driver = NULL; - char *devstring; - long dev = 0; - int retcode; - -#if defined(XFree86Server) - mode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE; - group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID; -#endif - -#if defined(XFree86Server) + int i; + int fd; + drmVersionPtr version; + if (!drmAvailable()) { +#if !defined(XFree86Server) + return -1; +#else /* try to load the kernel module now */ if (!xf86LoadKernelModule(name)) { ErrorF("[drm] failed to load kernel module \"%s\"\n", name); return -1; } - } -#else - if (!drmAvailable()) - return -1; #endif + } - if (!geteuid()) { - dirmode = mode; - if (dirmode & S_IRUSR) dirmode |= S_IXUSR; - if (dirmode & S_IRGRP) dirmode |= S_IXGRP; - if (dirmode & S_IROTH) dirmode |= S_IXOTH; - dirmode &= ~(S_IWGRP | S_IWOTH); - mkdir("/dev/dri", 0); - chown("/dev/dri", user, group); - chmod("/dev/dri", dirmode); + for (i = 0; i < DRM_MAX_MINOR; i++) { + if ((fd = drmOpenMinor(i, 1)) >= 0) { + if ((version = drmGetVersion(fd))) { + if (!strcmp(version->name, name)) { + drmFreeVersion(version); + return fd; + } + drmFreeVersion(version); + } + } } +#ifdef __linux__ + /* Backward-compatibility /proc support */ for (i = 0; i < 8; i++) { + char proc_name[64], buf[512]; + char *driver, *pt, *devstring; + int retcode; + sprintf(proc_name, "/proc/dri/%d/name", i); - sprintf(dev_name, "/dev/dri/card%d", i); if ((fd = open(proc_name, 0, 0)) >= 0) { retcode = read(fd, buf, sizeof(buf)-1); close(fd); @@ -319,34 +334,17 @@ static int drmOpenByName(const char *name) for (devstring = ++pt; *pt && *pt != ' '; ++pt) ; if (*pt) { /* Found busid */ - return drmOpenByBusid(++pt); + return drmOpenByBusid(++pt); } else { /* No busid */ - dev = strtol(devstring, NULL, 0); - return drmOpenDevice(dev_name, dev, - mode, user, group); + return drmOpenDevice(strtol(devstring, NULL, 0),i); } } } } - } else { - drmVersionPtr version; - /* /proc/dri not available, possibly - because we aren't on a Linux system. - So, try to create the next device and - see if it's active. */ - dev = makedev(DRM_FIXED_DEVICE_MAJOR, i); - if ((fd = drmOpenDevice(dev_name, dev, mode, user, group))) { - if ((version = drmGetVersion(fd))) { - if (!strcmp(version->name, name)) { - drmFreeVersion(version); - return fd; - } - drmFreeVersion(version); - } - } - remove(dev_name); } } +#endif + return -1; } @@ -408,7 +406,7 @@ drmVersionPtr drmGetVersion(int fd) version->date = NULL; version->desc_len = 0; version->desc = NULL; - + if (ioctl(fd, DRM_IOCTL_VERSION, version)) { drmFreeKernelVersion(version); return NULL; @@ -421,7 +419,7 @@ drmVersionPtr drmGetVersion(int fd) version->date = drmMalloc(version->date_len + 1); if (version->desc_len) version->desc = drmMalloc(version->desc_len + 1); - + if (ioctl(fd, DRM_IOCTL_VERSION, version)) { drmFreeKernelVersion(version); return NULL; @@ -503,7 +501,7 @@ int drmAddMap(int fd, map.offset = offset; #ifdef __alpha__ /* Make sure we add the bus_base to all but shm */ - if (type != DRM_SHM) + if (type != DRM_SHM) map.offset += BUS_BASE; #endif map.size = size; @@ -515,18 +513,28 @@ int drmAddMap(int fd, return 0; } +int drmRmMap(int fd, drmHandle handle) +{ + drm_map_t map; + + map.handle = (void *)handle; + + if(ioctl(fd, DRM_IOCTL_RM_MAP, &map)) return -errno; + return 0; +} + int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags, int agp_offset) { drm_buf_desc_t request; - + request.count = count; request.size = size; request.low_mark = 0; request.high_mark = 0; request.flags = flags; request.agp_start = agp_offset; - + if (ioctl(fd, DRM_IOCTL_ADD_BUFS, &request)) return -errno; return request.count; } @@ -542,16 +550,16 @@ int drmMarkBufs(int fd, double low, double high) if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) return -EINVAL; if (!info.count) return -EINVAL; - + if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) return -ENOMEM; - + if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { int retval = -errno; drmFree(info.list); return retval; } - + for (i = 0; i < info.count; i++) { info.list[i].low_mark = low * info.list[i].count; info.list[i].high_mark = high * info.list[i].count; @@ -562,7 +570,7 @@ int drmMarkBufs(int fd, double low, double high) } } drmFree(info.list); - + return 0; } @@ -630,7 +638,7 @@ drmBufInfoPtr drmGetBufInfo(int fd) if (info.count) { if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) return NULL; - + if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { drmFree(info.list); return NULL; @@ -657,7 +665,7 @@ drmBufMapPtr drmMapBufs(int fd) drm_buf_map_t bufs; drmBufMapPtr retval; int i; - + bufs.count = 0; bufs.list = NULL; if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) return NULL; @@ -689,16 +697,19 @@ drmBufMapPtr drmMapBufs(int fd) int drmUnmapBufs(drmBufMapPtr bufs) { int i; - + for (i = 0; i < bufs->count; i++) { munmap(bufs->list[i].address, bufs->list[i].total); } return 0; } +#define DRM_DMA_RETRY 16 + int drmDMA(int fd, drmDMAReqPtr request) { drm_dma_t dma; + int ret, i = 0; /* Copy to hidden structure */ dma.context = request->context; @@ -710,10 +721,17 @@ int drmDMA(int fd, drmDMAReqPtr request) dma.request_size = request->request_size; dma.request_indices = request->request_list; dma.request_sizes = request->request_sizes; - if (ioctl(fd, DRM_IOCTL_DMA, &dma)) return -errno; - request->granted_count = dma.granted_count; - - return 0; + + do { + ret = ioctl( fd, DRM_IOCTL_DMA, &dma ); + } while ( ret && errno == EAGAIN && i++ < DRM_DMA_RETRY ); + + if ( ret == 0 ) { + request->granted_count = dma.granted_count; + return 0; + } else { + return -errno; + } } int drmGetLock(int fd, drmContext context, drmLockFlags flags) @@ -728,7 +746,7 @@ int drmGetLock(int fd, drmContext context, drmLockFlags flags) if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL; if (flags & DRM_HALT_ALL_QUEUES) lock.flags |= _DRM_HALT_ALL_QUEUES; if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES; - + while (ioctl(fd, DRM_IOCTL_LOCK, &lock)) ; return 0; @@ -827,7 +845,7 @@ int drmGetContextFlags(int fd, drmContext context, drmContextFlagsPtr flags) if (ctx.flags & _DRM_CONTEXT_2DONLY) *flags |= DRM_CONTEXT_2DONLY; return 0; } - + int drmDestroyContext(int fd, drmContext handle) { drm_ctx_t ctx; @@ -1074,12 +1092,189 @@ void *drmGetContextTag(int fd, drmContext context) { drmHashEntry *entry = drmGetEntry(fd); void *value; - + if (drmHashLookup(entry->tagTable, context, &value)) return NULL; return value; } +int drmAddContextPrivateMapping(int fd, drmContext ctx_id, drmHandle handle) +{ + drm_ctx_priv_map_t map; + + map.ctx_id = ctx_id; + map.handle = (void *)handle; + + if (ioctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map)) return -errno; + return 0; +} + +int drmGetContextPrivateMapping(int fd, drmContext ctx_id, drmHandlePtr handle) +{ + drm_ctx_priv_map_t map; + + map.ctx_id = ctx_id; + + if (ioctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map)) return -errno; + if (handle) *handle = (drmHandle)map.handle; + + return 0; +} + +int drmGetMap(int fd, int idx, drmHandle *offset, drmSize *size, + drmMapType *type, drmMapFlags *flags, drmHandle *handle, + int *mtrr) +{ + drm_map_t map; + + map.offset = idx; + if (ioctl(fd, DRM_IOCTL_GET_MAP, &map)) return -errno; + *offset = map.offset; + *size = map.size; + *type = map.type; + *flags = map.flags; + *handle = (unsigned long)map.handle; + *mtrr = map.mtrr; + return 0; +} + +int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid, + unsigned long *magic, unsigned long *iocs) +{ + drm_client_t client; + + client.idx = idx; + if (ioctl(fd, DRM_IOCTL_GET_CLIENT, &client)) return -errno; + *auth = client.auth; + *pid = client.pid; + *uid = client.uid; + *magic = client.magic; + *iocs = client.iocs; + return 0; +} + +int drmGetStats(int fd, drmStatsT *stats) +{ + drm_stats_t s; + int i; + + if (ioctl(fd, DRM_IOCTL_GET_STATS, &s)) return -errno; + + stats->count = 0; + memset(stats, 0, sizeof(*stats)); + if (s.count > sizeof(stats->data)/sizeof(stats->data[0])) + return -1; + +#define SET_VALUE \ + stats->data[i].long_format = "%-20.20s"; \ + stats->data[i].rate_format = "%8.8s"; \ + stats->data[i].isvalue = 1; \ + stats->data[i].verbose = 0 + +#define SET_COUNT \ + stats->data[i].long_format = "%-20.20s"; \ + stats->data[i].rate_format = "%5.5s"; \ + stats->data[i].isvalue = 0; \ + stats->data[i].mult_names = "kgm"; \ + stats->data[i].mult = 1000; \ + stats->data[i].verbose = 0 + +#define SET_BYTE \ + stats->data[i].long_format = "%-20.20s"; \ + stats->data[i].rate_format = "%5.5s"; \ + stats->data[i].isvalue = 0; \ + stats->data[i].mult_names = "KGM"; \ + stats->data[i].mult = 1024; \ + stats->data[i].verbose = 0 + + + stats->count = s.count; + for (i = 0; i < s.count; i++) { + stats->data[i].value = s.data[i].value; + switch (s.data[i].type) { + case _DRM_STAT_LOCK: + stats->data[i].long_name = "Lock"; + stats->data[i].rate_name = "Lock"; + SET_VALUE; + break; + case _DRM_STAT_OPENS: + stats->data[i].long_name = "Opens"; + stats->data[i].rate_name = "O"; + SET_COUNT; + stats->data[i].verbose = 1; + break; + case _DRM_STAT_CLOSES: + stats->data[i].long_name = "Closes"; + stats->data[i].rate_name = "Lock"; + SET_COUNT; + stats->data[i].verbose = 1; + break; + case _DRM_STAT_IOCTLS: + stats->data[i].long_name = "Ioctls"; + stats->data[i].rate_name = "Ioc/s"; + SET_COUNT; + break; + case _DRM_STAT_LOCKS: + stats->data[i].long_name = "Locks"; + stats->data[i].rate_name = "Lck/s"; + SET_COUNT; + break; + case _DRM_STAT_UNLOCKS: + stats->data[i].long_name = "Unlocks"; + stats->data[i].rate_name = "Unl/s"; + SET_COUNT; + break; + case _DRM_STAT_IRQ: + stats->data[i].long_name = "IRQs"; + stats->data[i].rate_name = "IRQ/s"; + SET_COUNT; + break; + case _DRM_STAT_PRIMARY: + stats->data[i].long_name = "Primary Bytes"; + stats->data[i].rate_name = "PB/s"; + SET_BYTE; + break; + case _DRM_STAT_SECONDARY: + stats->data[i].long_name = "Secondary Bytes"; + stats->data[i].rate_name = "SB/s"; + SET_BYTE; + break; + case _DRM_STAT_DMA: + stats->data[i].long_name = "DMA"; + stats->data[i].rate_name = "DMA/s"; + SET_COUNT; + break; + case _DRM_STAT_SPECIAL: + stats->data[i].long_name = "Special DMA"; + stats->data[i].rate_name = "dma/s"; + SET_COUNT; + break; + case _DRM_STAT_MISSED: + stats->data[i].long_name = "Miss"; + stats->data[i].rate_name = "Ms/s"; + SET_COUNT; + break; + case _DRM_STAT_VALUE: + stats->data[i].long_name = "Value"; + stats->data[i].rate_name = "Value"; + SET_VALUE; + break; + case _DRM_STAT_BYTE: + stats->data[i].long_name = "Bytes"; + stats->data[i].rate_name = "B/s"; + SET_BYTE; + break; + case _DRM_STAT_COUNT: + default: + stats->data[i].long_name = "Count"; + stats->data[i].rate_name = "Cnt/s"; + SET_COUNT; + break; + } + } + return 0; +} + #if defined(XFree86Server) || defined(DRM_USE_MALLOC) static void drmSIGIOHandler(int interrupt, void *closure) { @@ -1108,7 +1303,7 @@ static void drmSIGIOHandler(int interrupt, void *closure) #if 0 fprintf(stderr, "Got %s\n", buf); #endif - + for (pt = buf; *pt != ' '; ++pt); /* Find first space */ ++pt; old = strtol(pt, &pt, 0); @@ -1141,7 +1336,7 @@ int drmRemoveSIGIOHandler(int fd) drmHashEntry *entry = drmGetEntry(fd); entry->f = NULL; - + return xf86RemoveSIGIOHandler(fd); } #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c index 24b698cce..1f1a05b3a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c @@ -10,11 +10,11 @@ * 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 @@ -22,10 +22,10 @@ * 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@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.3 2000/06/17 00:03:34 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ * * DESCRIPTION * @@ -187,7 +187,7 @@ int N(HashDestroy)(void *t) int i; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + for (i = 0; i < HASH_SIZE; i++) { for (bucket = table->buckets[i]; bucket;) { next = bucket->next; @@ -235,8 +235,8 @@ int N(HashLookup)(void *t, unsigned long key, void **value) HashTablePtr table = (HashTablePtr)t; HashBucketPtr bucket; - if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + if (!table || table->magic != HASH_MAGIC) return -1; /* Bad magic */ + bucket = HashFind(table, key, NULL); if (!bucket) return 1; /* Not found */ *value = bucket->value; @@ -250,7 +250,7 @@ int N(HashInsert)(void *t, unsigned long key, void *value) unsigned long hash; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + if (HashFind(table, key, &hash)) return 1; /* Already in table */ bucket = HASH_ALLOC(sizeof(*bucket)); @@ -272,7 +272,7 @@ int N(HashDelete)(void *t, unsigned long key) HashBucketPtr bucket; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + bucket = HashFind(table, key, &hash); if (!bucket) return 1; /* Not found */ @@ -285,7 +285,7 @@ int N(HashDelete)(void *t, unsigned long key) int N(HashNext)(void *t, unsigned long *key, void **value) { HashTablePtr table = (HashTablePtr)t; - + for (; table->p0 < HASH_SIZE; ++table->p0, table->p1 = table->buckets[table->p0]) { if (table->p1) { @@ -301,7 +301,7 @@ int N(HashNext)(void *t, unsigned long *key, void **value) int N(HashFirst)(void *t, unsigned long *key, void **value) { HashTablePtr table = (HashTablePtr)t; - + if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ table->p0 = 0; @@ -337,7 +337,7 @@ static void compute_dist(HashTablePtr table) { int i; HashBucketPtr bucket; - + printf("Entries = %ld, hits = %ld, partials = %ld, misses = %ld\n", table->entries, table->hits, table->partials, table->misses); clear_dist(); @@ -356,7 +356,7 @@ static void check_table(HashTablePtr table, { unsigned long retval = 0; int retcode = N(HashLookup)(table, key, &retval); - + switch (retcode) { case -1: printf("Bad magic = 0x%08lx:" @@ -391,7 +391,7 @@ int main(void) for (i = 256; i >= 0; i--) check_table(table, i, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 consecutive integers ****\n"); table = N(HashCreate)(); for (i = 0; i < 1024; i++) N(HashInsert)(table, i, i); @@ -399,7 +399,7 @@ int main(void) for (i = 1024; i >= 0; i--) check_table(table, i, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 consecutive page addresses (4k pages) ****\n"); table = N(HashCreate)(); for (i = 0; i < 1024; i++) N(HashInsert)(table, i*4096, i); @@ -407,7 +407,7 @@ int main(void) for (i = 1024; i >= 0; i--) check_table(table, i*4096, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 random integers ****\n"); table = N(HashCreate)(); srandom(0xbeefbeef); @@ -429,7 +429,7 @@ int main(void) for (i = 0; i < 5000; i++) check_table(table, random(), i); compute_dist(table); N(HashDestroy)(table); - + return 0; } #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c index d5a7e2263..064340e08 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.3 2000/08/24 22:20:17 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -70,8 +70,8 @@ Bool drmI810InitDma(int driSubFD, drmI810Init *info) memset(&init, 0, sizeof(drm_i810_init_t)); init.func = I810_INIT_DMA; - init.ring_map_idx = info->ring_map_idx; - init.buffer_map_idx = info->buffer_map_idx; + init.mmio_offset = info->mmio_offset; + init.buffers_offset = info->buffers_offset; init.ring_start = info->start; init.ring_end = info->end; init.ring_size = info->size; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c index d566b0868..2ba199fdb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c @@ -1,4 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.3 2000/08/24 22:20:17 tsi Exp $ */ +/* xf86drmMga.c -- User-level interface to MGA DRM device + * Created: Sun Apr 9 18:13:54 2000 by gareth@valinux.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. + * + * Author: + * Gareth Hughes <gareth@valinux.com> + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -49,73 +78,237 @@ extern int xf86RemoveSIGIOHandler(int fd); #include "xf86drmMga.h" #include "drm.h" -Bool drmMgaCleanupDma(int driSubFD) +#define MGA_IDLE_RETRY 128 + + +int drmMGAInitDMA( int fd, drmMGAInit *info ) { drm_mga_init_t init; - memset(&init, 0, sizeof(drm_mga_init_t)); + + memset( &init, 0, sizeof(drm_mga_init_t) ); + + init.func = MGA_INIT_DMA; + + init.sarea_priv_offset = info->sarea_priv_offset; + init.sgram = info->sgram; + init.chipset = info->chipset; + init.maccess = info->maccess; + + init.fb_cpp = info->fb_cpp; + init.front_offset = info->front_offset; + init.front_pitch = info->front_pitch; + init.back_offset = info->back_offset; + init.back_pitch = info->back_pitch; + + init.depth_cpp = info->depth_cpp; + init.depth_offset = info->depth_offset; + init.depth_pitch = info->depth_pitch; + + init.texture_offset[0] = info->texture_offset[0]; + init.texture_size[0] = info->texture_size[0]; + init.texture_offset[1] = info->texture_offset[1]; + init.texture_size[1] = info->texture_size[1]; + + init.fb_offset = info->fb_offset; + init.mmio_offset = info->mmio_offset; + init.status_offset = info->status_offset; + init.warp_offset = info->warp_offset; + init.primary_offset = info->primary_offset; + init.buffers_offset = info->buffers_offset; + + if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGACleanupDMA( int fd ) +{ + drm_mga_init_t init; + + memset( &init, 0, sizeof(drm_mga_init_t) ); + init.func = MGA_CLEANUP_DMA; - if(ioctl(driSubFD, DRM_IOCTL_MGA_INIT, &init)) { - return FALSE; + + if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) { + return -errno; + } else { + return 0; } - - return TRUE; } -Bool drmMgaLockUpdate(int driSubFD, drmLockFlags flags) +int drmMGAFlushDMA( int fd, drmLockFlags flags ) { drm_lock_t lock; - - memset(&lock, 0, sizeof(drm_lock_t)); - - if (flags & DRM_LOCK_QUIESCENT) lock.flags |= _DRM_LOCK_QUIESCENT; - if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH; - if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL; - - if(ioctl(driSubFD, DRM_IOCTL_MGA_FLUSH, &lock)) { - return FALSE; + int ret, i = 0; + + memset( &lock, 0, sizeof(drm_lock_t) ); + + if ( flags & DRM_LOCK_QUIESCENT ) lock.flags |= _DRM_LOCK_QUIESCENT; + if ( flags & DRM_LOCK_FLUSH ) lock.flags |= _DRM_LOCK_FLUSH; + if ( flags & DRM_LOCK_FLUSH_ALL ) lock.flags |= _DRM_LOCK_FLUSH_ALL; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) + return 0; + if ( errno != EBUSY ) + return -errno; + + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { + /* Only keep trying if we need quiescence. + */ + lock.flags &= ~(_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL); + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + } + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAEngineReset( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_MGA_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGAFullScreen( int fd, int enable ) +{ + return -EINVAL; +} + +int drmMGASwapBuffers( int fd ) +{ + int ret, i = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_SWAP, NULL ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ) +{ + drm_mga_clear_t clear; + int ret, i = 0; + + clear.flags = flags; + clear.clear_color = clear_color; + clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_CLEAR, &clear ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAFlushVertexBuffer( int fd, int index, int used, int discard ) +{ + drm_mga_vertex_t vertex; + + vertex.idx = index; + vertex.used = used; + vertex.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_MGA_VERTEX, &vertex ) ) { + return -errno; + } else { + return 0; } - - return TRUE; } -Bool drmMgaInitDma(int driSubFD, drmMgaInit *info) +int drmMGAFlushIndices( int fd, int index, int start, int end, int discard ) { - drm_mga_init_t init; - int i; - - memset(&init, 0, sizeof(drm_mga_init_t)); - init.func = MGA_INIT_DMA; - init.reserved_map_agpstart = info->reserved_map_agpstart; - init.reserved_map_idx = info->reserved_map_idx; - init.buffer_map_idx = info->buffer_map_idx; - init.sarea_priv_offset = info->sarea_priv_offset; - init.primary_size = info->primary_size; - init.warp_ucode_size = info->warp_ucode_size; - init.frontOffset = info->frontOffset; - init.backOffset = info->backOffset; - init.depthOffset = info->depthOffset; - init.textureOffset = info->textureOffset; - init.textureSize = info->textureSize; - init.agpTextureSize = info->agpTextureSize; - init.agpTextureOffset = info->agpTextureOffset; - init.cpp = info->cpp; - init.stride = info->stride; - init.sgram = info->sgram; - init.chipset = info->chipset; - - for(i = 0; i < MGA_MAX_WARP_PIPES; i++) { - init.WarpIndex[i].installed = info->WarpIndex[i].installed; - init.WarpIndex[i].phys_addr = info->WarpIndex[i].phys_addr; - init.WarpIndex[i].size = info->WarpIndex[i].size; - } - - init.mAccess = info->mAccess; - - - - if(ioctl(driSubFD, DRM_IOCTL_MGA_INIT, &init)) { - return FALSE; - } - return TRUE; + drm_mga_indices_t indices; + + indices.idx = index; + indices.start = start; + indices.end = end; + indices.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_MGA_INDICES, &indices ) ) { + return -errno; + } else { + return 0; + } } +int drmMGATextureLoad( int fd, int index, + unsigned int dstorg, unsigned int length ) +{ + drm_mga_iload_t iload; + int ret, i = 0; + + iload.idx = index; + iload.dstorg = dstorg; + iload.length = length; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_ILOAD, &iload ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAAgpBlit( int fd, unsigned int planemask, + unsigned int src_offset, int src_pitch, + unsigned int dst_offset, int dst_pitch, + int delta_sx, int delta_sy, + int delta_dx, int delta_dy, + int height, int ydir ) +{ + drm_mga_blit_t blit; + int ret, i = 0; + + blit.planemask = planemask; + blit.srcorg = src_offset; + blit.dstorg = dst_offset; + blit.src_pitch = src_pitch; + blit.dst_pitch = dst_pitch; + blit.delta_sx = delta_sx; + blit.delta_sy = delta_sy; + blit.delta_dx = delta_dx; + blit.delta_dx = delta_dx; + blit.height = height; + blit.ydir = ydir; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_BLIT, &blit ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c index 82559225e..c10ee7924 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c @@ -26,7 +26,7 @@ * Author: Kevin E. Martin <martin@valinux.com> * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.7 2001/01/08 01:07:37 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.8 2001/03/21 18:08:54 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -154,8 +154,11 @@ int drmR128StopCCE( int fd ) ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); - if ( ret && errno != EBUSY ) + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { return -errno; + } stop.flush = 0; @@ -163,8 +166,11 @@ int drmR128StopCCE( int fd ) ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); - if ( ret && errno != EBUSY ) + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { return -errno; + } stop.idle = 0; @@ -235,19 +241,16 @@ int drmR128SwapBuffers( int fd ) } int drmR128Clear( int fd, unsigned int flags, - int x, int y, int w, int h, - unsigned int clear_color, - unsigned int clear_depth ) + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ) { drm_r128_clear_t clear; clear.flags = flags; - clear.x = x; - clear.y = y; - clear.w = w; - clear.h = h; clear.clear_color = clear_color; clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; if ( ioctl( fd, DRM_IOCTL_R128_CLEAR, &clear ) < 0 ) { return -errno; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c index 41d7cdf27..ff3fadae6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c @@ -27,7 +27,7 @@ * Kevin E. Martin <martin@valinux.com> * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c,v 1.1 2001/01/08 01:07:37 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c,v 1.2 2001/03/21 18:08:54 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -154,8 +154,11 @@ int drmRadeonStopCP( int fd ) ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ); - if ( ret && errno != EBUSY ) + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { return -errno; + } stop.flush = 0; @@ -163,8 +166,11 @@ int drmRadeonStopCP( int fd ) ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ); } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY ); - if ( ret && errno != EBUSY ) + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { return -errno; + } stop.idle = 0; @@ -235,29 +241,33 @@ int drmRadeonSwapBuffers( int fd ) } int drmRadeonClear( int fd, unsigned int flags, - int x, int y, int w, int h, - unsigned int clear_color, - unsigned int clear_depth ) + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask, + void *b, int nbox ) { drm_radeon_clear_t clear; + drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; + drm_clip_rect_t *boxes = (drm_clip_rect_t *)b; + int i; clear.flags = flags; - clear.x = x; - clear.y = y; - clear.w = w; - clear.h = h; clear.clear_color = clear_color; clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; + clear.depth_boxes = depth_boxes; /* We can remove this when we do real depth clears, instead of * rendering a rectangle into the depth buffer. This prevents * floating point calculations being done in the kernel. */ - clear.rect.f[CLEAR_X1] = (float)x; - clear.rect.f[CLEAR_Y1] = (float)y; - clear.rect.f[CLEAR_X2] = (float)x + w; - clear.rect.f[CLEAR_Y2] = (float)y + h; - clear.rect.f[CLEAR_DEPTH] = (float)clear_depth; + for ( i = 0 ; i < nbox ; i++ ) { + depth_boxes[i].f[CLEAR_X1] = (float)boxes[i].x1; + depth_boxes[i].f[CLEAR_Y1] = (float)boxes[i].y1; + depth_boxes[i].f[CLEAR_X2] = (float)boxes[i].x2; + depth_boxes[i].f[CLEAR_Y2] = (float)boxes[i].y2; + depth_boxes[i].f[CLEAR_DEPTH] = (float)clear_depth; + } if ( ioctl( fd, DRM_IOCTL_RADEON_CLEAR, &clear ) < 0 ) { return -errno; @@ -301,25 +311,32 @@ int drmRadeonFlushIndices( int fd, int prim, int index, } } -int drmRadeonTextureBlit( int fd, int index, - int offset, int pitch, int format, - int x, int y, int width, int height ) +int drmRadeonLoadTexture( int fd, int offset, int pitch, int format, + int width, int height, drmRadeonTexImage *image ) { - drm_radeon_blit_t blit; - - blit.idx = index; - blit.offset = offset; - blit.pitch = pitch; - blit.format = format; - blit.x = x; - blit.y = y; - blit.width = width; - blit.height = height; - - if ( ioctl( fd, DRM_IOCTL_RADEON_BLIT, &blit ) < 0 ) { - return -errno; - } else { + drm_radeon_texture_t tex; + drm_radeon_tex_image_t tmp; + int ret; + + tex.offset = offset; + tex.pitch = pitch; + tex.format = format; + tex.width = width; + tex.height = height; + tex.image = &tmp; + + /* This gets updated by the kernel when a multipass blit is needed. + */ + memcpy( &tmp, image, sizeof(drm_radeon_tex_image_t) ); + + do { + ret = ioctl( fd, DRM_IOCTL_RADEON_TEXTURE, &tex ); + } while ( ret && errno == EAGAIN ); + + if ( ret == 0 ) { return 0; + } else { + return -errno; } } 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 efa113f84..07451887b 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.21 2001/02/15 19:46:04 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.22 2001/03/03 23:54:13 tsi Exp $ */ /* * linux specific part of the int10 module * Copyright 1999 Egbert Eich @@ -557,9 +557,11 @@ do_vm86(xf86Int10InfoPtr pInt) { int retval, signo; + xf86DisableIO(); /* So that all I/O can be trapped */ xf86InterceptSignals(&signo); retval = vm86_rep(VM86S); xf86InterceptSignals(NULL); + xf86EnableIO(); if (signo >= 0) { xf86DrvMsg(pInt->scrnIndex, X_ERROR, diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c index 45cefd9ba..160d75dbd 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.18 2000/08/31 19:03:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.19 2001/03/05 20:18:24 dawes Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -219,10 +219,12 @@ xf86KbdOn() struct termios nTty; #ifdef __powerpc__ - ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW); -#else - ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW); + if (xf86Info.kbdCustomKeycodes) + ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW); + else #endif + ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW); + nTty = kbdtty; nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); nTty.c_oflag = 0; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c index bd1a4b657..81616fab6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c @@ -1,16 +1,18 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c,v 3.4 2001/04/01 14:00:15 tsi Exp $ */ + #include <errno.h> #include <fcntl.h> #include <unistd.h> #include <sys/wait.h> #include <signal.h> #include "xf86_OSproc.h" -#include "xf86_ansic.h" #define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe" #define MAX_PATH 1024 +#if 0 /* XFree86 #defines execl to be the xf86execl() function which does * a fork AND exec. We don't want that. We want the regular, * standard execl(). @@ -18,6 +20,7 @@ #ifdef execl #undef execl #endif +#endif /* @@ -29,7 +32,8 @@ * Return: * 0 for failure, 1 for success */ -int xf86LoadKernelModule(const char *modName) +int +xf86LoadKernelModule(const char *modName) { char mpPath[MAX_PATH] = ""; int fd = -1, status, n; @@ -51,10 +55,15 @@ int xf86LoadKernelModule(const char *modName) if (mpPath[0] == 0) { /* we failed to get the path from the system, use a default */ - xf86strcpy(mpPath, "/sbin/modprobe"); + strcpy(mpPath, "/sbin/modprobe"); } /* now fork/exec the modprobe command */ + /* + * It would be good to capture stdout/stderr so that it can be directed + * to the log file. modprobe errors currently are missing from the log + * file. + */ switch (pid = fork()) { case 0: /* child */ n = execl(mpPath, "modprobe", modName, NULL); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c index 6d3e0644d..acbeaa187 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.5 2000/10/17 16:53:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.6 2001/04/03 17:05:32 dawes Exp $ */ #include <stdio.h> #include "X.h" @@ -13,7 +13,7 @@ Bool xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits) { FILE *file; - char c[0x100]; + char c[0x200]; char *res; int bus, devfn, dev, fn; unsigned int size[7]; @@ -26,14 +26,14 @@ xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits) if (!(file = fopen("/proc/bus/pci/devices","r"))) return FALSE; do { - res = fgets(c,0xff,file); + res = fgets(c,0x1ff,file); if (res) { num = sscanf(res,"%02x%02x\t%*04x%*04x\t%*x" "\t%*x\t%*x\t%*x\t%*x\t%*x\t%*x\t%*x" "\t%x\t%x\t%x\t%x\t%x\t%x\t%x", &bus,&devfn,&size[0],&size[1],&size[2],&size[3], &size[4],&size[5],&size[6]); - if (num != 9) { /* apparantly not 2.3 style */ + if (num != 9) { /* apparently not 2.3 style */ fclose(file); return FALSE; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c index 4cb1ed053..e49583d78 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.45 2001/02/15 11:03:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.49 2001/04/05 21:29:18 dawes Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -100,6 +100,9 @@ static unsigned long sparse_size; #endif #ifdef HAS_MTRR_SUPPORT + +#define SPLIT_WC_REGIONS 1 + static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); static void undoWC(int, pointer); @@ -239,6 +242,57 @@ mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size, wcr->added = TRUE; wcr->next = NULL; +#if SPLIT_WC_REGIONS + /*********************************** by _usul ********************/ + /* + * Splits up the write-combining region if it is not aligned on a + * size boundary. + */ + + if (base % size) { + struct mtrr_wc_region *wcrc = wcr; + int rgs = 1; + int srem, sdiv, bcurr; + + xf86DrvMsgVerb(screenNum, X_INFO, 2, + "WC region has to be split (0x%lx,0x%lx)\n", base, size); + + bcurr = base; + srem = size; + + do { + for (sdiv = size; sdiv /= 2; sdiv) { + while(sdiv > srem) { + sdiv /= 2; + } + if (!(bcurr % sdiv)) { + mtrr_add_wc_region(screenNum, bcurr, + sdiv, from); + break; + } + } + if (!sdiv) { + xf86DrvMsg(screenNum, X_ERROR, + "Serious error in region splitting!\n"); + } + wcrc->sentry.base = bcurr; + wcrc->sentry.size = sdiv; + wcrc->sentry.type = MTRR_TYPE_WRCOMB; + wcrc->added = TRUE; + if ((srem - sdiv)) { + wcrc->next = xalloc(sizeof(*wcrc)); + wcrc = wcrc->next; + } else { + wcrc->next = NULL; + } + srem -= sdiv; + bcurr += sdiv; + } while (srem); + return wcr; + } + /*****************************************************************/ +#endif /* SPLIT_WC_REGIONS */ + if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &wcr->sentry) >= 0) { /* Avoid printing on every VT switch */ if (xf86ServerIsInitialising()) { @@ -418,21 +472,46 @@ unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) /***************************************************************************/ #if defined(__powerpc__) -/* FIXME: init this... */ -volatile unsigned char *ioBase = MAP_FAILED; +volatile unsigned char *ioBase = NULL; + +#ifndef __NR_pciconfig_iobase +#define __NR_pciconfig_iobase 200 +#endif #endif void xf86EnableIO(void) { +#if defined(__powerpc__) + int fd; + unsigned int ioBase_phys; +#endif + if (ExtendedEnabled) return; -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if defined(__powerpc__) + ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0); + + fd = open("/dev/mem", O_RDWR); + if (ioBase == NULL) { + ioBase = (volatile unsigned char *)mmap(0, 0x20000, + PROT_READ|PROT_WRITE, MAP_SHARED, fd, + ioBase_phys); +/* Should this be fatal or just a warning? */ +#if 0 + if (ioBase == MAP_FAILED) { + FatalError( + "xf86EnableIOPorts: Failed to map iobase (%s)\n", + strerror(errno)); + } +#endif + } + close(fd); +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) if (ioperm(0, 1024, 1) || iopl(3)) - FatalError("%s: Failed to set IOPL for I/O\n", - "xf86EnableIOPorts"); + FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n"); #endif ExtendedEnabled = TRUE; @@ -444,8 +523,10 @@ xf86DisableIO(void) { if (!ExtendedEnabled) return; - -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if defined(__powerpc__) + munmap(ioBase, 0x20000); + ioBase = NULL; +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) iopl(0); ioperm(0, 1024, 0); #endif @@ -471,7 +552,9 @@ xf86DisableInterrupts() #else #ifdef __GNUC__ #if defined(__ia64__) - __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory"); +#if 0 + __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory"); +#endif #else __asm__ __volatile__("cli"); #endif @@ -501,7 +584,9 @@ xf86EnableInterrupts() #else #ifdef __GNUC__ #if defined(__ia64__) - __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory"); +#if 0 + __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory"); +#endif #else __asm__ __volatile__("sti"); #endif @@ -612,6 +697,7 @@ readSparse8(pointer Base, register unsigned long Offset) register unsigned long result, shift; register unsigned long msb; + mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; shift = (Offset & 0x3) << 3; if (Offset >= (hae_thresh)) { @@ -634,6 +720,7 @@ readSparse16(pointer Base, register unsigned long Offset) register unsigned long result, shift; register unsigned long msb; + mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; shift = (Offset & 0x2) << 3; if (Offset >= hae_thresh) { @@ -652,6 +739,7 @@ readSparse16(pointer Base, register unsigned long Offset) static int readSparse32(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(vuip)((unsigned long)Base+(Offset)); } @@ -661,7 +749,7 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) register unsigned long msb; register unsigned int b = Value & 0xffU; - mem_barrier(); + write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; if (Offset >= hae_thresh) { msb = Offset & hae_mask; @@ -680,7 +768,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) register unsigned long msb; register unsigned int w = Value & 0xffffU; - mem_barrier(); + write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; if (Offset >= hae_thresh) { msb = Offset & hae_mask; @@ -697,7 +785,7 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) static void writeSparse32(int Value, pointer Base, register unsigned long Offset) { - mem_barrier(); + write_mem_barrier(); *(vuip)((unsigned long)Base + (Offset)) = Value; return; } 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 dc3d262d4..f1abaabff 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 @@ -19,10 +19,10 @@ * 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 + * VA LINUX SYSTEMS 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. + * 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@valinux.com> @@ -36,6 +36,7 @@ #define _DRM_H_ #if defined(__linux__) +#include <linux/config.h> #include <asm/ioctl.h> /* For _IO* macros */ #define DRM_IOCTL_NR(n) _IOC_NR(n) #elif defined(__FreeBSD__) @@ -43,15 +44,8 @@ #define DRM_IOCTL_NR(n) ((n) & 0xff) #endif -#define DRM_PROC_DEVICES "/proc/devices" -#define DRM_PROC_MISC "/proc/misc" -#define DRM_PROC_DRM "/proc/drm" -#define DRM_DEV_DRM "/dev/drm" -#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) -#define DRM_DEV_UID 0 -#define DRM_DEV_GID 0 - - +#define DRM_MAJOR 226 +#define DRM_MAX_MINOR 15 #define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */ @@ -72,12 +66,20 @@ typedef unsigned int drm_magic_t; * XF86DRIClipRectRec in the server as well */ typedef struct drm_clip_rect { - unsigned short x1; - unsigned short y1; - unsigned short x2; - unsigned short y2; + unsigned short x1; + unsigned short y1; + unsigned short x2; + unsigned short y2; } drm_clip_rect_t; +typedef struct drm_tex_region { + unsigned char next; + unsigned char prev; + unsigned char in_use; + unsigned char padding; + unsigned int age; +} drm_tex_region_t; + /* Seperate include files for the i810/mga/r128 specific structures */ #include "mga_drm.h" #include "i810_drm.h" @@ -136,9 +138,15 @@ typedef enum drm_map_flags { _DRM_LOCKED = 0x04, /* shared, cached, locked */ _DRM_KERNEL = 0x08, /* kernel requires access */ _DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */ - _DRM_CONTAINS_LOCK = 0x20 /* SHM page that contains lock */ + _DRM_CONTAINS_LOCK = 0x20, /* SHM page that contains lock */ + _DRM_REMOVABLE = 0x40 /* Removable mapping */ } drm_map_flags_t; +typedef struct drm_ctx_priv_map { + unsigned int ctx_id; /* Context requesting private mapping */ + void *handle; /* Handle of map */ +} drm_ctx_priv_map_t; + typedef struct drm_map { unsigned long offset; /* Requested physical address (0 for SAREA)*/ unsigned long size; /* Requested physical size (bytes) */ @@ -150,6 +158,44 @@ typedef struct drm_map { /* Private data */ } drm_map_t; +typedef struct drm_client { + int idx; /* Which client desired? */ + int auth; /* Is client authenticated? */ + unsigned long pid; /* Process id */ + unsigned long uid; /* User id */ + unsigned long magic; /* Magic */ + unsigned long iocs; /* Ioctl count */ +} drm_client_t; + +typedef enum { + _DRM_STAT_LOCK, + _DRM_STAT_OPENS, + _DRM_STAT_CLOSES, + _DRM_STAT_IOCTLS, + _DRM_STAT_LOCKS, + _DRM_STAT_UNLOCKS, + _DRM_STAT_VALUE, /* Generic value */ + _DRM_STAT_BYTE, /* Generic byte counter (1024bytes/K) */ + _DRM_STAT_COUNT, /* Generic non-byte counter (1000/k) */ + + _DRM_STAT_IRQ, /* IRQ */ + _DRM_STAT_PRIMARY, /* Primary DMA bytes */ + _DRM_STAT_SECONDARY, /* Secondary DMA bytes */ + _DRM_STAT_DMA, /* DMA */ + _DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */ + _DRM_STAT_MISSED /* Missed DMA opportunity */ + + /* Add to the *END* of the list */ +} drm_stat_type_t; + +typedef struct drm_stats { + unsigned long count; + struct { + unsigned long value; + drm_stat_type_t type; + } data[15]; +} drm_stats_t; + typedef enum drm_lock_flags { _DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */ _DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */ @@ -309,6 +355,9 @@ typedef struct drm_agp_info { #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t) #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t) +#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t) +#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t) +#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t) @@ -322,6 +371,11 @@ typedef struct drm_agp_info { #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t) #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t) +#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t) + +#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t) +#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t) + #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t) @@ -345,17 +399,18 @@ typedef struct drm_agp_info { #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) -/* Mga specific ioctls */ +/* MGA specific ioctls */ #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) -#define DRM_IOCTL_MGA_SWAP DRM_IOW( 0x41, drm_mga_swap_t) -#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x42, drm_mga_clear_t) -#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x43, drm_mga_iload_t) -#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x44, drm_mga_vertex_t) -#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x45, drm_lock_t ) +#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) +#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42) +#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43) +#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t) +#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t) #define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) -#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x47, drm_mga_blit_t) +#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t) +#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t) -/* I810 specific ioctls */ +/* i810 specific ioctls */ #define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) #define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) #define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) @@ -395,7 +450,7 @@ typedef struct drm_agp_info { #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) #define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) -#define DRM_IOCTL_RADEON_BLIT DRM_IOW( 0x4b, drm_radeon_blit_t) +#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4b, drm_radeon_texture_t) #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h index 40095aa87..d57b4f9b3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.8 2000/12/18 02:25:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.9 2001/03/07 19:53:18 dawes Exp $ */ #ifndef _SOL8KEYNAMES_H #define _SOL8KEYNAMES_H @@ -64,7 +64,7 @@ unsigned char sol8map[256] = { KEY_Comma, /* 53 */ KEY_Period, /* 54 */ KEY_Slash, /* 55 */ - 0x73, /*KEY_P_BKSL*/ /* 56 */ + KEY_BSlash2, /* 56 */ KEY_ShiftR, /* 57 */ KEY_LCtrl, /* 58 */ KEY_LMeta, /* 59 */ @@ -139,9 +139,9 @@ unsigned char sol8map[256] = { KEY_UNKNOWN, /* 128 */ KEY_UNKNOWN, /* 129 */ KEY_UNKNOWN, /* 130 */ - 0x7B, /*KEY_P_NFER*/ /* 131 */ - 0x79, /*KEY_P_XFER*/ /* 132 */ - 0x70, /*KEY_HKTG*/ /* 133 */ + KEY_NFER, /* 131 */ + KEY_XFER, /* 132 */ + KEY_HKTG /* 133 */ KEY_UNKNOWN, /* 134 */ /* The rest default to KEY_UNKNOWN */ }; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c index 1e46cf95d..b6093121c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c @@ -1,19 +1,271 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c,v 1.1 1999/09/25 14:38:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c,v 1.2 2001/04/06 02:16:25 dawes Exp $ */ /* - * Copyright 1999 by The XFree86 Project, Inc. + * Copyright 1999-2001 by The XFree86 Project, Inc. */ #include "X.h" #include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" #include "xf86Xinput.h" #include "xf86OSmouse.h" +#include "xisb.h" +#include "mipointer.h" +#include <sys/vuid_event.h> + +/* Names of protocols that are handled internally here. */ + +static const char *internalNames[] = { + "VUID", + NULL +}; + +typedef struct _VuidMseRec { + Firm_event event; + unsigned char *buffer; +} VuidMseRec, *VuidMsePtr; + + +static int vuidMouseProc(DeviceIntPtr pPointer, int what); +static void vuidReadInput(InputInfoPtr pInfo); + +/* This function is called when the protocol is "VUID". */ +static Bool +vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags) +{ + MouseDevPtr pMse = pInfo->private; + VuidMsePtr pVuidMse; + int i; + + pVuidMse = xalloc(sizeof(VuidMseRec)); + if (pVuidMse == NULL) { + xf86Msg(X_ERROR, "%s: cannot allocate VuidMouseRec\n", pInfo->name); + xfree(pMse); + return FALSE; + } + + pMse->protocol = protocol; + xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); + + /* Collect the options, and process the common options. */ + xf86CollectInputOptions(pInfo, NULL, NULL); + xf86ProcessCommonOptions(pInfo, pInfo->options); + + /* Check if the device can be opened. */ + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) { + if (xf86GetAllowMouseOpenFail()) + xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); + else { + xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); + xfree(pVuidMse); + xfree(pMse); + return FALSE; + } + } + pVuidMse->buffer = (unsigned char *)&pVuidMse->event; + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + + /* Private structure */ + pMse->mousePriv = pVuidMse; + + /* Process common mouse options (like Emulate3Buttons, etc). */ + pMse->CommonOptions(pInfo); + + /* Setup the local procs. */ + pInfo->device_control = vuidMouseProc; + pInfo->read_input = vuidReadInput; + + pInfo->flags |= XI86_CONFIGURED; + return TRUE; +} + +static void +vuidReadInput(InputInfoPtr pInfo) +{ + MouseDevPtr pMse; + VuidMsePtr pVuidMse; + int buttons; + int dx = 0, dy = 0, dz = 0, dw = 0; + unsigned int n; + int c; + unsigned char *pBuf; + + pMse = pInfo->private; + pVuidMse = pMse->mousePriv; + buttons = pMse->lastButtons; + XisbBlockDuration(pMse->buffer, -1); + pBuf = pVuidMse->buffer; + n = 0; + + do { + while (n < sizeof(Firm_event) && (c = XisbRead(pMse->buffer)) >= 0) { + pBuf[n++] = (unsigned char)c; + } + + if (n == 0) + return; + + if (n != sizeof(Firm_event)) { + xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n", + pInfo->name, n); + } + + if (pVuidMse->event.id >= BUT_FIRST && pVuidMse->event.id <= BUT_LAST) { + /* button */ + int butnum = pVuidMse->event.id - BUT_FIRST; + if (butnum < 3) + butnum = 2 - butnum; + if (!pVuidMse->event.value) + buttons &= ~(1 << butnum); + else + buttons |= (1 << butnum); + } else if (pVuidMse->event.id >= VLOC_FIRST && + pVuidMse->event.id <= VLOC_LAST) { + /* axis */ + int delta = pVuidMse->event.value; + switch(pVuidMse->event.id) { + case LOC_X_DELTA: + dx += delta; + break; + case LOC_Y_DELTA: + dy -= delta; + break; + } + } + + n = 0; + if ((c = XisbRead(pMse->buffer)) >= 0) { + /* Another packet. Handle it right away. */ + pBuf[n++] = c; + } + } while (n != 0); + + pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); + return; +} + +#define NUMEVENTS 64 + +static int +vuidMouseProc(DeviceIntPtr pPointer, int what) +{ + InputInfoPtr pInfo; + MouseDevPtr pMse; + VuidMsePtr pVuidMse; + unsigned char map[MSE_MAXBUTTONS + 1]; + int nbuttons; + + pInfo = pPointer->public.devicePrivate; + pMse = pInfo->private; + pMse->device = pPointer; + pVuidMse = pMse->mousePriv; + + switch (what) { + case DEVICE_INIT: + pPointer->public.on = FALSE; + + for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) + map[nbuttons + 1] = nbuttons + 1; + + InitPointerDeviceStruct((DevicePtr)pPointer, + map, + min(pMse->buttons, MSE_MAXBUTTONS), + miPointerGetMotionEvents, + pMse->Ctrl, + miPointerGetMotionBufferSize()); + + /* X valuator */ + xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); + xf86InitValuatorDefaults(pPointer, 0); + /* Y valuator */ + xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); + xf86InitValuatorDefaults(pPointer, 1); + xf86MotionHistoryAllocate(pInfo); + break; + + case DEVICE_ON: + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) + xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); + else { + pMse->buffer = XisbNew(pInfo->fd, + NUMEVENTS * sizeof(Firm_event)); + if (!pMse->buffer) { + xfree(pMse); + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + } else { + int fmt = VUID_FIRM_EVENT; + ioctl(pInfo->fd, VUIDSFORMAT, &fmt); + xf86FlushInput(pInfo->fd); + AddEnabledDevice(pInfo->fd); + } + } + pMse->lastButtons = 0; + pMse->emulateState = 0; + pPointer->public.on = TRUE; + break; + + case DEVICE_OFF: + case DEVICE_CLOSE: + if (pInfo->fd != -1) { + RemoveEnabledDevice(pInfo->fd); + if (pMse->buffer) { + XisbFree(pMse->buffer); + pMse->buffer = NULL; + } + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + } + pPointer->public.on = FALSE; + usleep(300000); + break; + } + return Success; +} + +static Bool +sol8MousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) +{ + /* The protocol is guaranteed to be one of the internalNames[] */ + if (xf86NameCmp(protocol, "VUID") == 0) { + return vuidPreInit(pInfo, protocol, flags); + } + return TRUE; +} + +static const char ** +BuiltinNames(void) +{ + return internalNames; +} + +static Bool +CheckProtocol(const char *protocol) +{ + int i; + + for (i = 0; internalNames[i]; i++) + if (xf86NameCmp(protocol, internalNames[i]) == 0) + return TRUE; + + return FALSE; +} static int SupportedInterfaces(void) { /* XXX This needs to be checked. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2; + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2 | MSE_MISC; +} + +static const char * +DefaultProtocol(void) +{ + return "VUID"; } OSMouseInfoPtr @@ -25,6 +277,10 @@ xf86OSMouseInit(int flags) if (!p) return NULL; p->SupportedInterfaces = SupportedInterfaces; + p->BuiltinNames = BuiltinNames; + p->DefaultProtocol = DefaultProtocol; + p->CheckProtocol = CheckProtocol; + p->PreInit = sol8MousePreInit; return p; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c b/xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c index 9e8321cda..0478ee65e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c,v 3.19 2000/02/10 22:33:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c,v 3.20 2001/03/06 18:20:31 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993-1999 by The XFree86 Project, Inc. @@ -508,6 +508,7 @@ XqueueMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) MouseDevPtr pMse; XqInfoPtr pXq; + pMse = pInfo->private; pMse->protocol = protocol; xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); pXq = pMse->mousePriv = xnfcalloc(sizeof(XqInfoRec), 1); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h index d1d7c14b5..9b4678833 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.12 2000/12/18 15:52:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.14 2001/03/07 16:21:04 paulo Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -9,6 +9,8 @@ #ifndef _XF86OSMOUSE_H_ #define _XF86OSMOUSE_H_ +#include "xf86Xinput.h" + /* Mouse interface classes */ #define MSE_NONE 0x00 #define MSE_SERIAL 0x01 /* serial port */ @@ -121,7 +123,8 @@ typedef struct _MouseDevRec { int invY; int mouseFlags; /* Flags to Clear after opening * mouse dev */ - int truebuttons; /* Arg to maintain before + int truebuttons; /* (not used) + * Arg to maintain before * emulate3buttons timer callback */ int resolution; int negativeZ; 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 4549805b3..a5ee75d0b 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.76 2000/11/14 21:59:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.79 2001/03/03 09:53:00 herrb Exp $ */ /* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes <dawes@XFree86.org> @@ -98,10 +98,6 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); #endif #endif -#ifndef NO_COMPILER_H -#include "compiler.h" -#endif - #if defined(MACH386) || defined(__OSF__) # undef NULL #endif /* MACH386 || __OSF__ */ @@ -465,22 +461,35 @@ extern int errno; # undef CONSOLE_X_MODE_OFF # undef CONSOLE_X_BELL # endif +# if defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) +# include <dev/wscons/wsdisplay_usl_io.h> +# endif # endif # ifdef SYSCONS_SUPPORT # define COMPAT_SYSCONS -# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +# if defined(__NetBSD__) || defined(__OpenBSD__) # include <machine/console.h> # else -# include <sys/console.h> -# endif /* __FreeBSD__ || __NetBSD__ || defined(__OpenBSD__) */ +# if defined(__FreeBSD__) +# include <osreldate.h> +# if __FreeBSD_version >= 410000 +# include <sys/consio.h> +# include <sys/kbio.h> +# else +# include <machine/console.h> +# endif /* FreeBSD 4.1 RELEASE or lator */ +# else +# include <sys/console.h> +# endif +# endif # endif /* SYSCONS_SUPPORT */ # if defined(PCVT_SUPPORT) # if !defined(SYSCONS_SUPPORT) /* no syscons, so include pcvt specific header file */ -# if defined(__FreeBSD__) || defined(__OpenBSD__) +# if defined(__FreeBSD__) # include <machine/pcvt_ioctl.h> # else -# if defined(__NetBSD__) +# if defined(__NetBSD__) || defined(__OpenBSD__) # if defined(WSCONS_SUPPORT) /* NetBSD's wscons has a PCVT-compatibility module. */ # include <dev/wscons/wsdisplay_usl_io.h> @@ -503,8 +512,13 @@ extern int errno; # include <dev/wscons/wsconsio.h> # endif /* WSCONS_SUPPORT */ # if defined(__FreeBSD__) -# undef MOUSE_GETINFO -# include <machine/mouse.h> +# include <osreldate.h> +# if __FreeBSD_version >= 500013 +# include <sys/mouse.h> +# else +# undef MOUSE_GETINFO +# include <machine/mouse.h> +# endif # endif /* Include these definitions in case ioctl_pc.h didn't get included */ # ifndef CONSOLE_X_MODE_ON @@ -555,7 +569,7 @@ extern int errno; # define CLEARDTR_SUPPORT -# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) +# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) # define USE_VT_SYSREQ # endif @@ -894,4 +908,8 @@ double RInt( #define XF86_OS_PRIVS #include "xf86_OSproc.h" +#ifndef NO_COMPILER_H +#include "compiler.h" +#endif + #endif /* _XF86_OSLIB_H */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h index 7d3b9a804..e8be0690a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.44 2000/12/06 20:39:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.45 2001/03/03 22:53:02 tsi Exp $ */ #ifndef _XF86_ANSIC_H #define _XF86_ANSIC_H @@ -179,7 +179,7 @@ extern int xf86fputs(const char*,XF86FILE*); extern xf86size_t xf86fread(void*,xf86size_t,xf86size_t,XF86FILE*); extern void xf86free(void*); extern XF86FILE* xf86freopen(const char*,const char*,XF86FILE*); -#ifdef HAVE_VFSCANF +#if defined(HAVE_VFSCANF) || !defined(NEED_XF86_PROTOTYPES) extern int xf86fscanf(XF86FILE*,const char*,...); #else extern int xf86fscanf(/*XF86FILE*,const char*,char *,char *,char *,char *, @@ -226,7 +226,7 @@ extern double xf86sin(double); extern int xf86sprintf(char*,const char*,...); extern int xf86snprintf(char*,xf86size_t,const char*,...); extern double xf86sqrt(double); -#ifdef HAVE_VSSCANF +#if defined(HAVE_VSSCANF) || !defined(NEED_XF86_PROTOTYPES) extern int xf86sscanf(char*,const char*,...); #else extern int xf86sscanf(/*char*,const char*,char *,char *,char *,char *, diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h index de77ddd8b..664e6855b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h @@ -11,11 +11,11 @@ * 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 @@ -23,16 +23,26 @@ * 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. - * + * * Author: Rickard E. (Rik) Faith <faith@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.12 2000/09/24 13:51:32 alanh Exp $ - * + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.13 2001/03/21 18:08:53 dawes Exp $ + * */ #ifndef _XF86DRM_H_ #define _XF86DRM_H_ + /* Defaults, if nothing set in xf86config */ +#define DRM_DEV_UID 0 +#define DRM_DEV_GID 0 +#define DRM_DEV_DIRMODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP) +#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) + +#define DRM_DIR_NAME "/dev/dri" +#define DRM_DEV_NAME "%s/card%d" +#define DRM_PROC_NAME "/proc/dri/" /* For backware Linux compatibility */ + #define DRM_ERR_NO_DEVICE (-1001) #define DRM_ERR_NO_ACCESS (-1002) #define DRM_ERR_NOT_ROOT (-1003) @@ -58,6 +68,21 @@ typedef struct _drmVersion { char *desc; /* User-space buffer to hold desc */ } drmVersion, *drmVersionPtr; +typedef struct _drmStats { + unsigned long count; /* Number of data */ + struct { + unsigned long value; /* Value from kernel */ + const char *long_format; /* Suggested format for long_name */ + const char *long_name; /* Long name for value */ + const char *rate_format; /* Suggested format for rate_name */ + const char *rate_name; /* Short name for value per second */ + int isvalue; /* True if value (vs. counter) */ + const char *mult_names; /* Multiplier names (e.g., "KGM") */ + int mult; /* Multiplier value (e.g., 1024) */ + int verbose; /* Suggest only in verbose output */ + } data[15]; +} drmStatsT; + /* All of these enums *MUST* match with the kernel implementation -- so do *NOT* @@ -77,7 +102,8 @@ typedef enum { DRM_LOCKED = 0x0004, /* Physical pages locked */ DRM_KERNEL = 0x0008, /* Kernel requires access */ DRM_WRITE_COMBINING = 0x0010, /* Use write-combining, if available */ - DRM_CONTAINS_LOCK = 0x0020 /* SHM page that contains lock */ + DRM_CONTAINS_LOCK = 0x0020, /* SHM page that contains lock */ + DRM_REMOVABLE = 0x0040 /* Removable mapping */ } drmMapFlags; typedef enum { /* These values *MUST* match drm.h */ @@ -147,7 +173,7 @@ typedef struct _drmBufMap { typedef struct _drmLock { volatile unsigned int lock; char padding[60]; - /* This is big enough for most current (and future?) architectures: + /* This is big enough for most current (and future?) architectures: DEC Alpha: 32 bytes Intel Merced: ? Intel P5/PPro/PII/PIII: 32 bytes @@ -175,14 +201,22 @@ typedef struct _drmDMAReq { int granted_count; /* Number of buffers granted at this size */ } drmDMAReq, *drmDMAReqPtr; -#if 0 - /* The kernel does this, but it doesn't - seem necessary with recent gcc's. */ -typedef struct { unsigned int a[100]; } __drm_dummy_lock_t; -#define __drm_dummy_lock(lock) (*(__volatile__ __drm_dummy_lock_t *)lock) -#else +typedef struct _drmRegion { + drmHandle handle; + unsigned int offset; + drmSize size; + drmAddress map; +} drmRegion, *drmRegionPtr; + +typedef struct _drmTextureRegion { + unsigned char next; + unsigned char prev; + unsigned char in_use; + unsigned char padding; /* Explicitly pad this out */ + unsigned int age; +} drmTextureRegion, *drmTextureRegionPtr; + #define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) -#endif #define DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */ #define DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */ @@ -227,7 +261,7 @@ typedef struct { unsigned int a[100]; } __drm_dummy_lock_t; : "r" (old), \ "r" (new)); \ } while(0) - + #elif defined(__sparc__) #define DRM_CAS(lock,old,new,__ret) \ @@ -314,7 +348,7 @@ do { register unsigned int __old __asm("o0"); \ if (flags) drmGetLock(fd,context,flags); \ else DRM_LIGHT_LOCK(fd,lock,context); \ } while(0) - + #define DRM_UNLOCK(fd,lock,context) \ do { \ DRM_CAS_RESULT(__ret); \ @@ -372,6 +406,14 @@ extern int drmGetMagic(int fd, drmMagicPtr magic); extern char *drmGetBusid(int fd); extern int drmGetInterruptFromBusID(int fd, int busnum, int devnum, int funcnum); +extern int drmGetMap(int fd, int idx, drmHandle *offset, + drmSize *size, drmMapType *type, + drmMapFlags *flags, drmHandle *handle, + int *mtrr); +extern int drmGetClient(int fd, int idx, int *auth, int *pid, + int *uid, unsigned long *magic, + unsigned long *iocs); +extern int drmGetStats(int fd, drmStatsT *stats); /* General user-level programmer's API: X server (root) only */ @@ -384,7 +426,11 @@ extern int drmAddMap(int fd, drmMapType type, drmMapFlags flags, drmHandlePtr handle); -extern int drmAddBufs(int fd, int count, int size, +extern int drmRmMap(int fd, drmHandle handle); +extern int drmAddContextPrivateMapping(int fd, drmContext ctx_id, + drmHandle handle); + +extern int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags, int agp_offset); extern int drmMarkBufs(int fd, double low, double high); @@ -426,12 +472,14 @@ extern int drmGetLock(int fd, drmLockFlags flags); extern int drmUnlock(int fd, drmContext context); extern int drmFinish(int fd, int context, drmLockFlags flags); +extern int drmGetContextPrivateMapping(int fd, drmContext ctx_id, + drmHandlePtr handle); /* AGP/GART support: X server (root) only */ extern int drmAgpAcquire(int fd); extern int drmAgpRelease(int fd); extern int drmAgpEnable(int fd, unsigned long mode); -extern int drmAgpAlloc(int fd, unsigned long size, +extern int drmAgpAlloc(int fd, unsigned long size, unsigned long type, unsigned long *address, unsigned long *handle); extern int drmAgpFree(int fd, unsigned long handle); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h index 6c11b7a10..8c8368877 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h,v 3.3 2001/04/01 14:00:14 tsi Exp $ */ /* WARNING: If you change any of these defines, make sure to change * the kernel include file as well (i810_drm.h) @@ -25,9 +26,9 @@ typedef struct _drmI810Init { unsigned int start; unsigned int end; - unsigned int size; - int ring_map_idx; - int buffer_map_idx; + unsigned int size; + unsigned int mmio_offset; + unsigned int buffers_offset; int sarea_off; unsigned int front_offset; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h index 75157024f..0a4e072bb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h @@ -1,151 +1,71 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.3 2000/09/26 15:57:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.4 2001/03/21 18:08:53 dawes Exp $ */ + +#ifndef __XF86DRI_MGA_H__ +#define __XF86DRI_MGA_H__ /* * WARNING: If you change any of these defines, make sure to change * the kernel include file as well (mga_drm.h) */ -#ifndef _XF86DRI_MGA_H_ -#define _XF86DRI_MGA_H_ -#ifndef _MGA_DEFINES_ -#define _MGA_DEFINES_ -#define MGA_F 0x1 /* fog */ -#define MGA_A 0x2 /* alpha */ -#define MGA_S 0x4 /* specular */ -#define MGA_T2 0x8 /* multitexture */ - -#define MGA_WARP_TGZ 0 -#define MGA_WARP_TGZF (MGA_F) -#define MGA_WARP_TGZA (MGA_A) -#define MGA_WARP_TGZAF (MGA_F|MGA_A) -#define MGA_WARP_TGZS (MGA_S) -#define MGA_WARP_TGZSF (MGA_S|MGA_F) -#define MGA_WARP_TGZSA (MGA_S|MGA_A) -#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) -#define MGA_WARP_T2GZ (MGA_T2) -#define MGA_WARP_T2GZF (MGA_T2|MGA_F) -#define MGA_WARP_T2GZA (MGA_T2|MGA_A) -#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) -#define MGA_WARP_T2GZS (MGA_T2|MGA_S) -#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) -#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) -#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) - -#define MGA_MAX_G400_PIPES 16 -#define MGA_MAX_G200_PIPES 8 /* no multitex */ - -#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES - -#define MGA_CARD_TYPE_G200 1 -#define MGA_CARD_TYPE_G400 2 -#define MGA_FRONT 0x1 -#define MGA_BACK 0x2 -#define MGA_DEPTH 0x4 - -/* 3d state excluding texture units: - */ -#define MGA_CTXREG_DSTORG 0 /* validated */ -#define MGA_CTXREG_MACCESS 1 -#define MGA_CTXREG_PLNWT 2 -#define MGA_CTXREG_DWGCTL 3 -#define MGA_CTXREG_ALPHACTRL 4 -#define MGA_CTXREG_FOGCOLOR 5 -#define MGA_CTXREG_WFLAG 6 -#define MGA_CTXREG_TDUAL0 7 -#define MGA_CTXREG_TDUAL1 8 -#define MGA_CTXREG_FCOL 9 -#define MGA_CTXREG_STENCIL 10 -#define MGA_CTXREG_STENCILCTL 11 -#define MGA_CTX_SETUP_SIZE 12 - -/* 2d state - */ -#define MGA_2DREG_PITCH 0 -#define MGA_2D_SETUP_SIZE 1 - -/* Each texture unit has a state: - */ -#define MGA_TEXREG_CTL 0 -#define MGA_TEXREG_CTL2 1 -#define MGA_TEXREG_FILTER 2 -#define MGA_TEXREG_BORDERCOL 3 -#define MGA_TEXREG_ORG 4 /* validated */ -#define MGA_TEXREG_ORG1 5 -#define MGA_TEXREG_ORG2 6 -#define MGA_TEXREG_ORG3 7 -#define MGA_TEXREG_ORG4 8 -#define MGA_TEXREG_WIDTH 9 -#define MGA_TEXREG_HEIGHT 10 -#define MGA_TEX_SETUP_SIZE 11 - -/* What needs to be changed for the current vertex dma buffer? - */ -#define MGA_UPLOAD_CTX 0x1 -#define MGA_UPLOAD_TEX0 0x2 -#define MGA_UPLOAD_TEX1 0x4 -#define MGA_UPLOAD_PIPE 0x8 -#define MGA_UPLOAD_TEX0IMAGE 0x10 -#define MGA_UPLOAD_TEX1IMAGE 0x20 -#define MGA_UPLOAD_2D 0x40 -#define MGA_WAIT_AGE 0x80 /* handled client-side */ -#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ -#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock - quiescent */ - -/* 32 buffers of 64k each, total 1 meg. - */ -#define MGA_DMA_BUF_ORDER 16 -#define MGA_DMA_BUF_SZ (1<<MGA_DMA_BUF_ORDER) -#define MGA_DMA_BUF_NR 31 - -/* Keep these small for testing. - */ -#define MGA_NR_SAREA_CLIPRECTS 8 - -/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 - * regions, subject to a minimum region size of (1<<16) == 64k. - * - * Clients may subdivide regions internally, but when sharing between - * clients, the region size is the minimum granularity. - */ - -#define MGA_CARD_HEAP 0 -#define MGA_AGP_HEAP 1 -#define MGA_NR_TEX_HEAPS 2 -#define MGA_NR_TEX_REGIONS 16 -#define MGA_LOG_MIN_TEX_REGION_SIZE 16 -#endif - -typedef struct _drmMgaWarpIndex { +typedef struct { int installed; unsigned long phys_addr; int size; -} drmMgaWarpIndex; +} drmMGAWarpIndex; -typedef struct _drmMgaInit { - int reserved_map_agpstart; - int reserved_map_idx; - int buffer_map_idx; +typedef struct { int sarea_priv_offset; - int primary_size; - int warp_ucode_size; - unsigned int frontOffset; - unsigned int backOffset; - unsigned int depthOffset; - unsigned int textureOffset; - unsigned int textureSize; - unsigned int agpTextureSize; - unsigned int agpTextureOffset; - unsigned int cpp; - unsigned int stride; - int sgram; + int chipset; - drmMgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES]; - unsigned int mAccess; -} drmMgaInit; + int sgram; + + unsigned int maccess; + + unsigned int fb_cpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset, depth_pitch; + + unsigned int texture_offset[2]; + unsigned int texture_size[2]; + + unsigned int fb_offset; + unsigned int mmio_offset; + unsigned int status_offset; + unsigned int warp_offset; + unsigned int primary_offset; + unsigned int buffers_offset; +} drmMGAInit; + +extern int drmMGAInitDMA( int fd, drmMGAInit *info ); +extern int drmMGACleanupDMA( int fd ); + +extern int drmMGAFlushDMA( int fd, drmLockFlags flags ); + +extern int drmMGAEngineReset( int fd ); + +extern int drmMGAFullScreen( int fd, int enable ); + +extern int drmMGASwapBuffers( int fd ); +extern int drmMGAClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ); + +extern int drmMGAFlushVertexBuffer( int fd, int index, int used, int discard ); +extern int drmMGAFlushIndices( int fd, int index, + int start, int end, int discard ); + +extern int drmMGATextureLoad( int fd, int index, + unsigned int dstorg, unsigned int length ); +extern int drmMGAAgpBlit( int fd, unsigned int planemask, + unsigned int src, int src_pitch, + unsigned int dst, int dst_pitch, + int delta_sx, int delta_sy, + int delta_dx, int delta_dy, + int height, int ydir ); -Bool drmMgaCleanupDma(int driSubFD); -Bool drmMgaLockUpdate(int driSubFD, drmLockFlags flags); -Bool drmMgaInitDma(int driSubFD, drmMgaInit *info); #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h index ce544a72b..b4973b0b3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h @@ -27,7 +27,7 @@ * Gareth Hughes <gareth@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.7 2001/01/11 03:37:00 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.9 2001/03/25 05:32:13 tsi Exp $ * */ @@ -82,9 +82,8 @@ extern int drmR128FullScreen( int fd, int enable ); extern int drmR128SwapBuffers( int fd ); extern int drmR128Clear( int fd, unsigned int flags, - int x, int y, int w, int h, - unsigned int clear_color, - unsigned int clear_depth ); + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ); extern int drmR128FlushVertexBuffer( int fd, int prim, int indx, int count, int discard ); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h index 37c55ca8a..abf94b657 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h @@ -27,7 +27,7 @@ * Gareth Hughes <gareth@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.2 2001/01/11 03:37:00 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.4 2001/03/25 05:32:13 tsi Exp $ * */ @@ -43,27 +43,35 @@ #define DRM_RADEON_DEPTH 0x4 typedef struct { - int sarea_priv_offset; - int is_pci; - int cp_mode; - int agp_size; - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int ring_offset; - unsigned int ring_rptr_offset; - unsigned int buffers_offset; - unsigned int agp_textures_offset; + int sarea_priv_offset; + int is_pci; + int cp_mode; + int agp_size; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + unsigned int fb_offset; + unsigned int mmio_offset; + unsigned int ring_offset; + unsigned int ring_rptr_offset; + unsigned int buffers_offset; + unsigned int agp_textures_offset; } drmRadeonInit; +typedef struct { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + void *data; +} drmRadeonTexImage; + extern int drmRadeonInitCP( int fd, drmRadeonInit *info ); extern int drmRadeonCleanupCP( int fd ); @@ -78,18 +86,18 @@ extern int drmRadeonFullScreen( int fd, int enable ); extern int drmRadeonSwapBuffers( int fd ); extern int drmRadeonClear( int fd, unsigned int flags, - int x, int y, int w, int h, - unsigned int clear_color, - unsigned int clear_depth ); + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask, + void *boxes, int nbox ); extern int drmRadeonFlushVertexBuffer( int fd, int prim, int indx, int count, int discard ); extern int drmRadeonFlushIndices( int fd, int prim, int indx, int start, int end, int discard ); -extern int drmRadeonTextureBlit( int fd, int indx, - int offset, int pitch, int format, - int x, int y, int width, int height ); +extern int drmRadeonLoadTexture( int fd, int offset, int pitch, int format, + int width, int height, + drmRadeonTexImage *image ); extern int drmRadeonPolygonStipple( int fd, unsigned int *mask ); diff --git a/xc/programs/Xserver/hw/xfree86/parser/Configint.h b/xc/programs/Xserver/hw/xfree86/parser/Configint.h index c9f6d35ae..41d0392f1 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Configint.h +++ b/xc/programs/Xserver/hw/xfree86/parser/Configint.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.16 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.17 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -184,6 +184,8 @@ else\ #define GROUP_MSG \ "The Group keyword must be followed by either a group name in quotes or\n" \ "\ta numerical group id." +#define MULTIPLE_MSG \ +"Multiple \"%s\" lines." /* Warning messages */ #define OBSOLETE_MSG \ diff --git a/xc/programs/Xserver/hw/xfree86/parser/DRI.c b/xc/programs/Xserver/hw/xfree86/parser/DRI.c index 86ee209ab..b70237cb3 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/DRI.c +++ b/xc/programs/Xserver/hw/xfree86/parser/DRI.c @@ -24,7 +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/parser/DRI.c,v 1.8 2000/11/30 20:45:33 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.9 2001/03/08 21:32:35 anderson Exp $ * */ @@ -129,6 +129,7 @@ xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr) if (ptr == NULL) return; + fprintf (cf, "Section \"DRI\"\n"); if (ptr->dri_group_name) fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name); else if (ptr->dri_group >= 0) @@ -141,6 +142,7 @@ xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr) if (bufs->buf_flags) fprintf (cf, " \"%s\"", bufs->buf_flags); fprintf (cf, "\n"); } + fprintf (cf, "EndSection\n\n"); } void diff --git a/xc/programs/Xserver/hw/xfree86/parser/Device.c b/xc/programs/Xserver/hw/xfree86/parser/Device.c index d24cc6e60..a39ac033b 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Device.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Device.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.17 2000/11/30 20:45:33 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.18 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -89,6 +89,8 @@ xf86parseDeviceSection (void) case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->dev_identifier = val.str; has_ident = TRUE; break; diff --git a/xc/programs/Xserver/hw/xfree86/parser/Input.c b/xc/programs/Xserver/hw/xfree86/parser/Input.c index 6ab1a291a..f17b6d76a 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Input.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Input.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.5 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.6 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -66,6 +66,8 @@ xf86parseInputSection (void) case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->inp_identifier = val.str; has_ident = TRUE; break; diff --git a/xc/programs/Xserver/hw/xfree86/parser/Layout.c b/xc/programs/Xserver/hw/xfree86/parser/Layout.c index ee304525c..bfa80ba6a 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Layout.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Layout.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.13 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.14 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -78,6 +78,8 @@ xf86parseLayoutSection (void) case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->lay_identifier = val.str; has_ident = TRUE; break; diff --git a/xc/programs/Xserver/hw/xfree86/parser/Monitor.c b/xc/programs/Xserver/hw/xfree86/parser/Monitor.c index 2816c58d2..46fa5c2ed 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Monitor.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Monitor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.19 2001/01/31 20:52:18 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.20 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -391,6 +391,8 @@ xf86parseMonitorSection (void) case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->mon_identifier = val.str; has_ident = TRUE; break; @@ -437,7 +439,10 @@ xf86parseMonitorSection (void) (float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo) Error (HORIZSYNC_MSG, NULL); ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum; - break; + if (token = xf86getToken (NULL) == COMMA) + break; + ptr->mon_n_hsync++; + goto HorizDone; default: /* We cannot currently know if a '\n' was found, * or this is a real error @@ -471,7 +476,10 @@ HorizDone: (float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo) Error (VERTREFRESH_MSG, NULL); ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum; - break; + if (token = xf86getToken (NULL) == COMMA) + break; + ptr->mon_n_vrefresh++; + goto VertDone; default: /* We cannot currently know if a '\n' was found, * or this is a real error @@ -589,6 +597,8 @@ xf86parseModesSection (void) case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->modes_identifier = val.str; has_ident = TRUE; break; diff --git a/xc/programs/Xserver/hw/xfree86/parser/Vendor.c b/xc/programs/Xserver/hw/xfree86/parser/Vendor.c index a5adb3bde..e94693d84 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Vendor.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Vendor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.8 2000/11/30 20:45:34 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.9 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -48,6 +48,7 @@ static xf86ConfigSymTabRec VendorSubTab[] = XF86ConfVendSubPtr xf86parseVendorSubSection (void) { + int has_ident = FALSE; parsePrologue (XF86ConfVendSubPtr, XF86ConfVendSubRec) while ((token = xf86getToken (VendorSubTab)) != ENDSUBSECTION) @@ -57,7 +58,10 @@ xf86parseVendorSubSection (void) case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->vs_identifier = val.str; + has_ident = TRUE; break; case OPTION: { @@ -129,6 +133,8 @@ xf86parseVendorSection (void) case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->vnd_identifier = val.str; has_ident = TRUE; break; diff --git a/xc/programs/Xserver/hw/xfree86/parser/Video.c b/xc/programs/Xserver/hw/xfree86/parser/Video.c index 941a6cf76..47d601f0d 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/Video.c +++ b/xc/programs/Xserver/hw/xfree86/parser/Video.c @@ -25,7 +25,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.6 2000/11/30 20:45:34 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.7 2001/02/21 23:37:04 paulo Exp $ */ /* View/edit this file with tab stops set to 4 */ @@ -48,6 +48,7 @@ static xf86ConfigSymTabRec VideoPortTab[] = XF86ConfVideoPortPtr xf86parseVideoPortSubSection (void) { + int has_ident = FALSE; parsePrologue (XF86ConfVideoPortPtr, XF86ConfVideoPortRec) while ((token = xf86getToken (VideoPortTab)) != ENDSUBSECTION) @@ -57,7 +58,10 @@ xf86parseVideoPortSubSection (void) case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->vp_identifier = val.str; + has_ident = TRUE; break; case OPTION: { @@ -129,6 +133,8 @@ xf86parseVideoAdaptorSection (void) if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); ptr->va_identifier = val.str; + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); has_ident = TRUE; break; case VENDOR: diff --git a/xc/programs/Xserver/hw/xfree86/parser/write.c b/xc/programs/Xserver/hw/xfree86/parser/write.c index 9afe9a549..ee62771ab 100644 --- a/xc/programs/Xserver/hw/xfree86/parser/write.c +++ b/xc/programs/Xserver/hw/xfree86/parser/write.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.12 2000/11/14 17:33:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.13 2001/03/08 21:32:35 anderson Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -98,9 +98,7 @@ doWriteConfigFile (const char *filename, XF86ConfigPtr cptr) xf86printScreenSection (cf, cptr->conf_screen_lst); - fprintf (cf, "Section \"DRI\"\n"); xf86printDRISection (cf, cptr->conf_dri); - fprintf (cf, "EndSection\n\n"); fclose(cf); return 1; diff --git a/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h b/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h index ab067f45a..12a04be1e 100644 --- a/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h +++ b/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h @@ -1,8 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.4 1999/03/14 11:18:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.5 2001/03/25 05:32:14 tsi Exp $ */ #ifndef _XF86CURSOR_H #define _XF86CURSOR_H +#include "xf86str.h" #include "mipointrst.h" typedef struct _xf86CursorInfoRec { diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c index 88c1d7172..497c3e7a1 100644 --- a/xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c +++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c,v 1.12 2000/09/28 20:47:59 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c,v 1.13 2001/02/19 22:19:49 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -65,17 +65,6 @@ XAACopyArea( pGC, srcx, srcy, width, height, dstx, dsty, XAADoBitBlt, 0L)); } - } else if((pSrcDrawable->type == DRAWABLE_WINDOW) || - IS_OFFSCREEN_PIXMAP(pSrcDrawable)) { - if(infoRec->ReadPixmap && (pGC->alu == GXcopy) && - (pSrcDrawable->bitsPerPixel == pDstDrawable->bitsPerPixel) && - ((pGC->planemask & infoRec->FullPlanemasks[pSrcDrawable->depth - 1]) - == infoRec->FullPlanemasks[pSrcDrawable->depth - 1])) - { - return (XAABitBlt( pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, - XAADoImageRead, 0L)); - } } return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC, @@ -245,10 +234,11 @@ XAADoImageRead( BoxPtr pbox = REGION_RECTS(prgnDst); int nbox = REGION_NUM_RECTS(prgnDst); XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int Bpp = pSrc->bitsPerPixel >> 3; + int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both + src and dst have same bpp */ pdstBase = (unsigned char *)((PixmapPtr)pDst)->devPrivate.ptr; - dstwidth = (int)((PixmapPtr)pSrc)->devKind; + dstwidth = (int)((PixmapPtr)pDst)->devKind; for(; nbox; pbox++, pptSrc++, nbox--) { dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp); diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c index c3bd3e12a..c9ef93a1b 100644 --- a/xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c +++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c,v 1.18 2000/09/28 20:48:00 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c,v 1.19 2001/02/19 22:19:50 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -369,19 +369,33 @@ XAACopyAreaPixmap( XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); RegionPtr ret; - XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); - if(infoRec->pScrn->vtSema && - ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))){ + ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) + { + if(infoRec->ReadPixmap && (pGC->alu == GXcopy) && + (pSrc->bitsPerPixel == pDst->bitsPerPixel) && + ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1]) + == infoRec->FullPlanemasks[pSrc->depth - 1])) + { + XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst)); + pixPriv->flags |= DIRTY; + + return (XAABitBlt( pSrc, pDst, pGC, + srcx, srcy, width, height, dstx, dsty, + XAADoImageRead, 0L)); + } else if(infoRec->NeedToSync) { (*infoRec->Sync)(infoRec->pScrn); infoRec->NeedToSync = FALSE; } } - ret = (*pGC->ops->CopyArea)(pSrc, pDst, + { + XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); + ret = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty); - XAA_PIXMAP_OP_EPILOGUE(pGC); + XAA_PIXMAP_OP_EPILOGUE(pGC); + } return ret; } diff --git a/xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c b/xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c index 2625adfab..25efff45f 100644 --- a/xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c +++ b/xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c,v 1.4 1999/09/25 14:38:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c,v 1.5 2001/03/08 17:12:16 eich Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -127,7 +127,6 @@ xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) in the general case, NOT necessarily the same as the string's bounding box */ - /* GJA -- I agree, this ALL should be moved to GC validation. */ if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) || !xf86Screens[pDrawable->pScreen->myNum]->vtSema || @@ -193,6 +192,7 @@ xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) colorRrop.alu = oldalu; /* GJA */ pGC->alu = oldalu; } + } static void @@ -212,13 +212,13 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop) int widthDst; /* width of dst in longwords */ /* these keep track of the character origin */ - unsigned long *pdstBase; + CARD32 *pdstBase; /* points to longword with character origin */ int xchar; /* xorigin of char (mod 32) */ /* these are used for placing the glyph */ register int xoff; /* x offset of left edge of glyph (mod 32) */ - register unsigned long *pdst; + register CARD32 *pdst; /* pointer to current longword in dst */ int w; /* width of glyph in bits */ @@ -239,20 +239,19 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop) yorg = pDrawable->y; if (pDrawable->type == DRAWABLE_WINDOW) { - pdstBase = (unsigned long *) + pdstBase = (CARD32 *) (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr); widthDst = (int) (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2; } else { - pdstBase = (unsigned long *)(((PixmapPtr)pDrawable)->devPrivate.ptr); + pdstBase = (CARD32 *)(((PixmapPtr)pDrawable)->devPrivate.ptr); widthDst = (int)(((PixmapPtr)pDrawable)->devKind) >> 2; } x += xorg; y += yorg; - bbox.x1 = x + infop->overallLeft; bbox.x2 = x + infop->overallRight; bbox.y1 = y - infop->overallAscent; @@ -311,8 +310,10 @@ doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop) if ((xoff + w) <= 32) { + int i; /* glyph all in one longword */ maskpartialbits(xoff, w, startmask); + while (h--) { getleftbits(pglyph, w, tmpSrc); diff --git a/xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h b/xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h index 469b1bf3d..0a53572b2 100644 --- a/xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h +++ b/xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.5 2000/09/26 15:57:21 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.6 2001/03/08 17:12:17 eich Exp $ */ #ifndef __XF4BPP_H__ @@ -10,7 +10,7 @@ #include "colormapst.h" #include "fontstruct.h" #ifndef PixelType -#define PixelType unsigned long +#define PixelType CARD32 #endif /* ppcArea.c */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86Version.h b/xc/programs/Xserver/hw/xfree86/xf86Version.h index 57ab37b04..8298cb727 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86Version.h +++ b/xc/programs/Xserver/hw/xfree86/xf86Version.h @@ -1,9 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.464 2001/02/19 20:21:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.467 2001/04/06 16:51:16 dawes Exp $ */ + +#ifndef XF86_VERSION_CURRENT #define XF86_VERSION_MAJOR 4 #define XF86_VERSION_MINOR 0 #define XF86_VERSION_PATCH 99 -#define XF86_VERSION_SNAP 1 +#define XF86_VERSION_SNAP 2 /* This has five arguments for compatibilty reasons */ #define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \ @@ -22,6 +24,8 @@ 0) -#define XF86_DATE "19 February 2001" +#define XF86_DATE "6 April 2001" + +#endif /* $XConsortium: xf86Version.h /main/78 1996/10/28 05:42:10 kaleb $ */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile index 8071cdc15..43134fcc2 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.15 2001/01/24 00:06:39 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.17 2001/03/02 22:39:27 paulo Exp $ XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic @@ -95,8 +95,12 @@ CURSESLIB = NCursesLibName CURSESDEFINES = -DHAS_NCURSES #endif -DEFINES = -DXF86CONFIG=\"XConfigFile\" $(MODULEDEFINES) \ - $(CURSESDEFINES) -DPROJECT_ROOT=\"ProjectRoot\" +XF86CONFIGFILE = XConfigFile +XF86CONFIGDIR = XConfigDir + +DEFINES = -DXF86CONFIG=\"$(XF86CONFIGFILE)\" $(MODULEDEFINES) \ + $(CURSESDEFINES) -DPROJECT_ROOT=\"$(PROJECTROOT)\" \ + -DXF86CONFIGDIR=\"$(XF86CONFIGDIR)\" #if HasDlopen DLLIB = DlLibrary diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad index 9e2cbc5db..0a2ba49b6 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.7 2000/12/27 23:37:36 paulo Exp $ +!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.12 2001/03/29 16:54:30 paulo Exp $ !! *Form.background: gray85 @@ -187,10 +187,23 @@ lines -1,0,0,0,0,-1 *card.fromHoriz: keyboard *monitor.fromHoriz: card -*commands.mouse.tip: Add mouse -*commands.keyboard.tip: Add keyboard -*commands.card.tip: Add video card -*commands.monitor.tip: Add monitor +*commands.mouse*new.label: Add new mouse +*commands.keyboard*new.label: Add new keyboard +*commands.card*new.label: Add new video card +*commands.monitor*new.label: Add new monitor +*commands.mouse*configure.label: Configure mouse(s) +*commands.keyboard*configure.label: Configure keyboard(s) +*commands.card*configure.label: Configure video card(s) +*commands.monitor*configure.label: Configure monitor(s) +*commands.mouse*SimpleMenu*newMouse.label: New mouse +*commands.keyboard*SimpleMenu*newKeyboard.label:New keyboard +*commands.card*SimpleMenu*newcard.label: New card +*commands.monitor*SimpleMenu*newMonitor.label: New monitor + +*commands.MenuButton.translations: \ +<Enter>: highlight()\n\ +<Leave>: reset()\n\ +Any<BtnDown>: highlight() set() PopupMenu() *hpane.showGrip: False *hpane.expert.label: Expert Mode @@ -324,28 +337,40 @@ lines -1,0,0,0,0,-1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! keyboardML widget !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*keyboardML.labelL.vertDistance: 16 -*keyboardML.layout.vertDistance: 16 -*keyboardML.keyboard.vertDistance: 16 +*keyboardML.Label.vertDistance: 8 +*keyboardML.MenuButton.vertDistance: 8 +*keyboardML.keyboard.vertDistance: 10 *keyboardML.Label.borderWidth: 0 *keyboardML.Label.width: 115 +*keyboardML.MenuButton.width: 185 +*keyboardML.MenuButton.justify: left *keyboardML.Label.internalWidth: 0 *keyboardML.Label.justify: right -*keyboardML.model.width: 185 +*keyboardML.labelR.label: Xkb rules: +*keyboardML.rules.left: chainRight +*keyboardML.rules.right: chainRight +*keyboardML.rules.fromHoriz: labelR +*keyboardML.model.fromVert: rules +*keyboardML.labelM.fromVert: rules *keyboardML.model.left: chainRight *keyboardML.model.right: chainRight -*keyboardML.model.justify: left *keyboardML.model.fromHoriz: labelM *keyboardML.labelM.label: Keyboard model: -*keyboardML.layout.width: 185 *keyboardML.layout.left: chainRight *keyboardML.layout.right: chainRight -*keyboardML.layout.justify: left *keyboardML.layout.fromVert: model *keyboardML.labelL.fromVert: model *keyboardML.layout.fromHoriz: labelL *keyboardML.labelL.label: Keyboard layout: -*keyboardML.keyboard.fromVert: labelL +*keyboardML.variant.fromVert: labelL +*keyboardML.variant.fromHoriz: labelV +*keyboardML.labelV.fromVert: labelL +*keyboardML.labelV.label: Xkb variant: +*keyboardML.options.fromVert: labelV +*keyboardML.options.fromHoriz: labelO +*keyboardML.labelO.fromVert: labelV +*keyboardML.labelO.label: Xkb options: +*keyboardML.keyboard.fromVert: labelO *keyboardML.keyboard.borderWidth: 0 *keyboardML.keyboard.width: 305 *keyboardML.keyboard.height: 121 @@ -1386,6 +1411,8 @@ lines -1,0,0,0,0,-1 *expert*tree*Text.width: 160 *expert*tree*fontpath.Text.width: 228 +*expert*tree*fontpath.up.fromHoriz: remove +*expert*tree*fontpath.down.fromHoriz: up *expert*tree*fontpath.value.fromVert: remove *expert*tree*fontpath.valueNew.fromVert: new @@ -1767,4 +1794,4 @@ lines -1,0,0,0,0,-1 *expert*tree*buffers.flagsL.fromVert: size *expert*tree*buffers.flags.fromVert: size *expert*tree*buffers.flags.fromHoriz: flagsL -*Expert*close.label: Close
\ No newline at end of file +*Expert*close.label: Close diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c index 79139309c..03e441790 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.8 2001/01/26 21:17:40 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.9 2001/03/02 22:39:27 paulo Exp $ */ #include "config.h" @@ -109,7 +109,7 @@ startaccessx(void) xkb_info->xkb->ctrls->mk_max_speed = 500; xkb_info->xkb->ctrls->mk_curve = 0; XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - UpdateKeyboard(True); + (void)UpdateKeyboard(True); CreateAccessXHelpDialog(); } @@ -676,5 +676,5 @@ ApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb); XSync(DPY, False); - UpdateKeyboard(True); + (void)UpdateKeyboard(True); } diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c index ee7b7d07f..d2a708905 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.4 2000/12/01 23:27:54 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.5 2001/03/24 01:17:20 paulo Exp $ */ #include "xf86config.h" @@ -126,8 +126,8 @@ CardConfig(XtPointer config) device = (XF86ConfDevicePtr)(device->list.next); } do { - ++ndevices; XmuSnprintf(card_name, sizeof(card_name), "Card%d", ndevices); + ++ndevices; } while (xf86findDevice(card_name, XF86Config->conf_device_lst)); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h index 0e564300c..9d8a6a9e2 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.9 2000/12/08 21:51:05 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.10 2001/03/29 16:54:30 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -216,5 +216,6 @@ extern char *XFree86Dir; extern xf86cfgComputer computer; extern Atom wm_delete_window; extern Display *DPY; +extern Pixmap menuPixmap; #endif /* _xf86cfg_config_h */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c index 0f53ff9e0..1b13ae39f 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.6 2000/12/27 23:37:37 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.8 2001/04/01 14:00:15 tsi Exp $ */ #include "config.h" @@ -124,6 +124,7 @@ union _TreeData { } layout; struct { Widget menu, button, scrnum, adjx, adjy; + XF86ConfScreenPtr screen; XF86ConfAdjacencyPtr adjacency; } adjacency; struct { @@ -182,6 +183,7 @@ static void CreateFontPath(TreeNode*, char*); static Widget CreateFontPathField(TreeNode*, char*, Bool); static void FontPathChanged(TreeNode*); static void NewFontPathCallback(Widget, XtPointer, XtPointer); +static void FontPathCallback(Widget, XtPointer, XtPointer); static void CreateModulePath(TreeNode*, char*); static Widget CreateModulePathField(TreeNode*, char*, Bool); @@ -522,6 +524,12 @@ CreateFontPathField(TreeNode *fontpath, char *value, Bool addnew) NULL, 0); XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)fontpath); + command = XtCreateManagedWidget("up", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, FontPathCallback, + (XtPointer)fontpath); + command = XtCreateManagedWidget("down", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, FontPathCallback, + (XtPointer)fontpath); text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, XtNeditType, XawtextEdit, XtNstring, value, NULL, 0); @@ -590,6 +598,44 @@ NewFontPathCallback(Widget unused, XtPointer user_data, XtPointer call_data) RelayoutTree(); } +/*ARGSUSED*/ +static void +FontPathCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node, *fontpath = (TreeNode*)user_data; + char *t1, *t2; + Widget w1, w2; + + parent = fontpath->parent; + node = parent->child; + if (!node->next->next) + return; + if (strcmp(XtName(w), "up") == 0) { + if (node == fontpath) + while (node->next->next) + node = node->next; + else + while (node && node->next != fontpath) + node = node->next; + } + else { + if (fontpath->next->next) + node = fontpath->next; + /* else is already correct */ + } + + w1 = node->data->files.text; + w2 = fontpath->data->files.text; + + XtVaGetValues(w1, XtNstring, &t1, NULL); + XtVaGetValues(w2, XtNstring, &t2, NULL); + t1 = XtNewString(t1); + XtVaSetValues(w1, XtNstring, t2, NULL); + XtVaSetValues(w2, XtNstring, t1, NULL); + XtFree(t1); +} + + /* ModulePath */ /* Don't need to set the update tree field, as it is already set * as the destroy field */ @@ -2759,13 +2805,14 @@ ScreenDestroy(TreeNode *node) for (i = 0; i < composite->composite.num_children; ++i) if (strcmp(XtName(composite->composite.children[i]), - node->data->screen.screen->scrn_identifier) == 0) + node->data->screen.screen->scrn_identifier) == 0) { XtDestroyWidget(composite->composite.children[i]); + break; + } - if (adj && adj->data->adjacency.adjacency && - strcmp(adj->data->adjacency.adjacency->adj_screen_str, - node->data->screen.screen->scrn_identifier) == 0) + if (adj->data->adjacency.screen == node->data->screen.screen) DeleteNode(adj); + adj = next; } @@ -2777,6 +2824,9 @@ ScreenDestroy(TreeNode *node) config = computer.screens[i]->widget; RemoveDeviceCallback(NULL, NULL, NULL); } + + /* for the case of screens added and removed in the expert dialog */ + xf86removeScreen(XF86Config, node->data->screen.screen); } } @@ -3084,6 +3134,8 @@ NewScreenDisplayCallback(Widget w, XtPointer user_data, XtPointer call_data) parent = node->parent; DeleteNode(node); dsp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec)); + dsp->disp_black.red = dsp->disp_black.green = dsp->disp_black.blue = + dsp->disp_white.red = dsp->disp_white.green = dsp->disp_white.blue = -1; parent->parent->data->screen.screen->scrn_display_lst = xf86addScreenDisplay(parent->parent->data->screen.screen->scrn_display_lst, dsp); @@ -3584,6 +3636,7 @@ CreateAdjacency(TreeNode *parent, XF86ConfAdjacencyPtr adj) while (adj) { data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->adjacency.screen = adj ? adj->adj_screen : NULL; data->adjacency.adjacency = adj; node = NewNode(parent, NULL, NULL, parent->node, data); node->destroy = AdjacencyDestroy; @@ -3740,6 +3793,8 @@ NewAdjacencyCallback(Widget w, XtPointer user_data, XtPointer call_data) DeleteNode(node); adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec)); adj->adj_screen = xf86findScreen(ident, XF86Config->conf_screen_lst); + if (adj->adj_screen) + adj->adj_screen_str = XtNewString(adj->adj_screen->scrn_identifier); parent->parent->data->layout.layout->lay_adjacency_lst = xf86addAdjacency(parent->parent->data->layout.layout->lay_adjacency_lst, adj); @@ -3767,7 +3822,7 @@ AdjacencyToggleCallback(Widget w, XtPointer user_data, XtPointer call_data) XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency; char *x, *y; - if ((Bool)call_data == False) + if ((Bool)(long)call_data == False) return; XtVaGetValues(node->data->adjacency.adjx, XtNstring, &x, NULL, 0); @@ -4501,7 +4556,7 @@ ToggleCallback(Widget w, XtPointer user_data, XtPointer call_data) if (nodeParent->child) { if (XtIsRealized(tree)) XtUnmapWidget(tree); - ToggleNode(nodeParent->child, (Bool)call_data); + ToggleNode(nodeParent->child, (Bool)(long)call_data); RelayoutTree(); if (XtIsRealized(tree)) XtMapWidget(tree); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c index 7ad6cfaa5..01518410b 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.14 2000/12/29 20:09:52 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.21 2001/04/01 14:00:15 tsi Exp $ */ #include <X11/IntrinsicP.h> @@ -81,6 +81,7 @@ void DevicePopupMenu(Widget, XEvent*, String*, Cardinal*); void DevicePopdownMenu(Widget, XEvent*, String*, Cardinal*); void AddDeviceCallback(Widget, XtPointer, XtPointer); void QuitCallback(Widget, XtPointer, XtPointer); +void SmeConfigureDeviceCallback(Widget, XtPointer, XtPointer); void ConfigureDeviceCallback(Widget, XtPointer, XtPointer); void EnableDeviceCallback(Widget, XtPointer, XtPointer); void DisableDeviceCallback(Widget, XtPointer, XtPointer); @@ -100,6 +101,7 @@ void PopdownErrorCallback(Widget, XtPointer, XtPointer); static void ErrorCancelAction(Widget, XEvent*, String*, Cardinal*); static void QuitCancelAction(Widget, XEvent*, String*, Cardinal*); static void HelpCallback(Widget, XtPointer, XtPointer); +static void UpdateMenuDeviceList(int); extern void AccessXConfigureStart(void); extern void AccessXConfigureEnd(void); @@ -115,6 +117,8 @@ extern void TextMode(void); Widget toplevel, work, config, layout, layoutsme, layoutp; XtAppContext appcon; +Pixmap menuPixmap; + char *XF86Config_path = NULL; char *XF86Module_path = NULL; char *XFree86_path = NULL; @@ -137,6 +141,9 @@ int sxpos, sypos; static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 }; static GC cablegc, cablegcshadow; Atom wm_delete_window; +static Bool config_set = False; +static Widget mouseSme, mouseMenu, keyboardSme, keyboardMenu, + cardSme, cardMenu, monitorSme, monitorMenu; #define CONFIG_LAYOUT 0 #define CONFIG_SCREEN 1 @@ -179,12 +186,16 @@ static char *device_names[] = { "screen", }; -/* static XtResource appResources[] = { +#if 0 {"xf86config", "XF86Config", XtRString, sizeof(char*), 0, XtRString, "/etc/X11/XF86Config"}, +#endif + {"menuBitmap", "MenuBitmap", XtRString, sizeof(char*), + 0, XtRString, "menu10"}, }; +/* static XrmOptionDescRec optionDescList[] = { {"-xf86config", "*xf86config", XrmoptionSepArg, (XtPointer)"/etc/X11/XF86Config"}, }; @@ -203,6 +214,8 @@ main(int argc, char *argv[]) XGCValues values; XF86ConfLayoutPtr lay; int i, startedx; + char *menuPixmapPath; + XrmValue from, to; #ifdef USE_MODULES xf86Verbose = 1; @@ -215,8 +228,10 @@ main(int argc, char *argv[]) for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-xf86config") == 0) { - if (i + 1 < argc) + if (i + 1 < argc) { XF86Config_path = argv[++i]; + config_set = True; + } } else if (strcmp(argv[i], "-modulepath") == 0) { if (i + 1 < argc) XF86Module_path = argv[++i]; @@ -256,10 +271,15 @@ main(int argc, char *argv[]) if (DPY == NULL) DPY = XtDisplay(toplevel); -/* - XtGetApplicationResources(toplevel, (XtPointer)&XF86Config_path, - appResources, XtNumber(appResources), NULL, 0); -*/ + if (strlen(menuPixmapPath)) { + XtGetApplicationResources(toplevel, (XtPointer)&menuPixmapPath, + appResources, XtNumber(appResources), NULL, 0); + from.size = strlen(menuPixmapPath); + from.addr = menuPixmapPath; + to.size = sizeof(Pixmap); + to.addr = (XtPointer)&(menuPixmap); + XtConvertAndStore(toplevel, XtRString, &from, XtRBitmap, &to); + } XtAppAddActions(appcon, actions, XtNumber(actions)); @@ -297,18 +317,54 @@ main(int argc, char *argv[]) commands = XtCreateManagedWidget("commands", formWidgetClass, pane, NULL, 0); - mouse = XtCreateManagedWidget("mouse", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(mouse, XtNcallback, AddDeviceCallback, (XtPointer)MOUSE); - keyboard = XtCreateManagedWidget("keyboard", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(keyboard, XtNcallback, AddDeviceCallback, (XtPointer)KEYBOARD); - card = XtCreateManagedWidget("card", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(card, XtNcallback, AddDeviceCallback, (XtPointer)CARD); - monitor = XtCreateManagedWidget("monitor", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(monitor, XtNcallback, AddDeviceCallback, (XtPointer)MONITOR); + + mouse = XtVaCreateManagedWidget("mouse", menuButtonWidgetClass, + commands, XtNmenuName, "mouseP", NULL, 0); + popup = XtCreatePopupShell("mouseP", simpleMenuWidgetClass, + mouse, NULL, 0); + sme = XtCreateManagedWidget("new", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MOUSE); + mouseSme = XtCreateManagedWidget("configure", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(mouseSme, XtNcallback, SmeConfigureDeviceCallback, + (XtPointer)MOUSE); + + keyboard = XtVaCreateManagedWidget("keyboard", menuButtonWidgetClass, + commands, XtNmenuName, "keyboardP", NULL, 0); + popup = XtCreatePopupShell("keyboardP", simpleMenuWidgetClass, + keyboard, NULL, 0); + sme = XtCreateManagedWidget("new", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)KEYBOARD); + keyboardSme = XtCreateManagedWidget("configure", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(keyboardSme, XtNcallback, SmeConfigureDeviceCallback, + (XtPointer)KEYBOARD); + + card = XtVaCreateManagedWidget("card", menuButtonWidgetClass, + commands, XtNmenuName, "cardP", NULL, 0); + popup = XtCreatePopupShell("cardP", simpleMenuWidgetClass, + card, NULL, 0); + sme = XtCreateManagedWidget("new", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)CARD); + cardSme = XtCreateManagedWidget("configure", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(cardSme, XtNcallback, SmeConfigureDeviceCallback, + (XtPointer)CARD); + + monitor = XtVaCreateManagedWidget("monitor", menuButtonWidgetClass, + commands, XtNmenuName, "monitorP", NULL, 0); + popup = XtCreatePopupShell("monitorP", simpleMenuWidgetClass, + monitor, NULL, 0); + sme = XtCreateManagedWidget("new", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MONITOR); + monitorSme = XtCreateManagedWidget("configure", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(monitorSme, XtNcallback, SmeConfigureDeviceCallback, + (XtPointer)MONITOR); work = XtCreateManagedWidget("work", compositeWidgetClass, pane, NULL, 0); @@ -380,6 +436,10 @@ main(int argc, char *argv[]) StartConfig(); InitializeDevices(); + UpdateMenuDeviceList(MOUSE); + UpdateMenuDeviceList(KEYBOARD); + UpdateMenuDeviceList(CARD); + UpdateMenuDeviceList(MONITOR); XtSetSensitive(smemodeline, VideoModeInitialize()); ReadCardsDatabase(); @@ -389,6 +449,7 @@ main(int argc, char *argv[]) layoutp, XtNlabel, lay->lay_identifier, XtNmenuName, "options", + XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); if (layoutsme == NULL) @@ -421,6 +482,22 @@ main(int argc, char *argv[]) LoaderInitializeOptions(); #endif + if (!config_set && startedx) { + XtFree(XF86Config_path); +#ifdef XF86CONFIG +# ifdef XF86CONFIGDIR + XF86Config_path = XtNewString(XF86CONFIGDIR "/" XF86CONFIG); +# else + XF86Config_path = XtNewString("/etc/X11/" XF86CONFIG); +# endif +#else +# ifdef XF86CONFIGDIR + XF86Config_path = XtNewString(XF86CONFIGDIR "/XF86Config-4"); +# else + XF86Config_path = XtNewString("/etc/X11/XF86Config-4"); +# endif +#endif + } XtAppMainLoop(appcon); if (startedx) endx(); @@ -789,6 +866,8 @@ AddDevice(int type, XtPointer config, int x, int y) return (NULL); } + UpdateMenuDeviceList(type); + return (computer.devices[computer.num_devices - 1]); } @@ -931,6 +1010,7 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) layoutp, XtNlabel, name, XtNmenuName, "options", + XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(layoutsme, XtNcallback, SelectLayoutCallback, (XtPointer)l); @@ -1033,6 +1113,7 @@ DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) layoutp, XtNlabel, lay->lay_identifier, XtNmenuName, "options", + XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); if (layoutsme == NULL) @@ -1214,6 +1295,46 @@ AddDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) } void +SmeConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + int i; + + switch ((long)user_data) { + case MOUSE: + case KEYBOARD: + case CARD: + case MONITOR: + for (i = 0; i < computer.num_devices; i++) + if (computer.devices[i]->type == (long)user_data) { + config = computer.devices[i]->widget; + ConfigureDeviceCallback(w, NULL, NULL); + } + break; + + /* hack for newly added devices */ + case -(MOUSE + 100): + case -(KEYBOARD + 100): + case -(CARD + 100): + case -(MONITOR + 100): + for (i = 0; i < computer.num_devices; i++) + if (-(computer.devices[i]->type + 100) == (long)user_data && + computer.devices[i]->config == NULL) { + config = computer.devices[i]->widget; + ConfigureDeviceCallback(w, NULL, NULL); + } + break; + + default: + for (i = 0; i < computer.num_devices; i++) + if (computer.devices[i]->config == user_data) { + config = computer.devices[i]->widget; + ConfigureDeviceCallback(w, NULL, NULL); + } + break; + } +} + +void ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) { int i, j; @@ -1277,6 +1398,8 @@ ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) SetTip((xf86cfgDevice*)computer.screens[j]); } break; } + /* Need to update because it may have been renamed */ + UpdateMenuDeviceList(computer.devices[i]->type); break; } } @@ -1572,6 +1695,8 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) } if (computer.devices[i]->refcount <= 0) { + int type = computer.devices[i]->type; + XtDestroyWidget(computer.devices[i]->widget); XtFree((XtPointer)computer.devices[i]); if (--computer.num_devices > i) @@ -1579,6 +1704,7 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) (computer.num_devices - i) * sizeof(xf86cfgDevice*)); DrawCables(); + UpdateMenuDeviceList(type); } break; @@ -1586,6 +1712,127 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) } } +static void +UpdateMenuDeviceList(int type) +{ + Widget sme = NULL, menu = NULL; + int i, count; + static char *mouseM = "mouseM", *keyboardM = "keyboardM", + *cardM = "cardM", *monitorM = "monitorM"; + + for (i = count = 0; i < computer.num_devices; i++) + if (computer.devices[i]->type == type) + ++count; + + switch (type) { + case MOUSE: + sme = mouseSme; + menu = mouseMenu; + break; + case KEYBOARD: + sme = keyboardSme; + menu = keyboardMenu; + break; + case CARD: + sme = cardSme; + menu = cardMenu; + break; + case MONITOR: + sme = monitorSme; + menu = monitorMenu; + break; + } + + if (menu) + for (i = ((CompositeWidget)menu)->composite.num_children - 1; i >= 0; i--) + XtDestroyWidget(((CompositeWidget)menu)->composite.children[i]); + + if (count < 2) { + XtVaSetValues(sme, XtNmenuName, NULL, XtNleftBitmap, None, NULL); + return; + } + + switch (type) { + case MOUSE: + if (mouseMenu == NULL) + menu = mouseMenu = + XtCreatePopupShell(mouseM, simpleMenuWidgetClass, + XtParent(mouseSme), NULL, 0); + XtVaSetValues(mouseSme, XtNmenuName, mouseM, + XtNleftBitmap, menuPixmap, NULL); + break; + case KEYBOARD: + if (keyboardMenu == NULL) + menu = keyboardMenu = + XtCreatePopupShell(keyboardM, simpleMenuWidgetClass, + XtParent(keyboardSme), NULL, 0); + XtVaSetValues(keyboardSme, XtNmenuName, keyboardM, + XtNleftBitmap, menuPixmap, NULL); + break; + case CARD: + if (cardMenu == NULL) + menu = cardMenu = + XtCreatePopupShell(cardM, simpleMenuWidgetClass, + XtParent(cardSme), NULL, 0); + XtVaSetValues(cardSme, XtNmenuName, cardM, + XtNleftBitmap, menuPixmap, NULL); + break; + case MONITOR: + if (monitorMenu == NULL) + menu = monitorMenu = + XtCreatePopupShell(monitorM, simpleMenuWidgetClass, + XtParent(monitorSme), NULL, 0); + XtVaSetValues(monitorSme, XtNmenuName, monitorM, + XtNleftBitmap, menuPixmap, NULL); + break; + } + + for (i = 0; i < computer.num_devices; i++) + if (computer.devices[i]->type == type) { + char *label = NULL; + + if (computer.devices[i]->config) { + switch (type) { + case MOUSE: + case KEYBOARD: + label = ((XF86ConfInputPtr)computer.devices[i]->config) + ->inp_identifier; + break; + case CARD: + label = ((XF86ConfDevicePtr)computer.devices[i]->config) + ->dev_identifier; + break; + case MONITOR: + label = ((XF86ConfMonitorPtr)computer.devices[i]->config) + ->mon_identifier; + break; + } + } + else { + switch (type) { + case MOUSE: + label = "newMouse"; + break; + case KEYBOARD: + label = "newKeyboard"; + break; + case CARD: + label = "newCard"; + break; + case MONITOR: + label = "newMonitor"; + break; + } + } + + sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0); + XtAddCallback(sme, XtNcallback, SmeConfigureDeviceCallback, + computer.devices[i]->config ? + computer.devices[i]->config : + (XtPointer) (-((long)type + 100))); + } +} + /*ARGSUSED*/ void SelectDeviceAction(Widget w, XEvent *event, String *params, Cardinal *num_params) diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c index 1f5720a8e..7a65545bf 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.10 2000/12/11 18:47:46 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.14 2001/03/29 16:54:30 paulo Exp $ */ #include "xf86config.h" @@ -39,30 +39,47 @@ #include <X11/Xaw/SmeBSB.h> /* + * Types + */ +typedef struct { + char *rules; + XkbRF_RulesPtr list; + XF86XkbDescInfo model; + XF86XkbDescInfo layout; + XF86XkbDescInfo variant; + XF86XkbDescInfo option; +} XF86XkbRulesDescInfo; + +/* * Prototypes */ +static void KeyboardRulesCallback(Widget, XtPointer, XtPointer); static void KeyboardModelCallback(Widget, XtPointer, XtPointer); static void KeyboardLayoutCallback(Widget, XtPointer, XtPointer); +static void KeyboardVariantCallback(Widget, XtPointer, XtPointer); +static void KeyboardOptionsCallback(Widget, XtPointer, XtPointer); static void KeyboardApplyCallback(Widget, XtPointer, XtPointer); static Bool KeyboardConfigCheck(void); static void XkbUIEventHandler(Widget, XtPointer, XEvent*, Boolean*); +static XF86XkbRulesDescInfo *GetXkbRulesDesc(char*); +static void UpdateRulesPopups(void); /* * Initialization */ -static XF86XkbDescInfo xkb_model; -static XF86XkbDescInfo xkb_layout; -static XF86XkbDescInfo xkb_variant; -static XF86XkbDescInfo xkb_option; +static XF86XkbRulesDescInfo **xkb_desc, *xkb_rules; +static int num_xkb_desc; +static char *XkbRulesDir = "lib/X11/xkb/rules/"; #ifdef XFREE98_XKB -static char *XkbRulesFile = "lib/X11/xkb/rules/xfree98"; +static char *XkbRulesFile = "xfree98"; #else -static char *XkbRulesFile = "lib/X11/xkb/rules/xfree86"; +static char *XkbRulesFile = "xfree86"; #endif static XF86ConfInputPtr current_input; -static char *model, *layout; -static Widget kbd, modelb, layoutb; +static char *rules, *model, *layout, *variant, *options; +static Widget kbd, rulesb, modelb, layoutb, variantb, optionsb, + modelp, layoutp, variantp, optionsp; static XkbInfo **xkb_infos; static int num_xkb_infos; XkbInfo *xkb_info; @@ -79,9 +96,20 @@ KeyboardConfig(XtPointer config) XF86ConfInputPtr keyboard = (XF86ConfInputPtr)config; XF86OptionPtr option; Arg args[1]; - static char *XkbModel = "XkbModel", *XkbLayout = "XkbLayout"; + static char *XkbRules = "XkbRules", *XkbModel = "XkbModel", + *XkbLayout = "XkbLayout", *XkbVariant = "XkbVariant", + *XkbOptions = "XkbOptions"; + XF86XkbRulesDescInfo *info; + char *omodel, *olayout, *ovariant, *ooptions; InitializeKeyboard(); + rules = xkb_rules->rules; + if (xkb_info->config.rules_file == NULL) + xkb_info->config.rules_file = rules; + + if (options) + XtFree(options); + options = NULL; if (xkb_info->conf == NULL) xkb_info->conf = keyboard; @@ -148,19 +176,38 @@ KeyboardConfig(XtPointer config) current_input = keyboard; if (keyboard != NULL) { + if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules)) != NULL) { + if (strcmp(rules, option->opt_val)) { + XF86XkbRulesDescInfo *info = GetXkbRulesDesc(option->opt_val); + + if (info) { + rules = info->rules; + UpdateRulesPopups(); + } + } + } if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) != NULL) xkb_info->defs.model = model = option->opt_val; else - xkb_info->defs.model = model = xkb_model.name[0]; + xkb_info->defs.model = model = xkb_rules->model.name[0]; if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout)) != NULL) xkb_info->defs.layout = layout = option->opt_val; else - xkb_info->defs.layout = layout = xkb_layout.name[0]; + xkb_info->defs.layout = layout = xkb_rules->layout.name[0]; + if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant)) != NULL) + xkb_info->defs.variant = variant = option->opt_val; + else + xkb_info->defs.variant = variant = NULL; + + if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions)) != NULL) + xkb_info->defs.options = options = XtNewString(option->opt_val); + else + xkb_info->defs.options = options = NULL; XtSetArg(args[0], XtNstring, keyboard->inp_identifier); XtSetValues(ident_widget, args, 1); - UpdateKeyboard(False); + (void)UpdateKeyboard(False); } else { XF86ConfInputPtr input = XF86Config->conf_input_lst; @@ -173,18 +220,26 @@ KeyboardConfig(XtPointer config) input = (XF86ConfInputPtr)(input->list.next); } do { - ++nkeyboards; XmuSnprintf(keyboard_name, sizeof(keyboard_name), "Keyboard%d", nkeyboards); + ++nkeyboards; } while (xf86findInput(keyboard_name, XF86Config->conf_input_lst)); - model = xkb_model.name[0]; - layout = xkb_layout.name[0]; + model = xkb_rules->model.name[0]; + layout = xkb_rules->layout.name[0]; + variant = ""; + options = XtNewString(""); XtSetArg(args[0], XtNstring, keyboard_name); XtSetValues(ident_widget, args, 1); } + info = xkb_rules; + omodel = model; + olayout = layout; + ovariant = variant; + ooptions = options ? XtNewString(options) : NULL; + xf86info.cur_list = KEYBOARD; XtSetSensitive(back, xf86info.lists[KEYBOARD].cur_function > 0); XtSetSensitive(next, xf86info.lists[KEYBOARD].cur_function < @@ -198,10 +253,20 @@ KeyboardConfig(XtPointer config) keyboard->list.next = NULL; keyboard->inp_identifier = XtNewString(ident_string); keyboard->inp_driver = XtNewString("keyboard"); - keyboard->inp_option_lst = xf86newOption(XtNewString(XkbModel), - XtNewString(model)); + keyboard->inp_option_lst = xf86newOption(XtNewString(XkbRules), + XtNewString(rules)); + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbModel), XtNewString(model)); xf86addNewOption(keyboard->inp_option_lst, XtNewString(XkbLayout), XtNewString(layout)); + if (variant && *variant) + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbVariant), XtNewString(variant)); + if (options && *options) { + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbOptions), options); + options = NULL; + } keyboard->inp_comment = NULL; } else { @@ -210,34 +275,41 @@ KeyboardConfig(XtPointer config) XtSetArg(args[0], XtNlabel, &str); XtGetValues(modelb, args, 1); - for (i = 0; i < xkb_model.nelem; i++) - if (strcmp(xkb_model.desc[i], str) == 0) { - model = xkb_model.name[i]; + for (i = 0; i < xkb_rules->model.nelem; i++) + if (strcmp(xkb_rules->model.desc[i], str) == 0) { + model = xkb_rules->model.name[i]; break; } XtSetArg(args[0], XtNlabel, &str); XtGetValues(layoutb, args, 1); - for (i = 0; i < xkb_layout.nelem; i++) - if (strcmp(xkb_layout.desc[i], str) == 0) { - layout = xkb_layout.name[i]; + for (i = 0; i < xkb_rules->layout.nelem; i++) + if (strcmp(xkb_rules->layout.desc[i], str) == 0) { + layout = xkb_rules->layout.name[i]; break; } + if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules)) + != NULL) { + XtFree(option->opt_val); + option->opt_val = XtNewString(rules); + XtFree(option->opt_comment); + } + else + keyboard->inp_option_lst = + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbRules), XtNewString(rules)); + if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) != NULL) { XtFree(option->opt_val); option->opt_val = XtNewString(model); XtFree(option->opt_comment); } - else { - if (keyboard->inp_option_lst == NULL) - keyboard->inp_option_lst = xf86newOption(XtNewString(XkbModel), - XtNewString(model)); - else + else + keyboard->inp_option_lst = xf86addNewOption(keyboard->inp_option_lst, XtNewString(XkbModel), XtNewString(model)); - } XtFree(xkb_info->config.model); xkb_info->config.model = XtNewString(model); @@ -245,21 +317,66 @@ KeyboardConfig(XtPointer config) != NULL) { XtFree(option->opt_val); option->opt_val = XtNewString(layout); - XtFree(option->opt_comment); } else - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbLayout), XtNewString(layout)); + keyboard->inp_option_lst = + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbLayout), XtNewString(layout)); XtFree(xkb_info->config.layout); xkb_info->config.layout = XtNewString(layout); + + if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant)) + != NULL) { + if (variant && *variant) { + XtFree(option->opt_val); + option->opt_val = XtNewString(variant); + } + else + xf86removeOption(&keyboard->inp_option_lst, XkbVariant); + } + else if (variant && *variant) + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbVariant), XtNewString(variant)); + XtFree(xkb_info->config.variant); + xkb_info->config.variant = variant && *variant ? + XtNewString(variant) : NULL; + + XtFree(xkb_info->config.options); + xkb_info->config.options = options && *options ? + XtNewString(options) : NULL; + if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions)) + != NULL) { + if (options && *options) { + XtFree(option->opt_val); + option->opt_val = options; + options = NULL; + } + else + xf86removeOption(&keyboard->inp_option_lst, XkbOptions); + } + else if (options && *options) { + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbOptions), options); + options = NULL; + } } if (strcasecmp(keyboard->inp_identifier, ident_string)) xf86renameInput(XF86Config, keyboard, ident_string); xkb_info->conf = keyboard; + xkb_info->config.rules_file = rules; + return ((XtPointer)keyboard); } + xkb_rules = info; + rules = info->rules; + model = omodel; + layout = olayout; + variant = ovariant; + XtFree(options); + options = ooptions; + return (NULL); } @@ -312,8 +429,7 @@ InitializeKeyboard(void) { int major, minor, op, event, error; static int first = 1; - XkbRF_RulesPtr list; - int i, timeout = 5; + int timeout = 5; XF86ConfInputPtr keyboard = XF86Config->conf_input_lst; XF86OptionPtr option; char name[PATH_MAX]; @@ -355,69 +471,9 @@ InitializeKeyboard(void) bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec)); - if ((list = XkbRF_Create(0, 0)) == NULL || - !XkbRF_LoadDescriptionsByName(XkbRulesFile, NULL, list)) { - fprintf(stderr, "Can't create rules structure\n"); - exit(1); - } - - for (i = 0; i < list->models.num_desc; i++) { - if (i % 16 == 0) { - xkb_model.name = (char**)XtRealloc((XtPointer)xkb_model.name, - (i + 16) * sizeof(char*)); - xkb_model.desc = (char**)XtRealloc((XtPointer)xkb_model.desc, - (i + 16) * sizeof(char*)); - } - xkb_model.name[i] = XtNewString(list->models.desc[i].name); - xkb_model.desc[i] = XtNewString(list->models.desc[i].desc); - } - xkb_model.nelem = i; - - for (i = 0; i < list->layouts.num_desc; i++) { - if (i % 16 == 0) { - xkb_layout.name = (char**)XtRealloc((XtPointer)xkb_layout.name, - (i + 16) * sizeof(char*)); - xkb_layout.desc = (char**)XtRealloc((XtPointer)xkb_layout.desc, - (i + 16) * sizeof(char*)); - } - xkb_layout.name[i] = XtNewString(list->layouts.desc[i].name); - xkb_layout.desc[i] = XtNewString(list->layouts.desc[i].desc); - } - xkb_layout.nelem = i; - - for (i = 0; i < list->variants.num_desc; i++) { - if (i % 16 == 0) { - xkb_variant.name = (char**)XtRealloc((XtPointer)xkb_variant.name, - (i + 16) * sizeof(char*)); - xkb_variant.desc = (char**)XtRealloc((XtPointer)xkb_variant.desc, - (i + 16) * sizeof(char*)); - } - xkb_variant.name[i] = XtNewString(list->variants.desc[i].name); - xkb_variant.desc[i] = XtNewString(list->variants.desc[i].desc); - } - xkb_variant.nelem = i; - - for (i = 0; i < list->options.num_desc; i++) { - if (i % 16 == 0) { - xkb_option.name = (char**)XtRealloc((XtPointer)xkb_option.name, - (i + 16) * sizeof(char*)); - xkb_option.desc = (char**)XtRealloc((XtPointer)xkb_option.desc, - (i + 16) * sizeof(char*)); - } - xkb_option.name[i] = XtNewString(list->options.desc[i].name); - xkb_option.desc[i] = XtNewString(list->options.desc[i].desc); - } - xkb_option.nelem = i; - - XkbRF_Free(list, True); - /* Load configuration */ XmuSnprintf(name, sizeof(name), "%s%s", XkbConfigDir, XkbConfigFile); file = fopen(name, "r"); -/* if ((file = fopen(name, "r")) == NULL) { - strcpy(name, XkbConfigFile); - file = fopen(name, "r"); - }*/ if (file != NULL) { if (XkbCFParse(file, XkbCFDflts, xkb_info->xkb, &xkb_info->config) == 0) { fprintf(stderr, "Error parsing config file: "); @@ -427,6 +483,12 @@ InitializeKeyboard(void) fclose(file); } + xkb_rules = GetXkbRulesDesc(xkb_info->config.rules_file != NULL ? + xkb_info->config.rules_file : XkbRulesFile); + if (xkb_rules == NULL) + /* error message was printed */ + exit(1); + /* XXX Assumes the first keyboard is the core keyboard */ while (keyboard != NULL) { if (strcasecmp(keyboard->inp_driver, "keyboard") == 0) @@ -436,13 +498,49 @@ InitializeKeyboard(void) if (keyboard == NULL) return; + if (xkb_info->config.rules_file != NULL) + rules = xkb_info->config.rules_file; + else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbRules")) + != NULL) + rules = option->opt_val; + else + rules = XkbRulesFile; + + if (strcmp(rules, xkb_rules->rules)) { + xkb_rules = GetXkbRulesDesc(rules); + if (xkb_rules == NULL) + /* error message was printed */ + exit(1); + } + { + FILE *fp; + char filename[1024]; + + XmuSnprintf(filename, sizeof(filename), "%s%s", + XkbRulesDir, xkb_rules->rules); + if ((fp = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Can't open rules file\n"); + exit(1); + } + + if (!XkbRF_LoadRules(fp, xkb_rules->list)) { + fclose(fp); + fprintf(stderr, "Can't load rules\n"); + exit(1); + } + fclose(fp); + } + + if (xkb_info->config.rules_file == NULL) + xkb_info->config.rules_file = xkb_rules->rules; + if (xkb_info->config.model != NULL) xkb_info->defs.model = xkb_info->config.model; else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbModel")) != NULL) xkb_info->defs.model = option->opt_val; else - xkb_info->defs.model = xkb_model.name[0]; + xkb_info->defs.model = xkb_rules->model.name[0]; if (xkb_info->config.layout != NULL) xkb_info->defs.layout = xkb_info->config.layout; @@ -450,7 +548,103 @@ InitializeKeyboard(void) != NULL) xkb_info->defs.layout = option->opt_val; else - xkb_info->defs.layout = xkb_layout.name[0]; + xkb_info->defs.layout = xkb_rules->layout.name[0]; + + if (xkb_info->config.variant != NULL) + xkb_info->defs.variant = xkb_info->config.variant; + else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbVariant")) + != NULL) + xkb_info->defs.variant = option->opt_val; + else + xkb_info->defs.variant = NULL; + + if (xkb_info->config.options != NULL) + xkb_info->defs.options = xkb_info->config.options; + else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbOptions")) + != NULL) + xkb_info->defs.options = option->opt_val; + else + xkb_info->defs.options = NULL; +} + +static XF86XkbRulesDescInfo * +GetXkbRulesDesc(char *rules) +{ + int i; + XkbRF_RulesPtr list; + char filename[1024]; + XF86XkbRulesDescInfo *info; + + if (rules == NULL) + return (NULL); + + for (i = 0; i < num_xkb_desc; i++) + if (strcmp(rules, xkb_desc[i]->rules) == 0) + return (xkb_desc[i]); + + XmuSnprintf(filename, sizeof(filename), "%s%s", XkbRulesDir, rules); + if ((list = XkbRF_Create(0, 0)) == NULL || + !XkbRF_LoadDescriptionsByName(filename, NULL, list)) { + fprintf(stderr, "Can't create rules structure\n"); + return (NULL); + } + + info = (XF86XkbRulesDescInfo*)XtCalloc(1, sizeof(XF86XkbRulesDescInfo)); + xkb_desc = (XF86XkbRulesDescInfo**) + XtRealloc((XtPointer)xkb_desc, + sizeof(XF86XkbRulesDescInfo*) * (num_xkb_desc + 1)); + xkb_desc[num_xkb_desc++] = info; + info->rules = XtNewString(rules); + for (i = 0; i < list->models.num_desc; i++) { + if (i % 16 == 0) { + info->model.name = (char**)XtRealloc((XtPointer)info->model.name, + (i + 16) * sizeof(char*)); + info->model.desc = (char**)XtRealloc((XtPointer)info->model.desc, + (i + 16) * sizeof(char*)); + } + info->model.name[i] = XtNewString(list->models.desc[i].name); + info->model.desc[i] = XtNewString(list->models.desc[i].desc); + } + info->model.nelem = i; + + for (i = 0; i < list->layouts.num_desc; i++) { + if (i % 16 == 0) { + info->layout.name = (char**)XtRealloc((XtPointer)info->layout.name, + (i + 16) * sizeof(char*)); + info->layout.desc = (char**)XtRealloc((XtPointer)info->layout.desc, + (i + 16) * sizeof(char*)); + } + info->layout.name[i] = XtNewString(list->layouts.desc[i].name); + info->layout.desc[i] = XtNewString(list->layouts.desc[i].desc); + } + info->layout.nelem = i; + + for (i = 0; i < list->variants.num_desc; i++) { + if (i % 16 == 0) { + info->variant.name = (char**)XtRealloc((XtPointer)info->variant.name, + (i + 16) * sizeof(char*)); + info->variant.desc = (char**)XtRealloc((XtPointer)info->variant.desc, + (i + 16) * sizeof(char*)); + } + info->variant.name[i] = XtNewString(list->variants.desc[i].name); + info->variant.desc[i] = XtNewString(list->variants.desc[i].desc); + } + info->variant.nelem = i; + + for (i = 0; i < list->options.num_desc; i++) { + if (i % 16 == 0) { + info->option.name = (char**)XtRealloc((XtPointer)info->option.name, + (i + 16) * sizeof(char*)); + info->option.desc = (char**)XtRealloc((XtPointer)info->option.desc, + (i + 16) * sizeof(char*)); + } + info->option.name[i] = XtNewString(list->options.desc[i].name); + info->option.desc[i] = XtNewString(list->options.desc[i].desc); + } + info->option.nelem = i; + info->list = list; + + return (info); } static xf86ConfigSymTabRec ax_controls[] = @@ -499,7 +693,7 @@ WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf) return (False); if (conf->rules_file != NULL) - fprintf(fp, "Rules = %s\n", + fprintf(fp, "Rules = \"%s\"\n", conf->rules_file); if (conf->model != NULL) fprintf(fp, "Model = \"%s\"\n", @@ -508,10 +702,10 @@ WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf) fprintf(fp, "Layout = \"%s\"\n", conf->layout); if (conf->variant != NULL) - fprintf(fp, "Variant = %s\n", + fprintf(fp, "Variant = \"%s\"\n", conf->variant); if (conf->options != NULL) - fprintf(fp, "Options = %s\n", + fprintf(fp, "Options = \"%s\"\n", conf->options); if (conf->keymap != NULL) fprintf(fp, "Keymap = %s\n", @@ -645,45 +839,21 @@ WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf) return (True); } -void +Bool UpdateKeyboard(Bool load) { - static XkbRF_RulesPtr rules; XkbComponentNamesRec comps; XkbDescPtr xkb; - if (rules == NULL) { - FILE *fp; - - if ((fp = fopen(XkbRulesFile, "r")) == NULL) { - fprintf(stderr, "Can't open rules file\n"); - exit(1); - } - - if ((rules = XkbRF_Create(0, 0)) == NULL) { - fclose(fp); - fprintf(stderr, "Can't create rules structure\n"); - exit(1); - } - - if (!XkbRF_LoadRules(fp, rules)) { - fclose(fp); - XkbRF_Free(rules, True); - fprintf(stderr, "Can't load rules\n"); - exit(1); - } - fclose(fp); - } - bzero((char*)&comps, sizeof(XkbComponentNamesRec)); - XkbRF_GetComponents(rules, &(xkb_info->defs), &comps); + XkbRF_GetComponents(xkb_rules->list, &(xkb_info->defs), &comps); xkb = XkbGetKeyboardByName(DPY, XkbUseCoreKbd, &comps, XkbGBN_AllComponentsMask, 0, load); if (xkb == NULL || xkb->geom == NULL) { fprintf(stderr, "Couldn't get keyboard\n"); - exit(1); + return (False); } if (xkb->names->geometry == 0) xkb->names->geometry = xkb->geom->name; @@ -701,6 +871,150 @@ UpdateKeyboard(Bool load) if (kbd != NULL) XClearArea(XtDisplay(configp), XtWindow(kbd), 0, 0, 0, 0, True); + + return (True); +} + +static void +KeyboardRulesCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + int i; + FILE *fp; + Arg args[1]; + char filename[1024], *omodel, *olayout, *ovariant, *ooptions, + *dmodel, *dlayout, *dvariant; + XF86XkbRulesDescInfo *oxkb_rules, *info = GetXkbRulesDesc(XtName(w)); + + if (strcmp(XtName(w), rules) == 0 || info == NULL) + /* a error message was printed */ + return; + + XmuSnprintf(filename, sizeof(filename), "%s%s", + XkbRulesDir, info->rules); + if ((fp = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Can't open rules file\n"); + return; + } + + if (!XkbRF_LoadRules(fp, info->list)) { + fclose(fp); + fprintf(stderr, "Can't load rules\n"); + return; + } + fclose(fp); + + oxkb_rules = xkb_rules; + omodel = xkb_info->defs.model; + olayout = xkb_info->defs.layout; + ovariant = xkb_info->defs.variant; + ooptions = xkb_info->defs.options; + + if (omodel) { + for (i = 0; i < info->model.nelem; i++) { + if (strcmp(omodel, info->model.name[i]) == 0) + break; + } + } + else + i = 0; + model = xkb_info->defs.model = info->model.name + [i < info->model.nelem ? i : 0]; + dmodel = info->model.desc[i < info->model.nelem ? i : 0]; + + if (olayout) { + for (i = 0; i < info->layout.nelem; i++) { + if (strcmp(olayout, info->layout.name[i]) == 0) + break; + } + } + else + i = 0; + layout = xkb_info->defs.layout = info->layout.name + [i < info->layout.nelem ? i : 0]; + dlayout = info->layout.desc[i < info->layout.nelem ? i : 0]; + + if (ovariant) { + for (i = 0; i < info->variant.nelem; i++) { + if (strcmp(ovariant, info->variant.name[i]) == 0) + break; + } + } + else + i = info->variant.nelem; + variant = xkb_info->defs.variant = i < info->variant.nelem ? + info->variant.name[i] : NULL; + dvariant = i < info->variant.nelem ? + info->variant.desc[i] : NULL; + + if (ooptions) { + char *ptr, *tmp = XtNewString(options); + + for (ptr = strtok(tmp, ","); ptr != NULL; ptr = strtok(NULL, ",")) { + if (strchr(ptr, ':') == NULL) + continue; + + for (i = 0; i < xkb_rules->option.nelem; i++) + if (strcmp(xkb_rules->option.name[i], ptr) == 0) + break; + + if (i == xkb_rules->option.nelem) { + XtFree(options); + options = NULL; + /* no option with the same name */ + break; + } + } + XtFree(tmp); + } + else { + XtFree(options); + options = NULL; + } + + oxkb_rules = xkb_rules; + xkb_rules = info; + rules = info->rules; + + if (!UpdateKeyboard(False)) { + model = xkb_info->defs.model = omodel; + layout = xkb_info->defs.layout = olayout; + variant = xkb_info->defs.variant = ovariant; + options = xkb_info->defs.options = ooptions; + xkb_rules = oxkb_rules; + rules = xkb_rules->rules; + + XmuSnprintf(filename, sizeof(filename), "%s%s", + XkbRulesDir, rules); + if ((fp = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Can't open rules file\n"); + return; + } + + if (!XkbRF_LoadRules(fp, xkb_rules->list)) { + fclose(fp); + fprintf(stderr, "Can't load rules\n"); + } + fclose(fp); + + return; + } + + UpdateRulesPopups(); + + XtSetArg(args[0], XtNlabel, rules); + XtSetValues(rulesb, args, 1); + + XtSetArg(args[0], XtNlabel, dmodel); + XtSetValues(modelb, args, 1); + + XtSetArg(args[0], XtNlabel, dlayout); + XtSetValues(layoutb, args, 1); + + XtSetArg(args[0], XtNlabel, dvariant ? dvariant : ""); + XtSetValues(variantb, args, 1); + + XtSetArg(args[0], XtNlabel, options ? options : ""); + XtSetValues(variantb, args, 1); } static void @@ -708,14 +1022,18 @@ KeyboardModelCallback(Widget w, XtPointer user_data, XtPointer call_data) { Arg args[1]; int i; + char *oldval = xkb_info->defs.model; - for (i = 0; i < xkb_model.nelem; i++) - if (strcmp(XtName(w), xkb_model.name[i]) == 0) + for (i = 0; i < xkb_rules->model.nelem; i++) + if (strcmp(XtName(w), xkb_rules->model.name[i]) == 0) break; - XtSetArg(args[0], XtNlabel, xkb_model.desc[i]); - XtSetValues(modelb, args, 1); - model = xkb_info->defs.model = xkb_model.name[i]; - UpdateKeyboard(False); + model = xkb_info->defs.model = xkb_rules->model.name[i]; + if (!UpdateKeyboard(False)) + model = xkb_info->defs.model = oldval; + else { + XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]); + XtSetValues(modelb, args, 1); + } } static void @@ -723,20 +1041,209 @@ KeyboardLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) { Arg args[1]; int i; + char *oldval = xkb_info->defs.layout; - for (i = 0; i < xkb_layout.nelem; i++) - if (strcmp(XtName(w), xkb_layout.name[i]) == 0) + for (i = 0; i < xkb_rules->layout.nelem; i++) + if (strcmp(XtName(w), xkb_rules->layout.name[i]) == 0) break; - XtSetArg(args[0], XtNlabel, xkb_layout.desc[i]); - XtSetValues(layoutb, args, 1); - layout = xkb_info->defs.layout = xkb_layout.name[i]; + layout = xkb_info->defs.layout = xkb_rules->layout.name[i]; + if (!UpdateKeyboard(False)) + layout = xkb_info->defs.layout = oldval; + else { + XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]); + XtSetValues(layoutb, args, 1); + } +} + +static void +KeyboardVariantCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + Arg args[1]; + int i; + char *label, *oldval = xkb_info->defs.variant; + + for (i = 0; i < xkb_rules->variant.nelem; i++) + if (strcmp(XtName(w), xkb_rules->variant.name[i]) == 0) + break; + variant = i < xkb_rules->variant.nelem ? xkb_rules->variant.name[i] : ""; + xkb_info->defs.variant = variant && *variant ? variant : NULL; + + if (!UpdateKeyboard(False)) + xkb_info->defs.variant = variant = oldval; + else { + label = i < xkb_rules->variant.nelem ? xkb_rules->variant.desc[i] : ""; + XtSetArg(args[0], XtNlabel, label); + XtSetValues(variantb, args, 1); + } +} + +static void +KeyboardOptionsCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + Arg args[1]; + int i; + char *oldval = xkb_info->defs.options ? + XtNewString(xkb_info->defs.options) : XtNewString(""); + + for (i = 0; i < xkb_rules->option.nelem; i++) + if (strcmp(XtName(w), xkb_rules->option.name[i]) == 0) + break; + + if (i < xkb_rules->option.nelem) { + char *delim, *ptr, str[256]; + + /* remove old string, don't check if the same */ + if ((delim = strchr(XtName(w), ':')) != NULL) { + if (delim - XtName(w) >= sizeof(str) - 2) + return; + strncpy(str, XtName(w), delim - XtName(w) + 1); + str[delim - XtName(w) + 1] = '\0'; + } + else + XmuSnprintf(str, sizeof(str), "%s:", XtName(w)); + if (options && (delim = strstr(options, str)) != NULL) { + if ((ptr = strchr(delim, ',')) != NULL) { + *delim = *ptr = '\0'; + XmuSnprintf(str, sizeof(str), "%s%s", options, ptr + 1); + XtFree(options); + options = XtNewString(str); + } + else { + if (delim > options) + delim[-1] = '\0'; + else + delim[0] = '\0'; + } + } + + /* update string, if required */ + if ((delim = strchr(XtName(w), ':')) != NULL) { + if (options && *options) + XmuSnprintf(str, sizeof(str), "%s,%s", options, XtName(w)); + else + XmuSnprintf(str, sizeof(str), "%s", XtName(w)); + XtFree(options); + options = XtNewString(str); + } + } + else { + XtFree(options); + options = XtNewString(""); + } + + if (options == NULL) + options = XtNewString(""); + + xkb_info->defs.options = *options ? options : NULL; + if (!UpdateKeyboard(False)) { + XtFree(options); + xkb_info->defs.options = *oldval ? oldval : NULL; + } + else { + XtFree(oldval); + XtSetArg(args[0], XtNlabel, options); + XtSetValues(optionsb, args, 1); + XtSetArg(args[0], XtNtip, options); + XtSetValues(optionsb, args, 1); + } } /*ARGSUSED*/ static void KeyboardApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) { - UpdateKeyboard(True); + (void)UpdateKeyboard(True); +} + +static void +UpdateRulesPopups(void) +{ + int i; + char *optname; + Widget sme, optpopup, optparent; + + /* MODEL */ + if (modelp) + XtDestroyWidget(modelp); + modelp = XtCreatePopupShell("modelP", simpleMenuWidgetClass, + modelb, NULL, 0); + for (i = 0; i < xkb_rules->model.nelem; i++) { + sme = XtVaCreateManagedWidget(xkb_rules->model.name[i], smeBSBObjectClass, + modelp, + XtNlabel, xkb_rules->model.desc[i], + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardModelCallback, NULL); + } + + /* LAYOUT */ + if (layoutp) + XtDestroyWidget(layoutp); + layoutp = XtCreatePopupShell("layoutP", simpleMenuWidgetClass, + layoutb, NULL, 0); + for (i = 0; i < xkb_rules->layout.nelem; i++) { + sme = XtVaCreateManagedWidget(xkb_rules->layout.name[i], smeBSBObjectClass, + layoutp, + XtNlabel, xkb_rules->layout.desc[i], + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardLayoutCallback, NULL); + } + + /* VARIANT */ + if (variantp) + XtDestroyWidget(variantp); + variantp = XtCreatePopupShell("variantP", simpleMenuWidgetClass, + variantb, NULL, 0); + sme = XtVaCreateManagedWidget("None", smeBSBObjectClass, + variantp, + XtNlabel, "None", + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL); + for (i = 0; i < xkb_rules->variant.nelem; i++) { + sme = XtVaCreateManagedWidget(xkb_rules->variant.name[i], smeBSBObjectClass, + variantp, + XtNlabel, xkb_rules->variant.desc[i], + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL); + } + + /* OPTIONS */ + if (optionsp) + XtDestroyWidget(optionsp); + optionsp = XtCreatePopupShell("optionsP", simpleMenuWidgetClass, + optionsb, NULL, 0); + sme = XtVaCreateManagedWidget("None", smeBSBObjectClass, + optionsp, + XtNlabel, "None", + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); + optparent = optionsp; + optname = NULL; + for (i = 0; i < xkb_rules->option.nelem; i++) { + if (!strchr(xkb_rules->option.name[i], ':')) { + optpopup = + XtCreatePopupShell(optname = xkb_rules->option.desc[i], + simpleMenuWidgetClass, + optparent = optionsp, NULL, 0); + sme = XtVaCreateManagedWidget(xkb_rules->option.name[i], + smeBSBObjectClass, + optpopup, + XtNlabel, "None", + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); + } + else { + optparent = optpopup; + optname = NULL; + } + sme = XtVaCreateManagedWidget(xkb_rules->option.name[i], smeBSBObjectClass, + optparent, + XtNlabel, xkb_rules->option.desc[i], + XtNmenuName, optname, + XtNleftBitmap, optname ? menuPixmap : None, + NULL, 0); + if (optparent != optionsp) + XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); + } } void @@ -748,45 +1255,69 @@ KeyboardModelAndLayout(XF86SetupInfo *info) int i; if (first) { - Widget label, popup, sme; + Widget popup, sme; first = 0; kbdml = XtCreateWidget("keyboardML", formWidgetClass, configp, NULL, 0); + /* RULES */ + XtCreateManagedWidget("labelR", labelWidgetClass, kbdml, NULL, 0); + rulesb = XtVaCreateManagedWidget("rules", menuButtonWidgetClass, kbdml, + XtNmenuName, "rulesP", + NULL, 0); + popup = XtCreatePopupShell("rulesP", simpleMenuWidgetClass, + rulesb, NULL, 0); + { + struct dirent *ent; + DIR *dir; + + if ((dir = opendir(XkbRulesDir)) != NULL) { + (void)readdir(dir); + (void)readdir(dir); + while ((ent = readdir(dir)) != NULL) { + if (strchr(ent->d_name, '.')) + continue; + + sme = XtVaCreateManagedWidget(ent->d_name, smeBSBObjectClass, + popup, + XtNlabel, ent->d_name, + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardRulesCallback, NULL); + } + closedir(dir); + } + } + /* MODEL */ - label = XtCreateManagedWidget("labelM", labelWidgetClass, - kbdml, NULL, 0); + XtCreateManagedWidget("labelM", labelWidgetClass, kbdml, NULL, 0); modelb = XtVaCreateManagedWidget("model", menuButtonWidgetClass, kbdml, XtNmenuName, "modelP", NULL, 0); - popup = XtCreatePopupShell("modelP", simpleMenuWidgetClass, - modelb, NULL, 0); - for (i = 0; i < xkb_model.nelem; i++) { - sme = XtVaCreateManagedWidget(xkb_model.name[i], smeBSBObjectClass, - popup, - XtNlabel, xkb_model.desc[i], - NULL, 0); - XtAddCallback(sme, XtNcallback, KeyboardModelCallback, NULL); - } /* LAYOUT */ - label = XtCreateManagedWidget("labelL", labelWidgetClass, - kbdml, NULL, 0); + XtCreateManagedWidget("labelL", labelWidgetClass, kbdml, NULL, 0); layoutb = XtVaCreateManagedWidget("layout", menuButtonWidgetClass, kbdml, XtNmenuName, "layoutP", - XtNlabel, xkb_layout.desc[0], + XtNlabel, xkb_rules->layout.desc[0], NULL, 0); - popup = XtCreatePopupShell("layoutP", simpleMenuWidgetClass, - layoutb, NULL, 0); - for (i = 0; i < xkb_layout.nelem; i++) { - sme = XtVaCreateManagedWidget(xkb_layout.name[i], smeBSBObjectClass, - popup, - XtNlabel, xkb_layout.desc[i], + + /* VARIANT */ + XtCreateManagedWidget("labelV", labelWidgetClass, kbdml, NULL, 0); + variantb = XtVaCreateManagedWidget("variant", menuButtonWidgetClass, kbdml, + XtNmenuName, "variantP", + XtNlabel, "", NULL, 0); - XtAddCallback(sme, XtNcallback, KeyboardLayoutCallback, NULL); - } + + /* OPTIONS */ + XtCreateManagedWidget("labelO", labelWidgetClass, kbdml, NULL, 0); + optionsb = XtVaCreateManagedWidget("options", menuButtonWidgetClass, kbdml, + XtNmenuName, "optionsP", + XtNlabel, "", + NULL, 0); + + UpdateRulesPopups(); kbd = XtCreateManagedWidget("keyboard", coreWidgetClass, kbdml, NULL, 0); @@ -802,20 +1333,36 @@ KeyboardModelAndLayout(XF86SetupInfo *info) XClearArea(XtDisplay(kbd), XtWindow(kbd), 0, 0, 0, 0, True); } - for (i = 0; i < xkb_model.nelem; i++) - if (strcmp(model, xkb_model.name[i]) == 0) { - XtSetArg(args[0], XtNlabel, xkb_model.desc[i]); + XtSetArg(args[0], XtNlabel, xkb_rules->rules); + XtSetValues(rulesb, args, 1); + + for (i = 0; i < xkb_rules->model.nelem; i++) + if (strcmp(model, xkb_rules->model.name[i]) == 0) { + XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]); XtSetValues(modelb, args, 1); break; } - for (i = 0; i < xkb_layout.nelem; i++) - if (strcmp(layout, xkb_layout.name[i]) == 0) { - XtSetArg(args[0], XtNlabel, xkb_layout.desc[i]); + for (i = 0; i < xkb_rules->layout.nelem; i++) + if (strcmp(layout, xkb_rules->layout.name[i]) == 0) { + XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]); XtSetValues(layoutb, args, 1); break; } + if (variant) + for (i = 0; i < xkb_rules->variant.nelem; i++) + if (strcmp(variant, xkb_rules->variant.name[i]) == 0) { + XtSetArg(args[0], XtNlabel, xkb_rules->variant.desc[i]); + XtSetValues(variantb, args, 1); + break; + } + + if (options) { + XtSetArg(args[0], XtNlabel, options); + XtSetValues(optionsb, args, 1); + } + XtChangeManagedSet(¤t, 1, NULL, NULL, &kbdml, 1); current = kbdml; } diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h index b8f461c78..6ff63c002 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h,v 1.2 2000/06/13 23:15:51 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h,v 1.3 2001/03/02 22:39:27 paulo Exp $ */ #include "config.h" @@ -63,7 +63,7 @@ typedef struct { XtPointer KeyboardConfig(XtPointer); void KeyboardModelAndLayout(XF86SetupInfo*); void InitializeKeyboard(void); -void UpdateKeyboard(Bool); +Bool UpdateKeyboard(Bool); Bool WriteXKBConfiguration(char*, XkbConfigRtrnPtr); /* diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c index 7ab3e7f82..430833381 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.5 2001/01/31 20:52:19 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.7 2001/03/24 01:17:20 paulo Exp $ */ #include "xf86config.h" @@ -166,9 +166,9 @@ MonitorConfig(XtPointer conf) monitor = (XF86ConfMonitorPtr)(monitor->list.next); } do { - ++nmonitors; XmuSnprintf(monitor_name, sizeof(monitor_name), "Monitor%d", nmonitors); + ++nmonitors; } while (xf86findMonitor(monitor_name, XF86Config->conf_monitor_lst)); @@ -266,6 +266,10 @@ string_to_parser_range(char *str, parser_range *range, int nrange) while (*str) { while (*str && isspace(*str)) ++str; + if (!isdigit(*str)) { + ++str; + continue; + } val = strtod(str, &str); while (*str && isspace(*str)) ++str; diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c index e3949d60e..d7d2f3c61 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.5 2000/10/20 14:59:06 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.6 2001/03/24 01:17:21 paulo Exp $ */ #include "xf86config.h" @@ -115,8 +115,8 @@ MouseConfig(XtPointer config) input = (XF86ConfInputPtr)(input->list.next); } do { - ++nmouses; XmuSnprintf(mouse_name, sizeof(mouse_name), "Mouse%d", nmouses); + ++nmouses; } while (xf86findInput(mouse_name, XF86Config->conf_input_lst)); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c index 9914ad7a9..e683bff12 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.6 2000/12/08 21:51:06 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.7 2001/04/01 14:00:15 tsi Exp $ */ #include "xf86config.h" @@ -367,7 +367,7 @@ static void MoveCallback(Widget w, XtPointer user_data, XtPointer call_data) { char *tmp; - Bool down = (Bool)user_data; + Bool down = (long)user_data; if (unsel_index < 0 || unsel_index >= ndefmodes) return; diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c index a1bbf8c8f..227701269 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.5 2000/12/01 18:31:07 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.6 2001/03/24 01:17:21 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -194,9 +194,9 @@ AddScreen(xf86cfgDevice *mon, xf86cfgDevice *dev) screen = (XF86ConfScreenPtr)(screen->list.next); } do { - ++nscreens; XmuSnprintf(screen_name, sizeof(screen_name), "Screen%d", nscreens); + ++nscreens; } while (xf86findScreen(screen_name, XF86Config->conf_screen_lst) != NULL); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c index f710c5940..d387af8e8 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.8 2001/02/15 17:28:35 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.9 2001/03/01 20:37:25 paulo Exp $ */ #include <stdio.h> @@ -798,6 +798,7 @@ MonitorConfig(void) int nlist, def; char hsync_str[256], vrefresh_str[256]; + hsync_str[0] = vrefresh_str[0] = '\0'; nlist = 0; while (monitor) { list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*)); @@ -929,7 +930,7 @@ MonitorConfig(void) } } } - else + if (hsync_str[0] == '\0') strcpy(hsync_str, "31.5"); ClearScreen(); @@ -987,7 +988,7 @@ MonitorConfig(void) } } } - else + if (vrefresh_str[0] == '\0') strcpy(vrefresh_str, "50 - 70"); ClearScreen(); refresh(); @@ -1678,7 +1679,7 @@ CopyAdjacency(XF86ConfAdjacencyPtr ptr) adj->adj_scrnum = ptr->adj_scrnum; adj->adj_screen = ptr->adj_screen; - adj->adj_screen_str = XtNewString(adj->adj_screen_str); + adj->adj_screen_str = XtNewString(ptr->adj_screen_str); adj->adj_top = ptr->adj_top; if (ptr->adj_top_str) adj->adj_top_str = XtNewString(ptr->adj_top_str); @@ -2152,7 +2153,7 @@ LayoutConfig(void) ClearScreen(); refresh(); Dialog("Layout configuration", - (nmouses > 1 && nkeyboards > 1) ? + (nmouses > 1 || nkeyboards > 1) ? "As you have only one screen configured, I can now finish " "creating this Layout configuration." : @@ -3308,7 +3309,7 @@ DialogInput(char *title, char *prompt, int height, int width, char *init, case '\r': case '\n': delwin(dialog); - return (button == -1 ? XtNewString(instr) : NULL); + return (button != 1 ? XtNewString(instr) : NULL); } } } diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c index 08fd8285e..b2b0b871c 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.4 2000/11/30 20:55:18 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.5 2001/03/27 20:25:30 paulo Exp $ */ #include "xf86config.h" @@ -247,6 +247,8 @@ xf86removeScreen(XF86ConfigPtr config, XF86ConfScreenPtr screen) scrn = (XF86ConfScreenPtr)(scrn->list.next); } + if (scrn == NULL) + return (False); while (lay != NULL) { XF86ConfAdjacencyPtr pad, ad = NULL, adj = lay->lay_adjacency_lst; diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/Cards b/xc/programs/Xserver/hw/xfree86/xf86config/Cards index 512250bbb..9c4575347 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86config/Cards +++ b/xc/programs/Xserver/hw/xfree86/xf86config/Cards @@ -18,7 +18,7 @@ # The majority of entries are just a binding of a model name to a # chipset/server and untested. # -# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.75 2000/12/12 17:01:40 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.76 2001/04/01 14:00:16 tsi Exp $ # VGA @@ -1645,7 +1645,7 @@ SEE ET6000 (generic) NAME ATI Rage 128 CHIPSET ati SERVER SVGA -DRIVER r128 +DRIVER ati NAME ATI 8514 Ultra (no VGA) CHIPSET ati diff --git a/xc/programs/Xserver/hw/xnest/Imakefile b/xc/programs/Xserver/hw/xnest/Imakefile index 138e45141..f34a01ea8 100644 --- a/xc/programs/Xserver/hw/xnest/Imakefile +++ b/xc/programs/Xserver/hw/xnest/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.19 2001/01/17 22:36:55 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.20 2001/03/03 22:57:26 tsi Exp $ #include <Server.tmpl> @@ -58,13 +58,13 @@ OBJS = Args.o \ INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I../../mi -I../../include -I../../os \ -I$(EXTINCSRC) -I$(XINCLUDESRC) -DEFINES = $(OS_DEFINES) -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC \ - -UMITSHM -UXF86DRI -UXFree86LOADER +DEFINES = $(OS_DEFINES) $(EXT_DEFINES) -UXINPUT -UMITSHM \ + -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI -UXFree86LOADER all:: $(OBJS) LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) -SpecialCObjectRule(Init,$(ICONFIGFILES),$(EXT_DEFINES)) +SpecialCObjectRule(Init,$(ICONFIGFILES),$(_NOOP_)) LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) SpecialCObjectRule(miinitext,$(ICONFIGFILES),-UDPMSExtension) diff --git a/xc/programs/Xserver/hw/xnest/Init.c b/xc/programs/Xserver/hw/xnest/Init.c index f200992fb..b6165fec4 100644 --- a/xc/programs/Xserver/hw/xnest/Init.c +++ b/xc/programs/Xserver/hw/xnest/Init.c @@ -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/Init.c,v 3.20 2001/01/17 22:36:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Init.c,v 3.21 2001/03/04 17:40:13 herrb Exp $ */ #include "X.h" #include "Xproto.h" @@ -124,6 +124,13 @@ void ddxGiveUp() AbortDDX(); } +#ifdef __DARWIN__ +void +DarwinHandleGUI(int argc, char *argv[]) +{ +} +#endif + void OsVendorInit() { return; diff --git a/xc/programs/Xserver/hw/xnest/Keyboard.c b/xc/programs/Xserver/hw/xnest/Keyboard.c index ead2d1c7a..0a67db1e6 100644 --- a/xc/programs/Xserver/hw/xnest/Keyboard.c +++ b/xc/programs/Xserver/hw/xnest/Keyboard.c @@ -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/Keyboard.c,v 1.4 2001/01/17 22:36:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Keyboard.c,v 1.6 2001/03/25 05:32:15 tsi Exp $ */ #define NEED_EVENTS #include "X.h" @@ -31,6 +31,55 @@ is" without express or implied warranty. #include "Keyboard.h" #include "Args.h" +#ifdef XKB +#include <X11/extensions/XKB.h> +#include <X11/extensions/XKBsrv.h> +#include <X11/extensions/XKBconfig.h> + +extern Bool XkbQueryExtension( +#if NeedFunctionPrototypes + Display * /* dpy */, + int * /* opcodeReturn */, + int * /* eventBaseReturn */, + int * /* errorBaseReturn */, + int * /* majorRtrn */, + int * /* minorRtrn */ +#endif +); + +extern XkbDescPtr XkbGetKeyboard( +#if NeedFunctionPrototypes + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* deviceSpec */ +#endif +); + +#ifndef XKB_BASE_DIRECTORY +#define XKB_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb/" +#endif +#ifndef XKB_CONFIG_FILE +#define XKB_CONFIG_FILE "X0-config.keyboard" +#endif +#ifndef XKB_DFLT_RULES_FILE +#define XKB_DFLT_RULES_FILE "xfree86" +#endif +#ifndef XKB_DFLT_KB_LAYOUT +#define XKB_DFLT_KB_LAYOUT "us" +#endif +#ifndef XKB_DFLT_KB_MODEL +#define XKB_DFLT_KB_MODEL "pc101" +#endif +#ifndef XKB_DFLT_KB_VARIANT +#define XKB_DFLT_KB_VARIANT NULL +#endif +#ifndef XKB_DFLT_KB_OPTIONS +#define XKB_DFLT_KB_OPTIONS NULL +#endif + +extern Bool noXkbExtension; +#endif + void xnestBell(volume, pDev, ctrl, cls) int volume; DeviceIntPtr pDev; @@ -44,6 +93,7 @@ void xnestChangeKeyboardControl(pDev, ctrl) DeviceIntPtr pDev; KeybdCtrl *ctrl; { +#if 0 unsigned long value_mask; XKeyboardControl values; int i; @@ -75,6 +125,7 @@ void xnestChangeKeyboardControl(pDev, ctrl) values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff; XChangeKeyboardControl(xnestDisplay, value_mask, &values); } +#endif } int xnestKeyboardProc(pDev, onoff, argc, argv) @@ -134,6 +185,10 @@ int xnestKeyboardProc(pDev, onoff, argc, argv) keySyms.mapWidth = mapWidth; keySyms.map = keymap; +#ifdef XKB + if (noXkbExtension) { +XkbError: +#endif XGetKeyboardControl(xnestDisplay, &values); memmove((char *) defaultKeyboardControl.autoRepeats, @@ -141,6 +196,68 @@ int xnestKeyboardProc(pDev, onoff, argc, argv) InitKeyboardDeviceStruct(pDev, &keySyms, modmap, xnestBell, xnestChangeKeyboardControl); +#ifdef XKB + } else { + FILE *file; + XkbConfigRtrnRec config; + + XkbComponentNamesRec names; + char *rules, *model, *layout, *variants, *options; + + XkbDescPtr xkb; + int op, event, error, major, minor; + + if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor) == 0) { + ErrorF("Unable to initialize XKEYBOARD extension.\n"); + goto XkbError; + } + xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); + if (xkb == NULL || xkb->geom == NULL) { + ErrorF("Couldn't get keyboard.\n"); + goto XkbError; + } + XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb); + + memset(&names, 0, sizeof(XkbComponentNamesRec)); + rules = XKB_DFLT_RULES_FILE; + model = XKB_DFLT_KB_MODEL; + layout = XKB_DFLT_KB_LAYOUT; + variants = XKB_DFLT_KB_VARIANT; + options = XKB_DFLT_KB_OPTIONS; + if (XkbInitialMap) { + if ((names.keymap = strchr(XkbInitialMap, '/')) != NULL) + ++names.keymap; + else + names.keymap = XkbInitialMap; + } + + if ((file = fopen(XKB_BASE_DIRECTORY XKB_CONFIG_FILE, "r")) != NULL) { + if (XkbCFParse(file, XkbCFDflts, xkb, &config) == 0) { + ErrorF("Error parsing config file.\n"); + fclose(file); + goto XkbError; + } + if (config.rules_file) + rules = config.rules_file; + if (config.model) + model = config.model; + if (config.layout) + layout = config.layout; + if (config.variant) + variants = config.variant; + if (config.options) + options = config.options; + + fclose(file); + } + + XkbSetRulesDflts(rules, model, layout, variants, options); + XkbInitKeyboardDeviceStruct((pointer)pDev, &names, &keySyms, modmap, + xnestBell, xnestChangeKeyboardControl); + XkbDDXChangeControls((pointer)pDev, xkb->ctrls, xkb->ctrls); + XkbFreeKeyboard(xkb, 0, False); + } +#endif #ifdef _XSERVER64 xfree(keymap); #else diff --git a/xc/programs/Xserver/hw/xnest/Screen.c b/xc/programs/Xserver/hw/xnest/Screen.c index 4193ca2aa..1a7e078ca 100644 --- a/xc/programs/Xserver/hw/xnest/Screen.c +++ b/xc/programs/Xserver/hw/xnest/Screen.c @@ -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/Screen.c,v 3.8 2001/01/17 22:36:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.9 2001/03/23 01:27:09 paulo Exp $ */ #include "X.h" #include "Xproto.h" @@ -37,6 +37,7 @@ is" without express or implied warranty. #include "Visual.h" #include "Events.h" #include "Init.h" +#include "mipointer.h" #include "Args.h" extern Window xnestParentWindow; @@ -100,6 +101,28 @@ static Bool xnestSaveScreen(pScreen, what) } } +static Bool +xnestCursorOffScreen (ppScreen, x, y) + ScreenPtr *ppScreen; + int *x, *y; +{ + return FALSE; +} + +static void +xnestCrossScreen (pScreen, entering) + ScreenPtr pScreen; + Bool entering; +{ +} + +static miPointerScreenFuncRec xnestPointerCursorFuncs = +{ + xnestCursorOffScreen, + xnestCrossScreen, + miPointerWarpCursor +}; + Bool xnestOpenScreen(index, pScreen, argc, argv) int index; register ScreenPtr pScreen; @@ -184,6 +207,8 @@ Bool xnestOpenScreen(index, pScreen, argc, argv) miInitializeBackingStore(pScreen); + miDCInitialize(pScreen, &xnestPointerCursorFuncs); + pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay, DefaultScreen(xnestDisplay)) / DisplayWidth(xnestDisplay, diff --git a/xc/programs/Xserver/hw/xwin/Imakefile b/xc/programs/Xserver/hw/xwin/Imakefile index 7386a01a2..45df5e969 100644 --- a/xc/programs/Xserver/hw/xwin/Imakefile +++ b/xc/programs/Xserver/hw/xwin/Imakefile @@ -1,54 +1,87 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.3 2000/11/28 16:10:40 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.4 2001/04/05 20:13:49 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 - -OBJSA = InitInput.o InitOutput.o stubs.o miinitext.o directx.o +SRCSA = InitInput.c \ + InitOutput.c \ + stubs.c \ + miinitext.c \ + wingc.c \ + winpolyline.c \ + winfillsp.c \ + wingetsp.c \ + winsetsp.c \ + winwindow.c \ + winpntwin.c \ + winpixmap.c \ + winfont.c \ + wincmap.c \ + winclip.c \ + winallpriv.c \ + winscrinit.c \ + winmisc.c \ + winblock.c \ + winwakeup.c \ + wincursor.c \ + winwndproc.c \ + winshadgdi.c \ + winshaddd.c \ + winshadddnl.c \ + winpfbdd.c + +OBJSA = InitInput.o \ + InitOutput.o \ + stubs.o \ + miinitext.o \ + wingc.o \ + winpolyline.o \ + winfillsp.o \ + wingetsp.o \ + winsetsp.o \ + winwindow.o \ + winpntwin.o \ + winpixmap.o \ + winfont.o \ + wincmap.o \ + winclip.o \ + winallpriv.o \ + winscrinit.o \ + winmisc.o \ + winblock.o \ + winwakeup.o \ + wincursor.o \ + winwndproc.o \ + winshadgdi.o \ + winshaddd.o \ + winshadddnl.o \ + winpfbdd.o INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) -I$(SERVERSRC)/render \ - -I$(SERVERSRC)/cfb -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ -I$(SERVERSRC)/include -I$(SERVERSRC)/os \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) + -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/miext/shadow DEFINES = ServerOSDefines $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI #if BuildDPMS -SRCSC = dpmsstubs.c -OBJSC = dpmsstubs.o +SRCSB = dpmsstubs.c +OBJSB = 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) +LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) SpecialCObjectRule(InitInput,$(ICONFIGFILES),$(EXT_DEFINES)) -LinkSourceFile(miinitext.c,../../mi) +LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER) #if BuildDPMS diff --git a/xc/programs/Xserver/hw/xwin/InitInput.c b/xc/programs/Xserver/hw/xwin/InitInput.c index 103f947d4..6185072cf 100644 --- a/xc/programs/Xserver/hw/xwin/InitInput.c +++ b/xc/programs/Xserver/hw/xwin/InitInput.c @@ -1,283 +1,318 @@ /* $TOG: InitInput.c /main/12 1998/02/10 13:23:52 kaleb $ */ /* -Copyright 1993, 1998 The Open Group + Copyright 1993, 1998 The Open Group -All Rights Reserved. + All Rights Reserved. -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. + 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. + 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. + 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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.2 2001/04/05 20:13:49 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 "win.h" #include "winkeymap.h" -#include "keysym.h" - - - -CARD32 lastEventTime = 0; +/* Called from dix/devices.c */ +/* All of our keys generate up and down transition notifications, + so all of our keys can be used as modifiers. -int TimeSinceLastInputEvent() + An example of a modifier is mapping the A key to the Control key. + A has to be a legal modifier. I think. +*/ +Bool +LegalModifier (unsigned int uiKey, DevicePtr pDevice) { - if (lastEventTime == 0) - lastEventTime = GetTimeInMillis(); - return GetTimeInMillis() - lastEventTime; + return TRUE; } -void SetTimeSinceLastInputEvent() +/* Called from dix/dispatch.c */ +/* We tell mi to dequeue the events that we have sent it */ +void +ProcessInputEvents (void) { - lastEventTime = GetTimeInMillis(); + mieqProcessInputEvents (); + miPointerUpdate (); } -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; +/* We call this function from winKeybdProc when we are + initializing the keyboard. +*/ +void +winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap) { - return TRUE; + int i; + KeySym *pKeySym = g_winKeySym; + + /* MAP_LENGTH is defined in Xserver/include/input.h to be 256 */ + for (i = 0; i < MAP_LENGTH; i++) + { + pModMap[i] = NoSymbol; /* make sure it is restored */ + } + + /* Loop through all valid entries in the key symbol table */ + for (i = MIN_KEYCODE; + i < (MIN_KEYCODE + NUM_KEYCODES); + i++, pKeySym += GLYPHS_PER_KEY) + { + switch(*pKeySym) + { + 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 = (KeySym*)g_winKeySym; + pKeySyms->mapWidth = GLYPHS_PER_KEY; + pKeySyms->minKeyCode = MIN_KEYCODE; + pKeySyms->maxKeyCode = MAX_STD_KEYCODE; } void -ProcessInputEvents() +winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt, + pointer pCtrl, int iClass) { - mieqProcessInputEvents(); - miPointerUpdate(); } -#define WIN_MIN_KEY 8 -#define WIN_MAX_KEY 255 - void -GetWinMappings (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; +winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) { - 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; +/* See Porting Layer Definition - p. 18 + * This function is known as a DeviceProc. + */ +int +winKeybdProc (DeviceIntPtr pDeviceInt, int onoff) { - KeySymsRec keySyms; - CARD8 modMap[MAP_LENGTH]; - int i; - DevicePtr pDev = (DevicePtr)pDevice; + KeySymsRec keySyms; + CARD8 modMap[MAP_LENGTH]; + DevicePtr pDevice = (DevicePtr) pDeviceInt; - switch (onoff) + switch (onoff) { case DEVICE_INIT: - GetWinMappings(&keySyms, modMap); - InitKeyboardDeviceStruct(pDev, &keySyms, modMap, - (BellProcPtr)NoopDDA, (KbdCtrlProcPtr)NoopDDA); - DIInitKeyboard () ; - break; + winGetKeyMappings (&keySyms, modMap); + InitKeyboardDeviceStruct (pDevice, + &keySyms, + modMap, + winKeybdBell, + winKeybdCtrl); + break; case DEVICE_ON: - pDev->on = TRUE; - break; - case DEVICE_OFF: - pDev->on = FALSE; - break; + pDevice->on = TRUE; + break; + case DEVICE_CLOSE: - DITermKeyboard () ; - break; + case DEVICE_OFF: + pDevice->on = FALSE; + break; } - return Success; + + return Success; +} + +void +winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl) +{ } -static int -winMouseProc(pDevice, onoff) - DeviceIntPtr pDevice; - int onoff; +/* See Porting Layer Definition - p. 18 + * This is known as a DeviceProc + */ +int +winMouseProc (DeviceIntPtr pDeviceInt, int onoff) { - BYTE map[4]; - DevicePtr pDev = (DevicePtr)pDevice; + CARD8 map[6]; + DevicePtr pDevice = (DevicePtr) pDeviceInt; - switch (onoff) + switch (onoff) { case DEVICE_INIT: - map[1] = 1; - map[2] = 2; - map[3] = 3; - InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents, - (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize()); - DIInitMouse () ; - break; + map[1] = 1; + map[2] = 2; + map[3] = 3; + map[4] = 4; + map[5] = 5; + InitPointerDeviceStruct (pDevice, + map, + 5, /* Buttons 4 and 5 are mouse wheel events */ + miPointerGetMotionEvents, + winMouseCtrl, + miPointerGetMotionBufferSize ()); + break; case DEVICE_ON: - pDev->on = TRUE; - break; - - case DEVICE_OFF: - pDev->on = FALSE; - break; + pDevice->on = TRUE; + break; case DEVICE_CLOSE: - DITermMouse () ; - break; + case DEVICE_OFF: + pDevice->on = FALSE; + break; } - return Success; + return Success; } +static void -InitInput(argc, argv) - int argc; - char *argv[]; +winInitializeModeKeyStates (void) { - DevicePtr p, k; - p = AddInputDevice(winMouseProc, TRUE); - k = AddInputDevice(winKeybdProc, TRUE); - RegisterPointerDevice(p); - RegisterKeyboardDevice(k); - miRegisterPointerDevice(screenInfo.screens[0], p); - (void)mieqInit (k, p); + xEvent xCurrentEvent; + + /* Restore NumLock */ + if (GetKeyState (VK_NUMLOCK) & 0x0001) + { + xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_NUMLOCK; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore CapsLock */ + if (GetKeyState (VK_CAPITAL) & 0x0001) + { + xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_CAPITAL; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore ScrollLock */ + if (GetKeyState (VK_SCROLL) & 0x0001) + { + xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_SCROLL; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore KanaLock */ + if (GetKeyState (VK_KANA) & 0x0001) + { + xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_KANA; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } } -GenerateInputEvent (type, ix, iy, button) +/* See Porting Layer Definition - p. 17 */ +void +InitInput (int argc, char *argv[]) { - xEvent x ; + DeviceIntPtr pMouse, pKeyboard; + + ErrorF ("InitInput ()\n"); - /* Event types defined in directx.c */ - switch (type) - { - case 0: /* Mouse motion */ - miPointerDeltaCursor (ix,iy,lastEventTime = GetTimeInMillis ()); - break; + pMouse = AddInputDevice (winMouseProc, TRUE); + pKeyboard = AddInputDevice (winKeybdProc, TRUE); + + RegisterPointerDevice (pMouse); + RegisterKeyboardDevice (pKeyboard); - 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; + miRegisterPointerDevice (screenInfo.screens[0], pMouse); + mieqInit ((DevicePtr)pKeyboard, (DevicePtr)pMouse); - 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 ; - } + /* Initialize the mode key states */ + winInitializeModeKeyStates (); } #ifdef XTESTEXT1 void -XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey) - int dev_type; - int keycode; - int keystate; - int mousex; - int mousey; +XTestGenerateEvent (int dev_type, int keycode, int keystate, + int mousex, int mousey) { + ErrorF ("XTestGenerateEvent ()\n"); } void -XTestGetPointerPos(fmousex, fmousey) - short *fmousex, *fmousey; +XTestGetPointerPos (short *fmousex, short *fmousey) { + ErrorF ("XTestGetPointerPos ()\n"); } void -XTestJumpPointer(jx, jy, dev_type) - int jx; - int jy; - int dev_type; +XTestJumpPointer (int jx, int jy, int dev_type) { + ErrorF ("XTestJumpPointer ()\n"); } #endif diff --git a/xc/programs/Xserver/hw/xwin/InitOutput.c b/xc/programs/Xserver/hw/xwin/InitOutput.c index 61bb66d9b..aec6a6f11 100644 --- a/xc/programs/Xserver/hw/xwin/InitOutput.c +++ b/xc/programs/Xserver/hw/xwin/InitOutput.c @@ -22,791 +22,459 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.3 2001/02/13 19:19:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.4 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +int g_nNumScreens; +winScreenInfo g_winScreens[MAXSCREENS]; +//Bool g_fPixmapDepths[33]; +int g_nLastScreen = -1; +ColormapPtr g_cmInstalledMaps[MAXSCREENS]; + +static PixmapFormatRec g_PixmapFormats[] = { + { 1, 1, BITMAP_SCANLINE_PAD }, + { 4, 8, BITMAP_SCANLINE_PAD }, + { 8, 8, BITMAP_SCANLINE_PAD }, + { 15, 16, BITMAP_SCANLINE_PAD }, + { 16, 16, BITMAP_SCANLINE_PAD }, + { 24, 32, BITMAP_SCANLINE_PAD }, + { 32, 32, BITMAP_SCANLINE_PAD } +}; +const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]); -#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 "picturestr.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> +#if 0 +/* Set all pixmap flags to false, except 1 bit depth pixmaps */ +void +winInitializePixmapDepths (void) +{ +#if 0 + int i; #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 */ -/* NOT REALLY NEEDED -- WORKS ONLY ON WINDOWS NT/2000, CAUSES PROBLEMS on WIN98/95/Me */ -//extern char * map_dx_fb( char *adr, unsigned long size ); - + /* We don't care what pixmaps people use, as long + as they are standard depths. + */ + g_fPixmapDepths[1] = TRUE; + g_fPixmapDepths[4] = TRUE; + g_fPixmapDepths[8] = TRUE; + g_fPixmapDepths[16] = TRUE; + g_fPixmapDepths[24] = TRUE; + g_fPixmapDepths[32] = TRUE; + +#if 0 + for (i = 2; i <= 32; i++) + { + g_fPixmapDepths[i] = FALSE; - -extern char *display; - -#define WIN_DEFAULT_WIDTH 1024 -#define WIN_DEFAULT_HEIGHT 768 -#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) + if (i == 16 || i == 24 || i == 32 ) + { + g_fPixmapDepths[i] = TRUE; + } + else { - 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; + g_fPixmapDepths[i] = FALSE; } - (*pScreen->InstallColormap)(cmap); - return TRUE; + } +#endif } +#endif -static void -winInitializeDefaultScreens() +void +winInitializeDefaultScreens (void) { - int i; + int i; - for (i = 0; i < MAXSCREENS; 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; + g_winScreens[i].dwScreen = i; + g_winScreens[i].dwWidth = WIN_DEFAULT_WIDTH; + g_winScreens[i].dwHeight = WIN_DEFAULT_HEIGHT; + g_winScreens[i].dwDepth = WIN_DEFAULT_DEPTH; + g_winScreens[i].pixelBlack = WIN_DEFAULT_BLACKPIXEL; + g_winScreens[i].pixelWhite = WIN_DEFAULT_WHITEPIXEL; + g_winScreens[i].dwLineBias = WIN_DEFAULT_LINEBIAS; + g_winScreens[i].pfb = NULL; } - winNumScreens = 1; + g_nNumScreens = 1; } -static int -winBitsPerPixel(depth) - int depth; +DWORD +winBitsPerPixel (DWORD dwDepth) { - 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; + if (dwDepth == 1) return 1; + else if (dwDepth <= 8) return 8; + else if (dwDepth <= 16) return 16; + else if (dwDepth <= 24) return 24; + else return 32; } +/* See Porting Layer Definition - p. 57 */ void ddxGiveUp() { - return ; + ErrorF ("ddxGiveUp ()\n"); + + /* Tell Windows that we want to end the app */ + PostQuitMessage (0); } +/* See Porting Layer Definition - p. 57 */ void -AbortDDX() +AbortDDX (void) { - ddxGiveUp(); + ErrorF ("AbortDDX ()\n"); + ddxGiveUp (); } void -OsVendorInit() +OsVendorInit (void) { + ErrorF ("OsVendorInit ()\n"); } +/* See Porting Layer Definition - p. 57 */ void -ddxUseMsg() +ddxUseMsg (void) { - 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"); + ErrorF ("-screen scrn WxHxD\n"\ + "\tSet screen's width, height, bit depth\n"); + ErrorF ("-pixdepths list-of-int\n"\ + "\tSupport given pixmap depths\n"); + ErrorF ("-linebias n\n"\ + "\tAdjust thin line pixelization\n"); + ErrorF ("-blackpixel n\n"\ + "\tPixel value for black\n"); + ErrorF ("-whitepixel n\n"\ + "\tPixel value for white\n"); + ErrorF ("-engine n\n"\ + "\tOverride the server's detected engine type:\n"\ + "\t\tShadow FB GDI DIB\t\t1\n"\ + "\t\tShadow FB DirectDraw\t\t2\n"\ + "\t\tShadow FB DirectDraw Nonlocking\t4\n"\ + "\t\tPrimary FB DirectDraw\t\t8\n"); + ErrorF ("-fullscreen\n" + "\tRun the specified server engine in fullscreen mode\n"); } +/* See Porting Layer Definition - p. 57 */ int -ddxProcessArgument (argc, argv, i) - int argc; - char *argv[]; - int i; +ddxProcessArgument (int argc, char *argv[], int i) { - static Bool firstTime = TRUE; + static Bool fFirstTime = TRUE; - if (firstTime) + /* Run some initialization procedures the first time through */ + if (fFirstTime) { - winInitializeDefaultScreens(); - winInitializePixmapDepths(); - firstTime = FALSE; + winInitializeDefaultScreens (); +#if 0 + winInitializePixmapDepths (); +#endif + fFirstTime = FALSE; } - if (strcmp (argv[i], "-screen") == 0) /* -screen n WxHxD */ + /* + Look for the '-screen n WxHxD' arugment + */ + if (strcmp (argv[i], "-screen") == 0) { - 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)) + int nScreenNum; + + /* Display the usage message if the argument is malformed */ + if (i + 2 >= argc) { - ErrorF("Invalid screen configuration %s\n", argv[i+2]); - UseMsg(); + UseMsg (); + return 0; } - if (screenNum >= winNumScreens) - winNumScreens = screenNum + 1; - lastScreen = screenNum; - return 3; + nScreenNum = atoi (argv[i+1]); + + if (nScreenNum < 0 || nScreenNum >= MAXSCREENS) + { + ErrorF ("Invalid screen number %d\n", nScreenNum); + UseMsg (); + return 0; + } + if (3 != sscanf (argv[i+2], "%dx%dx%d", + (int*)&g_winScreens[nScreenNum].dwWidth, + (int*)&g_winScreens[nScreenNum].dwHeight, + (int*)&g_winScreens[nScreenNum].dwDepth)) + { + ErrorF ("Invalid screen configuration %s\n", argv[i+2]); + UseMsg (); + return 0; + } + + if (nScreenNum >= g_nNumScreens) + g_nNumScreens = nScreenNum + 1; + g_nLastScreen = nScreenNum; + return 3; } - if (strcmp (argv[i], "-pixdepths") == 0) /* -pixdepths list-of-depth */ +#if 0 + /* + Look for the '-pixdepths list-of-depths' argument + */ + if (strcmp (argv[i], "-pixdepths") == 0) { - int depth, ret = 1; + int nDepth, nReturn = 1; - if (++i >= argc) UseMsg(); - while ((i < argc) && (depth = atoi(argv[i++])) != 0) + /* Display the usage message if the argument is malformed */ + if (++i >= argc) { - if (depth < 0 || depth > 32) - { - ErrorF("Invalid pixmap depth %d\n", depth); - UseMsg(); - } - winPixmapDepths[depth] = TRUE; - ret++; + UseMsg (); + return 0; } - 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; + while ((i < argc) && (nDepth = atoi (argv[i++])) != 0) + { + if (nDepth < 0 || nDepth > 32) + { + ErrorF ("Invalid pixmap depth %d\n", nDepth); + UseMsg (); + return 0; + } + g_fPixmapDepths[nDepth] = TRUE; + nReturn++; + } + return nReturn; } +#endif - if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel n */ + /* + Look for the '-blackpixel n' argument + */ + 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].whitePixel = pix; - } - } - else - { - winScreens[lastScreen].whitePixel = pix; - } - return 2; - } + Pixel pix; - if (strcmp (argv[i], "-linebias") == 0) /* -linebias n */ - { - unsigned int linebias; - if (++i >= argc) UseMsg(); - linebias = atoi(argv[i]); - if (-1 == lastScreen) + /* Display the usage message if the argument is malformed */ + if (++i >= argc) { - int i; - for (i = 0; i < MAXSCREENS; i++) - { - winScreens[i].lineBias = linebias; - } + UseMsg (); + return 0; } - else - { - winScreens[lastScreen].lineBias = linebias; - } - return 2; + + pix = atoi (argv[i]); + if (-1 == g_nLastScreen) + { + int i; + for (i = 0; i < MAXSCREENS; i++) + { + g_winScreens[i].pixelBlack = pix; + } + } + else + { + g_winScreens[g_nLastScreen].pixelBlack = pix; + } + return 2; } - if (strcmp (argv[i], "-probe") == 0) /* -linebias n */ + /* + Look for the '-whitepixel n' argument + */ + if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel 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 - + Pixel pix; -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; - } -} + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } -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; + pix = atoi (argv[i]); + if (-1 == g_nLastScreen) + { + int i; + for (i = 0; i < MAXSCREENS; i++) + { + g_winScreens[i].pixelWhite = pix; + } + } + else + { + g_winScreens[g_nLastScreen].pixelWhite = pix; + } + return 2; } - 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) + /* + Look for the '-linebias n' argument + */ + if (strcmp (argv[i], "-linebias") == 0) { - 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]; + unsigned int uiLinebias; - 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; + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; } - (*pmap->pScreen->StoreColors)(pmap, entries, defs); - DEALLOCATE_LOCAL(ppix); - DEALLOCATE_LOCAL(prgb); - DEALLOCATE_LOCAL(defs); + uiLinebias = atoi (argv[i]); + + if (-1 == g_nLastScreen) + { + int i; + + for (i = 0; i < MAXSCREENS; i++) + { + g_winScreens[i].dwLineBias = uiLinebias; + } + } + else + { + g_winScreens[g_nLastScreen].dwLineBias = uiLinebias; + } + return 2; } -} -static void -winUninstallColormap(pmap) - ColormapPtr pmap; -{ - ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum]; - - if(pmap == curpmap) + /* + Look for the '-engine n' argument + */ + if (strcmp (argv[i], "-engine") == 0) { - if (pmap->mid != pmap->pScreen->defColormap) + DWORD dwEngine = 0; + CARD8 c8OnBits = 0; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) { - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); - (*pmap->pScreen->InstallColormap)(curpmap); + UseMsg (); + return 0; } - } -} - -static void -winStoreColors(pmap, ndef, pdefs) - ColormapPtr pmap; - int ndef; - xColorItem *pdefs; -{ - int i; - if (pmap != InstalledMaps[pmap->pScreen->myNum]) return; + /* Grab the argument */ + dwEngine = atoi (argv[i]); - 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) ; -} + /* Count the one bits in the engine argument */ + c8OnBits = winCountBits (dwEngine); -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 ) + /* Argument should only have a single bit on */ + if (c8OnBits != 1) { - pwin->pfbMemory = ntux_ddx_fb; - return ntux_ddx_fb; + UseMsg (); + return 0; } - */ - 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; + /* Is this parameter attached to a screen or global? */ + if (-1 == g_nLastScreen) + { + int i; - 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; + /* Parameter is for all screens */ + for (i = 0; i < MAXSCREENS; i++) + { + g_winScreens[i].dwEnginePreferred = dwEngine; + } + } + else + { + /* Parameter is for a single screen */ + g_winScreens[g_nLastScreen].dwEnginePreferred = dwEngine; + } + + /* Indicate that we have processed the argument */ + return 2; } - 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) + /* Look for the '-fullscreen' argument */ + if (strcmp(argv[i], "-fullscreen") == 0) { - ret = mfbCreateDefColormap(pScreen); - } - else - { - ret = winCreateDefColormap(pScreen); - } - - miSetZeroLineBias(pScreen, pwin->lineBias); - - if (ret) + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_nLastScreen) { - extern winfbBlockHandler (), winfbWakeupHandler () ; + int i; - RegisterBlockAndWakeupHandlers (winfbBlockHandler, winfbWakeupHandler, NULL) ; + /* Parameter is for all screens */ + for (i = 0; i < MAXSCREENS; i++) + { + g_winScreens[i].fFullScreen = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_winScreens[g_nLastScreen].fFullScreen = TRUE; } - pwin->pScreen = pScreen ; - ErrorF ("Successful addition of Screen %p %p\n", pScreen->devPrivate, pScreen) ; - return ret; -} /* end winScreenInit */ + /* Indicate that we have processed this argument */ + return 1; + } + return 0; +} -void -InitOutput(screenInfo, argc, argv) - ScreenInfo *screenInfo; - int argc; - char **argv; +#ifdef DDXTIME /* from ServerOSDefines */ +CARD32 +GetTimeInMillis (void) { - int i; - int NumFormats = 0; - FILE *pf = stderr; + return GetTickCount (); +} +#endif +/* See Porting Layer Definition - p. 20 */ +/* We use ddxProcessArgument, so we don't need to touch argc and argv */ +void +InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) +{ + int i; +#if 0 + int iNumFormats = 0; - /* initialize pixmap formats */ + /* Initialize pixmap formats */ -/* cfbLoad() ;*/ - /* must have a pixmap depth to match every screen depth */ - for (i = 0; i < winNumScreens; i++) + /* Flag a pixmap depth for every screen depth that we have */ + for (i = 0; i < g_nNumScreens; ++i) { - winPixmapDepths[winScreens[i].depth] = TRUE; + g_fPixmapDepths[g_winScreens[i].dwDepth] = TRUE; } - for (i = 1; i <= 32; i++) + /* Loop through all possible pixmap depths */ + for (i = 1; i <= 32; ++i) { - if (winPixmapDepths[i]) + /* Create a screen info format for existing pixmap depths */ + if (g_fPixmapDepths[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; + /* Have we exceeded the number of allowed formats? */ + if (iNumFormats >= MAXFORMATS) + { + FatalError ("MAXFORMATS is too small for this server\n"); + } - /* initialize screens */ + /* Setup a screen info format */ + screenInfo->formats[iNumFormats].depth = i; + screenInfo->formats[iNumFormats].bitsPerPixel = winBitsPerPixel (i); + screenInfo->formats[iNumFormats].scanlinePad = BITMAP_SCANLINE_PAD; - for (i = 0; i < winNumScreens; i++) + /* Increment the number of formats */ + iNumFormats++; + } + } +#endif + + /* Setup global screen info parameters */ + screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; + screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + screenInfo->numPixmapFormats = NUMFORMATS; + + /* Describe how we want common pixmap formats padded */ + for (i = 0; i < NUMFORMATS; i++) + screenInfo->formats[i] = g_PixmapFormats[i]; + + /* Initialize each screen */ + for (i = 0; i < g_nNumScreens; i++) { - if (-1 == AddScreen(winScreenInit, argc, argv)) + if (-1 == AddScreen (winFinishScreenInitFB, argc, argv)) { - FatalError("Couldn't add screen %d", i); + 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 index 30b370f18..2d7674dbf 100644 --- a/xc/programs/Xserver/hw/xwin/ddraw.h +++ b/xc/programs/Xserver/hw/xwin/ddraw.h @@ -1,16 +1,22 @@ -/* $XFree86: xc/programs/Xserver/hw/xwin/ddraw.h,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/ddraw.h,v 1.2 2001/04/05 20:13:49 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 "obj_base.h" -#include "winnt.h" /* LARGE_INTEGER ... */ -#include "wingdi.h" /* PALETTE stuff ... */ -#include "wine/obj_base.h" +# ifdef UNICODE +# define WINELIB_NAME_AW(func) func##W +# else +# define WINELIB_NAME_AW(func) func##A +# endif /* UNICODE */ +#define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ #ifndef DIRECTDRAW_VERSION #define DIRECTDRAW_VERSION 0x0500 @@ -20,28 +26,35 @@ * Predeclare the interfaces */ DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); +DEFINE_GUID( CLSID_DirectDraw7, 0x3C305196,0x50DB,0x11D3,0x9C,0xFE,0x00,0xC0,0x4F,0xD9,0x30,0xC5 ); 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_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); 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_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,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 ); +DEFINE_GUID( IID_IDirectDrawGammaControl,0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E ); typedef struct IDirectDraw IDirectDraw,*LPDIRECTDRAW; typedef struct IDirectDraw2 IDirectDraw2,*LPDIRECTDRAW2; typedef struct IDirectDraw4 IDirectDraw4,*LPDIRECTDRAW4; +typedef struct IDirectDraw7 IDirectDraw7,*LPDIRECTDRAW7; 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 IDirectDrawSurface7 IDirectDrawSurface7,*LPDIRECTDRAWSURFACE7; typedef struct IDirectDrawColorControl IDirectDrawColorControl,*LPDIRECTDRAWCOLORCONTROL; +typedef struct IDirectDrawGammaControl IDirectDrawGammaControl,*LPDIRECTDRAWGAMMACONTROL; #define DDENUMRET_CANCEL 0 @@ -71,6 +84,8 @@ typedef struct IDirectDrawColorControl IDirectDrawColorControl,*LPDIRECTDRAWCOLO #define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) #define DDERR_NO3D MAKE_DDHRESULT( 170 ) #define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) +#define DDERR_NOSTEREOHARDWARE MAKE_DDHRESULT( 181 ) +#define DDERR_NOSURFACELEFT MAKE_DDHRESULT( 182 ) #define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) #define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) #define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) @@ -83,6 +98,7 @@ typedef struct IDirectDrawColorControl IDirectDrawColorControl,*LPDIRECTDRAWCOLO #define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) #define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) #define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) +#define DDERR_OVERLAPPINGRECTS MAKE_DDHRESULT( 270 ) #define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) #define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) #define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) @@ -113,8 +129,10 @@ typedef struct IDirectDrawColorControl IDirectDrawColorControl,*LPDIRECTDRAWCOLO #define DDERR_UNSUPPORTED E_NOTIMPL #define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) #define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) +#define DDERR_INVALIDSTREAM MAKE_DDHRESULT( 521 ) #define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) #define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) +#define DDERR_DDSCAPSCOMPLEXREQUIRED MAKE_DDHRESULT( 542 ) #define DDERR_XALIGN MAKE_DDHRESULT( 560 ) #define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) #define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) @@ -151,13 +169,20 @@ typedef struct IDirectDrawColorControl IDirectDrawColorControl,*LPDIRECTDRAWCOLO #define DDERR_NOOPTIMIZEHW MAKE_DDHRESULT( 600 ) #define DDERR_NOTLOADED MAKE_DDHRESULT( 601 ) #define DDERR_NOFOCUSWINDOW MAKE_DDHRESULT( 602 ) +#define DDERR_NOTONMIPMAPSUBLEVEL MAKE_DDHRESULT( 603 ) #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_EXPIRED MAKE_DDHRESULT( 691 ) +#define DDERR_TESTFINISHED MAKE_DDHRESULT( 692 ) +#define DDERR_NEWMODE MAKE_DDHRESULT( 693 ) +#define DDERR_D3DNOTINITIALIZED MAKE_DDHRESULT( 694 ) #define DDERR_VIDEONOTACTIVE MAKE_DDHRESULT( 695 ) +#define DDERR_NOMONITORINFORMATION MAKE_DDHRESULT( 696 ) +#define DDERR_NODRIVERSUPPORT MAKE_DDHRESULT( 697 ) #define DDERR_DEVICEDOESNTOWNSURFACE MAKE_DDHRESULT( 699 ) #define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED @@ -188,17 +213,22 @@ typedef struct IDirectDrawColorControl IDirectDrawColorControl,*LPDIRECTDRAWCOLO #define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000 #define DDBLT_WAIT 0x01000000 #define DDBLT_DEPTHFILL 0x02000000 +#define DDBLT_DONOTWAIT 0x08000000 /* dwTrans for BltFast */ #define DDBLTFAST_NOCOLORKEY 0x00000000 #define DDBLTFAST_SRCCOLORKEY 0x00000001 #define DDBLTFAST_DESTCOLORKEY 0x00000002 #define DDBLTFAST_WAIT 0x00000010 +#define DDBLTFAST_DONOTWAIT 0x00000020 /* dwFlags for Flip */ -#define DDFLIP_WAIT 0x00000001 -#define DDFLIP_EVEN 0x00000002 /* only valid for overlay */ -#define DDFLIP_ODD 0x00000004 /* only valid for overlay */ +#define DDFLIP_WAIT 0x00000001 +#define DDFLIP_EVEN 0x00000002 /* only valid for overlay */ +#define DDFLIP_ODD 0x00000004 /* only valid for overlay */ +#define DDFLIP_NOVSYNC 0x00000008 +#define DDFLIP_STEREO 0x00000010 +#define DDFLIP_DONOTWAIT 0x00000020 /* dwFlags for GetBltStatus */ #define DDGBS_CANBLT 0x00000001 @@ -269,9 +299,242 @@ typedef struct _DDSCAPS { DWORD dwCaps; /* capabilities of surface wanted */ } DDSCAPS,*LPDDSCAPS; +/* DDSCAPS2.dwCaps2 */ +/* indicates the surface will receive data from a video port using + deinterlacing hardware. */ +#define DDSCAPS2_HARDWAREDEINTERLACE 0x00000002 +/* indicates the surface will be locked very frequently. */ +#define DDSCAPS2_HINTDYNAMIC 0x00000004 +/* indicates surface can be re-ordered or retiled on load() */ +#define DDSCAPS2_HINTSTATIC 0x00000008 +/* indicates surface to be managed by directdraw/direct3D */ +#define DDSCAPS2_TEXTUREMANAGE 0x00000010 +/* reserved bits */ +#define DDSCAPS2_RESERVED1 0x00000020 +#define DDSCAPS2_RESERVED2 0x00000040 +/* indicates surface will never be locked again */ +#define DDSCAPS2_OPAQUE 0x00000080 +/* set at CreateSurface() time to indicate antialising will be used */ +#define DDSCAPS2_HINTANTIALIASING 0x00000100 +/* set at CreateSurface() time to indicate cubic environment map */ +#define DDSCAPS2_CUBEMAP 0x00000200 +/* face flags for cube maps */ +#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 +#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 +#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 +#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 +#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 +#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 +/* specifies all faces of a cube for CreateSurface() */ +#define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX |\ + DDSCAPS2_CUBEMAP_NEGATIVEX |\ + DDSCAPS2_CUBEMAP_POSITIVEY |\ + DDSCAPS2_CUBEMAP_NEGATIVEY |\ + DDSCAPS2_CUBEMAP_POSITIVEZ |\ + DDSCAPS2_CUBEMAP_NEGATIVEZ ) +/* set for mipmap sublevels on DirectX7 and later. ignored by CreateSurface() */ +#define DDSCAPS2_MIPMAPSUBLEVEL 0x00010000 +/* indicates texture surface to be managed by Direct3D *only* */ +#define DDSCAPS2_D3DTEXTUREMANAGE 0x00020000 +/* indicates managed surface that can safely be lost */ +#define DDSCAPS2_DONOTPERSIST 0x00040000 +/* indicates surface is part of a stereo flipping chain */ +#define DDSCAPS2_STEREOSURFACELEFT 0x00080000 + +typedef struct _DDSCAPS2 { + DWORD dwCaps; /* capabilities of surface wanted */ + DWORD dwCaps2; /* additional capabilities */ + DWORD dwCaps3; /* reserved capabilities */ + DWORD dwCaps4; /* more reserved capabilities */ +} DDSCAPS2,*LPDDSCAPS2; + #define DD_ROP_SPACE (256/32) /* space required to store ROP array */ -typedef struct _DDCAPS_DX3 +typedef struct _DDCAPS_DX7 /* DirectX 7 version of caps struct */ +{ + 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 ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */ + 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 dwMaxVideoPorts; /* maximum number of usable video ports */ + DWORD dwCurrVideoPorts; /* current number of video ports used */ + DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ + DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ + DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ + DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ + DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ + DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ + DDSCAPS2 ddsCaps; /* surface capabilities */ +} DDCAPS_DX7,*LPDDCAPS_DX7; + +typedef struct _DDCAPS_DX6 /* DirectX 6 version of caps struct */ +{ + 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 ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */ + 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 dwMaxVideoPorts; /* maximum number of usable video ports */ + DWORD dwCurrVideoPorts; /* current number of video ports used */ + DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ + DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ + DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ + DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ + DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ + DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ + /* and one new member for DirectX 6 */ + DDSCAPS2 ddsCaps; /* surface capabilities */ +} DDCAPS_DX6,*LPDDCAPS_DX6; + +typedef struct _DDCAPS_DX5 /* DirectX5 version of caps struct */ +{ + 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 */ + /* the following are the new DirectX 5 members */ + DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ + DWORD dwCurrVideoPorts; /* current number of video ports used */ + DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ + DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ + DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ + DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ + DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ + DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ +} DDCAPS_DX5,*LPDDCAPS_DX5; + +typedef struct _DDCAPS_DX3 /* DirectX3 version of caps struct */ { DWORD dwSize; /* size of the DDDRIVERCAPS structure */ DWORD dwCaps; /* driver specific capabilities */ @@ -326,72 +589,19 @@ typedef struct _DDCAPS_DX3 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; +/* set caps struct according to DIRECTDRAW_VERSION */ + +#if DIRECTDRAW_VERSION <= 0x300 +typedef DDCAPS_DX3 DDCAPS; +#elif DIRECTDRAW_VERSION <= 0x500 +typedef DDCAPS_DX5 DDCAPS; +#elif DIRECTDRAW_VERSION <= 0x600 +typedef DDCAPS_DX6 DDCAPS; +#else +typedef DDCAPS_DX7 DDCAPS; +#endif +typedef DDCAPS *LPDDCAPS; /* DDCAPS.dwCaps */ #define DDCAPS_3D 0x00000001 @@ -443,6 +653,16 @@ typedef struct _DDCAPS #define DDCAPS2_WIDESURFACES 0x00001000 #define DDCAPS2_CANFLIPODDEVEN 0x00002000 #define DDCAPS2_CANBOBHARDWARE 0x00004000 +#define DDCAPS2_COPYFOURCC 0x00008000 +#define DDCAPS2_PRIMARYGAMMA 0x00020000 +#define DDCAPS2_CANRENDERWINDOWED 0x00080000 +#define DDCAPS2_CANCALIBRATEGAMMA 0x00100000 +#define DDCAPS2_FLIPINTERVAL 0x00200000 +#define DDCAPS2_FLIPNOVSYNC 0x00400000 +#define DDCAPS2_CANMANAGETEXTURE 0x00800000 +#define DDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000 +#define DDCAPS2_STEREO 0x02000000 +#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000 /* Set/Get Colour Key Flags */ @@ -492,31 +712,33 @@ typedef struct _DDPIXELFORMAT { 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; + } DUMMYUNIONNAME; union { DWORD dwRBitMask; /* 10: mask for red bit*/ DWORD dwYBitMask; /* 10: mask for Y bits*/ - } y; + } DUMMYUNIONNAME2; union { DWORD dwGBitMask; /* 14: mask for green bits*/ DWORD dwUBitMask; /* 14: mask for U bits*/ - } z; + } DUMMYUNIONNAME3; union { DWORD dwBBitMask; /* 18: mask for blue bits*/ DWORD dwVBitMask; /* 18: mask for V bits*/ - } xx; + } DUMMYUNIONNAME4; 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; + } DUMMYUNIONNAME5; /* 20: next structure */ } DDPIXELFORMAT,*LPDDPIXELFORMAT; /* DDCAPS.dwFXCaps */ -#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020 +#define DDFXCAPS_BLTALPHA 0x00000001 +#define DDFXCAPS_OVERLAYALPHA 0x00000004 #define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010 +#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020 #define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040 #define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080 #define DDFXCAPS_BLTROTATION 0x00000100 @@ -542,6 +764,8 @@ typedef struct _DDPIXELFORMAT { #define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000 #define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000 +#define DDFXCAPS_OVERLAYFILTER DDFXCAPS_OVERLAYARITHSTRETCHY + /* DDCAPS.dwFXAlphaCaps */ #define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001 #define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002 @@ -568,10 +792,19 @@ typedef struct _DDPIXELFORMAT { #define DDPCAPS_ALPHA 0x00000400 /* DDCAPS.dwSVCaps */ -#define DDSVCAPS_ENIGMA 0x00000001l -#define DDSVCAPS_FLICKER 0x00000002l -#define DDSVCAPS_REDBLUE 0x00000004l -#define DDSVCAPS_SPLIT 0x00000008l +/* the first 4 of these are now obsolete */ +#if DIRECTDRAW_VERSION >= 0x700 /* FIXME: I'm not sure when this switch occured */ +#define DDSVCAPS_RESERVED1 0x00000001 +#define DDSVCAPS_RESERVED2 0x00000002 +#define DDSVCAPS_RESERVED3 0x00000004 +#define DDSVCAPS_RESERVED4 0x00000008 +#else +#define DDSVCAPS_ENIGMA 0x00000001 +#define DDSVCAPS_FLICKER 0x00000002 +#define DDSVCAPS_REDBLUE 0x00000004 +#define DDSVCAPS_SPLIT 0x00000008 +#endif +#define DDSVCAPS_STEREOSEQUENTIAL 0x00000010 /* BitDepths */ #define DDBD_1 0x00004000 @@ -587,6 +820,31 @@ typedef struct _DDPIXELFORMAT { #define DDOVERFX_MIRRORLEFTRIGHT 0x00000002 #define DDOVERFX_MIRRORUPDOWN 0x00000004 +/* UpdateOverlay flags */ +#define DDOVER_ALPHADEST 0x00000001 +#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002 +#define DDOVER_ALPHADESTNEG 0x00000004 +#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008 +#define DDOVER_ALPHAEDGEBLEND 0x00000010 +#define DDOVER_ALPHASRC 0x00000020 +#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040 +#define DDOVER_ALPHASRCNEG 0x00000080 +#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100 +#define DDOVER_HIDE 0x00000200 +#define DDOVER_KEYDEST 0x00000400 +#define DDOVER_KEYDESTOVERRIDE 0x00000800 +#define DDOVER_KEYSRC 0x00001000 +#define DDOVER_KEYSRCOVERRIDE 0x00002000 +#define DDOVER_SHOW 0x00004000 +#define DDOVER_ADDDIRTYRECT 0x00008000 +#define DDOVER_REFRESHDIRTYRECTS 0x00010000 +#define DDOVER_REFRESHALL 0x00020000 +#define DDOVER_DDFX 0x00080000 +#define DDOVER_AUTOFLIP 0x00100000 +#define DDOVER_BOB 0x00200000 +#define DDOVER_OVERRIDEBOBWEAVE 0x00400000 +#define DDOVER_INTERLEAVED 0x00800000 + /* DDCOLORKEY.dwFlags */ #define DDPF_ALPHAPIXELS 0x00000001 #define DDPF_ALPHA 0x00000002 @@ -602,6 +860,11 @@ typedef struct _DDPIXELFORMAT { #define DDPF_PALETTEINDEXED1 0x00000800 #define DDPF_PALETTEINDEXED2 0x00001000 #define DDPF_ZPIXELS 0x00002000 +#define DDPF_STENCILBUFFER 0x00004000 +#define DDPF_ALPHAPREMULT 0x00008000 +#define DDPF_LUMINANCE 0x00020000 +#define DDPF_BUMPLUMINANCE 0x00040000 +#define DDPF_BUMPDUDV 0x00080000 /* SetCooperativeLevel dwFlags */ #define DDSCL_FULLSCREEN 0x00000001 @@ -613,6 +876,9 @@ typedef struct _DDPIXELFORMAT { #define DDSCL_SETFOCUSWINDOW 0x00000080 #define DDSCL_SETDEVICEWINDOW 0x00000100 #define DDSCL_CREATEDEVICEWINDOW 0x00000200 +#define DDSCL_MULTITHREADED 0x00000400 +#define DDSCL_FPUSETUP 0x00000800 +#define DDSCL_FPUPRESERVE 0x00001000 /* DDSURFACEDESC.dwFlags */ @@ -632,7 +898,10 @@ typedef struct _DDPIXELFORMAT { #define DDSD_MIPMAPCOUNT 0x00020000 #define DDSD_REFRESHRATE 0x00040000 #define DDSD_LINEARSIZE 0x00080000 -#define DDSD_ALL 0x000ff9ee +#define DDSD_TEXTURESTAGE 0x00100000 +#define DDSD_FVF 0x00200000 +#define DDSD_SRCVBHANDLE 0x00400000 +#define DDSD_ALL 0x007ff9ee /* EnumSurfaces flags */ #define DDENUMSURFACES_ALL 0x00000001 @@ -648,26 +917,32 @@ typedef struct _DDPIXELFORMAT { #define DDEDM_REFRESHRATES 0x00000001 #define DDEDM_STANDARDVGAMODES 0x00000002 +/* WaitForVerticalDisplay flags */ + +#define DDWAITVB_BLOCKBEGIN 0x00000001 +#define DDWAITVB_BLOCKBEGINEVENT 0x00000002 +#define DDWAITVB_BLOCKEND 0x00000004 +#if 0 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*/ + 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; + } DUMMYUNIONNAME; 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; + union { + DWORD dwLinearSize; + LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ + } DUMMYUNIONNAME2; DDCOLORKEY ddckCKDestOverlay;/* 28: CK for dest overlay use*/ DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/ DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/ @@ -675,6 +950,66 @@ typedef struct _DDSURFACEDESC DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/ DDSCAPS ddsCaps; /* 68: direct draw surface caps */ } DDSURFACEDESC,*LPDDSURFACEDESC; +#endif + +typedef struct _DDSURFACEDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwHeight; + DWORD dwWidth; + union + { + LONG lPitch; + DWORD dwLinearSize; + } DUMMYUNIONNAME; + DWORD dwBackBufferCount; + union + { + DWORD dwMipMapCount; + DWORD dwZBufferBitDepth; + DWORD dwRefreshRate; + } DUMMYUNIONNAME2; + DWORD dwAlphaBitDepth; + DWORD dwReserved; + LPVOID lpSurface; + DDCOLORKEY ddckCKDestOverlay; + DDCOLORKEY ddckCKDestBlt; + DDCOLORKEY ddckCKSrcOverlay; + DDCOLORKEY ddckCKSrcBlt; + DDPIXELFORMAT ddpfPixelFormat; + DDSCAPS ddsCaps; +} DDSURFACEDESC, FAR* LPDDSURFACEDESC; + +typedef struct _DDSURFACEDESC2 +{ + 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*/ + union { + LONG lPitch; /*10: distance to start of next line (return value only)*/ + DWORD dwLinearSize; /*10: formless late-allocated optimized surface size */ + } DUMMYUNIONNAME; + DWORD dwBackBufferCount;/* 14: number of back buffers requested*/ + union { + DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/ + DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/ + } DUMMYUNIONNAME2; + DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/ + DWORD dwReserved; /* 20:reserved*/ + LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ + union { + DDCOLORKEY ddckCKDestOverlay; /* 28: CK for dest overlay use*/ + DWORD dwEmptyFaceColor; /* 28: color for empty cubemap faces */ + } DUMMYUNIONNAME3; + DDCOLORKEY ddckCKDestBlt; /* 2C: CK for destination blt use*/ + DDCOLORKEY ddckCKSrcOverlay;/* 30: CK for source overlay use*/ + DDCOLORKEY ddckCKSrcBlt; /* 34: CK for source blt use*/ + DDPIXELFORMAT ddpfPixelFormat;/* 38: pixel format description of the surface*/ + DDSCAPS2 ddsCaps; /* 3C: DDraw surface caps */ + DWORD dwTextureStage; /* 40: stage in multitexture cascade */ +} DDSURFACEDESC2,*LPDDSURFACEDESC2; /* DDCOLORCONTROL.dwFlags */ #define DDCOLOR_BRIGHTNESS 0x00000001 @@ -698,19 +1033,22 @@ typedef struct { DWORD dwReserved1; } DDCOLORCONTROL,*LPDDCOLORCONTROL; -typedef BOOL (CALLBACK * LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID); -typedef BOOL (CALLBACK * LPDDENUMCALLBACKW)(GUID *, LPWSTR, LPWSTR, LPVOID); +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 HRESULT CALLBACK (*LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMMODESCALLBACK7)(LPDDSURFACEDESC2, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK7)(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); -typedef BOOL (CALLBACK * LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); -typedef BOOL (CALLBACK * LPDDENUMCALLBACKEXW)(GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR); +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); +#define DirectDrawEnumerateEx WINELIB_NAME_AW(DirectDrawEnumerateEx) /* flags for DirectDrawEnumerateEx */ #define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001 @@ -733,13 +1071,13 @@ typedef struct _DDBLTFX { DWORD dwZDestConst; /* Constant to use as Z buffer for dest */ LPDIRECTDRAWSURFACE lpDDSZBufferDest; /* Surface to use as Z buffer for dest */ - } x; + } DUMMYUNIONNAME; 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; + } DUMMYUNIONNAME2; DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */ DWORD dwReserved; @@ -748,20 +1086,20 @@ typedef struct _DDBLTFX { DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as Alpha Channel */ - } z; + } DUMMYUNIONNAME3; 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; + } DUMMYUNIONNAME4; 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; + } DUMMYUNIONNAME5; DDCOLORKEY ddckDestColorkey; /* DestColorkey override */ DDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */ } DDBLTFX,*LPDDBLTFX; @@ -797,13 +1135,13 @@ typedef struct _DDOVERLAYFX { DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as alpha channel for dest */ - } x; + } DUMMYUNIONNAME; 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; + } DUMMYUNIONNAME2; DDCOLORKEY dckDestColorkey; /* DestColorkey override */ DDCOLORKEY dckSrcColorkey; /* DestColorkey override */ DWORD dwDDFX; /* Overlay FX */ @@ -832,6 +1170,17 @@ typedef struct tagDDDEVICEIDENTIFIER { GUID guidDeviceIdentifier; } DDDEVICEIDENTIFIER, * LPDDDEVICEIDENTIFIER; +typedef struct tagDDDEVICEIDENTIFIER2 { + char szDriver[MAX_DDDEVICEID_STRING]; /* user readable driver name */ + char szDescription[MAX_DDDEVICEID_STRING]; /* user readable description */ + LARGE_INTEGER liDriverVersion; /* driver version */ + DWORD dwVendorId; /* vendor ID, zero if unknown */ + DWORD dwDeviceId; /* chipset ID, zero if unknown */ + DWORD dwSubSysId; /* board ID, zero if unknown */ + DWORD dwRevision; /* chipset version, zero if unknown */ + GUID guidDeviceIdentifier; /* unique ID for this driver/chipset combination */ + DWORD dwWHQLLevel; /* Windows Hardware Quality Lab certification level */ +} DDDEVICEIDENTIFIER2, * LPDDDEVICEIDENTIFIER2; /***************************************************************************** * IDirectDrawPalette interface @@ -848,7 +1197,6 @@ typedef struct tagDDDEVICEIDENTIFIER { 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) @@ -858,7 +1206,6 @@ ICOM_DEFINE(IDirectDrawPalette,IUnknown) #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 /***************************************************************************** @@ -878,7 +1225,6 @@ ICOM_DEFINE(IDirectDrawPalette,IUnknown) 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) @@ -890,7 +1236,6 @@ ICOM_DEFINE(IDirectDrawClipper,IUnknown) #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 /***************************************************************************** @@ -924,7 +1269,6 @@ ICOM_DEFINE(IDirectDrawClipper,IUnknown) 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) @@ -950,7 +1294,6 @@ ICOM_DEFINE(IDirectDraw,IUnknown) #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() */ @@ -970,35 +1313,34 @@ ICOM_DEFINE(IDirectDraw,IUnknown) */ #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) +/*0c*/ ICOM_METHOD (HRESULT,Compact) \ +/*10*/ ICOM_METHOD3(HRESULT,CreateClipper, DWORD,dwFlags, LPDIRECTDRAWCLIPPER*,lplpDDClipper, IUnknown*,pUnkOuter) \ +/*14*/ ICOM_METHOD4(HRESULT,CreatePalette, DWORD,dwFlags, LPPALETTEENTRY,lpColorTable, LPDIRECTDRAWPALETTE*,lplpDDPalette, IUnknown*,pUnkOuter) \ +/*18*/ ICOM_METHOD3(HRESULT,CreateSurface, LPDDSURFACEDESC,lpDDSurfaceDesc, LPDIRECTDRAWSURFACE*,lplpDDSurface, IUnknown*,pUnkOuter) \ +/*1c*/ ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE,lpDDSurface, LPDIRECTDRAWSURFACE*,lplpDupDDSurface) \ +/*20*/ ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK,lpEnumModesCallback) \ +/*24*/ ICOM_METHOD4(HRESULT,EnumSurfaces, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSD, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ +/*28*/ ICOM_METHOD (HRESULT,FlipToGDISurface) \ +/*2c*/ ICOM_METHOD2(HRESULT,GetCaps, LPDDCAPS,lpDDDriverCaps, LPDDCAPS,lpDDHELCaps) \ +/*30*/ ICOM_METHOD1(HRESULT,GetDisplayMode, LPDDSURFACEDESC,lpDDSurfaceDesc) \ +/*34*/ ICOM_METHOD2(HRESULT,GetFourCCCodes, LPDWORD,lpNumCodes, LPDWORD,lpCodes) \ +/*38*/ ICOM_METHOD1(HRESULT,GetGDISurface, LPDIRECTDRAWSURFACE*,lplpGDIDDSurface) \ +/*3c*/ ICOM_METHOD1(HRESULT,GetMonitorFrequency, LPDWORD,lpdwFrequency) \ +/*40*/ ICOM_METHOD1(HRESULT,GetScanLine, LPDWORD,lpdwScanLine) \ +/*44*/ ICOM_METHOD1(HRESULT,GetVerticalBlankStatus, BOOL*,lpbIsInVB) \ +/*48*/ ICOM_METHOD1(HRESULT,Initialize, GUID*,lpGUID) \ +/*4c*/ ICOM_METHOD (HRESULT,RestoreDisplayMode) \ +/*50*/ ICOM_METHOD2(HRESULT,SetCooperativeLevel, HWND,hWnd, DWORD,dwFlags) \ +/*54*/ ICOM_METHOD5(HRESULT,SetDisplayMode, DWORD,dwWidth, DWORD,dwHeight, DWORD,dwBPP, DWORD,dwRefreshRate, DWORD,dwFlags) \ +/*58*/ ICOM_METHOD2(HRESULT,WaitForVerticalBlank, DWORD,dwFlags, HANDLE,hEvent) \ + /* added in v2 */ \ +/*5c*/ 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) @@ -1026,7 +1368,6 @@ ICOM_DEFINE(IDirectDraw2,IUnknown) #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 /***************************************************************************** @@ -1044,7 +1385,6 @@ ICOM_DEFINE(IDirectDraw2,IUnknown) 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) @@ -1068,7 +1408,7 @@ ICOM_DEFINE(IDirectDraw4,IDirectDraw2) #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_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL5(SetDisplayMode,p,a,b,c,d,e) #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) @@ -1077,7 +1417,87 @@ ICOM_DEFINE(IDirectDraw4,IDirectDraw2) #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 + + +/***************************************************************************** + * IDirectDraw7 interface + */ +/* Note: IDirectDraw7 cannot derive from IDirectDraw4; it is even documented + * as not interchangeable with earlier DirectDraw interfaces. + */ +#define ICOM_INTERFACE IDirectDraw7 +#define IDirectDraw7_METHODS \ +/*0c*/ ICOM_METHOD (HRESULT,Compact) \ +/*10*/ ICOM_METHOD3(HRESULT,CreateClipper, DWORD,dwFlags, LPDIRECTDRAWCLIPPER*,lplpDDClipper, IUnknown*,pUnkOuter) \ +/*14*/ ICOM_METHOD4(HRESULT,CreatePalette, DWORD,dwFlags, LPPALETTEENTRY,lpColorTable, LPDIRECTDRAWPALETTE*,lplpDDPalette, IUnknown*,pUnkOuter) \ +/*18*/ ICOM_METHOD3(HRESULT,CreateSurface, LPDDSURFACEDESC2,lpDDSurfaceDesc, LPDIRECTDRAWSURFACE7*,lplpDDSurface, IUnknown*,pUnkOuter) \ +/*1c*/ ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE7,lpDDSurface, LPDIRECTDRAWSURFACE7*,lplpDupDDSurface) \ +/*20*/ ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC2,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK7,lpEnumModesCallback) \ +/*24*/ ICOM_METHOD4(HRESULT,EnumSurfaces, DWORD,dwFlags, LPDDSURFACEDESC2,lpDDSD, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK7,lpEnumSurfacesCallback) \ +/*28*/ ICOM_METHOD (HRESULT,FlipToGDISurface) \ +/*2c*/ ICOM_METHOD2(HRESULT,GetCaps, LPDDCAPS,lpDDDriverCaps, LPDDCAPS,lpDDHELCaps) \ +/*30*/ ICOM_METHOD1(HRESULT,GetDisplayMode, LPDDSURFACEDESC2,lpDDSurfaceDesc) \ +/*34*/ ICOM_METHOD2(HRESULT,GetFourCCCodes, LPDWORD,lpNumCodes, LPDWORD,lpCodes) \ +/*38*/ ICOM_METHOD1(HRESULT,GetGDISurface, LPDIRECTDRAWSURFACE7*,lplpGDIDDSurface) \ +/*3c*/ ICOM_METHOD1(HRESULT,GetMonitorFrequency, LPDWORD,lpdwFrequency) \ +/*40*/ ICOM_METHOD1(HRESULT,GetScanLine, LPDWORD,lpdwScanLine) \ +/*44*/ ICOM_METHOD1(HRESULT,GetVerticalBlankStatus, BOOL*,lpbIsInVB) \ +/*48*/ ICOM_METHOD1(HRESULT,Initialize, GUID*,lpGUID) \ +/*4c*/ ICOM_METHOD (HRESULT,RestoreDisplayMode) \ +/*50*/ ICOM_METHOD2(HRESULT,SetCooperativeLevel, HWND,hWnd, DWORD,dwFlags) \ +/*54*/ ICOM_METHOD5(HRESULT,SetDisplayMode, DWORD,dwWidth, DWORD,dwHeight, DWORD,dwBPP, DWORD,dwRefreshRate, DWORD,dwFlags) \ +/*58*/ ICOM_METHOD2(HRESULT,WaitForVerticalBlank, DWORD,dwFlags, HANDLE,hEvent) \ + /* added in v2 */ \ +/*5c*/ ICOM_METHOD3(HRESULT,GetAvailableVidMem, LPDDSCAPS2,lpDDCaps, LPDWORD,lpdwTotal, LPDWORD,lpdwFree) \ + /* added in v4 */ \ +/*60*/ ICOM_METHOD2(HRESULT,GetSurfaceFromDC, HDC,, LPDIRECTDRAWSURFACE7*,) \ +/*64*/ ICOM_METHOD (HRESULT,RestoreAllSurfaces) \ +/*68*/ ICOM_METHOD (HRESULT,TestCooperativeLevel) \ +/*6c*/ ICOM_METHOD2(HRESULT,GetDeviceIdentifier, LPDDDEVICEIDENTIFIER,, DWORD,) \ + /* added in v7 */ \ +/*70*/ ICOM_METHOD3(HRESULT,StartModeTest, LPSIZE,, DWORD,, DWORD,) \ +/*74*/ ICOM_METHOD2(HRESULT,EvaluateMode, DWORD,, DWORD *,) +#define IDirectDraw7_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDraw7_METHODS +ICOM_DEFINE(IDirectDraw7,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IDirectDraw7_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDraw7_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDraw7_Release(p) ICOM_CALL (Release,p) + /*** IDirectDraw methods ***/ +#define IDirectDraw7_Compact(p) ICOM_CALL (Compact,p) +#define IDirectDraw7_CreateClipper(p,a,b,c) ICOM_CALL3(CreateClipper,p,a,b,c) +#define IDirectDraw7_CreatePalette(p,a,b,c,d) ICOM_CALL4(CreatePalette,p,a,b,c,d) +#define IDirectDraw7_CreateSurface(p,a,b,c) ICOM_CALL3(CreateSurface,p,a,b,c) +#define IDirectDraw7_DuplicateSurface(p,a,b) ICOM_CALL2(DuplicateSurface,p,a,b) +#define IDirectDraw7_EnumDisplayModes(p,a,b,c,d) ICOM_CALL4(EnumDisplayModes,p,a,b,c,d) +#define IDirectDraw7_EnumSurfaces(p,a,b,c,d) ICOM_CALL4(EnumSurfaces,p,a,b,c,d) +#define IDirectDraw7_FlipToGDISurface(p) ICOM_CALL (FlipToGDISurface,p) +#define IDirectDraw7_GetCaps(p,a,b) ICOM_CALL2(GetCaps,p,a,b) +#define IDirectDraw7_GetDisplayMode(p,a) ICOM_CALL1(GetDisplayMode,p,a) +#define IDirectDraw7_GetFourCCCodes(p,a,b) ICOM_CALL2(GetFourCCCodes,p,a,b) +#define IDirectDraw7_GetGDISurface(p,a) ICOM_CALL1(GetGDISurface,p,a) +#define IDirectDraw7_GetMonitorFrequency(p,a) ICOM_CALL1(GetMonitorFrequency,p,a) +#define IDirectDraw7_GetScanLine(p,a) ICOM_CALL1(GetScanLine,p,a) +#define IDirectDraw7_GetVerticalBlankStatus(p,a) ICOM_CALL1(GetVerticalBlankStatus,p,a) +#define IDirectDraw7_Initialize(p,a) ICOM_CALL1(Initialize,p,a) +#define IDirectDraw7_RestoreDisplayMode(p) ICOM_CALL (RestoreDisplayMode,p) +#define IDirectDraw7_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b) +#define IDirectDraw7_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL5(SetDisplayMode,p,a,b,c,d,e) +#define IDirectDraw7_WaitForVerticalBlank(p,a,b) ICOM_CALL2(WaitForVerticalBlank,p,a,b) +/*** added in IDirectDraw2 ***/ +#define IDirectDraw7_GetAvailableVidMem(p,a,b,c) ICOM_CALL3(GetAvailableVidMem,p,a,b,c) +/*** added in IDirectDraw4 ***/ +#define IDirectDraw7_GetSurfaceFromDC(p,a,b) ICOM_CALL2(GetSurfaceFromDC,p,a,b,c) +#define IDirectDraw7_RestoreAllSurfaces(pc) ICOM_CALL (RestoreAllSurfaces,p) +#define IDirectDraw7_TestCooperativeLevel(p) ICOM_CALL (TestCooperativeLevel,p) +#define IDirectDraw7_GetDeviceIdentifier(p,a,b) ICOM_CALL2(GetDeviceIdentifier,p,a,b) +/*** added in IDirectDraw 7 ***/ +#define IDirectDraw7_StartModeTest(p,a,b,c) ICOM_CALL3(StartModeTest,p,a,b,c) +#define IDirectDraw7_EvaluateMode(p,a,b) ICOM_CALL2(EvaluateMode,p,a,b) /***************************************************************************** @@ -1085,46 +1505,45 @@ ICOM_DEFINE(IDirectDraw4,IDirectDraw2) */ #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) +/*0c*/ ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE,lpDDSAttachedSurface) \ +/*10*/ ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ +/*14*/ ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwFlags, LPDDBLTFX,lpDDBltFx) \ +/*18*/ ICOM_METHOD3(HRESULT,BltBatch, LPDDBLTBATCH,lpDDBltBatch, DWORD,dwCount, DWORD,dwFlags) \ +/*1c*/ ICOM_METHOD5(HRESULT,BltFast, DWORD,dwX, DWORD,dwY, LPDIRECTDRAWSURFACE,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ +/*20*/ ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE,lpDDSAttachedSurface) \ +/*24*/ ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ +/*28*/ ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ +/*2c*/ ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ +/*30*/ ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS,lpDDSCaps, LPDIRECTDRAWSURFACE*,lplpDDAttachedSurface) \ +/*34*/ ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ +/*38*/ ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS,lpDDSCaps) \ +/*3c*/ ICOM_METHOD1(HRESULT,GetClipper, LPDIRECTDRAWCLIPPER*,lplpDDClipper) \ +/*40*/ ICOM_METHOD2(HRESULT,GetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ +/*44*/ ICOM_METHOD1(HRESULT,GetDC, HDC*,lphDC) \ +/*48*/ ICOM_METHOD1(HRESULT,GetFlipStatus, DWORD,dwFlags) \ +/*4c*/ ICOM_METHOD2(HRESULT,GetOverlayPosition, LPLONG,lplX, LPLONG,lplY) \ +/*50*/ ICOM_METHOD1(HRESULT,GetPalette, LPDIRECTDRAWPALETTE*,lplpDDPalette) \ +/*54*/ ICOM_METHOD1(HRESULT,GetPixelFormat, LPDDPIXELFORMAT,lpDDPixelFormat) \ +/*58*/ ICOM_METHOD1(HRESULT,GetSurfaceDesc, LPDDSURFACEDESC,lpDDSurfaceDesc) \ +/*5c*/ ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC,lpDDSurfaceDesc) \ +/*60*/ ICOM_METHOD (HRESULT,IsLost) \ +/*64*/ ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC,lpDDSurfaceDesc, DWORD,dwFlags, HANDLE,hEvent) \ +/*68*/ ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ +/*6c*/ ICOM_METHOD (HRESULT,Restore) \ +/*70*/ ICOM_METHOD1(HRESULT,SetClipper, LPDIRECTDRAWCLIPPER,lpDDClipper) \ +/*74*/ ICOM_METHOD2(HRESULT,SetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ +/*78*/ ICOM_METHOD2(HRESULT,SetOverlayPosition, LONG,lX, LONG,lY) \ +/*7c*/ ICOM_METHOD1(HRESULT,SetPalette, LPDIRECTDRAWPALETTE,lpDDPalette) \ +/*80*/ ICOM_METHOD1(HRESULT,Unlock, LPVOID,lpSurfaceData) \ +/*84*/ ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ +/*88*/ ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ +/*8c*/ 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) @@ -1154,8 +1573,8 @@ ICOM_DEFINE(IDirectDrawSurface,IUnknown) #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_Restore(p) ICOM_CALL (Restore,p) +#define IDirectDrawSurface_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) #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) @@ -1163,7 +1582,6 @@ ICOM_DEFINE(IDirectDrawSurface,IUnknown) #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 /***************************************************************************** @@ -1217,7 +1635,6 @@ ICOM_DEFINE(IDirectDrawSurface,IUnknown) 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) @@ -1248,7 +1665,7 @@ ICOM_DEFINE(IDirectDrawSurface2,IUnknown) #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_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) #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) @@ -1260,7 +1677,6 @@ ICOM_DEFINE(IDirectDrawSurface2,IUnknown) #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 /***************************************************************************** @@ -1316,7 +1732,6 @@ ICOM_DEFINE(IDirectDrawSurface2,IUnknown) 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) @@ -1347,7 +1762,7 @@ ICOM_DEFINE(IDirectDrawSurface3,IUnknown) #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_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) #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) @@ -1361,7 +1776,6 @@ ICOM_DEFINE(IDirectDrawSurface3,IUnknown) #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 /***************************************************************************** @@ -1427,7 +1841,6 @@ ICOM_DEFINE(IDirectDrawSurface3,IUnknown) 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) @@ -1458,7 +1871,7 @@ ICOM_DEFINE(IDirectDrawSurface4,IUnknown) #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_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) #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) @@ -1478,7 +1891,68 @@ ICOM_DEFINE(IDirectDrawSurface4,IUnknown) #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 + + +/***************************************************************************** + * IDirectDrawSurface7 interface + */ +#define ICOM_INTERFACE IDirectDrawSurface7 +#define IDirectDrawSurface7_METHODS \ + ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE7,lpDDSAttachedSurface) \ + ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ + ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE7,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, LPDIRECTDRAWSURFACE7,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ + ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE7,lpDDSAttachedSurface) \ + ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ + ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ + ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE7,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS2,lpDDSCaps, LPDIRECTDRAWSURFACE7*,lplpDDAttachedSurface) \ + ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS2,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, LPDDSURFACEDESC2,lpDDSurfaceDesc) \ + ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC2,lpDDSurfaceDesc) \ + ICOM_METHOD (HRESULT,IsLost) \ + ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC2,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, LPDIRECTDRAWSURFACE7,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ + ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE7,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, LPDDSURFACEDESC2,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) \ + /* added in v7 */ \ + ICOM_METHOD1(HRESULT,SetPriority, DWORD,prio) \ + ICOM_METHOD1(HRESULT,GetPriority, LPDWORD,prio) \ + ICOM_METHOD1(HRESULT,SetLOD, DWORD,lod) \ + ICOM_METHOD1(HRESULT,GetLOD, LPDWORD,lod) +#define IDirectDrawSurface7_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawSurface7_METHODS +ICOM_DEFINE(IDirectDrawSurface7,IUnknown) +#undef ICOM_INTERFACE /***************************************************************************** @@ -1494,7 +1968,6 @@ ICOM_DEFINE(IDirectDrawSurface4,IUnknown) 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) @@ -1502,13 +1975,17 @@ ICOM_DEFINE(IDirectDrawColorControl,IUnknown) /*** 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 DirectDrawCreateEx(LPGUID,LPVOID*,REFIID,LPUNKNOWN); HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA,LPVOID); HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW,LPVOID); #define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate) HRESULT WINAPI DirectDrawCreateClipper(DWORD,LPDIRECTDRAWCLIPPER*,LPUNKNOWN); +#ifdef __cplusplus +} /* extern "C" */ +#endif /* defined(__cplusplus) */ + #endif /* __WINE_DDRAW_H */ diff --git a/xc/programs/Xserver/hw/xwin/obj_base.h b/xc/programs/Xserver/hw/xwin/obj_base.h new file mode 100644 index 000000000..178c7502b --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/obj_base.h @@ -0,0 +1,781 @@ +/* $XFree86: xc/programs/Xserver/hw/xwin/obj_base.h,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* + * This file defines the macros and types necessary to define COM interfaces, + * and the three most basic COM interfaces: IUnknown, IMalloc and IClassFactory. + */ + +#ifndef __WINE_WINE_OBJ_BASE_H +#define __WINE_WINE_OBJ_BASE_H + +/***************************************************************************** + * define ICOM_MSVTABLE_COMPAT + * to implement the microsoft com vtable compatibility workaround for g++. + * + * NOTE: Turning this option on will produce a winelib that is incompatible + * with the binary emulator. + * + * If the compiler supports the com_interface attribute, leave this off, and + * define the ICOM_USE_COM_INTERFACE_ATTRIBUTE macro below. This may also + * require the addition of the -vtable-thunks option for g++. + * + * If you aren't interested in WineLib C++ compatability at all, leave both + * options off. + * + * The preferable method for using ICOM_USE_COM_INTERFACE_ATTRIBUTE macro + * would be to define it only for your WineLib application. This allows you + * to have both binary and WineLib compatibility for C and C++ at the same + * time :) + */ +/* #define ICOM_MSVTABLE_COMPAT 1 */ +/* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */ + +/***************************************************************************** + * Defines the basic types + */ +#include <wtypes.h> +/*#include "guiddef.h"*/ + +typedef CHAR OLECHAR16; +typedef LPSTR LPOLESTR16; +typedef LPCSTR LPCOLESTR16; +typedef OLECHAR16 *BSTR16; +typedef BSTR16 *LPBSTR16; +#define OLESTR16(x) x + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NONAMELESSSTRUCT +#define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v)) +#define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v)) +#else +#define LISet32(li, v) ((li).s.HighPart = (v) < 0 ? -1 : 0, (li).s.LowPart = (v)) +#define ULISet32(li, v) ((li).s.HighPart = 0, (li).s.LowPart = (v)) +#endif + +/***************************************************************************** + * GUID API + */ +HRESULT WINAPI StringFromCLSID16(REFCLSID id, LPOLESTR16*); +HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*); + +HRESULT WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *); +HRESULT WINAPI CLSIDFromString(LPCOLESTR, CLSID *); + +HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid); +HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid); + +HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID); + + +INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax); + + +/***************************************************************************** + * Macros to define a COM interface + */ +/* + * The goal of the following set of definitions is to provide a way to use the same + * header file definitions to provide both a C interface and a C++ object oriented + * interface to COM interfaces. The type of interface is selected automatically + * depending on the language but it is always possible to get the C interface in C++ + * by defining CINTERFACE. + * + * It is based on the following assumptions: + * - all COM interfaces derive from IUnknown, this should not be a problem. + * - the header file only defines the interface, the actual fields are defined + * separately in the C file implementing the interface. + * + * The natural approach to this problem would be to make sure we get a C++ class and + * virtual methods in C++ and a structure with a table of pointer to functions in C. + * Unfortunately the layout of the virtual table is compiler specific, the layout of + * g++ virtual tables is not the same as that of an egcs virtual table which is not the + * same as that generated by Visual C+. There are workarounds to make the virtual tables + * compatible via padding but unfortunately the one which is imposed to the WINE emulator + * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all. + * + * So the solution I finally adopted does not use virtual tables. Instead I use inline + * non virtual methods that dereference the method pointer themselves and perform the call. + * + * Let's take Direct3D as an example: + * + * #define ICOM_INTERFACE IDirect3D + * #define IDirect3D_METHODS \ + * ICOM_METHOD1(HRESULT,Initialize, REFIID,) \ + * ICOM_METHOD2(HRESULT,EnumDevices, LPD3DENUMDEVICESCALLBACK,, LPVOID,) \ + * ICOM_METHOD2(HRESULT,CreateLight, LPDIRECT3DLIGHT*,, IUnknown*,) \ + * ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,) \ + * ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,) \ + * ICOM_METHOD2(HRESULT,FindDevice, LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,) + * #define IDirect3D_IMETHODS \ + * IUnknown_IMETHODS \ + * IDirect3D_METHODS + * ICOM_DEFINE(IDirect3D,IUnknown) + * #undef ICOM_INTERFACE + * + * #ifdef ICOM_CINTERFACE + * // *** IUnknown methods *** // + * #define IDirect3D_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) + * #define IDirect3D_AddRef(p) ICOM_CALL (AddRef,p) + * #define IDirect3D_Release(p) ICOM_CALL (Release,p) + * // *** IDirect3D methods *** // + * #define IDirect3D_Initialize(p,a) ICOM_CALL1(Initialize,p,a) + * #define IDirect3D_EnumDevices(p,a,b) ICOM_CALL2(EnumDevice,p,a,b) + * #define IDirect3D_CreateLight(p,a,b) ICOM_CALL2(CreateLight,p,a,b) + * #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b) + * #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b) + * #define IDirect3D_FindDevice(p,a,b) ICOM_CALL2(FindDevice,p,a,b) + * #endif + * + * Comments: + * - The ICOM_INTERFACE macro is used in the ICOM_METHOD macros to define the type of the 'this' + * pointer. Defining this macro here saves us the trouble of having to repeat the interface + * name everywhere. Note however that because of the way macros work, a macro like ICOM_METHOD1 + * cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not + * 'IDirect3D_VTABLE'. + * - ICOM_METHODS defines the methods specific to this interface. It is then aggregated with the + * inherited methods to form ICOM_IMETHODS. + * - ICOM_IMETHODS defines the list of methods that are inheritable from this interface. It must + * be written manually (rather than using a macro to generate the equivalent code) to avoid + * macro recursion (which compilers don't like). + * - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to + * explicitly use the interface name for macro expansion reasons again. + * Inherited methods are inherited in C by using the IDirect3D_METHODS macro and the parent's + * Xxx_IMETHODS macro. In C++ we need only use the IDirect3D_METHODS since method inheritance + * is taken care of by the language. + * - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer + * method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The + * only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and + * to have it take only the type information (with const if necessary) as parameters. + * The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following + * macros will not work. This time it's because the ICOM_CALL macro expansion is done only once + * the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone + * anyway. + * - You may have noticed the double commas after each parameter type. This allows you to put the + * name of that parameter which I think is good for documentation. It is not required and since + * I did not know what to put there for this example (I could only find doc about IDirect3D2), + * I left them blank. + * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access + * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate + * the inherited method definitions there. This time I could have used a trick to use only one + * macro whatever the number of parameters but I prefered to have it work the same way as above. + * - You probably have noticed that we don't define the fields we need to actually implement this + * interface: reference count, pointer to other resources and miscellaneous fields. That's + * because these interfaces are just that: interfaces. They may be implemented more than once, in + * different contexts and sometimes not even in Wine. Thus it would not make sense to impose + * that the interface contains some specific fields. + * + * + * In C this gives: + * typedef struct IDirect3DVtbl IDirect3DVtbl; + * struct IDirect3D { + * IDirect3DVtbl* lpVtbl; + * }; + * struct IDirect3DVtbl { + * HRESULT (*fnQueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj); + * ULONG (*fnQueryInterface)(IDirect3D* me); + * ULONG (*fnQueryInterface)(IDirect3D* me); + * HRESULT (*fnInitialize)(IDirect3D* me, REFIID a); + * HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b); + * HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b); + * HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b); + * HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b); + * HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b); + * }; + * + * #ifdef ICOM_CINTERFACE + * // *** IUnknown methods *** // + * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->fnQueryInterface(p,a,b) + * #define IDirect3D_AddRef(p) (p)->lpVtbl->fnAddRef(p) + * #define IDirect3D_Release(p) (p)->lpVtbl->fnRelease(p) + * // *** IDirect3D methods *** // + * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->fnInitialize(p,a) + * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->fnEnumDevice(p,a,b) + * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->fnCreateLight(p,a,b) + * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->fnCreateMaterial(p,a,b) + * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->fnCreateViewport(p,a,b) + * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->fnFindDevice(p,a,b) + * #endif + * + * Comments: + * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing + * the user needs to know to use the interface. Of course the structure we will define to + * implement this interface will have more fields but the first one will match this pointer. + * - The code generated by ICOM_DEFINE defines both the structure representing the interface and + * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_IMETHODS macro to + * automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS + * to define the IDirect3D methods. + * - Each method is declared as a pointer to function field in the jump table. The implementation + * will fill this jump table with appropriate values, probably using a static variable, and + * initialize the lpVtbl field to point to this variable. + * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer + * corresponding to the macro name. This emulates the behavior of a virtual table and should be + * just as fast. + * - This C code should be quite compatible with the Windows headers both for code that uses COM + * interfaces and for code implementing a COM interface. + * + * + * And in C++ (with gcc's g++): + * + * typedef struct IDirect3D: public IUnknown { + * private: HRESULT (*fnInitialize)(IDirect3D* me, REFIID a); + * public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpVtbl)->fnInitialize(this,a); }; + * private: HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b); + * public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) + * { return ((IDirect3D*)t.lpVtbl)->fnEnumDevices(this,a,b); }; + * private: HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b); + * public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b) + * { return ((IDirect3D*)t.lpVtbl)->fnCreateLight(this,a,b); }; + * private: HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b); + * public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b) + * { return ((IDirect3D*)t.lpVtbl)->fnCreateMaterial(this,a,b); }; + * private: HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b); + * public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b) + * { return ((IDirect3D*)t.lpVtbl)->fnCreateViewport(this,a,b); }; + * private: HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b); + * public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) + * { return ((IDirect3D*)t.lpVtbl)->fnFindDevice(this,a,b); }; + * }; + * + * Comments: + * - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface + * definition. The reason for this is to avoid having to duplicate the mehod definitions: once + * to have the function pointers in the jump table and once to have the methods in the interface + * class. Here one macro can generate both. This means though that the first pointer, t.lpVtbl + * defined in IUnknown, must be interpreted as the jump table pointer if we interpret the + * structure as the the interface class, and as the function pointer to the QueryInterface + * method, t.fnQueryInterface, if we interpret the structure as the jump table. Fortunately this + * gymnastic is entirely taken care of in the header of IUnknown. + * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions. + * - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and + * a non-vritual inline method which dereferences it and calls it. This way this method behaves + * just like a virtual method but does not create a true C++ virtual table which would break the + * structure layout. If you look at the implementation of these methods you'll notice that they + * would not work for void functions. We have to return something and fortunately this seems to + * be what all the COM methods do (otherwise we would need another set of macros). + * - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter + * names and the method invocation using only the formal parameter name. This is the reason why + * we need different macros to handle different numbers of parameters. + * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE + * macro is defined in which case we would not be here. + * - This C++ code works well for code that just uses COM interfaces. But it will not work with + * C++ code implement a COM interface. That's because such code assumes the interface methods + * are declared as virtual C++ methods which is not the case here. + * + * + * Implementing a COM interface. + * + * This continues the above example. This example assumes that the implementation is in C. + * + * typedef struct _IDirect3D { + * void* lpVtbl; + * // ... + * + * } _IDirect3D; + * + * static ICOM_VTABLE(IDirect3D) d3dvt; + * + * // implement the IDirect3D methods here + * + * int IDirect3D_fnQueryInterface(IDirect3D* me) + * { + * ICOM_THIS(IDirect3D,me); + * // ... + * } + * + * // ... + * + * static ICOM_VTABLE(IDirect3D) d3dvt = { + * ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + * IDirect3D_fnQueryInterface, + * IDirect3D_fnAdd, + * IDirect3D_fnAdd2, + * IDirect3D_fnInitialize, + * IDirect3D_fnSetWidth + * }; + * + * Comments: + * - We first define what the interface really contains. This is th e_IDirect3D structure. The + * first field must of course be the virtual table pointer. Everything else is free. + * - Then we predeclare our static virtual table variable, we will need its address in some + * methods to initialize the virtual table pointer of the returned interface objects. + * - Then we implement the interface methods. To match what has been declared in the header file + * they must take a pointer to a IDirect3D structure and we must cast it to an _IDirect3D so that + * we can manipulate the fields. This is performed by the ICOM_THIS macro. + * - Finally we initialize the virtual table. + */ + + +#define ICOM_VTABLE(iface) iface##Vtbl +#define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl +#define ICOM_VTBL(iface) (iface)->lpVtbl + + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define ICOM_CINTERFACE 1 +#endif + +#ifndef ICOM_CINTERFACE +/* C++ interface */ + +#define ICOM_METHOD(ret,xfn) \ + public: virtual ret CALLBACK (xfn)(void) = 0; +#define ICOM_METHOD1(ret,xfn,ta,na) \ + public: virtual ret CALLBACK (xfn)(ta a) = 0; +#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b) = 0; +#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c) = 0; +#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d) = 0; +#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e) = 0; +#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0; +#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0; +#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0; +#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0; +#define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j) = 0; +#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k) = 0; + + +#define ICOM_VMETHOD(xfn) \ + public: virtual void CALLBACK (xfn)(void) = 0; +#define ICOM_VMETHOD1(xfn,ta,na) \ + public: virtual void CALLBACK (xfn)(ta a) = 0; +#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \ + public: virtual void CALLBACK (xfn)(ta a,tb b) = 0; +#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c) = 0; +#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d) = 0; +#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e) = 0; +#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0; +#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0; +#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0; +#define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0; +#define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i, tj j) = 0; +#define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i, tj j, tk k) = 0; + + +#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE + +#define ICOM_DEFINE(iface,ibase) \ + typedef struct iface: public ibase { \ + iface##_METHODS \ + } __attribute__ ((com_interface)); + +#else + +#define ICOM_DEFINE(iface,ibase) \ + typedef struct iface: public ibase { \ + iface##_METHODS \ + }; + +#endif /* ICOM_USE_COM_INTERFACE_ATTRIBUTE */ + +#define ICOM_CALL(xfn, p) (p)->xfn() +#define ICOM_CALL1(xfn, p,a) (p)->xfn(a) +#define ICOM_CALL2(xfn, p,a,b) (p)->xfn(a,b) +#define ICOM_CALL3(xfn, p,a,b,c) (p)->xfn(a,b,c) +#define ICOM_CALL4(xfn, p,a,b,c,d) (p)->xfn(a,b,c,d) +#define ICOM_CALL5(xfn, p,a,b,c,d,e) (p)->xfn(a,b,c,d,e) +#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) (p)->xfn(a,b,c,d,e,f) +#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) (p)->xfn(a,b,c,d,e,f,g) +#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->xfn(a,b,c,d,e,f,g,h) +#define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) (p)->xfn(a,b,c,d,e,f,g,h,i) +#define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) (p)->xfn(a,b,c,d,e,f,g,h,i,j) +#define ICOM_CALL11(xfn, p,a,b,c,d,e,f,g,h,i,j,k) (p)->xfn(a,b,c,d,e,f,g,h,i,j,k) + + +#else +/* C interface */ + + +#ifdef __WINE__ + +#define ICOM_METHOD(ret,xfn) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me); +#define ICOM_METHOD1(ret,xfn,ta,na) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a); +#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); +#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_VMETHOD(xfn) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me); +#define ICOM_VMETHOD1(xfn,ta,na) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a); +#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); +#define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ni) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,nj) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,nk) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_CALL(xfn, p) ICOM_VTBL(p)->fn##xfn(p) +#define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->fn##xfn(p,a) +#define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->fn##xfn(p,a,b) +#define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->fn##xfn(p,a,b,c) +#define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d) +#define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e) +#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f) +#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g) +#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h) +#define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h,i) +#define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h,i,j) +#define ICOM_CALL11(xfn, p,a,b,c,d,e,f,g,h,i,j,k) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h,i,j,k) + +#else + +/* WINELIB case */ + +#define ICOM_METHOD(ret,xfn) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me); +#define ICOM_METHOD1(ret,xfn,ta,na) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a); +#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); +#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_VMETHOD(xfn) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me); +#define ICOM_VMETHOD1(xfn,ta,na) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a); +#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); +#define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ni) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,nj) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,nk) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_CVMETHOD(xfn) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me); +#define ICOM_CVMETHOD1(xfn,ta,na) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a); +#define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); + +#define ICOM_CVMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_CVMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_CVMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_CALL(xfn, p) ICOM_VTBL(p)->xfn(p) +#define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->xfn(p,a) +#define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->xfn(p,a,b) +#define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->xfn(p,a,b,c) +#define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->xfn(p,a,b,c,d) +#define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->xfn(p,a,b,c,d,e) +#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f) +#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g) +#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h) +#define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i) +#define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i,j) +#define ICOM_CALL11(xfn, p,a,b,c,d,e,f,g,h,i,j,k) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i,j,k) + +#endif /* __WINE__ */ + +#ifdef ICOM_MSVTABLE_COMPAT +#define ICOM_DEFINE(iface,ibase) \ + typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \ + struct iface { \ + const ICOM_VFIELD(iface); \ + }; \ + struct ICOM_VTABLE(iface) { \ + long dummyRTTI1; \ + long dummyRTTI2; \ + ibase##_IMETHODS \ + iface##_METHODS \ + }; +#define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 0,0, + +#else +#define ICOM_DEFINE(iface,ibase) \ + typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \ + struct iface { \ + const ICOM_VFIELD(iface); \ + }; \ + struct ICOM_VTABLE(iface) { \ + ibase##_IMETHODS \ + iface##_METHODS \ + }; +#define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE +#endif /* ICOM_MSVTABLE_COMPAT */ + + +#define ICOM_THIS(impl,iface) impl* const This=(impl*)iface +#define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)iface + +#endif + + +/***************************************************************************** + * Predeclare the interfaces + */ +DEFINE_OLEGUID(IID_IClassFactory, 0x00000001L, 0, 0); +typedef struct IClassFactory IClassFactory, *LPCLASSFACTORY; + +DEFINE_OLEGUID(IID_IMalloc, 0x00000002L, 0, 0); +typedef struct IMalloc IMalloc; /* ,*LPMALLOC; */ + +DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0); +typedef struct IUnknown IUnknown, *LPUNKNOWN; + +/***************************************************************************** + * IUnknown interface + */ +#define ICOM_INTERFACE IUnknown +#define IUnknown_IMETHODS \ + ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) \ + ICOM_METHOD (ULONG,AddRef) \ + ICOM_METHOD (ULONG,Release) +#ifdef ICOM_CINTERFACE +typedef struct ICOM_VTABLE(IUnknown) ICOM_VTABLE(IUnknown); +struct IUnknown { + ICOM_VFIELD(IUnknown); +#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) +} __attribute__ ((com_interface)); +#else +}; +#endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE */ + +struct ICOM_VTABLE(IUnknown) { +#ifdef ICOM_MSVTABLE_COMPAT + long dummyRTTI1; + long dummyRTTI2; +#endif /* ICOM_MSVTABLE_COMPAT */ + +#else /* ICOM_CINTERFACE */ +struct IUnknown { + +#endif /* ICOM_CINTERFACE */ + + ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) + ICOM_METHOD (ULONG,AddRef) + ICOM_METHOD (ULONG,Release) +#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) +} __attribute__ ((com_interface)); +#else +}; +#endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE */ + +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IUnknown_AddRef(p) ICOM_CALL (AddRef,p) +#define IUnknown_Release(p) ICOM_CALL (Release,p) + +/***************************************************************************** + * IClassFactory interface + */ +#define ICOM_INTERFACE IClassFactory +#define IClassFactory_METHODS \ + ICOM_METHOD3(HRESULT,CreateInstance, LPUNKNOWN,pUnkOuter, REFIID,riid, LPVOID*,ppvObject) \ + ICOM_METHOD1(HRESULT,LockServer, BOOL,fLock) +#define IClassFactory_IMETHODS \ + IUnknown_IMETHODS \ + IClassFactory_METHODS +ICOM_DEFINE(IClassFactory,IUnknown) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IClassFactory_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IClassFactory_AddRef(p) ICOM_CALL (AddRef,p) +#define IClassFactory_Release(p) ICOM_CALL (Release,p) +/*** IClassFactory methods ***/ +#define IClassFactory_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c) +#define IClassFactory_LockServer(p,a) ICOM_CALL1(LockServer,p,a) + + +/***************************************************************************** + * IMalloc interface + */ +#define ICOM_INTERFACE IMalloc +#define IMalloc_METHODS \ + ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \ + ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \ + ICOM_VMETHOD1( Free, LPVOID,pv) \ + ICOM_METHOD1(DWORD, GetSize, LPVOID,pv) \ + ICOM_METHOD1(INT, DidAlloc, LPVOID,pv) \ + ICOM_METHOD (VOID, HeapMinimize) +#define IMalloc_IMETHODS \ + IUnknown_IMETHODS \ + IMalloc_METHODS +ICOM_DEFINE(IMalloc,IUnknown) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IMalloc_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IMalloc_AddRef(p) ICOM_CALL (AddRef,p) +#define IMalloc_Release(p) ICOM_CALL (Release,p) +/*** IMalloc32 methods ***/ +#define IMalloc_Alloc(p,a) ICOM_CALL1(Alloc,p,a) +#define IMalloc_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b) +#define IMalloc_Free(p,a) ICOM_CALL1(Free,p,a) +#define IMalloc_GetSize(p,a) ICOM_CALL1(GetSize,p,a) +#define IMalloc_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a) +#define IMalloc_HeapMinimize(p) ICOM_CALL (HeapMinimize,p) + + +HRESULT WINAPI CoGetMalloc(DWORD dwMemContext,LPMALLOC* lpMalloc); + +LPVOID WINAPI CoTaskMemAlloc(ULONG size); + +void WINAPI CoTaskMemFree(LPVOID ptr); + +/* FIXME: unimplemented */ +LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size); + + +/***************************************************************************** + * Additional API + */ + +HRESULT WINAPI CoCreateGuid(GUID* pguid); + +HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree); + +void WINAPI CoFreeAllLibraries(void); + +void WINAPI CoFreeLibrary(HINSTANCE hLibrary); + +void WINAPI CoFreeUnusedLibraries(void); + +HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv); + +HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pvReserved, REFIID iid, LPVOID *ppv); + +HRESULT WINAPI CoInitialize(LPVOID lpReserved); +HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit); + +void WINAPI CoUninitialize(void); + +typedef enum tagCOINIT +{ + COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */ + COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */ + COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */ + COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */ +} COINIT; + + +/* FIXME: not implemented */ +BOOL WINAPI CoIsOle1Class(REFCLSID rclsid); + +HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases); + +/* class registration flags; passed to CoRegisterClassObject */ +typedef enum tagREGCLS +{ + REGCLS_SINGLEUSE = 0, + REGCLS_MULTIPLEUSE = 1, + REGCLS_MULTI_SEPARATE = 2, + REGCLS_SUSPENDED = 4 +} REGCLS; + +HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister); + +HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister); + +/***************************************************************************** + * COM Server dll - exports + */ +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv); +HRESULT WINAPI DllCanUnloadNow(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __WINE_WINE_OBJ_BASE_H */ diff --git a/xc/programs/Xserver/hw/xwin/win.h b/xc/programs/Xserver/hw/xwin/win.h new file mode 100644 index 000000000..4654baf1b --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/win.h @@ -0,0 +1,758 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/win.h,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#ifndef _WIN_H_ +#define _WIN_H_ + +/* Turn debug messages on or off */ +#define CYGDEBUG + +/* Debugging macros */ +#ifdef CYGDEBUG +#define DEBUG_MSG(str) if (fDebugProcMsg == TRUE) MessageBox(NULL, str, szFunctionName, MB_OK ) +#else +#define DEBUG_MSG(str) +#endif + +#ifdef CYGDEBUG +#define DEBUG_FN_NAME(str) PTSTR szFunctionName = str +#else +#define DEBUG_FN_NAME(str) +#endif + +#ifdef CYGDEBUG +#define DEBUGVARS BOOL fDebugProcCon = FALSE, fDebugProcMsg = FALSE +#else +#define DEBUGVARS +#endif + +#ifdef CYGDEBUG +#define DEBUGPROC_CON fDebugProcCon = TRUE +#define DEBUGPROC_MSG fDebugProcMsg = TRUE +#else +#define DEBUGPROC_CON +#define DEBUGPROC_MSG +#endif + +/* Constant strings */ +#define WINDOW_CLASS "cygwin/xfree86" +#define WINDOW_TITLE "Cygwin/XFree86" +#define WIN_SCR_PROP "cyg_screen_prop" + +#define NEED_EVENTS + +#define WIN_DEFAULT_WIDTH 640 +#define WIN_DEFAULT_HEIGHT 480 +#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 + +#define WIN_SERVER_NONE 0x0L /* 0 */ +#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */ +#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */ +#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */ +#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */ + +#define AltMask Mod1Mask +#define NumLockMask Mod2Mask +#define AltLangMask Mod3Mask +#define KanaMask Mod4Mask +#define ScrollLockMask Mod5Mask + +#define AltMapIndex Mod1MapIndex +#define NumLockMapIndex Mod2MapIndex +#define AltLangMapIndex Mod3MapIndex +#define KanaMapIndex Mod4MapIndex +#define ScrollLockMapIndex Mod5MapIndex + +#define WIN_KEY_EXTENDED 0x01000000 + +/* + * Defines for winkeymap.h + */ +#define GLYPHS_PER_KEY 4 +#define NUM_KEYCODES 278 +#define NUM_STD_KEYCODES 240 +#define MIN_KEYCODE 8 +#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) +#define MAX_STD_KEYCODE (NUM_STD_KEYCODES + MIN_KEYCODE - 1) +#define WIN_VK_KP_RETURN 0x0e + +#include <sys/types.h> +#include <sys/stat.h> +#include <stdio.h> +#include <errno.h> + +#include <X11/XWDFile.h> + +#ifdef HAS_MMAP +#include <sys/mman.h> +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif +#endif /* HAS_MMAP */ + +#include "X.h" +#include "Xproto.h" +#include "Xos.h" +#include "Xprotostr.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "pixmap.h" +#include "region.h" +#include "regionstr.h" +#include "gcstruct.h" +#include "colormap.h" +#include "colormapst.h" +#include "miscstruct.h" +#include "servermd.h" +#include "windowstr.h" +#include "mi.h" +#include "micmap.h" +#include "migc.h" +#include "mifillarc.h" +#include "mifpoly.h" +#include "mibstore.h" +#include "input.h" +#include "mipointer.h" +#include "keysym.h" +#include "mibstore.h" +#include "micoord.h" +#include "dix.h" +#include "miline.h" +#include "shadow.h" +#include "fb.h" + +#ifdef RENDER +#include "picturestr.h" +#endif + +/* + * Windows headers 26Mar2001 2200 + */ +#include "winms.h" + +/* Cygwin's winuser.h does not define VK_KANA as of 28Mar2001 */ +#ifndef VK_KANA +#define VK_KANA 15 +#endif + +#include <stdio.h> + +/* + * Typedefs for engine dependent function pointers + */ + +typedef Bool (*winAllocateFB)(ScreenPtr); + +typedef void (*winShadowUpdateProc)(ScreenPtr, PixmapPtr, RegionPtr); + +typedef void *(*winShadowWindowProc)(ScreenPtr, CARD32, CARD32, int, CARD32*); + +typedef Bool (*winCloseScreen)(int, ScreenPtr); + +typedef Bool (*winInitVisuals)(ScreenPtr); + +typedef Bool (*winAdjustVideoMode)(ScreenPtr); + +typedef void (*winCreateBoundingWindow)(ScreenPtr); + +typedef Bool (*winFinishScreenInit)(ScreenPtr, int, int, char **); + +/* + * Privates structures + */ + +typedef struct { + DWORD dwDummy; +} winPrivWin; + +typedef struct { + DWORD dwDummy; +} winPrivGC; + +typedef struct +{ + ScreenPtr pScreen; + DWORD dwScreen; + DWORD dwWidth; + DWORD dwPaddedWidth; + DWORD dwHeight; + DWORD dwDepth; + DWORD dwDPIx; + DWORD dwDPIy; + DWORD dwStrideBytes; + DWORD dwStride; + DWORD dwBPP; + char *pfb; + XWDColor *pXWDCmap; + XWDFileHeader *pXWDHeader; + Pixel pixelBlack; + Pixel pixelWhite; + DWORD dwLineBias; + DWORD dwEngine; + DWORD dwEnginePreferred; + DWORD dwEnginesSupported; + Bool fFullScreen; +} winScreenInfo, *winScreenInfoPtr; + +typedef struct +{ + winScreenInfoPtr pScreenInfo; + + Bool fEnabled; + Bool fClosed; + Bool fActive; + Bool fCursor; + + int iDeltaZ; + + CloseScreenProcPtr CloseScreen; + + DWORD dwRedMask; + DWORD dwGreenMask; + DWORD dwBlueMask; + DWORD dwBitsPerRGB; + + DWORD dwModeKeyStates; + + /* Privates used by shadow fb GDI server */ + HBITMAP hbmpShadow; + HDC hdcScreen; + HDC hdcShadow; + HWND hwndScreen; + + /* Privates used by shadow fb and primary fb DirectDraw servers */ + LPDIRECTDRAW pdd; + LPDIRECTDRAWSURFACE pddsPrimary; + + /* Privates used by shadow fb DirectDraw server */ + LPDIRECTDRAWSURFACE pddsShadow; + LPDDSURFACEDESC pddsdShadow; + + /* Privates used by primary fb DirectDraw server */ + LPDIRECTDRAWSURFACE pddsOffscreen; + LPDDSURFACEDESC pddsdOffscreen; + LPDDSURFACEDESC pddsdPrimary; + + /* Privates used by shadow fb DirectDraw Nonlocking server */ + LPDIRECTDRAW4 pdd4; + LPDIRECTDRAWSURFACE4 pddsShadow4; + LPDIRECTDRAWSURFACE4 pddsPrimary4; + + /* Privates used by both shadow fb DirectDraw servers */ + LPDIRECTDRAWCLIPPER pddcPrimary; + + /* Engine specific functions */ + winAllocateFB pwinAllocateFB; + winShadowUpdateProc pwinShadowUpdateProc; + winShadowWindowProc pwinShadowWindowProc; + winCloseScreen pwinCloseScreen; + winInitVisuals pwinInitVisuals; + winAdjustVideoMode pwinAdjustVideoMode; + winCreateBoundingWindow pwinCreateBoundingWindow; + winFinishScreenInit pwinFinishScreenInit; +} winPrivScreenRec, *winPrivScreenPtr; + +extern ColormapPtr g_cmInstalledMaps[]; +extern winScreenInfo g_winScreens[]; +extern char *g_pcDisplay; +extern miPointerScreenFuncRec g_winPointerCursorFuncs; +extern DWORD g_dwEvents; + +int g_winScreenPrivateIndex; +unsigned long g_winGeneration; + +/* Screen privates macros */ +#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ + (pScreen)->devPrivates[g_winScreenPrivateIndex].ptr) +#define winSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[g_winScreenPrivateIndex].ptr = \ + (pointer) v) +#define winScreenPriv(pScreen) winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) + +/* Window privates macros */ +#define winGetWindowPrivate(_pWin) ((winPrivWin *)\ + (_pWin)->devPrivates[winWindowPrivateIndex].ptr) + +/* FIXME: Windows mouse wheel macro, should go in Cygwin w32api headers */ +#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) + +/* BEGIN DDX and DIX Function Prototypes */ + +/* + * InitOutput.c + */ + +DWORD +winBitsPerPixel (DWORD dwDepth); + +/* + * winallpriv.c + */ + +Bool +winAllocatePrivates (ScreenPtr pScreen); + +/* + * winblock.c + */ +#if 0 +void +winBlockHandler (pointer pData, OSTimePtr pTimeout, pointer pRead); +#endif + +void +winBlockHandler (int iScreen, + pointer pBlockData, + pointer pTimeout, + pointer pReadmask); + +/* + * winclip.c + */ + +RegionPtr +winPixmapToRegionNativeGDI (PixmapPtr pPix); + +/* + * wincmap.c + */ + +int +winListInstalledColormapsNativeGDI (ScreenPtr pScreen, Colormap *pmaps); + +Bool +winInitVisualsNativeGDI (ScreenPtr pScreen); + +void +winStoreColorsNativeGDI (ColormapPtr pmap, int ndef, xColorItem *pdefs); + +void +winInstallColormapNativeGDI (ColormapPtr pmap); + +void +winUninstallColormapNativeGDI (ColormapPtr pmap); + +void +winResolveColorNativeGDI (unsigned short *pred, + unsigned short *pgreen, + unsigned short *pblue, + VisualPtr pVisual); + +Bool +winInitializeColormapNativeGDI (ColormapPtr pmap); + +int +winExpandDirectColorsNativeGDI (ColormapPtr pmap, int ndef, + xColorItem *indefs, xColorItem *outdefs); + +Bool +winCreateDefColormapNativeGDI (ScreenPtr pScreen); + +Bool +winSetVisualTypesNativeGDI (int nDepth, int nVisuals, int nBitsPerRGB); + +void +winClearVisualTypes (void); + +/* + * wincursor.c + */ + +Bool +winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y); + +void +winCrossScreen (ScreenPtr pScreen, Bool fEntering); + +/* + * winfillsp.c + */ + +void +winFillSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int nSpans, + DDXPointPtr pPoints, + int *pWidths, + int fSorted); + +/* + * winfont.c + */ + +Bool +winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); + +Bool +winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); + +/* + * wingc.c + */ + +Bool +winCreateGCNativeGDI (GCPtr pGC); + +void +winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges); + +void +winPadPixmapNativdGDI (PixmapPtr pPixmap); + +void +winValidateGCNativeGDI (GCPtr pGC, + unsigned long changes, + DrawablePtr pDrawable); + +void +winCopyGCNativeGDI (GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst); + +void +winDestroyGCNativeGDI (GCPtr pGC); + +void +winChangeClipNativeGDI (GCPtr pGC, int nType, char *pValue, int nRects); + +void +winDestroyClipNativeGDI (GCPtr pGC); + +void +winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc); + +/* + * wingetsp.c + */ + +void +winGetSpansNativeGDI (DrawablePtr pDrawable, + int wMax, + DDXPointPtr pPoints, + int *pWidths, + int nSpans, + char *pDst); + +/* + * winmisc.c + */ + +void +winQueryBestSizeNativeGDI (int class, unsigned short *pWidth, + unsigned short *pHeight, ScreenPtr pScreen); + +CARD8 +winCountBits (DWORD dw); + +/* + * winpfbddd.c + */ + +Bool +winAllocateFBPrimaryDD (ScreenPtr pScreen); + +Bool +winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsPrimaryDD (ScreenPtr pScreen); + +Bool +winAdjustVideoModePrimaryDD (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen); + +/* + * winpixmap.c + */ + +PixmapPtr +winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth); + +Bool +winDestroyPixmapNativeGDI (PixmapPtr pPixmap); + +void +winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw); + +void +winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh); + +void +winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix, + int xrot, int yrot); + +/* + * winpntwin.c + */ + +void +winPaintWindowNativeGDI (WindowPtr pWin, RegionPtr pRegion, int what); + +/* + * winpolyline.c + */ + +void +winPolyLineNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt); + +/* + * winscrinit.c + */ + +Bool +winScreenInit (int index, + ScreenPtr pScreen, + int argc, char **argv); + +Bool +winFinishScreenInitFB (int index, + ScreenPtr pScreen, + int argc, char **argv); + +Bool +winFinishScreenInitNativeGDI (int index, + ScreenPtr pScreen, + int argc, char **argv); + +Bool +winSaveScreen (ScreenPtr pScreen, int on); + +PixmapPtr +winGetWindowPixmap (WindowPtr pWin); + +void +winSetWindowPixmap (WindowPtr pWin, PixmapPtr pPix); + +Bool +winDetectSupportedEngines (ScreenPtr pScreen); + +Bool +winSetEngine (ScreenPtr pScreen); + +void +winCreateBoundingWindowFullScreen (ScreenPtr pScreen); + +void +winCreateBoundingWindowWindowed (ScreenPtr pScreen); + +/* + * winsetsp.c + */ + +void +winSetSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + char *pSrc, + DDXPointPtr pPoints, + int *pWidth, + int nSpans, + int fSorted); + +/* + * winshaddd.c + */ + +Bool +winAllocateFBShadowDD (ScreenPtr pScreen); + +void +winShadowUpdateProcDD (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); + +void * +winShadowSetWindowLinearDD (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize); + +void * +winShadowWindowProcDD (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +Bool +winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsShadowDD (ScreenPtr pScreen); + +Bool +winAdjustVideoModeShadowDD (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsShadowDD (ScreenPtr pScreen); + +/* + * winshadddnl.c + */ + +Bool +winAllocateFBShadowDDNL (ScreenPtr pScreen); + +void +winShadowUpdateProcDDNL (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); + +void * +winShadowSetWindowLinearDDNL (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize); + +void * +winShadowWindowProcDDNL (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +Bool +winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsShadowDDNL (ScreenPtr pScreen); + +Bool +winAdjustVideoModeShadowDDNL (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen); + +/* + * winshadgdi.c + */ + +Bool +winAllocateFBShadowGDI (ScreenPtr pScreen); + +void +winShadowUpdateProcGDI (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); + +void * +winShadowSetWindowLinearGDI (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize); + +void * +winShadowWindowProcGDI (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +Bool +winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsShadowGDI (ScreenPtr pScreen); + +Bool +winAdjustVideoModeShadowGDI (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsShadowGDI (ScreenPtr pScreen); + +/* + * winwakeup.c + */ +#if 0 +void +winWakeupHandler (pointer pData, int i, pointer pLastSelectMask); +#endif + +void +winWakeupHandler (int iScreen, + pointer pWakeupData, + unsigned long ulResult, + pointer pReadMask); + +/* + * winwindow.c + */ + +Bool +winCreateWindowNativeGDI (WindowPtr pWin); + +Bool +winDestroyWindowNativeGDI (WindowPtr pWin); + +Bool +winPositionWindowNativeGDI (WindowPtr pWin, int x, int y); + +void +winCopyWindowNativeGDI (WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +Bool +winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask); + +Bool +winUnmapWindowNativeGDI (WindowPtr pWindow); + +Bool +winMapWindowNativeGDI (WindowPtr pWindow); + +/* + * winwndproc.c + */ + +LRESULT CALLBACK +winWindowProc (HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam); + +void +winRestoreModeKeyStates (ScreenPtr pScreen); + +/* END DDX and DIX Function Prototypes */ + +#endif /* _WIN_H_ */ + diff --git a/xc/programs/Xserver/hw/xwin/winallpriv.c b/xc/programs/Xserver/hw/xwin/winallpriv.c new file mode 100644 index 000000000..57d7c3e98 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winallpriv.c @@ -0,0 +1,68 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Keith Packard, MIT X Consortium + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winallpriv.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +int g_winScreenPrivateIndex = -1; +unsigned long g_winGeneration = 0; + +/* See Porting Layer Definition - p. 58 */ +Bool +winAllocatePrivates (ScreenPtr pScreen) +{ + winPrivScreenPtr pScreenPriv; + + /* We need a new slot for our privates if the screen gen has changed */ + if (g_winGeneration != serverGeneration) + { + /* Get an index that we can store our privates at */ + g_winScreenPrivateIndex = AllocateScreenPrivateIndex (); + g_winGeneration = serverGeneration; + } + + /* Allocate memory for our private structure */ + pScreenPriv = (winPrivScreenPtr) xalloc (sizeof (*pScreenPriv)); + if (!pScreenPriv) + return FALSE; + + /* Initialize the memory of the private structure */ + ZeroMemory (pScreenPriv, sizeof (winPrivScreenRec)); + + /* Intialize private structure members */ + pScreenPriv->fActive = TRUE; + pScreenPriv->fCursor = TRUE; + + /* Save the screen private pointer */ + winSetScreenPriv (pScreen, pScreenPriv); + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/winblock.c b/xc/programs/Xserver/hw/xwin/winblock.c new file mode 100644 index 000000000..776ea4b67 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winblock.c @@ -0,0 +1,58 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 6 */ +void +winBlockHandler (int iScreen, + pointer pBlockData, + pointer pTimeout, + pointer pReadmask) +{ + ScreenPtr pScreen = (ScreenPtr) pBlockData; + winPrivScreenPtr pScreenPriv; + winScreenInfoPtr pScreenInfo; + MSG msg; + + //ErrorF ("winBlockHandler () - pScreen: %08x\n", pScreen); + + pScreenPriv = winGetScreenPriv (pScreen); + pScreenInfo = pScreenPriv->pScreenInfo; + + //ErrorF ("winBlockHandler () - Got privates\n"); + + while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) + { + TranslateMessage (&msg); + DispatchMessage (&msg); + } +} diff --git a/xc/programs/Xserver/hw/xwin/winclip.c b/xc/programs/Xserver/hw/xwin/winclip.c new file mode 100644 index 000000000..f12b38537 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winclip.c @@ -0,0 +1,40 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* Look at mfb/mfbclip.c for sample implementation */ +RegionPtr +winPixmapToRegionNativeGDI (PixmapPtr pPix) +{ + fprintf (stderr, "winPixmapToRegion()\n"); + return NULL; +} diff --git a/xc/programs/Xserver/hw/xwin/wincmap.c b/xc/programs/Xserver/hw/xwin/wincmap.c new file mode 100644 index 000000000..747099931 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/wincmap.c @@ -0,0 +1,386 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincmap.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 30 */ +int +winListInstalledColormapsNativeGDI (ScreenPtr pScreen, Colormap *pmaps) +{ + /* By the time we are processing requests, we can guarantee that there + * is always a colormap installed + */ + + fprintf (stderr, "\nwinListInstalledColormaps ()\n"); + return miListInstalledColormaps (pScreen, pmaps); +} + +/* See Porting Layer Definition - p. 30 */ +/* See Programming Windows - p. 663 */ +void +winInstallColormapNativeGDI (ColormapPtr pmap) +{ + fprintf (stderr, "\nwinInstallColormap ()\n"); + miInstallColormap (pmap); +} + +/* See Porting Layer Definition - p. 30 */ +void +winUninstallColormapNativeGDI (ColormapPtr pmap) +{ + fprintf (stderr, "\nwinUninstallColormap ()\n"); + miUninstallColormap (pmap); +} + +/* See Porting Layer Definition - p. 30 */ +void +winStoreColorsNativeGDI (ColormapPtr pmap, int ndef, xColorItem *pdefs) +{ + fprintf (stderr, "winStoreColors ()\n"); + //miStoreColors (pmap, ndef, pdefs); +} + +/* See Porting Layer Definition - p. 30 */ +void +winResolveColorNativeGDI (unsigned short *pred, + unsigned short *pgreen, + unsigned short *pblue, + VisualPtr pVisual) +{ + fprintf (stderr, "\nwinResolveColor ()\n"); + miResolveColor (pred, pgreen, pblue, pVisual); +} + +/* See Porting Layer Definition - p. 29 */ +/* Also refered to as CreateColormap */ +Bool +winInitializeColormapNativeGDI (ColormapPtr pmap) +{ + fprintf (stderr, "\nwinInitializeColormap ()\n"); + return miInitializeColormap (pmap); +} + +int +winExpandDirectColorsNativeGDI (ColormapPtr pmap, int ndef, + xColorItem *indefs, xColorItem *outdefs) +{ + fprintf (stderr, "\nwinExpandDirectColors ()\n"); + return miExpandDirectColors (pmap, ndef, indefs, outdefs); +} + +Bool +winCreateDefColormapNativeGDI (ScreenPtr pScreen) +{ + VisualPtr pVisual; + ColormapPtr pcmap = NULL; + HBITMAP hbmp; + HDC hdc = GetDC (NULL); + BITMAPINFO *pbmi = xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + int i; + Pixel pixel; + unsigned short nRed, nGreen, nBlue; + + ErrorF ("winCreateDefColormap () - sizeof (*pbmi): %d\n", + sizeof (*pbmi)); + + /* Find the root visual */ + for (pVisual = pScreen->visuals; + pVisual->vid != pScreen->rootVisual; + pVisual++); + + hbmp = CreateCompatibleBitmap (hdc, 1, 1); + + /* Allocate a colormap */ + if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pcmap, + AllocNone, 0) != Success) + return FALSE; + if (pcmap == NULL) + { + FatalError ("winCreateDefColormap () - Colormap could not be created\n"); + } + + ErrorF ("winCreateDefColormap () - Created a colormap\n"); + + /* Intialize memory of bitmap info header */ + ZeroMemory (pbmi, sizeof (*pbmi)); + pbmi->bmiHeader.biSize = sizeof (BITMAPINFOHEADER); + + /* Get the screen bitmap format and colormap */ + GetDIBits (hdc, hbmp, + 0, 0, + NULL, + pbmi, + DIB_RGB_COLORS); + + ErrorF ("winCreateDefColormap () - Got screen colormap %d %d\n", + pbmi->bmiHeader.biClrUsed, pbmi->bmiHeader.biClrImportant); + + /* Allocate an X colormap entry for each of Windows' colormap entries */ + for (i = 0; i < 8; ++i) + { + pixel = i; + + nRed = pbmi->bmiColors[i].rgbRed; + nGreen = pbmi->bmiColors[i].rgbGreen; + nBlue = pbmi->bmiColors[i].rgbBlue; + + ErrorF ("winCreateDefColormap () - Allocating a color: %d; %d %d %d\n", + pixel, nRed, nGreen, nBlue); + if (AllocColor (pcmap, + &nRed, + &nGreen, + &nBlue, + &pixel, + 0) != Success) + break; + } + + /* Free memory */ + ReleaseDC (NULL, hdc); + DeleteObject (hbmp); + xfree (pbmi); + + ErrorF ("winCreateDefColormap () - Returning\n"); + + return TRUE; +} + +void +winClearVisualTypes (void) +{ + fprintf (stderr, "\nwinClearVisualTypes ()\n"); + miClearVisualTypes (); +} + +Bool +winSetVisualTypesNativeGDI (int nDepth, int nVisuals, int nBitsPerRGB) +{ + fprintf (stderr, "\nwinSetVisualTypes ()\n"); + return miSetVisualTypes (nDepth, nVisuals, nBitsPerRGB, -1); +} + +Bool +winInitVisualsNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HBITMAP hbmp; + BITMAPINFO *pbmi = xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + BITMAPV4HEADER *pbmih = (BITMAPV4HEADER*) pbmi; + HDC hdc = GetDC (NULL); + + /* Exit if we could not allocate a bitmapinfo structure */ + if (pbmi == NULL) + FatalError ("winInitVisuals () - Could not allocate a "\ + "bitmapinfo structure\n"); + + /* Create a bitmap compatible with the primary display */ + hbmp = CreateCompatibleBitmap (hdc, 1, 1); + + ZeroMemory (pbmi, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); + pbmi->bmiHeader.biSize = sizeof (BITMAPINFOHEADER); + + /* Call GetDIBits for the first time; doesn't do much */ + /* NOTE: This doesn't actually return the bits, because our + data pointer is NULL; therefore, we don't have to free + memory later. + */ + GetDIBits (hdc, hbmp, + 0, 0, + NULL, + pbmi, + 0); + + ErrorF ("winInitVisuals () - 1st comp %08x rm %08x gm %08x bm %08x\n", + pbmi->bmiHeader.biCompression, + pbmih->bV4RedMask, + pbmih->bV4GreenMask, + pbmih->bV4BlueMask); + + /* Call GetDIBits again if the masks were zero and the color depth > 8 bpp */ + if ((pScreenInfo->dwDepth > 8) + && (pbmih->bV4RedMask == 0x0 + || pbmih->bV4GreenMask == 0x0 + || pbmih->bV4BlueMask == 0x0)) + { + GetDIBits (hdc, hbmp, + 0, 0, + NULL, + pbmi, + 0); + } + + ErrorF ("winInitVisuals () - 2nd comp %08x rm %08x gm %08x bm %08x\n", + pbmi->bmiHeader.biCompression, + pbmih->bV4RedMask, + pbmih->bV4GreenMask, + pbmih->bV4BlueMask); + + /* Set default masks if masks could not be detected */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + if (pbmih->bV4RedMask != 0x00FF0000) + { + pbmih->bV4RedMask = 0x00FF0000; + } + if (pbmih->bV4GreenMask != 0x0000FF00) + { + pbmih->bV4GreenMask = 0x0000FF00; + } + if (pbmih->bV4BlueMask != 0x000000FF) + { + pbmih->bV4BlueMask = 0x000000FF; + } + break; + + case 16: + if (pbmih->bV4RedMask != 0x0000F800 && pbmih->bV4RedMask != 0x00007C00) + { + pbmih->bV4RedMask = 0x0000F800; + } + if (pbmih->bV4GreenMask != 0x00007E0 + && pbmih->bV4GreenMask != 0x000003E0) + { + pbmih->bV4GreenMask = 0x000007E0; + } + if (pbmih->bV4BlueMask != 0x0000001F) + { + pbmih->bV4BlueMask = 0x0000001F; + } + break; + } + + ErrorF ("winInitVisuals () - 3rd comp %08x rm %08x gm %08x bm %08x\n", + pbmi->bmiHeader.biCompression, + pbmih->bV4RedMask, + pbmih->bV4GreenMask, + pbmih->bV4BlueMask); + + /* Copy the bitmasks into the screen privates, for later use */ + pScreenPriv->dwRedMask = pbmih->bV4RedMask; + pScreenPriv->dwGreenMask = pbmih->bV4GreenMask; + pScreenPriv->dwBlueMask = pbmih->bV4BlueMask; + + /* Release the DC and the bitmap that were used for querying */ + ReleaseDC (NULL, hdc); + DeleteObject (hbmp); + + /* Set the significant bits per red, green, and blue */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + pScreenPriv->dwBitsPerRGB = 8; + break; + + case 16: + if (pScreenPriv->dwRedMask == 0xF800) + { + pScreenPriv->dwBitsPerRGB = 6; + } + else + { + pScreenPriv->dwBitsPerRGB = 5; + } + break; + + case 15: + pScreenPriv->dwBitsPerRGB = 5; + break; + + case 8: + pScreenPriv->dwBitsPerRGB = 8; + pScreenPriv->dwRedMask = 0; + pScreenPriv->dwGreenMask = 0; + pScreenPriv->dwBlueMask = 0; + break; + + default: + pScreenPriv->dwBitsPerRGB = 0; + break; + } + + /* Tell the user how many bits per RGB we are using */ + ErrorF ("winInitVisuals () - Using dwBitsPerRGB: %d\n", + pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + } + break; + + case 8: + ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + } + ErrorF ("winInitVisuals () - Returned from miSetVisualTypesAndMasks\n"); + break; + + default: + break; + } + + /* Free memory */ + xfree (pbmi); + + ErrorF ("winInitVisuals () - Returning\n"); + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/wincursor.c b/xc/programs/Xserver/hw/xwin/wincursor.c new file mode 100644 index 000000000..f6baf40de --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/wincursor.c @@ -0,0 +1,54 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincursor.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +miPointerScreenFuncRec g_winPointerCursorFuncs = +{ + winCursorOffScreen, + winCrossScreen, + miPointerWarpCursor +}; + +Bool +winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y) +{ + return FALSE; +} + +void +winCrossScreen (ScreenPtr pScreen, Bool fEntering) +{ +} + diff --git a/xc/programs/Xserver/hw/xwin/winfillsp.c b/xc/programs/Xserver/hw/xwin/winfillsp.c new file mode 100644 index 000000000..d5eec4ea7 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winfillsp.c @@ -0,0 +1,262 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winfillsp.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 54 */ +void +winFillSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int nSpans, + DDXPointPtr pPoints, + int *pWidths, + int fSorted) +{ +#if 0 + int iIdx = 0, i, iX; + DDXPointPtr pPoint = NULL; + int *pnWidth = 0; + PixmapPtr pPixmap = NULL; + HDC hdcStipple; + HBITMAP hbmpFilledStipple; + HBITMAP hbmpMaskedForeground; + HBITMAP hbmpDrawable; + HBRUSH hbrushStipple; + HBRUSH hBrush; + DEBUG_FN_NAME("winFillSpans"); + DEBUGVARS; + //DEBUGPROC_MSG; + + fprintf (stderr, "winFillSpans () - pDrawable: %08x\n", + pDrawable); + + /* Branch on the fill type */ + switch (pGC->fillStyle) + { + case FillSolid: + BitBlt (g_hdc, pDrawable->width, pDrawable->height, + pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCCOPY); + DEBUG_MSG("Solid fill - original drawable"); + + /* Enumerate spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + /* Get pointers to the current span location and width */ + pPoint = pPoints + iIdx; + pnWidth = pWidths + iIdx; + + /* Draw the requested line */ + MoveToEx (g_hdcMem, pPoint->x, pPoint->y, NULL); + LineTo (g_hdcMem, pPoint->x + *pnWidth, pPoint->y); + + fprintf (stderr, + "(%dx%dx%d) from: (%d,%d) to: (%d,%d), color: %08x\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, pPoint->x + *pnWidth, pPoint->y, + pGC->fgPixel); + } + + BitBlt (g_hdc, pDrawable->width * 2, pDrawable->height, + pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCCOPY); + DEBUG_MSG("Solid Fill - Filled"); + break; + case FillStippled: + /* TODO: Construct the correct stipple, store it in hdcStipple */ + fprintf (stderr, "winFillSpans () - Stipple bitmap: %08x (%dx%d)\n", + pGC->stipple->devPrivate.ptr, + pGC->stipple->drawable.width, + pGC->stipple->drawable.height); + SelectObject (hdcStipple, (HBITMAP)pGC->stipple->devPrivate.ptr); + BitBlt (g_hdc, 0, 0, + pGC->stipple->drawable.width, + pGC->stipple->drawable.height, + hdcStipple, + 0, 0, + SRCCOPY); + DEBUG_MSG("Blitted original stipple to screen"); + + /* Create a memory DC to hold the stipple */ + hdcStipple = CreateCompatibleDC (g_hdc); + + /* Create a destination sized compatible bitmap */ + hbmpFilledStipple = CreateCompatibleBitmap (g_hdc, + pDrawable->width, + pDrawable->height); + + /* Select the stipple bitmap into the stipple DC */ + SelectObject (hdcStipple, hbmpFilledStipple); + + /* Set foreground and background to white and black */ + SetTextColor (hdcStipple, RGB(0xFF, 0xFF, 0xFF)); + SetBkColor (hdcStipple, RGB (0x00, 0x00, 0x00)); + + /* Create a pattern brush from the original stipple */ + hbrushStipple = CreatePatternBrush (pGC->stipple->devPrivate.ptr); + + /* Select the original stipple brush into the stipple DC */ + SelectObject (hdcStipple, hbrushStipple); + + /* PatBlt the original stipple to the filled stipple */ + PatBlt (hdcStipple, 0, 0, pDrawable->width, pDrawable->height, PATCOPY); + BitBlt (g_hdc, pDrawable->width, 0, + pDrawable->width, pDrawable->height, + hdcStipple, 0, 0, SRCCOPY); + DEBUG_MSG("Filled a drawable-sized stipple"); + + /* Mask out the bits from the drawable that are being preserved; + hbmpFilledStipple now contains the preserved original bits */ + BitBlt (hdcStipple, 0, 0, pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCERASE); + BitBlt (g_hdc, pDrawable->width * 2, 0, + pDrawable->width, pDrawable->height, + hdcStipple, 0, 0, SRCCOPY); + DEBUG_MSG("Preserved original bits"); + + /* Create a destination sized compatible bitmap to hold + the masked foreground color */ + hbmpMaskedForeground = CreateCompatibleBitmap (g_hdc, + pDrawable->width, + pDrawable->height); + + /* TODO: This code chunk can move to winValidateGC () */ + /* Set the foreground color for the stipple fill */ + if (pGC->fgPixel == 0x1) + { + SetTextColor (g_hdcMem, RGB(0x00, 0x00, 0x00)); + DEBUG_MSG("Grey fill"); + } + else if (pGC->fgPixel == 0xFFFF) + { + SetTextColor (g_hdcMem, RGB(0xFF, 0xFF, 0xFF)); + DEBUG_MSG("White fill"); + } + else + { + SetTextColor (g_hdcMem, RGB(0x00, 0x00, 0x00)); + DEBUG_MSG("Black fill"); + } + SetBkColor (g_hdcMem, RGB(0x00, 0x00, 0x00)); + + /* Select the masked foreground bitmap into the default memory DC; + this should pop the drawable bitmap out of the default DC */ + hbmpDrawable = SelectObject (g_hdcMem, hbmpMaskedForeground); + + /* Free the original drawable */ + DeleteObject (hbmpDrawable); + hbmpDrawable = NULL; + + /* Select the stipple brush into the default memory DC */ + SelectObject (g_hdcMem, hbrushStipple); + + /* Create the masked foreground bitmap using the original stipple */ + PatBlt (g_hdcMem, 0, 0, pDrawable->width, pDrawable->height, PATCOPY); + BitBlt (g_hdc, pDrawable->width * 3, 0, + pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCCOPY); + DEBUG_MSG("Masked foreground bitmap"); + + /* Combine the masked foreground with the masked drawable; + hbmpFilledStipple will contain the drawable stipple filled + with the current foreground color */ + BitBlt (hdcStipple, 0, 0, pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCPAINT); + BitBlt (g_hdc, pDrawable->width * 4, 0, + pDrawable->width, pDrawable->height, + hdcStipple, 0, 0, SRCCOPY); + DEBUG_MSG("Completed stipple"); + + /* Release the stipple DC */ + DeleteDC (hdcStipple); + + /* Pop the stipple pattern brush out of the default mem DC */ + SelectObject (g_hdcMem, GetStockObject (WHITE_BRUSH)); + + /* Destroy the original stipple pattern brush */ + DeleteObject (hbrushStipple); + + /* Select the result into the default memory DC */ + SelectObject (g_hdcMem, hbmpFilledStipple); + + /* Free the masked foreground bitmap */ + DeleteObject (hbmpMaskedForeground); + + /* Point the drawable to the new bitmap */ + ((PixmapPtr)pDrawable)->devPrivate.ptr = hbmpFilledStipple; + break; + case FillOpaqueStippled: + fprintf (stderr, "\n\nwinFillSpans () - OpaqueStippled\n\n"); + break; + case FillTiled: + /* Assumes that the drawable is the screen and the tile has been + selected into the default memory DC */ +#if 0 + hBrush = CreatePatternBrush (pGC->tile.pixmap->devPrivate.ptr); + hBrush = SelectObject (g_hdc, hBrush); + + PatBlt (g_hdc, 0, 0, pDrawable->width, pDrawable->height, PATCOPY); + + hBrush = SelectObject (g_hdc, hBrush); + + DeleteObject (hBrush); +#endif + + /* Enumerate spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + /* Get pointers to the current span location and width */ + pPoint = pPoints + iIdx; + pnWidth = pWidths + iIdx; + + for (iX = 0; iX < *pnWidth; iX += pGC->tile.pixmap->drawable.width) + { + /* Blit the tile to the screen, + one line at a time */ + BitBlt (g_hdc, + pPoint->x + iX, + pPoint->y, + pGC->tile.pixmap->drawable.width, + 1, + g_hdcMem, + 0, + pPoint->y % pGC->tile.pixmap->drawable.height, + SRCCOPY); + } + } + break; + default: + fprintf (stderr, "winFillSpans () - Unknown fillStyle\n"); + exit (1); + break; + } +#endif +} diff --git a/xc/programs/Xserver/hw/xwin/winfont.c b/xc/programs/Xserver/hw/xwin/winfont.c new file mode 100644 index 000000000..c9a013355 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winfont.c @@ -0,0 +1,50 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winfont.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 32 */ +/* See mfb/mfbfont.c - mfbRealizeFont() - which is empty :) */ +Bool +winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont) +{ + fprintf (stderr, "winRealizeFont()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 32 */ +/* See mfb/mfbfont.c - mfbUnrealizeFont() - which is empty :) */ +Bool +winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont) +{ + fprintf (stderr, "winUnrealizeFont()\n"); + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/wingc.c b/xc/programs/Xserver/hw/xwin/wingc.c new file mode 100644 index 000000000..bbe6131c9 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/wingc.c @@ -0,0 +1,319 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* GC Handling Routines */ +const GCFuncs winGCFuncs = { + winValidateGCNativeGDI, + winChangeGCNativeGDI, + winCopyGCNativeGDI, + winDestroyGCNativeGDI, + winChangeClipNativeGDI, + winDestroyClipNativeGDI, + winCopyClipNativeGDI, +}; + +/* Drawing Primitives */ +const GCOps winGCOps = { + winFillSpansNativeGDI, + winSetSpansNativeGDI, + miPutImage, + miCopyArea, + miCopyPlane, + miPolyPoint, + winPolyLineNativeGDI, + miPolySegment, + miPolyRectangle, + miPolyArc, + miFillPolygon, + miPolyFillRect, + miPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + miImageGlyphBlt, + miPolyGlyphBlt, + miPushPixels +#ifdef NEED_LINEHELPER + ,NULL +#endif +}; + +/* See Porting Layer Definition - p. 45 */ +/* See mfb/mfbgc.c - mfbCreateGC() */ +/* See Strategies for Porting - pp. 15, 16 */ +Bool +winCreateGCNativeGDI (GCPtr pGC) +{ + fprintf (stderr, "\nwinCreateGC () depth: %d\n\n", + pGC->depth); + + pGC->clientClip = NULL; + pGC->clientClipType = CT_NONE; + + pGC->ops = (GCOps *) &winGCOps; + pGC->funcs = (GCFuncs *) &winGCFuncs; + + pGC->miTranslate = 0; + + /* + winGetRotatedPixmapNativeGDI(pGC) = 0; + winGetExposeNativeGDI(pGC) = 1; + winGetFreeCompClipNativeGDI(pGC) = 0; + winGetCompositeClipNativeGDI(pGC) = 0; + winGetGCPrivateNativeGDI(pGC)->bpp = BitsPerPixel (pGC->depth); + */ + return TRUE; +} + +/* See Porting Layer Definition - p. 45 */ +void +winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges) +{ + +} + +/* See Porting Layer Definition - pp. 45-46 */ +/* See mfb/mfbgc.c - mfbValidateGC() */ +/* See Strategies for Porting - pp. 15, 16 */ +void +winValidateGCNativeGDI (GCPtr pGC, + unsigned long dwChanges, + DrawablePtr pDrawable) +{ +#if 0 + PixmapPtr pPixmap; + int nIndex, iResult; + unsigned long dwMask = dwChanges; + HPEN hPen; + HBRUSH hBrush; + HBITMAP hBitmap; + DEBUG_FN_NAME("winValidateGC"); + DEBUGVARS; + //DEBUGPROC_MSG; + + fprintf (stderr, "winValidateGC - pDrawable: %08x, pGC: %08x\n", + pDrawable, pGC); + + switch (pDrawable->type) + { + case DRAWABLE_PIXMAP: + /* I can handle drawable pixmaps, no problem */ + pPixmap = (PixmapPtr) pDrawable; + + fprintf (stderr, "winValidateGC - pPixmap->devPrivate.ptr: %08x\n", + pPixmap->devPrivate.ptr); + + /* Select the bitmap into the memory device context. + NOTE: A bitmap can only be selected into a single + memory device context at a time. + */ + SelectObject (g_hdcMem, pPixmap->devPrivate.ptr); + + /* Sync the DC settings with the GC settings */ + switch (pGC->fillStyle) + { + case FillSolid: + /* Select a stock pen */ + if (pDrawable->depth == 1 && pGC->fgPixel) + { + SelectObject (g_hdcMem, GetStockObject (WHITE_PEN)); + } + else if (pDrawable->depth == 1 && !pGC->fgPixel) + { + SelectObject (g_hdcMem, GetStockObject (BLACK_PEN)); + } + else if (pGC->fgPixel) + { + SelectObject (g_hdcMem, CreatePen (PS_SOLID, 0, pGC->fgPixel)); + } + else + { + SelectObject (g_hdcMem, GetStockObject (BLACK_PEN)); + } + break; + case FillStippled: + break; + default: + break; + } + + break; + case DRAWABLE_WINDOW: + switch (pGC->fillStyle) + { + case FillTiled: + /* Need to select the tile into the memory DC */ + SelectObject (g_hdcMem, pGC->tile.pixmap->devPrivate.ptr); + + /* Blit the tile to a remote area of the screen */ + BitBlt (g_hdc, 64, 64, + pGC->tile.pixmap->drawable.width, + pGC->tile.pixmap->drawable.height, + g_hdcMem, + 0, 0, SRCCOPY); + DEBUG_MSG("Blitted the tile to a remote area of the screen"); + break; + case FillStippled: + case FillSolid: + default: + break; + } + break; + case UNDRAWABLE_WINDOW: + break; + case DRAWABLE_BUFFER: + break; + default: + break; + } + +#if 0 + /* Inspect changes to the GC */ + while (dwMask) + { + /* This peels off one change at a time */ + nIndex = lowbit (dwMask); + dwMask &= ~nIndex; + + switch (nIndex) + { + case GCFunction: + /* mfb falls through to GCForeground */ + fprintf (stderr, "winValidateGC - GCFunction\n"); + break; + case GCForeground: + fprintf (stderr, "winValidateGC - GCForeground\n"); + break; + case GCPlaneMask: + fprintf (stderr, "winValidateGC - GCPlaneMask\n"); + break; + case GCBackground: + fprintf (stderr, "winValidateGC - GCBackground\n"); + break; + case GCLineStyle: + case GCLineWidth: + case GCJoinStyle: + fprintf (stderr, "winValidateGC - GCLineStyle, etc.\n"); + break; + case GCCapStyle: + fprintf (stderr, "winValidateGC - GCCapStyle\n"); + break; + case GCFillStyle: + fprintf (stderr, "winValidateGC - GCFillStyle\n"); + break; + case GCFillRule: + fprintf (stderr, "winValidateGC - GCFillRule\n"); + break; + case GCTile: + fprintf (stderr, "winValidateGC - GCTile\n"); + break; + case GCStipple: + fprintf (stderr, "winValidateGC - GCStipple\n"); + break; + case GCTileStipXOrigin: + fprintf (stderr, "winValidateGC - GCTileStipXOrigin\n"); + break; + case GCTileStipYOrigin: + fprintf (stderr, "winValidateGC - GCTileStipYOrigin\n"); + break; + case GCFont: + fprintf (stderr, "winValidateGC - GCFont\n"); + break; + case GCSubwindowMode: + fprintf (stderr, "winValidateGC - GCSubwindowMode\n"); + break; + case GCGraphicsExposures: + fprintf (stderr, "winValidateGC - GCGraphicsExposures\n"); + break; + case GCClipXOrigin: + fprintf (stderr, "winValidateGC - GCClipXOrigin\n"); + break; + case GCClipYOrigin: + fprintf (stderr, "winValidateGC - GCClipYOrigin\n"); + break; + case GCClipMask: + fprintf (stderr, "winValidateGC - GCClipMask\n"); + break; + case GCDashOffset: + fprintf (stderr, "winValidateGC - GCDashOffset\n"); + break; + case GCDashList: + fprintf (stderr, "winValidateGC - GCDashList\n"); + break; + case GCArcMode: + fprintf (stderr, "winValidateGC - GCArcMode\n"); + break; + default: + fprintf (stderr, "winValidateGC - default\n"); + break; + } + } +#endif +#endif +} + +/* See Porting Layer Definition - p. 46 */ +void +winCopyGCNativeGDI (GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst) +{ + +} + +/* See Porting Layer Definition - p. 46 */ +void +winDestroyGCNativeGDI (GCPtr pGC) +{ + +} + +/* See Porting Layer Definition - p. 46 */ +void +winChangeClipNativeGDI (GCPtr pGC, int nType, char *pValue, int nRects) +{ + +} + +/* See Porting Layer Definition - p. 47 */ +void +winDestroyClipNativeGDI (GCPtr pGC) +{ + +} + +/* See Porting Layer Definition - p. 47 */ +void +winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc) +{ + +} diff --git a/xc/programs/Xserver/hw/xwin/wingetsp.c b/xc/programs/Xserver/hw/xwin/wingetsp.c new file mode 100644 index 000000000..25613fab3 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/wingetsp.c @@ -0,0 +1,100 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wingetsp.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 55 */ +void +winGetSpansNativeGDI (DrawablePtr pDrawable, + int nMax, + DDXPointPtr pPoints, + int *pWidths, + int nSpans, + char *pDsts) +{ +#if 0 + int iIdx; + DDXPointPtr pPoint = NULL; + int *pWidth = NULL; + char *pDst = pDsts; + int iScanlineBytes; + int iBitmapBytes; + BITMAPINFOHEADER bmih; + DEBUG_FN_NAME("winGetSpans"); + DEBUGVARS; + DEBUGPROC_MSG; + + /* Setup the bitmap header info */ + bmih.biSize = sizeof (bmih); + bmih.biWidth = pDrawable->width; + bmih.biHeight = pDrawable->height; + bmih.biPlanes = 1; + bmih.biBitCount = pDrawable->depth; + bmih.biCompression = BI_RGB; + bmih.biSizeImage = 0; + bmih.biXPelsPerMeter = 0; + bmih.biYPelsPerMeter = 0; + bmih.biClrUsed = 0; + bmih.biClrImportant = 0; + + fprintf (stderr, "winGetSpans () - pDrawable: %08x\n", + pDrawable); + + /* Calculate the number of bytes in each scanline */ + iScanlineBytes = 4 * ((pDrawable->width * pDrawable->depth + 31) / 32); + + /* Calculate the number of bytes in the bitmap */ + iBitmapBytes = iScanlineBytes * pDrawable->height; + + /* + fprintf (stderr, "winGetSpans () - iBitmapBytes: %d\n", + iBitmapBytes); + */ + + /* Loop through spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + pPoint = pPoints + iIdx; + pWidth = pWidths + iIdx; + + /* Drawable should be in g_hdcMem */ + GetDIBits (hdcMem, ((PixmapPtr)pDrawable)->devPrivate.ptr, + pPoint->y, 1, pDst, &bmih, 0); + + fprintf (stderr, "(%dx%dx%d) (%d,%d) w: %d\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *pWidth); + + /* Calculate offset of next bit destination */ + pDst += 4 * ((*pWidth + 31) / 32); + } +#endif +} diff --git a/xc/programs/Xserver/hw/xwin/winkeymap.h b/xc/programs/Xserver/hw/xwin/winkeymap.h index c4a6ee779..71ffc128f 100644 --- a/xc/programs/Xserver/hw/xwin/winkeymap.h +++ b/xc/programs/Xserver/hw/xwin/winkeymap.h @@ -1,163 +1,400 @@ -/* $XFree86: xc/programs/Xserver/hw/xwin/winkeymap.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ /* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. * - * For Scancodes see notes in atKeynames.h !!!! + *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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II */ -/* $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, +/* $XFree86: xc/programs/Xserver/hw/xwin/winkeymap.h,v 1.2 2001/04/05 20:13:49 dawes Exp $ */ + +/* This table maps Windows Virtual Key Codes to X11 KeySyms. + + To map a particular VKey, lookup the value of the VKey + in MSDN Library->Platform SDK->User Interface Services-> + Windows User Interface->User Input->Virtual-Key Codes, + find the array position corresponding to the VKey code + (e.g. 0x09 for VK_TAB), and fill in the first column + in that row with the primary key cap, the second column + with the secondary key (shift), and so on. Note that + there are not generally any symbols in the third and fourth + columns of a particular row. + + Lookup the XK constants in xc/include/keysymdef.h. +*/ +static KeySym g_winKeySym[NUM_KEYCODES * GLYPHS_PER_KEY] = { + /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x01 through 0x06 are mouse buttons */ + /* 0x01 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x02 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x03 */ XK_Cancel, NoSymbol, NoSymbol, NoSymbol, + /* 0x04 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x05 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x06 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x07 undefined */ + /* 0x07 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x08 */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, + /* 0x09 */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, + + /* 0x0a through 0x0b reserved */ + /* 0x0a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x0b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x0c */ XK_Clear, NoSymbol, NoSymbol, NoSymbol, + /* 0x0d */ XK_Return, NoSymbol, NoSymbol, NoSymbol, + + /* 0x0e through 0x0f undefined */ + /* We use 0x0e for the numeric keypad return key */ + /* 0x0e */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, + /* 0x0f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x10, 0x11, and 0x12 are Shift, Control, and Alt, but we don't use + them because they do not distinquish between Left and Right keys. + + See keys 0xa0 through 0xa5 for Shift, Control, and Alt symbols. + */ + /* 0x10 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x11 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x12 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x13 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, + /* 0x14 */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, + /* 0x15 */ XK_Kana_Lock, NoSymbol, NoSymbol, NoSymbol, + + /* 0x16 undefined */ + /* 0x16 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* I don't know what to pass for Junja and Final mode keys, + so I'm just passing a mode siwtch. + */ + /* 0x19 for Kanji mode may be the wrong symbol */ + /* 0x17 */ XK_Mode_switch, NoSymbol, NoSymbol, NoSymbol, + /* 0x18 */ XK_Mode_switch, NoSymbol, NoSymbol, NoSymbol, + /* 0x19 */ XK_Kanji, NoSymbol, NoSymbol, NoSymbol, + + /* 0x1a undefined */ + /* 0x1a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x1c, 0x1d, and 0x1e are probably wrong. + Having a symbol passed at least allows people to map the key + to something more useful. + */ + /* 0x1b */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, + /* 0x1c */ XK_Henkan, NoSymbol, NoSymbol, NoSymbol, + /* 0x1d */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol, + /* 0x1e */ XK_Kanji_Bangou,NoSymbol, NoSymbol, NoSymbol, + /* 0x1f */ XK_Mode_switch, NoSymbol, NoSymbol, NoSymbol, + /* 0x20 */ XK_space, NoSymbol, NoSymbol, NoSymbol, + /* 0x21 */ XK_Page_Up, NoSymbol, NoSymbol, NoSymbol, + /* 0x22 */ XK_Page_Down, NoSymbol, NoSymbol, NoSymbol, + /* 0x23 */ XK_End, NoSymbol, NoSymbol, NoSymbol, + /* 0x24 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, + /* 0x25 */ XK_Left, NoSymbol, NoSymbol, NoSymbol, + /* 0x26 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, + /* 0x27 */ XK_Right, NoSymbol, NoSymbol, NoSymbol, + /* 0x28 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, + /* 0x29 */ XK_Select, NoSymbol, NoSymbol, NoSymbol, + /* 0x2a */ XK_Print, NoSymbol, NoSymbol, NoSymbol, + /* 0x2b */ XK_Execute, NoSymbol, NoSymbol, NoSymbol, + /* 0x2c */ XK_Print, NoSymbol, NoSymbol, NoSymbol, + /* 0x2d */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, + /* 0x2e */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, + /* 0x2f */ XK_Help, NoSymbol, NoSymbol, NoSymbol, + /* 0x30 */ XK_0, XK_parenright, NoSymbol, NoSymbol, + /* 0x31 */ XK_1, XK_exclam, NoSymbol, NoSymbol, + /* 0x32 */ XK_2, XK_at, NoSymbol, NoSymbol, + /* 0x33 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, + /* 0x34 */ XK_4, XK_dollar, NoSymbol, NoSymbol, + /* 0x35 */ XK_5, XK_percent, NoSymbol, NoSymbol, + /* 0x36 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, + /* 0x37 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, + /* 0x38 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, + /* 0x39 */ XK_9, XK_parenleft, NoSymbol, NoSymbol, + + /* 0x3a through 0x40 undefined */ + /* 0x3a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x3b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x3c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x3d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x3e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x3f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x40 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x41 */ XK_A, NoSymbol, NoSymbol, NoSymbol, + /* 0x42 */ XK_B, NoSymbol, NoSymbol, NoSymbol, + /* 0x43 */ XK_C, NoSymbol, NoSymbol, NoSymbol, + /* 0x44 */ XK_D, NoSymbol, NoSymbol, NoSymbol, + /* 0x45 */ XK_E, NoSymbol, NoSymbol, NoSymbol, + /* 0x46 */ XK_F, NoSymbol, NoSymbol, NoSymbol, + /* 0x47 */ XK_G, NoSymbol, NoSymbol, NoSymbol, + /* 0x48 */ XK_H, NoSymbol, NoSymbol, NoSymbol, + /* 0x49 */ XK_I, NoSymbol, NoSymbol, NoSymbol, + /* 0x4a */ XK_J, NoSymbol, NoSymbol, NoSymbol, + /* 0x4b */ XK_K, NoSymbol, NoSymbol, NoSymbol, + /* 0x4c */ XK_L, NoSymbol, NoSymbol, NoSymbol, + /* 0x4d */ XK_M, NoSymbol, NoSymbol, NoSymbol, + /* 0x4e */ XK_N, NoSymbol, NoSymbol, NoSymbol, + /* 0x4f */ XK_O, NoSymbol, NoSymbol, NoSymbol, + /* 0x50 */ XK_P, NoSymbol, NoSymbol, NoSymbol, + /* 0x51 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, + /* 0x52 */ XK_R, NoSymbol, NoSymbol, NoSymbol, + /* 0x53 */ XK_S, NoSymbol, NoSymbol, NoSymbol, + /* 0x54 */ XK_T, NoSymbol, NoSymbol, NoSymbol, + /* 0x55 */ XK_U, NoSymbol, NoSymbol, NoSymbol, + /* 0x56 */ XK_V, NoSymbol, NoSymbol, NoSymbol, + /* 0x57 */ XK_W, NoSymbol, NoSymbol, NoSymbol, + /* 0x58 */ XK_X, NoSymbol, NoSymbol, NoSymbol, + /* 0x59 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, + /* 0x5a */ XK_Z, NoSymbol, NoSymbol, NoSymbol, + + /* 0x5b through 0x5f undefined */ + /* 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_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, + /* 0x61 */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, + /* 0x62 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, + /* 0x63 */ XK_KP_Page_Down,XK_KP_3, NoSymbol, NoSymbol, + /* 0x64 */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, + /* 0x65 */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, + /* 0x66 */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, + /* 0x67 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, + /* 0x68 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, + /* 0x69 */ XK_KP_Page_Up, XK_KP_9, NoSymbol, NoSymbol, + /* 0x6a */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, + /* 0x6b */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, + /* 0x6c */ XK_KP_Separator,NoSymbol, NoSymbol, NoSymbol, + /* 0x6d */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, + /* 0x6e */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, + /* 0x6f */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, + /* 0x70 */ XK_F1, NoSymbol, NoSymbol, NoSymbol, + /* 0x71 */ XK_F2, NoSymbol, NoSymbol, NoSymbol, + /* 0x72 */ XK_F3, NoSymbol, NoSymbol, NoSymbol, + /* 0x73 */ XK_F4, NoSymbol, NoSymbol, NoSymbol, + /* 0x74 */ XK_F5, NoSymbol, NoSymbol, NoSymbol, + /* 0x75 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, + /* 0x76 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, + /* 0x77 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, + /* 0x78 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, + /* 0x79 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, + /* 0x7a */ XK_F11, NoSymbol, NoSymbol, NoSymbol, + /* 0x7b */ XK_F12, NoSymbol, NoSymbol, NoSymbol, + /* 0x7c */ XK_F13, NoSymbol, NoSymbol, NoSymbol, + /* 0x7d */ XK_F14, NoSymbol, NoSymbol, NoSymbol, + /* 0x7e */ XK_F15, NoSymbol, NoSymbol, NoSymbol, + /* 0x7f */ XK_F16, NoSymbol, NoSymbol, NoSymbol, + /* 0x80 */ XK_F17, NoSymbol, NoSymbol, NoSymbol, + /* 0x81 */ XK_F18, NoSymbol, NoSymbol, NoSymbol, + /* 0x82 */ XK_F19, NoSymbol, NoSymbol, NoSymbol, + /* 0x83 */ XK_F20, NoSymbol, NoSymbol, NoSymbol, + /* 0x84 */ XK_F21, NoSymbol, NoSymbol, NoSymbol, + /* 0x85 */ XK_F22, NoSymbol, NoSymbol, NoSymbol, + /* 0x86 */ XK_F23, NoSymbol, NoSymbol, NoSymbol, + /* 0x87 */ XK_F24, NoSymbol, NoSymbol, NoSymbol, + + /* 0x88 through 0x8f unassigned */ + /* 0x88 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x89 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x8a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x8b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x8c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x8d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x8e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x8f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x90 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, + /* 0x91 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, + + /* 0x92 through 0x96 OEM specific */ + /* 0x92 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x93 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x94 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x95 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x96 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0x97 through 0x9f unassigned */ + /* 0x97 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x98 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x99 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x9a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x9b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x9c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x9d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x9e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x9f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xa0 */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, + /* 0xa1 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, + /* 0xa2 */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, + /* 0xa3 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, + /* 0xa4 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, + /* 0xa5 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, + + /* 0xa6 through 0xb7 are MS Natural Keyboard Pro browser buttons, etc. */ + /* 0xa6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xa7 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xa8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xa9 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xaa */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xab */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xac */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xad */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xae */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xaf */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb1 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb3 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb5 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb7 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xb8 through 0xb9 reserved */ + /* 0xb8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xb9 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xba */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, + /* 0xbb */ XK_equal, XK_plus, NoSymbol, NoSymbol, + /* 0xbc */ XK_comma, XK_less, NoSymbol, NoSymbol, + /* 0xbd */ XK_minus, XK_underscore, NoSymbol, NoSymbol, + /* 0xbe */ XK_period, XK_greater, NoSymbol, NoSymbol, + /* 0xbf */ XK_slash, XK_question, NoSymbol, NoSymbol, + /* 0xc0 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, + + /* 0xc1 through 0xd7 reserved */ + /* 0xc1 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xc2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xc3 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xc4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xc5 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xc6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xc7 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xc8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xc9 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xca */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xcb */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xcc */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xcd */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xce */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xcf */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd1 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd3 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd5 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd7 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xd8 through 0xda unassigned */ + /* 0xd8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xd9 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xda */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xdb */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, + /* 0xdc */ XK_backslash, XK_bar, NoSymbol, NoSymbol, + /* 0xdd */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, + /* 0xde */ XK_apostrophe, XK_quotedbl, NoSymbol, NoSymbol, + /* 0xdf */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe0 reserved */ + /* 0xe0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe1 OEM specific */ + /* 0xe1 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe3 through 0xe4 OEM specific */ + /* 0xe3 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xe4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe5 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe6 OEM specific */ + /* 0xe6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe7 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe8 unassigned */ + /* 0xe8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xe9 through 0xf5 OEM specific */ + /* 0xe9 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xea */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xeb */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xec */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xed */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xef */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf0 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf1 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf2 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf3 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf4 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf5 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* 0xf6 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf7 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf8 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xf9 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xfa */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xfb */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xfc */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xfd */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xfe */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0xff */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + + /* For X Server NumLock handling */ + /* 0x100 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol, + /* 0x101 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol, + /* 0x102 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol, + /* 0x103 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol, + /* 0x104 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol, + /* 0x105 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol, + /* 0x106 */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol, + /* 0x107 */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol, + /* 0x108 */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol, + /* 0x109 */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol, + /* 0x10a */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol, + /* 0x10b */ XK_KP_Home, NoSymbol, NoSymbol, NoSymbol, + /* 0x10c */ XK_KP_Up, NoSymbol, NoSymbol, NoSymbol, + /* 0x10d */ XK_KP_Prior, NoSymbol, NoSymbol, NoSymbol, + /* 0x10e */ XK_KP_Left, NoSymbol, NoSymbol, NoSymbol, + /* 0x10f */ XK_KP_Begin, NoSymbol, NoSymbol, NoSymbol, + /* 0x110 */ XK_KP_Right, NoSymbol, NoSymbol, NoSymbol, + /* 0x111 */ XK_KP_End, NoSymbol, NoSymbol, NoSymbol, + /* 0x112 */ XK_KP_Down, NoSymbol, NoSymbol, NoSymbol, + /* 0x113 */ XK_KP_Next, NoSymbol, NoSymbol, NoSymbol, + /* 0x114 */ XK_KP_Insert, NoSymbol, NoSymbol, NoSymbol, + /* 0x115 */ XK_KP_Delete, NoSymbol, NoSymbol, NoSymbol }; diff --git a/xc/programs/Xserver/hw/xwin/winmisc.c b/xc/programs/Xserver/hw/xwin/winmisc.c new file mode 100644 index 000000000..67c5f86eb --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winmisc.c @@ -0,0 +1,59 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 33 */ +/* Called by clients, returns the best size for a cursor, tile, or + stipple, specified by class (sometimes called kind) */ +void +winQueryBestSizeNativeGDI (int class, unsigned short *pWidth, + unsigned short *pHeight, ScreenPtr pScreen) +{ + fprintf (stderr, "winQueryBestSize()\n"); +} + +/* + Count the number of one bits in a color mask. +*/ +CARD8 +winCountBits (DWORD dw) +{ + DWORD dwBits = 0; + + while (dw) + { + dwBits += (dw & 1); + dw >>= 1; + } + + return dwBits; +} diff --git a/xc/programs/Xserver/hw/xwin/winms.h b/xc/programs/Xserver/hw/xwin/winms.h new file mode 100644 index 000000000..bc11dda51 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winms.h @@ -0,0 +1,59 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winms.h,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#ifndef _WINMS_H_ +#define _WINMS_H_ + +#undef MINSHORT +#undef MAXSHORT +#undef CARD8 +#undef INT32 +#undef ATOM + +#define NONAMELESSUNION +#define DIRECTDRAW_VERSION 0x0300 + +#include <windows.h> +#include <windowsx.h> +//#include <wtypes.h> + +#include "obj_base.h" +#include "ddraw.h" + +/* + * Undefine unneeded Windows symbols that conflict + * with X symbols + */ + +#undef CreateWindow +#undef FreeResource + +#endif /* _WINMS_H_ */ diff --git a/xc/programs/Xserver/hw/xwin/winpfbdd.c b/xc/programs/Xserver/hw/xwin/winpfbdd.c new file mode 100644 index 000000000..d0f21810d --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winpfbdd.c @@ -0,0 +1,409 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpfbdd.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* + Create a DirectDraw primary surface +*/ +Bool +winAllocateFBPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC ddsd; + DDSURFACEDESC *pddsdPrimary = NULL; + DDSURFACEDESC *pddsdOffscreen = NULL; + RECT rcClient; + + ErrorF ("winAllocateFBPrimaryDD ()\n"); + + /* Get client area location in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = DirectDrawCreate (NULL, &pScreenPriv->pdd, NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBPrimaryDD () - Could not start DirectDraw\n"); + + ErrorF ("winAllocateFBPrimaryDD () - Created and initialized DD\n"); + + /* Are we windowed or fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* Full screen mode */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, + pScreenPriv->hwndScreen, + DDSCL_FULLSCREEN + | DDSCL_EXCLUSIVE); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + "cooperative level\n"); + + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw_SetDisplayMode (pScreenPriv->pdd, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + "full screen display mode\n"); + } + else + { + /* Windowed mode */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + "cooperative level\n"); + } + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD () - Could not create primary "\ + "surface %08x\n", ddrval); + + ErrorF ("winAllocateFBPrimaryDD () - Created primary\n"); + + /* Allocate a DD surface description for our screen privates */ + pddsdPrimary = pScreenPriv->pddsdPrimary + = xalloc (sizeof (DDSURFACEDESC)); + if (pddsdPrimary == NULL) + FatalError ("winAllocateFBPrimaryDD () - Could not allocate surface "\ + "description memory\n"); + ZeroMemory (pddsdPrimary, sizeof (*pddsdPrimary)); + pddsdPrimary->dwSize = sizeof (*pddsdPrimary); + + /* Describe the offscreen surface to be created */ + /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, + as drawing, locking, and unlocking take forever + with video memory surfaces. In addition, + video memory is a somewhat scarce resource, + so you shouldn't be allocating video memory when + you could use system memory instead. + */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsd.dwHeight = pScreenInfo->dwHeight; + ddsd.dwWidth = pScreenInfo->dwWidth; + + /* Create the shadow surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, + &ddsd, + &pScreenPriv->pddsOffscreen, + NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBPrimaryDD () - Could not create shadow "\ + "surface\n"); + + ErrorF ("winAllocateFBPrimaryDD () - Created offscreen\n"); + + /* Allocate a DD surface description for our screen privates */ + pddsdOffscreen = pScreenPriv->pddsdOffscreen + = xalloc (sizeof (DDSURFACEDESC)); + if (pddsdOffscreen == NULL) + FatalError ("winAllocateFBPrimaryDD () - Could not allocate surface "\ + "description memory\n"); + ZeroMemory (pddsdOffscreen, sizeof (*pddsdOffscreen)); + pddsdOffscreen->dwSize = sizeof (*pddsdOffscreen); + + ErrorF ("winAllocateFBPrimaryDD () - Locking primary\n"); + + /* Lock the primary surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsPrimary, + pScreenInfo->fFullScreen ? NULL:&rcClient, + pddsdPrimary, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL) + FatalError ("winAllocateFBPrimaryDD () - Could not lock "\ + "primary surface\n"); + + ErrorF ("winAllocateFBPrimaryDD () - Locked primary\n"); + + /* We don't know how to deal with anything other than RGB */ + if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB)) + FatalError ("winAllocateFBPrimaryDD () - Color format other than RGB\n"); + + /* Grab the pitch, and memory pointer from the surface desc */ + pScreenInfo->dwStrideBytes = pddsdPrimary->u.lPitch; + pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) + / pScreenInfo->dwDepth; + pScreenInfo->pfb = pddsdPrimary->lpSurface; + + /* Grab the color depth and masks from the surface description */ + pScreenInfo->dwDepth = pddsdPrimary->ddpfPixelFormat.u.dwRGBBitCount; + pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask; + + ErrorF ("winAllocateFBPrimaryDD () - Returning\n"); + + return TRUE; +} + +/* + Call the wrapped CloseScreen function. + + Free our resources and private structures. +*/ +Bool +winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + + ErrorF ("winCloseScreenPrimaryDD () - Freeing screen resources\n"); + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + pScreen->CloseScreen = pScreenPriv->CloseScreen; + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the offscreen surface, if there is one */ + if (pScreenPriv->pddsOffscreen) + { + IDirectDrawSurface_Unlock (pScreenPriv->pddsOffscreen, NULL); + IDirectDrawSurface_Release (pScreenPriv->pddsOffscreen); + pScreenPriv->pddsOffscreen = NULL; + } + + /* Release the primary surface, if there is one */ + if (pScreenPriv->pddsPrimary) + { + IDirectDrawSurface_Unlock (pScreenPriv->pddsPrimary, NULL); + IDirectDrawSurface_Release (pScreenPriv->pddsPrimary); + pScreenPriv->pddsPrimary = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Redisplay the Windows cursor */ + if (!pScreenPriv->fCursor) + ShowCursor (TRUE); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; + + /* Free the screen privates for this screen */ + xfree ((pointer) pScreenPriv); + + return fReturn; +} + +/* + Tell mi what sort of visuals we need. + + Generally we only need one visual, as our screen can only + handle one format at a time, I believe. You may want + to verify that last sentence. +*/ +Bool +winInitVisualsPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + ErrorF ("winInitVisualsPrimaryDD () - Masks: %08x %08x %08x bpRGB: %d\n", + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask, + pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisualsPrimaryDD () - miSetVisualTypesAndMasks failed\n"); + } + break; + + case 8: + ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisualsPrimaryDD () - miSetVisualTypesAndMasks failed\n"); + } + ErrorF ("winInitVisualsPrimaryDD () - Returned from miSetVisualTypesAndMasks\n"); + break; + + default: + break; + } + + /* Set DPI info */ + pScreenInfo->dwDPIx = 100; + pScreenInfo->dwDPIy = 100; + + ErrorF ("winInitVisualsPrimaryDD () - Returning\n"); + + return TRUE; +} + +Bool +winAdjustVideoModePrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwDepth; + + /* Are we fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* We don't need to adjust the video mode for fullscreen */ + return TRUE; + } + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + return FALSE; + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Is GDI using a depth different than command line parameter? */ + if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than depth specified */ + ErrorF ("winAdjustVideoModePrimaryDD () - Command line depth: %d, "\ + "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + + /* We'll use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + + /* Release our DC */ + ReleaseDC ((HDC) hdc, NULL); + + return TRUE; +} + +/* Set engine specific functions */ +Bool +winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD; + pScreenPriv->pwinShadowUpdateProc + = (winShadowUpdateProc) (void (*)())NoopDDA; + pScreenPriv->pwinShadowWindowProc + = (winShadowWindowProc) (void (*)())NoopDDA; + pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD; + pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/winpixmap.c b/xc/programs/Xserver/hw/xwin/winpixmap.c new file mode 100644 index 000000000..9b008a514 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winpixmap.c @@ -0,0 +1,163 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: drewry, september 1986 + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpixmap.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 34 */ +/* See mfb/mfbpixmap.c - mfbCreatePixmap() */ +PixmapPtr +winCreatePixmapNativeGDI (ScreenPtr pScreen, + int nWidth, int nHeight, + int nDepth) +{ +#ifdef CYGX_GDI + PixmapPtr pPixmap; + HBITMAP hBitmap; + BITMAPINFOHEADER bmih; + + fprintf (stderr, "winCreatePixmap()\n"); + + /* FIXME: For now we create all pixmaps in system memory. Pixmaps + with the same depth as the screen depth can be created in offscreen + video memory. It is a simple optimization, but an easy one to + screw up, so I'm leaving it out in this first implementation + */ + + /* Setup the bitmap header info */ + bmih.biSize = sizeof (bmih); + bmih.biWidth = nWidth; + bmih.biHeight = nHeight; + bmih.biPlanes = 1; + bmih.biBitCount = nDepth; + bmih.biCompression = BI_RGB; + bmih.biSizeImage = 0; + bmih.biXPelsPerMeter = 0; + bmih.biYPelsPerMeter = 0; + bmih.biClrUsed = 0; + bmih.biClrImportant = 0; + + /* Create the bitmap */ + if (nDepth == 1) + { + hBitmap = CreateDIBitmap (NULL, &bmih, 0, NULL, NULL, 0); + } + else + { + hBitmap = CreateDIBitmap (g_hdcMem, &bmih, 0, NULL, NULL, 0); + } + + /* Allocate a pixmap structure */ + pPixmap = (PixmapPtr) xalloc (sizeof (PixmapRec)); + if (!pPixmap) + return NullPixmap; + + /* Set other fields of the pixmap, all fields must be set to + valid values */ + pPixmap->drawable.type = DRAWABLE_PIXMAP; + pPixmap->drawable.class = 0; + pPixmap->drawable.pScreen = pScreen; + pPixmap->drawable.depth = nDepth; + pPixmap->drawable.bitsPerPixel = BitsPerPixel (nDepth); + pPixmap->drawable.id = 0; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pPixmap->drawable.x = 0; + pPixmap->drawable.y = 0; + pPixmap->drawable.width = nWidth; + pPixmap->drawable.height = nHeight; + pPixmap->devKind = nWidth; // Was paddedWidth in mfb + pPixmap->refcnt = 1; + + /* We will use devPrivate to point to our bitmap */ + pPixmap->devPrivate.ptr = hBitmap; + + fprintf (stderr, "winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for screen: %08x\n", + hBitmap, nWidth, nHeight, nDepth, pScreen); + + return pPixmap; +#else /* CYGX_GDI */ + return NULL; +#endif /* CYGX_GDI */ +} + +/* See Porting Layer Definition - p. 35 */ +/* See mfb/mfbpixmap.c - mfbDestroyPixmap() */ +Bool +winDestroyPixmapNativeGDI (PixmapPtr pPixmap) +{ + HBITMAP hBitmap; + + fprintf (stderr, "winDestroyPixmap - pPixmap->devPrivate.ptr: %08x\n", + pPixmap->devPrivate.ptr); + + /* Decrement reference count, and, if zero, free the pixmap */ + --(pPixmap->refcnt); + + /* Are there any more references to this pixmap? */ + if (pPixmap->refcnt == 0) + { + /* Free GDI bitmap */ + hBitmap = pPixmap->devPrivate.ptr; + if (hBitmap) DeleteObject (hBitmap); + hBitmap = NULL; + + /* Free the PixmapRec */ + xfree (pPixmap); + pPixmap = NULL; + } + + return TRUE; +} + +/* See cfb/cfbpixmap.c */ +void +winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw) +{ + fprintf (stderr, "winXRotatePixmap()\n"); + /* fill in this function, look at CFB */ +} + +/* See cfb/cfbpixmap.c */ +void +winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh) +{ + fprintf (stderr, "winYRotatePixmap()\n"); + /* fill in this function, look at CFB */ +} + +/* See cfb/cfbpixmap.c */ +void +winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix, + int xrot, int yrot) +{ + fprintf (stderr, "winCopyRotatePixmap()\n"); + /* fill in this function, look at CFB */ +} diff --git a/xc/programs/Xserver/hw/xwin/winpntwin.c b/xc/programs/Xserver/hw/xwin/winpntwin.c new file mode 100644 index 000000000..248567931 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winpntwin.c @@ -0,0 +1,45 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpntwin.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 39 + * Sometimes implemented as two functions: + * PaintWindowBackground (nKind = PW_BACKGROUND) + * PaintWindowBorder (nKind = PW_BORDER) + */ +void +winPaintWindowNativeGDI (WindowPtr pWin, + RegionPtr pRegion, + int nKind) +{ + fprintf (stderr, "winPaintWindow()\n"); +} diff --git a/xc/programs/Xserver/hw/xwin/winpolyline.c b/xc/programs/Xserver/hw/xwin/winpolyline.c new file mode 100644 index 000000000..ae2420a6a --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winpolyline.c @@ -0,0 +1,43 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpolyline.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 50 */ +void +winPolyLineNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt) +{ + fprintf (stderr, "winPolyLine()\n"); +} diff --git a/xc/programs/Xserver/hw/xwin/winscrinit.c b/xc/programs/Xserver/hw/xwin/winscrinit.c new file mode 100644 index 000000000..6d2ae20fe --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winscrinit.c @@ -0,0 +1,865 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* + * Create a full screen window + */ +void +winCreateBoundingWindowFullScreen (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + int iWidth = pScreenInfo->dwWidth; + int iHeight = pScreenInfo->dwHeight; + HWND *phwnd = &pScreenPriv->hwndScreen; + WNDCLASS wc; + + ErrorF ("winCreateBoundingWindowFullScreen ()\n"); + + /* Setup our window class */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = winWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = GetModuleHandle (NULL); + wc.hIcon = 0; + wc.hCursor = 0; + wc.hbrBackground = 0; + wc.lpszMenuName = NULL; + wc.lpszClassName = WINDOW_CLASS; + RegisterClass (&wc); + + /* Create the window */ + *phwnd = CreateWindowExA (WS_EX_TOPMOST, // Extended styles + WINDOW_CLASS, // Class name + WINDOW_TITLE, // Window name + WS_POPUP, + 0, // Horizontal position + 0, // Vertical position + iWidth, // Right edge + iHeight, // Bottom edge + (HWND) NULL, // No parent or owner window + (HMENU) NULL, // No menu + GetModuleHandle (NULL),// Instance handle + pScreenPriv); // ScreenPrivates + + /* Branch on the server engine */ + switch (pScreenInfo->dwEngine) + { + case WIN_SERVER_SHADOW_GDI: + /* Show the window */ + ShowWindow (*phwnd, SW_SHOWMAXIMIZED); + break; + + default: + /* Hide the window */ + ShowWindow (*phwnd, SW_HIDE); + break; + } + + /* Send first paint message */ + UpdateWindow (*phwnd); + + /* Attempt to bring our window to the top of the display */ + BringWindowToTop (*phwnd); +} + +/* + * Create our primary Windows display window + */ +void +winCreateBoundingWindowWindowed (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + int iWidth = pScreenInfo->dwWidth; + int iHeight = pScreenInfo->dwHeight; + HWND *phwnd = &pScreenPriv->hwndScreen; + WNDCLASS wc; + RECT rcClient, rcWorkArea; + + /* Setup our window class */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = winWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = GetModuleHandle (NULL); + wc.hIcon = 0; + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = WINDOW_CLASS; + RegisterClass (&wc); + + /* Get size of work area */ + SystemParametersInfo (SPI_GETWORKAREA, 0, &rcWorkArea, 0); + + ErrorF ("winCreateBoundingWindowWindowed () - WorkArea width %d height %d\n", + rcWorkArea.right - rcWorkArea.left, + rcWorkArea.bottom - rcWorkArea.top); + + + /* Adjust the window width and height for border and title bars */ + iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME); + iHeight += 2 * GetSystemMetrics (SM_CYFIXEDFRAME) + + GetSystemMetrics (SM_CYCAPTION); + + /* Trim window width to fit work area */ + if (iWidth > (rcWorkArea.right - rcWorkArea.left)) + { + iWidth = rcWorkArea.right - rcWorkArea.left; + pScreenInfo->dwWidth = iWidth - + 2 * GetSystemMetrics (SM_CXFIXEDFRAME); + } + + /* Trim window height to fit work area */ + if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top)) + { + /* FIXME: Currently chopping 1 off the maximum height + to allow hidden start bars to pop up when the mouse + reaches the bottom of the screen. + + This only works if the start menu is at the bottom + of the screen. + */ + iHeight = rcWorkArea.bottom - rcWorkArea.top - 1; + pScreenInfo->dwHeight = iHeight + - 2 * GetSystemMetrics (SM_CYFIXEDFRAME) + - GetSystemMetrics (SM_CYCAPTION); + } + + ErrorF ("winCreateBoundingWindowWindowed () - Adjusted width: %d "\ + "height: %d\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight); + + /* Create the window */ + *phwnd = CreateWindowExA (0, // Extended styles + WINDOW_CLASS, // Class name + WINDOW_TITLE, // Window name + WS_OVERLAPPED + | WS_CAPTION + | WS_SYSMENU + | WS_MINIMIZEBOX, // Almost an OverlappedWindow + 0, // Horizontal position + 0, // Vertical position + iWidth, // Right edge + iHeight, // Bottom edge + (HWND) NULL, // No parent or owner window + (HMENU) NULL, // No menu + GetModuleHandle (NULL),// Instance handle + pScreenPriv); // ScreenPrivates + + /* Get the client area coordinates */ + GetClientRect (*phwnd, &rcClient); + ErrorF ("winCreateBoundingWindowWindowed () - WindowClient "\ + "width %d height %d\n", + rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top); + MapWindowPoints (*phwnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2); + + /* Show the window */ + ShowWindow (*phwnd, SW_SHOW); + UpdateWindow (*phwnd); + + /* Attempt to bring our window to the top of the display */ + BringWindowToTop (*phwnd); + + ErrorF ("winCreateBoundingWindowWindowed () - Returning\n"); + + /* Hide that Windows cursor */ + //ShowCursor (FALSE); +} + +/* Determine what type of screen we are initializing + and call the appropriate procedure to intiailize + that type of screen. +*/ +Bool +winScreenInit (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenInfoPtr pScreenInfo = &g_winScreens[index]; + winPrivScreenPtr pScreenPriv; + + /* Allocate privates for this screen */ + winAllocatePrivates (pScreen); + + /* Get a pointer to the privates structure that was allocated */ + pScreenPriv = winGetScreenPriv (pScreen); + + /* Save a pointer to this screen in the screen info structure */ + pScreenInfo->pScreen = pScreen; + + /* Save a pointer to the screen info in the screen privates structure */ + /* This allows us to get back to the screen info from a sceen pointer */ + pScreenPriv->pScreenInfo = pScreenInfo; + + /* Detect which engines are supported */ + winDetectSupportedEngines (pScreen); + + /* Determine which engine to use */ + if (!winSetEngine (pScreen)) + return FALSE; + + /* Adjust the video mode for our engine type */ + if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) + return FALSE; + + /* Call the engine dependent screen initialization procedure */ + if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) + return FALSE; + + return TRUE; +} + +/* See Porting Layer Definition - p. 20 */ +Bool +winFinishScreenInitFB (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenInfoPtr pScreenInfo = &g_winScreens[index]; + Bool fReturn = TRUE; + char *pbits = NULL; + winPrivScreenPtr pScreenPriv; + + //#if 0 + /* Allocate privates for this screen */ + winAllocatePrivates (pScreen); + + /* Get a pointer to the privates structure that was allocated */ + pScreenPriv = winGetScreenPriv (pScreen); + + /* Save a pointer to this screen in the screen info structure */ + pScreenInfo->pScreen = pScreen; + + /* Save a pointer to the screen info in the screen privates structure */ + /* This allows us to get back to the screen info from a sceen pointer */ + pScreenPriv->pScreenInfo = pScreenInfo; + + /* Detect which engines are supported */ + winDetectSupportedEngines (pScreen); + + /* Determine which engine to use */ + if (!winSetEngine (pScreen)) + return FALSE; + + /* Adjust the video mode for our engine type */ + if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) + return FALSE; + //#endif + + /* Initial display parameters */ + pScreenInfo->dwBPP = winBitsPerPixel (pScreenInfo->dwDepth); + ErrorF ("winScreenInit () - dwBPP: %d\n", pScreenInfo->dwBPP); + + /* Create display window */ + (*pScreenPriv->pwinCreateBoundingWindow) (pScreen); + + /* Set the padded screen width */ + pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, + pScreenInfo->dwDepth); + + /* Clear the visuals list */ + winClearVisualTypes (); + + /* Create framebuffer */ + fReturn = (*pScreenPriv->pwinAllocateFB) (pScreen); + if (!fReturn) + { + ErrorF ("winScreenInit () - Could not allocate framebuffer\n"); + return FALSE; + } + + /* Init visuals */ + fReturn = (*pScreenPriv->pwinInitVisuals) (pScreen); + if (!fReturn) + { + ErrorF ("winScreenInit () - winInitVisuals failed\n"); + return FALSE; + } + ErrorF ("winScreenInit () - Returned from winInitVisuals ()\n"); + +#if 0 + /* Tell the server that we are enabled */ + pScreenPriv->fEnabled = TRUE; +#endif + + /* Setup a local variable to point to the framebuffer */ + pbits = pScreenInfo->pfb; + + ErrorF ("winScreenInit () - Calling fbScreenInit ()\n"); + + /* Initialize the fb code */ + if (!fbScreenInit (pScreen, + pScreenInfo->pfb, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenInfo->dwDPIx, pScreenInfo->dwDPIy, + pScreenInfo->dwStride, + pScreenInfo->dwBPP)) + { + return FALSE; + } + ErrorF ("winScreenInit () - Returned from fbScreenInit ()\n"); + + pScreen->GetWindowPixmap = winGetWindowPixmap; + pScreen->SetWindowPixmap = winSetWindowPixmap; + +#ifdef RENDER + /* Render extension initialization, calls miPictureInit */ + fbPictureInit (pScreen, NULL, 0); +#endif + +#if 0 + /* Wrap fb's CloseScreen with our CloseScreen */ + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; +#endif + + /* Setup the cursor routines */ + miDCInitialize (pScreen, &g_winPointerCursorFuncs); + + /* Create a default colormap */ + fReturn = fbCreateDefColormap (pScreen); + if (!fReturn) + { + ErrorF ("winScreenInit () - Could not create colormap\n"); + return FALSE; + } + + /* Register our block and wakeup handlers; these procedures + process messages in our Windows message queue; specifically, + they process mouse and keyboard input. + + These procedures will be wrapped by the shadow fb block + and wakeup handlers. + */ +#if 0 + RegisterBlockAndWakeupHandlers (winBlockHandler, + winWakeupHandler, + (pointer) pScreen); +#endif + pScreen->BlockHandler = winBlockHandler; + pScreen->WakeupHandler = winWakeupHandler; + pScreen->blockData = pScreen; + pScreen->wakeupData = pScreen; + + /* Initialize the shadow framebuffer layer */ + if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI + || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) + { + ErrorF ("winScreenInit () - Calling shadowInit ()\n"); + shadowInit (pScreen, + pScreenPriv->pwinShadowUpdateProc, + pScreenPriv->pwinShadowWindowProc); + ErrorF ("winScreenInit () - Returned from shadowInit ()\n"); + } + + /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */ + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; + + /* See Porting Layer Definition - p. 33 */ + /* SaveScreen () has something to do with sceen savers */ + /* Our SaveScreen () does nothing */ + pScreen->SaveScreen = winSaveScreen; + + /* Tell the server that we are enabled */ + pScreenPriv->fEnabled = TRUE; + + return fReturn; +} + +/* Detect engines supported by current Windows version + DirectDraw version and hardware +*/ +Bool +winDetectSupportedEngines (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + OSVERSIONINFO osvi; + HMODULE hmodDirectDraw = NULL; + + /* Initialize the engine support flags */ + pScreenInfo->dwEnginesSupported = WIN_SERVER_SHADOW_GDI; + + /* Get operating system version information */ + ZeroMemory (&osvi, sizeof (osvi)); + osvi.dwOSVersionInfoSize = sizeof (osvi); + GetVersionEx (&osvi); + + /* Branch on platform ID */ + switch (osvi.dwPlatformId) + { + case VER_PLATFORM_WIN32_NT: + /* Engine 4 is supported on NT only */ + ErrorF ("winDetectSupportedEngines () - Windows NT/2000\n"); + break; + + case VER_PLATFORM_WIN32_WINDOWS: + /* Engine 4 is supported on NT only */ + ErrorF ("winDetectSupportedEngines () - Windows 95/98/Me\n"); + break; + } + + /* Determine if DirectDraw is installed */ + hmodDirectDraw = LoadLibraryEx ("ddraw.dll", NULL, 0); + + /* Do we have DirectDraw? */ + if (hmodDirectDraw != NULL) + { + FARPROC fpDirectDrawCreate = NULL; + LPDIRECTDRAW lpdd = NULL; + LPDIRECTDRAW4 lpdd4 = NULL; + HRESULT ddrval; + + /* Try to get the DirectDrawCreate address */ + fpDirectDrawCreate = GetProcAddress (hmodDirectDraw, + "DirectDrawCreate"); + + /* Did the proc name exist? */ + if (fpDirectDrawCreate == NULL) + { + /* No DirectDraw support */ + return TRUE; + } + + /* DirectDrawCreate exists, try to call it */ + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = (*fpDirectDrawCreate) (NULL, + (void**) &lpdd, + NULL); + if (FAILED (ddrval)) + { + /* No DirectDraw support */ + ErrorF ("winDetectSupportedEngines () - DirectDraw not installed\n"); + return TRUE; + } + else + { + /* We have DirectDraw */ + /* FIXME: Assuming we have DirectDraw3+ */ + ErrorF ("winDetectSupportedEngines () - DirectDraw installed\n"); + pScreenInfo->dwEnginesSupported |= WIN_SERVER_SHADOW_DD; + + /* Allow PrimaryDD engine if NT */ + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + pScreenInfo->dwEnginesSupported |= WIN_SERVER_PRIMARY_DD; + ErrorF ("winDetectSupportedEngines () - Allowing PrimaryDD\n"); + } + } + + /* Try to query for DirectDraw4 interface */ + ddrval = IDirectDraw_QueryInterface (lpdd, + &IID_IDirectDraw4, + (LPVOID*) &lpdd4); + if (SUCCEEDED (ddrval)) + { + /* We have DirectDraw4 */ + ErrorF ("winDetectSupportedEngines () - DirectDraw4 installed\n"); + pScreenInfo->dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL; + } + + /* Cleanup DirectDraw interfaces */ + if (lpdd4 != NULL) + IDirectDraw_Release (lpdd4); + if (lpdd != NULL) + IDirectDraw_Release (lpdd); + + /* Unload the DirectDraw library */ + FreeLibrary (hmodDirectDraw); + hmodDirectDraw = NULL; + } + + ErrorF ("winDetectSupportedEngines () - Returning, supported engines %08x\n", + pScreenInfo->dwEnginesSupported); + + return TRUE; +} + +/* Set the engine type, depending on the engines + supported for this screen, and whether the user + suggested an engine type +*/ +Bool +winSetEngine (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* If the user's choice is supported, we'll use that */ + if (pScreenInfo->dwEnginesSupported & pScreenInfo->dwEnginePreferred) + { + ErrorF ("winSetEngine () - Using user's preference: %d\n", + pScreenInfo->dwEnginePreferred); + pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred; + + /* Setup engine function pointers */ + switch (pScreenInfo->dwEngine) + { + case WIN_SERVER_SHADOW_GDI: + winSetEngineFunctionsShadowGDI (pScreen); + break; + case WIN_SERVER_SHADOW_DD: + winSetEngineFunctionsShadowDD (pScreen); + break; + case WIN_SERVER_SHADOW_DDNL: + winSetEngineFunctionsShadowDDNL (pScreen); + break; + case WIN_SERVER_PRIMARY_DD: + winSetEngineFunctionsPrimaryDD (pScreen); + break; + default: + FatalError ("winSetEngine () - Invalid engine type\n"); + } + return TRUE; + } + + /* ShadowDDNL has good performance, so why not */ + if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_DDNL) + { + ErrorF ("winSetEngine () - Using Shadow DirectDraw NonLocking\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowDDNL (pScreen); + return TRUE; + } + + /* ShadowDD is next in line */ + if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_DD) + { + ErrorF ("winSetEngine () - Using Shadow DirectDraw\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowDD (pScreen); + return TRUE; + } + + /* ShadowGDI is next in line */ + if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_GDI) + { + ErrorF ("winSetEngine () - Using Shadow GDI DIB\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowGDI (pScreen); + return TRUE; + } + + return TRUE; +} + +/* See Porting Layer Definition - p. 33 */ +Bool +winSaveScreen (ScreenPtr pScreen, int on) +{ + ErrorF ("winSaveScreen ()\n"); + return TRUE; +} + +/* + * + * + * + * + * TEST CODE BELOW - NOT USED IN NORMAL COMPILATION + * + * + * + * + * + */ + +/* See Porting Layer Definition - p. 20 */ +Bool +winFinishScreenInitNativeGDI (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenInfoPtr pScreenInfo = &g_winScreens[index]; + PictFormatPtr formats = NULL; + int nformats = 0; + Bool fReturn = FALSE; + int xsize, ysize; + int dpix = 75, dpiy = 75; + char *pbits = NULL; + VisualPtr pVisuals = NULL; + DepthPtr pDepths = NULL; + VisualID rootVisual; + int nVisuals, nDepths, nRootDepth = 0; + winPrivScreenPtr pScreenPriv = NULL; + + fprintf (stderr, "winScreenInit ()\n"); + + if (!winAllocatePrivates (pScreen)) + return FALSE; + + /* Get a pointer to the privates structure that was allocated */ + pScreenPriv = winGetScreenPriv (pScreen); + + /* Save a pointer to this screen in the screen info structure */ + pScreenInfo->pScreen = pScreen; + + /* Save a pointer to the screen info in the sceen privates structure */ + /* This allows us to get back to the screen info from a sceen pointer */ + pScreenPriv->pScreenInfo = pScreenInfo; + + /* Initial display parameters */ + pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, + pScreenInfo->dwDepth); + pScreenInfo->dwBPP = winBitsPerPixel (pScreenInfo->dwDepth); + ErrorF ("winScreenInit () - screen (%dx%dx%d)\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth); + + /* Copy the width and height into local variables */ + xsize = pScreenInfo->dwWidth; + ysize = pScreenInfo->dwHeight; + + /* Create primary display window */ + winCreateBoundingWindowWindowed (pScreen); + + /* Simple screen information */ + pScreen->width = xsize; + pScreen->height = ysize; + pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10); + pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10); + pScreen->defColormap = FakeClientID (0); + pScreen->minInstalledCmaps = 1; + pScreen->maxInstalledCmaps = 1; + pScreen->backingStoreSupport = NotUseful; + pScreen->saveUnderSupport = NotUseful; + + pScreen->GetScreenPixmap = miGetScreenPixmap; + pScreen->SetScreenPixmap = miSetScreenPixmap; + + /* Region Routines */ +#ifdef NEED_SCREEN_REGIONS + pScreen->RegionCreate = miRegionCreate; + pScreen->RegionInit = miRegionInit; + pScreen->RegionCopy = miRegionCopy; + pScreen->RegionDestroy = miRegionDestroy; + pScreen->RegionUninit = miRegionUninit; + pScreen->Intersect = miIntersect; + pScreen->Union = miUnion; + pScreen->Subtract = miSubtract; + pScreen->Inverse = miInverse; + pScreen->RegionReset = miRegionReset; + pScreen->TranslateRegion = miTranslateRegion; + pScreen->RectIn = miRectIn; + pScreen->PointInRegion = miPointInRegion; + pScreen->RegionNotEmpty = miRegionNotEmpty; + pScreen->RegionBroken = miRegionBroken; + pScreen->RegionBreak = miRegionBreak; + pScreen->RegionEmpty = miRegionEmpty; + pScreen->RegionExtents = miRegionExtents; + pScreen->RegionAppend = miRegionAppend; + pScreen->RegionValidate = miRegionValidate; +#endif /* NEED_SCREEN_REGIONS */ + pScreen->BitmapToRegion = winPixmapToRegionNativeGDI; +#ifdef NEED_SCREEN_REGIONS + pScreen->RectsToRegion = miRectsToRegion; +#endif /* NEED_SCREEN_REGIONS */ + + /* Cursor Routines for a Screen */ + /* See mi/midispcur.c - miDCInitialize() */ + /* See Porting Layer Definition - pp. 25-26 */ + pScreen->PointerNonInterestBox = (PointerNonInterestBoxProcPtr) 0; + + /* Colormap Routines */ + pScreen->CreateColormap = winInitializeColormapNativeGDI; + pScreen->DestroyColormap = (void (*)())NoopDDA; + pScreen->InstallColormap = winInstallColormapNativeGDI; + pScreen->UninstallColormap = winUninstallColormapNativeGDI; + pScreen->ListInstalledColormaps = winListInstalledColormapsNativeGDI; + pScreen->StoreColors = (void (*)())NoopDDA; + pScreen->ResolveColor = winResolveColorNativeGDI; + + /* Fonts */ + pScreen->RealizeFont = winRealizeFontNativeGDI; + pScreen->UnrealizeFont = winUnrealizeFontNativeGDI; + + /* Other Screen Routines */ + pScreen->GetImage = miGetImage; + pScreen->GetSpans = winGetSpansNativeGDI; + pScreen->QueryBestSize = winQueryBestSizeNativeGDI; + pScreen->SourceValidate = (SourceValidateProcPtr) 0; + pScreen->SaveScreen = winSaveScreen; + pScreen->CloseScreen = miCloseScreen; + pScreen->CreateScreenResources = miCreateScreenResources; + + /* Pixmaps */ + pScreen->CreatePixmap = winCreatePixmapNativeGDI; + pScreen->DestroyPixmap = winDestroyPixmapNativeGDI; + pScreen->ModifyPixmapHeader = miModifyPixmapHeader; + + /* Window Procedures */ + pScreen->CreateWindow = winCreateWindowNativeGDI; + pScreen->DestroyWindow = winDestroyWindowNativeGDI; + pScreen->PositionWindow = winPositionWindowNativeGDI; + pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI; + pScreen->RealizeWindow = winMapWindowNativeGDI; + pScreen->UnrealizeWindow = winUnmapWindowNativeGDI; + pScreen->ValidateTree = miValidateTree; + pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0; + pScreen->WindowExposures = miWindowExposures; + pScreen->ClipNotify = (ClipNotifyProcPtr) 0; + + /* Window Painting Procedures */ + pScreen->ClearToBackground = miClearToBackground; + pScreen->CopyWindow = winCopyWindowNativeGDI; + pScreen->PaintWindowBackground = miPaintWindow; + pScreen->PaintWindowBorder = miPaintWindow; + + /* Screen Operation for Backing Store */ + pScreen->SaveDoomedAreas = 0; + pScreen->RestoreAreas = 0; + pScreen->TranslateBackingStore = 0; + pScreen->ExposeCopy = 0; + pScreen->ClearBackingStore = 0; + pScreen->DrawGuarantee = 0; + + /* Screen Operations for Multi-Layered Framebuffers */ + pScreen->MarkWindow = miMarkWindow; + pScreen->MarkOverlappedWindows = miMarkOverlappedWindows; + pScreen->ChangeSaveUnder = miChangeSaveUnder; + pScreen->PostChangeSaveUnder = miPostChangeSaveUnder; + pScreen->MoveWindow = miMoveWindow; + pScreen->ResizeWindow = miSlideAndSizeWindow; + pScreen->GetLayerWindow = miGetLayerWindow; + pScreen->HandleExposures = miHandleValidateExposures; + pScreen->ReparentWindow = (ReparentWindowProcPtr) 0; +#ifdef SHAPE + pScreen->SetShape = miSetShape; +#endif + pScreen->ChangeBorderWidth = miChangeBorderWidth; + pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; + + /* GC Handling Routines */ + /* All other GC handling routines are pointed to through + pScreen->gcfuncs + */ + /* See Porting Layer Definition pp. 43-46 */ + pScreen->CreateGC = winCreateGCNativeGDI; + + pScreen->RestackWindow = (RestackWindowProcPtr) 0; + + pScreen->SendGraphicsExpose = miSendGraphicsExpose; + + /* Block and Wakeup Handlers */ + pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA; + pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA; + pScreen->blockData = (pointer) 0; + pScreen->wakeupData = (pointer) 0; + + fprintf (stderr, "winScreenInit () - calling miInitVisuals()\n"); + if (!winInitVisualsNativeGDI (pScreen)) + { + ErrorF ("winScreenInit () - winInitVisuals returned FALSE\n"); + return FALSE; + } + else + { + ErrorF ("winScreenInit () - winInitVisuals returned TRUE\n"); + } + + /* Visuals */ + pScreen->numDepths = nDepths; + pScreen->rootDepth = nRootDepth; + pScreen->allowedDepths = pDepths; + pScreen->rootVisual = rootVisual; + pScreen->numVisuals = nVisuals; + pScreen->visuals = pVisuals; + + ErrorF ("winScreenInit () - nDepths: %d, nRootDepth: %d, nVisuals: %d\n", + nDepths, nRootDepth, nVisuals); + + fprintf (stderr, "winScreenInit () - calling miSetZeroLineBias()\n"); + miSetZeroLineBias (pScreen, pScreenInfo->dwLineBias); + + miPointerSetNewScreen (pScreenInfo->dwScreen, 0, 0); + + fprintf (stderr, "winScreenInit () - calling miDCInitialize()\n"); + if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs)) + { + ErrorF ("winScreenInit () - miDCInitialize failed\n"); + return FALSE; + } + else + { + ErrorF ("winScreenInit () - miDCInitialize succeeded\n"); + } + + ErrorF ("winScreenInit () - calling winCreateDefColormap()\n"); + fReturn = winCreateDefColormapNativeGDI (pScreen); + + ErrorF ("winScreenInit () - calling miPictureInit()\n"); + miPictureInit (pScreen, formats, nformats); + + if (fReturn) + { + RegisterBlockAndWakeupHandlers (winBlockHandler, + winWakeupHandler, + NULL); + } + pScreenInfo->pScreen = pScreen; + + miScreenDevPrivateInit (pScreen, xsize, pbits); + + ErrorF ("winScreenInit () - Successful addition of Screen %p %p\n", + pScreen->devPrivate, + pScreen); + + return fReturn; +} + +PixmapPtr +winGetWindowPixmap (WindowPtr pwin) +{ + ErrorF ("winGetWindowPixmap ()\n"); + return NULL; +} + +void +winSetWindowPixmap (WindowPtr pwin, PixmapPtr pPix) +{ + ErrorF ("winSetWindowPixmap ()\n"); +} diff --git a/xc/programs/Xserver/hw/xwin/winsetsp.c b/xc/programs/Xserver/hw/xwin/winsetsp.c new file mode 100644 index 000000000..3cc69e994 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winsetsp.c @@ -0,0 +1,201 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winsetsp.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 55 */ +void +winSetSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + char *pSrcs, + DDXPointPtr pPoints, + int *pWidths, + int nSpans, + int fSorted) +{ +#if 0 + int iIdx = 0; + static int iCount = 0; + HBITMAP hBitmap = NULL; + char *pSrc = pSrcs; + int *pWidth = NULL; + DDXPointPtr pPoint = NULL; + HDC hdcMem; + BITMAPINFOHEADER bmih, bmihNew; + + /* Setup the bitmap header info */ + bmih.biSize = sizeof (bmih); + bmih.biWidth = pDrawable->width; + bmih.biHeight = pDrawable->height; + bmih.biPlanes = 1; + bmih.biBitCount = pDrawable->depth; + bmih.biCompression = BI_RGB; + bmih.biSizeImage = 0; + bmih.biXPelsPerMeter = 0; + bmih.biYPelsPerMeter = 0; + bmih.biClrUsed = 0; + bmih.biClrImportant = 0; + + fprintf (stderr, "\nwinSetSpans () - pDrawable: %08x\n", + pDrawable); + + /* What kind of raster op have we got here? */ + switch (pGC->alu) + { + case GXclear: + fprintf (stderr, "winSetSpans () - GXclear\n"); + break; + case GXand: + fprintf (stderr, "winSetSpans () - GXand:\n"); + break; + case GXandReverse: + fprintf (stderr, "winSetSpans () - GXandReverse\n"); + break; + case GXcopy: + fprintf (stderr, "winSetSpans () - GXcopy\n"); + + /* Loop through spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + pWidth = pWidths + iIdx; + pPoint = pPoints + iIdx; + + /* Blast the bits to the drawable */ + SetDIBits (g_hdcMem, ((PixmapPtr)pDrawable)->devPrivate.ptr, + pPoint->y, 1, pSrc, &bmih, 0); + + /* Display some useful information */ + fprintf (stderr, "(%dx%dx%d) (%d,%d) w: %d ps: %08x\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *pWidth, pSrc); + + /* Calculate offset of next bit source */ + pSrc += 4 * ((*pWidth + 31) / 32); + } + break; + case GXandInverted: + fprintf (stderr, "winSetSpans () - GXandInverted\n"); + break; + case GXnoop: + fprintf (stderr, "winSetSpans () - GXnoop\n"); + break; + case GXxor: + fprintf (stderr, "winSetSpans () - GXxor\n"); + break; + case GXor: + fprintf (stderr, "winSetSpans () - GXor\n"); + break; + case GXnor: + fprintf (stderr, "winSetSpans () - GXnor\n"); + break; + case GXequiv: + fprintf (stderr, "winSetSpans () - GXequiv\n"); + break; + case GXinvert: + fprintf (stderr, "winSetSpans () - GXinvert\n"); + + hdcMem = CreateCompatibleDC (g_hdc); + + /* Loop through spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + pWidth = pWidths + iIdx; + pPoint = pPoints + iIdx; + + /* Setup the bitmap header info */ + bmihNew.biSize = sizeof (bmihNew); + bmihNew.biWidth = *pWidth; + bmihNew.biHeight = 1; + bmihNew.biPlanes = 1; + bmihNew.biBitCount = pDrawable->depth; + bmihNew.biCompression = BI_RGB; + bmihNew.biSizeImage = 0; + bmihNew.biXPelsPerMeter = 0; + bmihNew.biYPelsPerMeter = 0; + bmihNew.biClrUsed = 0; + bmihNew.biClrImportant = 0; + + /* Create a DIB from span line */ + if (pDrawable->depth == 1) + { + hBitmap = CreateDIBitmap (NULL, &bmih, 0, pSrc, NULL, 0); + } + else + { + hBitmap = CreateDIBitmap (g_hdcMem, &bmih, 0, pSrc, NULL, 0); + } + hBitmap = SelectObject (hdcMem, hBitmap); + + /* Blit the span line to the drawable */ + BitBlt (g_hdcMem, pPoint->x, pPoint->y, + *pWidth / pDrawable->depth, 1, + hdcMem, 0, 0, NOTSRCCOPY); + + /* Display some useful information */ + fprintf (stderr, "(%dx%dx%d) (%d,%d) w: %d ps: %08x\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *pWidth, pSrc); + + /* Calculate offset of next bit source */ + pSrc += 4 * ((*pWidth + 31) / 32); + + /* Pop the bitmap out of the memory DC */ + SelectObject (hdcMem, hBitmap); + + /* Free the temporary bitmap */ + DeleteObject (hBitmap); + hBitmap = NULL; + } + + /* Release the scratch DC */ + DeleteDC (hdcMem); + + break; + case GXorReverse: + fprintf (stderr, "winSetSpans () - GXorReverse\n"); + break; + case GXcopyInverted: + fprintf (stderr, "winSetSpans () - GXcopyInverted\n"); + break; + case GXorInverted: + fprintf (stderr, "winSetSpans () - GXorInverted\n"); + break; + case GXnand: + fprintf (stderr, "winSetSpans () - GXnand\n"); + break; + case GXset: + fprintf (stderr, "winSetSpans () - GXset\n"); + default: + fprintf (stderr, "winSetSpans () - Unknown ROP\n"); + break; + } +#endif +} diff --git a/xc/programs/Xserver/hw/xwin/winshaddd.c b/xc/programs/Xserver/hw/xwin/winshaddd.c new file mode 100644 index 000000000..68c94e7b0 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winshaddd.c @@ -0,0 +1,542 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshaddd.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* + Create a DirectDraw surface for the shadow framebuffer; also create + a primary surface object so we can blit to the display. + + Install a DirectDraw clipper on our primary surface object + that clips our blits to the unobscured client area of our display window. +*/ +Bool +winAllocateFBShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC ddsd; + DDSURFACEDESC *pddsdShadow = NULL; + + ErrorF ("winAllocateFBShadowDD ()\n"); + + /* Create a clipper */ + ddrval = DirectDrawCreateClipper (0, + &pScreenPriv->pddcPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDD () - Could not create clipper\n"); + + ErrorF ("winAllocateFBShadowDD () - Created a clipper\n"); + + /* Attach the clipper to our display window */ + ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, + 0, + pScreenPriv->hwndScreen); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDD () - Clipper not attached to window\n"); + + ErrorF ("winAllocateFBShadowDD () - Attached clipper to window\n"); + + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = DirectDrawCreate (NULL, &pScreenPriv->pdd, NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBShadowDD () - Could not start DirectDraw\n"); + + ErrorF ("winAllocateFBShadowDD () - Created and initialized DD\n"); + + /* FIXME: If we are full screen we don't need the clipper */ + if (pScreenInfo->fFullScreen) + { + /* Set the cooperative level to full screen */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, + pScreenPriv->hwndScreen, + DDSCL_EXCLUSIVE + | DDSCL_FULLSCREEN); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw_SetDisplayMode (pScreenPriv->pdd, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not set "\ + "full screen display mode\n"); + } + else + { + /* Set the cooperative level for windowed mode */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + } + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDD () - Could not create primary "\ + "surface %08x\n", ddrval); + + ErrorF ("winAllocateFBShadowDD () - Created primary\n"); + + ddrval = IDirectDrawSurface_SetClipper (pScreenPriv->pddsPrimary, + pScreenPriv->pddcPrimary); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDD () - Primary attach clipper failed\n"); + + ErrorF ("winAllocateFBShadowDD () - Attached clipper to primary surface\n"); + + /* Describe the shadow surface to be created */ + /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, + as drawing, locking, and unlocking take forever + with video memory surfaces. In addition, + video memory is a somewhat scarce resource, + so you shouldn't be allocating video memory when + you could use system memory instead. + */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsd.dwHeight = pScreenInfo->dwHeight; + ddsd.dwWidth = pScreenInfo->dwWidth; + + /* Create the shadow surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, + &ddsd, + &pScreenPriv->pddsShadow, + NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBShadowDD () - Could not create shadow "\ + "surface: %08x\n", ddrval); + + ErrorF ("winAllocateFBShadowDD () - Created shadow\n"); + + /* Allocate a DD surface description for our screen privates */ + pddsdShadow = pScreenPriv->pddsdShadow = xalloc (sizeof (DDSURFACEDESC)); + if (pddsdShadow == NULL) + FatalError ("winAllocateFBShadowDD () - Could not allocate surface "\ + "description memory\n"); + ZeroMemory (pddsdShadow, sizeof (*pddsdShadow)); + pddsdShadow->dwSize = sizeof (*pddsdShadow); + + ErrorF ("winAllocateFBShadowDD () - Locking shadow\n"); + + /* Lock the shadow surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, + NULL, + pddsdShadow, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK || pddsdShadow->lpSurface == NULL) + FatalError ("winAllocateFBShadowDD () - Could not lock shadow "\ + "surface: %08x\n", ddrval); + + ErrorF ("winAllocateFBShadowDD () - Locked shadow\n"); + + /* We don't know how to deal with anything other than RGB */ + if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB)) + FatalError ("winAllocateFBShadowDD () - Color format other than RGB\n"); + + /* Grab the pitch, and memory pointer from the surface desc */ + pScreenInfo->dwStrideBytes = pddsdShadow->u.lPitch; + pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) + / pScreenInfo->dwDepth; + pScreenInfo->pfb = pddsdShadow->lpSurface; + + /* Grab the color depth and masks from the surface description */ + pScreenInfo->dwDepth = pddsdShadow->ddpfPixelFormat.u.dwRGBBitCount; + pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask; + + ErrorF ("winAllocateFBShadowDD () - Returning\n"); + + return TRUE; +} + +/* + Transfer the damaged regions of the shadow framebuffer to the display. +*/ +void +winShadowUpdateProcDD (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + RECT rcClient, rcDest, rcSrc; + DWORD dwBox = REGION_NUM_RECTS (damage); + BoxPtr pBox = REGION_RECTS (damage); + + /* Return immediately if the app is not active and we are fullscreen */ + if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; + + /* Get location of display window's client area, in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Unlock the shadow surface, so we can blit */ + ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); + if (FAILED (ddrval)) + FatalError ("winShadowUpdateProcDD () - Unlock failed\n"); + + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Assign damage box to source rectangle */ + rcSrc.left = pBox->x1; + rcSrc.top = pBox->y1; + rcSrc.right = pBox->x2; + rcSrc.bottom = pBox->y2; + + /* Calculate destination rectange */ + rcDest.left = rcClient.left + rcSrc.left; + rcDest.top = rcClient.top + rcSrc.top; + rcDest.right = rcClient.left + rcSrc.right; + rcDest.bottom = rcClient.top + rcSrc.bottom; + + /* Blit the damaged areas */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary, + &rcDest, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winShadowUpateProcDD () - BltFast failed\n"); + + /* Get a pointer to the next box */ + ++pBox; + } + + /* Relock the shadow surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winShadowUpdateProcDD () - Lock failed\n"); + + /* Has our memory pointer changed? */ + if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) + { + /* Location of shadow framebuffer has changed */ + pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface; + + /* Update the screen pixmap */ + if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, + pScreen->width, + pScreen->height, + pScreen->rootDepth, + BitsPerPixel (pScreen->rootDepth), + PixmapBytePad (pScreenInfo->dwStride, + pScreenInfo->dwDepth), + pScreenInfo->pfb)) + { + FatalError ("winShadowUpdateProcDD () - Bits changed, no notify\n"); + } + } +} + +/* + Return a pointer to some part of the shadow framebuffer. + + NOTE: I have not seen this function get called, yet. +*/ +void * +winShadowSetWindowLinearDD (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + *pdwSize = pScreenInfo->dwPaddedWidth; + return (CARD8 *) pScreenInfo->pfb + dwRow * pScreenInfo->dwPaddedWidth + dwOffset; +} + +/* + Return a pointer to some part of the shadow framebuffer. + + NOTE: I have not seen this function get called, yet. + + We call winShadowSetWindowLinearDD because there could, + theoretically, be other framebuffer styles that + required a different calculation. +*/ +void * +winShadowWindowProcDD (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size) +{ + return winShadowSetWindowLinearDD (pScreen, row, offset, mode, size); +} + +/* + Call the wrapped CloseScreen function. + + Free our resources and private structures. +*/ +Bool +winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + + ErrorF ("winCloseScreenShadowDD () - Freeing screen resources\n"); + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + pScreen->CloseScreen = pScreenPriv->CloseScreen; + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the shadow surface, if there is one */ + if (pScreenPriv->pddsShadow) + { + IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); + IDirectDrawSurface_Release (pScreenPriv->pddsShadow); + pScreenPriv->pddsShadow = NULL; + } + + /* Release the primary surface, if there is one */ + if (pScreenPriv->pddsPrimary) + { + IDirectDrawSurface_Release (pScreenPriv->pddsPrimary); + pScreenPriv->pddsPrimary = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Redisplay the Windows cursor */ + if (!pScreenPriv->fCursor) + ShowCursor (TRUE); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; + + /* Free the screen privates for this screen */ + xfree ((pointer) pScreenPriv); + + return fReturn; +} + +/* + Tell mi what sort of visuals we need. + + Generally we only need one visual, as our screen can only + handle one format at a time, I believe. You may want + to verify that last sentence. +*/ +Bool +winInitVisualsShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + ErrorF ("winInitVisualsShadowDD () - Masks: %08x %08x %08x bpRGB: %d\n", + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask, + pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks failed\n"); + } + break; + + case 8: + ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks failed\n"); + } + ErrorF ("winInitVisualsShadowDD () - Returned from miSetVisualTypesAndMasks\n"); + break; + + default: + break; + } + + /* Set DPI info */ + pScreenInfo->dwDPIx = 100; + pScreenInfo->dwDPIy = 100; + + ErrorF ("winInitVisualsShadowDD () - Returning\n"); + + return TRUE; +} + +Bool +winAdjustVideoModeShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwDepth; + + /* Are we fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* We don't need to adjust the video mode for fullscreen */ + return TRUE; + } + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + return FALSE; + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Is GDI using a depth different than command line parameter? */ + if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than depth specified */ + ErrorF ("winAdjustVideoModeShadowDD () - Command line depth: %d, "\ + "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + + /* We'll use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + + /* Release our DC */ + ReleaseDC ((HDC) hdc, NULL); + return TRUE; +} + +/* Set engine specific functions */ +Bool +winSetEngineFunctionsShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD; + pScreenPriv->pwinShadowUpdateProc = winShadowUpdateProcDD; + pScreenPriv->pwinShadowWindowProc = winShadowWindowProcDD; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/winshadddnl.c b/xc/programs/Xserver/hw/xwin/winshadddnl.c new file mode 100644 index 000000000..c42ff0afd --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winshadddnl.c @@ -0,0 +1,561 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadddnl.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, + so we have to redefine it here. +*/ +#ifdef DEFINE_GUID +#undef DEFINE_GUID +#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} +#endif /* DEFINE_GUID */ + +/* FIXME: Headers are broken, IID_IDirectDraw4 has to be defined + here manually. Should be handled by ddraw.h +*/ +#ifndef IID_IDirectDraw4 +DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +#endif /* IID_IDirectDraw4 */ + +/* + Create a DirectDraw surface for the shadow framebuffer; also create + a primary surface object so we can blit to the display. + + Install a DirectDraw clipper on our primary surface object + that clips our blits to the unobscured client area of our display window. +*/ +Bool +winAllocateFBShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC2 ddsdPrimary; + DDSURFACEDESC2 ddsdShadow; + char *lpSurface = NULL; + DDPIXELFORMAT ddpfPrimary; + + ErrorF ("winAllocateFBShadowDDNL () - w %d h %d d %d\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth); + + /* Allocate memory for our shadow surface */ + lpSurface = xalloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); + if (lpSurface == NULL) + FatalError ("winAllocateFBShadowDDNL () - Could not allocate bits\n"); + + /* Initialize the framebuffer memory so we don't get a + strange display at startup + */ + ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); + + /* Create a clipper */ + ddrval = DirectDrawCreateClipper (0, + &pScreenPriv->pddcPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not create clipper\n"); + + ErrorF ("winAllocateFBShadowDDNL () - Created a clipper\n"); + + /* Attach the clipper to our display window */ + ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, + 0, + pScreenPriv->hwndScreen); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Clipper not attached "\ + "to window\n"); + + ErrorF ("winAllocateFBShadowDDNL () - Attached clipper to window\n"); + + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = DirectDrawCreate (NULL, + (void**) &pScreenPriv->pdd, + NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBShadowDDNL () - Could not start DirectDraw\n"); + + ErrorF ("winAllocateFBShadowDDNL () - Created and initialized DD\n"); + + /* Get a DirectDraw4 interface pointer */ + ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, + &IID_IDirectDraw4, + (LPVOID*) &pScreenPriv->pdd4); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Failed DD4 query: %08x\n", + ddrval); + + /* Are we full screen? */ + /* FIXME: If we are full screen we don't need the clipper */ + if (pScreenInfo->fFullScreen) + { + /* Set the cooperative level to full screen */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd4, + pScreenPriv->hwndScreen, + DDSCL_EXCLUSIVE + | DDSCL_FULLSCREEN); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw_SetDisplayMode (pScreenPriv->pdd, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not set "\ + "full screen display mode\n"); + } + else + { + /* Set the cooperative level for windowed mode */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd4, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + } + + /* Describe the primary surface */ + ZeroMemory (&ddsdPrimary, sizeof (ddsdPrimary)); + ddsdPrimary.dwSize = sizeof (ddsdPrimary); + ddsdPrimary.dwFlags = DDSD_CAPS; + ddsdPrimary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd4, + &ddsdPrimary, + &pScreenPriv->pddsPrimary4, + NULL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not create primary "\ + "surface %08x\n", ddrval); + + ErrorF ("winAllocateFBShadowDDNL () - Created primary\n"); + + ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary)); + ddpfPrimary.dwSize = sizeof (ddpfPrimary); + ddrval = IDirectDrawSurface_GetPixelFormat (pScreenPriv->pddsPrimary4, + &ddpfPrimary); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Could not get primary "\ + "pixformat\n"); + + ErrorF ("winAllocateFBShadowDDNL () - Primary masks: %08x %08x %08x "\ + "dwRGBBitCount: %d\n", + ddpfPrimary.u2.dwRBitMask, + ddpfPrimary.u3.dwGBitMask, + ddpfPrimary.u4.dwBBitMask, + ddpfPrimary.u.dwRGBBitCount); + + /* Attach our clipper to our primary surface handle */ + ddrval = IDirectDrawSurface_SetClipper (pScreenPriv->pddsPrimary4, + pScreenPriv->pddcPrimary); + if (FAILED (ddrval)) + FatalError ("winAllocateFBShadowDDNL () - Primary attach clipper "\ + "failed\n"); + + ErrorF ("winAllocateFBShadowDDNL () - Attached clipper to primary "\ + "surface\n"); + + /* Describe the shadow surface to be created */ + /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, + as drawing, locking, and unlocking take forever + with video memory surfaces. In addition, + video memory is a somewhat scarce resource, + so you shouldn't be allocating video memory when + you could use system memory instead. + */ + ZeroMemory (&ddsdShadow, sizeof (ddsdShadow)); + ddsdShadow.dwSize = sizeof (ddsdShadow); + ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH + | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT; + ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsdShadow.dwHeight = pScreenInfo->dwHeight; + ddsdShadow.dwWidth = pScreenInfo->dwWidth; + ddsdShadow.u.lPitch = pScreenInfo->dwPaddedWidth; + ddsdShadow.lpSurface = lpSurface; + ddsdShadow.ddpfPixelFormat = ddpfPrimary; + + /* Create the shadow surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd4, + &ddsdShadow, + &pScreenPriv->pddsShadow4, + NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBShadowDDNL () - Could not create shadow "\ + "surface %08x\n", ddrval); + + ErrorF ("winAllocateFBShadowDDNL () - Created shadow pitch: %d\n", + ddsdShadow.u.lPitch); + + /* Grab the pitch, and memory pointer from the surface desc */ + pScreenInfo->dwStrideBytes = pScreenInfo->dwPaddedWidth; + pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) + / pScreenInfo->dwDepth; + pScreenInfo->pfb = lpSurface; + + /* Grab the color depth and masks from the surface description */ + pScreenInfo->dwDepth = ddsdShadow.ddpfPixelFormat.u.dwRGBBitCount; + pScreenPriv->dwRedMask = ddsdShadow.ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = ddsdShadow.ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = ddsdShadow.ddpfPixelFormat.u4.dwBBitMask; + + ErrorF ("winAllocateFBShadowDDNL () - Returning\n"); + + return TRUE; +} + +/* + Transfer the damaged regions of the shadow framebuffer to the display. +*/ +void +winShadowUpdateProcDDNL (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + RECT rcClient, rcDest, rcSrc; + DWORD dwBox = REGION_NUM_RECTS (damage); + BoxPtr pBox = REGION_RECTS (damage); + + /* Return immediately if the app is not active and we are fullscreen */ + if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; + + /* Get location of display window's client area, in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Assign damage box to source rectangle */ + rcSrc.left = pBox->x1; + rcSrc.top = pBox->y1; + rcSrc.right = pBox->x2; + rcSrc.bottom = pBox->y2; + + /* Calculate destination rectange */ + rcDest.left = rcClient.left + rcSrc.left; + rcDest.top = rcClient.top + rcSrc.top; + rcDest.right = rcClient.left + rcSrc.right; + rcDest.bottom = rcClient.top + rcSrc.bottom; + + /* Blit the damaged areas */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winShadowUpateProcDDNL () - Blt failed\n"); + + /* Get a pointer to the next box */ + ++pBox; + } +} + +/* + Return a pointer to some part of the shadow framebuffer. + + NOTE: I have not seen this function get called, yet. +*/ +void * +winShadowSetWindowLinearDDNL (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + *pdwSize = pScreenInfo->dwPaddedWidth; + return (CARD8 *) pScreenInfo->pfb + dwRow * pScreenInfo->dwPaddedWidth + + dwOffset; +} + +/* + Return a pointer to some part of the shadow framebuffer. + + NOTE: I have not seen this function get called, yet. + + We call winShadowSetWindowLinearDD because there could, + theoretically, be other framebuffer styles that + required a different calculation. +*/ +void * +winShadowWindowProcDDNL (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size) +{ + FatalError ("winShadowWindowProcDDNL () - Hmm... this function has never "\ + "been called. Please send a message to "\ + "cygwin-xfree@cygwin.com if you get this message.\n"); + return winShadowSetWindowLinearDDNL (pScreen, row, offset, mode, size); +} + +/* + Call the wrapped CloseScreen function. + + Free our resources and private structures. +*/ +Bool +winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + + ErrorF ("winCloseScreenShadowDDNL () - Freeing screen resources\n"); + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + pScreen->CloseScreen = pScreenPriv->CloseScreen; + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the shadow surface, if there is one */ + if (pScreenPriv->pddsShadow4) + { + IDirectDrawSurface_Release (pScreenPriv->pddsShadow4); + xfree (pScreenInfo->pfb); + pScreenInfo->pfb = NULL; + pScreenPriv->pddsShadow4 = NULL; + } + + /* Release the primary surface, if there is one */ + if (pScreenPriv->pddsPrimary4) + { + IDirectDrawSurface_Release (pScreenPriv->pddsPrimary4); + pScreenPriv->pddsPrimary4 = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Free the DirectDraw4 object, if there is one */ + if (pScreenPriv->pdd4) + { + IDirectDraw_Release (pScreenPriv->pdd4); + pScreenPriv->pdd4 = NULL; + } + + /* Redisplay the Windows cursor */ + if (!pScreenPriv->fCursor) + ShowCursor (TRUE); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Free the screen privates for this screen */ + xfree ((pointer) pScreenPriv); + + return fReturn; +} + +/* + Tell mi what sort of visuals we need. + + Generally we only need one visual, as our screen can only + handle one format at a time, I believe. You may want + to verify that last sentence. +*/ +Bool +winInitVisualsShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + ErrorF ("winInitVisualsShadowDDNL () - Masks %08x %08x %08x RGB %d d %d\n", + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask, + pScreenPriv->dwBitsPerRGB, + pScreenInfo->dwDepth); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisualsShadowDDNL () - "\ + "miSetVisualTypesAndMasks failed\n"); + } + break; + + case 8: + ErrorF ("winInitVisualsShadowDDNL () - Calling "\ + "miSetVisualTypesAndMasks\n"); + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisualsShadowDDNL () - "\ + "miSetVisualTypesAndMasks failed\n"); + } + ErrorF ("winInitVisualsShadowDDNL () - Returned from "\ + "miSetVisualTypesAndMasks\n"); + break; + + default: + break; + } + + /* Set DPI info */ + pScreenInfo->dwDPIx = 100; + pScreenInfo->dwDPIy = 100; + + ErrorF ("winInitVisualsShadowDDNL () - Returning\n"); + + return TRUE; +} + +Bool +winAdjustVideoModeShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwDepth; + + /* Are we fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* We don't need to adjust the video mode for fullscreen */ + return TRUE; + } + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + return FALSE; + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Is GDI using a depth different than command line parameter? */ + if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than depth specified */ + ErrorF ("winAdjustVideoModeShadowDDNL () - Command line depth: %d, "\ + "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + + /* We'll use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + + /* Release our DC */ + ReleaseDC ((HDC) hdc, NULL); + + return TRUE; +} + + +/* Set pointers to our engine specific functions */ +Bool +winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL; + pScreenPriv->pwinShadowUpdateProc = winShadowUpdateProcDDNL; + pScreenPriv->pwinShadowWindowProc = winShadowWindowProcDDNL; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/winshadgdi.c b/xc/programs/Xserver/hw/xwin/winshadgdi.c new file mode 100644 index 000000000..bf39bac94 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winshadgdi.c @@ -0,0 +1,461 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ + +#include "win.h" + +static +Bool +winQueryScreenDIBFormat (ScreenPtr pScreen, BITMAPINFOHEADER *pbmih) +{ + winScreenPriv(pScreen); + HBITMAP hbmp; + Bool fReturn = TRUE; + + /* Create a memory bitmap compatible with the screen */ + hbmp = CreateCompatibleBitmap (pScreenPriv->hdcScreen, 1, 1); + if (hbmp == NULL) + return FALSE; + + /* Initialize our bitmap info header */ + ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); + pbmih->biSize = sizeof (BITMAPINFOHEADER); + + /* Get the biBitCount */ + fReturn = GetDIBits (pScreenPriv->hdcScreen, + hbmp, + 0, 1, + NULL, + (BITMAPINFO*) pbmih, + DIB_RGB_COLORS); + + /* Get optimal color table, or the optimal bitfields */ + if (fReturn) + fReturn = GetDIBits (pScreenPriv->hdcScreen, + hbmp, + 0, 1, + NULL, + (BITMAPINFO*)pbmih, + DIB_RGB_COLORS); + + /* Free memory */ + DeleteObject (hbmp); + + return fReturn; +} + +static +Bool +winQueryRGBBitsAndMasks (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + BITMAPINFOHEADER *pbmih = NULL; + Bool fReturn = TRUE; + LPDWORD pdw = NULL; + + /* RGB BPP for 8 bit palletes is always 8 bits per pixel */ + if (GetDeviceCaps (pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE) + { + pScreenPriv->dwBitsPerRGB = 8; + return TRUE; + } + + /* 24bpp is easy */ + if (GetDeviceCaps (pScreenPriv->hdcScreen, PLANES) + * GetDeviceCaps (pScreenPriv->hdcScreen, BITSPIXEL) == 24) + { + pScreenPriv->dwBitsPerRGB = 8; + return TRUE; + } + + /* Allocate a bitmap header and color table */ + pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pbmih == NULL) + return FALSE; + + /* Get screen description */ + if (winQueryScreenDIBFormat (pScreen, pbmih)) + { + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Get a pointer to bitfields */ + pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); + + /* Count the number of bits in each mask */ + dwRedBits = winCountBits (pdw[0]); + dwGreenBits = winCountBits (pdw[1]); + dwBlueBits = winCountBits (pdw[2]); + + /* Find maximum bits per red, green, blue */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + /* Set screen privates masks */ + pScreenPriv->dwRedMask = pdw[0]; + pScreenPriv->dwGreenMask = pdw[1]; + pScreenPriv->dwBlueMask = pdw[2]; + } + else + { + fReturn = FALSE; + } + + /* Free memory */ + xfree (pbmih); + + return fReturn; +} + +/* Allocate a DIB for the shadow framebuffer GDI server */ +Bool +winAllocateFBShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + BITMAPINFOHEADER *pbmih = NULL; + DIBSECTION dibsection; + Bool fReturn = TRUE; + + /* Get device contexts for the screen and shadow bitmap */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen); + + /* Allocate bitmap info header */ + pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pbmih == NULL) + return FALSE; + + /* Query the screen format */ + fReturn = winQueryScreenDIBFormat (pScreen, pbmih); + + /* Describe shadow bitmap to be created */ + pbmih->biWidth = pScreenInfo->dwWidth; + pbmih->biHeight = -pScreenInfo->dwHeight; + + /* Create a DI shadow bitmap with a bit pointer */ + pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen, + (BITMAPINFO *) pbmih, + 0, + (VOID**) &pScreenInfo->pfb, + NULL, + 0); + if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) + return FALSE; + else + { + ErrorF ("winAllocateFBShadowGDI () - Shadow buffer allocated\n"); + } + + /* Get information about the bitmap that was allocated */ + GetObject (pScreenPriv->hbmpShadow, sizeof (dibsection), + &dibsection); + + /* Print information about bitmap allocated */ + ErrorF ("winAllocateFBShadowGDI () - Dibsection width: %d height: %d\n", + dibsection.dsBmih.biWidth, dibsection.dsBmih.biHeight); + + /* Select the shadow bitmap into the shadow DC */ + SelectObject (pScreenPriv->hdcShadow, + pScreenPriv->hbmpShadow); + + ErrorF ("winAllocateFBShadowGDI () - Attempting a shadow blit\n"); + BitBlt (pScreenPriv->hdcScreen, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + ErrorF ("winAllocateFBShadowGDI () - Shadow blit success\n"); + + /* Set screeninfo stride */ + pScreenInfo->dwStrideBytes = pScreenInfo->dwPaddedWidth; + pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) + / pScreenInfo->dwDepth; + + return fReturn; +} + +/* Blit the damaged regions of the shadow fb to the screen */ +void +winShadowUpdateProcGDI (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwBox = REGION_NUM_RECTS (damage); + BoxPtr pBox = REGION_RECTS (damage); + int x, y, w, h; + + /* Return immediately if the app is not active and we are fullscreen */ + if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; + + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Calculate x offset, y offset, width, and height for + current damage box + */ + x = pBox->x1; + y = pBox->y1; + w = pBox->x2 - pBox->x1; + h = pBox->y2 - pBox->y1; + + if (!BitBlt (pScreenPriv->hdcScreen, + x, y, + w, h, + pScreenPriv->hdcShadow, + x, y, + SRCCOPY)) + { + FatalError ("winShadowUpdateProc () - BitBlt failed\n"); + } + + /* Get a pointer to the next box */ + ++pBox; + } +} + +void * +winShadowSetWindowLinearGDI (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + *pdwSize = pScreenInfo->dwPaddedWidth; + return (CARD8 *) pScreenInfo->pfb + dwRow * pScreenInfo->dwPaddedWidth + dwOffset; +} + +void * +winShadowWindowProcGDI (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) +{ + return winShadowSetWindowLinearGDI (pScreen, dwRow, dwOffset, mode, pdwSize); +} + +/* See Porting Layer Definition - p. 33 */ +/* We wrap whatever CloseScreen procedure was specified by fb; + a pointer to said procedure is stored in our devPrivate +*/ +Bool +winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + + ErrorF ("winCloseScreenShadowGDI () - Freeing screen resources\n"); + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + pScreen->CloseScreen = pScreenPriv->CloseScreen; + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the shadow DC; which allows the bitmap to be freed */ + DeleteDC (pScreenPriv->hdcShadow); + + /* Free the shadow bitmap */ + DeleteObject (pScreenPriv->hbmpShadow); + + /* Free the screen DC */ + ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); + + /* Redisplay the Windows cursor */ + if (!pScreenPriv->fCursor) + ShowCursor (TRUE); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; + + /* Free the screen privates for this screen */ + xfree ((pointer) pScreenPriv); + + return fReturn; +} + +Bool +winInitVisualsShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + BITMAPINFOHEADER *pbmih = NULL; + Bool fReturn = TRUE; + + /* Allocate bitmap info structure */ + pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pbmih == NULL) + return FALSE; + + /* Set bits per RGB and color masks */ + fReturn = winQueryRGBBitsAndMasks (pScreen); + if (!fReturn) + { + xfree (pbmih); + return fReturn; + } + + ErrorF ("winInitVisualsGDI () - Masks: %08x %08x %08x bpRGB: %d\n", + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask, + pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + } + break; + + case 8: + ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + FatalError ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + } + ErrorF ("winInitVisualsGDI () - Returned from miSetVisualTypesAndMasks\n"); + break; + } + + /* Set DPI info */ + pScreenInfo->dwDPIx = GetDeviceCaps (pScreenPriv->hdcScreen, LOGPIXELSX); + pScreenInfo->dwDPIy = GetDeviceCaps (pScreenPriv->hdcScreen, LOGPIXELSY); + + /* Free memory */ + xfree (pbmih); + + ErrorF ("winInitVisualsGDI () - Returning\n"); + + return TRUE; +} + +/* Adjust the video mode */ +Bool +winAdjustVideoModeShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = GetDC (NULL); + DWORD dwDepth; + + /* We're in serious trouble if we can't get a DC */ + if (hdc == NULL) + return FALSE; + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Is GDI using a depth different than command line parameter? */ + if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than depth specified */ + ErrorF ("winAdjustVideoModeShadowGDI () - Command line depth: %d, "\ + "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + + /* We'll use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + + /* Release our DC */ + ReleaseDC (hdc, NULL); + + return TRUE; +} + +/* Set engine specific funtions */ +Bool +winSetEngineFunctionsShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI; + pScreenPriv->pwinShadowUpdateProc = winShadowUpdateProcGDI; + pScreenPriv->pwinShadowWindowProc = winShadowWindowProcGDI; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/winwakeup.c b/xc/programs/Xserver/hw/xwin/winwakeup.c new file mode 100644 index 000000000..1f5fb82bf --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winwakeup.c @@ -0,0 +1,62 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwakeup.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 7 */ +void +winWakeupHandler (int iScreen, + pointer pWakeupData, + unsigned long ulResult, + pointer pReadmask) +{ + ScreenPtr pScreen = (ScreenPtr) pWakeupData; + winPrivScreenPtr pScreenPriv; + winScreenInfoPtr pScreenInfo; + MSG msg; + +#if 0 + ErrorF ("winWakeupHandler () - %d %08x %d %08x\n", + iScreen, pWakeupData, ulResult, pReadmask); +#endif + + pScreenPriv = winGetScreenPriv (pScreen); + pScreenInfo = pScreenPriv->pScreenInfo; + + while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) + { + //TranslateMessage (&msg); + DispatchMessage (&msg); + } +} diff --git a/xc/programs/Xserver/hw/xwin/winwindow.c b/xc/programs/Xserver/hw/xwin/winwindow.c new file mode 100644 index 000000000..85ada9271 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winwindow.c @@ -0,0 +1,104 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbCreateWindow() */ +Bool +winCreateWindowNativeGDI (WindowPtr pWin) +{ + fprintf (stderr, "winCreateWindow()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbDestroyWindow() */ +Bool +winDestroyWindowNativeGDI (WindowPtr pWin) +{ + fprintf (stderr, "winDestroyWindow()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbPositionWindow() */ +Bool +winPositionWindowNativeGDI (WindowPtr pWin, int x, int y) +{ + fprintf (stderr, "winPositionWindow()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 39 */ +/* See mfb/mfbwindow.c - mfbCopyWindow() */ +void +winCopyWindowNativeGDI (WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc) +{ + fprintf (stderr, "winCopyWindow()\n"); +} + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ +Bool +winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask) +{ + fprintf (stderr, "winChangeWindowAttributes()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 37 + * Also referred to as UnrealizeWindow + */ +Bool +winUnmapWindowNativeGDI (WindowPtr pWindow) +{ + fprintf (stderr, "winUnmapWindow()\n"); + /* This functions is empty in the CFB, + * we probably won't need to do anything + */ + return TRUE; +} + +/* See Porting Layer Definition - p. 37 + * Also referred to as RealizeWindow + */ +Bool +winMapWindowNativeGDI (WindowPtr pWindow) +{ + fprintf (stderr, "winMapWindow()\n"); + /* This function is empty in the CFB, + * we probably won't need to do anything + */ + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/winwndproc.c b/xc/programs/Xserver/hw/xwin/winwndproc.c new file mode 100644 index 000000000..0ea025530 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winwndproc.c @@ -0,0 +1,915 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 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 XFREE86 PROJECT 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 XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwndproc.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ + +#include "win.h" + +#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) + +/* + * Modify the screen pixmap to point to the new framebuffer address + */ +static +Bool +winUpdateFBPointer (ScreenPtr pScreen, void *pbits) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Location of shadow framebuffer has changed */ + pScreenInfo->pfb = pbits; + + /* Update the screen pixmap */ + if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, + pScreen->width, + pScreen->height, + pScreen->rootDepth, + BitsPerPixel (pScreen->rootDepth), + PixmapBytePad (pScreenInfo->dwStride, + pScreenInfo->dwDepth), + pScreenInfo->pfb)) + { + FatalError ("winUpdateFramebufferPointer () - Failed modifying "\ + "screen pixmap\n"); + } + + return TRUE; +} + +/* + We have to store the last state of each mode + key before we lose the keyboard focus. +*/ +static +void +winStoreModeKeyStates (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Initialize all mode key states to off */ + pScreenPriv->dwModeKeyStates = 0x0L; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_NUMLOCK) & 0x0001) << NumLockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_SCROLL) & 0x0001) << ScrollLockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_CAPITAL) & 0x0001) << LockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_KANA) & 0x0001) << KanaMapIndex; + + ErrorF ("winStoreModeKeyStates () - dwModeKeyStates: %08x\n", + pScreenPriv->dwModeKeyStates); +} + +/* + Upon regaining the keyboard focus we must + resynchronize our internal mode key states + with the actual state of the keys. +*/ +void +winRestoreModeKeyStates (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + xEvent xCurrentEvent; + ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); + + ErrorF ("winRestoreModeKeyStates ()\n"); + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & NumLockMask, + GetKeyState (VK_NUMLOCK))) + { + ErrorF ("winRestoreModeKeyStates () - Restoring NumLock\n"); + + xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_NUMLOCK; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & LockMask, + GetKeyState (VK_CAPITAL))) + { + ErrorF ("winRestoreModeKeyStates () - Restoring CapsLock\n"); + + xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_CAPITAL; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & ScrollLockMask, + GetKeyState (VK_SCROLL))) + { + ErrorF ("winRestoreModeKeyStates () - Restoring ScrollLock\n"); + + xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_SCROLL; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & KanaMask, + GetKeyState (VK_KANA))) + { + ErrorF ("winRestoreModeKeyStates () - Restoring KanaLock\n"); + xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_KANA; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } +} + +/* Called by the WakeupHandler + * Processes and/or dispatches Windows messages + */ +LRESULT CALLBACK +winWindowProc (HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + winPrivScreenPtr pScreenPriv = NULL; + winScreenInfo *pScreenInfo = NULL; + ScreenPtr pScreen = NULL; + xEvent xCurrentEvent; + int iDeltaZ; + HDC hdcUpdate; + PAINTSTRUCT ps; + LPCREATESTRUCT pcs; + HRESULT ddrval; + RECT rcClient, rcSrc; + + //ErrorF ("winWindowProc () - Message: %d\n", message); + + ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); + + /* Retrieve screen privates pointers for this window */ + pScreenPriv = GetProp (hWnd, WIN_SCR_PROP); + if (pScreenPriv != NULL) + { + pScreenInfo = pScreenPriv->pScreenInfo; + pScreen = pScreenInfo->pScreen; + } + else + { + ErrorF ("winWindowProc () - Screen privates are null, msg: %d\n", + message); + } + + /* Branch on message type */ + switch (message) + { + case WM_CREATE: + /* Add a property to our display window that references + this screens' privates. + + This allows the window procedure to refer to the + appropriate window DC and shadow DC for the window that + it is processing. We use this to repaint exposed + areas of our display window. + */ + pcs = (LPCREATESTRUCT) lParam; + pScreenPriv = pcs->lpCreateParams; + pScreen = pScreenPriv->pScreenInfo->pScreen; + SetProp (hWnd, + WIN_SCR_PROP, + pScreenPriv); + + /* Store the mode key states so restore doesn't try to restore them */ + winStoreModeKeyStates (pScreen); + return 0; + + case WM_PAINT: + /* Only paint if we have privates and the server is enabled */ + if (pScreenPriv == NULL + || !pScreenPriv->fEnabled + || (pScreenInfo->fFullScreen && !pScreenPriv->fActive)) + { + /* We don't want to paint */ + break; + } + + /* BeginPaint gives us an hdc that clips to the invalidated region */ + hdcUpdate = BeginPaint (hWnd, &ps); + + /* Branch on server style */ + switch (pScreenInfo->dwEngine) + { + case WIN_SERVER_SHADOW_GDI: + /* Our BitBlt will be clipped to the invalidated region */ + BitBlt (hdcUpdate, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + break; + + case WIN_SERVER_SHADOW_DD: + /* Unlock the shadow surface, so we can blit */ + ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - DD unlock failed\n"); + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Source can be enter shadow surface, as Blt should clip */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - DD blt failed\n"); + + /* Relock the shadow surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - DD lock failed\n"); + + /* Has our memory pointer changed? */ + if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdShadow->lpSurface); + break; + + case WIN_SERVER_SHADOW_DDNL: + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Source can be enter shadow surface, as Blt should clip */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary4, + &rcClient, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - DDNL Blt failed: %08x\n", + ddrval); + break; + + case WIN_SERVER_PRIMARY_DD: + /* FIXME: We only run in fullscreen mode with primary fb + DirectDraw server. + + We'll have to hand roll the clipping for windowed mode; + the performance of the primary fb server is so bad + that it probably won't be work the effort to write + the clipping code. + */ + break; + default: + FatalError ("winWindowProc () - WM_PAINT - Unknown engine type\n"); + } + + /* EndPaint frees the DC */ + EndPaint (hWnd, &ps); + return 0; + + case WM_MOUSEMOVE: + /* We can't do anything without privates */ + if (pScreenPriv == NULL) + break; + + /* Sometimes we hide, sometimes we show */ + if (pScreenPriv->fActive + && pScreenPriv->fCursor) + { + /* Hide Windows cursor */ + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + else if (!pScreenPriv->fActive + && !pScreenPriv->fCursor) + { + /* Show Windows cursor */ + pScreenPriv->fCursor = TRUE; + ShowCursor (TRUE); + } + + /* Deliver absolute cursor position to X Server */ + miPointerAbsoluteCursor (GET_X_LPARAM(lParam), + GET_Y_LPARAM(lParam), + GetTickCount ()); + return 0; + + case WM_NCMOUSEMOVE: + /* Non-client mouse movement, show Windows cursor */ + if (!pScreenPriv->fCursor) + { + pScreenPriv->fCursor = TRUE; + ShowCursor (TRUE); + } + return 0; + + case WM_LBUTTONDBLCLK: + case WM_LBUTTONDOWN: + xCurrentEvent.u.u.type = ButtonPress; + xCurrentEvent.u.u.detail = Button1; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_LBUTTONUP: + xCurrentEvent.u.u.type = ButtonRelease; + xCurrentEvent.u.u.detail = Button1; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_MBUTTONDBLCLK: + case WM_MBUTTONDOWN: + xCurrentEvent.u.u.type = ButtonPress; + xCurrentEvent.u.u.detail = Button2; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_MBUTTONUP: + xCurrentEvent.u.u.type = ButtonRelease; + xCurrentEvent.u.u.detail = Button2; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_RBUTTONDBLCLK: + case WM_RBUTTONDOWN: + xCurrentEvent.u.u.type = ButtonPress; + xCurrentEvent.u.u.detail = Button3; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_RBUTTONUP: + xCurrentEvent.u.u.type = ButtonRelease; + xCurrentEvent.u.u.detail = Button3; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_MOUSEWHEEL: + /* Button4 = WheelUp */ + /* Button5 = WheelDown */ + + /* Find out how far the wheel has moved */ + iDeltaZ = GET_WHEEL_DELTA_WPARAM(wParam); + + /* Do we have any previous delta stored? */ + if ((pScreenPriv->iDeltaZ > 0 + && iDeltaZ > 0) + || (pScreenPriv->iDeltaZ < 0 + && iDeltaZ < 0)) + { + /* Previous delta and of same sign as current delta */ + iDeltaZ += pScreenPriv->iDeltaZ; + pScreenPriv->iDeltaZ = 0; + } + else + { + /* Previous delta of different sign, or zero. + We will set it to zero for either case, + as blindly setting takes just as much time + as checking, then setting if necessary :) */ + pScreenPriv->iDeltaZ = 0; + } + + /* Only process this message if the wheel has moved further than + WHEEL_DELTA + */ + if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA) + { + pScreenPriv->iDeltaZ = 0; + + /* Figure out how many whole deltas of the wheel we have */ + iDeltaZ /= WHEEL_DELTA; + } + else + { + /* Wheel has not moved past WHEEL_DELTA threshold; + we will store the wheel delta until the threshold + has been reached. + */ + pScreenPriv->iDeltaZ = iDeltaZ; + return 0; + } + + /* Set the button to indicate up or down wheel delta */ + if (iDeltaZ > 0) + { + xCurrentEvent.u.u.detail = Button4; + } + else + { + xCurrentEvent.u.u.detail = Button5; + } + + /* Flip iDeltaZ to positive, if negative */ + if (iDeltaZ < 0) + { + iDeltaZ *= -1; + } + + /* Generate X input messages for each wheel delta we have seen */ + while (iDeltaZ--) + { + /* Push the wheel button */ + xCurrentEvent.u.u.type = ButtonPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the wheel button */ + xCurrentEvent.u.u.type = ButtonRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + return 0; + + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + /* Bail out early if this is a mouse button */ + if (wParam < 0x07 && wParam != VK_CANCEL) + break; + + /* Generic key down */ + xCurrentEvent.u.u.type = KeyPress; + + /* There are a couple funny keys */ + switch (wParam) + { + case VK_RETURN: + if (lParam & WIN_KEY_EXTENDED) + xCurrentEvent.u.u.detail = WIN_VK_KP_RETURN + MIN_KEYCODE; + else + xCurrentEvent.u.u.detail = wParam + MIN_KEYCODE; + break; + case VK_MENU: + if (lParam & WIN_KEY_EXTENDED) + xCurrentEvent.u.u.detail = VK_RMENU + MIN_KEYCODE; + else + xCurrentEvent.u.u.detail = VK_LMENU + MIN_KEYCODE; + break; + case VK_CONTROL: + if (lParam & WIN_KEY_EXTENDED) + xCurrentEvent.u.u.detail = VK_RCONTROL + MIN_KEYCODE; + else + xCurrentEvent.u.u.detail = VK_LCONTROL + MIN_KEYCODE; + break; + case VK_SHIFT: + if (lParam & WIN_KEY_EXTENDED) + xCurrentEvent.u.u.detail = VK_RSHIFT + MIN_KEYCODE; + else + xCurrentEvent.u.u.detail = VK_LSHIFT + MIN_KEYCODE; + break; + default: + xCurrentEvent.u.u.detail = wParam + MIN_KEYCODE; + } + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_SYSKEYUP: + case WM_KEYUP: + /* Bail out early if this is a mouse button */ + if (wParam < 0x07 && wParam != VK_CANCEL) + break; + + /* Generic key up */ + xCurrentEvent.u.u.type = KeyRelease; + + /* There are a couple funny keys */ + switch (wParam) + { + case VK_RETURN: + if (lParam & WIN_KEY_EXTENDED) + xCurrentEvent.u.u.detail = WIN_VK_KP_RETURN + MIN_KEYCODE; + else + xCurrentEvent.u.u.detail = wParam + MIN_KEYCODE; + break; + case VK_MENU: + if (lParam & WIN_KEY_EXTENDED) + xCurrentEvent.u.u.detail = VK_RMENU + MIN_KEYCODE; + else + xCurrentEvent.u.u.detail = VK_LMENU + MIN_KEYCODE; + break; + case VK_CONTROL: + if (lParam & WIN_KEY_EXTENDED) + xCurrentEvent.u.u.detail = VK_RCONTROL + MIN_KEYCODE; + else + xCurrentEvent.u.u.detail = VK_LCONTROL + MIN_KEYCODE; + break; + case VK_SHIFT: + if (lParam & WIN_KEY_EXTENDED) + xCurrentEvent.u.u.detail = VK_RSHIFT + MIN_KEYCODE; + else + xCurrentEvent.u.u.detail = VK_LSHIFT + MIN_KEYCODE; + break; + default: + xCurrentEvent.u.u.detail = wParam + MIN_KEYCODE; + } + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_HOTKEY: + if (pScreenPriv == NULL) + break; + + /* Handle each engine type */ + switch (pScreenInfo->dwEngine) + { + case WIN_SERVER_PRIMARY_DD: + /* Alt+Tab was pressed, we will lose focus very soon */ + pScreenPriv->fActive = FALSE; + + /* We need to save the primary fb to an offscreen fb when + we get deactivated, and point the fb code at the offscreen + fb for the duration of the deactivation. + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary != NULL + && pScreenPriv->pddsPrimary != NULL) + { + /* We are deactivating */ + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Did we loose the primary surface? */ + ddrval = IDirectDrawSurface_IsLost (pScreenPriv->pddsPrimary); + if (ddrval == DD_OK) + { + ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - Failed unlocking primary "\ + "surface\n"); + } + + /* Setup a source rectangle */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Blit the primary surface to the offscreen surface */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsOffscreen, + NULL, /* should be rcDest */ + pScreenPriv->pddsPrimary, + NULL, + DDBLT_WAIT, + NULL); + if (ddrval == DDERR_SURFACELOST) + { + IDirectDrawSurface_Restore (pScreenPriv->pddsOffscreen); + IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary); + + /* Blit the primary surface to the offscreen surface */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsOffscreen, + NULL, /* should be rcDest */ + pScreenPriv->pddsPrimary, + NULL, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - Failed blitting primary "\ + "surface to offscreen surface: %08x\n", + ddrval); + } + else + { + FatalError ("winWindowProc() - Unknown error from "\ + "Blt: %08dx\n", ddrval); + } + + /* Lock the offscreen surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsOffscreen, + NULL, + pScreenPriv->pddsdOffscreen, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK + || pScreenPriv->pddsdPrimary->lpSurface == NULL) + FatalError ("winWindowProc () - Could not lock "\ + "offscreen surface\n"); + + /* Notify FB of the new memory pointer */ + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdOffscreen->lpSurface); + + /* Unregister our hotkey */ + UnregisterHotKey (hWnd, 1); + return 0; + } + } + break; + + case WM_ACTIVATE: + /* Focus is being changed to another window. + The other window may or may not belong to + our process. + */ + + /* We can't do anything if we don't have screen privates */ + if (pScreenPriv == NULL) + break; + + if (LOWORD (wParam) == WA_ACTIVE || LOWORD (wParam) == WA_CLICKACTIVE) + { + /* Restore the state of all mode keys */ + winRestoreModeKeyStates (pScreen); + + /* Have we changed input screens? */ + if (pScreenPriv->fEnabled + && pScreen != miPointerCurrentScreen ()) + { + /* Tell mi that we are changing the screen that receives + mouse input events. + */ + miPointerSetNewScreen (pScreenInfo->dwScreen, + 0, 0); + } + } + else + { + /* Store the state of all mode keys */ + winStoreModeKeyStates (pScreen); + } + + /* Are we activating or deactivating? */ + if ((LOWORD(wParam) == WA_ACTIVE + || LOWORD(wParam) == WA_CLICKACTIVE) + && pScreenPriv->fCursor) + { + /* Hide Windows cursor */ + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + else if (LOWORD(wParam) == WA_INACTIVE + && !pScreenPriv->fCursor) + { + /* Show Windows cursor */ + pScreenPriv->fCursor = TRUE; + ShowCursor (TRUE); + } + return 0; + + case WM_ACTIVATEAPP: + /* We can't do anything if we don't have screen privates */ + if (pScreenPriv == NULL) + break; + + /* Activate or deactivate */ + pScreenPriv->fActive = wParam; + + /* Are we activating or deactivating? */ + if (pScreenPriv->fActive + && pScreenPriv->fCursor) + { + /* Hide Windows cursor */ + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + else if (!pScreenPriv->fActive + && !pScreenPriv->fCursor) + { + /* Show Windows cursor */ + pScreenPriv->fCursor = TRUE; + ShowCursor (TRUE); + } + + /* Handle activation/deactivation for each engine */ + switch (pScreenInfo->dwEngine) + { + case WIN_SERVER_SHADOW_GDI: + /* Are we active? + Are we fullscreen? + */ + if (pScreenPriv != NULL + && pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* Activating, attempt to bring our window + to the top of the display + */ + ShowWindow (hWnd, SW_RESTORE); + } + + /* Are we inactive? + Are we fullscreen? + */ + if (pScreenPriv != NULL + && !pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* Deactivating, stuff our window onto the + task bar. + */ + ShowWindow (hWnd, SW_MINIMIZE); + } + break; + + case WIN_SERVER_SHADOW_DD: + /* Do we have a surface? + Are we active? + Are we fullscreen? + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary != NULL + && pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* Primary surface was lost, restore it */ + IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary); + } + break; + + case WIN_SERVER_SHADOW_DDNL: + /* Do we have a surface? + Are we active? + Are we full screen? + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary4 != NULL + && pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* Primary surface was lost, restore it */ + IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary4); + } + break; + + case WIN_SERVER_PRIMARY_DD: + /* We need to blit our offscreen fb to + the screen when we are activated, and we need to point + the fb code back to the primary surface memory. + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary != NULL + && pScreenPriv->pddsOffscreen != NULL + && pScreenPriv->fActive) + { + /* We are activating */ + ddrval = IDirectDrawSurface_IsLost (pScreenPriv->pddsOffscreen); + if (ddrval == DD_OK) + { + ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsOffscreen, + NULL); +#if 0 + if (FAILED (ddrval)) + FatalError ("winWindowProc () - Failed unlocking "\ + "offscreen surface %08x\n", ddrval); +#endif + } + + /* Restore both surfaces, just cause I like it that way */ + IDirectDrawSurface_Restore (pScreenPriv->pddsOffscreen); + IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary); + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Setup a source rectangle */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsOffscreen, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - Failed blitting offscreen "\ + "surface to primary surface %08x\n", ddrval); + + /* Lock the primary surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsdPrimary, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK + || pScreenPriv->pddsdPrimary->lpSurface == NULL) + FatalError ("winWindowProc () - Could not lock "\ + "primary surface\n"); + + /* Notify FB of the new memory pointer */ + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdPrimary->lpSurface); + + /* Register the Alt-Tab combo as a hotkey so we can copy + the primary framebuffer before the display mode changes + */ + RegisterHotKey (hWnd, 1, MOD_ALT, 9); + } + break; + default: + FatalError ("winWindowProc () - WM_ACTIVATEAPP - Unknown engine\n"); + } + return 0; + + case WM_CLOSE: + /* Tell X that we are giving up */ + GiveUp (0); + return 0; + } + + return DefWindowProc (hWnd, message, wParam, lParam); +} diff --git a/xc/programs/Xserver/include/dixfont.h b/xc/programs/Xserver/include/dixfont.h index 923d0ae30..2a6877de2 100644 --- a/xc/programs/Xserver/include/dixfont.h +++ b/xc/programs/Xserver/include/dixfont.h @@ -21,7 +21,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/dixfont.h,v 3.7 2001/02/02 21:39:02 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/include/dixfont.h,v 3.8 2001/04/05 17:42:35 dawes Exp $ */ #ifndef DIXFONT_H #define DIXFONT_H 1 @@ -125,20 +125,10 @@ extern void DeleteClientFontStuff(ClientPtr /*client*/); #endif extern void InitFonts(void); -extern int GetDefaultPointSize(void); - extern void FreeFonts(void); extern FontPtr find_old_font(XID /*id*/); -extern Font GetNewFontClientID(void); - -extern int StoreFontClientFont(FontPtr /*pfont*/, - Font /*id*/); - -extern void DeleteFontClientID(Font /*id*/); - - extern void GetGlyphs(FontPtr /*font*/, unsigned long /*count*/, unsigned char * /*chars*/, @@ -162,7 +152,4 @@ extern void InitGlyphCaching(void); extern void SetGlyphCachingMode(int /*newmode*/); -extern void -ResetFontPrivateIndex(void); - #endif /* DIXFONT_H */ diff --git a/xc/programs/Xserver/include/regionstr.h b/xc/programs/Xserver/include/regionstr.h index 3a94fd9a5..5b7fbfea1 100644 --- a/xc/programs/Xserver/include/regionstr.h +++ b/xc/programs/Xserver/include/regionstr.h @@ -41,7 +41,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.5 2001/03/30 02:15:23 keithp Exp $ */ #ifndef REGIONSTRUCT_H #define REGIONSTRUCT_H @@ -394,6 +394,12 @@ extern void miRegionReset( #endif ); +extern Bool miRegionBreak( +#if NeedFunctionPrototypes + RegionPtr /*pReg*/ +#endif +); + extern Bool miPointInRegion( #if NeedFunctionPrototypes RegionPtr /*pReg*/, diff --git a/xc/programs/Xserver/include/swapreq.h b/xc/programs/Xserver/include/swapreq.h index 805788848..5946b2261 100644 --- a/xc/programs/Xserver/include/swapreq.h +++ b/xc/programs/Xserver/include/swapreq.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/swapreq.h,v 1.1 1998/10/06 06:59:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/swapreq.h,v 1.2 2001/04/05 17:42:35 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey <dickey@clark.net> @@ -27,6 +27,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef SWAPREQ_H #define SWAPREQ_H 1 +/* The first two are in misc.h */ +#if 0 void SwapLongs ( #if NeedFunctionPrototypes @@ -42,6 +44,7 @@ SwapShorts ( unsigned long /* count */ #endif ); +#endif void SwapColorItem( diff --git a/xc/programs/Xserver/mi/miinitext.c b/xc/programs/Xserver/mi/miinitext.c index e53b9b2f6..d7aadd91e 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.54 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.56 2001/03/16 04:45:36 tsi Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -153,6 +153,7 @@ extern void ScreenSaverExtensionInit (INITARGS); #endif #ifdef XV extern void XvExtensionInit(INITARGS); +extern void XvMCExtensionInit(INITARGS); #endif #ifdef XIE extern void XieInit(INITARGS); @@ -276,6 +277,7 @@ InitExtensions(argc, argv) #endif #ifdef XV XvExtensionInit(); + XvMCExtensionInit(); #endif #ifdef XIE XieInit(); @@ -439,7 +441,7 @@ static ExtensionModule staticExtensions[] = { { XIdleExtensionInit, "XIDLE", NULL, NULL, NULL }, #endif #ifdef XTRAP - { DEC_XTRAPIbit, "XTRAP", &noTestExtensions, NULL, NULL }, + { DEC_XTRAPInit, "XTRAP", &noTestExtensions, NULL, NULL }, #endif #ifdef XKB { XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL }, diff --git a/xc/programs/Xserver/mi/mipointer.h b/xc/programs/Xserver/mi/mipointer.h index 7ffec7750..98d1b33d4 100644 --- a/xc/programs/Xserver/mi/mipointer.h +++ b/xc/programs/Xserver/mi/mipointer.h @@ -25,11 +25,14 @@ 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/mi/mipointer.h,v 3.6 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipointer.h,v 3.7 2001/03/25 05:32:15 tsi Exp $ */ #ifndef MIPOINTER_H #define MIPOINTER_H +#include "cursor.h" +#include "input.h" + typedef struct _miPointerSpriteFuncRec { Bool (*RealizeCursor)( #if NeedFunctionPrototypes diff --git a/xc/programs/Xserver/mi/mipointrst.h b/xc/programs/Xserver/mi/mipointrst.h index d42f4d521..e83bb4ac6 100644 --- a/xc/programs/Xserver/mi/mipointrst.h +++ b/xc/programs/Xserver/mi/mipointrst.h @@ -25,9 +25,10 @@ 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/mi/mipointrst.h,v 1.2 2001/03/25 05:32:16 tsi Exp $ */ -# include <mipointer.h> -# include <input.h> +#include "mipointer.h" +#include "scrnintstr.h" #define MOTION_SIZE 256 diff --git a/xc/programs/Xserver/mi/miwideline.h b/xc/programs/Xserver/mi/miwideline.h index 0dd3363a6..6278bbf2d 100644 --- a/xc/programs/Xserver/mi/miwideline.h +++ b/xc/programs/Xserver/mi/miwideline.h @@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.8 2001/01/17 22:37:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.9 2001/04/05 17:42:35 dawes Exp $ */ /* Author: Keith Packard, MIT X Consortium */ @@ -154,8 +154,7 @@ typedef struct _LineFace { #define ICEIL(x) ((int)ceil(x)) #else #ifdef __GNUC__ -static __inline int ICEIL(x) - double x; +static __inline int ICEIL(double x) { int _cTmp = x; return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1; diff --git a/xc/programs/Xserver/os/WaitFor.c b/xc/programs/Xserver/os/WaitFor.c index 55c94a864..a7e5470e6 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.27 2001/01/17 22:37:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.29 2001/04/05 19:29:44 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -73,8 +73,8 @@ extern int errno; #ifdef __EMX__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif -#include <X11/Xpoll.h> #include "osdep.h" +#include <X11/Xpoll.h> #include "dixstruct.h" #include "opaque.h" @@ -242,11 +242,7 @@ WaitForSomething(pClientsReady) #endif /* DPMSExtension */ if ( -#ifndef __CYGWIN__ timeout <= 0 -#else - timeout = 0 -#endif #ifdef DPMSExtension && ScreenSaverTime > 0 #endif /* DPMSExtension */ diff --git a/xc/programs/Xserver/os/connection.c b/xc/programs/Xserver/os/connection.c index 43b1b1a7f..8c8397405 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.44 2001/01/17 22:37:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.45 2001/04/01 14:00:16 tsi Exp $ */ /***************************************************************** * Stuff to create connections --- OS dependent * @@ -148,8 +148,8 @@ extern __const__ int _nfiles; #endif #endif /* WIN32 */ #include "misc.h" /* for typedef of pointer */ -#include <X11/Xpoll.h> #include "osdep.h" +#include <X11/Xpoll.h> #include "opaque.h" #include "dixstruct.h" #ifdef XAPPGROUP diff --git a/xc/programs/Xserver/os/io.c b/xc/programs/Xserver/os/io.c index f962cab21..eeb2507dd 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.24 2001/01/17 22:37:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/io.c,v 3.25 2001/04/01 14:00:16 tsi Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> @@ -71,8 +71,8 @@ extern int errno; #define NEED_REPLIES #include "Xproto.h" #include "os.h" -#include "Xpoll.h" #include "osdep.h" +#include "Xpoll.h" #include "opaque.h" #include "dixstruct.h" #include "misc.h" diff --git a/xc/programs/Xserver/render/picturestr.h b/xc/programs/Xserver/render/picturestr.h index 784ce8715..ff2ee58ea 100644 --- a/xc/programs/Xserver/render/picturestr.h +++ b/xc/programs/Xserver/render/picturestr.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.12 2001/01/21 21:19:39 tsi Exp $ + * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.13 2001/04/05 17:42:35 dawes Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -199,8 +199,10 @@ SetPictureToDefaults (PicturePtr pPicture); PicturePtr AllocatePicture (ScreenPtr pScreen); +#if 0 Bool miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); +#endif PicturePtr diff --git a/xc/programs/Xserver/render/render.c b/xc/programs/Xserver/render/render.c index c9f288a80..9a713ed47 100644 --- a/xc/programs/Xserver/render/render.c +++ b/xc/programs/Xserver/render/render.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/render.c,v 1.9 2001/01/03 02:54:17 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/render.c,v 1.10 2001/03/08 03:48:44 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -281,6 +281,8 @@ ProcRenderQueryPictFormats (ClientPtr client) numScreens = screenInfo.numScreens; else numScreens = ((xConnSetup *)ConnectionInfo)->numRoots; +#else + numScreens = screenInfo.numScreens; #endif ndepth = nformat = nvisual = 0; for (s = 0; s < numScreens; s++) diff --git a/xc/programs/Xserver/xkb/xkbEvents.c b/xc/programs/Xserver/xkb/xkbEvents.c index 0ce992ed7..c90708d45 100644 --- a/xc/programs/Xserver/xkb/xkbEvents.c +++ b/xc/programs/Xserver/xkb/xkbEvents.c @@ -24,7 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbEvents.c,v 3.7 2001/01/17 22:37:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbEvents.c,v 3.8 2001/02/20 16:43:14 paulo Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -925,7 +925,7 @@ XkbSrvInfoPtr xkbi; (_XkbIsReleaseEvent(xE[0].u.u.type)) ) { return False; } - if ((pXDev->grab != NullGrab) && + if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab && ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) { register unsigned state,flags; |