diff options
author | dawes <dawes> | 2001-08-22 18:24:44 +0000 |
---|---|---|
committer | dawes <dawes> | 2001-08-22 18:24:44 +0000 |
commit | 34d7432dc114643d77fcea1abad791f0956bede8 (patch) | |
tree | f95b08c2304c526a6a00bc9a9290e2c1d6b91310 | |
parent | 17362840eb4dbe0675167830431b12d1fd4c9330 (diff) |
First part of XFree86 4.1.99.1 merge.X_4_1_99_1-20010822-merge
272 files changed, 12060 insertions, 30393 deletions
diff --git a/xc/config/cf/FreeBSD.cf b/xc/config/cf/FreeBSD.cf index 03ef7ea4c..330cc507c 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.109 2001/05/03 20:12:35 alanh Exp $ +XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.110 2001/08/16 14:33:44 dawes Exp $ #ifndef UseElfFormat #define UseElfFormat DefaultToElfFormat @@ -507,6 +507,25 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define PamLibraries -lpam DlLibrary #endif +/* + * On FreeBSD, the run-time loader will use the built-in "rpath" before + * LD_LIBRARY_PATH. This means that utilities like mkfontdir will load + * installed libraries (if they exist) in preference to the ones in the + * build tree, even though LD_LIBRARY_PATH points to the build tree. + * This can result in the build failing. One way to avoid this is to + * pre-load the libraries from the build tree. + * + * There should be a better way than this hack... + */ +#if UseElfFormat +#ifndef PreloadFontSetup +#define PreloadFontSetup LD_PRELOAD="`(cd $(XENVLIBDIR); echo libXfont*.so.?)`" +#endif +#ifndef PreloadSetup +#define PreloadSetup LD_PRELOAD="`(cd $(XENVLIBDIR); echo lib[A-f]*.so.? | grep -v Xfont)`" +#endif +#endif + #ifndef HasCookieMaker /* Which versions have /dev/urandom? */ #if OSMajorVersion >= 4 diff --git a/xc/config/cf/Imake.rules b/xc/config/cf/Imake.rules index d6b3822a3..d8f0a6cb9 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.94 2001/04/26 21:27:48 dawes Exp $ +XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.100 2001/08/09 20:34:05 dawes Exp $ /* * MACHINE-INDEPENDENT RULES; DO NOT MODIFY @@ -25,6 +25,7 @@ XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.94 2001/04/26 21:27:48 dawe * _MUse (a,b) * _MUseCat (a,b,c) * ProgramTargetName (target) + * HostProgramTargetName (target) * RunProgram (progvar,options) * RunProgramWithSetup (setup,progvar,options) * RemoveFile (file) @@ -311,6 +312,10 @@ XCOMM special target for clearmake @@\ #define ProgramTargetName(target)target #endif +#ifndef HostProgramTargetName +#define HostProgramTargetName(target)target +#endif + #ifndef RunProgram #define RunProgram(progvar,options) $(progvar) options #endif @@ -510,8 +515,14 @@ clean cleantc:: @@\ #endif /* RemoveTargetProgram */ #ifndef MakeDir -#define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then set +x; \ @@\ - else (set -x; $(MKDIRHIER) dir); fi +#define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then \ @@\ + set +x; \ @@\ + else \ @@\ + if [ -h dir ]; then \ @@\ + (set -x; rm -f dir); \ @@\ + fi; \ @@\ + (set -x; $(MKDIRHIER) dir); \ @@\ + fi #endif /* MakeDir */ #ifndef BuildIncludesTop @@ -1615,6 +1626,15 @@ step:: list @@\ * * Since the link is used in the installation process, we need to * make the link relative in order to honor $(DESTDIR) if it is set. + * + * Note: The sed script used here is not completely general. It assumes + * that no elements of the path are '..', and that none start with '.' + * that aren't just '.'. + * + * For a more general solution $(REVPATH) could be used. Even though + * it was intended for something a little different, it does do what is + * required here. + * */ #ifndef LinkConfDirectoryLong #if UseSeparateConfDir && HasSymLinks @@ -1625,7 +1645,7 @@ install:: @@\ @MakeFlagsToShellFlags(i,set +e); \ @@\ if [ -d Concat($(DESTDIR),opath/cdir) ]; then \ @@\ RELPATH=`echo opath/cdir | \ @@\ - sed -e 's:^.::' -e 's:[^/.][^/]*:..:'g`; \ @@\ + sed -e 's:^/::' -e 's:[^/.][^/]*:..:'g -e 's:/\.$$::'`; \ @@\ cd Concat($(DESTDIR),opath/cdir); \ @@\ if [ -d rdir -a ! -h rdir ]; then \ @@\ (cd rdir; tar cf - . | \ @@\ @@ -3167,7 +3187,8 @@ AllTarget(name.$(MANNEWSUFFIX)) @@\ @@\ name.$(MANNEWSUFFIX): name.$(MANSRCSUFFIX) @@\ RemoveFile($@) @@\ - $(LN) name.$(MANSRCSUFFIX) $@ @@\ + cd `dirname name` && \ @@\ + $(LN) `basename name.$(MANSRCSUFFIX)` `basename $@` @@\ @@\ clean:: @@\ RemoveFile(name.$(MANNEWSUFFIX)) diff --git a/xc/config/cf/Imake.tmpl b/xc/config/cf/Imake.tmpl index 98c022d43..2561c9896 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.102 2001/04/26 21:09:38 dawes Exp $ +XCOMM $XFree86: xc/config/cf/Imake.tmpl,v 3.105 2001/08/06 20:51:00 dawes Exp $ XCOMM ---------------------------------------------------------------------- /* @@ -400,10 +400,18 @@ XCOMM the platform-specific parameters - edit site.def to change #define ByteOrder X_BIG_ENDIAN #elif defined(Mc88000Architecture) #define ByteOrder X_BIG_ENDIAN +#elif defined(s390Architecture) +#define ByteOrder X_BIG_ENDIAN +#elif defined(s390xArchitecture) +#define ByteOrder X_BIG_ENDIAN #elif defined(Arm32Architecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(PpcArchitecture) #define ByteOrder X_BIG_ENDIAN +#elif defined(SuperHArchitecture) +#define ByteOrder X_LITTLE_ENDIAN +#elif defined(SuperHebArchitecture) +#define ByteOrder X_BIG_ENDIAN #endif #endif /* ByteOrder */ #ifndef HasFortran @@ -1118,7 +1126,7 @@ TCLIBDIR = TclLibDir #define NeedModuleRanlib NO #endif #ifndef ModuleRanlibCmd -#define ModuleRanlibCmd /*won't be used unless NeedModuleRanlib is YES*/ +#define ModuleRanlibCmd RanlibCmd #endif #ifndef StandardIncludes /* for platform-specifics */ diff --git a/xc/config/cf/X11.tmpl b/xc/config/cf/X11.tmpl index 31141da0a..aaea1ef6c 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.115.2.3 2001/06/01 02:24:14 dawes Exp $ +XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.125 2001/08/17 22:08:09 tsi Exp $ /*************************************************************************** * * @@ -286,6 +286,22 @@ VENDORMANVERSION = XVendorManVersionString #ifndef BuildFontCacheLib #define BuildFontCacheLib (BuildFontCache && !BuildServersOnly) #endif +#ifndef BuildFontEncLib +#define BuildFontEncLib BuildLibraries +#endif +/* + * This enables binary compatibility with the older (XFree86 <= 4.1) fontenc + * entry points in the Xfont library (and X server). If this is turned off, + * then SharedFontRev should have it's major revision bumped, and the + * XFree86 font module ABI (in xfree86/common/xf86Module.h) should have it's + * major revision bumped. + * + * Note: this does not enable those older functions in the separate libfontenc + * library (which didn't exist previously). + */ +#ifndef FontencCompatibility +#define FontencCompatibility YES +#endif #ifndef BuildLowMem #define BuildLowMem NO #endif @@ -415,6 +431,9 @@ VENDORMANVERSION = XVendorManVersionString #ifndef BuildGLULibrary #define BuildGLULibrary (BuildGLXLibrary && HasCplusplus) #endif +#ifndef BuildGLwLibrary +#define BuildGLwLibrary (BuildGlxExt || BuildGLXLibrary) +#endif #ifndef BuildXF86RushExt #define BuildXF86RushExt NO #endif @@ -452,6 +471,13 @@ VENDORMANVERSION = XVendorManVersionString #define BuildFreetype2Library (UseFreetype2 && !HasFreetype2) #endif +#ifndef BuildRandR +#define BuildRandR NO +#endif +#ifndef BuildRandRLibrary +#define BuildRandRLibrary !BuildServersOnly +#endif + #ifndef BuildMiscDocs #define BuildMiscDocs NO #endif @@ -899,6 +925,14 @@ FCHOWN_DEFINES = -DHAS_FCHOWN #endif #endif +#ifndef RandRDefines +#if BuildRandR +#define RandRDefines -DRANDR +#else +#define RandRDefines /**/ +#endif +#endif + #ifndef FontCacheExtentionDefines #if BuildFontCache #define FontCacheExtensionDefines -DFONTCACHE @@ -916,7 +950,7 @@ FCHOWN_DEFINES = -DHAS_FCHOWN XCSecurityDefines CupDefines PervasiveDBEDefines \ XF86BigfontExtensionDefines DPMSDefines \ LowMemDefines XprintDefines XineramaDefines \ - SitePervasiveExtensionDefines RenderDefines + SitePervasiveExtensionDefines RenderDefines RandRDefines #endif #ifndef SiteExtensionDefines #define SiteExtensionDefines /**/ @@ -1355,9 +1389,9 @@ XCOMM X Window System make variables; these need to be coordinated with rules UCSMAPPREFIX = $(FONTDIR)/util/map- #else RGB = $(CLIENTENVSETUP) $(XBUILDBINDIR)/rgb - FONTC = $(CLIENTENVSETUP) $(XBUILDBINDIR)/bdftopcf - MKFONTDIR = $(CLIENTENVSETUP) $(XBUILDBINDIR)/mkfontdir - XFTCACHE = $(CLIENTENVSETUP) XFT_CONFIG=$(XFTLIBSRC)/XftConfig $(XBUILDBINDIR)/xftcache + FONTC = $(CLIENTENVSETUP) $(PRELOADFONTSETUP) $(XBUILDBINDIR)/bdftopcf + MKFONTDIR = $(CLIENTENVSETUP) $(PRELOADFONTSETUP) $(XBUILDBINDIR)/mkfontdir + XFTCACHE = $(CLIENTENVSETUP) $(PRELOADSETUP) XFT_CONFIG=$(XFTLIBSRC)/XftConfig $(XBUILDBINDIR)/xftcache #if HasPerl MKHTMLINDEX = RunPerlScript($(CONFIGSRC)/util/mkhtmlindex.pl,) #else @@ -1423,6 +1457,13 @@ XCOMM X Window System make variables; these need to be coordinated with rules CLIENTENVSETUP = #endif +#ifdef PreloadSetup + PRELOADSETUP = PreloadSetup +#endif +#ifdef PreloadFontSetup + PRELOADFONTSETUP = PreloadFontSetup +#endif + #ifndef ShLibIncludeFile /* need this to make ANSI-style preprocessors happy */ #define ShLibIncludeFile <noop.rules> @@ -1647,6 +1688,21 @@ ProjectUnsharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBSRC),XBuildLibDir) #endif #endif +#if BuildRandRLibrary +#ifndef SharedLibXrandr +#define SharedLibXrandr HasSharedLibraries +#endif +#ifndef NormalLibXrandr +#define NormalLibXrandr YES +#endif +#ifndef DebugLibXrandr +#define DebugLibXrandr NO +#endif +#ifndef ProfileLibXrandr +#define ProfileLibXrandr NO +#endif +#endif + #if BuildGLULibrary #ifndef SharedLibGlu #define SharedLibGlu HasSharedLibraries @@ -1908,6 +1964,18 @@ ProjectUnsharedLibReferences(XRENDER,Xrender,$(XRENDERLIBSRC),XBuildLibDir) #endif #endif +#if BuildRandRLibrary + XRANDRRLIBSRC = $(LIBSRC)/Xrandr +#if SharedLibXrandr +#ifndef SharedXrandrRev +#define SharedXrandrRev 1.0 +#endif +SharedLibReferences(XRANDR,Xrandr,$(XRANDRLIBSRC),SOXRANDRREV,SharedXrandrRev) +#else +ProjectUnsharedLibReferences(XRANDR,Xrandr,$(XRANDRLIBSRC),XBuildLibDir) +#endif +#endif + #if BuildFontCacheLib # ifndef SharedLibXfontcache # define SharedLibXfontcache NO @@ -2371,7 +2439,7 @@ ProjectUnsharedLibReferences(FS,FS,$(FSLIBSRC),XBuildLibDir) FONTLIBSRC = $(LIBSRC)/font #if SharedLibFont #ifndef SharedFontRev -#define SharedFontRev 1.3 +#define SharedFontRev 1.4 #endif SharedFontLibReferences() XCOMM SharedLibReferences(XFONT,Xfont,$(FONTLIBSRC),SOFONTREV,SharedFontRev) @@ -2385,6 +2453,29 @@ ProjectUnsharedLibReferences(FONTSTUB,fntstubs,$(FONTSUBLIBSRC),XBuildLibDir) DEPFONTLIB = $(DEPXFONTLIB) $(DEPFONTSTUBLIB) FONTLIB = $(XFONTLIB) $(FONTSTUBLIB) + +#ifndef SharedLibFontEnc +#define SharedLibFontEnc NO +#endif +#ifndef NormalLibFontEnc +#define NormalLibFontEnc (!SharedLibFont | ForceNormalLib) +#endif +#ifndef DebugLibFontEnc +#define DebugLibFontEnc NO /* debugged fontenc library */ +#endif +#ifndef ProfileLibFontEnc +#define ProfileLibFontEnc NO /* profiled fontenc library */ +#endif + FONTENCLIBSRC = $(LIBSRC)/fontenc +#if SharedLibFontEnc +#ifndef SharedFontEncRev +#define SharedFontEncRev 1.0 +#endif +SharedLibReferences(XFONTENC,fontenc,$(FONTENCLIBSRC),SOFONTENCREV,SharedFontEncRev) +#else +ProjectUnsharedLibReferences(XFONTENC,fontenc,$(FONTENCLIBSRC),XBuildLibDir) +#endif + #ifndef SharedLibXpm #define SharedLibXpm HasSharedLibraries #endif @@ -2476,7 +2567,7 @@ FREETYPE2DEFINES = -DFREETYPE2 XFTLIBSRC = $(LIBSRC)/Xft #if SharedLibXft #ifndef SharedXftRev -#define SharedXftRev 1.0 +#define SharedXftRev 1.1 #endif SharedLibReferences(XFT,Xft,$(XFTLIBSRC),SOXFTREV,SharedXftRev) #else @@ -2530,7 +2621,7 @@ ProjectUnsharedLibReferences(XKBFILE,xkbfile,$(XKBFILELIBSRC),XBuildLibDir) XKBCOMPCMD = $(BINDIR)/XkbComp #else XKBCOMPSRC = $(PROGRAMSRC)/XkbComp - XKBCOMPCMD = $(CLIENTENVSETUP) $(XBUILDBINDIR)/XkbComp + XKBCOMPCMD = $(CLIENTENVSETUP) $(PRELOADSETUP) $(XBUILDBINDIR)/XkbComp #endif #else /* !BuildXKBlib */ #ifndef XkbClientDepLibs @@ -2830,7 +2921,7 @@ encodings.dir: deplist @@\ @(E=; for i in dirlist; do \ @@\ E="$$E -e $$i"; done; \ @@\ set -x; \ @@\ - RunProgram(MKFONTDIR, -r -p inst/ $$E .)) @@\ + RunProgram(MKFONTDIR, -n -r -p inst/ $$E .)) @@\ @@\ clean:: @@\ RemoveFiles(fonts.dir encodings.dir) diff --git a/xc/config/cf/cygwin.cf b/xc/config/cf/cygwin.cf index ff48187e0..3d4472688 100644 --- a/xc/config/cf/cygwin.cf +++ b/xc/config/cf/cygwin.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 alanh Exp $ +XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.26 2001/08/03 23:43:37 alanh Exp $ #ifndef OSName #define OSName Cygwin @@ -13,10 +13,10 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define OSMinorVersion 3 #endif #ifndef OSTeenyVersion -#define OSTeenyVersion 1 +#define OSTeenyVersion 2 #endif -#define ProjectRoot /usr/X11R6 +#define ProjectRoot /usr/X11R6 #define BuildServer YES @@ -28,7 +28,10 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define GccUsesGas YES #define UseGas YES #define GnuCpp YES + +#if !CrossCompiling #define BootstrapCFlags -L/lib/automode.o +#endif #define HasShadowPasswd NO #define HasLibCrypt YES @@ -56,8 +59,17 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define HasSockets YES #define GzipFontCompression YES #define HasZlib YES +#define GzipLibrary -lz.dll + +/* We don't need -lm */ +#define MathLibrary /**/ + +/* + * /lib/libtermcap.a doesn't have tgetent, which is needed for + * xc/programs/xterm/resize.exe + */ +#define TermcapLibrary -lncurses.dll -#define SharedLibFont NO #define AvoidNullMakeCommand YES #define StripInstalledPrograms NO #define CompressAllFonts YES @@ -71,7 +83,7 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define ExpandManNames NO #define HasDlopen NO #define HasGnuMake YES -#define UseGccMakeDepend YES +#define UseGccMakeDepend NO /* * This options may depend on the state of POSIX thread @@ -81,32 +93,51 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define HasThreadSafeAPI NO #define LnCmd ln -s +#ifndef CcCmd #define CcCmd gcc -#define CpluplusCmd c++ -fpermissive +#endif /* CcCmd */ +#ifndef CplusplusCmd +#define CplusplusCmd g++ +#endif /* CplusplusCmd */ +#ifndef AsCmd #define AsCmd as +#endif /* AsCmd */ #define GccGasOption -DGCCUSESGAS #define AsmDefines -DUSE_GAS -DGCCUSESGAS +#ifndef LdCmd #define LdCmd ld +#endif /* LdCmd */ #define MkdirHierCmd mkdir -p +#ifndef CppCmd #define CppCmd cpp +#endif /* CppCmd */ +#ifndef YaccCmd #define YaccCmd byacc +#endif /* YaccCmd */ #define LexCmd flex -l #define LexLib -lfl #define HasFlex YES #define PreProcessCmd CcCmd -E -#define StdIncDir `CcCmd --print-libgcc-file-name | sed 's,\\\\,/,g' | sed 's,libgcc.a,../../../../i686-pc-cygwin/include,'` - +#ifndef PostIncDir #define PostIncDir `CcCmd --print-libgcc-file-name | sed 's,\\\\,/,g' | sed 's,libgcc.a,include,'` +#endif #define LdCombineFlags -r +/* We don't define -ansi yet as newlib (which is cygwin's library) doesn't + * define some needed prototypes when -ansi is set, when that's fixed + * we can remove these lines and use the default XFree86 options. */ +#ifndef DefaultCCOptions +# define DefaultCCOptions /* -ansi -pedantic */ GccWarningOptions +#endif + # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2i386Opt # endif -#define StandardDefines -D__i386__ -DWIN32_LEAN_AND_MEAN -DX_LOCALE -D_X86_ -D__STDC__ -DNO_TCP_H -D__CYGWIN__ -D_XOPEN_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DX_SOURCE +#define StandardDefines -D__i386__ -DWIN32_LEAN_AND_MEAN -DX_LOCALE -D_X86_ -D__STDC__ -DNO_TCP_H -D__CYGWIN__ -D_XOPEN_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE #define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC #define HasWChar32 YES @@ -116,14 +147,14 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #else # define StandardCppDefines StandardDefines #endif -#define ServerOSDefines XFree86ServerDefines -DDDXTIME -DFD_SETSIZE=256 -DDXOSINIT +#define ServerOSDefines XFree86ServerDefines -DDDXTIME -DFD_SETSIZE=256 -DDDXOSINIT #define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #define ConnectionFlags -DTCPCONN -DUNIXCONN #define ExtraLibraries #define InstUidFlags -m 4711 -#define UseRgbTxt YES -#define ExtraFilesToClean *.obj *.orig *.rej junk.c *.exe *.dll *.lib *~ +#define UseRgbTxt YES +#define ExtraFilesToClean *.obj *.orig *.rej junk.c *.exe *.dll *.lib *~ /* * You'll probably want BuildDebug to be YES if you are debugging :) @@ -167,12 +198,13 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define BuildGlxExt YES #define BuildXInputExt YES #define BuildXF86VidModeExt YES -#define BuildXF86DGA NO +#define BuildXF86DGA NO /* No direct access to hardware */ #define BuildXvExt YES -#define BuildXF86MiscExt YES +#define BuildXF86MiscExt NO #define BuildRender YES -#define BuildXF86DRI NO -#define BuildXF86DRM NO +#define BuildRandR YES +#define BuildXF86DRI NO /* No direct access to hardware */ +#define BuildXF86DRM NO /* No direct access to hardware */ #define BuildXKB YES #define BuildXCMiscExt YES #define BuildTestExt YES @@ -189,7 +221,7 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define BuildXCSecurity YES #define BuildAppgroup YES #define BuildShapeExt YES -#define BuildScanpci NO +#define BuildScanpci NO /* No direct access to hardware */ #define BuildScreenSaverExt NO @@ -239,6 +271,12 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define XF86CardDrivers /**/ + +/* + * These man rules were ganked from linux.cf, verbatim. + * I am not convinced that we need them. + */ +#if 0 /* Some of these man page defaults are overriden in the above OS sections */ #ifndef ManSuffix # define ManSuffix 1x @@ -258,10 +296,9 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #ifndef FileManDir # define FileManDir $(MANSOURCEPATH)5 #endif +#endif -/* we don't need -lm */ -#define MathLibrary /**/ -#define TermcapLibrary -ltermcap +/* Server build rules */ #define XnestServer YES #define BuildXprint YES #define XprtServer YES @@ -269,12 +306,15 @@ XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.16.2.1 2001/05/30 14:29:27 #define XWinServer YES /* - * Why we don't use the smart scheduler? + * 2001-06-19 - SmartScheduler is terribly slow on Cygwin. It causes + * visible delays in updating of windows, cursor position, etc. */ #define UseSmartScheduler NO -/* --unix option of cygwin make fools the standard MakeFlagsToShellFlags macro */ -#define MakeFlagsToShellFlags(makeflags,shellcmd)\ +/* + * --unix option of Cygwin make fools the standard MakeFlagsToShellFlags macro + */ +#define MakeFlagsToShellFlags(makeflags,shellcmd) \ for flag in ${MAKEFLAGS} ''; do \ @@\ case "$$flag" in *=*) ;;--*) ;; *[makeflags]*) shellcmd;; esac; done diff --git a/xc/config/cf/cygwin.rules b/xc/config/cf/cygwin.rules index fae4486c4..66f230319 100644 --- a/xc/config/cf/cygwin.rules +++ b/xc/config/cf/cygwin.rules @@ -1,41 +1,35 @@ -XCOMM $XFree86: xc/config/cf/cygwin.rules,v 3.5 2001/04/27 12:32:42 alanh Exp $ - -#define CPPOnlyAsm(basename,options) RemoveFile(basename.i) @@\ - $(CPP) AsmDefines $(DEFINES) $(INCLUDES) options basename.S | grep -v '^\#' > basename.i - - +XCOMM $XFree86: xc/config/cf/cygwin.rules,v 3.13 2001/08/18 17:25:48 alanh Exp $ /* * Cygwin shared library rules (DLL versions) */ -#define HasSharedLibraries YES -#define NeedLibInsideFlag YES -#define ForceNormalLib NO -#define SharedLibXaw NO -#define SharedLibXmu NO -#define SharedLibXt NO -#define SharedLibSM YES -#define SharedLibICE YES -#define SharedLibXext YES -#define SharedLibXie YES -#define SharedLibXi YES -#define SharedLibPex YES -#define SharedLibXtst YES -#define SharedOldX YES -#define SharedLibXp YES -#define SharedLibGL YES -#define SharedLibXpm YES -#define SharedLibFont NO -#define SharedLibXaw6 NO -#define SharedLibgetsurf NO -#define SharedLibDps YES -#define SharedLibDpsTk YES -#define NormalLibGlu YES -#define SharedLibGlu YES +#define HasSharedLibraries YES +#define NeedLibInsideFlag YES +#define ForceNormalLib NO +#define SharedLibXaw NO +#define SharedLibXmu NO +#define SharedLibXt NO +#define SharedLibSM YES +#define SharedLibICE YES +#define SharedLibXext YES +#define SharedLibXie YES +#define SharedLibXi YES +#define SharedLibPex YES +#define SharedLibXtst YES +#define SharedOldX YES +#define SharedLibXp YES +#define SharedLibGlx YES +#define SharedLibFont NO +#define SharedLibXaw6 NO +#define SharedLibgetsurf NO +#define SharedLibDps YES +#define SharedLibDpsTk YES +#define SharedLibGlu YES #ifndef SharedDataSeparation -#define SharedDataSeparation NO +#define SharedDataSeparation NO #endif + #ifndef SharedCodeDef #define SharedCodeDef /**/ #endif @@ -58,25 +52,62 @@ XCOMM $XFree86: xc/config/cf/cygwin.rules,v 3.5 2001/04/27 12:32:42 alanh Exp $ #define UseExportLists YES #endif + /* * SharedDepLibraryTarget - generate rules to create a shared library. */ + #ifndef SharedDepLibraryTarget -#ifdef UseInstalled -#ifndef LinkBuildSonameLibrary -#define LinkBuildSonameLibrary(lib) -#endif -#else -#ifndef LinkBuildSonameLibrary -#define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); \ +# ifdef UseInstalled +# ifndef LinkBuildSonameLibrary +# define LinkBuildSonameLibrary(lib) +# endif +# else /* !UseInstalled */ +# ifndef LinkBuildSonameLibrary +# define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); @@\ cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .) -#endif -#endif +# endif +# endif /* UseInstalled */ + + +/* + * SharedDepLibraryTarget + */ #define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ -SharedLibraryTarget(libname,rev,solist,down,up) +AllTarget(Concat3(lib,libname,.dll)) @@\ + @@\ +CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\ + @@\ + @@\ + @@\ +junk.c: @@\ + echo "#include <cygwin/cygwin_dll.h>" >junk.c @@\ + echo "DECLARE_CYGWIN_DLL(dll_main)" >>junk.c @@\ + echo "int WINAPI dll_main(HINSTANCE a, DWORD reason, void *q)" >>junk.c @@\ + echo "{ return 1; }" >>junk.c @@\ + @@\ +Concat3(lib,libname,.dll): deplist junk.o libname.def @@\ + RemoveFile(LibraryTargetName(libname)) @@\ + RemoveFile(Concat3(lib,libname,.dll)) @@\ + MakeDLL(libname,solist) @@\ + LinkBuildLibrary(Concat3(lib,libname,.a)) @@\ + LinkBuildDLL(Concat3(lib,libname,.dll)) @@\ + @@\ +clean:: @@\ + RemoveFile(LibraryTargetName(libname)) @@\ + RemoveFile(Concat3(lib,libname,.dll)) @@\ + RemoveFile(junk.o) @@\ + RemoveFile(junk.c) @@\ + RemoveFile($(BASE_COUNTER)) + #endif /* SharedDepLibraryTarget */ + +/* + * SharedDepModuleTarget + */ + #ifndef SharedDepModuleTarget #define SharedDepModuleTarget(name,deps,solist) @@\ AllTarget(name) @@\ @@ -88,40 +119,52 @@ clean:: @@\ RemoveFile(name) #endif /* SharedDepModuleTarget */ + /* * SharedLibraryDataTarget - generate rules to create shared data file */ + #ifndef SharedLibraryDataTarget #define SharedLibraryDataTarget(libname,rev,salist) #endif + + /* * InstallSharedLibraryData - generate rules to install the shared library data */ + #ifndef InstallSharedLibraryData #define InstallSharedLibraryData(libname,rev,dest) #endif /* InstallSharedLibraryData */ -BASE_COUNTER=/tmp/DLL_BASE_COUNTER -#define MakeDLL(libname,solist) @@\ - if [ -f $(BASE_COUNTER) ]; then true; \ @@\ - else echo 0x67000000 > $(BASE_COUNTER); fi @@\ - dllwrap -s --def libname.def --output-lib Concat3(lib,libname,.a) -o Concat3(lib,libname,.dll) solist junk.o $(REQUIREDLIBS) -image-base `cat $(BASE_COUNTER)` @@\ - IMAGE_LENGTH=`objdump -x Concat3(lib,libname,.dll) |awk '/SizeOfImage/ {print "0x"$$2}'`; \ @@\ +/* + * MakeDll + */ + +#define MakeDLL(libname,solist) @@\ + if [ -f $(BASE_COUNTER) ]; then true; \ @@\ + else echo 0x67000000 > $(BASE_COUNTER); fi @@\ + $(DLLWRAP) -s --def libname.def --output-lib Concat3(lib,libname,.a) -o Concat3(lib,libname,.dll) solist junk.o $(REQUIREDLIBS) -image-base `cat $(BASE_COUNTER)` @@\ + IMAGE_LENGTH=`$(OBJDUMP) -x Concat3(lib,libname,.dll) |awk '/SizeOfImage/ {print "0x"$$2}'`; \ @@\ export IMAGE_LENGTH=`expr '(' \`printf %u $$IMAGE_LENGTH\` / 65536 + 1 ')' '*' 65536` ; \ @@\ export IMAGE_BASE=`cat $(BASE_COUNTER)`; \ @@\ printf 0x%x `expr \`printf %u $$IMAGE_BASE\` + $$IMAGE_LENGTH` > $(BASE_COUNTER) +/* + * SharedLibraryTarget + */ + #define SharedLibraryTarget(libname,rev,solist,down,up) @@\ AllTarget(Concat3(lib,libname,.dll)) @@\ @@\ CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\ @@\ @@\ -junk.c: @@\ +junk.c: @@\ echo "#include <cygwin/cygwin_dll.h>" >junk.c @@\ - echo "DECLARE_CYGWIN_DLL(dll_main);" >>junk.c @@\ + echo "DECLARE_CYGWIN_DLL(dll_main)" >>junk.c @@\ echo "int WINAPI dll_main(HINSTANCE a, DWORD reason, void *q)" >>junk.c @@\ echo "{ return 1; }" >>junk.c @@\ Concat3(lib,libname,.dll): solist junk.o libname.def @@\ @@ -129,7 +172,7 @@ Concat3(lib,libname,.dll): solist junk.o libname.def @@\ RemoveFile(Concat3(lib,libname,.dll)) @@\ MakeDLL(libname,solist) @@\ LinkBuildLibrary(Concat3(lib,libname,.a)) @@\ - LinkBuildDLL(Concat3(lib,libname,.dll)) @@\ + LinkBuildDLL(Concat3(lib,libname,.dll)) @@\ clean:: @@\ RemoveFile(LibraryTargetName(libname)) @@\ RemoveFile(Concat3(lib,libname,.dll)) @@\ @@ -137,15 +180,50 @@ clean:: @@\ RemoveFile(junk.c) @@\ RemoveFile($(BASE_COUNTER)) + +/* + * InstallSharedLibrary + */ + #define InstallSharedLibrary(libname,rev,dest) @@\ InstallTarget(install,LibraryTargetName(libname),$(INSTLIBFLAGS),$(USRLIBDIR)) @@\ InstallTarget(install,Concat3(lib,libname,.dll),$(INSTLIBFLAGS),$(BINDIR)) -#define ProgramTargetName(target)target.exe /* - * LinkBuildDLL - export a .dll to exports/bin. + * ProgramTargetName - This can be simply 'target' or 'target.exe' when + * building on Cygwin proper, as Cygwin automatically appends .exe to compiled + * executables and make, rm, ln, etc. will automatically search for a file + * with .exe appended if the raw file name cannot be found. However, + * building with a cross compiler requires 'target.exe', as the cross + * compiler doesn't know to append .exe, nor do the cross compiler tools + * know to search for files with .exe appended if the raw file name cannot + * be found. + */ + +#define ProgramTargetName(target) Concat(target,.exe) + + +/* + * HostProgramTargetName - Don't add .exe if cross-compiling. + */ + +#ifndef HostProgramTargetName +# if CrossCompiling +# define HostProgramTargetName(target) target +# else +# define HostProgramTargetName(target) ProgramTargetName(target) +# endif +#endif + + +/* + * LinkBuildDLL - Cygwin only rule, similar to LinkBuildModule. + * Unfortunately, we have to create a copy of each DLL in xc/exports/bin; + * linking doesn't work, the executables (e.g. xkbcomp) will report + * that they cannot find DLLs (e.g. libX11.dll). */ + #ifdef UseInstalled #define LinkBuildDLL(lib) $(_NULLCMD_) #else @@ -154,79 +232,60 @@ InstallTarget(install,Concat3(lib,libname,.dll),$(INSTLIBFLAGS),$(BINDIR)) cd $(BUILDBINDIR) && $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/lib . #endif + /* - * LinkBuildBinary - export an .exe to exports/bin. + * LinkBuildBinary - This rule normally creates a link in xc/exports/bin + * to a binary, but we create an actual copy of the binary. + * Creating a link causes the DLLs that the binary depend on, such as + * libX11.dll, not to be found. Copying the binary causes the runtime + * directory to be xc/exports/bin, which is the location of the DLLs, thus, + * the DLLs can now be found by the binary. Phew... + * + * Note that sometimes the binary is not an executable. One example + * is the rgb binary file. + * + * ProgramTargetName is passed to LinkBuildBinary if the binary + * is actually an executable; thus, we do not wrap the binary name + * with ProgramTargetName here. */ - #ifndef LinkBuildBinary -#define LinkBuildBinary(program) @@\ -all:: program @@\ - MakeDir($(BUILDBINDIR)) @@\ - RemoveFile($(BUILDBINDIR)/program) @@\ - $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/program $(BUILDBINDIR) +#define LinkBuildBinary(binary) @@\ +all:: binary @@\ + MakeDir($(BUILDBINDIR)) @@\ + RemoveFile($(BUILDBINDIR)/binary) @@\ + $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/binary $(BUILDBINDIR) #endif /* LinkBuildBinary */ -/* This is to replace an ugly hack in /xc/nls/XLC_LOCALE */ -/* the corresponding Imake.rules rule would be: - define LinkFileSpecial(gotodir,tofile,fromfile) @@\ - @MakeFlagsToShellFlags(i,set +e); \ @@\ - cd dir && (set -x; RemoveFile(tofile); $(LN) fromfile tofile) - */ -/* And this replaces a similarlry ugly hack in InstallDynamicModule */ +/* + * ComplexProgramTarget - Imake.rules doesn't wrap the program name + * with ProgramTargetName(), so we need this rule for Cygwin. + */ -#ifndef LinkBuildModule -#ifdef UseInstalled -#define LinkBuildModule(module,subdir) $(_NULLCMD_) -#else -#define LinkBuildModule(module,subdir) @@\ - MakeDir($(BUILDMODULEDIR)/subdir) @@\ - RemoveFile($(BUILDMODULEDIR)/subdir/module) @@\ - $(LN) $(BUILDMODULETOP)/$(CURRENT_DIR)/module $(BUILDMODULEDIR)/subdir/module -#endif -#endif /* LinkBuildModule */ - -#ifndef LinkBuildNamedModule -#define LinkBuildNamedModule(module,name) MakeDir($(BUILDMODULEDIR)) @@\ - RemoveFile($(BUILDMODULEDIR)/module) @@\ - $(BUILDMODULEDIR) $(BUILDMODULETOP)/$(CURRENT_DIR)/module name -#endif /* LinkBuildNamedModule */ - -#define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\ -AllTarget(ProgramTargetName(program)) @@\ -ProgramTargetName(program): objects deplibs @@\ - RemoveTargetProgram($@) @@\ - LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\ +#define ComplexProgramTarget(program) @@\ + AllTarget(ProgramTargetName(program)) @@\ + ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\ + DependTarget() @@\ + LintTarget() @@\ @@\ clean:: @@\ RemoveFile(ProgramTargetName(program)) -#define ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\ -ProgramTargetName(program): $(objs) $(deplib) @@\ - RemoveTargetProgram($@) @@\ - LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\ - @@\ -InstallProgram(program,$(BINDIR)) @@\ -InstallManPage(program,$(MANDIR)) -#define ComplexProgramTarget(program) @@\ -AllTarget(ProgramTargetName(program)) @@\ - @@\ -ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\ - @@\ -DependTarget() @@\ -LintTarget() @@\ - @@\ -clean:: @@\ - RemoveFile(ProgramTargetName(program)) +/* + * ComplexProgramTarget_1 - Imake.rules doesn't wrap the program names + * with ProgramTargetName(), so we need this rule for Cygwin. + */ #define ComplexProgramTarget_1(program,locallib,syslib) @@\ - OBJS = $(OBJS1) $(OBJS2) $(OBJS3) @@\ - SRCS = $(SRCS1) $(SRCS2) $(SRCS3) @@\ - PROGRAM1 = ProgramTargetName(program) @@\ + OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \ @@\ + $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10) @@\ + SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \ @@\ + $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10) @@\ + PROGS_EXE = $(foreach prog,$(PROGRAMS),ProgramTargetName($(prog))) @@\ @@\ -AllTarget($(PROGRAM1) $(PROGRAM2) $(PROGRAM3)) @@\ +AllTarget($(PROGS_EXE)) @@\ @@\ ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib) @@\ @@\ @@ -234,46 +293,15 @@ DependTarget() @@\ LintTarget() @@\ @@\ clean:: @@\ - for i in $(PROGRAMS); do $(RM) ProgramTargetName($$i); done - -#define ComplexProgramTarget_2(program,locallib,syslib) @@\ - PROGRAM2 = ProgramTargetName(program) @@\ - @@\ -ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib) + RemoveFiles($(PROGS_EXE)) -#define ComplexProgramTarget_3(program,locallib,syslib) @@\ - PROGRAM3 = ProgramTargetName(program) @@\ - @@\ -ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib) - -#define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\ -AllTarget(ProgramTargetName(server)) @@\ -ProgramTargetName(server): subdirs objects libs @@\ - MoveToBakFile($@) @@\ - LinkRule($@,$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\ - @@\ -Concat(load,server): @@\ - MoveToBakFile(ProgramTargetName(server)) @@\ - LinkRule(ProgramTargetName(server),$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\ - @@\ -loadX:: Concat(load,server) @@\ - @@\ -SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ -SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ -PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ -PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ -ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ -ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ - @@\ -InstallProgramWithFlags(server,$(BINDIR),flags) @@\ - @@\ -clean:: @@\ - RemoveFile(ProgramTargetName(server)) /* - * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable - * object file instead of a library. + * ProfiledRelocatableTarget - generate rules to produce a profiled + * relocatable object file instead of a library. Differs from Imake.rules + * by passing '--oformat pe-i386' to ld. */ + #ifndef ProfiledRelocatableTarget #define ProfiledRelocatableTarget(objname,objlist) @@\ AllTarget(Concat(objname,_p.Osuf)) @@\ @@ -287,8 +315,10 @@ Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS) @@\ /* * DebuggedRelocatableTarget - generate rules to produce a debuggable - * relocatable object file instead of a library. + * relocatable object file instead of a library. Differs from Imake.rules + * by passing '--oformat pe-i386' to ld. */ + #ifndef DebuggedRelocatableTarget #define DebuggedRelocatableTarget(objname,objlist) @@\ AllTarget(Concat(objname,_d.Osuf)) @@\ @@ -300,3 +330,70 @@ Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS) @@\ #endif /* DebuggedRelocatableTarget */ +/* + * DependDependencyStatement - Imake.rules wraps $(DEPEND) in + * ProgramTargetName(), which causes cross compiling to think that + * $(DEPEND) hasn't been built, as $(DEPEND) is a host tool, and should + * not be wrapped with ProgramTargetName(). Perhaps there should be + * a HostProgramTargetName()... + */ + +#ifndef DependDependencyStatement +#if HasMakefileSafeInclude +#define DependDependencyStatement() @@\ +DependFileName:: $(DEPEND) +#else +#define DependDependencyStatement() @@\ +depend:: $(DEPEND) +#endif +#endif + + +/* + * DependDependency - Imake.rules wraps $(DEPEND) in ProgramTargetName(). + * This doesn't work when cross compiling, see the locally defined + * DependDependencyStatement comment (above) for more information. + */ + +#ifndef DependDependency +#ifdef UseInstalled +#define DependDependency() /**/ +#else +#define DependDependency() @@\ +DependDependencyStatement() @@\ + @@\ +NoCmpScript($(DEPEND)) @@\ + @@\ +$(DEPEND): @@\ + @echo "checking $@ over in $(DEPENDSRC) first..."; \ @@\ + cd $(DEPENDSRC) && $(MAKE); \ @@\ + echo "okay, continuing in $(CURRENT_DIR)" + +#endif /* UseInstalled */ +#endif /* DependDependency */ + + +/* + * ImakeDependency - Imake.rules wraps $(IMAKE) in ProgramTargetName(), + * which doesn't work when cross compiling, as imake is supposed to be a + * host program. See the locally defined DependDependencyStatement + * comment (above) for more information. + */ + +#ifndef ImakeDependency +#ifdef UseInstalled +#define ImakeDependency(target) /**/ +#else +#define ImakeDependency(target) @@\ +target:: $(IMAKE) @@\ + @@\ +NoCmpScript($(IMAKE) $(IMAKE).Osuf) @@\ + @@\ +$(IMAKE) $(IMAKE).Osuf: @@\ + -@(cd $(IMAKESRC) && if [ -f Makefile ]; then \ @@\ + echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \ @@\ + echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \ @@\ + $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)") +#endif /* UseInstalled */ +#endif /* ImakeDependency */ diff --git a/xc/config/cf/cygwin.tmpl b/xc/config/cf/cygwin.tmpl index 0a06d48dc..7e629656c 100644 --- a/xc/config/cf/cygwin.tmpl +++ b/xc/config/cf/cygwin.tmpl @@ -1,10 +1,12 @@ XCOMM $XConsortium: WinLib.tmpl,v 1.1 94/01/08 18:32:51 rws Exp $ -XCOMM $XFree86: xc/config/cf/cygwin.tmpl,v 3.4 2001/04/18 17:13:58 dawes Exp $ +XCOMM $XFree86: xc/config/cf/cygwin.tmpl,v 3.7 2001/08/19 15:24:05 alanh Exp $ +#define SharedX11Reqs #define SharedOldXReqs $(LDPRELIB) $(XLIBONLY) +#define SharedXReqs $(XTOOLLIB) $(XPLIB) $(XLIB) $(LDPOSTLIBS) #define SharedXtReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XLIBONLY) #define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) -#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) #define SharedXextReqs $(LDPRELIB) $(XLIBONLY) #define SharedXiReqs $(LDPRELIB) $(XLIB) @@ -27,7 +29,7 @@ XCOMM #define SharedXfontReqs $(LDPRELIB) $(XLIB) #define SharedXrenderReqs $(LDPRELIB) $(EXTENSIONLIB) $(XLIB) #define SharedpsresReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB) #define SharedXmuuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) - +#define SharedXrandrReqs $(LDPRELIB) $(XLIB) #ifndef FixupLibReferences #define FixupLibReferences() @@\ @@ -36,6 +38,40 @@ XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) #endif #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XLIB) $(XPMLIB) +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#endif + + +/* + * Some Imake defines needed only on Cygwin + */ + +#ifndef DllwrapCmd +#define DllwrapCmd dllwrap +#endif + +#ifndef DlltoolCmd +#define DlltoolCmd dlltool #endif +#ifndef ObjdumpCmd +#define ObjdumpCmd objdump +#endif + +#ifndef DllBaseCounter +# if CrossCompiling +# define DllBaseCounter ~/DLL_BASE_COUNTER /* So you don't have to be root */ +# else +# define DllBaseCounter /tmp/DLL_BASE_COUNTER +#endif +#endif + +/* + * Some Cygwin only Makefile symbols, as opposed to Imake define's + */ + + DLLWRAP = DllwrapCmd + DLLTOOL = DlltoolCmd + OBJDUMP = ObjdumpCmd + BASE_COUNTER = DllBaseCounter + diff --git a/xc/config/cf/darwin.cf b/xc/config/cf/darwin.cf index 2d253737e..53da4e801 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.14 2001/05/18 17:48:23 torrey Exp $ +XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.15 2001/06/11 07:23:11 torrey Exp $ /* Darwin / Mac OS X configuration by John Carmack <johnc@idsoftware.com> */ @@ -11,7 +11,8 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.14 2001/05/18 17:48:23 torrey Exp $ #define HasSnprintf YES #define HasPutenv YES #define HasBSD44Sockets YES -#define BuildGlxExt NO +#define HasUsableFileMmap YES +#define HasZlib YES #ifndef HasShm # define HasShm YES #endif @@ -48,13 +49,6 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.14 2001/05/18 17:48:23 torrey Exp $ #define CcCmd /usr/bin/cc #define CplusplusCmd /usr/bin/c++ -/* uncommenting this line will get -g instead of -O, which builds - * a lot faster and gets debug info - */ -#if 0 -#define DefaultCDebugFlags -g -#endif - /* default flags to pass to cc */ #ifndef DefaultCCOptions #if XFree86Devel @@ -72,6 +66,16 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.14 2001/05/18 17:48:23 torrey Exp $ # define LibraryCCOptions DefaultCCOptions -fno-common #endif +#ifdef PpcDarwinArchitecture +# define DarwinMachineDefines -D__powerpc__ +# define OptimizedCDebugFlags -O2 +#endif /* PpcDarwinArchitecture */ + +#ifdef i386DarwinArchitecture +# define DarwinMachineDefines -D__i386__ +# define OptimizedCDebugFlags -O2 -fno-strength-reduce +#endif /* i386DarwinArchitecture */ + /* * __DARWIN__ will be used for platform specific #ifdefs that can't * be handled by existing X defines. @@ -79,11 +83,7 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.14 2001/05/18 17:48:23 torrey Exp $ * Darwin's alloca() seg faults (rather than returning NULL) on failed * allocations, so we can't use it. */ -#ifdef PpcDarwinArchitecture -#define StandardDefines -D__powerpc__ -D__DARWIN__ -DNO_ALLOCA -#else -#define StandardDefines -D__DARWIN__ -DNO_ALLOCA -#endif +#define StandardDefines DarwinMachineDefines -D__DARWIN__ -DNO_ALLOCA /* programs/rgb/rgb.h and others needs this */ #define HasNdbm YES @@ -117,16 +117,6 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.14 2001/05/18 17:48:23 torrey Exp $ /* no Display Power Management extension */ #define BuildDPMSExt NO -#define BuildXvExt NO - -/* no OpenGL libraries */ -#ifndef BuildGLXLibrary -# define BuildGLXLibrary NO -#endif -#ifndef BuildGLULibrary -# define BuildGLULibrary NO -#endif - #define BuildLibPathVar DYLD_LIBRARY_PATH /* include rules to build shared libraries */ diff --git a/xc/config/cf/kdrive.cf b/xc/config/cf/kdrive.cf index 5b9bda671..2ff279bcb 100644 --- a/xc/config/cf/kdrive.cf +++ b/xc/config/cf/kdrive.cf @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/config/cf/kdrive.cf,v 1.9 2001/04/10 16:07:47 dawes Exp $ +XCOMM $XFree86: xc/config/cf/kdrive.cf,v 1.12 2001/06/23 17:00:03 keithp Exp $ /* * This configuration file contains all of the configuration * information for the XFree86 based X Servers. @@ -13,8 +13,11 @@ XCOMM $XConsortium: $ #ifndef XTS300Server #define XTS300Server NO #endif +#ifndef XipaqServer +#define XipaqServer NO +#endif #ifndef XfbdevServer -#define XfbdevServer YES +#define XfbdevServer NO #endif #ifndef XIGSServer #define XIGSServer NO @@ -34,6 +37,9 @@ XCOMM $XConsortium: $ #ifndef XvesaServer #define XvesaServer NO #endif +#ifndef Xmach64Server +#define Xmach64Server NO +#endif #if XItsyServer #include <itsy.cf> diff --git a/xc/config/cf/linux.cf b/xc/config/cf/linux.cf index 8f9b372dc..1bd00bd8b 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.165.2.1 2001/06/01 02:24:14 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/linux.cf,v 3.170 2001/08/13 19:34:52 dawes Exp $ #ifndef LinuxElfDefault # define LinuxElfDefault YES @@ -143,22 +143,29 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # define BuildAllSpecsDocs YES /* we build-depend on libfreetype6-dev (FreeType 2.x) */ # define BuildFreetype2Library NO +# define HasFreetype2 YES +# define HasLinuxInput YES # define HasXdmAuth YES -/* modern LaTeX chokes on ancient sync.tex document */ -/* # define HasLatex YES */ +# define HasLatex YES # define BuilderEMailAddr "submit@bugs.debian.org" -/* right now glide only works on i386 */ +/* at present, glide2 only works on i386 */ # ifdef i386Architecture -# define HasMMXSupport YES -# define Has3DNowSupport YES -/* 2.4 is not yet the official (or predominant) kernel in unstable */ -# define HasKatmaiSupport NO # define HasGlide2 YES # define Glide2IncDir /usr/include/glide +# endif /* i386Architecture */ +/* at present, glide3 only works on alpha and i386 */ +# if defined(i386Architecture) || defined(AlphaArchitecture) # define HasGlide3 YES # define Glide3IncDir /usr/include/glide3 +# endif /* i386Architecture || AlphaArchitecture */ +/* extended instruction set support */ +# ifdef i386Architecture +# define HasMMXSupport YES +# define Has3DNowSupport YES +/* 2.4 is not yet the official (or predominant) kernel in unstable */ +# define HasKatmaiSupport NO # endif /* i386Architecture */ -# endif /* DebianMaintiner */ +# endif /* DebianMaintainer */ #endif /* LinuxDebian */ #if LinuxDistribution == LinuxRedHat @@ -282,11 +289,13 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #endif /* - * Build shared libGL and the DRI modules without -fPIC. This improves - * performance. + * Build shared libGL and the DRI modules without -fPIC on some architectures. + * This improves performance. */ #if BuildXF86DRI +# if defined(i386Architecture) # define BuildLibGlxWithoutPIC YES +# endif #endif /* The DRM module requires kernel services that appeared in late 2.1.x @@ -470,8 +479,8 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # ifndef AsCmd # define AsCmd gcc -c -x assembler-with-cpp # endif -# ifndef DoLoadableServer -# define DoLoadableServer NO +# ifndef MakeDllModules +# define MakeDllModules YES # endif # endif /* MipsArchitecure */ # ifndef CcCmd @@ -515,12 +524,19 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # define LdCmd /usr/alpha-linuxecoff/bin/ld -m alpha # define AsmDefines -DUSE_GAS -U__ELF__ # endif /* AlphaArchitecture */ +# ifdef HPArchitecture +# define CcCmd gcc +# define CplusplusCmd g++ +# define AsCmd as +# define LdCmd ld +# define AsmDefines -DUSE_GAS -U__ELF__ +# endif /* HPArchitecture */ # ifdef ia64Architecture -# define CcCmd gcc -# define CplusplusCmd g++ -# define AsCmd as -# define LdCmd ld -# define AsmDefines -DUSE_GAS -U__ELF__ +# define CcCmd gcc +# define CplusplusCmd g++ +# define AsCmd as +# define LdCmd ld +# define AsmDefines -DUSE_GAS -U__ELF__ # endif /* ia64Architecture */ # ifdef i386Architecture # define CcCmd gcc -b i486-linuxaout @@ -553,6 +569,14 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # define LdCmd ld # define AsmDefines -D__ELF__ # endif /* ia64Architecture */ +# ifdef HPArchitecture +# define CcCmd gcc +# define CplusplusCmd g++ +# define AsCmd as +# define LdCmd ld +# define AsmDefines -D__ELF__ +# define SharedLibXau YES +# endif /* HPArchitecture */ # ifdef i386Architecture # define CcCmd gcc -b i486-linux # define AsCmd /usr/i486-linux/bin/as @@ -576,7 +600,11 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #endif #if UseElfFormat # ifndef DoLoadableServer -# define DoLoadableServer YES +# ifdef HPArchitecture +# define DoLoadableServer YES +# else +# define DoLoadableServer YES +# endif # endif #endif #ifndef CppCmd @@ -627,6 +655,14 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* s390Architecture */ +#ifdef s390xArchitecture +/*#define DefaultCCOptions -fsigned-char */ +#define OptimizedCDebugFlags -O3 +#define LinuxMachineDefines -D__s390x__ +#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +#define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 +#endif /* s390xArchitecture */ + #ifdef AlphaArchitecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2AxpOpt @@ -703,6 +739,38 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif +#ifdef HPArchitecture +# define OptimizedCDebugFlags -O2 +# define LinuxMachineDefines -D__hppa__ +# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines +#endif + +#ifdef SuperHArchitecture +# ifndef SuperHArchOptFlags +# ifdef SuperH4Architecture +# define SuperHArchOptFlags -m4 +# elifdef SuperH4NOFPUArchitecture +# define SuperHArchOptFlags -m4-nofpu +# else +# define SuperHArchOptFlags -m3 +# endif +# endif +# ifndef SuperHebArchitecture +# ifdef SuperHebArchitecture +# define SuperHEndianFlags -mb +# else +# define SuperHEndianFlags -ml +# endif +# endif +# ifndef OptimizedCDebugFlags +# define OptimizedCDebugFlags -O2 SuperHArchOptFlags SuperHEndianFlags +# endif +# define LinuxMachineDefines -D__sh__ +# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines +#endif + #ifndef StandardDefines # define StandardDefines -Dlinux LinuxMachineDefines LinuxSourceDefines #endif @@ -772,7 +840,7 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #define TtClientLibs $(TTLIB) $(XTOOLLIB) $(XLIB) #define TtClientDepLibs $(DEPTTLIB) $(DEPXTOOLLIB) $(DEPXLIB) -#ifdef s390Architecture +#if (defined s390Architecture) || (defined s390xArchitecture) # define HasXServer NO #endif diff --git a/xc/config/cf/xfree86.cf b/xc/config/cf/xfree86.cf index 72a53fd3f..8fb1c4342 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.360.2.1 2001/05/22 21:25:40 dawes Exp $ +XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.375 2001/08/18 02:46:53 dawes Exp $ /* * This configuration file contains all of the configuration * information for the XFree86 based X Servers. @@ -134,15 +134,10 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ /* XInput drivers */ #ifndef XInputDrivers -#if 1 -#define XInputDrivers mouse digitaledge dynapro elographics \ - microtouch mutouch spaceorb summa \ - wacom void citron -#else -#define XInputDrivers mouse digitaledge dynapro elo2300 \ - elographics magellan citron \ - microtouch mutouch spaceorb summa wacom void -#endif +#define XInputDrivers mouse /* acecad */ calcomp citron \ + digitaledge dmc dynapro elographics \ + microtouch mutouch penmount spaceorb summa \ + wacom void /* magictouch */ #endif /* <linux/input.h> support mainly for USB support */ @@ -302,7 +297,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 nv tga s3virge sis rendition \ +# define XF86CardDrivers mga glint nv tga s3 s3virge sis rendition \ neomagic i740 tdfx savage \ cirrus vmware tseng trident chips apm \ GlideDriver fbdev i128 \ @@ -325,8 +320,7 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ #if defined(SparcArchitecture) && \ !defined(LynxOSArchitecture) && \ !defined(NetBSDArchitecture) && \ - !defined(OpenBSDArchitecture) && \ - !defined(SunArchitecture) + !defined(OpenBSDArchitecture) # ifndef XF86Server # define XF86Server YES # endif @@ -472,7 +466,7 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ # endif # ifndef XF86CardDrivers -# define XF86CardDrivers mga glint nv s3virge sis savage \ +# define XF86CardDrivers mga glint nv s3 s3virge sis savage \ trident chips tdfx fbdev ati \ DevelDrivers newport \ XF86OSCardDrivers XF86ExtraCardDrivers @@ -555,7 +549,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 tdfx glint s3virge rendition tga \ +# define XF86CardDrivers mga tdfx glint s3 s3virge rendition tga \ savage nv DevelDrivers siliconmotion vga \ XF86OSCardDrivers XF86ExtraCardDrivers # endif @@ -648,7 +642,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\ +# define XF86CardDrivers mga glint s3 s3virge sis savage\ trident chips tdfx fbdev \ DevelDrivers vga \ XF86OSCardDrivers XF86ExtraCardDrivers @@ -664,6 +658,72 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ #endif +/* SuperH drivers */ + +#if defined(SuperHArchitecture) +# ifndef XF86Server +# define XF86Server YES +# endif +/* 1bpp module */ +# ifndef XF1Bpp +# define XF1Bpp YES +# endif +/* 4bpp module */ +# ifndef XF4Bpp +# define XF4Bpp YES +# endif +/* 8/32bpp overlay module */ +# ifndef XF8_32Bpp +# define XF8_32Bpp YES +# endif +/* 8/16bpp dual fb module */ +# ifndef XF8_16Bpp +# define XF8_16Bpp YES +# endif +/* 24/32bpp conversion module */ +# ifndef XF24_32Bpp +# define XF24_32Bpp YES +# endif +/* shadow fb module */ +# ifndef XFShadowFB +# define XFShadowFB YES +# endif +/* fbdevhw module */ +# ifndef XF86FBDevHw +# define XF86FBDevHw YES +# endif +/* XAA module */ +# ifndef XF86XAA +# define XF86XAA YES +# endif +/* ramdac module */ +# ifndef XF86Ramdac +# define XF86Ramdac YES +# endif +/* I2C module */ +# ifndef XF86I2C +# define XF86I2C YES +# endif +/* DDC module */ +# ifndef XF86DDC +# define XF86DDC YES +# endif +/* RAC (Resource Access Control) module */ +# ifndef XF86RAC +# define XF86RAC YES +# endif + +/* int10 module */ +# ifndef XF86Int10 +# define XF86Int10 YES +# endif + +# ifndef XF86CardDrivers +# define XF86CardDrivers fbdev XF86OSCardDrivers XF86ExtraCardDrivers +# endif +#endif + + /* * For Mips/Arc platforms, the default is to build all modules which * are supported on this platform. @@ -680,6 +740,14 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ # define DebugDefines /**/ #endif +#ifndef XF86Server +# define XF86Server NO +#endif +#if !XF86Server +# undef DoLoadableServer +# define DoLoadableServer NO +#endif + /* * Fbdev module defines. They are set to indicate the fb types supported * on different architectures. @@ -733,14 +801,13 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 * The server-side of PEX is not 64-bit clean. */ #if !defined(BuildPexExt) -# if XF86Server && !defined(AlphaArchitecture) && !defined(ia64Architecture) -# define BuildPexExt YES +# if XF86Server && !defined(AlphaArchitecture) && !defined(ia64Architecture) && !defined(s390xArchitecture) +# define BuildPexExt NO /* But we turn off PEX anyway now */ # else # define BuildPexExt NO # endif #endif - /* * Build GLX server interface * --- Doesn't work for 1-bit and 4-bit servers @@ -878,14 +945,19 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 # define GlxCoreLibDefines /**/ # endif -# if defined(SparcArchitecture) || defined(ia64Architecture) +# if defined(SparcArchitecture) || defined(ia64Architecture) || defined(s390xArchitecture) # define GlxArchDefines -D__GLX_ALIGN64 # else # if defined(AlphaArchitecture) /* On the Alpha we need to ensure floating point accuracy for 3D */ # define GlxArchDefines -mieee # else -# define GlxArchDefines /**/ +# if defined(DarwinArchitecture) +/* GLX contains lots of uninitalized globals, which can upset Darwin */ +# define GlxArchDefines -fno-common +# else +# define GlxArchDefines /**/ +# endif # endif # endif @@ -932,7 +1004,7 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 */ #ifndef BuildXIE # if XF86Server -# define BuildXIE YES +# define BuildXIE NO # else # define BuildXIE NO # endif diff --git a/xc/extras/Mesa/include/GL/osmesa.h b/xc/extras/Mesa/include/GL/osmesa.h index c3bc43d0c..3f1b863ea 100644 --- a/xc/extras/Mesa/include/GL/osmesa.h +++ b/xc/extras/Mesa/include/GL/osmesa.h @@ -58,7 +58,7 @@ extern "C" { #endif -#include "GL/gl.h" +#include <GL/gl.h> #define OSMESA_MAJOR_VERSION 3 diff --git a/xc/extras/Mesa/src/dlist.c b/xc/extras/Mesa/src/dlist.c index ff23ee951..fc0c6e22d 100644 --- a/xc/extras/Mesa/src/dlist.c +++ b/xc/extras/Mesa/src/dlist.c @@ -1152,7 +1152,7 @@ save_CopyColorSubTable(GLenum target, GLsizei start, Node *n; FLUSH_VB(ctx, "dlist"); - n = alloc_instruction( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 6 ); + n = alloc_instruction( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5 ); if (n) { n[1].e = target; n[2].i = start; @@ -1174,7 +1174,7 @@ save_CopyColorTable(GLenum target, GLenum internalformat, Node *n; FLUSH_VB(ctx, "dlist"); - n = alloc_instruction( ctx, OPCODE_COPY_COLOR_TABLE, 6 ); + n = alloc_instruction( ctx, OPCODE_COPY_COLOR_TABLE, 5 ); if (n) { n[1].e = target; n[2].e = internalformat; @@ -1316,7 +1316,7 @@ save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; FLUSH_VB(ctx, "dlist"); - n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6 ); if (n) { n[1].e = target; n[2].e = pname; @@ -3669,7 +3669,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level, return; } MEMCPY(image, data, imageSize); - n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 8 ); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7 ); if (n) { n[1].e = target; n[2].i = level; @@ -3713,7 +3713,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level, return; } MEMCPY(image, data, imageSize); - n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 9 ); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8 ); if (n) { n[1].e = target; n[2].i = level; @@ -3758,7 +3758,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level, return; } MEMCPY(image, data, imageSize); - n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 10 ); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9 ); if (n) { n[1].e = target; n[2].i = level; @@ -3799,7 +3799,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, return; } MEMCPY(image, data, imageSize); - n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 8 ); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7 ); if (n) { n[1].e = target; n[2].i = level; @@ -3838,7 +3838,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, return; } MEMCPY(image, data, imageSize); - n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 10 ); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9 ); if (n) { n[1].e = target; n[2].i = level; @@ -3879,7 +3879,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, return; } MEMCPY(image, data, imageSize); - n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 12 ); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11 ); if (n) { n[1].e = target; n[2].i = level; @@ -5660,11 +5660,22 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) fprintf(f,"Error: %s %s\n", enum_string(n[1].e), (const char *)n[2].data ); break; case OPCODE_VERTEX_CASSETTE: - fprintf(f,"VERTEX-CASSETTE, id %u, rows %u..%u\n", - ((struct immediate *) n[1].data)->id, - n[2].ui, - n[3].ui); - gl_print_cassette( (struct immediate *) n[1].data ); + { + struct immediate *IM; + fprintf(f,"VERTEX-CASSETTE, id %u, rows %u..%u\n", + ((struct immediate *) n[1].data)->id, + n[2].ui, + n[3].ui); + IM = (struct immediate *) n[1].data; + IM->Start = n[2].ui; + IM->Count = n[3].ui; + IM->BeginState = n[4].ui; + IM->OrFlag = n[5].ui; + IM->AndFlag = n[6].ui; + IM->LastData = n[7].ui; + IM->LastPrimitive = n[8].ui; + gl_print_cassette( (struct immediate *) n[1].data ); + } break; case OPCODE_CONTINUE: fprintf(f,"DISPLAY-LIST-CONTINUE\n"); diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h index b737c8036..a45465462 100644 --- a/xc/extras/Mesa/src/mmath.h +++ b/xc/extras/Mesa/src/mmath.h @@ -232,8 +232,8 @@ do { \ * GLubyte b = FloatToInt(CLAMP(f, 0, 1) * 255) */ -#if defined(__i386__) || defined(__sparc__) || ( defined(__alpha__) && \ - ( defined( __IEEE_FLOAT ) || !defined( VMS ) ) ) +#if defined(__i386__) || defined(__sparc__) || defined(__s390x__) || \ + ( defined(__alpha__) && ( defined( __IEEE_FLOAT ) || !defined( VMS ) ) ) #define USE_IEEE #define IEEE_ONE 0x3f7f0000 #endif diff --git a/xc/include/GL/glxproto.h b/xc/include/GL/glxproto.h index 4c3397139..2fe8e7ac7 100644 --- a/xc/include/GL/glxproto.h +++ b/xc/include/GL/glxproto.h @@ -1,7 +1,7 @@ #ifndef _GLX_glxproto_h_ #define _GLX_glxproto_h_ -/* $XFree86: xc/include/GL/glxproto.h,v 1.4 2001/04/10 16:07:49 dawes Exp $ */ +/* $XFree86: xc/include/GL/glxproto.h,v 1.5 2001/08/01 00:44:34 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 @@ -36,7 +36,7 @@ ** compliant with the OpenGL(R) version 1.2.1 Specification. */ -#include "GL/glxmd.h" +#include <GL/glxmd.h> /*****************************************************************************/ diff --git a/xc/include/extensions/Imakefile b/xc/include/extensions/Imakefile index 51e20dcee..26fe07d03 100644 --- a/xc/include/extensions/Imakefile +++ b/xc/include/extensions/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/18 04:05:44 coskrey Exp $ -XCOMM $XFree86: xc/include/extensions/Imakefile,v 3.41 2001/04/28 23:52:32 dawes Exp $ +XCOMM $XFree86: xc/include/extensions/Imakefile,v 3.43 2001/08/01 00:44:35 tsi Exp $ #if BuildScreenSaverExt || BuildScreenSaveLibrary SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h @@ -22,7 +22,8 @@ XF86VIDMODEHEADERS = xf86vmode.h xf86vmstr.h 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 +LBXHEADERS = XLbx.h lbxbuf.h lbxbufstr.h lbxdeltastr.h lbximage.h lbxopts.h \ + lbxstr.h lbxzlib.h #endif #if BuildXvExt || BuildXvLibrary XVHEADERS = Xv.h Xvlib.h Xvproto.h @@ -40,11 +41,14 @@ XINERAMAHEADERS = panoramiXext.h panoramiXproto.h Xinerama.h #if BuildRender || BuildXftLibrary RENDERHEADERS = render.h renderproto.h #endif +#if BuildRandRLibrary +RANDRHEADERS = randr.h randrproto.h +#endif EXTRAHEADERS = $(SCREENSAVERHEADERS) $(XF86MISCHEADERS) $(XF86BIGFONTHEADERS) \ $(XF86VIDMODEHEADERS) $(XF86DGAHEADERS) $(XINERAMAHEADERS) \ $(LBXHEADERS) $(XVHEADERS) $(XVMCHEADERS) $(XF86RUSHHEADERS) \ - $(FONTCACHEHEADERS) $(RENDERHEADERS) + $(FONTCACHEHEADERS) $(RENDERHEADERS) $(RANDRHEADERS) diff --git a/xc/include/extensions/renderproto.h b/xc/include/extensions/renderproto.h index f8cbafb89..222b41b1d 100644 --- a/xc/include/extensions/renderproto.h +++ b/xc/include/extensions/renderproto.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/include/extensions/renderproto.h,v 1.6 2001/01/21 21:19:08 tsi Exp $ + * $XFree86: xc/include/extensions/renderproto.h,v 1.8 2001/08/01 00:44:35 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -27,7 +27,7 @@ #define _XRENDERP_H_ #include <X11/Xmd.h> -#include "render.h" +#include <X11/extensions/render.h> #define Window CARD32 #define Drawable CARD32 @@ -74,7 +74,7 @@ typedef struct { Colormap colormap; } xPictFormInfo; -#define sz_xPictFormInfo 16 +#define sz_xPictFormInfo 24 typedef struct { VisualID visual; diff --git a/xc/include/extensions/xf86rushstr.h b/xc/include/extensions/xf86rushstr.h index e59478362..33b4d32c7 100644 --- a/xc/include/extensions/xf86rushstr.h +++ b/xc/include/extensions/xf86rushstr.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/include/extensions/xf86rushstr.h,v 1.4 2000/02/29 03:09:02 dawes Exp $ */ +/* $XFree86: xc/include/extensions/xf86rushstr.h,v 1.5 2001/08/01 00:44:36 tsi Exp $ */ /* Copyright (c) 1998 Daryll Strauss @@ -8,7 +8,7 @@ Copyright (c) 1998 Daryll Strauss #ifndef _XF86RUSHSTR_H_ #define _XF86RUSHSTR_H_ -#include "xf86rush.h" +#include <X11/extensions/xf86rush.h> #define XF86RUSHNAME "XFree86-Rush" diff --git a/xc/lib/GL/dri/dri_glx.c b/xc/lib/GL/dri/dri_glx.c index fac386f20..6bbfd619d 100644 --- a/xc/lib/GL/dri/dri_glx.c +++ b/xc/lib/GL/dri/dri_glx.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/dri/dri_glx.c,v 1.8 2001/04/10 16:07:49 dawes Exp $ */ +/* $XFree86: xc/lib/GL/dri/dri_glx.c,v 1.9 2001/08/18 02:51:03 dawes Exp $ */ /* * Authors: diff --git a/xc/lib/GL/mesa/src/OSmesa/Imakefile b/xc/lib/GL/mesa/src/OSmesa/Imakefile index c15de3f30..be2c790d4 100644 --- a/xc/lib/GL/mesa/src/OSmesa/Imakefile +++ b/xc/lib/GL/mesa/src/OSmesa/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.10 2001/04/03 02:29:33 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.11 2001/06/04 20:43:30 dawes Exp $ #include <Threads.tmpl> @@ -64,7 +64,7 @@ NormalLibraryTarget($(LIBNAME), $(UOBJS)) InstallLibrary($(LIBNAME),$(USRLIBDIR)) #endif -#if DoSharedLib +#if SharedLibGlx SharedLibraryTarget($(LIBNAME),$(SOREV), $(OBJS), ., .) InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR)) #endif diff --git a/xc/lib/GL/mesa/src/drv/common/hwlog.c b/xc/lib/GL/mesa/src/drv/common/hwlog.c index 0285a295f..ff6e7d921 100644 --- a/xc/lib/GL/mesa/src/drv/common/hwlog.c +++ b/xc/lib/GL/mesa/src/drv/common/hwlog.c @@ -24,7 +24,7 @@ * * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/common/hwlog.c,v 1.2 2000/06/22 16:59:23 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/common/hwlog.c,v 1.3 2001/08/18 02:51:03 dawes Exp $ */ #include "hwlog.h" hwlog_t hwlog = { 0,0,0, "[???] "}; diff --git a/xc/lib/GL/mesa/src/drv/common/mm.c b/xc/lib/GL/mesa/src/drv/common/mm.c index 2ec5a101a..89a204952 100644 --- a/xc/lib/GL/mesa/src/drv/common/mm.c +++ b/xc/lib/GL/mesa/src/drv/common/mm.c @@ -21,7 +21,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/lib/GL/mesa/src/drv/common/mm.c,v 1.2 2000/06/22 16:59:23 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/common/mm.c,v 1.3 2001/08/18 02:51:03 dawes Exp $ */ #include <stdlib.h> #include <stdio.h> diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c index f93a837b6..9412038bc 100644 --- a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c,v 1.2.4.1 2001/05/29 22:28:17 dawes Exp $ +/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c,v 1.3 2001/05/29 22:24:01 dawes Exp $ * * GLX Hardware Device Driver for Sun Creator/Creator3D * Copyright (C) 2000 David S. Miller diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_gl.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_gl.c index d859e5d50..84bdd56ab 100644 --- a/xc/lib/GL/mesa/src/drv/gamma/gamma_gl.c +++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_gl.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_gl.c,v 1.9 2001/02/07 13:26:16 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_gl.c,v 1.10 2001/08/18 02:51:04 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -64,32 +64,32 @@ void gamma_error( GLenum error, const char *s ) #endif if (debug) { - char errstr[1000]; + const char *errstr; switch (error) { case GL_NO_ERROR: - strcpy( errstr, "GL_NO_ERROR" ); + errstr = "GL_NO_ERROR"; break; case GL_INVALID_VALUE: - strcpy( errstr, "GL_INVALID_VALUE" ); + errstr = "GL_INVALID_VALUE"; break; case GL_INVALID_ENUM: - strcpy( errstr, "GL_INVALID_ENUM" ); + errstr = "GL_INVALID_ENUM"; break; case GL_INVALID_OPERATION: - strcpy( errstr, "GL_INVALID_OPERATION" ); + errstr = "GL_INVALID_OPERATION"; break; case GL_STACK_OVERFLOW: - strcpy( errstr, "GL_STACK_OVERFLOW" ); + errstr = "GL_STACK_OVERFLOW"; break; case GL_STACK_UNDERFLOW: - strcpy( errstr, "GL_STACK_UNDERFLOW" ); + errstr = "GL_STACK_UNDERFLOW"; break; case GL_OUT_OF_MEMORY: - strcpy( errstr, "GL_OUT_OF_MEMORY" ); + errstr = "GL_OUT_OF_MEMORY"; break; default: - strcpy( errstr, "unknown" ); + errstr = "unknown"; break; } fprintf( stderr, "Mesa user error: %s in %s\n", errstr, s ); 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 324e9c2ff..6d0428fb2 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.12 2001/03/21 16:14:21 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c,v 1.13 2001/08/18 02:51:04 dawes Exp $ */ /* * Authors: diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c index c99e1c98a..34c9750f4 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c @@ -24,7 +24,7 @@ * Authors: * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.10 2001/04/10 16:07:50 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.11 2001/08/18 02:51:05 dawes Exp $ */ #include "types.h" diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaregs.h b/xc/lib/GL/mesa/src/drv/mga/mgaregs.h index fb667c537..91aacba44 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaregs.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaregs.h @@ -19,6 +19,7 @@ * 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/mgaregs.h,v 1.4 2001/08/18 11:55:47 tsi Exp $ */ #ifndef _MGAREGS_H_ #define _MGAREGS_H_ diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.c b/xc/lib/GL/mesa/src/drv/mga/mgastate.c index 926548a7d..b954be44b 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgastate.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgastate.c @@ -24,7 +24,7 @@ * Authors: * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.10.2.1 2001/05/31 08:31:23 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.11 2001/05/31 08:29:42 alanh Exp $ */ #include <stdio.h> diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c index 6c925bc0c..9baf7875f 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatex.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.c @@ -24,7 +24,7 @@ * Authors: * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.10.2.1 2001/05/31 08:31:23 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.12 2001/08/18 02:51:05 dawes Exp $ */ #include <stdlib.h> #include <stdio.h> 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 1694f8d36..d6d42c5cc 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.9 2001/04/10 16:07:52 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.10 2001/08/18 02:51:05 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., 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 065b65999..d7900ea45 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.8 2001/03/21 16:14:24 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c,v 1.9 2001/08/18 02:51:05 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., 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 8985361b7..83c22f878 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.3.2.1 2001/05/22 21:25:41 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c,v 1.4 2001/05/21 21:43:52 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c index b1d87f599..fe0780804 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_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/sis/sis_xmesa.c,v 1.9.2.1 2001/05/22 21:25:41 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c,v 1.10 2001/05/19 18:29:18 dawes Exp $ */ /* * Authors: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile index b7f4346e4..abb22e61a 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile +++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.25.2.1 2001/06/01 07:42:23 alanh Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.28 2001/08/18 02:51:06 dawes Exp $ #include <Threads.tmpl> @@ -23,8 +23,6 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.25.2.1 2001/06/01 07:4 #include "../../X86/Imakefile.inc" #endif - DEPEND_DEFINES = -D__linux__ - DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(MESA_ASM_DEFINES) INCLUDES = $(X_INCLUDES) $(MESA_INCLUDES) $(DRI_INCLUDES) \ -I$(GLIDE3INCDIR) diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc index 88ad0d988..0b7080a49 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc +++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc,v 1.2 2001/05/02 15:06:04 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile.inc,v 1.3 2001/08/18 02:51:06 dawes Exp $ #ifndef MesaDrvSrcDir #define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c index 1669e7865..568da0563 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c @@ -23,7 +23,7 @@ * 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.2.1 2001/05/22 21:25:41 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c,v 1.3 2001/08/18 02:51:06 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h index 07f7703b2..3ab973604 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h,v 1.2 2001/08/18 02:51:06 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c index 797ec88d6..132bea2ad 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c @@ -23,7 +23,7 @@ * 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.4 2001/05/02 15:06:04 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c,v 1.5 2001/08/18 02:51:06 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c index d6a44dc0f..d448ad581 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_fastpath.c,v 1.2 2001/08/18 02:51:06 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c index 94119f7c3..ae2aca898 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c,v 1.2 2001/08/18 02:51:06 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h index 249384f81..8f258f57b 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h,v 1.2 2001/08/18 02:51:06 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c index 6c3efa501..9be3edf44 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c,v 1.3 2001/08/18 02:51:06 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c index 64dcadb78..42acda0c7 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c,v 1.2 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c index 600ba1432..5d47e948a 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c,v 1.2 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c index 18c75965e..06bd0022f 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c,v 1.3 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: @@ -557,6 +557,10 @@ GetFbParams(tdfxContextPtr fxMesa, * it's better in the macro or in the call. * * Recall that x and y are screen coordinates. + * + * Note: ANSI C doesn't allow conditional expressions or cast expressions + * as lvalues. Some of these macros violate that. + * */ #define GET_FB_DATA(ReadParamsp, type, x, y) \ (((x) < (ReadParamsp)->firstWrappedX) \ diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c index 10316454b..4738fe809 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c @@ -23,7 +23,7 @@ * 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.2 2001/05/02 15:06:04 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c,v 1.3 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c index b54e6b387..3b9a40d3f 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c @@ -23,7 +23,7 @@ * 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.2.1 2001/05/22 21:25:41 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c,v 1.3 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c index d3d2275af..273fd3169 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c @@ -23,7 +23,7 @@ * 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.2.2.1 2001/05/22 21:25:41 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c,v 1.4 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c index e75866529..2afe815b2 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c,v 1.2 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h index da7f9fc81..4ef310b3a 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h,v 1.2 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h index 0fbf52ef6..04d01e7f2 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tritmp.h,v 1.2 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c index 96d1e06c3..70641eb9a 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.c,v 1.2 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h index 23a9b5bc7..9bb819c96 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h @@ -39,7 +39,7 @@ * * See fxapi.h for more revision/author details. */ - +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_wrapper.h,v 1.3 2001/08/18 11:55:48 tsi Exp $ */ #ifndef __FX_GLIDE_WARPER__ #define __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 c32e4dc04..9fb4a8321 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c @@ -23,7 +23,7 @@ * 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 $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c,v 1.13 2001/08/18 02:51:07 dawes Exp $ */ /* * Original rewrite: diff --git a/xc/lib/Imakefile b/xc/lib/Imakefile index a6e7a2a93..4d600393a 100644 --- a/xc/lib/Imakefile +++ b/xc/lib/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:44:00 cpqbld Exp $ -XCOMM $XFree86: xc/lib/Imakefile,v 3.52 2001/04/03 17:36:28 dawes Exp $ +XCOMM $XFree86: xc/lib/Imakefile,v 3.56 2001/08/13 21:46:46 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags @@ -75,6 +75,9 @@ XINERAMADIR=Xinerama #if BuildGLXLibrary GLXLIBDIR = GL +#endif + +#if BuildGLwLibrary GLWLIBDIR = GLw #endif @@ -106,6 +109,10 @@ XFTLIBDIR = Xft FREETYPE2BUILDDIR = freetype2 #endif +#if BuildRandRLibrary +RANDRLIBDIR = Xrandr +#endif + XF86EXTLIBS = $(XF86MISCLIBDIR) $(XF86VMLIBDIR) \ $(XF86DGALIBDIR) $(XF86RUSHLIBDIR) @@ -135,6 +142,10 @@ FONTCACHELIBDIR = Xfontcache FONTSUBDIR = font +#if BuildFontEncLib +FONTENCSUBDIR = fontenc +#endif + XAULIBDIR = Xau XDMCPLIBDIR = Xdmcp X11LIBDIR = X11 @@ -167,9 +178,10 @@ LINTSUBDIRS = $(XAULIBDIR) $(XDMCPLIBDIR) $(THRSTUBLIBDIR) $(X11LIBDIR) \ $(XVLIBDIR) $(GLXLIBDIR) $(GLULIBDIR) $(GLWLIBDIR) \ $(DPSLIBDIR) $(DPSTKLIBDIR) $(PSRESLIBDIR) $(XINERAMADIR) \ $(ZLIBDIR) $(REGEXDIR) $(RENDERLIBDIR) $(FREETYPE2BUILDDIR) \ - $(XFTLIBDIR) $(XVMCLIBDIR) + $(XFTLIBDIR) $(XVMCLIBDIR) $(RANDRLIBDIR) -SUBDIRS = $(BERKDIR) xtrans $(LINTSUBDIRS) $(FONTSUBDIR) $(FONTCACHELIBDIR) +SUBDIRS = $(BERKDIR) xtrans $(LINTSUBDIRS) $(FONTSUBDIR) $(FONTENCSUBDIR) \ + $(FONTCACHELIBDIR) MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/xc/lib/X11/Imakefile b/xc/lib/X11/Imakefile index 75b2da1f5..1e56341a7 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.38 2001/05/01 10:35:05 alanh Exp $ +XCOMM $XFree86: xc/lib/X11/Imakefile,v 3.40 2001/07/23 13:15:41 dawes Exp $ #define DoNormalLib NormalLibX11 #define DoSharedLib SharedLibX11 @@ -936,10 +936,6 @@ SpecialCLibObjectRule(imConv,$(ICONFIGFILES),$(XKB_DEFINES)) #if HasKrb5 SpecialCLibObjectRule(k5encode,$(_NOOP_),$(K5INCL)) #endif -#ifdef MinixArchitecture -SpecialCLibObjectRule(IMWrap,$(ICONFIGFILES),-DX11_TINY_IM) -SpecialCLibObjectRule(lcInit,$(ICONFIGFILES),-DX11_TINY_LC) -#endif #if InstallXcmsTxt InstallNonExecFile(Xcms.txt,$(LIBDIR)) @@ -969,18 +965,18 @@ LOCAL_LDFLAGS=-F MAKEKEYS = ./makekeys ks_tables.h: $(XINCLUDESRC)/keysymdef.h util/makekeys.c - RemoveFiles($@ ProgramTargetName(makekeys) makekeys.Osuf) - -HostLinkRule(ProgramTargetName(makekeys),$(CFLAGS) $(LOCAL_LDFLAGS),util/makekeys.c,$(LDLIBS)) + RemoveFiles($@ HostProgramTargetName(makekeys) makekeys.Osuf) + -HostLinkRule(HostProgramTargetName(makekeys),$(CFLAGS) $(LOCAL_LDFLAGS),util/makekeys.c,$(LDLIBS)) RunProgram(MAKEKEYS,< $(XINCLUDESRC)/keysymdef.h > ks_tables_h) $(MV) ks_tables_h $@ - RemoveFiles(ProgramTargetName(makekeys) makekeys.Osuf ks_tables_h) + RemoveFiles(HostProgramTargetName(makekeys) makekeys.Osuf ks_tables_h) includes:: ks_tables.h depend:: ks_tables.h clean:: - RemoveFiles(ks_tables_h ks_tables.h ProgramTargetName(makekeys)) + RemoveFiles(ks_tables_h ks_tables.h HostProgramTargetName(makekeys)) DependTarget3($(SRCS1),$(SRCS2),$(SRCS3)) #else diff --git a/xc/lib/X11/Xvarargs.h b/xc/lib/X11/Xvarargs.h deleted file mode 100644 index 8d166a72a..000000000 --- a/xc/lib/X11/Xvarargs.h +++ /dev/null @@ -1,66 +0,0 @@ -/* $TOG: Xvarargs.h /main/5 1998/02/06 18:03:41 kaleb $ */ -/* - -Copyright 1985, 1986, 1987, 1988, 1989, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifndef _XVARARGS_H_ -#define _XVARARGS_H_ - -#ifdef __HIGHC__ -#ifndef _STDARG_H -#define _STDARG_H - -typedef char *va_list; - -/* Amount of space required in an argument list for an arg of type TYPE. - TYPE may alternatively be an expression whose type is used. */ - -#define __va_rounded_size(TYPE) \ - (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) - -#define va_start(AP, LASTARG) \ - (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) - -#define va_end(AP) - -#define va_arg(AP, TYPE) \ - (AP += __va_rounded_size (TYPE), \ - *((TYPE *) (AP - __va_rounded_size (TYPE)))) - -#endif /* _STDARG_H */ - -#define Va_start(a,b) va_start(a,b) - -#else /* !__HIGHC__ */ - -#if NeedVarargsPrototypes -# include <stdarg.h> -# define Va_start(a,b) va_start(a,b) -#else -# include <varargs.h> -# define Va_start(a,b) va_start(a) -#endif - -#endif /* __HIGHC__ */ - -#endif /* _XVARARGS_H_ */ diff --git a/xc/lib/Xft/xftint.h b/xc/lib/Xft/xftint.h index f92dd4876..46e0c0997 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.25 2001/05/18 16:03:06 tsi Exp $ + * $XFree86: xc/lib/Xft/xftint.h,v 1.26 2001/07/13 18:16:10 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -264,7 +264,7 @@ XftCoreConvert16 (XftChar16 *string, XChar2b xcloc[XFT_CORE_N16LOCAL]); XChar2b * -XftCoreConvert32 (unsigned int *string, +XftCoreConvert32 (XftChar32 *string, int len, XChar2b xcloc[XFT_CORE_N16LOCAL]); @@ -291,7 +291,7 @@ XftCoreExtents16 (Display *dpy, void XftCoreExtents32 (Display *dpy, XFontStruct *fs, - unsigned int *string, + XftChar32 *string, int len, XGlyphInfo *extents); @@ -305,7 +305,7 @@ XftCoreExtentsUtf8 (Display *dpy, Bool XftCoreGlyphExists (Display *dpy, XFontStruct *fs, - unsigned int glyph); + XftChar32 glyph); /* xftdbg.c */ void diff --git a/xc/lib/Xft/xftrender.c b/xc/lib/Xft/xftrender.c index 1be21a65a..02dd97b95 100644 --- a/xc/lib/Xft/xftrender.c +++ b/xc/lib/Xft/xftrender.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/Xft/xftrender.c,v 1.7 2001/04/21 16:58:02 keithp Exp $ + * $XFree86: xc/lib/Xft/xftrender.c,v 1.8 2001/07/13 18:16:10 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -32,7 +32,7 @@ XftRenderString8 (Display *dpy, Picture src, int x, int y, XftChar8 *string, int len) { - unsigned int missing[XFT_NMISSING]; + XftChar32 missing[XFT_NMISSING]; int nmissing; XftChar8 *s; int l; @@ -41,7 +41,7 @@ XftRenderString8 (Display *dpy, Picture src, l = len; nmissing = 0; while (l--) - XftGlyphCheck (dpy, font, (unsigned int) *s++, missing, &nmissing); + XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing); if (nmissing) XftGlyphLoad (dpy, font, missing, nmissing); XRenderCompositeString8 (dpy, PictOpOver, src, dst, @@ -56,7 +56,7 @@ XftRenderString16 (Display *dpy, Picture src, int x, int y, XftChar16 *string, int len) { - unsigned int missing[XFT_NMISSING]; + XftChar32 missing[XFT_NMISSING]; int nmissing; XftChar16 *s; int l; @@ -65,7 +65,7 @@ XftRenderString16 (Display *dpy, Picture src, l = len; nmissing = 0; while (l--) - XftGlyphCheck (dpy, font, (unsigned int) *s++, missing, &nmissing); + XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing); if (nmissing) XftGlyphLoad (dpy, font, missing, nmissing); XRenderCompositeString16 (dpy, PictOpOver, src, dst, @@ -78,18 +78,18 @@ XftRenderString32 (Display *dpy, Picture src, XftFontStruct *font, Picture dst, int srcx, int srcy, int x, int y, - unsigned int *string, int len) + XftChar32 *string, int len) { - unsigned int missing[XFT_NMISSING]; + XftChar32 missing[XFT_NMISSING]; int nmissing; - unsigned int *s; + XftChar32 *s; int l; s = string; l = len; nmissing = 0; while (l--) - XftGlyphCheck (dpy, font, (unsigned int) *s++, missing, &nmissing); + XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing); if (nmissing) XftGlyphLoad (dpy, font, missing, nmissing); XRenderCompositeString32 (dpy, PictOpOver, src, dst, @@ -191,7 +191,7 @@ XftRenderExtents8 (Display *dpy, int len, XGlyphInfo *extents) { - unsigned int missing[XFT_NMISSING]; + XftChar32 missing[XFT_NMISSING]; int nmissing; XftChar8 *s, c; int l; @@ -205,7 +205,7 @@ XftRenderExtents8 (Display *dpy, l = len; nmissing = 0; while (l--) - XftGlyphCheck (dpy, font, (unsigned int) *s++, missing, &nmissing); + XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing); if (nmissing) XftGlyphLoad (dpy, font, missing, nmissing); @@ -268,22 +268,25 @@ XftRenderExtents8 (Display *dpy, void XftRenderExtents16 (Display *dpy, XftFontStruct *font, - XftChar16 *string, + XftChar16 *string, int len, XGlyphInfo *extents) { - unsigned int missing[XFT_NMISSING]; + XftChar32 missing[XFT_NMISSING]; int nmissing; XftChar16 *s, c; int l; XGlyphInfo *gi; int x, y; + int left, right, top, bottom; + int overall_left, overall_right; + int overall_top, overall_bottom; s = string; l = len; nmissing = 0; while (l--) - XftGlyphCheck (dpy, font, (unsigned int) *s++, missing, &nmissing); + XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing); if (nmissing) XftGlyphLoad (dpy, font, missing, nmissing); @@ -306,26 +309,39 @@ XftRenderExtents16 (Display *dpy, extents->xOff = 0; return; } - *extents = *gi; - x = gi->xOff; - y = gi->yOff; + x = 0; + y = 0; + overall_left = x - gi->x; + overall_top = y - gi->y; + overall_right = overall_left + (int) gi->width; + overall_bottom = overall_top + (int) gi->height; + x += gi->xOff; + y += gi->yOff; while (len--) { c = *string++; gi = c < font->nrealized ? font->realized[c] : 0; if (!gi) continue; - if (gi->x + x < extents->x) - extents->x = gi->x + x; - if (gi->y + y < extents->y) - extents->y = gi->y + y; - if (gi->width + x > extents->width) - extents->width = gi->width + x; - if (gi->height + y > extents->height) - extents->height = gi->height + y; + left = x - gi->x; + top = y - gi->y; + right = left + (int) gi->width; + bottom = top + (int) gi->height; + if (left < overall_left) + overall_left = left; + if (top < overall_top) + overall_top = top; + if (right > overall_right) + overall_right = right; + if (bottom > overall_bottom) + overall_bottom = bottom; x += gi->xOff; y += gi->yOff; } + extents->x = -overall_left; + extents->y = -overall_top; + extents->width = overall_right - overall_left; + extents->height = overall_bottom - overall_top; extents->xOff = x; extents->yOff = y; } @@ -333,22 +349,25 @@ XftRenderExtents16 (Display *dpy, void XftRenderExtents32 (Display *dpy, XftFontStruct *font, - unsigned int *string, + XftChar32 *string, int len, XGlyphInfo *extents) { - unsigned int missing[XFT_NMISSING]; + XftChar32 missing[XFT_NMISSING]; int nmissing; - unsigned int *s, c; + XftChar32 *s, c; int l; XGlyphInfo *gi; int x, y; + int left, right, top, bottom; + int overall_left, overall_right; + int overall_top, overall_bottom; s = string; l = len; nmissing = 0; while (l--) - XftGlyphCheck (dpy, font, (unsigned int) *s++, missing, &nmissing); + XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing); if (nmissing) XftGlyphLoad (dpy, font, missing, nmissing); @@ -371,26 +390,39 @@ XftRenderExtents32 (Display *dpy, extents->xOff = 0; return; } - *extents = *gi; - x = gi->xOff; - y = gi->yOff; + x = 0; + y = 0; + overall_left = x - gi->x; + overall_top = y - gi->y; + overall_right = overall_left + (int) gi->width; + overall_bottom = overall_top + (int) gi->height; + x += gi->xOff; + y += gi->yOff; while (len--) { c = *string++; gi = c < font->nrealized ? font->realized[c] : 0; if (!gi) continue; - if (gi->x + x < extents->x) - extents->x = gi->x + x; - if (gi->y + y < extents->y) - extents->y = gi->y + y; - if (gi->width + x > extents->width) - extents->width = gi->width + x; - if (gi->height + y > extents->height) - extents->height = gi->height + y; + left = x - gi->x; + top = y - gi->y; + right = left + (int) gi->width; + bottom = top + (int) gi->height; + if (left < overall_left) + overall_left = left; + if (top < overall_top) + overall_top = top; + if (right > overall_right) + overall_right = right; + if (bottom > overall_bottom) + overall_bottom = bottom; x += gi->xOff; y += gi->yOff; } + extents->x = -overall_left; + extents->y = -overall_top; + extents->width = overall_right - overall_left; + extents->height = overall_bottom - overall_top; extents->xOff = x; extents->yOff = y; } @@ -402,13 +434,16 @@ XftRenderExtentsUtf8 (Display *dpy, int len, XGlyphInfo *extents) { - unsigned int missing[XFT_NMISSING]; + XftChar32 missing[XFT_NMISSING]; int nmissing; XftChar8 *s; XftChar32 c; int l, clen; XGlyphInfo *gi; int x, y; + int left, right, top, bottom; + int overall_left, overall_right; + int overall_top, overall_bottom; s = string; l = len; @@ -418,7 +453,7 @@ XftRenderExtentsUtf8 (Display *dpy, clen = XftUtf8ToUcs4 (s, &c, l); if (clen < 0) break; - XftGlyphCheck (dpy, font, c, missing, &nmissing); + XftGlyphCheck (dpy, font, (XftChar32) c, missing, &nmissing); s += clen; l -= clen; } @@ -450,9 +485,14 @@ XftRenderExtentsUtf8 (Display *dpy, extents->xOff = 0; return; } - *extents = *gi; - x = gi->xOff; - y = gi->yOff; + x = 0; + y = 0; + overall_left = x - gi->x; + overall_top = y - gi->y; + overall_right = overall_left + (int) gi->width; + overall_bottom = overall_top + (int) gi->height; + x += gi->xOff; + y += gi->yOff; while (len) { clen = XftUtf8ToUcs4 (string, &c, len); @@ -463,17 +503,25 @@ XftRenderExtentsUtf8 (Display *dpy, gi = c < font->nrealized ? font->realized[c] : 0; if (!gi) continue; - if (gi->x + x < extents->x) - extents->x = gi->x + x; - if (gi->y + y < extents->y) - extents->y = gi->y + y; - if (gi->width + x > extents->width) - extents->width = gi->width + x; - if (gi->height + y > extents->height) - extents->height = gi->height + y; + left = x - gi->x; + top = y - gi->y; + right = left + (int) gi->width; + bottom = top + (int) gi->height; + if (left < overall_left) + overall_left = left; + if (top < overall_top) + overall_top = top; + if (right > overall_right) + overall_right = right; + if (bottom > overall_bottom) + overall_bottom = bottom; x += gi->xOff; y += gi->yOff; } + extents->x = -overall_left; + extents->y = -overall_top; + extents->width = overall_right - overall_left; + extents->height = overall_bottom - overall_top; extents->xOff = x; extents->yOff = y; } diff --git a/xc/lib/xtrans/Xtransam.c b/xc/lib/xtrans/Xtransam.c deleted file mode 100644 index fe9f2bccf..000000000 --- a/xc/lib/xtrans/Xtransam.c +++ /dev/null @@ -1,2002 +0,0 @@ -/* $TOG: Xtransam.c /main/5 1998/02/06 15:54:26 kaleb $ */ -/* - -Copyright 1994, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* $XFree86: xc/lib/xtrans/Xtransam.c,v 3.2 1998/10/03 09:07:34 dawes Exp $ */ - -/* Copyright 1994 Vrije Universiteit Amsterdam, Netherlands - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, 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 Vrije Universiteit not be used - * in advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The Vrije Universiteit - * makes no representations about the suitability of this software for - * any purpose. It is provided "as is" without express or implied warranty. - * - * THE VRIJE UNIVERSITEIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL THE VRIJE UNIVERSITEIT 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. - */ - -/* - * This is the Amoeba implementation of the X Transport service layer - */ - -#define event am_event_t -#define interval am_interval_t -#define port am_port_t -#include <amoeba.h> -#include <semaphore.h> -#include <cmdreg.h> -#include <stdcom.h> -#include <stderr.h> -#include <vc.h> -#include <circbuf.h> -#include <exception.h> -#include <module/signals.h> -#include <ampolicy.h> -#include <stdlib.h> -#include <stdio.h> -#include <exception.h> -#include <fault.h> -#include <signal.h> -#include <ctype.h> -#include <module/name.h> -#include <server/x11/Xamoeba.h> -#include <server/ip/hton.h> -#include <server/ip/types.h> -#include <server/ip/gen/in.h> -#include <server/ip/gen/tcp.h> -#include <server/ip/tcpip.h> -#include <server/ip/tcp_io.h> -#include <server/ip/gen/tcp_io.h> -#include <server/ip/gen/netdb.h> -#include <server/ip/gen/inet.h> -#undef event -#undef interval -#undef port - -extern char *strdup(); - -/* a new family for Amoeba RPC connections */ -#define AF_AMOEBA 33 -#define FamilyAmoeba 33 - -#define MAX_TCPIP_RETRY 4 -#define CIRCBUFSIZE 4096 /* was 1024 */ - -/* - * Amoeba channel description: - */ -typedef struct _XAmChanDesc { - int state; /* current state of connection */ - int type; /* type of connection */ - int status; /* status used by server */ - signum signal; /* signal to kill TCP/IP reader */ - semaphore *sema; /* select semaphore */ - struct vc *virtcirc; /* virtual circuit for Amoeba RPC */ - struct circbuf *circbuf; /* circular buffer for TCP/IP */ - capability chancap; /* TCP/IP channel capability */ - XtransConnInfo conninfo; /* back pointer to the connect info */ -} XAmChanDesc; - -/* Amoeba channel descriptor states */ -#define ACDS_FREE 0 /* unused */ -#define ACDS_USED 1 /* intermediate state */ -#define ACDS_CLOSED 2 /* just closed */ - -/* Amoeba channel types */ -#define ACDT_TCPIP 1 /* TCP/IP connection */ -#define ACDT_VIRTCIRC 2 /* Amoeba virtual circuit connection */ - - -#ifdef XSERV_t -#include "dix.h" /* clients[] needed by AmFindReadyClients */ -#define Error(list) ErrorF list -#define Fatal(list) FatalError list -#else -#define Error(list) printf list -#define Fatal(list) { printf list; exit(1); } -#endif - -#define dbprintf(list) /* printf list */ -#define doprintf(list) printf list /**/ - -/* - * First: utility functions. - */ - -#if defined(XSERV_t) || defined(FS_t) - -static semaphore main_sema; - -/* The X-server consists of one main thread, running the non re-entrant - * X code, and a number of auxilary threads that take care of reading - * the input streams, and input devices. The following set of routines - * wake up the main thread when it has something to do. - */ -void -InitMainThread() -{ - sema_init(&main_sema, 0); -} - -void -WakeUpMainThread() -{ - sema_up(&main_sema); -} - -int -SleepMainThread(timeout) -am_interval_t timeout; -{ - dbprintf(("Sleeping main thread timeout %d\n", timeout)); - return (sema_trydown(&main_sema, timeout) == 0) ? 0 : -1; -} - - -static int init_waiters; -static semaphore init_sema; - -void -AmInitWaitFor() -{ - init_waiters = 0; - sema_init(&init_sema, 0); -} - -/* - * Force caller thread to wait until main has finished the initialization. - */ -void -WaitForInitialization() -{ - init_waiters++; - dbprintf(("Waiting for initialization (%d)\n", init_waiters)); - sema_down(&init_sema); -} - -void -WakeupInitWaiters() -{ - /* wakeup threads in initial sleep */ - if (init_waiters > 0) { - dbprintf(("%d waiters wait for something ...\n", init_waiters)); - while (init_waiters-- > 0) { - sema_up(&init_sema); - } - } -} - -#endif /* XSERV_t || FS_t */ - - -#define THREAD_STACK_SIZE (8*1024) - -/* - * Amoeba connection information is stored in, so called, - * channel descriptors. Channel descriptors are identified - * by their index in the table below. - */ -static XAmChanDesc XAmChanDescriptors[OPEN_MAX]; -static void XAmCleanUpChanDesc(); /* forward */ - -/* - * Cleanup connection descriptors on a signal - */ -static void -XAmSignalCleanUpChanDesc(sig) - int sig; -{ - XAmCleanUpChanDesc(); - _exit(sig | 0x80); -} - -/* - * Cleanup connection descriptors - */ -static void -XAmCleanUpChanDesc() -{ - register int i; - - for (i = 0; i < OPEN_MAX; i++) { - switch (XAmChanDescriptors[i].type) { - case ACDT_TCPIP: - /* The Amoeba TCP/IP server is capability based, i.e. - * it uses capabilities to identify connections. Since a - * capability is only destroyed when it has aged too much - * or is explicitly deleted, the connection it identifies - * will tend to exist for some while even if the client is - * already gone. To force connections to close this loop - * destroys all open TCP/IP connection. This loop us auto- - * matically executed when exit() is called. - */ - std_destroy(&XAmChanDescriptors[i].chancap); - break; - case ACDT_VIRTCIRC: - /* Close the virtual circuit asynchronously, or otherwise - * we may hang for a minute under some (?) conditions. - */ - vc_close(XAmChanDescriptors[i].virtcirc, VC_BOTH | VC_ASYNC); - break; - } - XAmChanDescriptors[i].state = ACDS_FREE; - } -} - -/* - * Allocate a channel descriptor - */ -static XAmChanDesc * -XAmAllocChanDesc() -{ - register int i; - -#ifndef XSERV_t - - static int initialized = 0; - - /* - * Since the TCP/IP server is capability based its connections exists - * even if the owner process is long gone. To overcome this nuisance, - * a sweep is made over the connection descriptors when exit() is - * called or when an un-catched (by application program) signal is - * received. - */ - if (!initialized) { - initialized = 1; - atexit(XAmCleanUpChanDesc); - if (signal(SIGHUP, SIG_IGN) != SIG_IGN) - signal(SIGHUP, XAmSignalCleanUpChanDesc); - if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) - signal(SIGQUIT, XAmSignalCleanUpChanDesc); - if (signal(SIGINT, SIG_IGN) != SIG_IGN) - signal(SIGINT, XAmSignalCleanUpChanDesc); - if (signal(SIGTERM, SIG_IGN) != SIG_IGN) - signal(SIGTERM, XAmSignalCleanUpChanDesc); - } -#endif - - for (i = 0; i < OPEN_MAX; i++) { - if (XAmChanDescriptors[i].state == ACDS_FREE) { - XAmChanDescriptors[i].state = ACDS_USED; - XAmChanDescriptors[i].conninfo = NULL; - return &XAmChanDescriptors[i]; - } - } - return NULL; -} - -/* - * Convert ``file descriptor'' to channel descriptor - */ -static XAmChanDesc * -XAmFdToChanDesc(fd) - int fd; -{ - if (fd >= 0 && fd < OPEN_MAX) { - return &XAmChanDescriptors[fd]; - } else { - return NULL; - } -} - -/* - * Convert channel descriptor to ``file descriptor'' - */ -static int -XAmChanDescToFd(chandesc) - XAmChanDesc *chandesc; -{ - return chandesc - XAmChanDescriptors; -} - -/* - * Free channel descriptor - */ -static void -XAmFreeChanDesc(chandesc) - XAmChanDesc *chandesc; -{ - if (chandesc->sema) { - xfree(chandesc->sema); - chandesc->sema = NULL; - } - chandesc->state = ACDS_FREE; -} - -static void XAmReaderThread(); - -static int -MakeAmConnection(phostname, idisplay, familyp, saddrlenp, saddrp) - char *phostname; - int idisplay; - int *familyp; /* RETURN */ - int *saddrlenp; /* RETURN */ - char **saddrp; /* RETURN */ -{ - capability xservercap; - char xserverpath[256]; - XAmChanDesc *chandesc; - errstat err; - - /* Amoeba requires a server hostname */ - if (phostname == NULL || *phostname == '\0') { - fprintf(stderr, "MakeAmConnection: Display name expected\n"); - return -1; - } - - /* allocate channel descriptor */ - chandesc = XAmAllocChanDesc(); - if (chandesc == NULL) { - fprintf(stderr, "MakeAmConnection: Out of channel capabilities\n"); - return -1; - } - - /* - * There are two possible way to make a connection on Amoeba. Either - * through an Amoeba RPC or a TCP/IP connection. Depending on whether - * the X server resides on Amoeba, Amoeba RPC's are used. Otherwise - * it uses a TCP/IP connection. - */ - (void)sprintf(xserverpath, "%s/%s:%d", DEF_XSVRDIR, phostname, idisplay); - if ((err = name_lookup(xserverpath, &xservercap)) == STD_OK) { - am_port_t vccaps[2]; - bufsize size; - errstat err; - header hdr; - - /* Amoeba virtual circuit connection */ - chandesc->type = ACDT_VIRTCIRC; - - /* get the two connection ports from the X-server */ - hdr.h_command = AX_CONNECT; - hdr.h_port = xservercap.cap_port; - hdr.h_priv = xservercap.cap_priv; - size = trans(&hdr, NILBUF, 0, &hdr, (char *)vccaps, sizeof(vccaps)); - if (ERR_STATUS(size)) { - err = ERR_CONVERT(size); - } else { - err = ERR_CONVERT(hdr.h_status); - } - if (err != STD_OK || size != sizeof(vccaps)) { - fprintf(stderr, "Xlib: connect to Amoeba X-server failed (%s)\n", - err_why(err)); - XAmFreeChanDesc(chandesc); - return -1; - } - - /* setup an Amoeba virtual circuit */ - chandesc->virtcirc = - vc_create(&vccaps[1], &vccaps[0], MAXBUFSIZE, MAXBUFSIZE); - if (chandesc->virtcirc == (struct vc *)NULL) { - fprintf(stderr, "Xlib: Amoeba virtual circuit create failed\n"); - XAmFreeChanDesc(chandesc); - return -1; - } - - /* Special Amoeba family type. For Amoeba no additional access control - * mechanism exists; when you have the server capability, you have - * the access. Just use a fake address. - */ - *familyp = AF_AMOEBA; - *saddrp = strdup("Amoeba"); - *saddrlenp = strlen(*saddrp); - } else { - char tcpname[256]; - capability tcpcap; - ipaddr_t ipaddr; - char *tcpsvr; - nwio_tcpcl_t tcpcl; - nwio_tcpconf_t tcpconf; - XAmChanDesc **param; - int result; - - /* Amoeba TCP/IP connection */ - chandesc->type = ACDT_TCPIP; - - /* lookup up TCP/IP server */ - if ((tcpsvr = getenv("TCP_SERVER")) == NULL) { - tcpsvr = TCP_SVR_NAME; - } - if ((err = name_lookup(tcpsvr, &tcpcap)) != STD_OK) { - fprintf(stderr, "Xlib: Cannot lookup %s (%s)\n", - tcpsvr, err_why(err)); - std_destroy(&chandesc->chancap); - XAmFreeChanDesc(chandesc); - return -1; - } - - /* establish TCP/IP connection */ - if ((err = tcpip_open(&tcpcap, &chandesc->chancap)) != STD_OK) { - fprintf(stderr, "Xlib: Cannot open TCP/IP server on %s (%s)\n", - tcpsvr, tcpip_why(err)); - std_destroy(&chandesc->chancap); - XAmFreeChanDesc(chandesc); - return -1; - } - - /* lookup TCP/IP hostname */ - if (isdigit(phostname[0])) { - ipaddr = inet_addr(phostname); - } else { - struct hostent *hp = gethostbyname(phostname); - if (hp == NULL) { - fprintf(stderr, "Xlib: %s unknown host\n", phostname); - return -1; - } - memcpy(&ipaddr, hp->h_addr, hp->h_length); - } - - /* set remote address/port on the TCP/IP connection */ - tcpconf.nwtc_flags = NWTC_SET_RA|NWTC_SET_RP|NWTC_LP_SEL; - tcpconf.nwtc_remaddr = ipaddr; - tcpconf.nwtc_remport = htons(6000+idisplay); - if ((err = tcp_ioc_setconf(&chandesc->chancap, &tcpconf)) != STD_OK) { - fprintf(stderr, "Xlib: Cannot configure TCP/IP server (%s)\n", - tcpip_why(err)); - std_destroy(&chandesc->chancap); - XAmFreeChanDesc(chandesc); - return -1; - } - - /* make the actual TCP/IP connection */ - tcpcl.nwtcl_flags = 0; - if ((err = tcp_ioc_connect(&chandesc->chancap, &tcpcl)) != STD_OK) { - fprintf(stderr, "Xlib: Cannot make TCP/IP connection (%s)\n", - tcpip_why(err)); - std_destroy(&chandesc->chancap); - XAmFreeChanDesc(chandesc); - return -1; - } - - /* start TCP/IP reader thread */ - chandesc->signal = sig_uniq(); - chandesc->circbuf = cb_alloc(CIRCBUFSIZE); - param = (XAmChanDesc **) xalloc(sizeof(XAmChanDesc *)); /* error checking? */ - *param = chandesc; - result = thread_newthread(XAmReaderThread, THREAD_STACK_SIZE, - (char *)param, sizeof(XAmChanDesc *)); - if (result == 0) { - fprintf(stderr, "Xlib: Cannot start reader thread\n"); - std_destroy(&chandesc->chancap); - XAmFreeChanDesc(chandesc); - return -1; - } - threadswitch(); /* give reader a try */ - - /* - * Family type is set to Internet so that the .Xauthority - * files from Unix will work under Amoeba (for Unix displays). - */ - *familyp = AF_INET; - *saddrlenp = sizeof(ipaddr_t); - *saddrp = xalloc(sizeof(ipaddr_t)); - memcpy(*saddrp, (char *)&ipaddr, sizeof(ipaddr_t)); /* error checking? */ - } - - return XAmChanDescToFd(chandesc); -} - -/* - * The TCP/IP server silently assumes a maximum buffer size of 30000 bytes. - */ -#define TCPIP_BUFSIZE 16384 - -static void -XAMCloseChannel(chandesc) -XAmChanDesc *chandesc; -{ - if (chandesc->state == ACDS_USED && chandesc->type == ACDT_TCPIP) { - cb_close(chandesc->circbuf); - chandesc->state = ACDS_CLOSED; - } -} - - -/* - * Shutdown TCP/IP reader thread - */ -static void -XAmReaderSignalCatcher(sig, us, extra) - signum sig; - thread_ustate *us; - _VOIDSTAR extra; -{ - register XAmChanDesc *chandesc = (XAmChanDesc *)extra; - - XAMCloseChannel(chandesc); - thread_exit(); -} - -/* - * TCP/IP reader thread - */ -static void -XAmReaderThread(argptr, argsize) - void *argptr; - int argsize; -{ - register XAmChanDesc *chandesc; - - chandesc = *((XAmChanDesc **)argptr); - (void) sig_catch(chandesc->signal, XAmReaderSignalCatcher, - (_VOIDSTAR) chandesc); - - while (chandesc->state == ACDS_USED) { - char buffer[CIRCBUFSIZE]; - bufsize size; - - size = tcpip_read(&chandesc->chancap, buffer, sizeof(buffer)); - if (ERR_STATUS(size) || size == 0) { - if (size == 0) { - static char msg[] = "Xlib: TCP/IP channel closed\n"; - - write(2, msg, sizeof(msg)); - } else { - fprintf(stderr, "Xlib: TCP/IP read failed (%s)\n", - err_why(ERR_CONVERT(size))); - } - XAMCloseChannel(chandesc); - break; - } - - if (cb_puts(chandesc->circbuf, buffer, size) != 0) { - fprintf(stderr, "Xlib: short write to circular buffer\n"); - XAMCloseChannel(chandesc); - } - } - - thread_exit(); -} - -/* - * Wait until input is available or until the timer expires. - */ -int -TRANS(AmSelect)(ifd, timout) - int ifd; - int timout; -{ - XAmChanDesc *chandesc; - int n; - - errno = 0; - - chandesc = XAmFdToChanDesc(ifd); - if (chandesc == NULL || chandesc->state != ACDS_USED) { - errno = EBADF; - return -1; - } - - if (chandesc->sema == NULL) { - /* Allocate semaphore to sleep on when no data is - * available. The underlying circular buffer and - * virtual circuit packages manage this semaphore. - */ - chandesc->sema = (semaphore *) xalloc(sizeof(semaphore)); - if (chandesc->sema == NULL) { - errno = ENOMEM; - return -1; - } - - sema_init(chandesc->sema, 0); - switch (chandesc->type) { - case ACDT_TCPIP: - cb_setsema(chandesc->circbuf, chandesc->sema); - break; - case ACDT_VIRTCIRC: - vc_setsema(chandesc->virtcirc, chandesc->sema); - break; - } - } - - switch (chandesc->type) { - case ACDT_TCPIP: - if ((n = cb_full(chandesc->circbuf)) != 0) { - if (n < 0) errno = EPIPE; - return n; /* includes error as well */ - } - if (sema_trydown(chandesc->sema, timout) < 0) { - errno = EINTR; - return -1; - } else { - /* we down for all the bytes in AMRead, so undo the down */ - sema_up(chandesc->sema); - } - if ((n = cb_full(chandesc->circbuf)) < 0) { - errno = EPIPE; - return -1; - } - return n; - - case ACDT_VIRTCIRC: - if ((n = vc_avail(chandesc->virtcirc, VC_IN)) != 0) { - if (n < 0) errno = EPIPE; - return n; /* includes error as well */ - } - if (sema_trydown(chandesc->sema, timout) < 0) { - errno = EINTR; - return -1; - } else { - /* we down for all the bytes in AMRead, so undo the down */ - sema_up(chandesc->sema); - } - if ((n = vc_avail(chandesc->virtcirc, VC_IN)) < 0) { - errno = EPIPE; - return -1; - } - return n; - } - - errno = EINVAL; - return -1; -} - -/* - * This function gets the local address of the transport and stores it in the - * XtransConnInfo structure for the connection. - */ - -static int -TRANS(AMGetAddr)(ciptr) -XtransConnInfo ciptr; -{ - PRMSG(1,"AMGetAddr(%x)\n", ciptr, 0,0 ); - PRMSG(1,"AMGetAddr: TODO\n", 0, 0, 0); - - return -1; -} - - -/* - * This function gets the remote address of the socket and stores it in the - * XtransConnInfo structure for the connection. - */ - -static int -TRANS(AMGetPeerAddr)(ciptr) -XtransConnInfo ciptr; -{ - struct nwio_tcpconf tcpconf; - errstat err; - XAmChanDesc *chandesc; - - PRMSG(2,"AMGetPeerAddr(%x)\n", ciptr, 0,0 ); - - chandesc = XAmFdToChanDesc(ciptr->fd); - if (chandesc == NULL || chandesc->state != ACDS_USED) { - errno = EBADF; - return -1; - } - - switch (chandesc->type) { - case ACDT_TCPIP: - /* get the remote adress from the TCP/IP server */ - if ((err = tcp_ioc_getconf(&chandesc->chancap, &tcpconf)) != STD_OK) { - PRMSG (1, "AMGetPeerAddr: Cannot get remote address (%d)\n", - (int) err, 0, 0); - return -1; - } - -#if 0 /* debug */ - { - struct hostent *remote; - char *hostname; - - remote = gethostbyaddr((char *) &tcpconf.nwtc_remaddr, - sizeof(tcpconf.nwtc_remaddr), AF_INET); - if ((remote == NULL) || (remote->h_name == NULL)) { - hostname = inet_ntoa(tcpconf.nwtc_remaddr); - } else { - hostname = remote->h_name; - } - PRMSG (1, "AMGetPeerAddr: remote addr `%s'\n", - hostname, 0, 0); - } -#endif - - ciptr->peeraddrlen = sizeof(tcpconf.nwtc_remaddr); - ciptr->peeraddr = (char *) xalloc (ciptr->peeraddrlen); - if (ciptr->peeraddr == NULL) { - PRMSG (1, "AMGetPeerAddr: Can't allocate peeraddr\n", - 0, 0, 0); - return -1; - } - - memcpy (ciptr->peeraddr, &tcpconf.nwtc_remaddr, ciptr->peeraddrlen); - break; - - case ACDT_VIRTCIRC: - /* for Amoeba virtual circuits just copy the client address */ - if ((ciptr->peeraddr = (char *) xalloc (ciptr->addrlen)) == NULL) { - PRMSG (1, "AMGetPeerAddr: Can't allocate peeraddr\n", - 0, 0, 0); - return -1; - } - - ciptr->peeraddrlen = ciptr->addrlen; - memcpy (ciptr->peeraddr, ciptr->addr, ciptr->peeraddrlen); - break; - } - - return 0; -} - - -static XtransConnInfo -TRANS(AMOpen)(device) -char *device; -{ - PRMSG(1,"AMOpen(%s)\n", device, 0,0 ); - PRMSG(1,"AMOpen: TODO\n", 0, 0, 0); - - return NULL; -} - - -static int -TRANS(AMAddrToNetbuf)(tlifamily, host, port, netbufp) -int tlifamily; -char *host; -char *port; -struct netbuf *netbufp; -{ - PRMSG(1,"AMAddrToNetbuf(%d,%s,%s)\n", tlifamily, host, port ); - PRMSG(1,"AMAddrToNetbuf: TODO\n", 0, 0, 0); - - return -1; -} - -/* - * These functions are the interface supplied in the Xtransport structure - */ - -#ifdef TRANS_CLIENT - -static XtransConnInfo -TRANS(AMOpenCOTSClient)(thistrans, protocol, host, port) -Xtransport *thistrans; -char *protocol; -char *host; -char *port; -{ - XtransConnInfo ciptr; - XAmChanDesc *chandesc; - - PRMSG(2,"AMOpenCOTSClient(%s,%s,%s)\n", protocol, host, port ); - - ciptr = (XtransConnInfo) xcalloc (1, sizeof(struct _XtransConnInfo)); - if (ciptr == NULL) { - PRMSG (1, "AMOpenCotsClient: malloc failed\n", 0, 0, 0); - return NULL; - } - - ciptr->fd = MakeAmConnection (host, 0 /* TODO */, &ciptr->family, - &ciptr->addrlen, &ciptr->addr); - if (ciptr->fd < 0) { - PRMSG(1,"AMOpenCOTSClient: Unable to make connection to %s\n", - host, 0,0 ); - xfree(ciptr); - return NULL; - } - - /* set the back pointer */ - chandesc = XAmFdToChanDesc(ciptr->fd); - chandesc->conninfo = ciptr; - - TRANS(AMGetPeerAddr)(ciptr); - - PRMSG(2,"AMOpenCOTSClient: made connection to %s; fd = %d, family = %d\n", - host, ciptr->fd, ciptr->family); - - return ciptr; -} - -#endif /* TRANS_CLIENT */ - -#if defined(XSERV_t) || defined(FS_t) - -/* The following defines come from osdep.h; - * they should removed from there eventually. - */ - -/* - * Some fundamental constants - */ -#define CONNECTOR_STACK 4000 /* stack for connector task */ -#define DEVREADER_STACK 4000 /* stack for device reader */ -#define CREATOR_STACK 4000 /* stack for connection creator */ -#define MAXTASKS 100 /* Maximum # clients */ - -/* - * OsComm status bits - */ -#define CONN_KILLED 0x1 /* Connection being closed */ -#define REQ_PUSHBACK 0x2 /* Request pushed back */ -#define IGNORE 0x4 /* True if client ignored */ -#define CONN_INIT 0x8 /* True if still initializing */ -#define CONN_ALIVE 0x10 /* True if living */ - - -#define REPLY_BUFSIZE 30000 - -capability X; /* X capability */ -char *XServerHostName; /* X server host name */ -char *XTcpServerName; /* TCP/IP server name */ - -static XtransConnInfo NewConns[MAXTASKS]; /* new client connections */ -int nNewConns; /* # of new clients */ - -int maxClient; /* Highest allocated client fd + 1*/ -static int minClient = 1; /* Lowest allocated client fd */ - -static char * -OsCommStatus(status) - int status; -{ - static char buf[100]; - - buf[0] = '\0'; - if (status == 0) - sprintf(buf, "NONE"); - if (status & CONN_INIT) - sprintf(buf, "%s INIT", buf); - if (status & CONN_ALIVE) - sprintf(buf, "%s ALIVE", buf); - if (status & CONN_KILLED) - sprintf(buf, "%s KILLED", buf); - if (status & REQ_PUSHBACK) - sprintf(buf, "%s PUSHBACK", buf); - if (status & IGNORE) - sprintf(buf, "%s IGNORE", buf); - return buf; -} - -static char * -OsCommFamily(family) - int family; -{ - if (family == FamilyAmoeba) { - return "AMOEBA"; - } else { - return "TCP/IP"; - } -} - - -/* - * Return status information about the open connections - */ -static errstat -ConnectionStatus(hdr, buf, size) - header *hdr; - char *buf; - int size; -{ - char *begin, *end; - char *bprintf(); - int fd; - XAmChanDesc *chandesc; - - begin = buf; - end = buf + size; - - - /* all active clients */ - begin = bprintf(begin, end, "Active clients:\n"); - for (fd = minClient; fd < maxClient; fd++) { - static XAmChanDesc *chandesc; - - chandesc = XAmFdToChanDesc(fd); - if (chandesc != NULL && chandesc->conninfo != NULL) { - begin = bprintf(begin, end, "%d: Family %s, State %d, Status %s\n", - fd, OsCommFamily(chandesc->conninfo->family), - chandesc->state, OsCommStatus(chandesc->status)); - } - } - - if (begin == NULL) { - hdr->h_size = 0; - return STD_SYSERR; - } else { - hdr->h_size = begin - buf; - return STD_OK; - } -} - -/* - * Wakeup main thread if necessary - */ -static void -UnblockMain(fd) -int fd; -{ - XAmChanDesc *chandesc; - - chandesc = XAmFdToChanDesc(fd); - if (chandesc != NULL) { - if ((chandesc->status & IGNORE) == 0) { - WakeUpMainThread(); - } - } else { - Error(("UnblockMain: invalid fd %d\n", fd)); - } -} - -static void -TcpIpReaderSignalCatcher(sig, us, extra) - signum sig; - thread_ustate *us; - _VOIDSTAR extra; -{ - XAmChanDesc *chandesc = (XAmChanDesc *) extra; - - if (chandesc->conninfo != NULL) { - dbprintf(("TcpIpReaderSignalCatcher(%d), number %d\n", - sig, chandesc->conninfo->fd)); - if (chandesc->signal != sig) { - Error(("TCP/IP Reader: Connection %s got unexpected signal %d\n", - chandesc->conninfo->fd, sig)); - } - } - - chandesc->signal = -1; - thread_exit(); -} - -void -TcpIpReaderThread(argptr, argsize) - void *argptr; - int argsize; -{ - XAmChanDesc *chandesc; - - if (argsize != sizeof(XAmChanDesc *)) { - Fatal(("Internal error: TcpIpReaderThread incorrectly called\n")); - } - - chandesc = * ((XAmChanDesc **) argptr); - (void) sig_catch(chandesc->signal, TcpIpReaderSignalCatcher, - (_VOIDSTAR) chandesc); - - for (;;) { - char buffer[MAXBUFSIZE]; - bufsize size; - - size = tcpip_read(&chandesc->chancap, buffer, sizeof(buffer)); - - dbprintf(("TcpIpReaderThread() read %d bytes\n", size)); - if (ERR_STATUS(size)) { - Error(("TCP/IP read failed (%s)\n", tcpip_why(ERR_CONVERT(size)))); - chandesc->status |= CONN_KILLED; - chandesc->status &= ~CONN_ALIVE; - chandesc->signal = -1; - thread_exit(); - } - - if (size == 0 || cb_puts(chandesc->circbuf, buffer, size)) { - if (size != 0) { - Error(("TCP/IP short write to circular buffer for %d\n", - XAmChanDescToFd(chandesc))); - } else { - Error(("TCP/IP read failed for client %d\n", - XAmChanDescToFd(chandesc))); - } - - chandesc->status |= CONN_KILLED; - chandesc->status &= ~CONN_ALIVE; - chandesc->signal = -1; - thread_exit(); - } - UnblockMain(XAmChanDescToFd(chandesc)); - } -} - -static XAmChanDesc * -AllocClientChannel() -{ - XAmChanDesc *chandesc; - int fd; - - chandesc = XAmAllocChanDesc(); - if (chandesc == NULL) { - return NULL; - } - - fd = XAmChanDescToFd(chandesc); - if (fd >= maxClient) { - maxClient = fd + 1; - dbprintf(("new max Client: %d\n", fd)); - } - if (fd < minClient) { - minClient = fd; - } - - return chandesc; -} - -static errstat -AmRegisterRPCconn(client_ports, server_ports) -am_port_t client_ports[2]; -am_port_t server_ports[2]; -{ - XAmChanDesc *chandesc; - - if ((chandesc = AllocClientChannel()) == NULL) { - return STD_NOSPACE; - } - - chandesc->type = ACDT_VIRTCIRC; - chandesc->virtcirc = vc_create(&server_ports[0], &server_ports[1], - MAXBUFSIZE, MAXBUFSIZE); - if (chandesc->virtcirc == NULL) { - Error(("Connection refused: No memory for virtual circuit\n")); - XAmFreeChanDesc(chandesc); - return STD_NOSPACE; - } - - dbprintf(("Amoeba connection registered\n")); - - vc_warn(chandesc->virtcirc, VC_IN, UnblockMain, XAmChanDescToFd(chandesc)); - - chandesc->status = CONN_INIT; - - /* cause WaitFor to call EstablishNewConnections: */ - nNewConns++; - WakeUpMainThread(); - - return STD_OK; -} - -static XAmChanDesc * -XAmFetchConnectingClient() -{ - XAmChanDesc *chandesc; - int fd; - - for (fd = minClient; fd < maxClient; fd++) { - chandesc = XAmFdToChanDesc(fd); - - if (chandesc->status & CONN_INIT) { - Error(("Client %d is connecting\n", fd)); - chandesc->status &= ~CONN_INIT; - return chandesc; - } - } - - return NULL; -} - -static errstat -AmRegisterTCPconn(chancap) -capability *chancap; -{ - XAmChanDesc *chandesc, **param; - - if ((chandesc = AllocClientChannel()) == NULL) { - return STD_NOSPACE; - } - - chandesc->type = ACDT_TCPIP; - chandesc->chancap = *chancap; - - if ((chandesc->circbuf = cb_alloc(MAXBUFSIZE)) == NULL) { - Error(("TCPconn refused: No memory for circular buffer\n")); - XAmFreeChanDesc(chandesc); - return STD_NOSPACE; - } - - chandesc->signal = sig_uniq(); - param = (XAmChanDesc **) xalloc(sizeof(XAmChanDesc *)); /* error checking? */ - *param = chandesc; - if (thread_newthread(TcpIpReaderThread, MAXBUFSIZE + CONNECTOR_STACK, - (char *)param, sizeof(XAmChanDesc *)) == 0) - { - Error(("TCPconn refused: Cannot start reader thread\n")); - cb_close(chandesc->circbuf); - cb_free(chandesc->circbuf); - XAmFreeChanDesc(chandesc); - return STD_NOSPACE; - } - - dbprintf(("TCP connection registered\n")); - - chandesc->status = CONN_INIT; - - /* cause WaitFor to call EstablishNewConnections: */ - nNewConns++; - WakeUpMainThread(); - - return STD_OK; -} - - -/* - * Establishing a new connection is done in two phases. This thread does the - * first part. It filters out bad connect requests. A new rendevous port is - * sent to the client and the main loop is informed if there is a legal - * request. The sleep synchronizes with the main loop so that the paperwork - * is finished for the current connect request before the thread is ready to - * accept another connect. - */ -static void -AmConnectorThread() -{ - header req, rep; - am_port_t client_ports[2]; - am_port_t server_ports[2]; - short s; - char *repb; - extern CreateNewClient(); - - WaitForInitialization(); - dbprintf(("AmConnectorThread() running ...\n")); - if ((repb = (char *)xalloc(REPLY_BUFSIZE)) == NULL) { - Fatal(("Amoeba connector thread: malloc failed")); - } - for (;;) { - do { - req.h_port = X.cap_port; - s = getreq(&req, NILBUF, 0); - } while (ERR_CONVERT(s) == RPC_ABORTED); - if (ERR_STATUS(s)) - Fatal(("Amoeba connector thread: getreq failed")); - - /* TODO: check privilege fields here */ - - dbprintf(("AmConnectorThread() accepting a request\n")); - - switch (req.h_command) { - - case STD_INFO: - rep.h_status = STD_OK; - sprintf(repb, "X11R6 server on %s", XServerHostName); - rep.h_size = strlen(repb); - putrep(&rep, repb, rep.h_size); - break; - - case STD_STATUS: - rep.h_status = ConnectionStatus(&rep, repb, REPLY_BUFSIZE); - putrep(&rep, repb, rep.h_size); - break; - -#ifdef XSERV_t - case AX_SHUTDOWN: - rep.h_status = STD_OK; - putrep(&rep, NILBUF, 0); - GiveUp(SIGTERM); - break; - - case AX_REINIT: - rep.h_status = STD_OK; - putrep(&rep, NILBUF, 0); - AutoResetServer(SIGINT); - break; -#endif - - case AX_CONNECT: - uniqport(&client_ports[0]); - uniqport(&server_ports[1]); - priv2pub(&client_ports[0], &server_ports[0]); - priv2pub(&server_ports[1], &client_ports[1]); - - rep.h_status = AmRegisterRPCconn(client_ports, server_ports); - if (rep.h_status == STD_OK) { - putrep(&rep, (bufptr)client_ports, 2*sizeof(am_port_t)); - } else { - putrep(&rep, NILBUF, 0); - } - break; - - default: - rep.h_status = STD_COMBAD; - putrep(&rep, NILBUF, 0); - break; - } - } -} - -#ifdef XSERV_t - -/* - * To prevent the X-server from generating lots of error messages, - * in case the server is gone or when its full. - */ -#define LOOP_OPEN 1 -#define LOOP_SETCONF 2 -#define LOOP_LISTEN 4 - -extern char *display; /* The display number */ - -/* - * The TCP/IP connector thread listens to a well known port (6000 + - * display number) for connection request. When such a request arrives - * it allocates a communication structure and a reader thread. This - * thread prevents the main loop from blocking when there's no data. - */ -static void -AmTCPConnectorThread() -{ - capability svrcap, chancap; - nwio_tcpconf_t tcpconf; - nwio_tcpcl_t tcpconnopt; - char name[BUFSIZ]; - errstat err; - int result; - int looping = 0; - - strncpy(name, XTcpServerName, BUFSIZ); - if ((err = name_lookup(name, &svrcap)) != STD_OK) { - sprintf(name, "%s/%s", TCP_SVR_NAME, XTcpServerName); - if ((err = name_lookup(name, &svrcap)) != STD_OK) - Fatal(("Lookup %s failed: %s\n", XTcpServerName, err_why(err))); - } - - WaitForInitialization(); - dbprintf(("AmTCPConnectorThread() running ...\n")); - - for (;;) { - /* - * Listen to TCP/IP port X_TCP_PORT + display for connections. - * Some interesting actions have to be taken to keep this connection - * alive and kicking :-) - */ - if ((err = tcpip_open(&svrcap, &chancap)) != STD_OK) { - /* the server probably disappeared, just wait for it to return */ - if (looping & LOOP_OPEN) { - Error(("TCP/IP open failed: %s\n", tcpip_why(err))); - looping |= LOOP_OPEN; - } - sleep(60); - (void) name_lookup(name, &svrcap); - continue; - } - looping &= ~LOOP_OPEN; - - tcpconf.nwtc_locport = htons(X_TCP_PORT + atoi(display)); - tcpconf.nwtc_flags = NWTC_EXCL | NWTC_LP_SET | NWTC_UNSET_RA | - NWTC_UNSET_RP; - if ((err = tcp_ioc_setconf(&chancap, &tcpconf)) != STD_OK) { - /* couldn't configure, probably server space problem */ - if (looping & LOOP_SETCONF) { - Error(("TCP/IP setconf failed: %s\n", tcpip_why(err))); - looping |= LOOP_SETCONF; - } - std_destroy(&chancap); - sleep(60); - continue; - } - looping &= ~LOOP_SETCONF; - - tcpconnopt.nwtcl_flags = 0; - if ((err = tcp_ioc_listen(&chancap, &tcpconnopt)) != STD_OK) { - /* couldn't listen, definitely a server memory problem */ - if (looping & LOOP_LISTEN) { - Error(("TCP/IP listen failed: %s\n", tcpip_why(err))); - looping |= LOOP_LISTEN; - } - std_destroy(&chancap); - sleep(60); - continue; - } - looping &= ~LOOP_LISTEN; - - if ((err = tcpip_keepalive_cap(&chancap)) != STD_OK) { - Error(("TCP/IP keep alive failed: %s\n", tcpip_why(err))); - std_destroy(&chancap); - continue; - } - - err = AmRegisterTCPconn(&chancap); - if (err != STD_OK) { - Error(("AmRegisterTCPconn failed (%s)\n", err_why(err))); - std_destroy(&chancap); - } - } -} - -static void -AmStartXserverThreads(chandesc) -XAmChanDesc *chandesc; -{ - char host[100]; - errstat err; - capability pubX; - static int threadsStarted = 0; - - /* - * Each time the server is reset this routine is called to - * setup the new well known sockets. For Amoeba we'll just - * keep using the old threads that are already running. - */ - if (!threadsStarted) { - threadsStarted = 1; - - /* - * Create a new capability for this X server - */ - if (XServerHostName == NULL) - XServerHostName = getenv("XHOST"); - if (XServerHostName == NULL) { - Fatal(("XHOST not set, or server host name not given\n")); - } - sprintf(host, "%s/%s:%s", DEF_XSVRDIR, XServerHostName, display); - - uniqport(&X.cap_port); - priv2pub(&X.cap_port, &pubX.cap_port); - (void) name_delete(host); - if ((err = name_append(host, &pubX)) != 0) { - Error(("Cannot create capability %s: %s\n", host, err_why(err))); - exit(1); - } - - /* Allow WaitFor module to initialize */ - AmInitWaitFor(); - - /* Also, initialize main thread locking */ - InitMainThread(); - - /* Initialize and start IOP reader thread */ - InitializeIOPServerReader(); - - /* Start native Amoeba service threads */ - if (thread_newthread(AmConnectorThread, CONNECTOR_STACK, 0, 0) <= 0) { - Fatal(("Cannot start Amoeba connector thread\n")); - } - if (thread_newthread(AmConnectorThread, CONNECTOR_STACK, 0, 0) <= 0) { - Fatal(("Cannot start Amoeba connector thread\n")); - } - chandesc->type = ACDT_VIRTCIRC; - chandesc->status = CONN_ALIVE; - - /* - * Start TCP/IP service threads - */ - if (XTcpServerName) { - if (thread_newthread(AmTCPConnectorThread, - CONNECTOR_STACK, 0, 0) <= 0) - Fatal(("Cannot start TCP connector thread\n")); - if (thread_newthread(AmTCPConnectorThread, - CONNECTOR_STACK, 0, 0) <= 0) - Fatal(("Cannot start TCP connector thread\n")); - } - } -} - -int -AmFindReadyClients(pClientsReady, mask) -int *pClientsReady; -long *mask; -{ - /* Check for clients needing attention. They may have input, - * or they might be dying. Ignore the clients not present in - * the file descriptor bit vector `mask'. This is used for - * implementing server grabs. - * Returns the number of clients having data for us. - */ - extern int ConnectionTranslation[]; - XAmChanDesc *chandesc; - int fd; - int nready; - - /* Since we're scheduled non-preemptively by default, allow the - * listener threads to run first, if needed: - */ - threadswitch(); - - nready = 0; - for (fd = minClient; fd < maxClient; fd++) { - int which; - int n; - - if (fd > 0 && (fd % 32) == 0) { - /* switch to next fd mask */ - mask++; - } - - if ((*mask & (1L << fd)) == 0) { - dbprintf(("skip %d\n", fd)); - continue; - } - - chandesc = XAmFdToChanDesc(fd); - if (chandesc->state != ACDS_USED) { - dbprintf(("AmFindReady: fd %d not in use\n", fd)); - continue; - } - - which = ConnectionTranslation[fd]; - dbprintf(("checking client %d (fd %d) of %d\n", - fd, which, maxClient)); - - if (chandesc->status & CONN_KILLED) { - dbprintf(("conn killed; close client with fd %d\n", fd)); - CloseDownClient(clients[which]); - chandesc->status &= ~(CONN_KILLED | CONN_ALIVE); - continue; - } - - if ((chandesc->status & CONN_ALIVE) == 0) { - dbprintf(("conn with %d is not alive\n", fd)); - continue; - } - - /* see if there is data available */ - switch (chandesc->type) { - case ACDT_TCPIP: - n = cb_full(chandesc->circbuf); - break; - case ACDT_VIRTCIRC: - n = vc_avail(chandesc->virtcirc, VC_IN); - break; - default: - n = -1; - } - - if (n < 0) { - dbprintf(("avail %d; close client %d\n", n, which)); - CloseDownClient(clients[which]); - continue; - } else { - if (n > 0) { - *pClientsReady++ = which; - nready++; - dbprintf(("client %d has %d bytes available\n", which, n)); - } else { - dbprintf(("client %d has no data available\n", which, n)); - } - } - - /* Clients that already have (possibly inserted) data are found - * with help from io.c (the ClientsWithData bit array). - */ - } - - return nready; -} - -#endif /* XSERV_t */ - -#endif /* XSERV_t || FS_t */ - -static -TRANS(AmSetAddr)(ciptr, chandesc) - XtransConnInfo ciptr; - XAmChanDesc *chandesc; -{ - switch (chandesc->type) { - case ACDT_TCPIP: - /* should really ask the TCP/IP server */ - ciptr->family = AF_INET; - ciptr->addr = strdup("XXXXTODO"); - ciptr->addrlen = strlen("XXXXTODO"); - break; - case ACDT_VIRTCIRC: - /* For Amoeba connections the adress is not really used, - * so just fake something - */ - ciptr->family = AF_AMOEBA; - ciptr->addr = strdup("Amoeba"); - ciptr->addrlen = strlen(ciptr->addr); - break; - } -} - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(AMOpenCOTSServer)(thistrans, protocol, given_host, port) -Xtransport *thistrans; -char *protocol; -char *given_host; -char *port; -{ - XAmChanDesc *chandesc; - XtransConnInfo ciptr; - - PRMSG(2,"AMOpenCOTSServer(%s,%s,%s)\n", protocol, given_host, port); - - ciptr = (XtransConnInfo) xcalloc (1, sizeof(struct _XtransConnInfo)); - if (ciptr == NULL) { - PRMSG (1, "AMOpenCotsClient: malloc failed\n", 0, 0, 0); - return NULL; - } - - chandesc = XAmAllocChanDesc(); - if (chandesc == NULL) { - return NULL; - } - -#ifdef XSERV_t - AmStartXserverThreads(chandesc); -#endif - - chandesc->conninfo = ciptr; - ciptr->fd = XAmChanDescToFd(chandesc); - - TRANS(AmSetAddr)(ciptr, chandesc); - TRANS(AMGetPeerAddr)(ciptr); - - return ciptr; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -static XtransConnInfo -TRANS(AMOpenCLTSClient)(thistrans, protocol, host, port) -Xtransport *thistrans; -char *protocol; -char *host; -char *port; -{ - XtransConnInfo ciptr; - int i; - - PRMSG(1,"AMOpenCLTSClient(%d,%s,%s)\n", protocol, host, port ); - /* TODO */ - return NULL; -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(AMOpenCLTSServer)(thistrans, protocol, host, port) -Xtransport *thistrans; -char *protocol; -char *host; -char *port; -{ - XtransConnInfo ciptr; - int i; - - PRMSG(1,"AMOpenCLTSServer(%d,%s,%s)\n", protocol, host, port ); - /* TODO */ - return NULL; -} - -static int -TRANS(AMResetListener)(ciptr) -XtransConnInfo ciptr; -{ - PRMSG(2,"AMResetListener()\n", 0, 0, 0 ); - - /* nothing to do? */ - return 0; -} - -#endif /* TRANS_SERVER */ - -static -TRANS(AMSetOption)(ciptr, option, arg) -XtransConnInfo ciptr; -int option; -int arg; -{ - PRMSG(1,"AMSetOption(%d,%d,%d)\n", ciptr->fd, option, arg ); - /* TODO */ - return -1; -} - - -#ifdef TRANS_SERVER - -static -TRANS(AMCreateListener)(ciptr, req) -XtransConnInfo ciptr; -char *req; -{ - PRMSG(2,"AMCreateListener(%x->%d,%x)\n", ciptr, ciptr->fd, req ); - - /* Listener threads are already created at this point */ - return 0; -} - - -static XtransConnInfo -TRANS(AMAccept)(ciptr) -XtransConnInfo ciptr; -{ - XAmChanDesc *chandesc; - XtransConnInfo newciptr; - - PRMSG(2,"AMAccept(%x->%d)\n", ciptr, ciptr->fd, 0 ); - -#if defined(XSERV_t) || defined(FS_t) - chandesc = XAmFetchConnectingClient(); - if (chandesc == NULL) { - PRMSG (1, "AMAccept: no client waiting?\n", 0, 0, 0); - return NULL; - } - nNewConns--; - - newciptr = (XtransConnInfo) xcalloc (1, sizeof(struct _XtransConnInfo)); - if (newciptr == NULL) - { - PRMSG (1, "AMAccept: malloc failed\n", 0, 0, 0); - return NULL; - } - - newciptr->fd = XAmChanDescToFd(chandesc); - chandesc->conninfo = newciptr; - chandesc->status |= CONN_ALIVE; - - PRMSG(2,"AMAccept: OK: (%x->%d)\n", newciptr, newciptr->fd, 0 ); - - TRANS(AmSetAddr)(newciptr, chandesc); - TRANS(AMGetPeerAddr)(newciptr); - - return newciptr; -#else - return NULL; -#endif -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -static -TRANS(AMConnect)(ciptr, host, port) -XtransConnInfo ciptr; -char *host; -char *port; -{ - /* If this function is called, we are already connected */ - PRMSG(2, "AMConnect(%d,%s)\n", ciptr->fd, host, 0); - return 0; -} - -#endif /* TRANS_CLIENT */ - - -int -TRANS(AmFdBytesReadable)(fd, count) -int fd; -BytesReadable_t *count; -{ - register XAmChanDesc *chandesc; - - PRMSG(2, "AmFdBytesReadable(%d,%x): ", fd, count, 0 ); - -#ifndef XSERV_t - /* give reader threads a chance: */ - threadswitch(); -#endif - - errno = 0; - chandesc = XAmFdToChanDesc(fd); - if (chandesc == NULL || chandesc->state != ACDS_USED) { - errno = EBADF; - *count = 0; - return -1; - } - - switch (chandesc->type) { - case ACDT_TCPIP: - *count = cb_full(chandesc->circbuf); - break; - case ACDT_VIRTCIRC: - *count = vc_avail(chandesc->virtcirc, VC_IN); - break; - } - - if (*count < 0) { - errno = (chandesc->state == ACDS_CLOSED) ? EINTR : EPIPE; - *count = 0; - return -1; - } - - PRMSG(2, "AMFdBytesReadable: %d\n", *count, 0, 0 ); - - return 0; -} - -static -TRANS(AMBytesReadable)(ciptr, count) -XtransConnInfo ciptr; -BytesReadable_t *count; -{ - return TRANS(AmFdBytesReadable)(ciptr->fd, count); -} - - -static -TRANS(AMRead)(ciptr, buf, count) -XtransConnInfo ciptr; -char *buf; -int count; -{ - int fdi; - register XAmChanDesc *chandesc; - register int rv; - BytesReadable_t avail; - - fdi = ciptr->fd; - PRMSG(2, "AMRead(%d,%x,%d)\n", ciptr->fd, buf, count ); - - errno = 0; - chandesc = XAmFdToChanDesc(fdi); - if (chandesc == NULL || chandesc->state != ACDS_USED) { - errno = EBADF; - return -1; - } - - /* do a non-blocking read (maybe only conditionally?) */ - if ((TRANS(AMBytesReadable)(ciptr, &avail)) == 0) { - if (avail <= 0) { - PRMSG(2, "AMRead: nothing available yet\n", 0, 0, 0); - errno = EAGAIN; - return 0; - } else if (count > avail) { - PRMSG(2, "AMRead(%d): only %d of %d available\n", - ciptr->fd, avail, count); - count = avail; /* just read amount available */ - } - } else { - PRMSG(1, "AMRead: ...BytesReadable failed\n", 0, 0, 0); - return -1; - } - - switch (chandesc->type) { - case ACDT_TCPIP: - rv = cb_gets(chandesc->circbuf, buf, count, count); - if (rv != count) { - if (rv == 0) { - fprintf(stderr, "Xlib: Cannot read circbuf\n"); - errno = EPIPE; - rv = -1; - } else { - fprintf(stderr, "Xlib: Cannot read circbuf (%d)\n", rv); - } - } - break; - - case ACDT_VIRTCIRC: - rv = vc_readall(chandesc->virtcirc, buf, count); - if (rv < 0) { - fprintf(stderr, "Xlib: Cannot read virtual circuit\n"); - errno = EPIPE; - rv = -1; - } - break; - } - - /* The circular buffer writer will only UP the semaphore when - * characters are available; we have to down it ourselfs. - */ - if (chandesc->sema && rv > 0) - sema_mdown(chandesc->sema, rv); - - PRMSG(2, "AMRead: %d bytes\n", rv, 0, 0); - - return rv; -} - - -static -TRANS(AMWrite)(ciptr, buf, count) -XtransConnInfo ciptr; -char *buf; -int count; -{ - register XAmChanDesc *chandesc; - register int written; - - PRMSG(2, "AMWrite(%d,%x,%d)\n", ciptr->fd, buf, count ); - - errno = 0; - written = 0; - - chandesc = XAmFdToChanDesc(ciptr->fd); - if (chandesc == NULL || chandesc->state != ACDS_USED) { - errno = EBADF; - return -1; - } - - switch (chandesc->type) { - case ACDT_TCPIP: - while (count > 0) { - bufsize bsize; - int wrcnt; - - wrcnt = count > TCPIP_BUFSIZE ? TCPIP_BUFSIZE : count; - bsize = tcpip_write(&chandesc->chancap, buf, wrcnt); - if (ERR_STATUS(bsize)) { - fprintf(stderr, "Xlib: TCP/IP write failed (%s)\n", - tcpip_why(ERR_CONVERT(bsize))); - errno = EPIPE; - return -1; - } - if (bsize != wrcnt) { - fprintf(stderr, - "Xlib: TCP/IP write failed (expected %d, wrote %d)\n", - (int)bsize, wrcnt); - errno = EPIPE; - return -1; - } - buf += bsize; - count -= (int) bsize; - written += (int) bsize; - } - break; - - case ACDT_VIRTCIRC: - if ((written = vc_write(chandesc->virtcirc, buf, count)) < 0) { - fprintf(stderr, "Xlib: virtual circuit write failed\n"); - errno = EPIPE; - return -1; - } - break; - } - - return written; -} - - -static -TRANS(AMReadv)(ciptr, iov, n) -XtransConnInfo ciptr; -struct iovec *iov; -int n; -{ - int i; - int count = 0, thiscount; - - PRMSG(2, "AMReadv(%d,%x,%d)\n", ciptr->fd, ciptr, n ); - - for (i = 0; i < n; i++, iov++) { - if (iov->iov_len) { - thiscount = TRANS(AMRead)(ciptr, iov->iov_base, iov->iov_len); - if (thiscount < 0) return thiscount; - count += thiscount; - if (thiscount < iov->iov_len) break; - } - } - - return count; -} - - -static -TRANS(AMWritev)(ciptr, iov, n) -XtransConnInfo ciptr; -struct iovec *iov; -int n; -{ - int i; - int count = 0, thiscount; - - PRMSG(2, "AMWritev(%d,%x,%d)\n", ciptr->fd, iov, n ); - - for (i = 0; i < n; i++, iov++) { - if (iov->iov_len) { - thiscount = TRANS(AMWrite)(ciptr, iov->iov_base, iov->iov_len); - if (thiscount < 0) - return thiscount; - count += thiscount; - if (thiscount < iov->iov_len) break; - } - } - - return count; -} - - -static -TRANS(AMDisconnect)(ciptr) -XtransConnInfo ciptr; -{ - register XAmChanDesc *chandesc; - - PRMSG(2, "AMDisconnect(%x->%d)\n", ciptr, ciptr->fd, 0 ); - - chandesc = XAmFdToChanDesc(ciptr->fd); - if (chandesc != NULL) { - switch (chandesc->type) { - case ACDT_TCPIP: - if (chandesc->signal != -1) { - sig_raise(chandesc->signal); - chandesc->signal = -1; - } - std_destroy(&chandesc->chancap); - break; - - case ACDT_VIRTCIRC: - vc_close(chandesc->virtcirc, VC_BOTH | VC_ASYNC); - break; - } -#ifdef XSERV_t - if (ciptr->fd == maxClient - 1) { - maxClient--; - /* we could look if maxClient can be reduced even more */ - } -#endif - XAmFreeChanDesc(chandesc); - } - - return 0; -} - - -static -TRANS(AMClose)(ciptr) -XtransConnInfo ciptr; -{ - PRMSG(2, "AMClose(%x->%d)\n", ciptr, ciptr->fd, 0 ); - - return TRANS(AMDisconnect)(ciptr); -} - - -Xtransport TRANS(AmConnFuncs) = { - /* Combined AMOEBA RPC/TCP Interface; maybe we should split this */ - "amcon", - 0, -#ifdef TRANS_CLIENT - TRANS(AMOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(AMOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(AMOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(AMOpenCLTSServer), -#endif /* TRANS_SERVER */ - TRANS(AMSetOption), -#ifdef TRANS_SERVER - TRANS(AMCreateListener), - TRANS(AMResetListener), - TRANS(AMAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(AMConnect), -#endif /* TRANS_CLIENT */ - TRANS(AMBytesReadable), - TRANS(AMRead), - TRANS(AMWrite), - TRANS(AMReadv), - TRANS(AMWritev), - TRANS(AMDisconnect), - TRANS(AMClose), -}; diff --git a/xc/lib/xtrans/Xtransmnx.c b/xc/lib/xtrans/Xtransmnx.c deleted file mode 100644 index 9e5b5e616..000000000 --- a/xc/lib/xtrans/Xtransmnx.c +++ /dev/null @@ -1,1639 +0,0 @@ -/* $XFree86: xc/lib/xtrans/Xtransmnx.c,v 3.3 1996/05/10 06:55:50 dawes Exp $ */ - -/* -Xtransmnx.c - -Created: 11 April 1994 by Philip Homburg <philip@cs.vu.nl> -*/ - - -#include <stdlib.h> -#include <sys/ioctl.h> -#include <sys/nbio.h> -#include <net/hton.h> -#include <net/netlib.h> -#include <net/gen/in.h> -#include <net/gen/netdb.h> -#include <net/gen/tcp.h> -#include <net/gen/tcp_io.h> - -struct private -{ - int nonblocking; - - int read_inprogress; - char *read_buffer; - size_t read_bufsize; - size_t read_size; - size_t read_offset; - - int write_inprogress; - char *write_buffer; - size_t write_bufsize; - size_t write_size; - size_t write_offset; - int write_errno; - - int listen_completed; - u16_t listen_port; - XtransConnInfo listen_list; -}; -#define RD_BUFSIZE 1024 -#define WR_BUFSIZE 1024 - -static XtransConnInfo listen_list= NULL; - -static XtransConnInfo alloc_ConnInfo(Xtransport *thistrans); -static void free_ConnInfo(XtransConnInfo ciptr); -static struct private *alloc_private(size_t rd_size, size_t wr_size); -static void free_private(struct private *priv); -static void read_cb(nbio_ref_t ref, int res, int err); -static void write_cb(nbio_ref_t ref, int res, int err); -static void listen_cb(nbio_ref_t ref, int res, int err); -static int restart_listen(XtransConnInfo ciptr); - -#ifdef TRANS_CLIENT -static XtransConnInfo -TRANS(MnxTcpOpenCOTSClient) (thistrans, protocol, host, port) - -Xtransport *thistrans; -char *protocol; -char *host; -char *port; - -{ - XtransConnInfo ciptr; - char *tcp_device; - int s_errno; - int fd; - nbio_ref_t ref; - - - PRMSG(2, "MnxTcpOpenCOTSClient(%s,%s,%s)\n", - protocol, host, port); - - if ((ciptr= alloc_ConnInfo(thistrans)) == NULL) - { - PRMSG(1, - "MnxTcpOpenCOTSClient: alloc_ConnInfo failed\n", - 0, 0, 0); - return NULL; - } - if ((ciptr->priv= (char *)alloc_private(RD_BUFSIZE, WR_BUFSIZE)) == - NULL) - { - PRMSG(1, - "MnxTcpOpenCOTSClient: alloc_private() failed\n", - 0, 0, 0); - s_errno= errno; - free_ConnInfo(ciptr); - errno= s_errno; - return NULL; - } - - if ((tcp_device= getenv("TCP_DEVICE")) == NULL) - tcp_device= TCP_DEVICE; - PRMSG(4, "MnxTcpOpenCOTSClient: tcp_device= '%s'\n", - tcp_device, 0, 0); - - if ((fd= open(tcp_device, O_RDWR)) == -1) - { - PRMSG(1, - "MnxTcpOpenCOTSClient: open '%s' failed: %s\n", - tcp_device, strerror(errno), 0); - s_errno= errno; - free_ConnInfo(ciptr); - errno= s_errno; - return NULL; - } - ciptr->fd= fd; - ref.ref_ptr= ciptr; - nbio_register(fd); - nbio_setcallback(fd, ASIO_READ, read_cb, ref); - nbio_setcallback(fd, ASIO_WRITE, write_cb, ref); - return ciptr; -} -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER -static XtransConnInfo -TRANS(MnxTcpOpenCOTSServer) (thistrans, protocol, host, port) - -Xtransport *thistrans; -char *protocol; -char *host; -char *port; - -{ - XtransConnInfo ciptr; - char *tcp_device; - int s_errno; - int fd; - nbio_ref_t ref; - - - PRMSG(2, "MnxTcpOpenCOTSServer(%s,%s,%s)\n", - protocol, host, port); - - if ((ciptr= alloc_ConnInfo(thistrans)) == NULL) - { - PRMSG(1, - "MnxTcpOpenCOTSServer: alloc_ConnInfo failed\n", - 0, 0, 0); - return NULL; - } - if ((ciptr->priv= (char *)alloc_private(RD_BUFSIZE, WR_BUFSIZE)) == - NULL) - { - PRMSG(1, - "MnxTcpOpenCOTSServer: alloc_private() failed\n", - 0, 0, 0); - s_errno= errno; - free_ConnInfo(ciptr); - errno= s_errno; - return NULL; - } - - if ((tcp_device= getenv("TCP_DEVICE")) == NULL) - tcp_device= TCP_DEVICE; - PRMSG(4, "MnxTcpOpenCOTSServer: tcp_device= '%s'\n", - tcp_device, 0, 0); - - if ((fd= open(tcp_device, O_RDWR)) == -1) - { - PRMSG(1, - "MnxTcpOpenCOTSServer: open '%s' failed: %s\n", - tcp_device, strerror(errno), 0); - s_errno= errno; - free_ConnInfo(ciptr); - errno= s_errno; - return NULL; - } - PRMSG(5, "MnxTcpOpenCOTSServer: fd= '%d'\n", fd, 0, 0); - ciptr->fd= fd; - ref.ref_ptr= ciptr; - nbio_register(fd); - nbio_setcallback(fd, ASIO_IOCTL, listen_cb, ref); - return ciptr; -} -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT -static XtransConnInfo -TRANS(MnxTcpOpenCLTSClient) (thistrans, protocol, host, port) - -Xtransport *thistrans; -char *protocol; -char *host; -char *port; - -{ - abort(); -} -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER -static XtransConnInfo -TRANS(MnxTcpOpenCLTSServer) (thistrans, protocol, host, port) - -Xtransport *thistrans; -char *protocol; -char *host; -char *port; - -{ - abort(); -} -#endif /* TRANS_SERVER */ - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(MnxTcpReopenCOTSServer) (thistrans, fd, port) - -Xtransport *thistrans; -int fd; -char *port; - -{ - XtransConnInfo ciptr; - int i; - - PRMSG (2, - "MnxTcpReopenCOTSServer(%d, %s)\n", fd, port, 0); - - abort(); -} - -static XtransConnInfo -TRANS(MnxTcpReopenCLTSServer) (thistrans, fd, port) - -Xtransport *thistrans; -int fd; -char *port; - -{ - XtransConnInfo ciptr; - int i; - - - PRMSG (2, - "MnxTcpReopenCLTSServer(%d, %s)\n", fd, port, 0); - - abort(); -} - -#endif /* TRANS_REOPEN */ - - - -static int -TRANS(MnxTcpSetOption) (ciptr, option, arg) - -XtransConnInfo ciptr; -int option; -int arg; - -{ - int flags; - struct private *priv; - - PRMSG(2, "MnxTcpSetOption(%d,%d,%d)\n", - ciptr->fd, option, arg); - - priv= (struct private *)ciptr->priv; - switch(option) - { - case TRANS_NONBLOCKING: - flags= fcntl(ciptr->fd, F_GETFD); - if (flags == -1) - { - PRMSG(1, - "MnxTcpSetOption: fcntl F_GETFD failed: %s\n", - strerror(errno), 0, 0); - return -1; - } - if (arg == 0) - flags &= ~FD_ASYNCHIO; - else if (arg == 1) - flags |= FD_ASYNCHIO; - else - { - PRMSG(1, - "MnxTcpSetOption: bad arg for TRANS_NONBLOCKING: %d\n", - arg, 0, 0); - return -1; - } - if (fcntl(ciptr->fd, F_SETFD, flags) == -1) - { - PRMSG(1, - "MnxTcpSetOption: fcntl F_SETFD failed: %s\n", - strerror(errno), 0, 0); - return -1; - } - priv->nonblocking= arg; - return 0; - case TRANS_CLOSEONEXEC: - flags= fcntl(ciptr->fd, F_GETFD); - if (flags == -1) - { - PRMSG(1, - "MnxTcpSetOption: fcntl F_GETFD failed: %s\n", - strerror(errno), 0, 0); - return -1; - } - if (arg == 0) - flags &= ~FD_CLOEXEC; - else if (arg == 1) - flags |= FD_CLOEXEC; - else - { - PRMSG(1, - "MnxTcpSetOption: bad arg for TRANS_CLOSEONEXEC: %d\n", - arg, 0, 0); - return -1; - } - if (fcntl(ciptr->fd, F_SETFD, flags) == -1) - { - PRMSG(1, - "MnxTcpSetOption: fcntl F_SETFD failed: %s\n", - strerror(errno), 0, 0); - return -1; - } - return 0; - default: - PRMSG(1, "MnxTcpSetOption: unknown option '%d'\n", - option, 0, 0); - errno= EINVAL; - return -1; - } -} - - -#ifdef TRANS_SERVER -static int -TRANS(MnxTcpCreateListener) (ciptr, port) - -XtransConnInfo ciptr; -char *port; - -{ - struct servent *servp; - tcpport_t num_port; - char *check; - nwio_tcpconf_t tcpconf; - nwio_tcpcl_t tcpcl; - int r, s_errno, flags; - struct private *priv; - struct sockaddr_in *addr; - - PRMSG(2, "MnxTcpCreateListener(%d,%s)\n", ciptr->fd, port, 0); - - priv= (struct private *)ciptr->priv; - - if (port == NULL) - num_port= 0; - else - { - num_port= strtol(port, &check, 10); - num_port= htons(num_port); - if (check[0] == '\0') - port= NULL; - } - -#ifdef X11_t - /* - * X has a well known port, that is transport dependent. It is easier - * to handle it here, than try and come up with a transport independent - * representation that can be passed in and resolved the usual way. - * - * The port that is passed here is really a string containing the - * idisplay from ConnectDisplay(). - */ - if (port == NULL) - num_port= htons(ntohs(num_port) + X_TCP_PORT); -#endif - if (port != NULL) - { - if ((servp = getservbyname (port, "tcp")) == NULL) - { - PRMSG(1, - "MnxTcpCreateListener: can't get service for %s\n", - port, 0, 0); - errno= EINVAL; - return TRANS_CREATE_LISTENER_FAILED; - } - num_port= servp->s_port; - } - - tcpconf.nwtc_flags= NWTC_SHARED | NWTC_UNSET_RA | NWTC_UNSET_RP; - if (num_port != 0) - { - tcpconf.nwtc_locport= num_port; - tcpconf.nwtc_flags |= NWTC_LP_SET; - } - else - tcpconf.nwtc_flags |= NWTC_LP_SEL; - - if (ioctl(ciptr->fd, NWIOSTCPCONF, &tcpconf) == -1) - { - PRMSG(1, - "MnxTcpCreateListener: NWIOSTCPCONF failed: %s\n", - strerror(errno),0, 0); - return TRANS_CREATE_LISTENER_FAILED; - } - - if (ioctl(ciptr->fd, NWIOGTCPCONF, &tcpconf) == -1) - { - PRMSG(1, - "MnxTcpListen: NWIOGTCPCONF failed: %s\n", - strerror(errno),0, 0); - return TRANS_CREATE_LISTENER_FAILED; - } - - priv->listen_port= tcpconf.nwtc_locport; - - if ((addr= (struct sockaddr_in *)xalloc(sizeof(struct sockaddr_in))) - == NULL) - { - PRMSG(1, "MnxTcpAccept: malloc failed\n", 0, 0, 0); - return TRANS_CREATE_LISTENER_FAILED; - } - addr->sin_family= AF_INET; - addr->sin_addr.s_addr= tcpconf.nwtc_locaddr; - addr->sin_port= tcpconf.nwtc_locport; - if (ciptr->addr) - xfree(ciptr->addr); - ciptr->addr= (char *)addr; - ciptr->addrlen= sizeof(struct sockaddr_in); - - flags= fcntl(ciptr->fd, F_GETFD); - if (flags == -1) - { - PRMSG(1, - "MnxTcpCreateListener: fcntl F_GETFD failed: %s\n", - strerror(errno), 0, 0); - return TRANS_CREATE_LISTENER_FAILED; - } - if (fcntl(ciptr->fd, F_SETFD, flags | FD_ASYNCHIO) == -1) - { - PRMSG(1, - "MnxTcpCreateListener: fcntl F_SETFD failed: %s\n", - strerror(errno), 0, 0); - return TRANS_CREATE_LISTENER_FAILED; - } - - tcpcl.nwtcl_flags= 0; - r= ioctl(ciptr->fd, NWIOTCPLISTEN, &tcpcl); - s_errno= errno; - - if (fcntl(ciptr->fd, F_SETFD, flags) == -1) - { - PRMSG(1, - "MnxTcpCreateListener: fcntl F_SETFD failed: %s\n", - strerror(errno), 0, 0); - return TRANS_CREATE_LISTENER_FAILED; - } - - if (r == -1 && s_errno == EINPROGRESS) - { - nbio_inprogress(ciptr->fd, ASIO_IOCTL, 1 /* read */, - 1 /* write */, 0 /* exception */); - return 0; - } - if (r == 0) - { - priv->listen_completed= 1; - return 0; - } - - errno= s_errno; - PRMSG(1, "MnxTcpCreateListener: NWIOTCPLISTEN failed: %s\n", - strerror(errno), 0, 0); - return TRANS_CREATE_LISTENER_FAILED; -} -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_SERVER -static int -TRANS(MnxTcpResetListener) (ciptr) - -XtransConnInfo ciptr; -{ - PRMSG(2, "MnxTcpResetListener(%d)\n", ciptr->fd, 0, 0); - return TRANS_RESET_NOOP; -} -#endif /* TRANS_SERVER */ - -#ifdef TRANS_SERVER -static XtransConnInfo -TRANS(MnxTcpAccept) (ciptr_listen, status) - -XtransConnInfo ciptr_listen; -int *status; - -{ - XtransConnInfo ciptr; - int s_errno; - int fd; - nbio_ref_t ref; - struct private *priv; - nwio_tcpconf_t tcpconf; - struct sockaddr_in *addr; - - PRMSG(2, "MnxTcpAccept(%d,%p)\n", ciptr_listen->fd, status, 0); - - priv= (struct private *)ciptr_listen->priv; - *status= TRANS_ACCEPT_MISC_ERROR; - - if (!priv->listen_completed) - { - PRMSG(1, "MnxTcpAccept: listen is not completed\n", - 0, 0, 0); - *status= TRANS_ACCEPT_FAILED; - return NULL; - } - priv->listen_completed= 0; - - if ((ciptr= alloc_ConnInfo(ciptr_listen->transptr)) == NULL) - { - PRMSG(1, - "MnxTcpAccept: alloc_ConnInfo failed\n", - 0, 0, 0); - *status= TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - if ((ciptr->priv= (char *)alloc_private(RD_BUFSIZE, WR_BUFSIZE)) == - NULL) - { - PRMSG(1, - "MnxTcpAccept: alloc_private() failed\n", - 0, 0, 0); - s_errno= errno; - free_ConnInfo(ciptr); - errno= s_errno; - *status= TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - fd= dup(ciptr_listen->fd); - if (fd == -1) - { - s_errno= errno; - PRMSG(1, "MnxTcpAccept: dup failed: %s\n", - strerror(errno), 0, 0); - free_ConnInfo(ciptr); - *status= TRANS_ACCEPT_FAILED; - return NULL; - } - if (restart_listen(ciptr_listen) == -1) - { - priv->listen_list= listen_list; - listen_list= ciptr_listen; - PRMSG(1, "MnxTcpAccept: unable to restart listen\n", - 0, 0, 0); - } - ciptr->fd= fd; - ref.ref_ptr= ciptr; - nbio_register(fd); - nbio_setcallback(fd, ASIO_WRITE, write_cb, ref); - nbio_setcallback(fd, ASIO_READ, read_cb, ref); - - if (ioctl(ciptr->fd, NWIOGTCPCONF, &tcpconf) == -1) - { - PRMSG(1, "MnxTcpAccept: NWIOGTCPCONF failed: %s\n", - strerror(errno),0, 0); - close(fd); - free_ConnInfo(ciptr); - *status= TRANS_ACCEPT_MISC_ERROR; - return NULL; - } - if ((addr= (struct sockaddr_in *)xalloc(sizeof(struct sockaddr_in))) - == NULL) - { - PRMSG(1, "MnxTcpAccept: malloc failed\n", 0, 0, 0); - close(fd); - free_ConnInfo(ciptr); - *status= TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - addr->sin_family= AF_INET; - addr->sin_addr.s_addr= tcpconf.nwtc_locaddr; - addr->sin_port= tcpconf.nwtc_locport; - if (ciptr->addr) - xfree(ciptr->addr); - ciptr->addr= (char *)addr; - ciptr->addrlen= sizeof(struct sockaddr_in); - if (*(u8_t *)&tcpconf.nwtc_remaddr == 127) - { - /* Make ConvertAddress return FamilyLocal */ - addr->sin_addr.s_addr= tcpconf.nwtc_remaddr; - } - - if ((addr= (struct sockaddr_in *)xalloc(sizeof(struct sockaddr_in))) - == NULL) - { - PRMSG(1, "MnxTcpConnect: malloc failed\n", 0, 0, 0); - close(fd); - free_ConnInfo(ciptr); - *status= TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - addr->sin_family= AF_INET; - addr->sin_addr.s_addr= tcpconf.nwtc_remaddr; - addr->sin_port= tcpconf.nwtc_remport; - ciptr->peeraddr= (char *)addr; - ciptr->peeraddrlen= sizeof(struct sockaddr_in); - *status= 0; - return ciptr; -} -#endif /* TRANS_SERVER */ - -TRANS(MnxTcpConnect) (ciptr, host, port) - -XtransConnInfo ciptr; -char *host; -char *port; - -{ - struct hostent *hostp; - struct servent *servp; - char hostnamebuf[256]; /* tmp space */ - tcpport_t num_port; - ipaddr_t num_addr; - char *check; - nwio_tcpconf_t tcpconf; - nwio_tcpcl_t tcpcl; - struct sockaddr_in *addr; - - PRMSG(2, "MnxTcpConnect(%d,%s,%s)\n", ciptr->fd, host, port); - - if (!host) - { - hostnamebuf[0] = '\0'; - (void) TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); - host = hostnamebuf; - } - - - num_port= strtol(port, &check, 10); - num_port= htons(num_port); - if (check[0] == '\0') - port= NULL; -#ifdef X11_t - /* - * X has a well known port, that is transport dependent. It is easier - * to handle it here, than try and come up with a transport independent - * representation that can be passed in and resolved the usual way. - * - * The port that is passed here is really a string containing the - * idisplay from ConnectDisplay(). - */ - if (port == NULL) - num_port= htons(ntohs(num_port) + X_TCP_PORT); -#endif - - num_addr= inet_addr(host); - if (num_addr != -1) - host= NULL; - - if (host != NULL) - { - if ((hostp = gethostbyname(host)) == NULL) - { - PRMSG(1, - "MnxTcpConnect: can't get address for %s\n", - host, 0, 0); - errno= EINVAL; - return TRANS_CONNECT_FAILED; - } - if (hostp->h_addrtype != AF_INET) /* is IP host? */ - { - PRMSG(1, "MnxTcpConnect: %s in not an INET host\n", - host, 0, 0); - errno= EINVAL; - return TRANS_CONNECT_FAILED; - } - num_addr= *(ipaddr_t *)hostp->h_addr; - } - - if (port != NULL) - { - if ((servp = getservbyname (port, "tcp")) == NULL) - { - PRMSG(1, - "MnxTcpConnect: can't get service for %s\n", - port, 0, 0); - errno= EINVAL; - return TRANS_CONNECT_FAILED; - } - num_port= servp->s_port; - } - - tcpconf.nwtc_flags= NWTC_EXCL | NWTC_LP_SEL | NWTC_SET_RA | - NWTC_SET_RP; - tcpconf.nwtc_remaddr= num_addr; - tcpconf.nwtc_remport= num_port; - if (ioctl(ciptr->fd, NWIOSTCPCONF, &tcpconf) == -1) - { - PRMSG(1, "MnxTcpConnect: NWIOSTCPCONF failed: %s\n", - strerror(errno),0, 0); - return TRANS_CONNECT_FAILED; - } - - tcpcl.nwtcl_flags= 0; - if (ioctl(ciptr->fd, NWIOTCPCONN, &tcpcl) == -1) - { - PRMSG(1, "MnxTcpConnect: connect failed: %s\n", - strerror(errno),0, 0); - if (errno == ECONNREFUSED || errno == EINTR) - return TRANS_TRY_CONNECT_AGAIN; - else - return TRANS_CONNECT_FAILED; - } - - if (ioctl(ciptr->fd, NWIOGTCPCONF, &tcpconf) == -1) - { - PRMSG(1, "MnxTcpConnect: NWIOGTCPCONF failed: %s\n", - strerror(errno),0, 0); - return TRANS_CONNECT_FAILED; - } - if ((addr= (struct sockaddr_in *)xalloc(sizeof(struct sockaddr_in))) - == NULL) - { - PRMSG(1, "MnxTcpConnect: malloc failed\n", 0, 0, 0); - return TRANS_CONNECT_FAILED; - } - addr->sin_family= AF_INET; - addr->sin_addr.s_addr= tcpconf.nwtc_locaddr; - addr->sin_port= tcpconf.nwtc_locport; - ciptr->addr= (char *)addr; - ciptr->addrlen= sizeof(struct sockaddr_in); - if (*(u8_t *)&tcpconf.nwtc_remaddr == 127) - { - /* Make ConvertAddress return FamilyLocal */ - addr->sin_addr.s_addr= tcpconf.nwtc_remaddr; - } - - if ((addr= (struct sockaddr_in *)xalloc(sizeof(struct sockaddr_in))) - == NULL) - { - PRMSG(1, "MnxTcpConnect: malloc failed\n", 0, 0, 0); - return TRANS_CONNECT_FAILED; - } - addr->sin_family= AF_INET; - addr->sin_addr.s_addr= tcpconf.nwtc_remaddr; - addr->sin_port= tcpconf.nwtc_remport; - ciptr->peeraddr= (char *)addr; - ciptr->peeraddrlen= sizeof(struct sockaddr_in); - - return 0; -} - -static int -TRANS(MnxTcpBytesReadable) (ciptr, pend) - -XtransConnInfo ciptr; -BytesReadable_t *pend; - -{ - struct private *priv; - int r; - - PRMSG(2, "MnxTcpBytesReadable(%x,%d,%x)\n", - ciptr, ciptr->fd, pend); - - *pend= 0; - - priv= (struct private *)ciptr->priv; - if (priv->read_inprogress) - { - PRMSG(5, "MnxTcpBytesReadable: read inprogress, %d\n", - *pend, 0, 0); - return *pend; - } - if (priv->read_offset < priv->read_size) - { - *pend= priv->read_size-priv->read_offset; - PRMSG(5, "MnxTcpBytesReadable: %d\n", - *pend, 0, 0); - return *pend; - } - priv->read_offset= 0; - r= read(ciptr->fd, priv->read_buffer, priv->read_bufsize); - if (r >= 0) - { - if (r == 0) - r= 1; /* Signal EOF condition */ - - priv->read_size= r; - PRMSG(5, "MnxTcpBytesReadable: %d\n", - *pend, 0, 0); - *pend= r; - } - else if (r == -1 && errno == EINPROGRESS) - { - priv->read_inprogress= 1; - nbio_inprogress(ciptr->fd, ASIO_READ, 1 /* read */, - 0 /* write */, 0 /* exception */); - } - else - { - PRMSG(1, "MnxTcpBytesReadable: read failed: %s\n", - strerror(errno), 0, 0); - return -1; - } - PRMSG(5, "MnxTcpBytesReadable: %d\n", *pend, 0, 0); - return *pend; -} - - -static int -TRANS(MnxTcpRead) (ciptr, buf, size) - -XtransConnInfo ciptr; -char *buf; -int size; - -{ - int len, r, ret, s_errno; - int offset; - struct private *priv; - asio_fd_set_t fd_set; - fwait_t fw; - - PRMSG(2, "MnxTcpRead(%d,%x,%d)\n", ciptr->fd, buf, size); - - priv= (struct private *)ciptr->priv; - offset= 0; - - if (priv->read_inprogress) - { - PRMSG(5, "MnxTcpRead: EAGAIN\n", 0, 0, 0); - errno= EAGAIN; - return -1; - } - - /* Copy any data left in the buffer */ - if (priv->read_offset < priv->read_size) - { - len= priv->read_size-priv->read_offset; - if (len > size-offset) - len= size-offset; - PRMSG(5, "MnxTcpRead: copying %d bytes\n", len, 0, 0); - - memcpy(buf+offset, priv->read_buffer + priv->read_offset, - len); - offset += len; - priv->read_offset += len; - if (priv->read_offset < priv->read_size) - return offset; - } - - /* Try to read directly into the user's buffer. */ - ret= 0; - s_errno= 0; - while(offset < size) - { - r= read(ciptr->fd, buf+offset, size-offset); - if (r == -1 && errno == EINPROGRESS) - { - r= fcancel(ciptr->fd, ASIO_READ); - if (r == -1) - abort(); - ASIO_FD_ZERO(&fd_set); - ASIO_FD_SET(ciptr->fd, ASIO_READ, &fd_set); - fw.fw_flags= FWF_NONBLOCK; - fw.fw_bits= fd_set.afds_bits; - fw.fw_maxfd= ASIO_FD_SETSIZE; - r= fwait(&fw); - if (r == -1 || fw.fw_fd != ciptr->fd || - fw.fw_operation != ASIO_READ) - { - abort(); - } - r= fw.fw_result; - errno= fw.fw_errno; - } - - if (r > 0) - { - PRMSG(5, "MnxTcpRead: read %d bytes\n", r, - 0, 0); - offset += r; - continue; - } - else if (r == 0) - { - PRMSG(5, "MnxTcpRead: read EOF\n", 0, 0, 0); - break; - } - else - { - if (errno == EINTR) - { - PRMSG(5, "MnxTcpRead: EINTR\n", - 0, 0, 0); - errno= EAGAIN; - } - else - { - PRMSG(1, "MnxTcpRead: read error %s\n", - strerror(errno), 0, 0); - } - s_errno= errno; - ret= -1; - break; - } - } - if (offset != 0) - ret= offset; - - if (priv->read_offset != priv->read_size) - abort(); - priv->read_offset= 0; - priv->read_size= 0; - if (priv->nonblocking) - { - r= read(ciptr->fd, priv->read_buffer, priv->read_bufsize); - if (r >= 0) - { - PRMSG(5, "MnxTcpRead: buffered %d bytes\n", - r, 0, 0); - priv->read_size= r; - } - else if (r == -1 && errno == EINPROGRESS) - { - priv->read_inprogress= 1; - nbio_inprogress(ciptr->fd, ASIO_READ, 1 /* read */, - 0 /* write */, 0 /* exception */); - } - else - { - PRMSG(1, "MnxTcpRead: read failed: %s\n", - strerror(errno), 0, 0); - } - } - errno= s_errno; - return ret; -} - - -static int -TRANS(MnxTcpWrite) (ciptr, buf, size) - -XtransConnInfo ciptr; -char *buf; -int size; - -{ - int len, r, ret, s_errno; - int offset; - struct private *priv; - asio_fd_set_t fd_set; - fwait_t fw; - - PRMSG(2, "MnxTcpWrite(%d,%x,%d)\n", ciptr->fd, buf, size); - - priv= (struct private *)ciptr->priv; - offset= 0; - - if (priv->write_errno) - { - PRMSG(5, "MnxTcpWrite: write_errno %d\n", - priv->write_errno, 0, 0); - errno= priv->write_errno; - return -1; - } - - if (priv->write_inprogress) - { - PRMSG(5, "MnxTcpWrite: EAGAIN\n", 0, 0, 0); - errno= EAGAIN; - return -1; - } - - /* Try to write directly out of the user's buffer. */ - ret= 0; - s_errno= 0; - while(offset < size) - { - r= write(ciptr->fd, buf+offset, size-offset); - if (r == -1 && errno == EINPROGRESS) - { - r= fcancel(ciptr->fd, ASIO_WRITE); - if (r == -1) - abort(); - ASIO_FD_ZERO(&fd_set); - ASIO_FD_SET(ciptr->fd, ASIO_WRITE, &fd_set); - fw.fw_flags= FWF_NONBLOCK; - fw.fw_bits= fd_set.afds_bits; - fw.fw_maxfd= ASIO_FD_SETSIZE; - r= fwait(&fw); - if (r == -1 || fw.fw_fd != ciptr->fd || - fw.fw_operation != ASIO_WRITE) - { - abort(); - } - r= fw.fw_result; - errno= fw.fw_errno; - } - if (r > 0) - { - PRMSG(5, "MnxTcpWrite: wrote %d bytes\n", r, - 0, 0); - offset += r; - continue; - } - else if (r == 0) - abort(); - else - { - if (errno == EINTR) - { - PRMSG(5, "MnxTcpWrite: EINTR\n", - 0, 0, 0); - errno= EAGAIN; - } - else - { - PRMSG(1, - "MnxTcpWrite: write error: %s\n", - strerror(errno), 0, 0); - } - s_errno= errno; - ret= -1; - break; - } - } - - /* Copy any data to the buffer */ - if (offset < size) - { - len= priv->write_bufsize; - if (len > size-offset) - len= size-offset; - PRMSG(5, "MnxTcpWrite: copying %d bytes\n", len, 0, 0); - - memcpy(priv->write_buffer, buf+offset, len); - offset += len; - priv->write_offset= 0; - priv->write_size= len; - } - if (offset != 0) - ret= offset; - - while (priv->write_offset < priv->write_size) - { - r= write(ciptr->fd, priv->write_buffer+priv->write_offset, - priv->write_size-priv->write_offset); - if (r > 0) - { - PRMSG(5, "MnxTcpWrite: wrote %d bytes\n", - r, 0, 0); - priv->write_offset += r; - continue; - } - else if (r == -1 && errno == EINPROGRESS) - { - priv->write_inprogress= 1; - nbio_inprogress(ciptr->fd, ASIO_WRITE, 0 /* read */, - 1 /* write */, 0 /* exception */); - } - else - { - PRMSG(1, "MnxTcpWrite: write failed: %s\n", - strerror(errno), 0, 0); - priv->write_errno= errno; - } - break; - } - - errno= s_errno; - return ret; -} - - -static int -TRANS(MnxTcpReadv) (ciptr, buf, size) - -XtransConnInfo ciptr; -struct iovec *buf; -int size; - -{ - int i, offset, total, len, r; - - PRMSG(2, "MnxTcpReadv(%d,%x,%d)\n", ciptr->fd, buf, size); - - /* Simply call read a number of times. */ - total= 0; - offset= 0; - i= 0; - while(i<size) - { - PRMSG(5, "MnxTcpReadv: [%d] size %d-%d\n", - i, buf[i].iov_len, offset); - if (offset >= buf[i].iov_len) - { - offset= 0; - i++; - continue; - } - len= buf[i].iov_len-offset; - r= TRANS(MnxTcpRead)(ciptr, buf[i].iov_base+offset, len); - if (r == -1) - { - if (errno == EAGAIN) - { - PRMSG(5, - "MnxTcpReadv: read returned: %s\n", - strerror(errno), 0, 0); - } - else - { - PRMSG(1, - "MnxTcpReadv: read failed: %s\n", - strerror(errno), 0, 0); - } - if (total != 0) - return total; - else - return -1; - } - if (r == 0) - break; - if (r > len) - abort(); - total += r; - offset += r; - } - return total; -} - -static int -TRANS(MnxTcpWritev) (ciptr, buf, size) - -XtransConnInfo ciptr; -struct iovec *buf; -int size; - -{ - int i, offset, total, len, r; - - PRMSG(2, "MnxTcpWritev(%d,%x,%d)\n", ciptr->fd, buf, size); - - /* Simply call write a number of times. */ - total= 0; - offset= 0; - i= 0; - while(i<size) - { - if (offset >= buf[i].iov_len) - { - offset= 0; - i++; - continue; - } - len= buf[i].iov_len-offset; - r= TRANS(MnxTcpWrite)(ciptr, buf[i].iov_base+offset, len); - if (r == -1) - { - if (errno == EAGAIN) - { - PRMSG(5, "MnxTcpWritev: AGAIN\n", - 0, 0, 0); - } - else - { - PRMSG(1, - "MnxTcpWritev: write failed: %s\n", - strerror(errno), 0, 0); - } - if (total != 0) - return total; - else - return -1; - } - if (r == 0 || r > len) - abort(); - total += r; - offset += r; - } - return total; -} - - -static int -TRANS(MnxTcpDisconnect) (ciptr) - -XtransConnInfo ciptr; - -{ - PRMSG(2, "MnxTcpDisconnect(%x,%d)\n", ciptr, ciptr->fd, 0); - - return ioctl(ciptr->fd, NWIOTCPSHUTDOWN, NULL); -} - -static int -TRANS(MnxTcpClose) (ciptr) - -XtransConnInfo ciptr; - -{ - XtransConnInfo list, t_ciptr; - struct private *priv; - - PRMSG(2, "MnxTcpClose(%x,%d)\n", ciptr, ciptr->fd, 0); - - - if (listen_list) - { - list= listen_list; - listen_list= NULL; - while(list) - { - t_ciptr= list; - priv= (struct private *)t_ciptr->priv; - list= priv->listen_list; - if (t_ciptr == ciptr) - continue; - if (restart_listen(t_ciptr) == -1) - { - priv->listen_list= listen_list; - listen_list= t_ciptr; - } - } - } - - free_private((struct private *)ciptr->priv); - nbio_unregister(ciptr->fd); - return close (ciptr->fd); -} - - -static XtransConnInfo -alloc_ConnInfo(thistrans) -Xtransport *thistrans; -{ - XtransConnInfo ciptr; - - PRMSG(2, " alloc_ConnInfo(%p)\n", thistrans, 0, 0); - - if ((ciptr= (XtransConnInfo) xalloc(sizeof(struct _XtransConnInfo))) - == NULL) - { - PRMSG(1, " alloc_ConnInfo: malloc failed\n", 0, 0, 0); - return NULL; - } - ciptr->transptr= thistrans; - ciptr->priv= NULL; - ciptr->flags= 0; - ciptr->fd= -1; - ciptr->port= NULL; - ciptr->family= AF_INET; - ciptr->addr= NULL; - ciptr->addrlen= 0; - ciptr->peeraddr= NULL; - ciptr->peeraddrlen= 0; - return ciptr; -} - -static void -free_ConnInfo(ciptr) -XtransConnInfo ciptr; -{ - if (ciptr == NULL) - return; - free_private((struct private *)ciptr->priv); - xfree(ciptr); -} - -static struct private * -alloc_private(rd_size, wr_size) -size_t rd_size; -size_t wr_size; -{ - struct private *priv; - int s_errno; - char *buf; - - PRMSG(2, ":alloc_private(%d, %d)\n", rd_size, wr_size, 0); - - if ((priv= (struct private *)xalloc(sizeof(struct private))) == NULL) - { - PRMSG(1, ":alloc_private: malloc failed\n", 0, 0, 0); - return NULL; - } - priv->nonblocking= 0; - priv->read_inprogress= 0; - priv->read_buffer= NULL; - priv->read_bufsize= rd_size; - priv->read_size= 0; - priv->read_offset= 0; - - if (rd_size != 0) - { - if ((buf= xalloc(rd_size)) == NULL) - { - PRMSG(1, ":alloc_private: malloc failed\n", 0, 0, 0); - s_errno= errno; - free_private(priv); - errno= s_errno; - return NULL; - } - priv->read_buffer= buf; - } - - priv->write_inprogress= 0; - priv->write_buffer= NULL; - priv->write_bufsize= rd_size; - priv->write_size= 0; - priv->write_offset= 0; - priv->write_errno= 0; - - if (wr_size != 0) - { - if ((buf= xalloc(wr_size)) == NULL) - { - PRMSG(1, ":alloc_private: malloc failed\n", 0, 0, 0); - s_errno= errno; - free_private(priv); - errno= s_errno; - return NULL; - } - priv->write_buffer= buf; - } - - priv->listen_completed= 0; - priv->listen_port= 0; - priv->listen_list= NULL; - - return priv; -} - -static void -free_private(priv) -struct private *priv; -{ - if (priv == NULL) - return; - xfree(priv->read_buffer); - xfree(priv->write_buffer); - xfree(priv); -} - -static void -read_cb(ref, res, err) -nbio_ref_t ref; -int res; -int err; -{ - XtransConnInfo ciptr; - struct private *priv; - - PRMSG(2, ":read_cb(%x,%d,%d)\n", ref.ref_ptr, res, err); - - ciptr= ref.ref_ptr; - priv= (struct private *)ciptr->priv; - if (res > 0) - priv->read_size= res; - priv->read_inprogress= 0; -} - -static void -write_cb(ref, res, err) -nbio_ref_t ref; -int res; -int err; -{ - XtransConnInfo ciptr; - struct private *priv; - int r; - - PRMSG(2, ":write_cb(%x,%d,%d)\n", ref.ref_ptr, res, err); - - ciptr= ref.ref_ptr; - priv= (struct private *)ciptr->priv; - if (res > 0) - priv->write_offset += res; - else if (res == 0) - abort(); - else - { - priv->write_errno= err; - return; - } - priv->write_inprogress= 0; - - while (priv->write_offset < priv->write_size) - { - r= write(ciptr->fd, priv->write_buffer+priv->write_offset, - priv->write_size-priv->write_offset); - if (r > 0) - { - PRMSG(5, "MnxTcpWrite: wrote %d bytes\n", - r, 0, 0); - priv->write_offset += r; - continue; - } - else if (r == -1 && errno == EINPROGRESS) - { - priv->write_inprogress= 1; - nbio_inprogress(ciptr->fd, ASIO_WRITE, 0 /* read */, - 1 /* write */, 0 /* exception */); - } - else - { - PRMSG(1, "MnxTcpWrite: write failed: %s\n", - strerror(errno), 0, 0); - priv->write_errno= errno; - } - break; - } -} - -static void -listen_cb(ref, res, err) -nbio_ref_t ref; -int res; -int err; -{ - XtransConnInfo ciptr; - struct private *priv; - struct sockaddr_in *addr; - nwio_tcpconf_t tcpconf; - - PRMSG(2, ":listen_cb(%x,%d,%d)\n", ref.ref_ptr, res, err); - - ciptr= ref.ref_ptr; - priv= (struct private *)ciptr->priv; - if (res == 0) - { - if (ioctl(ciptr->fd, NWIOGTCPCONF, &tcpconf) == -1) - { - PRMSG(1, - ":listen_cb: NWIOGTCPCONF failed: %s\n", - strerror(errno),0, 0); - return; - } - if ((addr= (struct sockaddr_in *)xalloc(sizeof(struct sockaddr_in))) - == NULL) - { - PRMSG(1, ":listen_cb: malloc failed\n", 0, 0, 0); - return; - } - addr->sin_family= AF_INET; - addr->sin_addr.s_addr= tcpconf.nwtc_locaddr; - addr->sin_port= tcpconf.nwtc_locport; - if (ciptr->addr) - xfree(ciptr->addr); - ciptr->addr= (char *)addr; - ciptr->addrlen= sizeof(struct sockaddr_in); - priv->listen_completed= 1; - return; - } - PRMSG(2, ":listen_cb: listen failed: %s\n", strerror(err), 0, 0); - if (restart_listen(ciptr) == -1) - { - priv->listen_list= listen_list; - listen_list= ciptr; - } -} - -static int -restart_listen(ciptr) -XtransConnInfo ciptr; -{ - char *tcp_device; - nwio_tcpconf_t tcpconf; - nwio_tcpcl_t tcpcl; - int fd, r, s_errno, flags; - struct private *priv; - nbio_ref_t ref; - - PRMSG(2, ":restart_listen(%d)\n", ciptr->fd, 0, 0); - - nbio_unregister(ciptr->fd); - - if ((tcp_device= getenv("TCP_DEVICE")) == NULL) - tcp_device= TCP_DEVICE; - - if ((fd= open(tcp_device, O_RDWR)) == -1) - { - PRMSG(1, ":restart_listen: open '%s' failed: %s\n", - tcp_device, strerror(errno), 0); - return -1; - } - PRMSG(5, ":restart_listen: fd= '%d'\n", fd, 0, 0); - if (fd != ciptr->fd) - { - if (dup2(fd, ciptr->fd) == -1) - abort(); /* no way to recover */ - close(fd); - } - fd= ciptr->fd; - ref.ref_ptr= ciptr; - nbio_register(fd); - nbio_setcallback(fd, ASIO_IOCTL, listen_cb, ref); - - priv= (struct private *)ciptr->priv; - - tcpconf.nwtc_flags= NWTC_SHARED | NWTC_UNSET_RA | NWTC_UNSET_RP; - tcpconf.nwtc_locport= priv->listen_port; - tcpconf.nwtc_flags |= NWTC_LP_SET; - - if (ioctl(ciptr->fd, NWIOSTCPCONF, &tcpconf) == -1) - { - PRMSG(1, - ":restart_listen: NWIOSTCPCONF failed: %s\n", - strerror(errno),0, 0); - return -1; - } - - flags= fcntl(ciptr->fd, F_GETFD); - if (flags == -1) - { - PRMSG(1, - ":restart_listen: fcntl F_GETFD failed: %s\n", - strerror(errno), 0, 0); - return -1; - } - if (fcntl(ciptr->fd, F_SETFD, flags | FD_ASYNCHIO) == -1) - { - PRMSG(1, - ":restart_listen: fcntl F_SETFD failed: %s\n", - strerror(errno), 0, 0); - return -1; - } - - tcpcl.nwtcl_flags= 0; - r= ioctl(ciptr->fd, NWIOTCPLISTEN, &tcpcl); - s_errno= errno; - - if (fcntl(ciptr->fd, F_SETFD, flags) == -1) - { - PRMSG(1, - ":restart_listen: fcntl F_SETFD failed: %s\n", - strerror(errno), 0, 0); - return -1; - } - - if (r == -1 && s_errno == EINPROGRESS) - { - nbio_inprogress(ciptr->fd, ASIO_IOCTL, 1 /* read */, - 1 /* write */, 0 /* exception */); - return 0; - } - if (r == 0) - { - priv->listen_completed= 1; - return 0; - } - errno= s_errno; - PRMSG(1, ":restart_listen: NWIOTCPLISTEN failed: %s\n", - strerror(errno), 0, 0); - return -1; -} - - -Xtransport TRANS(MnxINETFuncs) = -{ - /* Minix TCP Interface */ - "inet", - 0, -#ifdef TRANS_CLIENT - TRANS(MnxTcpOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(MnxTcpOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(MnxTcpOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(MnxTcpOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(MnxTcpReopenCOTSServer), - TRANS(MnxTcpReopenCLTSServer), -#endif - TRANS(MnxTcpSetOption), -#ifdef TRANS_SERVER - TRANS(MnxTcpCreateListener), - TRANS(MnxTcpResetListener), - TRANS(MnxTcpAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(MnxTcpConnect), -#endif /* TRANS_CLIENT */ - TRANS(MnxTcpBytesReadable), - TRANS(MnxTcpRead), - TRANS(MnxTcpWrite), - TRANS(MnxTcpReadv), - TRANS(MnxTcpWritev), - TRANS(MnxTcpDisconnect), - TRANS(MnxTcpClose), - TRANS(MnxTcpClose), -}; - -Xtransport TRANS(MnxTCPFuncs) = -{ - /* Minix TCP Interface */ - "tcp", - TRANS_ALIAS, -#ifdef TRANS_CLIENT - TRANS(MnxTcpOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(MnxTcpOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(MnxTcpOpenCLTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(MnxTcpOpenCLTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(MnxTcpReopenCOTSServer), - TRANS(MnxTcpReopenCLTSServer), -#endif - TRANS(MnxTcpSetOption), -#ifdef TRANS_SERVER - TRANS(MnxTcpCreateListener), - TRANS(MnxTcpResetListener), - TRANS(MnxTcpAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(MnxTcpConnect), -#endif /* TRANS_CLIENT */ - TRANS(MnxTcpBytesReadable), - TRANS(MnxTcpRead), - TRANS(MnxTcpWrite), - TRANS(MnxTcpReadv), - TRANS(MnxTcpWritev), - TRANS(MnxTcpDisconnect), - TRANS(MnxTcpClose), - TRANS(MnxTcpClose), -}; diff --git a/xc/programs/Imakefile b/xc/programs/Imakefile index 927d1dbc1..1d1b8a010 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.45 2001/05/01 17:23:26 alanh Exp $ +XCOMM $XFree86: xc/programs/Imakefile,v 3.47 2001/06/30 21:53:57 tsi Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" @@ -95,6 +95,10 @@ XINPUTCLIENTDIRS = xsetmode xsetpointer XLOADDIR = xload #endif +#if BuildRandRLibrary + XRANDRDIR = xrandr +#endif + #if BuildServersOnly || !BuildClients SUBDIRS = $(XSSRCDIR) #else @@ -119,7 +123,7 @@ SUBDIRS = \ $(XTERMSRCDIR) $(XVIDTUNESRCDIR) xwd xwininfo xwud \ $(XPMCLIENTDIRS) $(XVINFOSRCDIR) \ $(XSSRCDIR) $(XASSRCDIR) $(LBXPROXYSRCDIR) $(SCRIPTSDIR) \ - $(GLXCLIENTDIRS) $(XFTCACHEDIR) + $(GLXCLIENTDIRS) $(XFTCACHEDIR) $(XRANDRDIR) #endif MakeSubdirs($(SUBDIRS)) diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 12d7a8df1..1f3a64f86 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.31 2001/04/10 16:07:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.32 2001/08/18 02:51:08 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. diff --git a/xc/programs/Xserver/GL/dri/drimodule.c b/xc/programs/Xserver/GL/dri/drimodule.c index 0f56efeec..1c2b3f112 100644 --- a/xc/programs/Xserver/GL/dri/drimodule.c +++ b/xc/programs/Xserver/GL/dri/drimodule.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/GL/dri/drimodule.c,v 1.4 2001/04/10 16:07:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/drimodule.c,v 1.5 2001/06/15 21:22:39 dawes Exp $ */ /* * Authors: @@ -64,8 +64,29 @@ ExtensionModule XF86DRIExt = NULL }; -static const char *glxSymbols[] = { - "__glXActiveScreens", +static const char *drmSymbols[] = { + "drmAddContextTag", + "drmAddMap", + "drmAuthMagic", + "drmAvailable", + "drmClose", + "drmCreateContext", + "drmCreateDrawable", + "drmDelContextTag", + "drmDestroyContext", + "drmDestroyDrawable", + "drmFreeReservedContextList", + "drmGetContextTag", + "drmGetLock", + "drmGetReservedContextList", + "drmInstallSIGIOHandler", + "drmMap", + "drmOpen", + "drmRemoveSIGIOHandler", + "drmSetBusid", + "drmSetContextFlags", + "drmUnlock", + "drmUnmap", NULL }; @@ -80,18 +101,19 @@ driSetup(pointer module, pointer opts, int *errmaj, int *errmin) if (!setupDone) { setupDone = TRUE; - LoaderRefSymLists(glxSymbols, NULL); - drm = LoadSubModule(module, "drm", NULL, NULL, NULL, NULL, errmaj, errmin); - if (!drm) - ErrorF("Cannot load the drm library\n"); - else + if (!drm) { + if (errmaj) *errmaj = LDR_NOSUBENT; + } + else { + LoaderReqSymLists(drmSymbols, NULL); LoadExtension(&XF86DRIExt, FALSE); + } + } else { + if (errmaj) *errmaj = LDR_ONCEONLY; } - - if (errmaj) *errmaj = LDR_ONCEONLY; /* Need a non-NULL return value to indicate success */ return drm; } diff --git a/xc/programs/Xserver/GL/glx/single2.c b/xc/programs/Xserver/GL/glx/single2.c index a4efbca92..286f63d70 100644 --- a/xc/programs/Xserver/GL/glx/single2.c +++ b/xc/programs/Xserver/GL/glx/single2.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.6 2001/06/06 19:00:15 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 diff --git a/xc/programs/Xserver/GL/glxmodule.c b/xc/programs/Xserver/GL/glxmodule.c index 6965a5562..513bb7647 100644 --- a/xc/programs/Xserver/GL/glxmodule.c +++ b/xc/programs/Xserver/GL/glxmodule.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/GL/glxmodule.c,v 1.10 2001/04/10 16:07:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glxmodule.c,v 1.11 2001/06/15 21:22:38 dawes Exp $ */ /* * Authors: @@ -54,6 +54,1154 @@ ExtensionModule GLXExt = initdeps }; +static const char *glcoreSymbols[] = { + "__glCallLists_size", + "__glColorTableParameterfv_size", + "__glColorTableParameteriv_size", + "__glConvolutionParameterfv_size", + "__glConvolutionParameteriv_size", + "__glDDXExtensionInfo", + "__glDDXScreenInfo", + "__glEvalComputeK", + "__glFloorLog2", + "__glFogfv_size", + "__glFogiv_size", + "__glGetBooleanv_size", + "__glGetColorTableParameterfv_size", + "__glGetColorTableParameteriv_size", + "__glGetConvolutionParameterfv_size", + "__glGetConvolutionParameteriv_size", + "__glGetDoublev_size", + "__glGetFloatv_size", + "__glGetHistogramParameterfv_size", + "__glGetHistogramParameteriv_size", + "__glGetIntegerv_size", + "__glGetLightfv_size", + "__glGetLightiv_size", + "__glGetMapdv_size", + "__glGetMapfv_size", + "__glGetMapiv_size", + "__glGetMaterialfv_size", + "__glGetMaterialiv_size", + "__glGetMinmaxParameterfv_size", + "__glGetMinmaxParameteriv_size", + "__glGetPixelMapfv_size", + "__glGetPixelMapuiv_size", + "__glGetPixelMapusv_size", + "__glGetTexEnvfv_size", + "__glGetTexEnviv_size", + "__glGetTexGendv_size", + "__glGetTexGenfv_size", + "__glGetTexGeniv_size", + "__glGetTexImage_size", + "__glGetTexLevelParameterfv_size", + "__glGetTexLevelParameteriv_size", + "__glGetTexParameterfv_size", + "__glGetTexParameteriv_size", + "__glLightModelfv_size", + "__glLightModeliv_size", + "__glLightfv_size", + "__glLightiv_size", + "__glMaterialfv_size", + "__glMaterialiv_size", + "__glReadPixels_size", + "__glTexEnvfv_size", + "__glTexEnviv_size", + "__glTexGendv_size", + "__glTexGenfv_size", + "__glTexGeniv_size", + "__glTexParameterfv_size", + "__glTexParameteriv_size", + "__glXActiveScreens", + "__glXAssociateContext", + "__glXBadContext", + "__glXBadContextState", + "__glXBadContextTag", + "__glXBadCurrentWindow", + "__glXBadDrawable", + "__glXBadLargeRequest", + "__glXBadPixmap", + "__glXBadRenderRequest", + "__glXBitmapReqSize", + "__glXCacheDrawableSize", + "__glXCallListsReqSize", + "__glXClearErrorOccured", + "__glXClientInfo", + "__glXClientRes", + "__glXClients", + "__glXColorSubTableReqSize", + "__glXColorTableParameterfvReqSize", + "__glXColorTableParameterivReqSize", + "__glXColorTableReqSize", + "__glXContextRes", + "__glXConvolutionFilter1DReqSize", + "__glXConvolutionFilter2DReqSize", + "__glXConvolutionParameterfvReqSize", + "__glXConvolutionParameterivReqSize", + "__glXCopyContext", + "__glXCoreType", + "__glXCreateContext", + "__glXCreateGLXPixmap", + "__glXDeassociateContext", + "__glXDestroyContext", + "__glXDestroyGLXPixmap", + "__glXDispSwap_Accum", + "__glXDispSwap_ActiveTextureARB", + "__glXDispSwap_AlphaFunc", + "__glXDispSwap_AreTexturesResident", + "__glXDispSwap_AreTexturesResidentEXT", + "__glXDispSwap_Begin", + "__glXDispSwap_BindTexture", + "__glXDispSwap_Bitmap", + "__glXDispSwap_BlendColor", + "__glXDispSwap_BlendEquation", + "__glXDispSwap_BlendFunc", + "__glXDispSwap_CallList", + "__glXDispSwap_CallLists", + "__glXDispSwap_Clear", + "__glXDispSwap_ClearAccum", + "__glXDispSwap_ClearColor", + "__glXDispSwap_ClearDepth", + "__glXDispSwap_ClearIndex", + "__glXDispSwap_ClearStencil", + "__glXDispSwap_ClipPlane", + "__glXDispSwap_Color3bv", + "__glXDispSwap_Color3dv", + "__glXDispSwap_Color3fv", + "__glXDispSwap_Color3iv", + "__glXDispSwap_Color3sv", + "__glXDispSwap_Color3ubv", + "__glXDispSwap_Color3uiv", + "__glXDispSwap_Color3usv", + "__glXDispSwap_Color4bv", + "__glXDispSwap_Color4dv", + "__glXDispSwap_Color4fv", + "__glXDispSwap_Color4iv", + "__glXDispSwap_Color4sv", + "__glXDispSwap_Color4ubv", + "__glXDispSwap_Color4uiv", + "__glXDispSwap_Color4usv", + "__glXDispSwap_ColorMask", + "__glXDispSwap_ColorMaterial", + "__glXDispSwap_ColorSubTable", + "__glXDispSwap_ColorTable", + "__glXDispSwap_ColorTableParameterfv", + "__glXDispSwap_ColorTableParameteriv", + "__glXDispSwap_ConvolutionFilter1D", + "__glXDispSwap_ConvolutionFilter2D", + "__glXDispSwap_ConvolutionParameterf", + "__glXDispSwap_ConvolutionParameterfv", + "__glXDispSwap_ConvolutionParameteri", + "__glXDispSwap_ConvolutionParameteriv", + "__glXDispSwap_CopyColorSubTable", + "__glXDispSwap_CopyColorTable", + "__glXDispSwap_CopyConvolutionFilter1D", + "__glXDispSwap_CopyConvolutionFilter2D", + "__glXDispSwap_CopyPixels", + "__glXDispSwap_CopyTexImage1D", + "__glXDispSwap_CopyTexImage2D", + "__glXDispSwap_CopyTexSubImage1D", + "__glXDispSwap_CopyTexSubImage2D", + "__glXDispSwap_CopyTexSubImage3D", + "__glXDispSwap_CullFace", + "__glXDispSwap_DeleteLists", + "__glXDispSwap_DeleteTextures", + "__glXDispSwap_DeleteTexturesEXT", + "__glXDispSwap_DepthFunc", + "__glXDispSwap_DepthMask", + "__glXDispSwap_DepthRange", + "__glXDispSwap_Disable", + "__glXDispSwap_DrawArrays", + "__glXDispSwap_DrawArraysEXT", + "__glXDispSwap_DrawBuffer", + "__glXDispSwap_DrawPixels", + "__glXDispSwap_EdgeFlagv", + "__glXDispSwap_Enable", + "__glXDispSwap_End", + "__glXDispSwap_EndList", + "__glXDispSwap_EvalCoord1dv", + "__glXDispSwap_EvalCoord1fv", + "__glXDispSwap_EvalCoord2dv", + "__glXDispSwap_EvalCoord2fv", + "__glXDispSwap_EvalMesh1", + "__glXDispSwap_EvalMesh2", + "__glXDispSwap_EvalPoint1", + "__glXDispSwap_EvalPoint2", + "__glXDispSwap_FeedbackBuffer", + "__glXDispSwap_Finish", + "__glXDispSwap_Flush", + "__glXDispSwap_Fogf", + "__glXDispSwap_Fogfv", + "__glXDispSwap_Fogi", + "__glXDispSwap_Fogiv", + "__glXDispSwap_FrontFace", + "__glXDispSwap_Frustum", + "__glXDispSwap_GenLists", + "__glXDispSwap_GenTextures", + "__glXDispSwap_GenTexturesEXT", + "__glXDispSwap_GetBooleanv", + "__glXDispSwap_GetClipPlane", + "__glXDispSwap_GetColorTable", + "__glXDispSwap_GetColorTableParameterfv", + "__glXDispSwap_GetColorTableParameteriv", + "__glXDispSwap_GetConvolutionFilter", + "__glXDispSwap_GetConvolutionParameterfv", + "__glXDispSwap_GetConvolutionParameteriv", + "__glXDispSwap_GetDoublev", + "__glXDispSwap_GetError", + "__glXDispSwap_GetFloatv", + "__glXDispSwap_GetHistogram", + "__glXDispSwap_GetHistogramParameterfv", + "__glXDispSwap_GetHistogramParameteriv", + "__glXDispSwap_GetIntegerv", + "__glXDispSwap_GetLightfv", + "__glXDispSwap_GetLightiv", + "__glXDispSwap_GetMapdv", + "__glXDispSwap_GetMapfv", + "__glXDispSwap_GetMapiv", + "__glXDispSwap_GetMaterialfv", + "__glXDispSwap_GetMaterialiv", + "__glXDispSwap_GetMinmax", + "__glXDispSwap_GetMinmaxParameterfv", + "__glXDispSwap_GetMinmaxParameteriv", + "__glXDispSwap_GetPixelMapfv", + "__glXDispSwap_GetPixelMapuiv", + "__glXDispSwap_GetPixelMapusv", + "__glXDispSwap_GetPolygonStipple", + "__glXDispSwap_GetSeparableFilter", + "__glXDispSwap_GetString", + "__glXDispSwap_GetTexEnvfv", + "__glXDispSwap_GetTexEnviv", + "__glXDispSwap_GetTexGendv", + "__glXDispSwap_GetTexGenfv", + "__glXDispSwap_GetTexGeniv", + "__glXDispSwap_GetTexImage", + "__glXDispSwap_GetTexLevelParameterfv", + "__glXDispSwap_GetTexLevelParameteriv", + "__glXDispSwap_GetTexParameterfv", + "__glXDispSwap_GetTexParameteriv", + "__glXDispSwap_Hint", + "__glXDispSwap_Histogram", + "__glXDispSwap_IndexMask", + "__glXDispSwap_Indexdv", + "__glXDispSwap_Indexfv", + "__glXDispSwap_Indexiv", + "__glXDispSwap_Indexsv", + "__glXDispSwap_Indexubv", + "__glXDispSwap_InitNames", + "__glXDispSwap_IsEnabled", + "__glXDispSwap_IsList", + "__glXDispSwap_IsTexture", + "__glXDispSwap_IsTextureEXT", + "__glXDispSwap_LightModelf", + "__glXDispSwap_LightModelfv", + "__glXDispSwap_LightModeli", + "__glXDispSwap_LightModeliv", + "__glXDispSwap_Lightf", + "__glXDispSwap_Lightfv", + "__glXDispSwap_Lighti", + "__glXDispSwap_Lightiv", + "__glXDispSwap_LineStipple", + "__glXDispSwap_LineWidth", + "__glXDispSwap_ListBase", + "__glXDispSwap_LoadIdentity", + "__glXDispSwap_LoadMatrixd", + "__glXDispSwap_LoadMatrixf", + "__glXDispSwap_LoadName", + "__glXDispSwap_LogicOp", + "__glXDispSwap_Map1d", + "__glXDispSwap_Map1f", + "__glXDispSwap_Map2d", + "__glXDispSwap_Map2f", + "__glXDispSwap_MapGrid1d", + "__glXDispSwap_MapGrid1f", + "__glXDispSwap_MapGrid2d", + "__glXDispSwap_MapGrid2f", + "__glXDispSwap_Materialf", + "__glXDispSwap_Materialfv", + "__glXDispSwap_Materiali", + "__glXDispSwap_Materialiv", + "__glXDispSwap_MatrixMode", + "__glXDispSwap_Minmax", + "__glXDispSwap_MultMatrixd", + "__glXDispSwap_MultMatrixf", + "__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", + "__glXDispSwap_NewList", + "__glXDispSwap_Normal3bv", + "__glXDispSwap_Normal3dv", + "__glXDispSwap_Normal3fv", + "__glXDispSwap_Normal3iv", + "__glXDispSwap_Normal3sv", + "__glXDispSwap_Ortho", + "__glXDispSwap_PassThrough", + "__glXDispSwap_PixelMapfv", + "__glXDispSwap_PixelMapuiv", + "__glXDispSwap_PixelMapusv", + "__glXDispSwap_PixelStoref", + "__glXDispSwap_PixelStorei", + "__glXDispSwap_PixelTransferf", + "__glXDispSwap_PixelTransferi", + "__glXDispSwap_PixelZoom", + "__glXDispSwap_PointSize", + "__glXDispSwap_PolygonMode", + "__glXDispSwap_PolygonOffset", + "__glXDispSwap_PolygonStipple", + "__glXDispSwap_PopAttrib", + "__glXDispSwap_PopMatrix", + "__glXDispSwap_PopName", + "__glXDispSwap_PrioritizeTextures", + "__glXDispSwap_PushAttrib", + "__glXDispSwap_PushMatrix", + "__glXDispSwap_PushName", + "__glXDispSwap_RasterPos2dv", + "__glXDispSwap_RasterPos2fv", + "__glXDispSwap_RasterPos2iv", + "__glXDispSwap_RasterPos2sv", + "__glXDispSwap_RasterPos3dv", + "__glXDispSwap_RasterPos3fv", + "__glXDispSwap_RasterPos3iv", + "__glXDispSwap_RasterPos3sv", + "__glXDispSwap_RasterPos4dv", + "__glXDispSwap_RasterPos4fv", + "__glXDispSwap_RasterPos4iv", + "__glXDispSwap_RasterPos4sv", + "__glXDispSwap_ReadBuffer", + "__glXDispSwap_ReadPixels", + "__glXDispSwap_Rectdv", + "__glXDispSwap_Rectfv", + "__glXDispSwap_Rectiv", + "__glXDispSwap_Rectsv", + "__glXDispSwap_RenderMode", + "__glXDispSwap_ResetHistogram", + "__glXDispSwap_ResetMinmax", + "__glXDispSwap_Rotated", + "__glXDispSwap_Rotatef", + "__glXDispSwap_Scaled", + "__glXDispSwap_Scalef", + "__glXDispSwap_Scissor", + "__glXDispSwap_SelectBuffer", + "__glXDispSwap_SeparableFilter2D", + "__glXDispSwap_ShadeModel", + "__glXDispSwap_StencilFunc", + "__glXDispSwap_StencilMask", + "__glXDispSwap_StencilOp", + "__glXDispSwap_TexCoord1dv", + "__glXDispSwap_TexCoord1fv", + "__glXDispSwap_TexCoord1iv", + "__glXDispSwap_TexCoord1sv", + "__glXDispSwap_TexCoord2dv", + "__glXDispSwap_TexCoord2fv", + "__glXDispSwap_TexCoord2iv", + "__glXDispSwap_TexCoord2sv", + "__glXDispSwap_TexCoord3dv", + "__glXDispSwap_TexCoord3fv", + "__glXDispSwap_TexCoord3iv", + "__glXDispSwap_TexCoord3sv", + "__glXDispSwap_TexCoord4dv", + "__glXDispSwap_TexCoord4fv", + "__glXDispSwap_TexCoord4iv", + "__glXDispSwap_TexCoord4sv", + "__glXDispSwap_TexEnvf", + "__glXDispSwap_TexEnvfv", + "__glXDispSwap_TexEnvi", + "__glXDispSwap_TexEnviv", + "__glXDispSwap_TexGend", + "__glXDispSwap_TexGendv", + "__glXDispSwap_TexGenf", + "__glXDispSwap_TexGenfv", + "__glXDispSwap_TexGeni", + "__glXDispSwap_TexGeniv", + "__glXDispSwap_TexImage1D", + "__glXDispSwap_TexImage2D", + "__glXDispSwap_TexImage3D", + "__glXDispSwap_TexParameterf", + "__glXDispSwap_TexParameterfv", + "__glXDispSwap_TexParameteri", + "__glXDispSwap_TexParameteriv", + "__glXDispSwap_TexSubImage1D", + "__glXDispSwap_TexSubImage2D", + "__glXDispSwap_TexSubImage3D", + "__glXDispSwap_Translated", + "__glXDispSwap_Translatef", + "__glXDispSwap_Vertex2dv", + "__glXDispSwap_Vertex2fv", + "__glXDispSwap_Vertex2iv", + "__glXDispSwap_Vertex2sv", + "__glXDispSwap_Vertex3dv", + "__glXDispSwap_Vertex3fv", + "__glXDispSwap_Vertex3iv", + "__glXDispSwap_Vertex3sv", + "__glXDispSwap_Vertex4dv", + "__glXDispSwap_Vertex4fv", + "__glXDispSwap_Vertex4iv", + "__glXDispSwap_Vertex4sv", + "__glXDispSwap_Viewport", + "__glXDisp_Accum", + "__glXDisp_ActiveTextureARB", + "__glXDisp_AlphaFunc", + "__glXDisp_AreTexturesResident", + "__glXDisp_AreTexturesResidentEXT", + "__glXDisp_Begin", + "__glXDisp_BindTexture", + "__glXDisp_Bitmap", + "__glXDisp_BlendColor", + "__glXDisp_BlendEquation", + "__glXDisp_BlendFunc", + "__glXDisp_CallList", + "__glXDisp_CallLists", + "__glXDisp_Clear", + "__glXDisp_ClearAccum", + "__glXDisp_ClearColor", + "__glXDisp_ClearDepth", + "__glXDisp_ClearIndex", + "__glXDisp_ClearStencil", + "__glXDisp_ClipPlane", + "__glXDisp_Color3bv", + "__glXDisp_Color3dv", + "__glXDisp_Color3fv", + "__glXDisp_Color3iv", + "__glXDisp_Color3sv", + "__glXDisp_Color3ubv", + "__glXDisp_Color3uiv", + "__glXDisp_Color3usv", + "__glXDisp_Color4bv", + "__glXDisp_Color4dv", + "__glXDisp_Color4fv", + "__glXDisp_Color4iv", + "__glXDisp_Color4sv", + "__glXDisp_Color4ubv", + "__glXDisp_Color4uiv", + "__glXDisp_Color4usv", + "__glXDisp_ColorMask", + "__glXDisp_ColorMaterial", + "__glXDisp_ColorSubTable", + "__glXDisp_ColorTable", + "__glXDisp_ColorTableParameterfv", + "__glXDisp_ColorTableParameteriv", + "__glXDisp_ConvolutionFilter1D", + "__glXDisp_ConvolutionFilter2D", + "__glXDisp_ConvolutionParameterf", + "__glXDisp_ConvolutionParameterfv", + "__glXDisp_ConvolutionParameteri", + "__glXDisp_ConvolutionParameteriv", + "__glXDisp_CopyColorSubTable", + "__glXDisp_CopyColorTable", + "__glXDisp_CopyConvolutionFilter1D", + "__glXDisp_CopyConvolutionFilter2D", + "__glXDisp_CopyPixels", + "__glXDisp_CopyTexImage1D", + "__glXDisp_CopyTexImage2D", + "__glXDisp_CopyTexSubImage1D", + "__glXDisp_CopyTexSubImage2D", + "__glXDisp_CopyTexSubImage3D", + "__glXDisp_CullFace", + "__glXDisp_DeleteLists", + "__glXDisp_DeleteTextures", + "__glXDisp_DeleteTexturesEXT", + "__glXDisp_DepthFunc", + "__glXDisp_DepthMask", + "__glXDisp_DepthRange", + "__glXDisp_Disable", + "__glXDisp_DrawArrays", + "__glXDisp_DrawArraysEXT", + "__glXDisp_DrawBuffer", + "__glXDisp_DrawPixels", + "__glXDisp_EdgeFlagv", + "__glXDisp_Enable", + "__glXDisp_End", + "__glXDisp_EndList", + "__glXDisp_EvalCoord1dv", + "__glXDisp_EvalCoord1fv", + "__glXDisp_EvalCoord2dv", + "__glXDisp_EvalCoord2fv", + "__glXDisp_EvalMesh1", + "__glXDisp_EvalMesh2", + "__glXDisp_EvalPoint1", + "__glXDisp_EvalPoint2", + "__glXDisp_FeedbackBuffer", + "__glXDisp_Finish", + "__glXDisp_Flush", + "__glXDisp_Fogf", + "__glXDisp_Fogfv", + "__glXDisp_Fogi", + "__glXDisp_Fogiv", + "__glXDisp_FrontFace", + "__glXDisp_Frustum", + "__glXDisp_GenLists", + "__glXDisp_GenTextures", + "__glXDisp_GenTexturesEXT", + "__glXDisp_GetBooleanv", + "__glXDisp_GetClipPlane", + "__glXDisp_GetColorTable", + "__glXDisp_GetColorTableParameterfv", + "__glXDisp_GetColorTableParameteriv", + "__glXDisp_GetConvolutionFilter", + "__glXDisp_GetConvolutionParameterfv", + "__glXDisp_GetConvolutionParameteriv", + "__glXDisp_GetDoublev", + "__glXDisp_GetError", + "__glXDisp_GetFloatv", + "__glXDisp_GetHistogram", + "__glXDisp_GetHistogramParameterfv", + "__glXDisp_GetHistogramParameteriv", + "__glXDisp_GetIntegerv", + "__glXDisp_GetLightfv", + "__glXDisp_GetLightiv", + "__glXDisp_GetMapdv", + "__glXDisp_GetMapfv", + "__glXDisp_GetMapiv", + "__glXDisp_GetMaterialfv", + "__glXDisp_GetMaterialiv", + "__glXDisp_GetMinmax", + "__glXDisp_GetMinmaxParameterfv", + "__glXDisp_GetMinmaxParameteriv", + "__glXDisp_GetPixelMapfv", + "__glXDisp_GetPixelMapuiv", + "__glXDisp_GetPixelMapusv", + "__glXDisp_GetPolygonStipple", + "__glXDisp_GetSeparableFilter", + "__glXDisp_GetString", + "__glXDisp_GetTexEnvfv", + "__glXDisp_GetTexEnviv", + "__glXDisp_GetTexGendv", + "__glXDisp_GetTexGenfv", + "__glXDisp_GetTexGeniv", + "__glXDisp_GetTexImage", + "__glXDisp_GetTexLevelParameterfv", + "__glXDisp_GetTexLevelParameteriv", + "__glXDisp_GetTexParameterfv", + "__glXDisp_GetTexParameteriv", + "__glXDisp_Hint", + "__glXDisp_Histogram", + "__glXDisp_IndexMask", + "__glXDisp_Indexdv", + "__glXDisp_Indexfv", + "__glXDisp_Indexiv", + "__glXDisp_Indexsv", + "__glXDisp_Indexubv", + "__glXDisp_InitNames", + "__glXDisp_IsEnabled", + "__glXDisp_IsList", + "__glXDisp_IsTexture", + "__glXDisp_IsTextureEXT", + "__glXDisp_LightModelf", + "__glXDisp_LightModelfv", + "__glXDisp_LightModeli", + "__glXDisp_LightModeliv", + "__glXDisp_Lightf", + "__glXDisp_Lightfv", + "__glXDisp_Lighti", + "__glXDisp_Lightiv", + "__glXDisp_LineStipple", + "__glXDisp_LineWidth", + "__glXDisp_ListBase", + "__glXDisp_LoadIdentity", + "__glXDisp_LoadMatrixd", + "__glXDisp_LoadMatrixf", + "__glXDisp_LoadName", + "__glXDisp_LogicOp", + "__glXDisp_Map1d", + "__glXDisp_Map1f", + "__glXDisp_Map2d", + "__glXDisp_Map2f", + "__glXDisp_MapGrid1d", + "__glXDisp_MapGrid1f", + "__glXDisp_MapGrid2d", + "__glXDisp_MapGrid2f", + "__glXDisp_Materialf", + "__glXDisp_Materialfv", + "__glXDisp_Materiali", + "__glXDisp_Materialiv", + "__glXDisp_MatrixMode", + "__glXDisp_Minmax", + "__glXDisp_MultMatrixd", + "__glXDisp_MultMatrixf", + "__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", + "__glXDisp_NewList", + "__glXDisp_Normal3bv", + "__glXDisp_Normal3dv", + "__glXDisp_Normal3fv", + "__glXDisp_Normal3iv", + "__glXDisp_Normal3sv", + "__glXDisp_Ortho", + "__glXDisp_PassThrough", + "__glXDisp_PixelMapfv", + "__glXDisp_PixelMapuiv", + "__glXDisp_PixelMapusv", + "__glXDisp_PixelStoref", + "__glXDisp_PixelStorei", + "__glXDisp_PixelTransferf", + "__glXDisp_PixelTransferi", + "__glXDisp_PixelZoom", + "__glXDisp_PointSize", + "__glXDisp_PolygonMode", + "__glXDisp_PolygonOffset", + "__glXDisp_PolygonStipple", + "__glXDisp_PopAttrib", + "__glXDisp_PopMatrix", + "__glXDisp_PopName", + "__glXDisp_PrioritizeTextures", + "__glXDisp_PushAttrib", + "__glXDisp_PushMatrix", + "__glXDisp_PushName", + "__glXDisp_RasterPos2dv", + "__glXDisp_RasterPos2fv", + "__glXDisp_RasterPos2iv", + "__glXDisp_RasterPos2sv", + "__glXDisp_RasterPos3dv", + "__glXDisp_RasterPos3fv", + "__glXDisp_RasterPos3iv", + "__glXDisp_RasterPos3sv", + "__glXDisp_RasterPos4dv", + "__glXDisp_RasterPos4fv", + "__glXDisp_RasterPos4iv", + "__glXDisp_RasterPos4sv", + "__glXDisp_ReadBuffer", + "__glXDisp_ReadPixels", + "__glXDisp_Rectdv", + "__glXDisp_Rectfv", + "__glXDisp_Rectiv", + "__glXDisp_Rectsv", + "__glXDisp_RenderMode", + "__glXDisp_ResetHistogram", + "__glXDisp_ResetMinmax", + "__glXDisp_Rotated", + "__glXDisp_Rotatef", + "__glXDisp_Scaled", + "__glXDisp_Scalef", + "__glXDisp_Scissor", + "__glXDisp_SelectBuffer", + "__glXDisp_SeparableFilter2D", + "__glXDisp_ShadeModel", + "__glXDisp_StencilFunc", + "__glXDisp_StencilMask", + "__glXDisp_StencilOp", + "__glXDisp_TexCoord1dv", + "__glXDisp_TexCoord1fv", + "__glXDisp_TexCoord1iv", + "__glXDisp_TexCoord1sv", + "__glXDisp_TexCoord2dv", + "__glXDisp_TexCoord2fv", + "__glXDisp_TexCoord2iv", + "__glXDisp_TexCoord2sv", + "__glXDisp_TexCoord3dv", + "__glXDisp_TexCoord3fv", + "__glXDisp_TexCoord3iv", + "__glXDisp_TexCoord3sv", + "__glXDisp_TexCoord4dv", + "__glXDisp_TexCoord4fv", + "__glXDisp_TexCoord4iv", + "__glXDisp_TexCoord4sv", + "__glXDisp_TexEnvf", + "__glXDisp_TexEnvfv", + "__glXDisp_TexEnvi", + "__glXDisp_TexEnviv", + "__glXDisp_TexGend", + "__glXDisp_TexGendv", + "__glXDisp_TexGenf", + "__glXDisp_TexGenfv", + "__glXDisp_TexGeni", + "__glXDisp_TexGeniv", + "__glXDisp_TexImage1D", + "__glXDisp_TexImage2D", + "__glXDisp_TexImage3D", + "__glXDisp_TexParameterf", + "__glXDisp_TexParameterfv", + "__glXDisp_TexParameteri", + "__glXDisp_TexParameteriv", + "__glXDisp_TexSubImage1D", + "__glXDisp_TexSubImage2D", + "__glXDisp_TexSubImage3D", + "__glXDisp_Translated", + "__glXDisp_Translatef", + "__glXDisp_Vertex2dv", + "__glXDisp_Vertex2fv", + "__glXDisp_Vertex2iv", + "__glXDisp_Vertex2sv", + "__glXDisp_Vertex3dv", + "__glXDisp_Vertex3fv", + "__glXDisp_Vertex3iv", + "__glXDisp_Vertex3sv", + "__glXDisp_Vertex4dv", + "__glXDisp_Vertex4fv", + "__glXDisp_Vertex4iv", + "__glXDisp_Vertex4sv", + "__glXDisp_Viewport", + "__glXDrawArraysSize", + "__glXDrawPixelsReqSize", + "__glXDrawableRes", + "__glXErrorOccured", + "__glXFBInitDrawable", + "__glXFBMemSwapBuffers", + "__glXFindDrawablePrivate", + "__glXFogfvReqSize", + "__glXFogivReqSize", + "__glXForceCurrent", + "__glXFormatGLModes", + "__glXFree", + "__glXFreeBuffers", + "__glXFreeContext", + "__glXGetDrawablePrivate", + "__glXGetVisualConfigs", + "__glXImageSize", + "__glXImpAtoi", + "__glXImpCalloc", + "__glXImpFatal", + "__glXImpFclose", + "__glXImpFopen", + "__glXImpFprintf", + "__glXImpFree", + "__glXImpGetDrawablePrivate", + "__glXImpGetenv", + "__glXImpMalloc", + "__glXImpRealloc", + "__glXImpSprintf", + "__glXImpWarning", + "__glXInitFB", + "__glXInitMem", + "__glXInitPix", + "__glXIsDirect", + "__glXLastContext", + "__glXLightModelfvReqSize", + "__glXLightModelivReqSize", + "__glXLightfvReqSize", + "__glXLightivReqSize", + "__glXLookupContextByTag", + "__glXMakeCurrent", + "__glXMalloc", + "__glXMap1dReqSize", + "__glXMap1fReqSize", + "__glXMap2dReqSize", + "__glXMap2fReqSize", + "__glXMaterialfvReqSize", + "__glXMaterialivReqSize", + "__glXNoSuchRenderOpcode", + "__glXNoSuchSingleOpcode", + "__glXNop", + "__glXPixInitDrawable", + "__glXPixelMapfvReqSize", + "__glXPixelMapuivReqSize", + "__glXPixelMapusvReqSize", + "__glXPixmapRes", + "__glXPrioritizeTexturesReqSize", + "__glXQueryContextInfoEXT", + "__glXQueryExtensionsString", + "__glXQueryServerString", + "__glXQueryVersion", + "__glXRealloc", + "__glXRender", + "__glXRenderLarge", + "__glXRenderSizeTable", + "__glXRenderSizeTable_EXT", + "__glXRenderTable", + "__glXRenderTable_EXT", + "__glXReply", + "__glXResetLargeCommandStatus", + "__glXResizeBuffers", + "__glXResizeDrawableBuffers", + "__glXScreenInit", + "__glXScreenReset", + "__glXSeparableFilter2DReqSize", + "__glXSingleTable", + "__glXSwapBuffers", + "__glXSwapClientInfo", + "__glXSwapCopyContext", + "__glXSwapCreateContext", + "__glXSwapCreateGLXPixmap", + "__glXSwapDestroyContext", + "__glXSwapDestroyGLXPixmap", + "__glXSwapGetVisualConfigs", + "__glXSwapIsDirect", + "__glXSwapIsDirectReply", + "__glXSwapMakeCurrent", + "__glXSwapMakeCurrentReply", + "__glXSwapQueryContextInfoEXTReply", + "__glXSwapQueryExtensionsString", + "__glXSwapQueryServerString", + "__glXSwapQueryVersion", + "__glXSwapQueryVersionReply", + "__glXSwapRender", + "__glXSwapRenderLarge", + "__glXSwapRenderTable", + "__glXSwapRenderTable_EXT", + "__glXSwapSingleTable", + "__glXSwapSwapBuffers", + "__glXSwapUseXFont", + "__glXSwapVendorPrivTable_EXT", + "__glXSwapVendorPrivate", + "__glXSwapVendorPrivateWithReply", + "__glXSwapWaitGL", + "__glXSwapWaitX", + "__glXTexEnvfvReqSize", + "__glXTexEnvivReqSize", + "__glXTexGendvReqSize", + "__glXTexGenfvReqSize", + "__glXTexGenivReqSize", + "__glXTexImage1DReqSize", + "__glXTexImage2DReqSize", + "__glXTexImage3DReqSize", + "__glXTexParameterfvReqSize", + "__glXTexParameterivReqSize", + "__glXTexSubImage1DReqSize", + "__glXTexSubImage2DReqSize", + "__glXTexSubImage3DReqSize", + "__glXTypeSize", + "__glXUnrefDrawablePrivate", + "__glXUnsupportedPrivateRequest", + "__glXUseXFont", + "__glXVendorPrivTable_EXT", + "__glXVendorPrivate", + "__glXVendorPrivateWithReply", + "__glXWaitGL", + "__glXWaitX", + "__glXcombine_strings", + "glAccum", + "glActiveTextureARB", + "glAlphaFunc", + "glAreTexturesResident", + "glAreTexturesResidentEXT", + "glBegin", + "glBindTexture", + "glBitmap", + "glBlendColor", + "glBlendEquation", + "glBlendFunc", + "glCallList", + "glCallLists", + "glClear", + "glClearAccum", + "glClearColor", + "glClearDepth", + "glClearIndex", + "glClearStencil", + "glClipPlane", + "glColor3bv", + "glColor3dv", + "glColor3fv", + "glColor3iv", + "glColor3sv", + "glColor3ubv", + "glColor3uiv", + "glColor3usv", + "glColor4bv", + "glColor4dv", + "glColor4fv", + "glColor4iv", + "glColor4sv", + "glColor4ubv", + "glColor4uiv", + "glColor4usv", + "glColorMask", + "glColorMaterial", + "glColorPointer", + "glColorSubTable", + "glColorTable", + "glColorTableParameterfv", + "glColorTableParameteriv", + "glConvolutionFilter1D", + "glConvolutionFilter2D", + "glConvolutionParameterf", + "glConvolutionParameterfv", + "glConvolutionParameteri", + "glConvolutionParameteriv", + "glCopyColorSubTable", + "glCopyColorTable", + "glCopyConvolutionFilter1D", + "glCopyConvolutionFilter2D", + "glCopyPixels", + "glCopyTexImage1D", + "glCopyTexImage2D", + "glCopyTexSubImage1D", + "glCopyTexSubImage2D", + "glCopyTexSubImage3D", + "glCullFace", + "glDeleteLists", + "glDeleteTextures", + "glDeleteTexturesEXT", + "glDepthFunc", + "glDepthMask", + "glDepthRange", + "glDisable", + "glDisableClientState", + "glDrawArrays", + "glDrawBuffer", + "glDrawPixels", + "glEdgeFlagPointer", + "glEdgeFlagv", + "glEnable", + "glEnableClientState", + "glEnd", + "glEndList", + "glEvalCoord1dv", + "glEvalCoord1fv", + "glEvalCoord2dv", + "glEvalCoord2fv", + "glEvalMesh1", + "glEvalMesh2", + "glEvalPoint1", + "glEvalPoint2", + "glFeedbackBuffer", + "glFinish", + "glFlush", + "glFogf", + "glFogfv", + "glFogi", + "glFogiv", + "glFrontFace", + "glFrustum", + "glGenLists", + "glGenTextures", + "glGenTexturesEXT", + "glGetBooleanv", + "glGetClipPlane", + "glGetColorTable", + "glGetColorTableParameterfv", + "glGetColorTableParameteriv", + "glGetConvolutionFilter", + "glGetConvolutionParameterfv", + "glGetConvolutionParameteriv", + "glGetDoublev", + "glGetError", + "glGetFloatv", + "glGetHistogram", + "glGetHistogramParameterfv", + "glGetHistogramParameteriv", + "glGetIntegerv", + "glGetLightfv", + "glGetLightiv", + "glGetMapdv", + "glGetMapfv", + "glGetMapiv", + "glGetMaterialfv", + "glGetMaterialiv", + "glGetMinmax", + "glGetMinmaxParameterfv", + "glGetMinmaxParameteriv", + "glGetPixelMapfv", + "glGetPixelMapuiv", + "glGetPixelMapusv", + "glGetPolygonStipple", + "glGetSeparableFilter", + "glGetString", + "glGetTexEnvfv", + "glGetTexEnviv", + "glGetTexGendv", + "glGetTexGenfv", + "glGetTexGeniv", + "glGetTexImage", + "glGetTexLevelParameterfv", + "glGetTexLevelParameteriv", + "glGetTexParameterfv", + "glGetTexParameteriv", + "glHint", + "glHistogram", + "glIndexMask", + "glIndexPointer", + "glIndexdv", + "glIndexfv", + "glIndexiv", + "glIndexsv", + "glIndexubv", + "glInitNames", + "glIsEnabled", + "glIsList", + "glIsTexture", + "glIsTextureEXT", + "glLightModelf", + "glLightModelfv", + "glLightModeli", + "glLightModeliv", + "glLightf", + "glLightfv", + "glLighti", + "glLightiv", + "glLineStipple", + "glLineWidth", + "glListBase", + "glLoadIdentity", + "glLoadMatrixd", + "glLoadMatrixf", + "glLoadName", + "glLogicOp", + "glMap1d", + "glMap1f", + "glMap2d", + "glMap2f", + "glMapGrid1d", + "glMapGrid1f", + "glMapGrid2d", + "glMapGrid2f", + "glMaterialf", + "glMaterialfv", + "glMateriali", + "glMaterialiv", + "glMatrixMode", + "glMinmax", + "glMultMatrixd", + "glMultMatrixf", + "glMultiTexCoord1dvARB", + "glMultiTexCoord1fvARB", + "glMultiTexCoord1ivARB", + "glMultiTexCoord1svARB", + "glMultiTexCoord2dvARB", + "glMultiTexCoord2fvARB", + "glMultiTexCoord2ivARB", + "glMultiTexCoord2svARB", + "glMultiTexCoord3dvARB", + "glMultiTexCoord3fvARB", + "glMultiTexCoord3ivARB", + "glMultiTexCoord3svARB", + "glMultiTexCoord4dvARB", + "glMultiTexCoord4fvARB", + "glMultiTexCoord4ivARB", + "glMultiTexCoord4svARB", + "glNewList", + "glNormal3bv", + "glNormal3dv", + "glNormal3fv", + "glNormal3iv", + "glNormal3sv", + "glNormalPointer", + "glOrtho", + "glPassThrough", + "glPixelMapfv", + "glPixelMapuiv", + "glPixelMapusv", + "glPixelStoref", + "glPixelStorei", + "glPixelTransferf", + "glPixelTransferi", + "glPixelZoom", + "glPointSize", + "glPolygonMode", + "glPolygonOffset", + "glPolygonStipple", + "glPopAttrib", + "glPopMatrix", + "glPopName", + "glPrioritizeTextures", + "glPushAttrib", + "glPushMatrix", + "glPushName", + "glRasterPos2dv", + "glRasterPos2fv", + "glRasterPos2iv", + "glRasterPos2sv", + "glRasterPos3dv", + "glRasterPos3fv", + "glRasterPos3iv", + "glRasterPos3sv", + "glRasterPos4dv", + "glRasterPos4fv", + "glRasterPos4iv", + "glRasterPos4sv", + "glReadBuffer", + "glReadPixels", + "glRectdv", + "glRectfv", + "glRectiv", + "glRectsv", + "glRenderMode", + "glResetHistogram", + "glResetMinmax", + "glRotated", + "glRotatef", + "glScaled", + "glScalef", + "glScissor", + "glSelectBuffer", + "glSeparableFilter2D", + "glShadeModel", + "glStencilFunc", + "glStencilMask", + "glStencilOp", + "glTexCoord1dv", + "glTexCoord1fv", + "glTexCoord1iv", + "glTexCoord1sv", + "glTexCoord2dv", + "glTexCoord2fv", + "glTexCoord2iv", + "glTexCoord2sv", + "glTexCoord3dv", + "glTexCoord3fv", + "glTexCoord3iv", + "glTexCoord3sv", + "glTexCoord4dv", + "glTexCoord4fv", + "glTexCoord4iv", + "glTexCoord4sv", + "glTexCoordPointer", + "glTexEnvf", + "glTexEnvfv", + "glTexEnvi", + "glTexEnviv", + "glTexGend", + "glTexGendv", + "glTexGenf", + "glTexGenfv", + "glTexGeni", + "glTexGeniv", + "glTexImage1D", + "glTexImage2D", + "glTexImage3D", + "glTexParameterf", + "glTexParameterfv", + "glTexParameteri", + "glTexParameteriv", + "glTexSubImage1D", + "glTexSubImage2D", + "glTexSubImage3D", + "glTranslated", + "glTranslatef", + "glVertex2dv", + "glVertex2fv", + "glVertex2iv", + "glVertex2sv", + "glVertex3dv", + "glVertex3fv", + "glVertex3iv", + "glVertex3sv", + "glVertex4dv", + "glVertex4fv", + "glVertex4iv", + "glVertex4sv", + "glVertexPointer", + "glViewport", + "glxSwapQueryExtensionsStringReply", + "glxSwapQueryServerStringReply", + NULL +}; static XF86ModuleVersionInfo VersRec = { @@ -88,18 +1236,18 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) GLcore = LoadSubModule(module, GLcoreName, NULL, NULL, NULL, NULL, errmaj, errmin); if (!GLcore) { - ErrorF("Cannot load the GL core library: %s\n", GLcoreName); + if (errmaj) *errmaj = LDR_NOSUBENT; } else { + LoaderReqSymLists(glcoreSymbols, NULL); LoadExtension(&GLXExt, FALSE); - /* Wrap the init visuals routine in micmap.c */ GlxWrapInitVisuals(&miInitVisualsProc); /* Make sure this gets wrapped each time InitVisualWrap is called */ miHookInitVisuals(NULL, GlxWrapInitVisuals); } + } else { + if (errmaj) *errmaj = LDR_ONCEONLY; } - - if (errmaj) *errmaj = LDR_ONCEONLY; /* Need a non-NULL return value to indicate success */ return GLcore; } diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile index 461d4cc69..e7681f224 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.229 2001/05/18 17:48:30 torrey Exp $ +XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.243 2001/08/03 23:43:37 alanh Exp $ #ifndef InstallXserverSetUID #define InstallXserverSetUID NO @@ -189,20 +189,25 @@ XPFBLIBS = dix/LibraryTargetName(xpstubs) RENDERDIR = render RENDERLIB = $(RENDERDIR)/librender.a #endif +#if BuildRandR + RANDRDIR = randr + RANDRLIB = $(RANDRDIR)/librandr.a +#endif #if DoLoadableServer - EXTENSIONS = $(OTHEREXTS) $(RENDERLIB) + EXTENSIONS = $(OTHEREXTS) $(RENDERLIB) $(RANDRLIB) LOADABLEEXTS = $(PEXLIBS) $(XIEEXT) $(MISCEXT) $(DBEEXT) $(RECORDEXT) \ $(GLXEXT) MISCEXT = Xext/LibraryTargetName(ext) OTHEREXTS = Xext/LibraryTargetName(exts) $(XKBEXT) $(XINPUTEXT) \ $(LBXEXT) $(SITEEXTS) #else - EXTENSIONS = $(OTHEREXTS) $(PEXLIBS) $(GLXEXT) $(RENDERLIB) + EXTENSIONS = $(OTHEREXTS) $(PEXLIBS) $(GLXEXT) $(RENDERLIB) $(RANDRLIB) OTHEREXTS = Xext/LibraryTargetName(ext) $(XKBEXT) $(XINPUTEXT) \ $(XIEEXT) $(LBXEXT) $(DBEEXT) $(RECORDEXT) $(SITEEXTS) #endif EXTDIRS = Xext $(XKBDIR) $(XIDIR) $(XIEDIR) $(PEXDIR) $(GLXDIR) \ - $(LBXDIRS) $(DBEDIR) $(RECORDDIR) $(SITEEXTDIRS) $(RENDERDIR) + $(LBXDIRS) $(DBEDIR) $(RECORDDIR) $(SITEEXTDIRS) \ + $(RENDERDIR) $(RANDRDIR) XAULIB = $(XAUTHSRC)/LibraryTargetName(Xau) XDMCPLIB = $(XDMCPLIBSRC)/LibraryTargetName(Xdmcp) #if BuildLBX || GzipFontCompression @@ -227,6 +232,7 @@ XPFBLIBS = dix/LibraryTargetName(xpstubs) CFB32 = cfb/ModuleLibraryTargetName(cfb) \ cfb32/ModuleLibraryTargetName(cfb32) SHADOW = miext/shadow/ModuleLibraryTargetName(shadow) + LAYER = miext/layer/ModuleLibraryTargetName(layer) #else MFB = mfb/LibraryTargetName(mfb) FB = fb/LibraryTargetName(fb) @@ -244,6 +250,7 @@ XPFBLIBS = dix/LibraryTargetName(xpstubs) CFB32 = cfb/LibraryTargetName(cfb) \ cfb32/LibraryTargetName(cfb32) SHADOW = miext/shadow/LibraryTargetName(shadow) + LAYER = miext/layer/LibraryTargetName(layer) #endif #if BuildLowMem LMFCFB = lmfcfb/LibraryTargetName(cfb) @@ -303,13 +310,6 @@ XCOMM * If a server does not need all of the above components, simply * omit the relevant lines from the build block. * - * Additional ddx directories can be split across three variables: - * DDXDIR1, DDXDIR2, and DDXDIR3. Most servers only use DDXDIR1, - * but if two servers can be built on a platform then DDXDIR1 is - * typically set to the ddx directories that are shared by both - * servers, DDXDIR2 is the directories unique to one of the servers, - * and DDXDIR3 is the directories unique to the other server. - * * If these guidelines are followed, a make at the top of the server * tree should result in each subdirectory being built only once, * even if multiple servers that share subdirectories are being built. @@ -325,11 +325,11 @@ XCOMM Digital MIPS based WS server (ultrix 4.2 and beyond) XCOMM MFBDIR = mfb CFB8DIR = cfb -DDXDIR1 = hw/dec/ws +DECWSDDXDIR = hw/dec/ws #if BuildLowMem -DECDIRS = $(STDDIRS) $(LMFCFBDIR) $(DDXDIR1) $(DEPDIRS) +DECDIRS = $(STDDIRS) $(LMFCFBDIR) $(DECWSDDXDIR) $(DEPDIRS) #else -DECDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) +DECDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DECWSDDXDIR) $(DEPDIRS) #endif DECOBJS = hw/dec/ws/init.o hw/dec/ws/sdepthinit.o #if BuildLowMem @@ -355,10 +355,10 @@ CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 -DDXDIR1 = hw/dec/ws +DECWSDDXDIR = hw/dec/ws DECDIRS1 = $(STDDIRS) $(MFBDIR) \ $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ - $(DDXDIR1) $(DEPDIRS) + $(DECWSDDXDIR) $(DEPDIRS) DECOBJS1 = hw/dec/ws/init.o hw/dec/ws/mdepthinit.o DECLIBS1 = hw/dec/ws/LibraryTargetName(dec) CFBLibs ServerTarget(Xdec_md,$(DECDIRS1),$(DECOBJS1), \ @@ -375,22 +375,24 @@ XCOMM Sun server XCOMM MFBDIR = mfb CFB8DIR = cfb -DDXDIR1 = hw/sun -#ifndef AmoebaArchitecture -SUNOBJS = hw/sun/sunInit.o +SUNDDXDIR = hw/sun +#if DoLoadableServer +SUNOBJS = hw/sun/sunInit.o hw/sun/sunInitExt.o hw/sun/stubs.o +#elif XF86Server +SUNOBJS = hw/sun/sunInit.o hw/sun/stubs.o #else -SUNOBJS = hw/sun/sunInitColor.o +SUNOBJS = hw/sun/sunInit.o #endif #if BuildLowMem -SUNDIRS = $(STDDIRS) $(LMFCFBDIR) $(DDXDIR1) $(DEPDIRS) +SUNDIRS = $(STDDIRS) $(LMFCFBDIR) $(SUNDDXDIR) $(DEPDIRS) SUNLIBS = hw/sun/LibraryTargetName(sun) LMFCFBLibs #else -SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) +SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(SUNDDXDIR) $(DEPDIRS) SUNLIBS = hw/sun/LibraryTargetName(sun) CFB8Libs #endif SUNSYSLIBS = $(FONTLIBS) $(WIDECHARSYSLIB) $(SYSLIBS) SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \ - $(SUNLIBS),$(SUNSYSLIBS)) + $(SUNLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(SUNSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun #endif @@ -406,14 +408,20 @@ CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 -DDXDIR1 = hw/sun +SUNDDXDIR = hw/sun SUN24DIRS = $(STDDIRS) $(MFBDIR) \ $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ - $(DDXDIR1) $(DEPDIRS) + $(SUNDDXDIR) $(DEPDIRS) +#if DoLoadableServer +SUN24OBJS = hw/sun/sunInitMulti.o hw/sun/sunInitExt.o hw/sun/stubs.o +#elif XF86Server +SUN24OBJS = hw/sun/sunInitMulti.o hw/sun/stubs.o +#else SUN24OBJS = hw/sun/sunInitMulti.o +#endif SUN24LIBS = hw/sun/LibraryTargetName(sun) CFBLibs SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS), \ - $(SUN24LIBS),$(FONTLIBS) $(SYSLIBS)) + $(SUN24LIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun24 #endif @@ -425,61 +433,30 @@ XCOMM XCOMM Sun monochrome server XCOMM MFBDIR = mfb -DDXDIR1 = hw/sun -SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) +SUNDDXDIR = hw/sun +SUNMDIRS = $(STDDIRS) $(MFBDIR) $(SUNDDXDIR) $(DEPDIRS) +#if XF86Server +SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o hw/sun/stubs.o +#else SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o +#endif SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBBareLibs $(EXTENSIONS) SetUIDServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \ - $(SUNMLIBS),$(FONTLIBS) $(SYSLIBS)) + $(SUNMLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XsunMono #endif #endif /* XsunMonoServer */ -#if XsunAmoebaServer -XCOMM -XCOMM Sun server for Amoeba -XCOMM -MFBDIR = mfb -CFB8DIR = cfb -DDXDIR1 = hw/sunAmoeba -SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) -SUNOBJS = hw/sunAmoeba/sunInitColor.o -SUNLIBS = hw/sunAmoeba/LibraryTargetName(sun) CFB8Libs -ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \ - $(SUNLIBS),$(FONTLIBS) $(SYSLIBS)) -#ifndef ServerToInstall -#define ServerToInstall Xsun -#endif -#endif /* XsunAmoebaServer */ - - -#if XsunAmoebaMonoServer -XCOMM -XCOMM Sun monochrome server for Amoeba -XCOMM -MFBDIR = mfb -DDXDIR1 = hw/sunAmoeba -SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) -SUNMOBJS = hw/sunAmoeba/sunInitMono.o hw/sunAmoeba/sunInExMono.o -SUNMLIBS = hw/sunAmoeba/LibraryTargetName(sun) MFBBareLibs $(OTHEREXTS) -ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \ - $(SUNMLIBS),$(FONTLIBS) $(SYSLIBS)) -#ifndef ServerToInstall -#define ServerToInstall XsunMono -#endif -#endif /* XsunAmoebaMonoServer */ - - #if XsunLynxServer XCOMM XCOMM Sun server for LynxOS microSPARC 2.4.0 XCOMM MFBDIR = mfb CFB8DIR = cfb -DDXDIR1 = hw/sunLynx -SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) +LYNXDDXDIR = hw/sunLynx +SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(LYNXDDXDIR) $(DEPDIRS) SUNOBJS = hw/sunLynx/sunLyInit.o SUNLIBS = hw/sunLynx/libsun.a CFB8Libs ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \ @@ -495,8 +472,8 @@ XCOMM XCOMM Sun monochrome server for LynxOS microSPARC 2.4.0 XCOMM MFBDIR = mfb -DDXDIR1 = hw/sunLynx -SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) +LYNXDDXDIR = hw/sunLynx +SUNMDIRS = $(STDDIRS) $(MFBDIR) $(LYNXDDXDIR) $(DEPDIRS) SUNMOBJS = hw/sunLynx/sunInitMono.o hw/sunLynx/sunInExMono.o SUNMLIBS = hw/sunLynx/libsun.a MFBBareLibs $(OTHEREXTS) ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \ @@ -514,13 +491,13 @@ XCOMM MFBDIR = mfb CFB8DIR = cfb CFB32DIR = cfb32 -DDXDIR1 = hw/hp +HPDDXDIR = hw/hp HPOBJS = hw/hp/hp.o #if BuildLowMem -HPSUBDIRS = $(STDDIRS) $(LMFCFBDIR) $(DDXDIR1) $(DEPDIRS) +HPSUBDIRS = $(STDDIRS) $(LMFCFBDIR) $(HPDDXDIR) $(DEPDIRS) HPLIBS = LMFCFBLibs #else -HPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) +HPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(HPDDXDIR) $(DEPDIRS) HPLIBS = CFB32Libs #endif HPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) @@ -569,13 +546,14 @@ CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 SHADOWDIR = miext/shadow +LAYERDIR = miext/layer #if XF86AFB AFBDIR = afb #endif -DDXDIR1 = hw/xfree86 +XFREE86DDXDIR = hw/xfree86 XF86SERVERSUBDIRS = $(STDDIRS) $(MFBDIR) $(FBDIR) $(AFBDIR) \ $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ - $(SHADOWDIR) $(DDXDIR1) $(DEPDIRS) + $(SHADOWDIR) $(LAYERDIR) $(XFREE86DDXDIR) $(DEPDIRS) XF86INIT = $(XF86COMSRC)/xf86Init.o $(XF86COMSRC)/xf86IniExt.o XF86COMLIB = $(XF86COMSRC)/LibraryTargetName(xf86) XF86PARSLIB= $(XF86PARSERSRC)/LibraryTargetName(xf86config) @@ -707,13 +685,14 @@ XCOMM PSEUDO8DIR = $(KDRIVE)/pseudo8 #endif SHADOWDIR = miext/shadow + LAYERDIR = miext/layer KD = $(KDRIVE)/LibraryTargetName(kdrive) KDFBDEV = $(KDRIVE)/fbdev/LibraryTargetName(fbdev) #define StdKdDirs $(KDRIVE) $(KDOSDIR) $(PSEUDO8DIR) fb $(DEPDIRS) #define StdKdSysLibs $(FONTLIBS) $(SYSLIBS) -#define KdLibs $(KD) $(KDOS) $(PSEUDO8) MiExtLibs $(RENDERLIB) +#define KdLibs $(KD) $(KDOS) $(PSEUDO8) MiExtLibs $(RENDERLIB) $(RANDRLIB) #if XfbdevServer XCOMM @@ -725,11 +704,9 @@ XCOMM KDDIRS = StdKdDirs - SHADOWDIR = miext/shadow - - FBDEVDIRS = $(STDDIRS) $(KDDIRS) $(FBDEVDIR) $(SHADOWDIR) + FBDEVDIRS = $(STDDIRS) $(KDDIRS) $(FBDEVDIR) $(SHADOWDIR) $(LAYERDIR) - FBDEVLIBS = PreFbLibs $(FBDEV) KdLibs FbPostFbLibs + FBDEVLIBS = PreFbLibs $(FBDEV) $(LAYER) KdLibs FbPostFbLibs FBDEVSYSLIBS = StdKdSysLibs #if HasParallelMake @@ -804,16 +781,15 @@ XCOMM FBDEV = $(FBDEVDIR)/LibraryTargetName(fbdev) VESADIR = $(KDRIVE)/vesa VESA = $(VESADIR)/LibraryTargetName(vesa) - SHADOWDIR = miext/shadow TRIDENTDIR = $(KDRIVE)/trident TRIDENT = $(TRIDENTDIR)/LibraryTargetName(trident) KDDIRS = StdKdDirs TRIDENTDIRS = $(STDDIRS) $(KDDIRS) \ - $(FBDEVDIR) $(VESADIR) $(SHADOWDIR) $(TRIDENTDIR) + $(FBDEVDIR) $(VESADIR) $(SHADOWDIR) $(LAYERDIR) $(TRIDENTDIR) - TRIDENTLIBS = PreFbLibs $(TRIDENT) $(FBDEV) $(VESA) KdLibs FbPostFbLibs + TRIDENTLIBS = PreFbLibs $(TRIDENT) $(FBDEV) $(VESA) $(LAYER) KdLibs FbPostFbLibs TRIDENTSYSLIBS = StdKdSysLibs #if HasParallelMake @@ -827,6 +803,35 @@ ServerTarget(Xtrident,$(TRIDENTDIRS),$(TRIDENTOBJS), \ $(TRIDENTLIBS),$(TRIDENTSYSLIBS)) #endif /* XTridentServer */ +#if Xmach64Server +XCOMM +XCOMM server with Keith's Mach64 driver (for Mobility 1 machines) +XCOMM + + VESADIR = $(KDRIVE)/vesa + VESA = $(VESADIR)/LibraryTargetName(vesa) + MACH64DIR = $(KDRIVE)/mach64 + MACH64 = $(MACH64DIR)/LibraryTargetName(mach64) + + KDDIRS = StdKdDirs + + MACH64DIRS = $(STDDIRS) $(KDDIRS) \ + $(VESADIR) $(SHADOWDIR) $(LAYERDIR) $(MACH64DIR) + + MACH64LIBS = PreFbLibs $(MACH64) $(VESA) $(LAYER) KdLibs FbPostFbLibs +MACH64SYSLIBS = StdKdSysLibs + +#if HasParallelMake +MakeMutex($(MACH64DIRS) $(MACH64LIBS) $(MACH64SYSLIBS)) +#endif +#if ForceServerRemake +$(MACH64OBJS) $(MACH64LIBS) $(MACH64SYSLIBS):: $(MACH64DIRS) + @if [ -f $@ ]; then touch $@; fi +#endif +ServerTarget(Xmach64,$(MACH64DIRS),$(MACH64OBJS), \ + $(MACH64LIBS),$(MACH64SYSLIBS)) +#endif /* Xmach64Server */ + #if Xi810Server XCOMM XCOMM server with Intel i810 driver @@ -836,7 +841,6 @@ XCOMM FBDEV = $(FBDEVDIR)/LibraryTargetName(fbdev) VESADIR = $(KDRIVE)/vesa VESA = $(VESADIR)/LibraryTargetName(vesa) - SHADOWDIR = miext/shadow I810DIR = $(KDRIVE)/i810 I810 = $(I810DIR)/LibraryTargetName(i810) @@ -911,6 +915,40 @@ ServerTarget(Xtrio,$(TRIODIRS),$(TRIOOBJS), \ $(TRIOLIBS),$(TRIOSYSLIBS)) #endif /* XTrioServer */ +#if XipaqServer +XCOMM +XCOMM server with Alan's HP VGA Out PCMCIA driver & fbdev +XCOMM + + FBDEVDIR = $(KDRIVE)/fbdev + FBDEV = $(FBDEVDIR)/LibraryTargetName(fbdev) + + PCMCIADIR = $(KDRIVE)/pcmcia + PCMCIA = $(PCMCIADIR)/LibraryTargetName(pcmcia) + + SHADOWDIR = miext/shadow + + IPAQDIR = $(KDRIVE)/ipaq + IPAQ = $(IPAQDIR)/LibraryTargetName(ipaq) + + KDDIRS = StdKdDirs + + IPAQDIRS = $(STDDIRS) $(KDDIRS) $(FBDEVDIR) $(LAYERDIR) $(SHADOWDIR) $(PCMCIADIR) $(IPAQDIR) + + IPAQLIBS = PreFbLibs $(IPAQ) $(FBDEV) $(LAYER) $(SHADOW) $(PCMCIA) KdLibs FbPostFbLibs + IPAQSYSLIBS = StdKdSysLibs + +#if HasParallelMake +MakeMutex($(IPAQDIRS) $(IPAQOBJS) $(IPAQLIBS) $(IPAQSYSLIBS)) +#endif +#if ForceServerRemake +$(IPAQOBJS) $(IPAQLIBS) $(IPAQSYSLIBS):: $(IPAQDIRS) + @if [ -f $@ ]; then touch $@; fi +#endif +ServerTarget(Xipaq,$(IPAQDIRS),$(IPAQOBJS), \ + $(IPAQLIBS),$(IPAQSYSLIBS)) +#endif /* XIPAQServer */ + #if XTS300Server XCOMM XCOMM server with Keith's S3 Trio and SiS530 driver for the TS300/TS400 @@ -978,11 +1016,9 @@ XCOMM KDDIRS = StdKdDirs - SHADOWDIR = miext/shadow + VESADIRS = $(STDDIRS) $(KDDIRS) $(VESADIR) $(SHADOWDIR) $(LAYERDIR) - VESADIRS = $(STDDIRS) $(KDDIRS) $(VESADIR) $(SHADOWDIR) - - VESALIBS = PreFbLibs $(VESA) KdLibs FbPostFbLibs + VESALIBS = PreFbLibs $(VESA) $(LAYER) KdLibs FbPostFbLibs VESASYSLIBS = StdKdSysLibs #if HasParallelMake @@ -997,7 +1033,8 @@ ServerTarget(Xvesa,$(VESADIRS),$(VESAOBJS), \ #endif /* XvesaServer */ KDRIVEDIRS=$(KDDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(I810DIR) \ - $(SIS530DIR) $(TRIODIR) $(TS300DIR) $(ITSYDIR) $(IGSDIR) $(VESADIR) + $(SIS530DIR) $(TRIODIR) $(TS300DIR) $(ITSYDIR) $(IGSDIR) \ + $(VESADIR) $(PCMCIADIR) $(IPAQDIR) $(MACH64DIR) #endif /* KDriveXServer */ #if XprtServer @@ -1123,32 +1160,36 @@ XCOMM X Server for MS Windows XCOMM FBDIR = fb SHADOWDIR = miext/shadow -XWINDIR = hw/xwin -XWIN = $(XWINDIR)/LibraryTargetName(Xwin) -XWINGDI32 = -lgdi32 -XWINDDRAW = -lddraw -DDXDIR1 = $(XWINDIR) -XWINDIRS = $(STDDIRS) $(FBDIR) $(SHADOWDIR) $(XWINDIR) $(DEPDIRS) - -XWINOBJSA = $(XWINDIR)/stubs.o - -#if BuildDPMS -XWINOBJSB = $(XWINDIR)/dpmsstubs.o +LAYERDIR = miext/layer +XWINDDXDIR = hw/xwin +XWINLIB = $(XWINDDXDIR)/LibraryTargetName(Xwin) +XWINDIRS = $(STDDIRS) $(FBDIR) $(SHADOWDIR) $(LAYERDIR) $(XWINDDXDIR) \ + $(DEPDIRS) +XWINOBJS = $(XWINDDXDIR)/stubs.o +XWINLIBS = PreFbLibs $(XWINLIB) FbPostFbLibs $(LAYER) $(SHADOW) +XWINSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS) -lgdi32 -lddraw + +#if 0 +/* + * Do not erase this block - it will be used in the future, and the + * flags are obscure enough as to be easily forgotten. + * + * These flags cause XWin.exe to be a Windows executable, which + * prevents XWin.exe from opening a Command Prompt window when it is + * started. However, the flags also prevent XWin.exe from outputting + * its status and error message to a Command Prompt; thus, one most + * implement a method to redirect status and error messages to a file + * before enabling these flags. + */ +EXTRA_LDOPTIONS = -mwindows -e _mainCRTStartup #endif -XWINOBJS = $(XWINOBJSA) $(XWINOBJSB) - -XWINLIBS = PreFbLibs $(XWIN) FbPostFbLibs $(SHADOW) - -XWINSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS) \ - $(XWINGDI32) $(XWINDDRAW) - #if HasParallelMake -MakeMutex($(XWINDIRS) $(XWINOBJS) $(XWIN) $(XWINLIBS) $(XWINSYSLIBS)) +MakeMutex($(XWINDIRS) $(XWINOBJS) $(XWINLIB) $(XWINLIBS) $(XWINSYSLIBS)) #endif #if ForceServerRemake -$(XWINOBJS) $(XWIN) $(XWINLIBS) $(XWINSYSLIBS):: $(XWINDIRS) +$(XWINOBJS) $(XWINLIB) $(XWINLIBS) $(XWINSYSLIBS):: $(XWINDIRS) @if [ -f $@ ]; then touch $@; fi #endif @@ -1166,12 +1207,11 @@ ServerTarget(XWin,$(XWINDIRS),$(XWINOBJS), \ XCOMM XCOMM X Darwin server for Mac OS X / Darwin XCOMM -FBDIR = fb -DDXDIR1 = hw/darwin -DDXDIR2 = hw/darwin/bundle -DARWINDIRS = $(STDDIRS) $(FBDIR) $(DDXDIR1) $(DEPDIRS) -DARWINOBJS = $(DDXDIR1)/xfIOKitStartup.o -DARWINLIBS = PreFbLibs $(DDXDIR1)/LibraryTargetName(darwin) FbPostFbLibs +FBDIR = fb +DARWINDDXDIR = hw/darwin +DARWINDIRS = $(STDDIRS) $(FBDIR) $(DARWINDDXDIR) $(DEPDIRS) +DARWINOBJS = $(DARWINDDXDIR)/xfIOKitStartup.o +DARWINLIBS = PreFbLibs $(DARWINDDXDIR)/LibraryTargetName(darwin) FbPostFbLibs DARWINSYSLIBS = $(FONTLIBS) $(SYSLIBS) -framework IOKit /* @@ -1189,7 +1229,7 @@ SetUIDServerTarget(XDarwin,$(DARWINDIRS),$(DARWINOBJS), \ */ QUARTZSYSLIBS = -framework ApplicationServices -framework Cocoa \ -framework CoreAudio -framework Carbon -ObjC -QUARTZOBJS = $(DDXDIR2)/quartzStartup.o +QUARTZOBJS = $(DARWINDDXDIR)/bundle/quartzStartup.o #if NothingOutsideProjectRoot XDARWINAPPDIR = $(BINDIR)/XDarwin.app/Contents/MacOS #else @@ -1200,7 +1240,7 @@ XDARWINAPPDIR = /Applications/XDarwin.app/Contents/MacOS * Quartz X server (installed in its application bundle) */ SetUIDServerTarget(XDarwinApp,$(DARWINDIRS),$(QUARTZOBJS), \ - $(DARWINLIBS) $(DDXDIR2)/LibraryTargetName(XQuartz), \ + $(DARWINLIBS) $(DARWINDDXDIR)/bundle/LibraryTargetName(XQuartz), \ $(DARWINSYSLIBS) $(QUARTZSYSLIBS)) install:: @@ -1219,9 +1259,11 @@ install:: CFBDIRS = $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) -MIEXTDIRS = $(SHADOWDIR) +MIEXTDIRS = $(SHADOWDIR) $(LAYERDIR) IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR) -DDXDIRS = $(DDXDIR1) $(DDXDIR2) $(DDXDIR3) $(XVFBDDXDIR) $(XNESTDDXDIR) +DDXDIRS = $(DECWSDDXDIR) $(SUNDDXDIR) $(LYNXDDXDIR) \ + $(HPDDXDIR) $(XFREE86DDXDIR) $(XWINDDXDIR) $(DARWINDDXDIR) \ + $(XVFBDDXDIR) $(XNESTDDXDIR) SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFBDIRS) $(IPLANDIRS) $(ILBMDIR) $(AFBDIR) \ $(LMFCFBDIR) $(DDXDIRS) $(FBDIR) $(KDRIVEDIRS) $(MIEXTDIRS) diff --git a/xc/programs/Xserver/Xext/panoramiXsrv.h b/xc/programs/Xserver/Xext/panoramiXsrv.h index 44228b57e..27cbcda52 100644 --- a/xc/programs/Xserver/Xext/panoramiXsrv.h +++ b/xc/programs/Xserver/Xext/panoramiXsrv.h @@ -1,14 +1,16 @@ -/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.7 2001/01/03 02:54:17 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.9 2001/08/11 21:00:06 mvojkovi Exp $ */ #ifndef _PANORAMIXSRV_H_ #define _PANORAMIXSRV_H_ +#include "panoramiX.h" + extern int PanoramiXNumScreens; extern PanoramiXData *panoramiXdataPtr; extern int PanoramiXPixWidth; extern int PanoramiXPixHeight; extern RegionRec PanoramiXScreenRegion; -extern XID PanoramiXVisualTable[256][MAXSCREENS]; +extern XID *PanoramiXVisualTable; extern void PanoramiXConsolidate(void); extern Bool PanoramiXCreateConnectionBlock(void); diff --git a/xc/programs/Xserver/Xprint/Quarks.c b/xc/programs/Xserver/Xprint/Quarks.c deleted file mode 100644 index 7a73f7eb8..000000000 --- a/xc/programs/Xserver/Xprint/Quarks.c +++ /dev/null @@ -1,373 +0,0 @@ -/* - * $XConsortium: Quarks.c /main/1 1996/09/28 16:58:44 rws $ - */ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 -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 THE SOFTWARE. - -Except as contained in this notice, the names of the copyright holders shall -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. -*/ - -#include "Xlibint.h" -#include <X11/Xresource.h> - -/* Not cost effective, at least for vanilla MIT clients */ -/* #define PERMQ */ - -typedef unsigned long Signature; -typedef unsigned long Entry; -#ifdef PERMQ -typedef unsigned char Bits; -#endif - -static XrmQuark nextQuark = 1; /* next available quark number */ -static unsigned long quarkMask = 0; -static Entry zero = 0; -static Entry *quarkTable = &zero; /* crock */ -static unsigned long quarkRehash; -static XrmString **stringTable = NULL; -#ifdef PERMQ -static Bits **permTable = NULL; -#endif -static XrmQuark nextUniq = -1; /* next quark from XrmUniqueQuark */ - -#define QUANTUMSHIFT 8 -#define QUANTUMMASK ((1 << QUANTUMSHIFT) - 1) -#define CHUNKPER 8 -#define CHUNKMASK ((CHUNKPER << QUANTUMSHIFT) - 1) - -#define LARGEQUARK ((Entry)0x80000000L) -#define QUARKSHIFT 18 -#define QUARKMASK ((LARGEQUARK - 1) >> QUARKSHIFT) -#define XSIGMASK ((1L << QUARKSHIFT) - 1) - -#define STRQUANTSIZE (sizeof(XrmString) * (QUANTUMMASK + 1)) -#ifdef PERMQ -#define QUANTSIZE (STRQUANTSIZE + \ - (sizeof(Bits) * ((QUANTUMMASK + 1) >> 3)) -#else -#define QUANTSIZE STRQUANTSIZE -#endif - -#define HASH(sig) ((sig) & quarkMask) -#define REHASHVAL(sig) ((((sig) % quarkRehash) + 2) | 1) -#define REHASH(idx,rehash) ((idx + rehash) & quarkMask) -#define NAME(q) stringTable[(q) >> QUANTUMSHIFT][(q) & QUANTUMMASK] -#ifdef PERMQ -#define BYTEREF(q) permTable[(q) >> QUANTUMSHIFT][((q) & QUANTUMMASK) >> 3] -#define ISPERM(q) (BYTEREF(q) & (1 << ((q) & 7))) -#define SETPERM(q) BYTEREF(q) |= (1 << ((q) & 7)) -#define CLEARPERM(q) BYTEREF(q) &= ~(1 << ((q) & 7)) -#endif - -/* Permanent memory allocation */ - -#define WALIGN sizeof(unsigned long) -#define DALIGN sizeof(double) - -#define NEVERFREETABLESIZE ((8192-12) & ~(DALIGN-1)) -static char *neverFreeTable = NULL; -static int neverFreeTableSize = 0; - -static char *permalloc(length) - register unsigned int length; -{ - char *ret; - - if (neverFreeTableSize < length) { - if (length >= NEVERFREETABLESIZE) - return Xmalloc(length); - if (! (ret = Xmalloc(NEVERFREETABLESIZE))) - return (char *) NULL; - neverFreeTableSize = NEVERFREETABLESIZE; - neverFreeTable = ret; - } - ret = neverFreeTable; - neverFreeTable += length; - neverFreeTableSize -= length; - return(ret); -} - -char *Xpermalloc(length) - unsigned int length; -{ - int i; - - if (neverFreeTableSize && length < NEVERFREETABLESIZE) { -#ifndef WORD64 - if ((sizeof(struct {char a; double b;}) != - (sizeof(struct {char a; unsigned long b;}) - - sizeof(unsigned long) + sizeof(double))) && - !(length & (DALIGN-1)) && - (i = (NEVERFREETABLESIZE - neverFreeTableSize) & (DALIGN-1))) { - neverFreeTableSize -= DALIGN - i; - neverFreeTable += DALIGN - i; - } else -#endif - if (i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1)) { - neverFreeTableSize -= WALIGN - i; - neverFreeTable += WALIGN - i; - } - } - return permalloc(length); -} - -static Bool -ExpandQuarkTable() -{ - unsigned long oldmask, newmask; - register char c, *s; - register Entry *oldentries, *entries; - register Entry entry; - register int oldidx, newidx, rehash; - Signature sig; - XrmQuark q; - - oldentries = quarkTable; - if (oldmask = quarkMask) - newmask = (oldmask << 1) + 1; - else { - if (!stringTable) { - stringTable = (XrmString **)Xmalloc(sizeof(XrmString *) * - CHUNKPER); - if (!stringTable) - return False; - stringTable[0] = (XrmString *)NULL; - } -#ifdef PERMQ - if (!permTable) - permTable = (Bits **)Xmalloc(sizeof(Bits *) * CHUNKPER); - if (!permTable) - return False; -#endif - stringTable[0] = (XrmString *)Xpermalloc(QUANTSIZE); - if (!stringTable[0]) - return False; -#ifdef PERMQ - permTable[0] = (Bits *)((char *)stringTable[0] + STRQUANTSIZE); -#endif - newmask = 0x1ff; - } - entries = (Entry *)Xmalloc(sizeof(Entry) * (newmask + 1)); - if (!entries) - return False; - bzero((char *)entries, sizeof(Entry) * (newmask + 1)); - quarkTable = entries; - quarkMask = newmask; - quarkRehash = quarkMask - 2; - for (oldidx = 0; oldidx <= oldmask; oldidx++) { - if (entry = oldentries[oldidx]) { - if (entry & LARGEQUARK) - q = entry & (LARGEQUARK-1); - else - q = (entry >> QUARKSHIFT) & QUARKMASK; - for (sig = 0, s = NAME(q); c = *s++; ) - sig = (sig << 1) + c; - newidx = HASH(sig); - if (entries[newidx]) { - rehash = REHASHVAL(sig); - do { - newidx = REHASH(newidx, rehash); - } while (entries[newidx]); - } - entries[newidx] = entry; - } - } - if (oldmask) - Xfree((char *)oldentries); - return True; -} - -#if NeedFunctionPrototypes -XrmQuark _XrmInternalStringToQuark( - register _Xconst char *name, register int len, register Signature sig, - Bool permstring) -#else -XrmQuark _XrmInternalStringToQuark(name, len, sig, permstring) - register XrmString name; - register int len; - register Signature sig; - Bool permstring; -#endif -{ - register XrmQuark q; - register Entry entry; - register int idx, rehash; - register int i; - register char *s1, *s2; - char *new; - - rehash = 0; - idx = HASH(sig); - while (entry = quarkTable[idx]) { - if (entry & LARGEQUARK) - q = entry & (LARGEQUARK-1); - else { - if ((entry - sig) & XSIGMASK) - goto nomatch; - q = (entry >> QUARKSHIFT) & QUARKMASK; - } - for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) { - if (*s1++ != *s2++) - goto nomatch; - } - if (*s2) { -nomatch: if (!rehash) - rehash = REHASHVAL(sig); - idx = REHASH(idx, rehash); - continue; - } -#ifdef PERMQ - if (permstring && !ISPERM(q)) { - Xfree(NAME(q)); - NAME(q) = (char *)name; - SETPERM(q); - } -#endif - return q; - } - if (nextUniq == nextQuark) - return NULLQUARK; - if ((nextQuark + (nextQuark >> 2)) > quarkMask) { - if (!ExpandQuarkTable()) - return NULLQUARK; - return _XrmInternalStringToQuark(name, len, sig, permstring); - } - q = nextQuark; - if (!(q & QUANTUMMASK)) { - if (!(q & CHUNKMASK)) { - if (!(new = Xrealloc((char *)stringTable, - sizeof(XrmString *) * - ((q >> QUANTUMSHIFT) + CHUNKPER)))) - return NULLQUARK; - stringTable = (XrmString **)new; -#ifdef PERMQ - if (!(new = Xrealloc((char *)permTable, - sizeof(Bits *) * - ((q >> QUANTUMSHIFT) + CHUNKPER)))) - return NULLQUARK; - permTable = (Bits **)new; -#endif - } - new = Xpermalloc(QUANTSIZE); - if (!new) - return NULLQUARK; - stringTable[q >> QUANTUMSHIFT] = (XrmString *)new; -#ifdef PERMQ - permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE); -#endif - } - if (!permstring) { - s2 = (char *)name; -#ifdef PERMQ - name = Xmalloc(len+1); -#else - name = permalloc(len+1); -#endif - if (!name) - return NULLQUARK; - for (i = len, s1 = (char *)name; --i >= 0; ) - *s1++ = *s2++; - *s1++ = '\0'; -#ifdef PERMQ - CLEARPERM(q); - } - else { - SETPERM(q); -#endif - } - NAME(q) = (char *)name; - if (q <= QUARKMASK) - entry = (q << QUARKSHIFT) | (sig & XSIGMASK); - else - entry = q | LARGEQUARK; - quarkTable[idx] = entry; - nextQuark++; - return q; -} - -#if NeedFunctionPrototypes -XrmQuark XrmStringToQuark( - _Xconst char *name) -#else -XrmQuark XrmStringToQuark(name) - XrmString name; -#endif -{ - register char c, *tname; - register Signature sig = 0; - - if (!name) - return (NULLQUARK); - - for (tname = (char *)name; c = *tname++; ) - sig = (sig << 1) + c; - - return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, False); -} - -#if NeedFunctionPrototypes -XrmQuark XrmPermStringToQuark( - _Xconst char *name) -#else -XrmQuark XrmPermStringToQuark(name) - XrmString name; -#endif -{ - register char c, *tname; - register Signature sig = 0; - - if (!name) - return (NULLQUARK); - - for (tname = (char *)name; c = *tname++; ) - sig = (sig << 1) + c; - - return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, True); -} - -XrmQuark XrmUniqueQuark() -{ - if (nextUniq == nextQuark) - return NULLQUARK; - return nextUniq--; -} - -XrmString XrmQuarkToString(quark) - register XrmQuark quark; -{ - if (quark <= 0 || quark >= nextQuark) - return NULLSTRING; -#ifdef PERMQ - /* We have to mark the quark as permanent, since the caller might hold - * onto the string pointer forver. - */ - SETPERM(quark); -#endif - return NAME(quark); -} diff --git a/xc/programs/Xserver/Xprint/Xlcint.h b/xc/programs/Xserver/Xprint/Xlcint.h deleted file mode 100644 index b86cf1aed..000000000 --- a/xc/programs/Xserver/Xprint/Xlcint.h +++ /dev/null @@ -1,625 +0,0 @@ -/* - * $XConsortium: Xlcint.h /main/1 1996/09/28 16:59:05 rws $ - */ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 -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 THE SOFTWARE. - -Except as contained in this notice, the names of the copyright holders shall -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. -*/ - -/* - * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, - * and Nippon Telegraph and Telephone Corporation - * Copyright 1991 by the Massachusetts Institute of Technology - * Copyright 1991 by the Open Software Foundation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of OMRON, NTT Software, NTT, Open - * Software Foundation and M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. OMRON, NTT Software, NTT, Open Software - * Foundation and M.I.T. make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION AND M.I.T. - * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT - * SHALL OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATIONN OR M.I.T. BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Li Yuhong OMRON Corporation - * Tatsuya Kato NTT Software Corporation - * Hiroshi Kuribayashi OMRON Coproration - * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. - * - * M. Collins OSF - */ - - -#ifndef _XLCINT_H_ -#define _XLCINT_H_ - -#ifdef NOT_IN_SERVER - -#include <X11/Xresource.h> - -/* current Ultrix compiler gets horribly confused */ -#if defined(FUNCPROTO) && defined(ultrix) -#undef NeedFunctionPrototypes -#endif - -typedef struct _XIMFilter { - struct _XIMFilter *next; - Window window; - unsigned long event_mask; - int start_type, end_type; - Bool (*filter)( -#if NeedFunctionPrototypes - Display*, Window, XEvent*, XPointer -#endif - ); - XPointer client_data; -} XFilterEventRec, *XFilterEventList; - -#ifdef offsetof -#define XOffsetOf(s_type,field) offsetof(s_type,field) -#else -#define XOffsetOf(s_type,field) ((unsigned int)&(((s_type*)NULL)->field)) -#endif - -#define XIMNumber(arr) ((unsigned int) (sizeof(arr) / sizeof(arr[0]))) - -typedef struct { - char *name; - XPointer value; -} XIMArg; - -#define ICInputStyle 0 -#define ICClientWindow 1 -#define ICFocusWindow 2 -#define ICFilterEvents 3 -#define ICArea 4 -#define ICAreaNeeded 5 -#define ICSpotLocation 6 -#define ICColormap 7 -#define ICStdColormap 8 -#define ICForeground 9 -#define ICBackground 10 -#define ICBackgroundPixmap 11 -#define ICFontSet 12 -#define ICLineSpace 13 -#define ICCursor 14 -#define ICResourceClass 26 -#define ICResourceName 27 -#ifdef __hpux -#define ICNlioctl 28 /* must be > 14 + 11 */ -#endif - -#define IMQueryInputStyle 0 - -#define IMResourceWrite 1 -#define IMResourceRead 2 -#define IMResourceReadWrite 3 - -/* - * define secondary data structs which are part of Input methods - * and input context - */ -typedef struct { - XrmQuark xrm_name; /* Resource name quark */ - int xrm_size; /* Size in bytes of data */ - long xrm_offset; /* -offset-1 */ - unsigned short mode; /* Read Write Permission */ - int mask; /* ? */ -} XIMrmResource, *XIMrmResourceList; - -typedef struct { - char *resource_name; /* Resource string */ - int resource_size; /* Size in bytes of data */ - long resource_offset; /* -offset-1 */ - unsigned short mode; /* Read Write Permission */ - int mask; /* ? */ -} XIMResource, *XIMResourceList; - -typedef struct { - XIMCallback start; - XIMCallback done; - XIMCallback draw; - XIMCallback caret; -} ICCallbacks; - -/* - * data block describing the visual attributes associated with - * an input context - */ -typedef struct { - XRectangle area; - XRectangle area_needed; - XPoint spot_location; - Colormap colormap; - Atom std_colormap; - unsigned long foreground; - unsigned long background; - Pixmap background_pixmap; - XFontSet fontset; - int line_space; - Cursor cursor; - ICCallbacks callbacks; -} ICAttributes, *ICAttributesPtr; - -typedef struct _XLCd *XLCd; /* need forward reference */ - -/* - * define an LC, it's methods, and data. - */ - -typedef struct { - char* (*map_modifiers)( /* called by XSetModifiers */ -#if NeedFunctionPrototypes - XLCd, char*, char* -#endif - ); - XFontSet (*create_fontset)( -#if NeedFunctionPrototypes - XLCd, Display*, char*, char**, int, char***, int* -#endif - ); - XIM (*open_im)( -#if NeedFunctionPrototypes - XLCd, Display*, XrmDatabase, char*, char* -#endif - ); -} XLCdMethodsRec, *XLCdMethods; - - -typedef struct { - char* name; /* name of this LC */ - char* modifiers; /* modifiers of locale */ -} XLCdCoreRec, *XLCdCore; - - -typedef struct _XLCd { - XLCdMethods methods; /* methods of this LC */ - XLCdCoreRec core; /* data of this LC */ -} XLCdRec; - - -/* - * X Font Sets are an instantiable object, so we define it, the - * object itself, a method list and data - */ - -/* - * XFontSet object method list - */ -typedef struct { - /* pure font methods */ - - void (*free)( -#if NeedFunctionPrototypes - Display*, XFontSet -#endif - ); - - /* multi-byte text drawing methods */ - - int (*mb_escapement)( -#if NeedFunctionPrototypes - XFontSet, char*, int -#endif - ); - int (*mb_extents)( -#if NeedFunctionPrototypes - XFontSet, char*, int, XRectangle*, XRectangle* -#endif - ); - Status (*mb_extents_per_char)( -#if NeedFunctionPrototypes - XFontSet, char*, int, XRectangle*, XRectangle*, int, int*, - XRectangle*, XRectangle* -#endif - ); - int (*mb_draw_string)( -#if NeedFunctionPrototypes - Display*, Drawable, XFontSet, GC, int, int, char*, int -#endif - ); - void (*mb_draw_image_string)( -#if NeedFunctionPrototypes - Display*, Drawable, XFontSet, GC, int, int, char*, int -#endif - ); - - /* wide character text drawing methods */ - - int (*wc_escapement)( -#if NeedFunctionPrototypes - XFontSet, wchar_t*, int -#endif - ); - int (*wc_extents)( -#if NeedFunctionPrototypes - XFontSet, wchar_t*, int, XRectangle*, XRectangle* -#endif - ); - Status (*wc_extents_per_char)( -#if NeedFunctionPrototypes - XFontSet, wchar_t*, int, XRectangle*, XRectangle*, int, int*, - XRectangle*, XRectangle* -#endif - ); - int (*wc_draw_string)( -#if NeedFunctionPrototypes - Display*, Drawable, XFontSet, GC, int, int, wchar_t*, int -#endif - ); - void (*wc_draw_image_string)( -#if NeedFunctionPrototypes - Display*, Drawable, XFontSet, GC, int, int, wchar_t*, int -#endif - ); -} XFontSetMethodsRec, *XFontSetMethods; - - -/* - * XFontSet LC independent data - */ - -typedef struct { - XLCd lcd; /* LC of this font set */ - char * base_name_list; /* base font name list */ - int num_of_fonts; /* number of fonts */ - char ** font_name_list; /* font names list */ - XFontStruct ** font_struct_list; /* font struct list */ - XFontSetExtents font_set_extents; /* font set extents */ - char * default_string; /* default string */ - Bool context_dependent; /* context-dependent drawing */ -} XFontSetCoreRec, *XFontSetCore; - - -/* - * An XFontSet. Implementations may need to extend this data structure to - * accomodate additional data, state information etc. - */ -typedef struct _XFontSet { - XFontSetMethods methods; /* methods of this font set */ - XFontSetCoreRec core; /* data of this font set */ -} XFontSetRec; - - - -/* - * X Input Managers are an instantiable object, so we define it, the - * object itself, a method list and data. - */ - -/* - * an Input Manager object method list - */ -typedef struct { - Status (*close)( -#if NeedFunctionPrototypes - XIM -#endif - ); - char* (*get_values)( -#if NeedFunctionPrototypes - XIM, XIMArg* -#endif - ); - XIC (*create_ic)( -#if NeedFunctionPrototypes - XIM, XIMArg* -#endif - ); -} XIMMethodsRec, *XIMMethods; - -/* - * Input Manager LC independent data - */ -typedef struct { - XLCd lcd; /* LC of this input method */ - XIC ic_chain; /* list of ICs for this IM */ - - Display * display; /* display */ - XrmDatabase rdb; - char * res_name; - char * res_class; - - XIMrmResourceList ic_resources; /* compiled IC resource list */ - unsigned int ic_num_resources; - XIMrmResourceList ic_attr_resources; /* compiled IC visual res */ - unsigned int ic_num_attr_resources; -} XIMCoreRec, *XIMCore; - - - -/* - * An X Input Manager (IM). Implementations may need to extend this data - * structure to accomodate additional data, state information etc. - */ -typedef struct _XIM { - XIMMethods methods; /* method list of this IM */ - XIMCoreRec core; /* data of this IM */ -} XIMRec; - - - -/* - * X Input Contexts (IC) are an instantiable object, so we define it, the - * object itself, a method list and data for this object - */ - -/* - * Input Context method list - */ -typedef struct { - void (*destroy)( -#if NeedFunctionPrototypes - XIC -#endif - ); - void (*set_focus)( -#if NeedFunctionPrototypes - XIC -#endif - ); - void (*unset_focus)( -#if NeedFunctionPrototypes - XIC -#endif - ); - char* (*set_values)( -#if NeedFunctionPrototypes - XIC, XIMArg* -#endif - ); - char* (*get_values)( -#if NeedFunctionPrototypes - XIC, XIMArg* -#endif - ); - char* (*mb_reset)( -#if NeedFunctionPrototypes - XIC -#endif - ); - wchar_t* (*wc_reset)( -#if NeedFunctionPrototypes - XIC -#endif - ); - int (*mb_lookup_string)( -#if NeedFunctionPrototypes - XIC, XKeyEvent*, char*, int, KeySym*, Status* -#endif - ); - int (*wc_lookup_string)( -#if NeedFunctionPrototypes - XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status* -#endif - ); -} XICMethodsRec, *XICMethods; - - - -/* - * Input Context LC independent data - */ -typedef struct { - XIM im; /* XIM this IC belongs too */ - XIC next; /* linked list of ICs for IM */ - - Window client_window; /* window IM can use for */ - /* display or subwindows */ - XIMStyle input_style; /* IM's input style */ - Window focus_window; /* where key events go */ - XrmDatabase res_database; /* where IM gets resources */ - char * string_database; /* string for IM's resources */ - XIMCallback geometry_callback; /* client callback */ - int preedit_state; /* */ - unsigned long filter_events; /* event mask from IM */ - - ICAttributes preedit_attr; /* visuals of preedit area */ - ICAttributes status_attr; /* visuals of status area */ -} XICCoreRec, *XICCore; - - -/* - * an Input Context. Implementations may need to extend this data - * structure to accomodate additional data, state information etc. - */ -typedef struct _XIC { - XICMethods methods; /* method list of this IC */ - XICCoreRec core; /* data of this IC */ -} XICRec; - -#endif /* NOT_IN_SERVER */ - -/* - * Methods for Xrm parsing - */ - -typedef struct { - void (*mbinit)( -#if NeedFunctionPrototypes - XPointer /* state */ -#endif - ); - char (*mbchar)( -#if NeedFunctionPrototypes - XPointer /* state */, - char* /* str */, - int* /* lenp */ -#endif - ); - void (*mbfinish)( -#if NeedFunctionPrototypes - XPointer /* state */ -#endif - ); - char* (*lcname)( -#if NeedFunctionPrototypes - XPointer /* state */ -#endif - ); - void (*destroy)( -#if NeedFunctionPrototypes - XPointer /* state */ -#endif - ); -} XrmMethodsRec, *XrmMethods; - -#ifdef NOT_IN_SERVER - -/* current Ultrix compiler gets horribly confused */ -#if !defined(NeedFunctionPrototypes) && defined(FUNCPROTO) -#define NeedFunctionPrototypes 1 -#endif - -typedef XLCd (*XLCdLoadProc)( -#if NeedFunctionPrototypes - char* -#endif -); - -_XFUNCPROTOBEGIN - -extern XLCd _XlcCurrentLC( -#if NeedFunctionPrototypes - void -#endif -); - -extern Bool _XlcValidModSyntax( -#if NeedFunctionPrototypes - char* /* mods */, - char** /* valid */ -#endif -); - -extern char *_XlcDefaultMapModifiers( -#if NeedFunctionPrototypes - XLCd /* lcd */, - char* /* user_mods */, - char* /* prog_mods */ -#endif -); - -extern void _XIMCompileResourceList( -#if NeedFunctionPrototypes - XIMResourceList /* res */, - unsigned int /* num_res */ -#endif -); - -extern void _XCopyToArg( -#if NeedFunctionPrototypes - XPointer /* src */, - XPointer* /* dst */, - unsigned int /* size */ -#endif -); - -extern char ** _XParseBaseFontNameList( -#if NeedFunctionPrototypes - char* /* str */, - int* /* num */ -#endif -); - -extern XrmMethods _XrmInitParseInfo( -#if NeedFunctionPrototypes - XPointer* /* statep */ -#endif -); - -extern void _XRegisterFilterByMask( -#if NeedFunctionPrototypes - Display* /* dpy */, - Window /* window */, - unsigned long /* event_mask */, - Bool (*)( -#if NeedNestedPrototypes - Display* /* display */, - Window /* window */, - XEvent* /* event */, - XPointer /* client_data */ -#endif - ) /* filter */, - XPointer /* client_data */ -#endif -); - -extern void _XRegisterFilterByType( -#if NeedFunctionPrototypes - Display* /* dpy */, - Window /* window */, - int /* start_type */, - int /* end_type */, - Bool (*)( -#if NeedNestedPrototypes - Display* /* display */, - Window /* window */, - XEvent* /* event */, - XPointer /* client_data */ -#endif - ) /* filter */, - XPointer /* client_data */ -#endif -); - -extern void _XUnregisterFilter( -#if NeedFunctionPrototypes - Display* /* dpy */, - Window /* window */, - Bool (*)( -#if NeedNestedPrototypes - Display* /* display */, - Window /* window */, - XEvent* /* event */, - XPointer /* client_data */ -#endif - ) /* filter */, - XPointer /* client_data */ -#endif -); - -_XFUNCPROTOEND - -#endif /* NOT_IN_SERVER */ - -#endif /* _XLCINT_H_ */ diff --git a/xc/programs/Xserver/Xprint/Xresource.h b/xc/programs/Xserver/Xprint/Xresource.h deleted file mode 100644 index b7ded0270..000000000 --- a/xc/programs/Xserver/Xprint/Xresource.h +++ /dev/null @@ -1,423 +0,0 @@ -/* $XConsortium: Xresource.h /main/1 1996/09/28 16:59:12 rws $ */ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 -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 THE SOFTWARE. - -Except as contained in this notice, the names of the copyright holders shall -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. -*/ - -/*********************************************************** -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, -and the Massachusetts Institute of Technology, Cambridge, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Digital or MIT not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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 _XRESOURCE_H_ -#define _XRESOURCE_H_ - -/* You must include <X11/Xlib.h> before including this file */ - -/**************************************************************** - **************************************************************** - *** *** - *** *** - *** X Resource Manager Intrinsics *** - *** *** - *** *** - **************************************************************** - ****************************************************************/ - -_XFUNCPROTOBEGIN - -/**************************************************************** - * - * Memory Management - * - ****************************************************************/ - -extern char *Xpermalloc( -#if NeedFunctionPrototypes - unsigned int /* size */ -#endif -); - -/**************************************************************** - * - * Quark Management - * - ****************************************************************/ - -typedef int XrmQuark, *XrmQuarkList; -#define NULLQUARK ((XrmQuark) 0) - -typedef char *XrmString; -#define NULLSTRING ((XrmString) 0) - -/* find quark for string, create new quark if none already exists */ -extern XrmQuark XrmStringToQuark( -#if NeedFunctionPrototypes - _Xconst char* /* string */ -#endif -); - -extern XrmQuark XrmPermStringToQuark( -#if NeedFunctionPrototypes - _Xconst char* /* string */ -#endif -); - -/* find string for quark */ -extern XrmString XrmQuarkToString( -#if NeedFunctionPrototypes - XrmQuark /* quark */ -#endif -); - -extern XrmQuark XrmUniqueQuark( -#if NeedFunctionPrototypes - void -#endif -); - -#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0) - - -/**************************************************************** - * - * Conversion of Strings to Lists - * - ****************************************************************/ - -typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList; - -extern void XrmStringToQuarkList( -#if NeedFunctionPrototypes - _Xconst char* /* string */, - XrmQuarkList /* quarks_return */ -#endif -); - -extern void XrmStringToBindingQuarkList( -#if NeedFunctionPrototypes - _Xconst char* /* string */, - XrmBindingList /* bindings_return */, - XrmQuarkList /* quarks_return */ -#endif -); - -/**************************************************************** - * - * Name and Class lists. - * - ****************************************************************/ - -typedef XrmQuark XrmName; -typedef XrmQuarkList XrmNameList; -#define XrmNameToString(name) XrmQuarkToString(name) -#define XrmStringToName(string) XrmStringToQuark(string) -#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) - -typedef XrmQuark XrmClass; -typedef XrmQuarkList XrmClassList; -#define XrmClassToString(c_class) XrmQuarkToString(c_class) -#define XrmStringToClass(c_class) XrmStringToQuark(c_class) -#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) - - - -/**************************************************************** - * - * Resource Representation Types and Values - * - ****************************************************************/ - -typedef XrmQuark XrmRepresentation; -#define XrmStringToRepresentation(string) XrmStringToQuark(string) -#define XrmRepresentationToString(type) XrmQuarkToString(type) - -typedef struct { - unsigned int size; - XPointer addr; -} XrmValue, *XrmValuePtr; - - -/**************************************************************** - * - * Resource Manager Functions - * - ****************************************************************/ - -typedef struct _XrmHashBucketRec *XrmHashBucket; -typedef XrmHashBucket *XrmHashTable; -typedef XrmHashTable XrmSearchList[]; -typedef struct _XrmHashBucketRec *XrmDatabase; - - -extern void XrmDestroyDatabase( -#if NeedFunctionPrototypes - XrmDatabase /* database */ -#endif -); - -extern void XrmQPutResource( -#if NeedFunctionPrototypes - XrmDatabase* /* database */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - XrmRepresentation /* type */, - XrmValue* /* value */ -#endif -); - -extern void XrmPutResource( -#if NeedFunctionPrototypes - XrmDatabase* /* database */, - _Xconst char* /* specifier */, - _Xconst char* /* type */, - XrmValue* /* value */ -#endif -); - -extern void XrmQPutStringResource( -#if NeedFunctionPrototypes - XrmDatabase* /* database */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - _Xconst char* /* value */ -#endif -); - -extern void XrmPutStringResource( -#if NeedFunctionPrototypes - XrmDatabase* /* database */, - _Xconst char* /* specifier */, - _Xconst char* /* value */ -#endif -); - -extern void XrmPutLineResource( -#if NeedFunctionPrototypes - XrmDatabase* /* database */, - _Xconst char* /* line */ -#endif -); - -extern XrmQGetResource( -#if NeedFunctionPrototypes - XrmDatabase /* database */, - XrmNameList /* quark_name */, - XrmClassList /* quark_class */, - XrmRepresentation* /* quark_type_return */, - XrmValue* /* value_return */ -#endif -); - -extern Bool XrmGetResource( -#if NeedFunctionPrototypes - XrmDatabase /* database */, - _Xconst char* /* str_name */, - _Xconst char* /* str_class */, - char** /* str_type_return */, - XrmValue* /* value_return */ -#endif -); - -extern Bool XrmQGetSearchList( -#if NeedFunctionPrototypes - XrmDatabase /* database */, - XrmNameList /* names */, - XrmClassList /* classes */, - XrmSearchList /* list_return */, - int /* list_length */ -#endif -); - -extern Bool XrmQGetSearchResource( -#if NeedFunctionPrototypes - XrmSearchList /* list */, - XrmName /* name */, - XrmClass /* class */, - XrmRepresentation* /* type_return */, - XrmValue* /* value_return */ -#endif -); - -/**************************************************************** - * - * Resource Database Management - * - ****************************************************************/ - -#ifdef NOT_IN_SERVER - -extern void XrmSetDatabase( -#if NeedFunctionPrototypes - Display* /* display */, - XrmDatabase /* database */ -#endif -); - -extern XrmDatabase XrmGetDatabase( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -#endif /* NOT_IN_SERVER */ - -extern XrmDatabase XrmGetFileDatabase( -#if NeedFunctionPrototypes - _Xconst char* /* filename */ -#endif -); - -extern Status XrmCombineFileDatabase( -#if NeedFunctionPrototypes - _Xconst char* /* filename */, - XrmDatabase* /* target */, - Bool /* override */ -#endif -); - -extern XrmDatabase XrmGetStringDatabase( -#if NeedFunctionPrototypes - _Xconst char* /* data */ /* null terminated string */ -#endif -); - -extern void XrmPutFileDatabase( -#if NeedFunctionPrototypes - XrmDatabase /* database */, - _Xconst char* /* filename */ -#endif -); - -extern void XrmMergeDatabases( -#if NeedFunctionPrototypes - XrmDatabase /* source_db */, - XrmDatabase* /* target_db */ -#endif -); - -extern void XrmCombineDatabase( -#if NeedFunctionPrototypes - XrmDatabase /* source_db */, - XrmDatabase* /* target_db */, - Bool /* override */ -#endif -); - -#define XrmEnumAllLevels 0 -#define XrmEnumOneLevel 1 - -extern Bool XrmEnumerateDatabase( -#if NeedFunctionPrototypes - XrmDatabase /* db */, - XrmNameList /* name_prefix */, - XrmClassList /* class_prefix */, - int /* mode */, - Bool (*)( -#if NeedNestedPrototypes - XrmDatabase* /* db */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - XrmRepresentation* /* type */, - XrmValue* /* value */, - XPointer /* closure */ -#endif - ) /* proc */, - XPointer /* closure */ -#endif -); - -extern char *XrmLocaleOfDatabase( -#if NeedFunctionPrototypes - XrmDatabase /* database */ -#endif -); - - -/**************************************************************** - * - * Command line option mapping to resource entries - * - ****************************************************************/ - -typedef enum { - XrmoptionNoArg, /* Value is specified in OptionDescRec.value */ - XrmoptionIsArg, /* Value is the option string itself */ - XrmoptionStickyArg, /* Value is characters immediately following option */ - XrmoptionSepArg, /* Value is next argument in argv */ - XrmoptionResArg, /* Resource and value in next argument in argv */ - XrmoptionSkipArg, /* Ignore this option and the next argument in argv */ - XrmoptionSkipLine, /* Ignore this option and the rest of argv */ - XrmoptionSkipNArgs /* Ignore this option and the next - OptionDescRes.value arguments in argv */ -} XrmOptionKind; - -typedef struct { - char *option; /* Option abbreviation in argv */ - char *specifier; /* Resource specifier */ - XrmOptionKind argKind; /* Which style of option it is */ - XPointer value; /* Value to provide if XrmoptionNoArg */ -} XrmOptionDescRec, *XrmOptionDescList; - - -extern void XrmParseCommand( -#if NeedFunctionPrototypes - XrmDatabase* /* database */, - XrmOptionDescList /* table */, - int /* table_count */, - _Xconst char* /* name */, - int* /* argc_in_out */, - char** /* argv_in_out */ -#endif -); - -_XFUNCPROTOEND - -#endif /* _XRESOURCE_H_ */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/xc/programs/Xserver/Xprint/Xrm.c b/xc/programs/Xserver/Xprint/Xrm.c deleted file mode 100644 index 55879dd05..000000000 --- a/xc/programs/Xserver/Xprint/Xrm.c +++ /dev/null @@ -1,2600 +0,0 @@ -/* - * $TOG: Xrm.c /main/4 1997/06/22 07:14:18 kaleb $ - */ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 -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 THE SOFTWARE. - -Except as contained in this notice, the names of the copyright holders shall -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. -*/ - -/*********************************************************** -Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, -Massachusetts, and the Massachusetts Institute of Technology, Cambridge, -Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Digital or MIT not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -******************************************************************/ -/* $XFree86: xc/programs/Xserver/Xprint/Xrm.c,v 1.5 1997/06/22 12:20:21 dawes Exp $ */ - -#include <stdio.h> -#include <ctype.h> -#ifdef NOT_IN_SERVER -#include "Xlibint.h" -#include <X11/Xresource.h> -#else -typedef char *XPointer; -#define Status int -#define True 1 -#define False 0 -#include "misc.h" -#include <Xfuncproto.h> -#include "Xresource.h" -#endif /* NOT_IN_SERVER */ -#include "Xlcint.h" -#include "XrmI.h" - -#if __STDC__ -#define Const const -#else -#define Const /**/ -#endif -#if __STDC__ && !defined(VMS) -#define RConst const -#else -#define RConst /**/ -#endif - -/* - -These Xrm routines allow very fast lookup of resources in the resource -database. Several usage patterns are exploited: - -(1) Widgets get a lot of resources at one time. Rather than look up each from -scratch, we can precompute the prioritized list of database levels once, then -search for each resource starting at the beginning of the list. - -(2) Many database levels don't contain any leaf resource nodes. There is no -point in looking for resources on a level that doesn't contain any. This -information is kept on a per-level basis. - -(3) Sometimes the widget instance tree is structured such that you get the same -class name repeated on the fully qualified widget name. This can result in the -same database level occuring multiple times on the search list. The code below -only checks to see if you get two identical search lists in a row, rather than -look back through all database levels, but in practice this removes all -duplicates I've ever observed. - -Joel McCormack - -*/ - -/* - -The Xrm representation has been completely redesigned to substantially reduce -memory and hopefully improve performance. - -The database is structured into two kinds of tables: LTables that contain -only values, and NTables that contain only other tables. - -Some invariants: - -The next pointer of the top-level node table points to the top-level leaf -table, if any. - -Within an LTable, for a given name, the tight value always precedes the -loose value, and if both are present the loose value is always right after -the tight value. - -Within an NTable, all of the entries for a given name are contiguous, -in the order tight NTable, loose NTable, tight LTable, loose LTable. - -Bob Scheifler - -*/ - -typedef unsigned long Signature; - -static XrmQuark XrmQString, XrmQANY; - -typedef Bool (*DBEnumProc)( -#if NeedNestedPrototypes /* this is Nested on purpose, to match Xlib.h */ - XrmDatabase* /* db */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - XrmRepresentation* /* type */, - XrmValue* /* value */, - XPointer /* closure */ -#endif -); - -typedef struct _VEntry { - struct _VEntry *next; /* next in chain */ - XrmQuark name; /* name of this entry */ - unsigned int tight:1; /* 1 if it is a tight binding */ - unsigned int string:1; /* 1 if type is String */ - unsigned int size:30; /* size of value */ -} VEntryRec, *VEntry; - - -typedef struct _DEntry { - VEntryRec entry; /* entry */ - XrmRepresentation type; /* representation type */ -} DEntryRec, *DEntry; - -/* the value is right after the structure */ -#define StringValue(ve) (XPointer)((ve) + 1) -#define RepType(ve) ((DEntry)(ve))->type -/* the value is right after the structure */ -#define DataValue(ve) (XPointer)(((DEntry)(ve)) + 1) -#define RawValue(ve) (char *)((ve)->string ? StringValue(ve) : DataValue(ve)) - -typedef struct _NTable { - struct _NTable *next; /* next in chain */ - XrmQuark name; /* name of this entry */ - unsigned int tight:1; /* 1 if it is a tight binding */ - unsigned int leaf:1; /* 1 if children are values */ - unsigned int hasloose:1; /* 1 if has loose children */ - unsigned int hasany:1; /* 1 if has ANY entry */ - unsigned int pad:4; /* unused */ - unsigned int mask:8; /* hash size - 1 */ - unsigned int entries:16; /* number of children */ -} NTableRec, *NTable; - -/* the buckets are right after the structure */ -#define NodeBuckets(ne) ((NTable *)((ne) + 1)) -#define NodeHash(ne,q) NodeBuckets(ne)[(q) & (ne)->mask] - -/* leaf tables have an extra level of indirection for the buckets, - * so that resizing can be done without invalidating a search list. - * This is completely ugly, and wastes some memory, but the Xlib - * spec doesn't really specify whether invalidation is OK, and the - * old implementation did not invalidate. - */ -typedef struct _LTable { - NTableRec table; - VEntry *buckets; -} LTableRec, *LTable; - -#define LeafHash(le,q) (le)->buckets[(q) & (le)->table.mask] - -/* An XrmDatabase just holds a pointer to the first top-level table. - * The type name is no longer descriptive, but better to not change - * the Xresource.h header file. This type also gets used to define - * XrmSearchList, which is a complete crock, but we'll just leave it - * and caste types as required. - */ -typedef struct _XrmHashBucketRec { - NTable table; - XPointer mbstate; - XrmMethods methods; -} XrmHashBucketRec; - -/* closure used in get/put resource */ -typedef struct _VClosure { - XrmRepresentation *type; /* type of value */ - XrmValuePtr value; /* value itself */ -} VClosureRec, *VClosure; - -/* closure used in get search list */ -typedef struct _SClosure { - LTable *list; /* search list */ - int idx; /* index of last filled element */ - int limit; /* maximum index */ -} SClosureRec, *SClosure; - -/* placed in XrmSearchList to indicate next table is loose only */ -#define LOOSESEARCH ((LTable)1) - -/* closure used in enumerate database */ -typedef struct _EClosure { - XrmDatabase db; /* the database */ - DBEnumProc proc; /* the user proc */ - XPointer closure; /* the user closure */ - XrmBindingList bindings; /* binding list */ - XrmQuarkList quarks; /* quark list */ - int mode; /* XrmEnum<kind> */ -} EClosureRec, *EClosure; - -/* predicate to determine when to resize a hash table */ -#define GrowthPred(n,m) ((unsigned)(n) > (((m) + 1) << 2)) - -#define GROW(prev) \ - if (GrowthPred((*prev)->entries, (*prev)->mask)) \ - GrowTable(prev) - -/* pick a reasonable value for maximum depth of resource database */ -#define MAXDBDEPTH 100 - -/* macro used in get/search functions */ - -/* find an entry named ename, with leafness given by leaf */ -#define NFIND(ename) \ - q = ename; \ - entry = NodeHash(table, q); \ - while (entry && entry->name != q) \ - entry = entry->next; \ - if (leaf && entry && !entry->leaf) { \ - entry = entry->next; \ - if (entry && !entry->leaf) \ - entry = entry->next; \ - if (entry && entry->name != q) \ - entry = (NTable)NULL; \ - } - -/* resourceQuarks keeps track of what quarks have been associated with values - * in all LTables. If a quark has never been used in an LTable, we don't need - * to bother looking for it. - */ - -static unsigned char *resourceQuarks = (unsigned char *)NULL; -static XrmQuark maxResourceQuark = -1; - -/* determines if a quark has been used for a value in any database */ -#define IsResourceQuark(q) ((q) > 0 && (q) <= maxResourceQuark && \ - resourceQuarks[(q) >> 3] & (1 << ((q) & 7))) - -typedef unsigned char XrmBits; - -#define BSLASH ((XrmBits) (1 << 5)) -#define NORMAL ((XrmBits) (1 << 4)) -#define EOQ ((XrmBits) (1 << 3)) -#define SEP ((XrmBits) (1 << 2)) -#define ENDOF ((XrmBits) (1 << 1)) -#define SPACE (NORMAL|EOQ|SEP|(XrmBits)0) -#define RSEP (NORMAL|EOQ|SEP|(XrmBits)1) -#define EOS (EOQ|SEP|ENDOF|(XrmBits)0) -#define EOL (EOQ|SEP|ENDOF|(XrmBits)1) -#define BINDING (NORMAL|EOQ) -#define ODIGIT (NORMAL|(XrmBits)1) - -#define next_char(ch,str) xrmtypes[(unsigned char)((ch) = *(++(str)))] -#define next_mbchar(ch,len,str) xrmtypes[(unsigned char)(ch = (*db->methods->mbchar)(db->mbstate, str, &len), str += len, ch)] - -#define is_space(bits) ((bits) == SPACE) -#define is_EOQ(bits) ((bits) & EOQ) -#define is_EOF(bits) ((bits) == EOS) -#define is_EOL(bits) ((bits) & ENDOF) -#define is_binding(bits) ((bits) == BINDING) -#define is_odigit(bits) ((bits) == ODIGIT) -#define is_separator(bits) ((bits) & SEP) -#define is_nonpcs(bits) (!(bits)) -#define is_normal(bits) ((bits) & NORMAL) -#define is_simple(bits) ((bits) & (NORMAL|BSLASH)) -#define is_special(bits) ((bits) & (ENDOF|BSLASH)) - -/* parsing types */ -static XrmBits Const xrmtypes[256] = { - EOS,0,0,0,0,0,0,0, - 0,SPACE,EOL,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - SPACE,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,BINDING,NORMAL,NORMAL,NORMAL,BINDING,NORMAL, - ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT, - NORMAL,NORMAL,RSEP,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,BSLASH,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,0 - /* The rest will be automatically initialized to zero. */ -}; - -void XrmInitialize() -{ - XrmQString = XrmPermStringToQuark("String"); - XrmQANY = XrmPermStringToQuark("?"); -} - -#ifdef NOT_IN_SERVER -XrmDatabase XrmGetDatabase(display) - Display *display; -{ - return display->db; -} - -void XrmSetDatabase(display, database) - Display *display; - XrmDatabase database; -{ - display->db = database; -} -#endif /* NOT_IN_SERVER */ - -#if NeedFunctionPrototypes -void XrmStringToQuarkList( - register _Xconst char *name, - register XrmQuarkList quarks) /* RETURN */ -#else -void XrmStringToQuarkList(name, quarks) - register char *name; - register XrmQuarkList quarks; /* RETURN */ -#endif -{ - register XrmBits bits; - register Signature sig = 0; - register char ch, *tname; - register int i = 0; - - if (tname = (char *)name) { - tname--; - while (!is_EOF(bits = next_char(ch, tname))) { - if (is_binding (bits)) { - if (i) { - /* Found a complete name */ - *quarks++ = _XrmInternalStringToQuark(name,tname - name, - sig, False); - i = 0; - sig = 0; - } - name = tname+1; - } - else { - sig = (sig << 1) + ch; /* Compute the signature. */ - i++; - } - } - *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); - } - *quarks = NULLQUARK; -} - -#if NeedFunctionPrototypes -void XrmStringToBindingQuarkList( - register _Xconst char *name, - register XrmBindingList bindings, /* RETURN */ - register XrmQuarkList quarks) /* RETURN */ -#else -void XrmStringToBindingQuarkList(name, bindings, quarks) - register char *name; - register XrmBindingList bindings; /* RETURN */ - register XrmQuarkList quarks; /* RETURN */ -#endif -{ - register XrmBits bits; - register Signature sig = 0; - register char ch, *tname; - register XrmBinding binding; - register int i = 0; - - if (tname = (char *)name) { - tname--; - binding = XrmBindTightly; - while (!is_EOF(bits = next_char(ch, tname))) { - if (is_binding (bits)) { - if (i) { - /* Found a complete name */ - *bindings++ = binding; - *quarks++ = _XrmInternalStringToQuark(name, tname - name, - sig, False); - - i = 0; - sig = 0; - binding = XrmBindTightly; - } - name = tname+1; - - if (ch == '*') - binding = XrmBindLoosely; - } - else { - sig = (sig << 1) + ch; /* Compute the signature. */ - i++; - } - } - *bindings = binding; - *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); - } - *quarks = NULLQUARK; -} - -#ifdef DEBUG - -static void PrintQuarkList(quarks, stream) - XrmQuarkList quarks; - FILE *stream; -{ - Bool firstNameSeen; - - for (firstNameSeen = False; *quarks; quarks++) { - if (firstNameSeen) { - (void) fprintf(stream, "."); - } - firstNameSeen = True; - (void) fputs(XrmQuarkToString(*quarks), stream); - } -} /* PrintQuarkList */ - -#endif /* DEBUG */ - -/*ARGSUSED*/ -static void mbnoop(state) - XPointer state; -{ -} - -/*ARGSUSED*/ -static char mbchar(state, str, lenp) - XPointer state; - char *str; - int *lenp; -{ - *lenp = 1; - return *str; -} - -/*ARGSUSED*/ -static char *lcname(state) - XPointer state; -{ - return "C"; -} - -static RConst XrmMethodsRec mb_methods = { - mbnoop, - mbchar, - mbnoop, - lcname, - mbnoop -}; - -static XrmDatabase NewDatabase() -{ - register XrmDatabase db; - - db = (XrmDatabase) xalloc(sizeof(XrmHashBucketRec)); - if (db) { - db->table = (NTable)NULL; - db->mbstate = (XPointer)NULL; -#ifdef NOT_IN_SERVER - db->methods = _XrmInitParseInfo(&db->mbstate); -#else - db->methods = (XrmMethods) NULL; -#endif /* NOT_IN_SERVER */ - if (!db->methods) - db->methods = (XrmMethods)&mb_methods; - } - return db; -} - -/* move all values from ftable to ttable, and free ftable's buckets. - * ttable is quaranteed empty to start with. - */ -static void MoveValues(ftable, ttable) - LTable ftable; - register LTable ttable; -{ - register VEntry fentry, nfentry; - register VEntry *prev; - register VEntry *bucket; - register VEntry tentry; - register int i; - - for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) { - for (fentry = *bucket++; fentry; fentry = nfentry) { - prev = &LeafHash(ttable, fentry->name); - tentry = *prev; - *prev = fentry; - /* chain on all with same name, to preserve invariant order */ - while ((nfentry = fentry->next) && nfentry->name == fentry->name) - fentry = nfentry; - fentry->next = tentry; - } - } - xfree((char *)ftable->buckets); -} - -/* move all tables from ftable to ttable, and free ftable. - * ttable is quaranteed empty to start with. - */ -static void MoveTables(ftable, ttable) - NTable ftable; - register NTable ttable; -{ - register NTable fentry, nfentry; - register NTable *prev; - register NTable *bucket; - register NTable tentry; - register int i; - - for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--) { - for (fentry = *bucket++; fentry; fentry = nfentry) { - prev = &NodeHash(ttable, fentry->name); - tentry = *prev; - *prev = fentry; - /* chain on all with same name, to preserve invariant order */ - while ((nfentry = fentry->next) && nfentry->name == fentry->name) - fentry = nfentry; - fentry->next = tentry; - } - } - xfree((char *)ftable); -} - -/* grow the table, based on current number of entries */ -static void GrowTable(prev) - NTable *prev; -{ - register NTable table; - register int i; - - table = *prev; - i = table->mask; - if (i == 255) /* biggest it gets */ - return; - while (i < 255 && GrowthPred(table->entries, i)) - i = (i << 1) + 1; - i++; /* i is now the new size */ - if (table->leaf) { - register LTable ltable; - LTableRec otable; - - ltable = (LTable)table; - /* cons up a copy to make MoveValues look symmetric */ - otable = *ltable; - ltable->buckets = (VEntry *)xalloc(i * sizeof(VEntry)); - if (!ltable->buckets) { - ltable->buckets = otable.buckets; - return; - } - ltable->table.mask = i - 1; - bzero((char *)ltable->buckets, i * sizeof(VEntry)); - MoveValues(&otable, ltable); - } else { - register NTable ntable; - - ntable = (NTable)xalloc(sizeof(NTableRec) + i * sizeof(NTable)); - if (!ntable) - return; - *ntable = *table; - ntable->mask = i - 1; - bzero((char *)NodeBuckets(ntable), i * sizeof(NTable)); - *prev = ntable; - MoveTables(table, ntable); - } -} - -/* merge values from ftable into *pprev, destroy ftable in the process */ -static void MergeValues(ftable, pprev, override) - LTable ftable; - NTable *pprev; - Bool override; -{ - register VEntry fentry, tentry; - register VEntry *prev; - register LTable ttable; - VEntry *bucket; - int i; - register XrmQuark q; - - ttable = (LTable)*pprev; - if (ftable->table.hasloose) - ttable->table.hasloose = 1; - for (i = ftable->table.mask, bucket = ftable->buckets; - i >= 0; - i--, bucket++) { - for (fentry = *bucket; fentry; ) { - q = fentry->name; - prev = &LeafHash(ttable, q); - tentry = *prev; - while (tentry && tentry->name != q) - tentry = *(prev = &tentry->next); - /* note: test intentionally uses fentry->name instead of q */ - /* permits serendipitous inserts */ - while (tentry && tentry->name == fentry->name) { - /* if tentry is earlier, skip it */ - if (!fentry->tight && tentry->tight) { - tentry = *(prev = &tentry->next); - continue; - } - if (fentry->tight != tentry->tight) { - /* no match, chain in fentry */ - *prev = fentry; - prev = &fentry->next; - fentry = *prev; - *prev = tentry; - ttable->table.entries++; - } else if (override) { - /* match, chain in fentry, splice out and free tentry */ - *prev = fentry; - prev = &fentry->next; - fentry = *prev; - *prev = tentry->next; - /* free the overridden entry */ - xfree((char *)tentry); - /* get next tentry */ - tentry = *prev; - } else { - /* match, discard fentry */ - prev = &tentry->next; - tentry = fentry; /* use as a temp var */ - fentry = fentry->next; - /* free the overpowered entry */ - xfree((char *)tentry); - /* get next tentry */ - tentry = *prev; - } - if (!fentry) - break; - } - /* at this point, tentry cannot match any fentry named q */ - /* chain in all bindings together, preserve invariant order */ - while (fentry && fentry->name == q) { - *prev = fentry; - prev = &fentry->next; - fentry = *prev; - *prev = tentry; - ttable->table.entries++; - } - } - } - xfree((char *)ftable->buckets); - xfree((char *)ftable); - /* resize if necessary, now that we're all done */ - GROW(pprev); -} - -/* merge tables from ftable into *pprev, destroy ftable in the process */ -static void MergeTables(ftable, pprev, override) - NTable ftable; - NTable *pprev; - Bool override; -{ - register NTable fentry, tentry; - NTable nfentry; - register NTable *prev; - register NTable ttable; - NTable *bucket; - int i; - register XrmQuark q; - - ttable = *pprev; - if (ftable->hasloose) - ttable->hasloose = 1; - if (ftable->hasany) - ttable->hasany = 1; - for (i = ftable->mask, bucket = NodeBuckets(ftable); - i >= 0; - i--, bucket++) { - for (fentry = *bucket; fentry; ) { - q = fentry->name; - prev = &NodeHash(ttable, q); - tentry = *prev; - while (tentry && tentry->name != q) - tentry = *(prev = &tentry->next); - /* note: test intentionally uses fentry->name instead of q */ - /* permits serendipitous inserts */ - while (tentry && tentry->name == fentry->name) { - /* if tentry is earlier, skip it */ - if ((fentry->leaf && !tentry->leaf) || - (!fentry->tight && tentry->tight && - (fentry->leaf || !tentry->leaf))) { - tentry = *(prev = &tentry->next); - continue; - } - nfentry = fentry->next; - if (fentry->leaf != tentry->leaf || - fentry->tight != tentry->tight) { - /* no match, just chain in */ - *prev = fentry; - *(prev = &fentry->next) = tentry; - ttable->entries++; - } else { - if (fentry->leaf) - MergeValues((LTable)fentry, prev, override); - else - MergeTables(fentry, prev, override); - /* bump to next tentry */ - tentry = *(prev = &(*prev)->next); - } - /* bump to next fentry */ - fentry = nfentry; - if (!fentry) - break; - } - /* at this point, tentry cannot match any fentry named q */ - /* chain in all bindings together, preserve invariant order */ - while (fentry && fentry->name == q) { - *prev = fentry; - prev = &fentry->next; - fentry = *prev; - *prev = tentry; - ttable->entries++; - } - } - } - xfree((char *)ftable); - /* resize if necessary, now that we're all done */ - GROW(pprev); -} - -void XrmCombineDatabase(from, into, override) - XrmDatabase from, *into; - Bool override; -{ - register NTable *prev; - register NTable ftable, ttable, nftable; - - if (!*into) { - *into = from; - } else if (from) { - if (ftable = from->table) { - prev = &(*into)->table; - ttable = *prev; - if (!ftable->leaf) { - nftable = ftable->next; - if (ttable && !ttable->leaf) { - /* both have node tables, merge them */ - MergeTables(ftable, prev, override); - /* bump to into's leaf table, if any */ - ttable = *(prev = &(*prev)->next); - } else { - /* into has no node table, link from's in */ - *prev = ftable; - *(prev = &ftable->next) = ttable; - } - /* bump to from's leaf table, if any */ - ftable = nftable; - } else { - /* bump to into's leaf table, if any */ - if (ttable && !ttable->leaf) - ttable = *(prev = &ttable->next); - } - if (ftable) { - /* if into has a leaf, merge, else insert */ - if (ttable) - MergeValues((LTable)ftable, prev, override); - else - *prev = ftable; - } - } - (from->methods->destroy)(from->mbstate); - xfree((char *)from); - } -} - -void XrmMergeDatabases(from, into) - XrmDatabase from, *into; -{ - XrmCombineDatabase(from, into, True); -} - -/* store a value in the database, overriding any existing entry */ -static void PutEntry(db, bindings, quarks, type, value) - XrmDatabase db; - XrmBindingList bindings; - XrmQuarkList quarks; - XrmRepresentation type; - XrmValuePtr value; -{ - register NTable *pprev, *prev; - register NTable table; - register XrmQuark q; - register VEntry *vprev; - register VEntry entry; - NTable *nprev, *firstpprev; - -#define NEWTABLE(q,i) \ - table = (NTable)xalloc(sizeof(LTableRec)); \ - if (!table) \ - return; \ - table->name = q; \ - table->hasloose = 0; \ - table->hasany = 0; \ - table->mask = 0; \ - table->entries = 0; \ - if (quarks[i]) { \ - table->leaf = 0; \ - nprev = NodeBuckets(table); \ - } else { \ - table->leaf = 1; \ - if (!(nprev = (NTable *)xalloc(sizeof(VEntry *)))) \ - return; \ - ((LTable)table)->buckets = (VEntry *)nprev; \ - } \ - *nprev = (NTable)NULL; \ - table->next = *prev; \ - *prev = table - - if (!db || !*quarks) - return; - table = *(prev = &db->table); - /* if already at leaf, bump to the leaf table */ - if (!quarks[1] && table && !table->leaf) - table = *(prev = &table->next); - pprev = prev; - if (!table || (quarks[1] && table->leaf)) { - /* no top-level node table, create one and chain it in */ - NEWTABLE(NULLQUARK,1); - table->tight = 1; /* arbitrary */ - prev = nprev; - } else { - /* search along until we need a value */ - while (quarks[1]) { - q = *quarks; - table = *(prev = &NodeHash(table, q)); - while (table && table->name != q) - table = *(prev = &table->next); - if (!table) - break; /* not found */ - if (quarks[2]) { - if (table->leaf) - break; /* not found */ - } else { - if (!table->leaf) { - /* bump to leaf table, if any */ - table = *(prev = &table->next); - if (!table || table->name != q) - break; /* not found */ - if (!table->leaf) { - /* bump to leaf table, if any */ - table = *(prev = &table->next); - if (!table || table->name != q) - break; /* not found */ - } - } - } - if (*bindings == XrmBindTightly) { - if (!table->tight) - break; /* not found */ - } else { - if (table->tight) { - /* bump to loose table, if any */ - table = *(prev = &table->next); - if (!table || table->name != q || - !quarks[2] != table->leaf) - break; /* not found */ - } - } - /* found that one, bump to next quark */ - pprev = prev; - quarks++; - bindings++; - } - if (!quarks[1]) { - /* found all the way to a leaf */ - q = *quarks; - entry = *(vprev = &LeafHash((LTable)table, q)); - while (entry && entry->name != q) - entry = *(vprev = &entry->next); - /* if want loose and have tight, bump to next entry */ - if (entry && *bindings == XrmBindLoosely && entry->tight) - entry = *(vprev = &entry->next); - if (entry && entry->name == q && - (*bindings == XrmBindTightly) == entry->tight) { - /* match, need to override */ - if ((type == XrmQString) == entry->string && - entry->size == value->size) { - /* update type if not String, can be different */ - if (!entry->string) - RepType(entry) = type; - /* identical size, just overwrite value */ - bcopy((char *)value->addr, RawValue(entry), value->size); - return; - } - /* splice out and free old entry */ - *vprev = entry->next; - xfree((char *)entry); - (*pprev)->entries--; - } - /* this is where to insert */ - prev = (NTable *)vprev; - } - } - /* keep the top table, because we may have to grow it */ - firstpprev = pprev; - /* iterate until we get to the leaf */ - while (quarks[1]) { - /* build a new table and chain it in */ - NEWTABLE(*quarks,2); - if (*quarks++ == XrmQANY) - (*pprev)->hasany = 1; - if (*bindings++ == XrmBindTightly) { - table->tight = 1; - } else { - table->tight = 0; - (*pprev)->hasloose = 1; - } - (*pprev)->entries++; - pprev = prev; - prev = nprev; - } - /* now allocate the value entry */ - entry = (VEntry)xalloc(((type == XrmQString) ? - sizeof(VEntryRec) : sizeof(DEntryRec)) + - value->size); - if (!entry) - return; - entry->name = q = *quarks; - if (*bindings == XrmBindTightly) { - entry->tight = 1; - } else { - entry->tight = 0; - (*pprev)->hasloose = 1; - } - /* chain it in, with a bit of type cast ugliness */ - entry->next = *((VEntry *)prev); - *((VEntry *)prev) = entry; - entry->size = value->size; - if (type == XrmQString) { - entry->string = 1; - } else { - entry->string = 0; - RepType(entry) = type; - } - /* save a copy of the value */ - bcopy((char *)value->addr, RawValue(entry), value->size); - (*pprev)->entries++; - /* this is a new leaf, need to remember it for search lists */ - if (q > maxResourceQuark) { - unsigned oldsize = (maxResourceQuark + 1) >> 3; - unsigned size = ((q | 0x7f) + 1) >> 3; /* reallocate in chunks */ - if (resourceQuarks) - resourceQuarks = (unsigned char *)xrealloc((char *)resourceQuarks, - size); - else - resourceQuarks = (unsigned char *)xalloc(size); - if (resourceQuarks) { - bzero((char *)&resourceQuarks[oldsize], size - oldsize); - maxResourceQuark = (size << 3) - 1; - } else { - maxResourceQuark = -1; - } - } - if (q > 0 && resourceQuarks) - resourceQuarks[q >> 3] |= 1 << (q & 0x7); - GROW(firstpprev); - -#undef NEWTABLE -} - -void XrmQPutResource(pdb, bindings, quarks, type, value) - XrmDatabase *pdb; - XrmBindingList bindings; - XrmQuarkList quarks; - XrmRepresentation type; - XrmValuePtr value; -{ - if (!*pdb) *pdb = NewDatabase(); - PutEntry(*pdb, bindings, quarks, type, value); -} - -#if NeedFunctionPrototypes -void XrmPutResource( - XrmDatabase *pdb, - _Xconst char *specifier, - _Xconst char *type, - XrmValuePtr value) -#else -void XrmPutResource(pdb, specifier, type, value) - XrmDatabase *pdb; - char *specifier; - char *type; - XrmValuePtr value; -#endif -{ - XrmBinding bindings[MAXDBDEPTH+1]; - XrmQuark quarks[MAXDBDEPTH+1]; - - if (!*pdb) *pdb = NewDatabase(); - XrmStringToBindingQuarkList(specifier, bindings, quarks); - PutEntry(*pdb, bindings, quarks, XrmStringToQuark(type), value); -} - -#if NeedFunctionPrototypes -void XrmQPutStringResource( - XrmDatabase *pdb, - XrmBindingList bindings, - XrmQuarkList quarks, - _Xconst char *str) -#else -void XrmQPutStringResource(pdb, bindings, quarks, str) - XrmDatabase *pdb; - XrmBindingList bindings; - XrmQuarkList quarks; - char *str; -#endif -{ - XrmValue value; - - if (!*pdb) *pdb = NewDatabase(); - value.addr = (XPointer) str; - value.size = strlen(str)+1; - PutEntry(*pdb, bindings, quarks, XrmQString, &value); -} - -/* Function Name: GetDatabase - * Description: Parses a string and stores it as a database. - * Arguments: db - the database. - * str - a pointer to the string containing the database. - * filename - source filename, if any. - * doall - whether to do all lines or just one - */ - -/* - * This function is highly optimized to inline as much as possible. - * Be very careful with modifications, or simplifications, as they - * may adversely affect the performance. - * - * Chris Peterson, MIT X Consortium 5/17/90. - */ - -/* - * Xlib spec says max 100 quarks in a lookup, will stop and return if - * return if any single production's lhs has more than 100 components. - */ -#define QLIST_SIZE 100 - -/* - * This should be big enough to handle things like the XKeysymDB or biggish - * ~/.Xdefaults or app-defaults files. Anything bigger will be allocated on - * the heap. - */ -#define DEF_BUFF_SIZE 8192 - -static void GetIncludeFile(); - -static void GetDatabase(db, str, filename, doall) - XrmDatabase db; - register char *str; - char *filename; - Bool doall; -{ - char *rhs; - char *lhs, lhs_s[DEF_BUFF_SIZE]; - XrmQuark quarks[QLIST_SIZE + 1]; /* allow for a terminal NullQuark */ - XrmBinding bindings[QLIST_SIZE + 1]; - - register char *ptr; - register XrmBits bits = 0; - register char c; - register Signature sig; - register char *ptr_max; - register int num_quarks; - register XrmBindingList t_bindings; - - int len, alloc_chars; - unsigned long str_len; - XrmValue value; - Bool only_pcs; - Bool dolines; - - if (!db) - return; - - /* - * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for - * speed otherwise malloc the buffer. From a buffer overflow standpoint - * we can be sure that neither: a) a component on the lhs, or b) a - * value on the rhs, will be longer than the overall length of str, - * i.e. strlen(str). - * - * This should give good performance when parsing "*foo: bar" type - * databases as might be passed with -xrm command line options; but - * with larger databases, e.g. .Xdefaults, app-defaults, or KeysymDB - * files, the size of the buffers will be overly large. One way - * around this would be to double-parse each production with a resulting - * performance hit. In any event we can be assured that a lhs component - * name or a rhs value won't be longer than str itself. - */ - - str_len = strlen (str); - if (DEF_BUFF_SIZE > str_len) lhs = lhs_s; - else if ((lhs = (char*) xalloc (str_len)) == NULL) - return; - - alloc_chars = DEF_BUFF_SIZE < str_len ? str_len : DEF_BUFF_SIZE; - if ((rhs = (char*) xalloc (alloc_chars)) == NULL) { - if (lhs != lhs_s) Xfree (lhs); - return; - } - - (*db->methods->mbinit)(db->mbstate); - str--; - dolines = True; - while (!is_EOF(bits) && dolines) { - dolines = doall; - - /* - * First: Remove extra whitespace. - */ - - do { - bits = next_char(c, str); - } while is_space(bits); - - /* - * Ignore empty lines. - */ - - if (is_EOL(bits)) - continue; /* start a new line. */ - - /* - * Second: check the first character in a line to see if it is - * "!" signifying a comment, or "#" signifying a directive. - */ - - if (c == '!') { /* Comment, spin to next newline */ - while (is_simple(bits = next_char(c, str))) {} - if (is_EOL(bits)) - continue; - while (!is_EOL(bits = next_mbchar(c, len, str))) {} - str--; - continue; /* start a new line. */ - } - - if (c == '#') { /* Directive */ - /* remove extra whitespace */ - only_pcs = True; - while (is_space(bits = next_char(c, str))) {}; - /* only "include" directive is currently defined */ - if (!strncmp(str, "include", 7)) { - str += (7-1); - /* remove extra whitespace */ - while (is_space(bits = next_char(c, str))) {}; - /* must have a starting " */ - if (c == '"') { - char *fname = str+1; - len = 0; - do { - if (only_pcs) { - bits = next_char(c, str); - if (is_nonpcs(bits)) - only_pcs = False; - } - if (!only_pcs) - bits = next_mbchar(c, len, str); - } while (c != '"' && !is_EOL(bits)); - /* must have an ending " */ - if (c == '"') - GetIncludeFile(db, filename, fname, str - len - fname); - } - } - /* spin to next newline */ - if (only_pcs) { - while (is_simple(bits)) - bits = next_char(c, str); - if (is_EOL(bits)) - continue; - } - while (!is_EOL(bits)) - bits = next_mbchar(c, len, str); - str--; - continue; /* start a new line. */ - } - - /* - * Third: loop through the LHS of the resource specification - * storing characters and converting this to a Quark. - */ - - num_quarks = 0; - t_bindings = bindings; - - sig = 0; - ptr = lhs; - *t_bindings = XrmBindTightly; - for(;;) { - if (!is_binding(bits)) { - while (!is_EOQ(bits)) { - *ptr++ = c; - sig = (sig << 1) + c; /* Compute the signature. */ - bits = next_char(c, str); - } - - quarks[num_quarks++] = - _XrmInternalStringToQuark(lhs, ptr - lhs, sig, False); - - if (num_quarks > QLIST_SIZE) { - Xfree(rhs); - if (lhs != lhs_s) Xfree (lhs); - (*db->methods->mbfinish)(db->mbstate); - return; - } - - if (is_separator(bits)) { - if (!is_space(bits)) - break; - - /* Remove white space */ - do { - *ptr++ = c; - sig = (sig << 1) + c; /* Compute the signature. */ - } while (is_space(bits = next_char(c, str))); - - /* - * The spec doesn't permit it, but support spaces - * internal to resource name/class - */ - - if (is_separator(bits)) - break; - num_quarks--; - continue; - } - - if (c == '.') - *(++t_bindings) = XrmBindTightly; - else - *(++t_bindings) = XrmBindLoosely; - - sig = 0; - ptr = lhs; - } - else { - /* - * Magic unspecified feature #254. - * - * If two separators appear with no Text between them then - * ignore them. - * - * If anyone of those separators is a '*' then the binding - * will be loose, otherwise it will be tight. - */ - - if (c == '*') - *t_bindings = XrmBindLoosely; - } - - bits = next_char(c, str); - } - - quarks[num_quarks] = NULLQUARK; - - /* - * Make sure that there is a ':' in this line. - */ - - if (c != ':') { - char oldc; - - /* - * A parsing error has occured, toss everything on the line - * a new_line can still be escaped with a '\'. - */ - - while (is_normal(bits)) - bits = next_char(c, str); - if (is_EOL(bits)) - continue; - bits = next_mbchar(c, len, str); - do { - oldc = c; - bits = next_mbchar(c, len, str); - } while (c && (c != '\n' || oldc == '\\')); - str--; - continue; - } - - /* - * I now have a quark and binding list for the entire left hand - * side. "c" currently points to the ":" separating the left hand - * side for the right hand side. It is time to begin processing - * the right hand side. - */ - - /* - * Fourth: Remove more whitespace - */ - - for(;;) { - if (is_space(bits = next_char(c, str))) - continue; - if (c != '\\') - break; - bits = next_char(c, str); - if (c == '\n') - continue; - str--; - bits = BSLASH; - c = '\\'; - break; - } - - /* - * Fifth: Process the right hand side. - */ - - ptr = rhs; - ptr_max = ptr + alloc_chars - 4; - only_pcs = True; - len = 1; - - for(;;) { - - /* - * Tight loop for the normal case: Non backslash, non-end of value - * character that will fit into the allocated buffer. - */ - - if (only_pcs) { - while (is_normal(bits) && ptr < ptr_max) { - *ptr++ = c; - bits = next_char(c, str); - } - if (is_EOL(bits)) - break; - if (is_nonpcs(bits)) { - only_pcs = False; - bits = next_mbchar(c, len, str); - } - } - while (!is_special(bits) && ptr + len <= ptr_max) { - len = -len; - while (len) - *ptr++ = str[len++]; - bits = next_mbchar(c, len, str); - } - - if (is_EOL(bits)) { - str--; - break; - } - - if (c == '\\') { - /* - * We need to do some magic after a backslash. - */ - - if (only_pcs) { - bits = next_char(c, str); - if (is_nonpcs(bits)) - only_pcs = False; - } - if (!only_pcs) - bits = next_mbchar(c, len, str); - - if (is_EOL(bits)) { - if (is_EOF(bits)) - continue; - } else if (c == 'n') { - /* - * "\n" means insert a newline. - */ - *ptr++ = '\n'; - } else if (c == '\\') { - /* - * "\\" completes to just one backslash. - */ - *ptr++ = '\\'; - } else { - /* - * pick up to three octal digits after the '\'. - */ - char temp[3]; - int count = 0; - while (is_odigit(bits) && count < 3) { - temp[count++] = c; - if (only_pcs) { - bits = next_char(c, str); - if (is_nonpcs(bits)) - only_pcs = False; - } - if (!only_pcs) - bits = next_mbchar(c, len, str); - } - - /* - * If we found three digits then insert that octal code - * into the value string as a character. - */ - - if (count == 3) { - *ptr++ = (unsigned char) ((temp[0] - '0') * 0100 + - (temp[1] - '0') * 010 + - (temp[2] - '0')); - } - else { - int tcount; - - /* - * Otherwise just insert those characters into the - * string, since no special processing is needed on - * numerics we can skip the special processing. - */ - - for (tcount = 0; tcount < count; tcount++) { - *ptr++ = temp[tcount]; /* print them in - the correct order */ - } - } - continue; - } - if (only_pcs) { - bits = next_char(c, str); - if (is_nonpcs(bits)) - only_pcs = False; - } - if (!only_pcs) - bits = next_mbchar(c, len, str); - } - - /* - * It is important to make sure that there is room for at least - * four more characters in the buffer, since I can add that - * many characters into the buffer after a backslash has occured. - */ - - if (ptr + len > ptr_max) { - char * temp_str; - - alloc_chars += BUFSIZ/10; - temp_str = (char *)xrealloc(rhs, sizeof(char) * alloc_chars); - - if (!temp_str) { - xfree(rhs); - if (lhs != lhs_s) xfree(lhs); - (*db->methods->mbfinish)(db->mbstate); - return; - } - - ptr = temp_str + (ptr - rhs); /* reset pointer. */ - rhs = temp_str; - ptr_max = rhs + alloc_chars - 4; - } - } - - /* - * Lastly: Terminate the value string, and store this entry - * into the database. - */ - - *ptr++ = '\0'; - - /* Store it in database */ - value.size = ptr - rhs; - value.addr = (XPointer) rhs; - - PutEntry(db, bindings, quarks, XrmQString, &value); - } - - if (lhs != lhs_s) xfree (lhs); - xfree(rhs); - (*db->methods->mbfinish)(db->mbstate); -} - -#if NeedFunctionPrototypes -void XrmPutStringResource( - XrmDatabase *pdb, - _Xconst char*specifier, - _Xconst char*str) -#else -void XrmPutStringResource(pdb, specifier, str) - XrmDatabase *pdb; - char *specifier; - char *str; -#endif -{ - XrmValue value; - XrmBinding bindings[MAXDBDEPTH+1]; - XrmQuark quarks[MAXDBDEPTH+1]; - - if (!*pdb) *pdb = NewDatabase(); - XrmStringToBindingQuarkList(specifier, bindings, quarks); - value.addr = (XPointer) str; - value.size = strlen(str)+1; - PutEntry(*pdb, bindings, quarks, XrmQString, &value); -} - - -#if NeedFunctionPrototypes -void XrmPutLineResource( - XrmDatabase *pdb, - _Xconst char*line) -#else -void XrmPutLineResource(pdb, line) - XrmDatabase *pdb; - char *line; -#endif -{ - if (!*pdb) *pdb = NewDatabase(); - GetDatabase(*pdb, line, (char *)NULL, False); -} - -#if NeedFunctionPrototypes -XrmDatabase XrmGetStringDatabase( - _Xconst char *data) -#else -XrmDatabase XrmGetStringDatabase(data) - char *data; -#endif -{ - XrmDatabase db; - - db = NewDatabase(); - GetDatabase(db, data, (char *)NULL, True); - return db; -} - -/* Function Name: ReadInFile - * Description: Reads the file into a buffer. - * Arguments: filename - the name of the file. - * Returns: An allocated string containing the contents of the file. - */ - -static char * -ReadInFile(filename) -char * filename; -{ - register int fd, size; - char * filebuf; - - if ( (fd = OpenFile(filename)) == -1 ) - return (char *)NULL; - - GetSizeOfFile(filename, size); - - if (!(filebuf = (char *)xalloc(size + 1))) { /* leave room for '\0' */ - close(fd); - return (char *)NULL; - } - - if (ReadFile(fd, filebuf, size) != size) { /* If we didn't read the - correct number of bytes. */ - CloseFile(fd); - xfree(filebuf); - return (char *)NULL; - } - CloseFile(fd); - - filebuf[size] = '\0'; /* NULL terminate it. */ - return filebuf; -} - -static void -GetIncludeFile(db, base, fname, fnamelen) - XrmDatabase db; - char *base; - char *fname; - int fnamelen; -{ - int len; - char *str; - char realfname[BUFSIZ]; - - if (fnamelen <= 0 || fnamelen >= BUFSIZ) - return; - if (*fname != '/' && base && (str = rindex(base, '/'))) { - len = str - base + 1; - if (len + fnamelen >= BUFSIZ) - return; - strncpy(realfname, base, len); - strncpy(realfname + len, fname, fnamelen); - realfname[len + fnamelen] = '\0'; - } else { - strncpy(realfname, fname, fnamelen); - realfname[fnamelen] = '\0'; - } - if (!(str = ReadInFile(realfname))) - return; - GetDatabase(db, str, realfname, True); - xfree(str); -} - -#if NeedFunctionPrototypes -XrmDatabase XrmGetFileDatabase( - _Xconst char *filename) -#else -XrmDatabase XrmGetFileDatabase(filename) - char *filename; -#endif -{ - XrmDatabase db; - char *str; - - if (!(str = ReadInFile(filename))) - return (XrmDatabase)NULL; - - db = NewDatabase(); - GetDatabase(db, str, filename, True); - xfree(str); - return db; -} - -#if NeedFunctionPrototypes -Status XrmCombineFileDatabase( - _Xconst char *filename, - XrmDatabase *target, - Bool override) -#else -Status XrmCombineFileDatabase(filename, target, override) - char *filename; - XrmDatabase *target; - Bool override; -#endif -{ - XrmDatabase db; - char *str; - - if (!(str = ReadInFile(filename))) - return 0; - if (override) { - db = *target; - if (!db) - *target = db = NewDatabase(); - } else - db = NewDatabase(); - GetDatabase(db, str, filename, True); - xfree(str); - if (!override) - XrmCombineDatabase(db, target, False); - return 1; -} - -/* call the user proc for every value in the table, arbitrary order. - * stop if user proc returns True. level is current depth in database. - */ -/*ARGSUSED*/ -static Bool EnumLTable(table, names, classes, level, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - register int level; - register EClosure closure; -{ - register VEntry *bucket; - register int i; - register VEntry entry; - XrmValue value; - XrmRepresentation type; - Bool tightOk; - - closure->bindings[level] = (table->table.tight ? - XrmBindTightly : XrmBindLoosely); - closure->quarks[level] = table->table.name; - level++; - tightOk = !*names; - closure->quarks[level + 1] = NULLQUARK; - for (i = table->table.mask, bucket = table->buckets; - i >= 0; - i--, bucket++) { - for (entry = *bucket; entry; entry = entry->next) { - if (entry->tight && !tightOk) - continue; - closure->bindings[level] = (entry->tight ? - XrmBindTightly : XrmBindLoosely); - closure->quarks[level] = entry->name; - value.size = entry->size; - if (entry->string) { - type = XrmQString; - value.addr = StringValue(entry); - } else { - type = RepType(entry); - value.addr = DataValue(entry); - } - if ((*closure->proc)(&closure->db, closure->bindings+1, - closure->quarks+1, &type, &value, - closure->closure)) - return True; - } - } - return False; -} - -static Bool EnumAllNTable(table, level, closure) - NTable table; - register int level; - register EClosure closure; -{ - register NTable *bucket; - register int i; - register NTable entry; - XrmQuark empty = NULLQUARK; - - if (level >= MAXDBDEPTH) - return False; - for (i = table->mask, bucket = NodeBuckets(table); - i >= 0; - i--, bucket++) { - for (entry = *bucket; entry; entry = entry->next) { - if (entry->leaf) { - if (EnumLTable((LTable)entry, &empty, &empty, level, closure)) - return True; - } else { - closure->bindings[level] = (entry->tight ? - XrmBindTightly : XrmBindLoosely); - closure->quarks[level] = entry->name; - if (EnumAllNTable(entry, level+1, closure)) - return True; - } - } - } - return False; -} - -/* recurse on every table in the table, arbitrary order. - * stop if user proc returns True. level is current depth in database. - */ -static Bool EnumNTable(table, names, classes, level, closure) - NTable table; - XrmNameList names; - XrmClassList classes; - register int level; - register EClosure closure; -{ - register NTable entry; - register XrmQuark q; - register unsigned int leaf; - Bool (*get)(); - Bool bilevel; - -/* find entries named ename, leafness leaf, tight or loose, and call get */ -#define ITIGHTLOOSE(ename) \ - NFIND(ename); \ - if (entry) { \ - if (leaf == entry->leaf) { \ - if (!leaf && !entry->tight && entry->next && \ - entry->next->name == q && entry->next->tight && \ - (bilevel || entry->next->hasloose) && \ - EnumLTable((LTable)entry->next, names+1, classes+1, \ - level, closure)) \ - return True; \ - if ((*get)(entry, names+1, classes+1, level, closure)) \ - return True; \ - if (entry->tight && (entry = entry->next) && \ - entry->name == q && leaf == entry->leaf && \ - (*get)(entry, names+1, classes+1, level, closure)) \ - return True; \ - } else if (entry->leaf) { \ - if ((bilevel || entry->hasloose) && \ - EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ - return True; \ - if (entry->tight && (entry = entry->next) && \ - entry->name == q && (bilevel || entry->hasloose) && \ - EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ - return True; \ - } \ - } - -/* find entries named ename, leafness leaf, loose only, and call get */ -#define ILOOSE(ename) \ - NFIND(ename); \ - if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ - entry = (NTable)NULL; \ - if (entry) { \ - if (leaf == entry->leaf) { \ - if ((*get)(entry, names+1, classes+1, level, closure)) \ - return True; \ - } else if (entry->leaf && (bilevel || entry->hasloose)) { \ - if (EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ - return True; \ - } \ - } - - if (level >= MAXDBDEPTH) - return False; - closure->bindings[level] = (table->tight ? - XrmBindTightly : XrmBindLoosely); - closure->quarks[level] = table->name; - level++; - if (!*names) { - if (EnumAllNTable(table, level, closure)) - return True; - } else { - if (names[1] || closure->mode == XrmEnumAllLevels) { - get = EnumNTable; /* recurse */ - leaf = 0; - bilevel = !names[1]; - } else { - get = EnumLTable; /* bottom of recursion */ - leaf = 1; - bilevel = False; - } - if (table->hasloose && closure->mode == XrmEnumAllLevels) { - NTable *bucket; - int i; - XrmQuark empty = NULLQUARK; - - for (i = table->mask, bucket = NodeBuckets(table); - i >= 0; - i--, bucket++) { - q = NULLQUARK; - for (entry = *bucket; entry; entry = entry->next) { - if (!entry->tight && entry->name != q && - entry->name != *names && entry->name != *classes) { - q = entry->name; - if (entry->leaf) { - if (EnumLTable((LTable)entry, &empty, &empty, - level, closure)) - return True; - } else { - if (EnumNTable(entry, &empty, &empty, - level, closure)) - return True; - } - } - } - } - } - - ITIGHTLOOSE(*names); /* do name, tight and loose */ - ITIGHTLOOSE(*classes); /* do class, tight and loose */ - if (table->hasany) { - ITIGHTLOOSE(XrmQANY); /* do ANY, tight and loose */ - } - if (table->hasloose) { - while (1) { - names++; - classes++; - if (!*names) - break; - if (!names[1] && closure->mode != XrmEnumAllLevels) { - get = EnumLTable; /* bottom of recursion */ - leaf = 1; - } - ILOOSE(*names); /* loose names */ - ILOOSE(*classes); /* loose classes */ - if (table->hasany) { - ILOOSE(XrmQANY); /* loose ANY */ - } - } - names--; - classes--; - } - } - /* now look for matching leaf nodes */ - entry = table->next; - if (!entry) - return False; - if (entry->leaf) { - if (entry->tight && !table->tight) - entry = entry->next; - } else { - entry = entry->next; - if (!entry || !entry->tight) - return False; - } - if (!entry || entry->name != table->name) - return False; - /* found one */ - level--; - if ((!*names || entry->hasloose) && - EnumLTable((LTable)entry, names, classes, level, closure)) - return True; - if (entry->tight && entry == table->next && (entry = entry->next) && - entry->name == table->name && (!*names || entry->hasloose)) - return EnumLTable((LTable)entry, names, classes, level, closure); - return False; - -#undef ITIGHTLOOSE -#undef ILOOSE -} - -/* call the proc for every value in the database, arbitrary order. - * stop if the proc returns True. - */ -Bool XrmEnumerateDatabase(db, names, classes, mode, proc, closure) - XrmDatabase db; - XrmNameList names; - XrmClassList classes; - int mode; - DBEnumProc proc; - XPointer closure; -{ - XrmBinding bindings[MAXDBDEPTH+2]; - XrmQuark quarks[MAXDBDEPTH+2]; - register NTable table; - EClosureRec eclosure; - - if (!db) - return False; - eclosure.db = db; - eclosure.proc = proc; - eclosure.closure = closure; - eclosure.bindings = bindings; - eclosure.quarks = quarks; - eclosure.mode = mode; - table = db->table; - if (table && !table->leaf && !*names && mode == XrmEnumOneLevel) - table = table->next; - if (table) { - if (!table->leaf) - return EnumNTable(table, names, classes, 0, &eclosure); - else - return EnumLTable((LTable)table, names, classes, 0, &eclosure); - } - return False; -} - -static void PrintBindingQuarkList(bindings, quarks, stream) - XrmBindingList bindings; - XrmQuarkList quarks; - FILE *stream; -{ - Bool firstNameSeen; - - for (firstNameSeen = False; *quarks; bindings++, quarks++) { - if (*bindings == XrmBindLoosely) { - (void) fprintf(stream, "*"); - } else if (firstNameSeen) { - (void) fprintf(stream, "."); - } - firstNameSeen = True; - (void) fputs(XrmQuarkToString(*quarks), stream); - } -} - -/* output out the entry in correct file syntax */ -/*ARGSUSED*/ -static Bool DumpEntry(db, bindings, quarks, type, value, data) - XrmDatabase *db; - XrmBindingList bindings; - XrmQuarkList quarks; - XrmRepresentation *type; - XrmValuePtr value; - XPointer data; -{ - FILE *stream = (FILE *)data; - register unsigned int i; - register char *s; - register char c; - - if (*type != XrmQString) - (void) putc('!', stream); - PrintBindingQuarkList(bindings, quarks, stream); - s = value->addr; - i = value->size; - if (*type == XrmQString) { - (void) fputs(":\t", stream); - if (i) - i--; - } - else - fprintf(stream, "=%s:\t", XrmRepresentationToString(*type)); - if (i && (*s == ' ' || *s == '\t')) - (void) putc('\\', stream); /* preserve leading whitespace */ - while (i--) { - c = *s++; - if (c == '\n') { - if (i) - (void) fputs("\\n\\\n", stream); - else - (void) fputs("\\n", stream); - } else if (c == '\\') - (void) fputs("\\\\", stream); - else if ((c < ' ' && c != '\t') || - ((unsigned char)c >= 0x7f && (unsigned char)c < 0xa0)) - (void) fprintf(stream, "\\%03o", (unsigned char)c); - else - (void) putc(c, stream); - } - (void) putc('\n', stream); - return False; -} - -#ifdef DEBUG - -void PrintTable(table, file) - NTable table; - FILE *file; -{ - XrmBinding bindings[MAXDBDEPTH+1]; - XrmQuark quarks[MAXDBDEPTH+1]; - EClosureRec closure; - XrmQuark empty = NULLQUARK; - - closure.db = (XrmDatabase)NULL; - closure.proc = DumpEntry; - closure.closure = (XPointer)file; - closure.bindings = bindings; - closure.quarks = quarks; - closure.mode = XrmEnumAllLevels; - if (table->leaf) - EnumLTable((LTable)table, &empty, &empty, 0, &closure); - else - EnumNTable(table, &empty, &empty, 0, &closure); -} - -#endif /* DEBUG */ - -#if NeedFunctionPrototypes -void XrmPutFileDatabase( - XrmDatabase db, - _Xconst char *fileName) -#else -void XrmPutFileDatabase(db, fileName) - XrmDatabase db; - char *fileName; -#endif -{ - FILE *file; - XrmQuark empty = NULLQUARK; - - if (!db) return; - if (!(file = fopen(fileName, "w"))) return; - (void)XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels, - DumpEntry, (XPointer) file); - fclose(file); -} - -/* macros used in get/search functions */ - -/* find entries named ename, leafness leaf, tight or loose, and call get */ -#define GTIGHTLOOSE(ename,looseleaf) \ - NFIND(ename); \ - if (entry) { \ - if (leaf == entry->leaf) { \ - if (!leaf && !entry->tight && entry->next && \ - entry->next->name == q && entry->next->tight && \ - entry->next->hasloose && \ - looseleaf((LTable)entry->next, names+1, classes+1, closure)) \ - return True; \ - if ((*get)(entry, names+1, classes+1, closure)) \ - return True; \ - if (entry->tight && (entry = entry->next) && \ - entry->name == q && leaf == entry->leaf && \ - (*get)(entry, names+1, classes+1, closure)) \ - return True; \ - } else if (entry->leaf) { \ - if (entry->hasloose && \ - looseleaf((LTable)entry, names+1, classes+1, closure)) \ - return True; \ - if (entry->tight && (entry = entry->next) && \ - entry->name == q && entry->hasloose && \ - looseleaf((LTable)entry, names+1, classes+1, closure)) \ - return True; \ - } \ - } - -/* find entries named ename, leafness leaf, loose only, and call get */ -#define GLOOSE(ename,looseleaf) \ - NFIND(ename); \ - if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ - entry = (NTable)NULL; \ - if (entry) { \ - if (leaf == entry->leaf) { \ - if ((*get)(entry, names+1, classes+1, closure)) \ - return True; \ - } else if (entry->leaf && entry->hasloose) { \ - if (looseleaf((LTable)entry, names+1, classes+1, closure)) \ - return True; \ - } \ - } - -/* add tight/loose entry to the search list, return True if list is full */ -/*ARGSUSED*/ -static Bool AppendLEntry(table, names, classes, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - register SClosure closure; -{ - /* check for duplicate */ - if (closure->idx >= 0 && closure->list[closure->idx] == table) - return False; - if (closure->idx == closure->limit) - return True; - /* append it */ - closure->idx++; - closure->list[closure->idx] = table; - return False; -} - -/* add loose entry to the search list, return True if list is full */ -/*ARGSUSED*/ -static Bool AppendLooseLEntry(table, names, classes, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - register SClosure closure; -{ - /* check for duplicate */ - if (closure->idx >= 0 && closure->list[closure->idx] == table) - return False; - if (closure->idx >= closure->limit - 1) - return True; - /* append it */ - closure->idx++; - closure->list[closure->idx] = LOOSESEARCH; - closure->idx++; - closure->list[closure->idx] = table; - return False; -} - -/* search for a leaf table */ -static Bool SearchNEntry(table, names, classes, closure) - NTable table; - XrmNameList names; - XrmClassList classes; - SClosure closure; -{ - register NTable entry; - register XrmQuark q; - register unsigned int leaf; - Bool (*get)(); - - if (names[1]) { - get = SearchNEntry; /* recurse */ - leaf = 0; - } else { - get = AppendLEntry; /* bottom of recursion */ - leaf = 1; - } - GTIGHTLOOSE(*names, AppendLooseLEntry); /* do name, tight and loose */ - GTIGHTLOOSE(*classes, AppendLooseLEntry); /* do class, tight and loose */ - if (table->hasany) { - GTIGHTLOOSE(XrmQANY, AppendLooseLEntry); /* do ANY, tight and loose */ - } - if (table->hasloose) { - while (1) { - names++; - classes++; - if (!*names) - break; - if (!names[1]) { - get = AppendLEntry; /* bottom of recursion */ - leaf = 1; - } - GLOOSE(*names, AppendLooseLEntry); /* loose names */ - GLOOSE(*classes, AppendLooseLEntry); /* loose classes */ - if (table->hasany) { - GLOOSE(XrmQANY, AppendLooseLEntry); /* loose ANY */ - } - } - } - /* now look for matching leaf nodes */ - entry = table->next; - if (!entry) - return False; - if (entry->leaf) { - if (entry->tight && !table->tight) - entry = entry->next; - } else { - entry = entry->next; - if (!entry || !entry->tight) - return False; - } - if (!entry || entry->name != table->name) - return False; - /* found one */ - if (entry->hasloose && - AppendLooseLEntry((LTable)entry, names, classes, closure)) - return True; - if (entry->tight && entry == table->next && (entry = entry->next) && - entry->name == table->name && entry->hasloose) - return AppendLooseLEntry((LTable)entry, names, classes, closure); - return False; -} - -Bool XrmQGetSearchList(db, names, classes, searchList, listLength) - XrmDatabase db; - XrmNameList names; - XrmClassList classes; - XrmSearchList searchList; /* RETURN */ - int listLength; -{ - register NTable table; - SClosureRec closure; - - if (listLength <= 0) - return False; - closure.list = (LTable *)searchList; - closure.idx = -1; - closure.limit = listLength - 2; - if (db) { - table = db->table; - if (*names) { - if (table && !table->leaf) { - if (SearchNEntry(table, names, classes, &closure)) - return False; - } else if (table && table->hasloose && - AppendLooseLEntry((LTable)table, names, classes, - &closure)) - return False; - } else { - if (table && !table->leaf) - table = table->next; - if (table && AppendLEntry((LTable)table, names, classes, &closure)) - return False; - } - } - closure.list[closure.idx + 1] = (LTable)NULL; - return True; -} - -Bool XrmQGetSearchResource(searchList, name, class, pType, pValue) - XrmSearchList searchList; - register XrmName name; - register XrmClass class; - XrmRepresentation *pType; /* RETURN */ - XrmValue *pValue; /* RETURN */ -{ - register LTable *list; - register LTable table; - register VEntry entry; - int flags; - -/* find tight or loose entry */ -#define VTIGHTLOOSE(q) \ - entry = LeafHash(table, q); \ - while (entry && entry->name != q) \ - entry = entry->next; \ - if (entry) \ - break - -/* find loose entry */ -#define VLOOSE(q) \ - entry = LeafHash(table, q); \ - while (entry && entry->name != q) \ - entry = entry->next; \ - if (entry) { \ - if (!entry->tight) \ - break; \ - if ((entry = entry->next) && entry->name == q) \ - break; \ - } - - list = (LTable *)searchList; - /* figure out which combination of name and class we need to search for */ - flags = 0; - if (IsResourceQuark(name)) - flags = 2; - if (IsResourceQuark(class)) - flags |= 1; - if (!flags) { - /* neither name nor class has ever been used to name a resource */ - table = (LTable)NULL; - } else if (flags == 3) { - /* both name and class */ - while (table = *list++) { - if (table != LOOSESEARCH) { - VTIGHTLOOSE(name); /* do name, tight and loose */ - VTIGHTLOOSE(class); /* do class, tight and loose */ - } else { - table = *list++; - VLOOSE(name); /* do name, loose only */ - VLOOSE(class); /* do class, loose only */ - } - } - } else { - /* just one of name or class */ - if (flags == 1) - name = class; - while (table = *list++) { - if (table != LOOSESEARCH) { - VTIGHTLOOSE(name); /* tight and loose */ - } else { - table = *list++; - VLOOSE(name); /* loose only */ - } - } - } - if (table) { - /* found a match */ - if (entry->string) { - *pType = XrmQString; - pValue->addr = StringValue(entry); - } else { - *pType = RepType(entry); - pValue->addr = DataValue(entry); - } - pValue->size = entry->size; - return True; - } - *pType = NULLQUARK; - pValue->addr = (XPointer)NULL; - pValue->size = 0; - return False; - -#undef VTIGHTLOOSE -#undef VLOOSE -} - -/* look for a tight/loose value */ -static Bool GetVEntry(table, names, classes, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - VClosure closure; -{ - register VEntry entry; - register XrmQuark q; - - /* try name first */ - q = *names; - entry = LeafHash(table, q); - while (entry && entry->name != q) - entry = entry->next; - if (!entry) { - /* not found, try class */ - q = *classes; - entry = LeafHash(table, q); - while (entry && entry->name != q) - entry = entry->next; - if (!entry) - return False; - } - if (entry->string) { - *closure->type = XrmQString; - closure->value->addr = StringValue(entry); - } else { - *closure->type = RepType(entry); - closure->value->addr = DataValue(entry); - } - closure->value->size = entry->size; - return True; -} - -/* look for a loose value */ -static Bool GetLooseVEntry(table, names, classes, closure) - LTable table; - XrmNameList names; - XrmClassList classes; - VClosure closure; -{ - register VEntry entry; - register XrmQuark q; - -#define VLOOSE(ename) \ - q = ename; \ - entry = LeafHash(table, q); \ - while (entry && entry->name != q) \ - entry = entry->next; \ - if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ - entry = (VEntry)NULL; - - /* bump to last component */ - while (names[1]) { - names++; - classes++; - } - VLOOSE(*names); /* do name, loose only */ - if (!entry) { - VLOOSE(*classes); /* do class, loose only */ - if (!entry) - return False; - } - if (entry->string) { - *closure->type = XrmQString; - closure->value->addr = StringValue(entry); - } else { - *closure->type = RepType(entry); - closure->value->addr = DataValue(entry); - } - closure->value->size = entry->size; - return True; - -#undef VLOOSE -} - -/* recursive search for a value */ -static Bool GetNEntry(table, names, classes, closure) - NTable table; - XrmNameList names; - XrmClassList classes; - VClosure closure; -{ - register NTable entry; - register XrmQuark q; - register unsigned int leaf; - Bool (*get)(); - NTable otable; - - if (names[2]) { - get = GetNEntry; /* recurse */ - leaf = 0; - } else { - get = GetVEntry; /* bottom of recursion */ - leaf = 1; - } - GTIGHTLOOSE(*names, GetLooseVEntry); /* do name, tight and loose */ - GTIGHTLOOSE(*classes, GetLooseVEntry); /* do class, tight and loose */ - if (table->hasany) { - GTIGHTLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, tight and loose */ - } - if (table->hasloose) { - while (1) { - names++; - classes++; - if (!names[1]) - break; - if (!names[2]) { - get = GetVEntry; /* bottom of recursion */ - leaf = 1; - } - GLOOSE(*names, GetLooseVEntry); /* do name, loose only */ - GLOOSE(*classes, GetLooseVEntry); /* do class, loose only */ - if (table->hasany) { - GLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, loose only */ - } - } - } - /* look for matching leaf tables */ - otable = table; - table = table->next; - if (!table) - return False; - if (table->leaf) { - if (table->tight && !otable->tight) - table = table->next; - } else { - table = table->next; - if (!table || !table->tight) - return False; - } - if (!table || table->name != otable->name) - return False; - /* found one */ - if (table->hasloose && - GetLooseVEntry((LTable)table, names, classes, closure)) - return True; - if (table->tight && table == otable->next) { - table = table->next; - if (table && table->name == otable->name && table->hasloose) - return GetLooseVEntry((LTable)table, names, classes, closure); - } - return False; -} - -Bool XrmQGetResource(db, names, classes, pType, pValue) - XrmDatabase db; - XrmNameList names; - XrmClassList classes; - XrmRepresentation *pType; /* RETURN */ - XrmValuePtr pValue; /* RETURN */ -{ - register NTable table; - VClosureRec closure; - - if (db && *names) { - closure.type = pType; - closure.value = pValue; - table = db->table; - if (names[1]) { - if (table && !table->leaf) { - if (GetNEntry(table, names, classes, &closure)) - return True; - } else if (table && table->hasloose && - GetLooseVEntry((LTable)table, names, classes, &closure)) - return True; - } else { - if (table && !table->leaf) - table = table->next; - if (table && GetVEntry((LTable)table, names, classes, &closure)) - return True; - } - } - *pType = NULLQUARK; - pValue->addr = (XPointer)NULL; - pValue->size = 0; - return False; -} - -#if NeedFunctionPrototypes -Bool XrmGetResource(db, name_str, class_str, pType_str, pValue) - XrmDatabase db; - _Xconst char *name_str; - _Xconst char *class_str; - XrmString *pType_str; /* RETURN */ - XrmValuePtr pValue; /* RETURN */ -#else -Bool XrmGetResource(db, name_str, class_str, pType_str, pValue) - XrmDatabase db; - XrmString name_str; - XrmString class_str; - XrmString *pType_str; /* RETURN */ - XrmValuePtr pValue; /* RETURN */ -#endif -{ - XrmName names[MAXDBDEPTH+1]; - XrmClass classes[MAXDBDEPTH+1]; - XrmRepresentation fromType; - Bool result; - - XrmStringToNameList(name_str, names); - XrmStringToClassList(class_str, classes); - result = XrmQGetResource(db, names, classes, &fromType, pValue); - (*pType_str) = XrmQuarkToString(fromType); - return result; -} - -/* destroy all values, plus table itself */ -static void DestroyLTable(table) - LTable table; -{ - register int i; - register VEntry *buckets; - register VEntry entry, next; - - buckets = table->buckets; - for (i = table->table.mask; i >= 0; i--, buckets++) { - for (next = *buckets; entry = next; ) { - next = entry->next; - xfree((char *)entry); - } - } - xfree((char *)table->buckets); - xfree((char *)table); -} - -/* destroy all contained tables, plus table itself */ -static void DestroyNTable(table) - NTable table; -{ - register int i; - register NTable *buckets; - register NTable entry, next; - - buckets = NodeBuckets(table); - for (i = table->mask; i >= 0; i--, buckets++) { - for (next = *buckets; entry = next; ) { - next = entry->next; - if (entry->leaf) - DestroyLTable((LTable)entry); - else - DestroyNTable(entry); - } - } - xfree((char *)table); -} - -char *XrmLocaleOfDatabase(db) - XrmDatabase db; -{ - return (*db->methods->lcname)(db->mbstate); -} - -void XrmDestroyDatabase(db) - XrmDatabase db; -{ - register NTable table, next; - - if (db) { - for (next = db->table; table = next; ) { - next = table->next; - if (table->leaf) - DestroyLTable((LTable)table); - else - DestroyNTable(table); - } - (*db->methods->destroy)(db->mbstate); - xfree((char *)db); - } -} diff --git a/xc/programs/Xserver/Xprint/XrmI.h b/xc/programs/Xserver/Xprint/XrmI.h deleted file mode 100644 index 25afd0e51..000000000 --- a/xc/programs/Xserver/Xprint/XrmI.h +++ /dev/null @@ -1,68 +0,0 @@ -/* $XConsortium: XrmI.h /main/1 1996/09/28 16:59:28 rws $ */ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 -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 THE SOFTWARE. - -Except as contained in this notice, the names of the copyright holders shall -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. -*/ -/* - -Copyright 1990 by the Massachusetts Institute of Technology - -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 M.I.T. not be used in advertising or -publicity pertaining to distribution of the software without specific, -written prior permission. M.I.T. makes no representations about the -suitability of this software for any purpose. It is provided "as is" -without express or implied warranty. - -*/ - -/* - * Macros to abstract out reading the file, and getting its size. - * - * You may need to redefine these for various other operating systems. - */ - -#include <X11/Xos.h> -#include <sys/stat.h> - -#define OpenFile(name) open((name), O_RDONLY) -#define CloseFile(fd) close((fd)) -#define ReadFile(fd,buf,size) read((fd), (buf), (size)) -#define GetSizeOfFile(name,size) \ -{ \ - struct stat status_buffer; \ - if ( (stat((name), &status_buffer)) == -1 ) \ - size = -1; \ - else \ - size = status_buffer.st_size; \ -} diff --git a/xc/programs/Xserver/fb/fb24_32.c b/xc/programs/Xserver/fb/fb24_32.c index 08073a49d..1f9e843cf 100644 --- a/xc/programs/Xserver/fb/fb24_32.c +++ b/xc/programs/Xserver/fb/fb24_32.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fb24_32.c,v 1.4 2000/08/09 17:50:51 keithp Exp $ + * $XFree86: xc/programs/Xserver/fb/fb24_32.c,v 1.5 2001/05/29 04:54:08 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -278,17 +278,18 @@ fb24_32GetSpans(DrawablePtr pDrawable, CARD8 *src; FbStride srcStride; int srcBpp; + int srcXoff, srcYoff; CARD8 *dst; - fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp); + fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); src = (CARD8 *) srcBits; srcStride *= sizeof (FbBits); while (nspans--) { dst = (CARD8 *) pchardstStart; - fb24_32BltUp (src + ppt->y * srcStride, srcStride, - ppt->x, + fb24_32BltUp (src + (ppt->y + srcYoff) * srcStride, srcStride, + ppt->x + srcXoff, dst, 1, @@ -321,16 +322,17 @@ fb24_32SetSpans (DrawablePtr pDrawable, CARD8 *dst, *d, *s; FbStride dstStride; int dstBpp; + int dstXoff, dstYoff; BoxPtr pbox; int n; int x1, x2; - fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp); + fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); dst = (CARD8 *) dstBits; dstStride *= sizeof (FbBits); while (nspans--) { - d = dst + ppt->y * dstStride; + d = dst + (ppt->y + dstYoff) * dstStride; s = (CARD8 *) src; n = REGION_NUM_RECTS(pClip); pbox = REGION_RECTS (pClip); @@ -352,7 +354,7 @@ fb24_32SetSpans (DrawablePtr pDrawable, (x1 - ppt->x), d, dstStride, - x1, + x1 + dstXoff, (x2 - x1), 1, @@ -385,11 +387,12 @@ fb24_32PutZImage (DrawablePtr pDrawable, CARD8 *dst; FbStride dstStride; int dstBpp; + int dstXoff, dstYoff; int nbox; BoxPtr pbox; int x1, y1, x2, y2; - fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp); + fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); dstStride *= sizeof(FbBits); dst = (CARD8 *) dstBits; @@ -416,9 +419,9 @@ fb24_32PutZImage (DrawablePtr pDrawable, srcStride, (x1 - x), - dst + y1 * dstStride, + dst + (y1 + dstYoff) * dstStride, dstStride, - x1, + x1 + dstXoff, (x2 - x1), (y2 - y1), @@ -442,10 +445,11 @@ fb24_32GetImage (DrawablePtr pDrawable, CARD8 *src; FbStride srcStride; int srcBpp; + int srcXoff, srcYoff; FbStride dstStride; FbBits pm; - fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp); + fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); src = (CARD8 *) srcBits; srcStride *= sizeof (FbBits); @@ -456,7 +460,7 @@ fb24_32GetImage (DrawablePtr pDrawable, dstStride = PixmapBytePad(w, pDrawable->depth); if (pm != FB_ALLONES) memset (d, 0, dstStride * h); - fb24_32BltUp (src + y * srcStride, srcStride, x, + fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff, (CARD8 *) d, dstStride, 0, w, h, GXcopy, pm); } @@ -484,11 +488,13 @@ fb24_32CopyMtoN (DrawablePtr pSrcDrawable, FbStride dstStride; int dstBpp; fb24_32BltFunc blt; + int srcXoff, srcYoff; + int dstXoff, dstYoff; - fbGetDrawable (pSrcDrawable, srcBits, srcStride, srcBpp); + fbGetDrawable (pSrcDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); src = (CARD8 *) srcBits; srcStride *= sizeof (FbBits); - fbGetDrawable (pDstDrawable, dstBits, dstStride, dstBpp); + fbGetDrawable (pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); dst = (CARD8 *) dstBits; dstStride *= sizeof (FbBits); if (srcBpp == 24) @@ -498,13 +504,13 @@ fb24_32CopyMtoN (DrawablePtr pSrcDrawable, while (nbox--) { - (*blt) (src + (pbox->y1 + dy) * srcStride, + (*blt) (src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, - (pbox->x1 + dx), + (pbox->x1 + dx + srcXoff), - dst + (pbox->y1) * dstStride, + dst + (pbox->y1 + dstYoff) * dstStride, dstStride, - (pbox->x1), + (pbox->x1 + dstXoff), (pbox->x2 - pbox->x1), (pbox->y2 - pbox->y1), @@ -524,6 +530,8 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) FbStride oldStride, newStride; int oldBpp, newBpp; fb24_32BltFunc blt; + int oldXoff, oldYoff; + int newXoff, newYoff; pNewTile = fbCreatePixmapBpp (pScreen, pOldTile->drawable.width, @@ -533,9 +541,9 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) if (!pNewTile) return 0; fbGetDrawable (&pOldTile->drawable, - old, oldStride, oldBpp); + old, oldStride, oldBpp, oldXoff, oldYoff); fbGetDrawable (&pNewTile->drawable, - new, newStride, newBpp); + new, newStride, newBpp, newXoff, newYoff); if (oldBpp == 24) blt = fb24_32BltUp; else diff --git a/xc/programs/Xserver/fb/fbcompose.c b/xc/programs/Xserver/fb/fbcompose.c index 74d0062ac..840cf62d8 100644 --- a/xc/programs/Xserver/fb/fbcompose.c +++ b/xc/programs/Xserver/fb/fbcompose.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fbcompose.c,v 1.5 2000/11/20 07:13:07 keithp Exp $ + * $XFree86: xc/programs/Xserver/fb/fbcompose.c,v 1.11 2001/08/16 08:03:25 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -35,11 +35,6 @@ * and storing these exist for each format. */ -typedef struct _fbCompSrc { - CARD32 value; - CARD32 alpha; -} FbCompSrc; - /* * Combine src and mask using IN */ @@ -54,13 +49,13 @@ fbCombineMaskU (FbCompositeOperand *src, CARD32 m,n,o,p; if (!msk) - return (*src->fetch) (src->line, src->offset); + return (*src->fetch) (src); - a = (*msk->fetch) (msk->line, msk->offset) >> 24; + a = (*msk->fetch) (msk) >> 24; if (!a) return 0; - x = (*src->fetch) (src->line, src->offset); + x = (*src->fetch) (src); if (a == 0xff) return x; @@ -84,7 +79,7 @@ fbCombineMaskC (FbCompositeOperand *src, if (!msk) { - x = (*src->fetch) (src->line, src->offset); + x = (*src->fetch) (src); s.value = x; x = x >> 24; x |= x << 8; @@ -93,7 +88,7 @@ fbCombineMaskC (FbCompositeOperand *src, return s; } - a = (*msk->fetcha) (msk->line, msk->offset); + a = (*msk->fetcha) (msk); if (!a) { s.value = 0; @@ -101,7 +96,7 @@ fbCombineMaskC (FbCompositeOperand *src, return s; } - x = (*src->fetch) (src->line, src->offset); + x = (*src->fetch) (src); if (a == 0xffffffff) { s.value = x; @@ -132,20 +127,19 @@ fbCombineMaskValueC (FbCompositeOperand *src, { CARD32 x; CARD32 a; - CARD16 xa; CARD16 t; CARD32 m,n,o,p; if (!msk) { - return (*src->fetch) (src->line, src->offset); + return (*src->fetch) (src); } - a = (*msk->fetcha) (msk->line, msk->offset); + a = (*msk->fetcha) (msk); if (!a) return a; - x = (*src->fetch) (src->line, src->offset); + x = (*src->fetch) (src); if (a == 0xffffffff) return x; @@ -168,13 +162,13 @@ fbCombineMaskAlphaU (FbCompositeOperand *src, CARD16 t; if (!msk) - return (*src->fetch) (src->line, src->offset); + return (*src->fetch) (src); - a = (*msk->fetch) (msk->line, msk->offset) >> 24; + a = (*msk->fetch) (msk) >> 24; if (!a) return 0; - x = (*src->fetch) (src->line, src->offset); + x = (*src->fetch) (src); if (a == 0xff) return x; @@ -187,18 +181,17 @@ fbCombineMaskAlphaC (FbCompositeOperand *src, { CARD32 x; CARD32 a; - CARD16 xa; CARD16 t; CARD32 m,n,o,p; if (!msk) - return (*src->fetch) (src->line, src->offset); + return (*src->fetch) (src); - a = (*msk->fetcha) (msk->line, msk->offset); + a = (*msk->fetcha) (msk); if (!a) return 0; - x = (*src->fetcha) (src->line, src->offset); + x = (*src->fetcha) (src); if (a == 0xffffffff) return x; @@ -217,7 +210,7 @@ fbCombineClear (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - (*dst->store) (dst->line, dst->offset, 0); + (*dst->store) (dst, 0); } void @@ -225,7 +218,7 @@ fbCombineSrcU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - (*dst->store) (dst->line, dst->offset, fbCombineMaskU (src, msk)); + (*dst->store) (dst, fbCombineMaskU (src, msk)); } void @@ -233,7 +226,7 @@ fbCombineSrcC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - (*dst->store) (dst->line, dst->offset, fbCombineMaskValueC (src, msk)); + (*dst->store) (dst, fbCombineMaskValueC (src, msk)); } void @@ -260,14 +253,14 @@ fbCombineOverU (FbCompositeOperand *src, { if (a) { - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); m = FbOverU(s,d,0,a,t); n = FbOverU(s,d,8,a,t); o = FbOverU(s,d,16,a,t); p = FbOverU(s,d,24,a,t); s = m|n|o|p; } - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); } } @@ -289,14 +282,14 @@ fbCombineOverC (FbCompositeOperand *src, { if (a) { - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); m = FbOverC(s,d,0,a,t); n = FbOverC(s,d,8,a,t); o = FbOverC(s,d,16,a,t); p = FbOverC(s,d,24,a,t); s = m|n|o|p; } - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); } } @@ -310,7 +303,7 @@ fbCombineOverReverseU (FbCompositeOperand *src, CARD16 t; CARD32 m,n,o,p; - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); a = ~d >> 24; if (a) { @@ -323,7 +316,7 @@ fbCombineOverReverseU (FbCompositeOperand *src, p = FbOverU(d,s,24,a,t); s = m|n|o|p; } - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); } } @@ -337,7 +330,7 @@ fbCombineOverReverseC (FbCompositeOperand *src, CARD16 t; CARD32 m,n,o,p; - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); a = ~d >> 24; if (a) { @@ -350,7 +343,7 @@ fbCombineOverReverseC (FbCompositeOperand *src, p = FbOverU(d,s,24,a,t); s = m|n|o|p; } - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); } } @@ -364,7 +357,7 @@ fbCombineInU (FbCompositeOperand *src, CARD16 t; CARD32 m,n,o,p; - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); a = d >> 24; s = 0; if (a) @@ -379,7 +372,7 @@ fbCombineInU (FbCompositeOperand *src, s = m|n|o|p; } } - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); } void @@ -392,7 +385,7 @@ fbCombineInC (FbCompositeOperand *src, CARD16 t; CARD32 m,n,o,p; - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); a = d >> 24; s = 0; if (a) @@ -407,7 +400,7 @@ fbCombineInC (FbCompositeOperand *src, s = m|n|o|p; } } - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); } void @@ -427,14 +420,14 @@ fbCombineInReverseU (FbCompositeOperand *src, d = 0; if (a) { - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); m = FbInU(d,0,a,t); n = FbInU(d,8,a,t); o = FbInU(d,16,a,t); p = FbInU(d,24,a,t); d = m|n|o|p; } - (*dst->store) (dst->line, dst->offset, d); + (*dst->store) (dst, d); } } @@ -455,14 +448,14 @@ fbCombineInReverseC (FbCompositeOperand *src, d = 0; if (a) { - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); m = FbInC(d,0,a,t); n = FbInC(d,8,a,t); o = FbInC(d,16,a,t); p = FbInC(d,24,a,t); d = m|n|o|p; } - (*dst->store) (dst->line, dst->offset, d); + (*dst->store) (dst, d); } } @@ -476,7 +469,7 @@ fbCombineOutU (FbCompositeOperand *src, CARD16 t; CARD32 m,n,o,p; - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); a = ~d >> 24; s = 0; if (a) @@ -491,7 +484,7 @@ fbCombineOutU (FbCompositeOperand *src, s = m|n|o|p; } } - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); } void @@ -504,7 +497,7 @@ fbCombineOutC (FbCompositeOperand *src, CARD16 t; CARD32 m,n,o,p; - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); a = ~d >> 24; s = 0; if (a) @@ -519,7 +512,7 @@ fbCombineOutC (FbCompositeOperand *src, s = m|n|o|p; } } - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); } void @@ -539,14 +532,14 @@ fbCombineOutReverseU (FbCompositeOperand *src, d = 0; if (a) { - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); m = FbInU(d,0,a,t); n = FbInU(d,8,a,t); o = FbInU(d,16,a,t); p = FbInU(d,24,a,t); d = m|n|o|p; } - (*dst->store) (dst->line, dst->offset, d); + (*dst->store) (dst, d); } } @@ -567,14 +560,14 @@ fbCombineOutReverseC (FbCompositeOperand *src, d = 0; if (a) { - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); m = FbInC(d,0,a,t); n = FbInC(d,8,a,t); o = FbInC(d,16,a,t); p = FbInC(d,24,a,t); d = m|n|o|p; } - (*dst->store) (dst->line, dst->offset, d); + (*dst->store) (dst, d); } } @@ -585,18 +578,18 @@ fbCombineAtopU (FbCompositeOperand *src, { CARD32 s, d; CARD16 ad, as; - CARD16 t; + CARD16 t,u,v; CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); ad = ~s >> 24; as = d >> 24; - m = FbGen(s,d,0,as,ad,t); - n = FbGen(s,d,8,as,ad,t); - o = FbGen(s,d,16,as,ad,t); - p = FbGen(s,d,24,as,ad,t); - (*dst->store) (dst->line, dst->offset, m|n|o|p); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); + (*dst->store) (dst, m|n|o|p); } void @@ -608,19 +601,19 @@ fbCombineAtopC (FbCompositeOperand *src, CARD32 s, d; CARD32 ad; CARD16 as; - CARD16 t; + CARD16 t, u, v; CARD32 m,n,o,p; cs = fbCombineMaskC (src, msk); - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); s = cs.value; ad = cs.alpha; as = d >> 24; - m = FbGen(s,d,0,as,FbGet8(ad,0),t); - n = FbGen(s,d,8,as,FbGet8(ad,8),t); - o = FbGen(s,d,16,as,FbGet8(ad,16),t); - p = FbGen(s,d,24,as,FbGet8(ad,24),t); - (*dst->store) (dst->line, dst->offset, m|n|o|p); + m = FbGen(s,d,0,as,FbGet8(ad,0),t,u,v); + n = FbGen(s,d,8,as,FbGet8(ad,8),t,u,v); + o = FbGen(s,d,16,as,FbGet8(ad,16),t,u,v); + p = FbGen(s,d,24,as,FbGet8(ad,24),t,u,v); + (*dst->store) (dst, m|n|o|p); } void @@ -630,18 +623,18 @@ fbCombineAtopReverseU (FbCompositeOperand *src, { CARD32 s, d; CARD16 ad, as; - CARD16 t; + CARD16 t, u, v; CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); ad = s >> 24; as = ~d >> 24; - m = FbGen(s,d,0,as,ad,t); - n = FbGen(s,d,8,as,ad,t); - o = FbGen(s,d,16,as,ad,t); - p = FbGen(s,d,24,as,ad,t); - (*dst->store) (dst->line, dst->offset, m|n|o|p); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); + (*dst->store) (dst, m|n|o|p); } void @@ -652,19 +645,19 @@ fbCombineAtopReverseC (FbCompositeOperand *src, FbCompSrc cs; CARD32 s, d, ad; CARD16 as; - CARD16 t; + CARD16 t, u, v; CARD32 m,n,o,p; cs = fbCombineMaskC (src, msk); - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); s = cs.value; ad = cs.alpha; as = ~d >> 24; - m = FbGen(s,d,0,as,FbGet8(ad,0),t); - n = FbGen(s,d,8,as,FbGet8(ad,8),t); - o = FbGen(s,d,16,as,FbGet8(ad,16),t); - p = FbGen(s,d,24,as,FbGet8(ad,24),t); - (*dst->store) (dst->line, dst->offset, m|n|o|p); + m = FbGen(s,d,0,as,FbGet8(ad,0),t,u,v); + n = FbGen(s,d,8,as,FbGet8(ad,8),t,u,v); + o = FbGen(s,d,16,as,FbGet8(ad,16),t,u,v); + p = FbGen(s,d,24,as,FbGet8(ad,24),t,u,v); + (*dst->store) (dst, m|n|o|p); } void @@ -674,18 +667,18 @@ fbCombineXorU (FbCompositeOperand *src, { CARD32 s, d; CARD16 ad, as; - CARD16 t; + CARD16 t, u, v; CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); ad = ~s >> 24; as = ~d >> 24; - m = FbGen(s,d,0,as,ad,t); - n = FbGen(s,d,8,as,ad,t); - o = FbGen(s,d,16,as,ad,t); - p = FbGen(s,d,24,as,ad,t); - (*dst->store) (dst->line, dst->offset, m|n|o|p); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); + (*dst->store) (dst, m|n|o|p); } void @@ -696,19 +689,19 @@ fbCombineXorC (FbCompositeOperand *src, FbCompSrc cs; CARD32 s, d, ad; CARD16 as; - CARD16 t; + CARD16 t, u, v; CARD32 m,n,o,p; cs = fbCombineMaskC (src, msk); - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); s = cs.value; ad = ~cs.alpha; as = ~d >> 24; - m = FbGen(s,d,0,as,ad,t); - n = FbGen(s,d,8,as,ad,t); - o = FbGen(s,d,16,as,ad,t); - p = FbGen(s,d,24,as,ad,t); - (*dst->store) (dst->line, dst->offset, m|n|o|p); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); + (*dst->store) (dst, m|n|o|p); } void @@ -722,17 +715,17 @@ fbCombineAddU (FbCompositeOperand *src, s = fbCombineMaskU (src, msk); if (s == ~0) - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); else { - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); if (s && d != ~0) { m = FbAdd(s,d,0,t); n = FbAdd(s,d,8,t); o = FbAdd(s,d,16,t); p = FbAdd(s,d,24,t); - (*dst->store) (dst->line, dst->offset, m|n|o|p); + (*dst->store) (dst, m|n|o|p); } } } @@ -748,17 +741,17 @@ fbCombineAddC (FbCompositeOperand *src, s = fbCombineMaskValueC (src, msk); if (s == ~0) - (*dst->store) (dst->line, dst->offset, s); + (*dst->store) (dst, s); else { - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); if (s && d != ~0) { m = FbAdd(s,d,0,t); n = FbAdd(s,d,8,t); o = FbAdd(s,d,16,t); p = FbAdd(s,d,24,t); - (*dst->store) (dst->line, dst->offset, m|n|o|p); + (*dst->store) (dst, m|n|o|p); } } } @@ -775,7 +768,8 @@ fbCombineSaturateU (FbCompositeOperand *src, CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); - d = (*dst->fetch) (dst->line, dst->offset); +#if 0 + d = (*dst->fetch) (dst); sa = s >> 24; da = ~d >> 24; if (sa <= da) @@ -789,12 +783,22 @@ fbCombineSaturateU (FbCompositeOperand *src, { as = (da << 8) / sa; ad = 0xff; - m = FbGen(s,d,0,as,ad,t); - n = FbGen(s,d,8,as,ad,t); - o = FbGen(s,d,16,as,ad,t); - p = FbGen(s,d,24,as,ad,t); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); + } + (*dst->store) (dst, m|n|o|p); +#else + if ((s >> 24) == 0xff) + (*dst->store) (dst, s); + else + { + d = (*dst->fetch) (dst); + if ((s >> 24) > (d >> 24)) + (*dst->store) (dst, s); } - (*dst->store) (dst->line, dst->offset, m|n|o|p); +#endif } void @@ -805,12 +809,11 @@ fbCombineSaturateC (FbCompositeOperand *src, FbCompSrc cs; CARD32 s, d; CARD16 sa, sr, sg, sb, da; - CARD16 ad, as; - CARD16 t; + CARD16 t, u, v; CARD32 m,n,o,p; cs = fbCombineMaskC (src, msk); - d = (*dst->fetch) (dst->line, dst->offset); + d = (*dst->fetch) (dst); s = cs.value; sa = (cs.alpha >> 24) & 0xff; sr = (cs.alpha >> 16) & 0xff; @@ -821,24 +824,686 @@ fbCombineSaturateC (FbCompositeOperand *src, if (sb <= da) m = FbAdd(s,d,0,t); else - m = FbGen (s, d, 0, (da << 8) / sb, 0xff, t); + m = FbGen (s, d, 0, (da << 8) / sb, 0xff, t, u, v); if (sg <= da) n = FbAdd(s,d,8,t); else - n = FbGen (s, d, 8, (da << 8) / sg, 0xff, t); + n = FbGen (s, d, 8, (da << 8) / sg, 0xff, t, u, v); if (sr < da) o = FbAdd(s,d,16,t); else - o = FbGen (s, d, 16, (da << 8) / sr, 0xff, t); + o = FbGen (s, d, 16, (da << 8) / sr, 0xff, t, u, v); if (sa <= da) p = FbAdd(s,d,24,t); else - p = FbGen (s, d, 24, (da << 8) / sa, 0xff, t); + p = FbGen (s, d, 24, (da << 8) / sa, 0xff, t, u, v); + + (*dst->store) (dst, m|n|o|p); +} + +/* + * All of the disjoint composing functions + + The four entries in the first column indicate what source contributions + come from each of the four areas of the picture -- areas covered by neither + A nor B, areas covered only by A, areas covered only by B and finally + areas covered by both A and B. + + Disjoint Conjoint + Fa Fb Fa Fb +(0,0,0,0) 0 0 0 0 +(0,A,0,A) 1 0 1 0 +(0,0,B,B) 0 1 0 1 +(0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0) +(0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1 +(0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0 +(0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1) +(0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0 +(0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0) +(0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0) +(0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b) +(0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0) + + */ + +#define CombineAOut 1 +#define CombineAIn 2 +#define CombineBOut 4 +#define CombineBIn 8 + +#define CombineClear 0 +#define CombineA (CombineAOut|CombineAIn) +#define CombineB (CombineBOut|CombineBIn) +#define CombineAOver (CombineAOut|CombineBOut|CombineAIn) +#define CombineBOver (CombineAOut|CombineBOut|CombineBIn) +#define CombineAAtop (CombineBOut|CombineAIn) +#define CombineBAtop (CombineAOut|CombineBIn) +#define CombineXor (CombineAOut|CombineBOut) + +/* portion covered by a but not b */ +CARD8 +fbCombineDisjointOutPart (CARD8 a, CARD8 b) +{ + /* min (1, (1-b) / a) */ + + b = ~b; /* 1 - b */ + if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ + return 0xff; /* 1 */ + return FbIntDiv(b,a); /* (1-b) / a */ +} + +/* portion covered by both a and b */ +CARD8 +fbCombineDisjointInPart (CARD8 a, CARD8 b) +{ + /* max (1-(1-b)/a,0) */ + /* = - min ((1-b)/a - 1, 0) */ + /* = 1 - min (1, (1-b)/a) */ + + b = ~b; /* 1 - b */ + if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ + return 0; /* 1 - 1 */ + return ~FbIntDiv(b,a); /* 1 - (1-b) / a */ +} + +void +fbCombineDisjointGeneralU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst, + CARD8 combine) +{ + CARD32 s, d; + CARD32 m,n,o,p; + CARD16 Fa, Fb, t, u, v; + CARD8 sa, da; + + s = fbCombineMaskU (src, msk); + sa = s >> 24; + + d = (*dst->fetch) (dst); + da = d >> 24; + + switch (combine & CombineA) { + case 0: + Fa = 0; + break; + case CombineAOut: + Fa = fbCombineDisjointOutPart (sa, da); + break; + case CombineAIn: + Fa = fbCombineDisjointInPart (sa, da); + break; + case CombineA: + Fa = 0xff; + break; + } + + switch (combine & CombineB) { + case 0: + Fb = 0; + break; + case CombineBOut: + Fb = fbCombineDisjointOutPart (da, sa); + break; + case CombineBIn: + Fb = fbCombineDisjointInPart (da, sa); + break; + case CombineB: + Fb = 0xff; + break; + } + m = FbGen (s,d,0,Fa,Fb,t,u,v); + n = FbGen (s,d,8,Fa,Fb,t,u,v); + o = FbGen (s,d,16,Fa,Fb,t,u,v); + p = FbGen (s,d,24,Fa,Fb,t,u,v); + s = m|n|o|p; + (*dst->store) (dst, s); +} + +void +fbCombineDisjointGeneralC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst, + CARD8 combine) +{ + FbCompSrc cs; + CARD32 s, d; + CARD32 m,n,o,p; + CARD32 Fa; + CARD16 Fb, t, u, v; + CARD32 sa; + CARD8 da; + + cs = fbCombineMaskC (src, msk); + s = cs.value; + sa = cs.alpha; + + d = (*dst->fetch) (dst); + da = d >> 24; + + switch (combine & CombineA) { + case 0: + Fa = 0; + break; + case CombineAOut: + m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; + Fa = m|n|o|p; + break; + case CombineAIn: + m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; + Fa = m|n|o|p; + break; + case CombineA: + Fa = 0xffffffff; + break; + } + + switch (combine & CombineB) { + case 0: + Fb = 0; + break; + case CombineBOut: + Fb = fbCombineDisjointOutPart (da, sa); + break; + case CombineBIn: + Fb = fbCombineDisjointInPart (da, sa); + break; + case CombineB: + Fb = 0xff; + break; + } + m = FbGen (s,d,0,FbGet8(Fa,0),Fb,t,u,v); + n = FbGen (s,d,8,FbGet8(Fa,8),Fb,t,u,v); + o = FbGen (s,d,16,FbGet8(Fa,16),Fb,t,u,v); + p = FbGen (s,d,24,FbGet8(Fa,24),Fb,t,u,v); + s = m|n|o|p; + (*dst->store) (dst, s); +} + +void +fbCombineDisjointOverU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; + + s = fbCombineMaskU (src, msk); + a = s >> 24; + if (a != 0x00) + { + if (a != 0xff) + { + d = (*dst->fetch) (dst); + a = fbCombineDisjointOutPart (d >> 24, a); + m = FbOverU(s,d,0,a,t); + n = FbOverU(s,d,8,a,t); + o = FbOverU(s,d,16,a,t); + p = FbOverU(s,d,24,a,t); + s = m|n|o|p; + } + (*dst->store) (dst, s); + } +} + +void +fbCombineDisjointOverC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineAOver); +} + +void +fbCombineDisjointOverReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralU (src, msk, dst, CombineBOver); +} + +void +fbCombineDisjointOverReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineBOver); +} + +void +fbCombineDisjointInU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralU (src, msk, dst, CombineAIn); +} + +void +fbCombineDisjointInC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineAIn); +} + +void +fbCombineDisjointInReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralU (src, msk, dst, CombineBIn); +} + +void +fbCombineDisjointInReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineBIn); +} + +void +fbCombineDisjointOutU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralU (src, msk, dst, CombineAOut); +} + +void +fbCombineDisjointOutC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineAOut); +} + +void +fbCombineDisjointOutReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralU (src, msk, dst, CombineBOut); +} + +void +fbCombineDisjointOutReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineBOut); +} + +void +fbCombineDisjointAtopU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralU (src, msk, dst, CombineAAtop); +} + +void +fbCombineDisjointAtopC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineAAtop); +} + +void +fbCombineDisjointAtopReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralU (src, msk, dst, CombineBAtop); +} + +void +fbCombineDisjointAtopReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineBAtop); +} + +void +fbCombineDisjointXorU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralU (src, msk, dst, CombineXor); +} + +void +fbCombineDisjointXorC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineDisjointGeneralC (src, msk, dst, CombineXor); +} + +/* portion covered by a but not b */ +CARD8 +fbCombineConjointOutPart (CARD8 a, CARD8 b) +{ + /* max (1-b/a,0) */ + /* = 1-min(b/a,1) */ + + /* min (1, (1-b) / a) */ + + if (b >= a) /* b >= a -> b/a >= 1 */ + return 0x00; /* 0 */ + return ~FbIntDiv(b,a); /* 1 - b/a */ +} + +/* portion covered by both a and b */ +CARD8 +fbCombineConjointInPart (CARD8 a, CARD8 b) +{ + /* min (1,b/a) */ + + if (b >= a) /* b >= a -> b/a >= 1 */ + return 0xff; /* 1 */ + return FbIntDiv(b,a); /* b/a */ +} + +void +fbCombineConjointGeneralU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst, + CARD8 combine) +{ + CARD32 s, d; + CARD32 m,n,o,p; + CARD16 Fa, Fb, t, u, v; + CARD8 sa, da; + CARD32 rp; + + s = fbCombineMaskU (src, msk); + sa = s >> 24; + + d = (*dst->fetch) (dst); + da = d >> 24; - (*dst->store) (dst->line, dst->offset, m|n|o|p); + switch (combine & CombineA) { + case 0: + Fa = 0; + break; + case CombineAOut: + Fa = fbCombineConjointOutPart (sa, da); + break; + case CombineAIn: + Fa = fbCombineConjointInPart (sa, da); + break; + case CombineA: + Fa = 0xff; + break; + } + + switch (combine & CombineB) { + case 0: + Fb = 0; + break; + case CombineBOut: + Fb = fbCombineConjointOutPart (da, sa); + break; + case CombineBIn: + Fb = fbCombineConjointInPart (da, sa); + break; + case CombineB: + Fb = 0xff; + break; + } + m = FbGen (s,d,0,Fa,Fb,t,u,v); + n = FbGen (s,d,8,Fa,Fb,t,u,v); + o = FbGen (s,d,16,Fa,Fb,t,u,v); + p = FbGen (s,d,24,Fa,Fb,t,u,v); + s = m|n|o|p; + (*dst->store) (dst, s); +} + +void +fbCombineConjointGeneralC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst, + CARD8 combine) +{ + FbCompSrc cs; + CARD32 s, d; + CARD32 m,n,o,p; + CARD32 Fa; + CARD16 Fb, t, u, v; + CARD32 sa; + CARD8 da; + + cs = fbCombineMaskC (src, msk); + s = cs.value; + sa = cs.alpha; + + d = (*dst->fetch) (dst); + da = d >> 24; + + switch (combine & CombineA) { + case 0: + Fa = 0; + break; + case CombineAOut: + m = fbCombineConjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineConjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineConjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineConjointOutPart ((CARD8) (sa >> 24), da) << 24; + Fa = m|n|o|p; + break; + case CombineAIn: + m = fbCombineConjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineConjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineConjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineConjointOutPart ((CARD8) (sa >> 24), da) << 24; + Fa = m|n|o|p; + break; + case CombineA: + Fa = 0xffffffff; + break; + } + + switch (combine & CombineB) { + case 0: + Fb = 0; + break; + case CombineBOut: + Fb = fbCombineConjointOutPart (da, sa); + break; + case CombineBIn: + Fb = fbCombineConjointInPart (da, sa); + break; + case CombineB: + Fb = 0xff; + break; + } + m = FbGen (s,d,0,FbGet8(Fa,0),Fb,t,u,v); + n = FbGen (s,d,8,FbGet8(Fa,8),Fb,t,u,v); + o = FbGen (s,d,16,FbGet8(Fa,16),Fb,t,u,v); + p = FbGen (s,d,24,FbGet8(Fa,24),Fb,t,u,v); + s = m|n|o|p; + (*dst->store) (dst, s); +} + +void +fbCombineConjointOverU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineAOver); +/* + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; + + s = fbCombineMaskU (src, msk); + a = s >> 24; + if (a != 0x00) + { + if (a != 0xff) + { + d = (*dst->fetch) (dst); + a = fbCombineConjointOutPart (d >> 24, a); + m = FbOverU(s,d,0,a,t); + n = FbOverU(s,d,8,a,t); + o = FbOverU(s,d,16,a,t); + p = FbOverU(s,d,24,a,t); + s = m|n|o|p; + } + (*dst->store) (dst, s); + } + */ +} + +void +fbCombineConjointOverC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineAOver); +} + +void +fbCombineConjointOverReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineBOver); +} + +void +fbCombineConjointOverReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineBOver); +} + +void +fbCombineConjointInU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineAIn); +} + +void +fbCombineConjointInC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineAIn); +} + +void +fbCombineConjointInReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineBIn); +} + +void +fbCombineConjointInReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineBIn); +} + +void +fbCombineConjointOutU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineAOut); +} + +void +fbCombineConjointOutC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineAOut); +} + +void +fbCombineConjointOutReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineBOut); +} + +void +fbCombineConjointOutReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineBOut); +} + +void +fbCombineConjointAtopU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineAAtop); +} + +void +fbCombineConjointAtopC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineAAtop); +} + +void +fbCombineConjointAtopReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineBAtop); +} + +void +fbCombineConjointAtopReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineBAtop); +} + +void +fbCombineConjointXorU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralU (src, msk, dst, CombineXor); +} + +void +fbCombineConjointXorC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) +{ + fbCombineConjointGeneralC (src, msk, dst, CombineXor); } FbCombineFunc fbCombineFuncU[] = { @@ -855,7 +1520,37 @@ FbCombineFunc fbCombineFuncU[] = { fbCombineAtopReverseU, fbCombineXorU, fbCombineAddU, - fbCombineSaturateU, + fbCombineDisjointOverU, /* Saturate */ + 0, + 0, + fbCombineClear, + fbCombineSrcU, + fbCombineDst, + fbCombineDisjointOverU, + fbCombineDisjointOverReverseU, + fbCombineDisjointInU, + fbCombineDisjointInReverseU, + fbCombineDisjointOutU, + fbCombineDisjointOutReverseU, + fbCombineDisjointAtopU, + fbCombineDisjointAtopReverseU, + fbCombineDisjointXorU, + 0, + 0, + 0, + 0, + fbCombineClear, + fbCombineSrcU, + fbCombineDst, + fbCombineConjointOverU, + fbCombineConjointOverReverseU, + fbCombineConjointInU, + fbCombineConjointInReverseU, + fbCombineConjointOutU, + fbCombineConjointOutReverseU, + fbCombineConjointAtopU, + fbCombineConjointAtopReverseU, + fbCombineConjointXorU, }; FbCombineFunc fbCombineFuncC[] = { @@ -872,7 +1567,37 @@ FbCombineFunc fbCombineFuncC[] = { fbCombineAtopReverseC, fbCombineXorC, fbCombineAddC, - fbCombineSaturateC, + fbCombineDisjointOverC, /* Saturate */ + 0, + 0, + fbCombineClear, /* 0x10 */ + fbCombineSrcC, + fbCombineDst, + fbCombineDisjointOverC, + fbCombineDisjointOverReverseC, + fbCombineDisjointInC, + fbCombineDisjointInReverseC, + fbCombineDisjointOutC, + fbCombineDisjointOutReverseC, + fbCombineDisjointAtopC, + fbCombineDisjointAtopReverseC, + fbCombineDisjointXorC, /* 0x1b */ + 0, + 0, + 0, + 0, + fbCombineClear, + fbCombineSrcC, + fbCombineDst, + fbCombineConjointOverC, + fbCombineConjointOverReverseC, + fbCombineConjointInC, + fbCombineConjointInReverseC, + fbCombineConjointOutC, + fbCombineConjointOutReverseC, + fbCombineConjointAtopC, + fbCombineConjointAtopReverseC, + fbCombineConjointXorC, }; /* @@ -880,20 +1605,23 @@ FbCombineFunc fbCombineFuncC[] = { */ CARD32 -fbFetch_a8r8g8b8 (FbBits *line, CARD32 offset) +fbFetch_a8r8g8b8 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; return ((CARD32 *)line)[offset >> 5]; } CARD32 -fbFetch_x8r8g8b8 (FbBits *line, CARD32 offset) +fbFetch_x8r8g8b8 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; return ((CARD32 *)line)[offset >> 5] | 0xff000000; } CARD32 -fbFetch_a8b8g8r8 (FbBits *line, CARD32 offset) +fbFetch_a8b8g8r8 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD32 *)line)[offset >> 5]; return ((pixel & 0xff000000) | @@ -903,8 +1631,9 @@ fbFetch_a8b8g8r8 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_x8b8g8r8 (FbBits *line, CARD32 offset) +fbFetch_x8b8g8r8 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD32 *)line)[offset >> 5]; return ((0xff000000) | @@ -914,8 +1643,9 @@ fbFetch_x8b8g8r8 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_r8g8b8 (FbBits *line, CARD32 offset) +fbFetch_r8g8b8 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | @@ -931,8 +1661,9 @@ fbFetch_r8g8b8 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_b8g8r8 (FbBits *line, CARD32 offset) +fbFetch_b8g8r8 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | @@ -948,8 +1679,9 @@ fbFetch_b8g8r8 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_r5g6b5 (FbBits *line, CARD32 offset) +fbFetch_r5g6b5 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD16 *) line)[offset >> 4]; CARD32 r,g,b; @@ -960,8 +1692,9 @@ fbFetch_r5g6b5 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_b5g6r5 (FbBits *line, CARD32 offset) +fbFetch_b5g6r5 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD16 *) line)[offset >> 4]; CARD32 r,g,b; @@ -972,8 +1705,9 @@ fbFetch_b5g6r5 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_a1r5g5b5 (FbBits *line, CARD32 offset) +fbFetch_a1r5g5b5 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD16 *) line)[offset >> 4]; CARD32 a,r,g,b; @@ -985,8 +1719,9 @@ fbFetch_a1r5g5b5 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_x1r5g5b5 (FbBits *line, CARD32 offset) +fbFetch_x1r5g5b5 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD16 *) line)[offset >> 4]; CARD32 r,g,b; @@ -997,8 +1732,9 @@ fbFetch_x1r5g5b5 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_a1b5g5r5 (FbBits *line, CARD32 offset) +fbFetch_a1b5g5r5 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD16 *) line)[offset >> 4]; CARD32 a,r,g,b; @@ -1010,8 +1746,9 @@ fbFetch_a1b5g5r5 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_x1b5g5r5 (FbBits *line, CARD32 offset) +fbFetch_x1b5g5r5 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD16 *) line)[offset >> 4]; CARD32 r,g,b; @@ -1022,16 +1759,18 @@ fbFetch_x1b5g5r5 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_a8 (FbBits *line, CARD32 offset) +fbFetch_a8 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD8 *) line)[offset>>3]; return pixel << 24; } CARD32 -fbFetcha_a8 (FbBits *line, CARD32 offset) +fbFetcha_a8 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD8 *) line)[offset>>3]; pixel |= pixel << 8; @@ -1040,8 +1779,9 @@ fbFetcha_a8 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_r3g3b2 (FbBits *line, CARD32 offset) +fbFetch_r3g3b2 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD8 *) line)[offset>>3]; CARD32 r,g,b; @@ -1055,8 +1795,9 @@ fbFetch_r3g3b2 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_b2g3r3 (FbBits *line, CARD32 offset) +fbFetch_b2g3r3 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD8 *) line)[offset>>3]; CARD32 r,g,b; @@ -1072,8 +1813,9 @@ fbFetch_b2g3r3 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_a2r2g2b2 (FbBits *line, CARD32 offset) +fbFetch_a2r2g2b2 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD8 *) line)[offset>>3]; CARD32 a,r,g,b; @@ -1085,8 +1827,9 @@ fbFetch_a2r2g2b2 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_a2b2g2r2 (FbBits *line, CARD32 offset) +fbFetch_a2b2g2r2 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD8 *) line)[offset>>3]; CARD32 a,r,g,b; @@ -1097,6 +1840,15 @@ fbFetch_a2b2g2r2 (FbBits *line, CARD32 offset) return a|r|g|b; } +CARD32 +fbFetch_c8 (FbCompositeOperand *op) +{ + FbBits *line = op->line; CARD32 offset = op->offset; + CARD32 pixel = ((CARD8 *) line)[offset>>3]; + + return op->indexed->rgba[pixel]; +} + #define Fetch8(l,o) (((CARD8 *) (l))[(o) >> 3]) #if IMAGE_BYTE_ORDER == MSBFirst #define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4) @@ -1105,8 +1857,9 @@ fbFetch_a2b2g2r2 (FbBits *line, CARD32 offset) #endif CARD32 -fbFetch_a4 (FbBits *line, CARD32 offset) +fbFetch_a4 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = Fetch4(line, offset); pixel |= pixel << 4; @@ -1114,8 +1867,9 @@ fbFetch_a4 (FbBits *line, CARD32 offset) } CARD32 -fbFetcha_a4 (FbBits *line, CARD32 offset) +fbFetcha_a4 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = Fetch4(line, offset); pixel |= pixel << 4; @@ -1125,8 +1879,9 @@ fbFetcha_a4 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_r1g2b1 (FbBits *line, CARD32 offset) +fbFetch_r1g2b1 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = Fetch4(line, offset); CARD32 r,g,b; @@ -1137,8 +1892,9 @@ fbFetch_r1g2b1 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_b1g2r1 (FbBits *line, CARD32 offset) +fbFetch_b1g2r1 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = Fetch4(line, offset); CARD32 r,g,b; @@ -1149,8 +1905,9 @@ fbFetch_b1g2r1 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_a1r1g1b1 (FbBits *line, CARD32 offset) +fbFetch_a1r1g1b1 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = Fetch4(line, offset); CARD32 a,r,g,b; @@ -1162,8 +1919,9 @@ fbFetch_a1r1g1b1 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_a1b1g1r1 (FbBits *line, CARD32 offset) +fbFetch_a1b1g1r1 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = Fetch4(line, offset); CARD32 a,r,g,b; @@ -1175,8 +1933,18 @@ fbFetch_a1b1g1r1 (FbBits *line, CARD32 offset) } CARD32 -fbFetcha_a1 (FbBits *line, CARD32 offset) +fbFetch_c4 (FbCompositeOperand *op) +{ + FbBits *line = op->line; CARD32 offset = op->offset; + CARD32 pixel = Fetch4(line, offset); + + return op->indexed->rgba[pixel]; +} + +CARD32 +fbFetcha_a1 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD32 *)line)[offset >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst @@ -1194,8 +1962,9 @@ fbFetcha_a1 (FbBits *line, CARD32 offset) } CARD32 -fbFetch_a1 (FbBits *line, CARD32 offset) +fbFetch_a1 (FbCompositeOperand *op) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel = ((CARD32 *)line)[offset >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst @@ -1210,6 +1979,21 @@ fbFetch_a1 (FbBits *line, CARD32 offset) return a << 24; } +CARD32 +fbFetch_g1 (FbCompositeOperand *op) +{ + FbBits *line = op->line; CARD32 offset = op->offset; + CARD32 pixel = ((CARD32 *)line)[offset >> 5]; + CARD32 a; +#if BITMAP_BIT_ORDER == MSBFirst + a = pixel >> (0x1f - offset & 0x1f); +#else + a = pixel >> (offset & 0x1f); +#endif + a = a & 1; + return op->indexed->rgba[a]; +} + /* * All the store functions */ @@ -1218,34 +2002,39 @@ fbFetch_a1 (FbBits *line, CARD32 offset) #define Split(v) CARD32 r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff void -fbStore_a8r8g8b8 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a8r8g8b8 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; ((CARD32 *)line)[offset >> 5] = value; } void -fbStore_x8r8g8b8 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_x8r8g8b8 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; ((CARD32 *)line)[offset >> 5] = value & 0xffffff; } void -fbStore_a8b8g8r8 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a8b8g8r8 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; Splita(value); ((CARD32 *)line)[offset >> 5] = a << 24 | b << 16 | g << 8 | r; } void -fbStore_x8b8g8r8 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_x8b8g8r8 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; Split(value); ((CARD32 *)line)[offset >> 5] = b << 16 | g << 8 | r; } void -fbStore_r8g8b8 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_r8g8b8 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); Split(value); #if IMAGE_BYTE_ORDER == MSBFirst @@ -1260,8 +2049,9 @@ fbStore_r8g8b8 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_b8g8r8 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_b8g8r8 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); Split(value); #if IMAGE_BYTE_ORDER == MSBFirst @@ -1276,8 +2066,9 @@ fbStore_b8g8r8 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_r5g6b5 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_r5g6b5 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD16 *pixel = ((CARD16 *) line) + (offset >> 4); Split(value); *pixel = (((r << 8) & 0xf800) | @@ -1286,8 +2077,9 @@ fbStore_r5g6b5 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_b5g6r5 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_b5g6r5 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD16 *pixel = ((CARD16 *) line) + (offset >> 4); Split(value); *pixel = (((b << 8) & 0xf800) | @@ -1296,8 +2088,9 @@ fbStore_b5g6r5 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_a1r5g5b5 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a1r5g5b5 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD16 *pixel = ((CARD16 *) line) + (offset >> 4); Splita(value); *pixel = (((a << 8) & 0x8000) | @@ -1307,8 +2100,9 @@ fbStore_a1r5g5b5 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_x1r5g5b5 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_x1r5g5b5 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD16 *pixel = ((CARD16 *) line) + (offset >> 4); Split(value); *pixel = (((r << 7) & 0x7c00) | @@ -1317,8 +2111,9 @@ fbStore_x1r5g5b5 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_a1b5g5r5 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a1b5g5r5 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD16 *pixel = ((CARD16 *) line) + (offset >> 4); Splita(value); *pixel = (((a << 8) & 0x8000) | @@ -1328,8 +2123,9 @@ fbStore_a1b5g5r5 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_x1b5g5r5 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_x1b5g5r5 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD16 *pixel = ((CARD16 *) line) + (offset >> 4); Split(value); *pixel = (((b << 7) & 0x7c00) | @@ -1338,15 +2134,17 @@ fbStore_x1b5g5r5 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_a8 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a8 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); *pixel = value >> 24; } void -fbStore_r3g3b2 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_r3g3b2 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); Split(value); *pixel = (((r ) & 0xe0) | @@ -1355,8 +2153,9 @@ fbStore_r3g3b2 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_b2g3r3 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_b2g3r3 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); Split(value); *pixel = (((b ) & 0xe0) | @@ -1365,8 +2164,9 @@ fbStore_b2g3r3 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_a2r2g2b2 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a2r2g2b2 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); Splita(value); *pixel = (((a ) & 0xc0) | @@ -1375,26 +2175,44 @@ fbStore_a2r2g2b2 (FbBits *line, CARD32 offset, CARD32 value) ((b >> 6) )); } +void +fbStore_c8 (FbCompositeOperand *op, CARD32 value) +{ + FbBits *line = op->line; CARD32 offset = op->offset; + CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); + *pixel = miIndexToEnt24(op->indexed,value); +} + +void +fbStore_g8 (FbCompositeOperand *op, CARD32 value) +{ + FbBits *line = op->line; CARD32 offset = op->offset; + CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); + *pixel = miIndexToEntY24(op->indexed,value); +} + #define Store8(l,o,v) (((CARD8 *) l)[(o) >> 3] = (v)) #if IMAGE_BYTE_ORDER == MSBFirst -#define Store4(l,o,v) Store8(l,o,((o) & 2 ? \ - Fetch8(l,o) & 0xf0 | (v) : \ - Fetch8(l,o) & 0x0f | ((v) << 4))) +#define Store4(l,o,v) Store8(l,o,((o) & 4 ? \ + (Fetch8(l,o) & 0xf0) | (v) : \ + (Fetch8(l,o) & 0x0f) | ((v) << 4))) #else -#define Store4(l,o,v) Store8(l,o,((o) & 2 ? \ - Fetch8(l,o) & 0x0f | ((v) << 4) : \ - Fetch8(l,o) & 0xf0 | (v))) +#define Store4(l,o,v) Store8(l,o,((o) & 4 ? \ + (Fetch8(l,o) & 0x0f) | ((v) << 4) : \ + (Fetch8(l,o) & 0xf0) | (v))) #endif void -fbStore_a4 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a4 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; Store4(line,offset,value>>28); } void -fbStore_r1g2b1 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_r1g2b1 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel; Split(value); @@ -1405,8 +2223,9 @@ fbStore_r1g2b1 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_b1g2r1 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_b1g2r1 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel; Split(value); @@ -1417,8 +2236,9 @@ fbStore_b1g2r1 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_a1r1g1b1 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a1r1g1b1 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel; Splita(value); pixel = (((a >> 4) & 0x8) | @@ -1429,8 +2249,9 @@ fbStore_a1r1g1b1 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_a1b1g1r1 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_a1b1g1r1 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 pixel; Splita(value); pixel = (((a >> 4) & 0x8) | @@ -1441,13 +2262,68 @@ fbStore_a1b1g1r1 (FbBits *line, CARD32 offset, CARD32 value) } void -fbStore_a1 (FbBits *line, CARD32 offset, CARD32 value) +fbStore_c4 (FbCompositeOperand *op, CARD32 value) { + FbBits *line = op->line; CARD32 offset = op->offset; + CARD32 pixel; + + pixel = miIndexToEnt24(op->indexed,value); + Store4(line,offset,pixel); +} + +void +fbStore_g4 (FbCompositeOperand *op, CARD32 value) +{ + FbBits *line = op->line; CARD32 offset = op->offset; + CARD32 pixel; + + pixel = miIndexToEntY24(op->indexed,value); + Store4(line,offset,pixel); +} + +void +fbStore_a1 (FbCompositeOperand *op, CARD32 value) +{ + FbBits *line = op->line; CARD32 offset = op->offset; CARD32 *pixel = ((CARD32 *) line) + (offset >> 5); CARD32 mask = FbStipMask(offset & 0x1f, 1); value = value & 0x80000000 ? mask : 0; - *pixel = *pixel & ~mask | value; + *pixel = (*pixel & ~mask) | value; +} + +void +fbStore_g1 (FbCompositeOperand *op, CARD32 value) +{ + FbBits *line = op->line; CARD32 offset = op->offset; + CARD32 *pixel = ((CARD32 *) line) + (offset >> 5); + CARD32 mask = FbStipMask(offset & 0x1f, 1); + + value = miIndexToEntY24(op->indexed,value) ? mask : 0; + *pixel = (*pixel & ~mask) | value; +} + +CARD32 +fbFetch_external (FbCompositeOperand *op) +{ + CARD32 rgb = (*op[1].fetch) (&op[1]); + CARD32 a = (*op[2].fetch) (&op[2]); + + return (rgb & 0xffffff) | (a & 0xff000000); +} + + +CARD32 +fbFetcha_external (FbCompositeOperand *op) +{ + return (*op[2].fetch) (&op[2]); +} + +void +fbStore_external (FbCompositeOperand *op, CARD32 value) +{ + (*op[1].store) (&op[1], value | 0xff000000); + (*op[2].store) (&op[2], value & 0xff000000); } FbAccessMap fbAccessMap[] = { @@ -1475,6 +2351,8 @@ FbAccessMap fbAccessMap[] = { PICT_r3g3b2, fbFetch_r3g3b2, fbFetch_r3g3b2, fbStore_r3g3b2, PICT_b2g3r3, fbFetch_b2g3r3, fbFetch_b2g3r3, fbStore_b2g3r3, PICT_a2r2g2b2, fbFetch_a2r2g2b2, fbFetch_a2r2g2b2, fbStore_a2r2g2b2, + PICT_c8, fbFetch_c8, fbFetch_c8, fbStore_c8, + PICT_g8, fbFetch_c8, fbFetch_c8, fbStore_g8, /* 4bpp formats */ PICT_a4, fbFetch_a4, fbFetcha_a4, fbStore_a4, @@ -1482,17 +2360,20 @@ FbAccessMap fbAccessMap[] = { PICT_b1g2r1, fbFetch_b1g2r1, fbFetch_b1g2r1, fbStore_b1g2r1, PICT_a1r1g1b1, fbFetch_a1r1g1b1, fbFetch_a1r1g1b1, fbStore_a1r1g1b1, PICT_a1b1g1r1, fbFetch_a1b1g1r1, fbFetch_a1b1g1r1, fbStore_a1b1g1r1, + PICT_c4, fbFetch_c4, fbFetch_c4, fbStore_c4, + PICT_g4, fbFetch_c4, fbFetch_c4, fbStore_g4, /* 1bpp formats */ PICT_a1, fbFetch_a1, fbFetcha_a1, fbStore_a1, + PICT_g1, fbFetch_g1, fbFetch_g1, fbStore_g1, }; #define NumAccessMap (sizeof fbAccessMap / sizeof fbAccessMap[0]) Bool -fbBuildCompositeOperand (PicturePtr pPict, - FbCompositeOperand *op, - INT16 x, - INT16 y) +fbBuildOneCompositeOperand (PicturePtr pPict, + FbCompositeOperand *op, + INT16 x, + INT16 y) { int i; @@ -1502,20 +2383,49 @@ fbBuildCompositeOperand (PicturePtr pPict, op->fetch = fbAccessMap[i].fetch; op->fetcha = fbAccessMap[i].fetcha; op->store = fbAccessMap[i].store; - fbGetDrawable (pPict->pDrawable, op->line, op->stride, op->bpp); + op->indexed = (miIndexedPtr) pPict->pFormat->indexed; + fbGetDrawable (pPict->pDrawable, op->line, op->stride, op->bpp, + op->xoff, op->yoff); if (pPict->repeat && pPict->pDrawable->width == 1 && pPict->pDrawable->height == 1) { op->bpp = 0; op->stride = 0; } - op->line = op->line + y * op->stride; + op->line = op->line + (y + op->yoff) * op->stride; op->offset = 0; return TRUE; } return FALSE; } +Bool +fbBuildCompositeOperand (PicturePtr pPict, + FbCompositeOperand op[3], + INT16 x, + INT16 y) +{ + if (pPict->alphaMap) + { + if (!fbBuildOneCompositeOperand (pPict, &op[1], x, y)) + return FALSE; + if (!fbBuildOneCompositeOperand (pPict->alphaMap, &op[2], + x - pPict->alphaOrigin.x, + y - pPict->alphaOrigin.y)) + return FALSE; + op[0].fetch = fbFetch_external; + op[0].fetcha = fbFetcha_external; + op[0].store = fbStore_external; + op[2].xoff -= pPict->alphaOrigin.x; + op[2].yoff -= pPict->alphaOrigin.y; + return TRUE; + } + else + { + return fbBuildOneCompositeOperand (pPict, &op[0], x, y); + } +} + void fbCompositeGeneral (CARD8 op, PicturePtr pSrc, @@ -1530,44 +2440,104 @@ fbCompositeGeneral (CARD8 op, CARD16 width, CARD16 height) { - FbCompositeOperand src,msk,dst,*pmsk; + FbCompositeOperand src[3],msk[3],dst[3],*pmsk; + FbCompositeOperand *srcPict, *srcAlpha; + FbCompositeOperand *dstPict, *dstAlpha; + FbCompositeOperand *mskPict, *mskAlpha; FbCombineFunc f; int w; - if (!fbBuildCompositeOperand (pSrc, &src, xSrc, ySrc)) + if (!fbBuildCompositeOperand (pSrc, src, xSrc, ySrc)) return; - if (!fbBuildCompositeOperand (pDst, &dst, xDst, yDst)) + if (!fbBuildCompositeOperand (pDst, dst, xDst, yDst)) return; + if (pSrc->alphaMap) + { + srcPict = &src[1]; + srcAlpha = &src[2]; + } + else + { + srcPict = &src[0]; + srcAlpha = 0; + } + if (pDst->alphaMap) + { + dstPict = &dst[1]; + dstAlpha = &dst[2]; + } + else + { + dstPict = &dst[0]; + dstAlpha = 0; + } f = fbCombineFuncU[op]; if (pMask) { - if (!fbBuildCompositeOperand (pMask, &msk, xMask, yMask)) + if (!fbBuildCompositeOperand (pMask, msk, xMask, yMask)) return; - pmsk = &msk; + pmsk = msk; if (pMask->componentAlpha) f = fbCombineFuncC[op]; + if (pMask->alphaMap) + { + mskPict = &msk[1]; + mskAlpha = &msk[2]; + } + else + { + mskPict = &msk[0]; + mskAlpha = 0; + } } else pmsk = 0; while (height--) { w = width; - src.offset = xSrc * src.bpp; - dst.offset = xDst * dst.bpp; + + srcPict->offset = (xSrc + srcPict->xoff) * srcPict->bpp; + if (srcAlpha) + srcAlpha->offset = (xSrc + srcAlpha->xoff) * srcAlpha->bpp; + + dstPict->offset = (xDst + dstPict->xoff) * dstPict->bpp; + if (dstAlpha) + dstAlpha->offset = (xDst + dstAlpha->xoff) * dstAlpha->bpp; + if (pmsk) - msk.offset = xMask * msk.bpp; + { + mskPict->offset = (xMask + mskPict->xoff) * mskPict->bpp; + if (mskAlpha) + mskAlpha->offset = (xMask + mskAlpha->xoff) * mskAlpha->bpp; + } while (w--) { - (*f) (&src, pmsk, &dst); - src.offset += src.bpp; - dst.offset += dst.bpp; + (*f) (src, pmsk, dst); + srcPict->offset += srcPict->bpp; + if (srcAlpha) + srcAlpha->offset += srcAlpha->bpp; + dstPict->offset += dstPict->bpp; + if (dstAlpha) + dstAlpha->offset += dstAlpha->bpp; if (pmsk) - msk.offset += msk.bpp; + { + mskPict->offset += mskPict->bpp; + if (mskAlpha) + mskAlpha->offset += mskAlpha->bpp; + } } - src.line += src.stride; - dst.line += dst.stride; + srcPict->line += srcPict->stride; + if (srcAlpha) + srcAlpha->line += srcAlpha->stride; + + dstPict->line += dstPict->stride; + if (dstAlpha) + dstAlpha->line += dstAlpha->stride; if (pmsk) - msk.line += msk.stride; + { + mskPict->line += mskPict->stride; + if (mskAlpha) + mskAlpha->line += mskAlpha->stride; + } } - } diff --git a/xc/programs/Xserver/fb/fbpict.c b/xc/programs/Xserver/fb/fbpict.c index 70545995d..c89c0d7bc 100644 --- a/xc/programs/Xserver/fb/fbpict.c +++ b/xc/programs/Xserver/fb/fbpict.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fbpict.c,v 1.8 2001/02/09 02:12:17 keithp Exp $ + * $XFree86: xc/programs/Xserver/fb/fbpict.c,v 1.12 2001/07/16 05:04:05 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -99,6 +99,43 @@ fbIn (CARD32 x, CARD8 y) return m|n|o|p; } +#define fbComposeGetSolid(pict, bits) { \ + FbBits *__bits__; \ + FbStride __stride__; \ + int __bpp__; \ + int __xoff__,__yoff__; \ +\ + fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ + switch (__bpp__) { \ + case 32: \ + (bits) = *(CARD32 *) __bits__; \ + break; \ + case 24: \ + (bits) = Fetch24 ((CARD8 *) __bits__); \ + break; \ + case 16: \ + (bits) = *(CARD16 *) __bits__; \ + (bits) = cvt0565to8888(bits); \ + break; \ + default: \ + return; \ + } \ + /* manage missing src alpha */ \ + if ((pict)->pFormat->direct.alphaMask == 0) \ + (bits) |= 0xff000000; \ +} + +#define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\ + FbBits *__bits__; \ + FbStride __stride__; \ + int __bpp__; \ + int __xoff__,__yoff__; \ +\ + fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ + (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \ + (line) = ((type *) __bits__) + (stride) * ((y) - __yoff__) + (mul) * ((x) - __xoff__); \ +} + /* * Naming convention: * @@ -122,43 +159,18 @@ fbCompositeSolidMask_nx8x8888 (CARD8 op, CARD32 src, srca; CARD32 *dstLine, *dst, d, dstMask; CARD8 *maskLine, *mask, m; - FbBits *dstBits, *maskBits, *srcBits; - FbStride dstStride, maskStride, srcStride; - int dstBpp, maskBpp, srcBpp; + FbStride dstStride, maskStride; CARD16 w; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - switch (srcBpp) { - case 32: - src = *(CARD32 *) srcBits; - break; - case 24: - src = Fetch24 ((CARD8 *) srcBits); - break; - case 16: - src = *(CARD16 *) srcBits; - src = cvt0565to8888(src); - break; - default: - return; - } - /* manage missing src alpha */ - if (pSrc->pFormat->direct.alphaMask == 0) - src |= 0xff000000; + fbComposeGetSolid(pSrc, src); + dstMask = FbFullMask (pDst->pDrawable->depth); srca = src >> 24; if (src == 0) return; - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD32 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD32); - dstLine += dstStride * yDst + xDst; - - fbGetDrawable(pMask->pDrawable, maskBits, maskStride, maskBpp); - maskLine = (CARD8 *) maskBits; - maskStride = maskStride * sizeof (FbBits) / sizeof (CARD8); - maskLine += maskStride * yMask + xMask; + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { @@ -205,42 +217,19 @@ fbCompositeSolidMask_nx8888x8888C (CARD8 op, CARD32 src, srca; CARD32 *dstLine, *dst, d, dstMask; CARD32 *maskLine, *mask, ma; - FbBits *dstBits, *maskBits, *srcBits; - FbStride dstStride, maskStride, srcStride; - int dstBpp, maskBpp, srcBpp; + FbStride dstStride, maskStride; CARD16 w; CARD32 m, n, o, p; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - switch (srcBpp) { - case 32: - src = *(CARD32 *) srcBits; - break; - case 24: - src = Fetch24 ((CARD8 *) srcBits); - break; - case 16: - src = *(CARD16 *) srcBits; - src = cvt0565to8888(src); - break; - } - /* manage missing src alpha */ - if (pSrc->pFormat->direct.alphaMask == 0) - src |= 0xff000000; + fbComposeGetSolid(pSrc, src); + dstMask = FbFullMask (pDst->pDrawable->depth); srca = src >> 24; if (src == 0) return; - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD32 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD32); - dstLine += dstStride * yDst + xDst; - - fbGetDrawable(pMask->pDrawable, maskBits, maskStride, maskBpp); - maskLine = (CARD32 *) maskBits; - maskStride = maskStride * sizeof (FbBits) / sizeof (CARD32); - maskLine += maskStride * yMask + xMask; + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); while (height--) { @@ -302,40 +291,17 @@ fbCompositeSolidMask_nx8x0888 (CARD8 op, CARD8 *dstLine, *dst; CARD32 d; CARD8 *maskLine, *mask, m; - FbBits *dstBits, *maskBits, *srcBits; - FbStride dstStride, maskStride, srcStride; - int dstBpp, maskBpp, srcBpp; + FbStride dstStride, maskStride; CARD16 w; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - switch (srcBpp) { - case 32: - src = *(CARD32 *) srcBits; - break; - case 24: - src = Fetch24 ((CARD8 *) srcBits); - break; - case 16: - src = *(CARD16 *) srcBits; - src = cvt0565to8888(src); - break; - } - /* manage missing src alpha */ - if (pSrc->pFormat->direct.alphaMask == 0) - src |= 0xff000000; + fbComposeGetSolid(pSrc, src); + srca = src >> 24; if (src == 0) return; - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD8 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD8); - dstLine += dstStride * yDst + xDst * 3; - - fbGetDrawable(pMask->pDrawable, maskBits, maskStride, maskBpp); - maskLine = (CARD8 *) maskBits; - maskStride = maskStride * sizeof (FbBits) / sizeof (CARD8); - maskLine += maskStride * yMask + xMask; + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { @@ -387,40 +353,17 @@ fbCompositeSolidMask_nx8x0565 (CARD8 op, CARD16 *dstLine, *dst; CARD32 d; CARD8 *maskLine, *mask, m; - FbBits *dstBits, *maskBits, *srcBits; - FbStride dstStride, maskStride, srcStride; - int dstBpp, maskBpp, srcBpp; + FbStride dstStride, maskStride; CARD16 w; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - switch (srcBpp) { - case 32: - src = *(CARD32 *) srcBits; - break; - case 24: - src = Fetch24 ((CARD8 *) srcBits); - break; - case 16: - src = *(CARD16 *) srcBits; - src = cvt0565to8888(src); - break; - } - /* manage missing src alpha */ - if (pSrc->pFormat->direct.alphaMask == 0) - src |= 0xff000000; + fbComposeGetSolid(pSrc, src); + srca = src >> 24; if (src == 0) return; - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD16 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD16); - dstLine += dstStride * yDst + xDst; - - fbGetDrawable(pMask->pDrawable, maskBits, maskStride, maskBpp); - maskLine = (CARD8 *) maskBits; - maskStride = maskStride * sizeof (FbBits) / sizeof (CARD8); - maskLine += maskStride * yMask + xMask; + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { @@ -456,6 +399,79 @@ fbCompositeSolidMask_nx8x0565 (CARD8 op, } void +fbCompositeSolidMask_nx8888x0565C (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 src, srca; + CARD16 src16; + CARD16 *dstLine, *dst; + CARD32 d; + CARD32 *maskLine, *mask, ma; + FbStride dstStride, maskStride; + CARD16 w; + CARD32 m, n, o; + + fbComposeGetSolid(pSrc, src); + + srca = src >> 24; + if (src == 0) + return; + + src16 = cvt8888to0565(src); + + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + + while (w--) + { + ma = *mask++; + if (ma == 0xffffffff) + { + if (srca == 0xff) + { + *dst = src16; + } + else + { + d = *dst; + d = fbOver24 (src, cvt0565to8888(d)); + *dst = cvt8888to0565(d); + } + } + else if (ma) + { + d = *dst; + d = cvt0565to8888(d); + FbInOverC (src, srca, ma, d, 0, m); + FbInOverC (src, srca, ma, d, 8, n); + FbInOverC (src, srca, ma, d, 16, o); + d = m|n|o; + *dst = cvt8888to0565(d); + } + dst++; + } + } +} + +void fbCompositeSrc_8888x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, @@ -471,22 +487,14 @@ fbCompositeSrc_8888x8888 (CARD8 op, { CARD32 *dstLine, *dst, dstMask; CARD32 *srcLine, *src, s; - CARD8 a; - FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; - int dstBpp, srcBpp; + CARD8 a; CARD16 w; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - srcLine = (CARD32 *) srcBits; - srcStride = srcStride * sizeof (FbBits) / sizeof (CARD32); - srcLine += srcStride * ySrc + xSrc; - + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + dstMask = FbFullMask (pDst->pDrawable->depth); - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD32 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD32); - dstLine += dstStride * yDst + xDst; while (height--) { @@ -527,21 +535,12 @@ fbCompositeSrc_8888x0888 (CARD8 op, CARD32 d; CARD32 *srcLine, *src, s; CARD8 a; - FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; - int dstBpp, srcBpp; CARD16 w; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - srcLine = (CARD32 *) srcBits; - srcStride = srcStride * sizeof (FbBits) / sizeof (CARD32); - srcLine += srcStride * ySrc + xSrc; - - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD8 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD8); - dstLine += dstStride * yDst + xDst * 3; - + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + while (height--) { dst = dstLine; @@ -585,20 +584,11 @@ fbCompositeSrc_8888x0565 (CARD8 op, CARD32 d; CARD32 *srcLine, *src, s; CARD8 a; - FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; - int dstBpp, srcBpp; CARD16 w; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - srcLine = (CARD32 *) srcBits; - srcStride = srcStride * sizeof (FbBits) / sizeof (CARD32); - srcLine += srcStride * ySrc + xSrc; - - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD16 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD16); - dstLine += dstStride * yDst + xDst; + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); while (height--) { @@ -644,20 +634,12 @@ fbCompositeSrc_0565x0565 (CARD8 op, { CARD16 *dstLine, *dst; CARD16 *srcLine, *src; - FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; - int dstBpp, srcBpp; CARD16 w; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - srcLine = (CARD16 *) srcBits; - srcStride = srcStride * sizeof (FbBits) / sizeof (CARD16); - srcLine += srcStride * ySrc + xSrc; + fbComposeGetStart (pSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1); - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD16 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD16); - dstLine += dstStride * yDst + xDst; + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); while (height--) { @@ -688,22 +670,13 @@ fbCompositeSrcAdd_8000x8000 (CARD8 op, { CARD8 *dstLine, *dst; CARD8 *srcLine, *src; - FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; - int dstBpp, srcBpp; CARD8 w; CARD8 s, d; CARD16 t; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - srcLine = (CARD8 *) srcBits; - srcStride = srcStride * sizeof (FbBits) / sizeof (CARD8); - srcLine += srcStride * ySrc + xSrc; - - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); - dstLine = (CARD8 *) dstBits; - dstStride = dstStride * sizeof (FbBits) / sizeof (CARD8); - dstLine += dstStride * yDst + xDst; + fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); while (height--) { @@ -728,6 +701,59 @@ fbCompositeSrcAdd_8000x8000 (CARD8 op, } void +fbCompositeSrcAdd_8888x8888 (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 *dstLine, *dst; + CARD32 *srcLine, *src; + FbStride dstStride, srcStride; + CARD16 w; + CARD32 s, d; + CARD16 t; + CARD32 m,n,o,p; + + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + while (w--) + { + s = *src++; + if (s != 0xffffffff) + { + d = *dst; + if (d) + { + m = FbAdd(s,d,0,t); + n = FbAdd(s,d,8,t); + o = FbAdd(s,d,16,t); + p = FbAdd(s,d,24,t); + s = m|n|o|p; + } + } + *dst++ = s; + } + } +} + +void fbCompositeSrcAdd_1000x1000 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, @@ -744,18 +770,20 @@ fbCompositeSrcAdd_1000x1000 (CARD8 op, FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; int dstBpp, srcBpp; + int dstXoff, dstYoff; + int srcXoff, srcYoff; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); + fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp); + fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); - fbBlt (srcBits + srcStride * ySrc, + fbBlt (srcBits + srcStride * (ySrc + srcYoff), srcStride, - xSrc, + xSrc + srcXoff, - dstBits + dstStride * yDst, + dstBits + dstStride * (yDst + dstYoff), dstStride, - xDst, + xDst + dstXoff, width, height, @@ -782,28 +810,18 @@ fbCompositeSolidMask_nx1xn (CARD8 op, CARD16 width, CARD16 height) { - FbBits *dstBits, *srcBits; + FbBits *dstBits; FbStip *maskBits; - FbStride dstStride, maskStride, srcStride; - int dstBpp, maskBpp, srcBpp; + FbStride dstStride, maskStride; + int dstBpp, maskBpp; + int dstXoff, dstYoff; + int maskXoff, maskYoff; FbBits src; - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp); - switch (srcBpp) { - case 32: - src = *(CARD32 *) srcBits; - break; - case 24: - src = Fetch24 ((CARD8 *) srcBits); - break; - case 16: - src = *(CARD16 *) srcBits; - src = cvt0565to8888(src); - break; - } + fbComposeGetSolid(pSrc, src); - fbGetStipDrawable (pMask->pDrawable, maskBits, maskStride, maskBpp); - fbGetDrawable (pDst->pDrawable, dstBits, dstStride, dstBpp); + fbGetStipDrawable (pMask->pDrawable, maskBits, maskStride, maskBpp, maskXoff, maskYoff); + fbGetDrawable (pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); switch (dstBpp) { case 32: @@ -817,13 +835,13 @@ fbCompositeSolidMask_nx1xn (CARD8 op, src = fbReplicatePixel (src, dstBpp); - fbBltOne (maskBits + maskStride * yMask, + fbBltOne (maskBits + maskStride * (yMask + maskYoff), maskStride, - xMask, + xMask + maskXoff, - dstBits + dstStride * yDst, + dstBits + dstStride * (yDst + dstYoff), dstStride, - xDst * dstBpp, + (xDst + dstXoff) * dstBpp, dstBpp, width * dstBpp, @@ -857,6 +875,9 @@ fbComposite (CARD8 op, CompositeFunc func; Bool srcRepeat = pSrc->repeat; Bool maskRepeat = FALSE; + Bool srcAlphaMap = pSrc->alphaMap != 0; + Bool maskAlphaMap = FALSE; + Bool dstAlphaMap = pDst->alphaMap != 0; int x_msk, y_msk, x_src, y_src, x_dst, y_dst; int w, h, w_this, h_this; @@ -869,6 +890,7 @@ fbComposite (CARD8 op, xMask += pMask->pDrawable->x; yMask += pMask->pDrawable->y; maskRepeat = pMask->repeat; + maskAlphaMap = pMask->alphaMap != 0; } if (!miComputeCompositeRegion (®ion, @@ -886,6 +908,7 @@ fbComposite (CARD8 op, return; func = fbCompositeGeneral; + if (!maskAlphaMap && !srcAlphaMap && !dstAlphaMap) switch (op) { case PictOpOver: if (pMask) @@ -922,6 +945,9 @@ fbComposite (CARD8 op, case PICT_x8r8g8b8: func = fbCompositeSolidMask_nx8888x8888C; break; + case PICT_r5g6b5: + func = fbCompositeSolidMask_nx8888x0565C; + break; } } break; @@ -932,6 +958,9 @@ fbComposite (CARD8 op, case PICT_x8b8g8r8: func = fbCompositeSolidMask_nx8888x8888C; break; + case PICT_b5g6r5: + func = fbCompositeSolidMask_nx8888x0565C; + break; } } break; @@ -1006,18 +1035,34 @@ fbComposite (CARD8 op, if (pMask == 0) { switch (pSrc->format) { + case PICT_a8r8g8b8: + switch (pDst->format) { + case PICT_a8r8g8b8: + func = fbCompositeSrcAdd_8888x8888; + break; + } + break; + case PICT_a8b8g8r8: + switch (pDst->format) { + case PICT_a8b8g8r8: + func = fbCompositeSrcAdd_8888x8888; + break; + } + break; case PICT_a8: switch (pDst->format) { case PICT_a8: func = fbCompositeSrcAdd_8000x8000; break; } + break; case PICT_a1: switch (pDst->format) { case PICT_a1: func = fbCompositeSrcAdd_1000x1000; break; } + break; } } break; diff --git a/xc/programs/Xserver/fb/fbpict.h b/xc/programs/Xserver/fb/fbpict.h index 0eaaeec26..7b2ad5833 100644 --- a/xc/programs/Xserver/fb/fbpict.h +++ b/xc/programs/Xserver/fb/fbpict.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fbpict.h,v 1.3 2001/01/21 21:19:09 tsi Exp $ + * $XFree86: xc/programs/Xserver/fb/fbpict.h,v 1.8 2001/08/16 08:03:25 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -26,6 +26,7 @@ #define _FBPICT_H_ #define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) +#define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b)) #define FbGet8(v,i) ((CARD16) (CARD8) ((v) >> i)) @@ -47,9 +48,10 @@ #define FbInC(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i)) -#define FbGen(x,y,i,ax,ay,t) ((t) = (FbIntMult(FbGet8(y,i),ay,(t)) + \ - FbIntMult(FbGet8(x,i),ax,(t))),\ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) +#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (FbIntMult(FbGet8(y,i),ay,(u)) + \ + FbIntMult(FbGet8(x,i),ax,(v))),\ + (CARD32) ((CARD8) ((t) | \ + (0 - ((t) >> 8)))) << (i)) #define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \ (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) @@ -68,18 +70,23 @@ typedef void (*CompositeFunc) (CARD8 op, CARD16 width, CARD16 height); -typedef CARD32 (*FbCompositeFetch)(FbBits *line, CARD32 offset); -typedef void (*FbCompositeStore) (FbBits *line, CARD32 offset, CARD32 value); +typedef struct _FbCompositeOperand FbCompositeOperand; -typedef struct _FbCompositeOperand { +typedef CARD32 (*FbCompositeFetch)(FbCompositeOperand *op); +typedef void (*FbCompositeStore) (FbCompositeOperand *op, CARD32 value); + +struct _FbCompositeOperand { FbBits *line; CARD32 offset; FbStride stride; + int xoff; + int yoff; int bpp; FbCompositeFetch fetch; FbCompositeFetch fetcha; FbCompositeStore store; -} FbCompositeOperand; + miIndexedPtr indexed; +}; typedef void (*FbCombineFunc) (FbCompositeOperand *src, FbCompositeOperand *msk, @@ -104,223 +111,336 @@ extern FbAccessMap fbAccessMap[]; /* fbcompose.c */ +typedef struct _fbCompSrc { + CARD32 value; + CARD32 alpha; +} FbCompSrc; + /* * All compositing operators * */ CARD32 +fbCombineMaskU (FbCompositeOperand *src, + FbCompositeOperand *msk); + +FbCompSrc +fbCombineMaskC (FbCompositeOperand *src, + FbCompositeOperand *msk); + +CARD32 +fbCombineMaskValueC (FbCompositeOperand *src, + FbCompositeOperand *msk); + +CARD32 +fbCombineMaskAlphaU (FbCompositeOperand *src, + FbCompositeOperand *msk); + +CARD32 +fbCombineMaskAlphaC (FbCompositeOperand *src, + FbCompositeOperand *msk); + + +#if 0 +CARD32 FbCombineMask (FbCompositeOperand *src, FbCompositeOperand *msk); +#endif void -FbCombineClear (FbCompositeOperand *src, +fbCombineClear (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst); void -FbCombineSrc (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineSrcU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineDst (FbCompositeOperand *src, +fbCombineSrcC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineDst (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst); void -FbCombineOver (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineOverU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineOverC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineOverReverse (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineOverReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineIn (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineOverReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineInReverse (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineInU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineOut (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineInC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineOutReverse (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineInReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineAtop (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineInReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineAtopReverse (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineOutU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineXor (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineOutC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineAdd (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineOutReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); void -FbCombineSaturate (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +fbCombineOutReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); +void +fbCombineAtopU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + + +void +fbCombineAtopC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineAtopReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineAtopReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineXorU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineXorC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + + +void +fbCombineAddU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineAddC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineSaturateU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +void +fbCombineSaturateC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); /* * All fetch functions */ CARD32 -fbFetch_a8r8g8b8 (FbBits *line, CARD32 offset); +fbFetch_a8r8g8b8 (FbCompositeOperand *op); + +CARD32 +fbFetch_x8r8g8b8 (FbCompositeOperand *op); + +CARD32 +fbFetch_a8b8g8r8 (FbCompositeOperand *op); CARD32 -fbFetch_x8r8g8b8 (FbBits *line, CARD32 offset); +fbFetch_x8b8g8r8 (FbCompositeOperand *op); CARD32 -fbFetch_a8b8g8r8 (FbBits *line, CARD32 offset); +fbFetch_r8g8b8 (FbCompositeOperand *op); CARD32 -fbFetch_x8b8g8r8 (FbBits *line, CARD32 offset); +fbFetch_b8g8r8 (FbCompositeOperand *op); CARD32 -fbFetch_r8g8b8 (FbBits *line, CARD32 offset); +fbFetch_r5g6b5 (FbCompositeOperand *op); CARD32 -fbFetch_b8g8r8 (FbBits *line, CARD32 offset); +fbFetch_b5g6r5 (FbCompositeOperand *op); CARD32 -fbFetch_r5g6b5 (FbBits *line, CARD32 offset); +fbFetch_a1r5g5b5 (FbCompositeOperand *op); CARD32 -fbFetch_b5g6r5 (FbBits *line, CARD32 offset); +fbFetch_x1r5g5b5 (FbCompositeOperand *op); CARD32 -fbFetch_a1r5g5b5 (FbBits *line, CARD32 offset); +fbFetch_a1b5g5r5 (FbCompositeOperand *op); CARD32 -fbFetch_x1r5g5b5 (FbBits *line, CARD32 offset); +fbFetch_x1b5g5r5 (FbCompositeOperand *op); CARD32 -fbFetch_a1b5g5r5 (FbBits *line, CARD32 offset); +fbFetch_a8 (FbCompositeOperand *op); CARD32 -fbFetch_x1b5g5r5 (FbBits *line, CARD32 offset); +fbFetcha_a8 (FbCompositeOperand *op); CARD32 -fbFetch_a8 (FbBits *line, CARD32 offset); +fbFetch_r3g3b2 (FbCompositeOperand *op); CARD32 -fbFetch_r3g3b2 (FbBits *line, CARD32 offset); +fbFetch_b2g3r3 (FbCompositeOperand *op); CARD32 -fbFetch_b2g3r3 (FbBits *line, CARD32 offset); +fbFetch_a2r2g2b2 (FbCompositeOperand *op); CARD32 -fbFetch_a2r2g2b2 (FbBits *line, CARD32 offset); +fbFetch_a2b2g2r2 (FbCompositeOperand *op); CARD32 -fbFetch_a2b2g2r2 (FbBits *line, CARD32 offset); +fbFetch_a4 (FbCompositeOperand *op); CARD32 -fbFetch_a4 (FbBits *line, CARD32 offset); +fbFetcha_a4 (FbCompositeOperand *op); CARD32 -fbFetch_r1g2b1 (FbBits *line, CARD32 offset); +fbFetch_r1g2b1 (FbCompositeOperand *op); CARD32 -fbFetch_b1g2r1 (FbBits *line, CARD32 offset); +fbFetch_b1g2r1 (FbCompositeOperand *op); CARD32 -fbFetch_a1r1g1b1 (FbBits *line, CARD32 offset); +fbFetch_a1r1g1b1 (FbCompositeOperand *op); CARD32 -fbFetch_a1b1g1r1 (FbBits *line, CARD32 offset); +fbFetch_a1b1g1r1 (FbCompositeOperand *op); CARD32 -fbFetch_a1 (FbBits *line, CARD32 offset); +fbFetch_a1 (FbCompositeOperand *op); + +CARD32 +fbFetcha_a1 (FbCompositeOperand *op); void -fbStore_a8r8g8b8 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a8r8g8b8 (FbCompositeOperand *op, CARD32 value); void -fbStore_x8r8g8b8 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_x8r8g8b8 (FbCompositeOperand *op, CARD32 value); void -fbStore_a8b8g8r8 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a8b8g8r8 (FbCompositeOperand *op, CARD32 value); void -fbStore_x8b8g8r8 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_x8b8g8r8 (FbCompositeOperand *op, CARD32 value); void -fbStore_r8g8b8 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_r8g8b8 (FbCompositeOperand *op, CARD32 value); void -fbStore_b8g8r8 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_b8g8r8 (FbCompositeOperand *op, CARD32 value); void -fbStore_r5g6b5 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_r5g6b5 (FbCompositeOperand *op, CARD32 value); void -fbStore_b5g6r5 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_b5g6r5 (FbCompositeOperand *op, CARD32 value); void -fbStore_a1r5g5b5 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a1r5g5b5 (FbCompositeOperand *op, CARD32 value); void -fbStore_x1r5g5b5 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_x1r5g5b5 (FbCompositeOperand *op, CARD32 value); void -fbStore_a1b5g5r5 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a1b5g5r5 (FbCompositeOperand *op, CARD32 value); void -fbStore_x1b5g5r5 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_x1b5g5r5 (FbCompositeOperand *op, CARD32 value); void -fbStore_a8 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a8 (FbCompositeOperand *op, CARD32 value); void -fbStore_r3g3b2 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_r3g3b2 (FbCompositeOperand *op, CARD32 value); void -fbStore_b2g3r3 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_b2g3r3 (FbCompositeOperand *op, CARD32 value); void -fbStore_a2r2g2b2 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a2r2g2b2 (FbCompositeOperand *op, CARD32 value); void -fbStore_a4 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a4 (FbCompositeOperand *op, CARD32 value); void -fbStore_r1g2b1 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_r1g2b1 (FbCompositeOperand *op, CARD32 value); void -fbStore_b1g2r1 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_b1g2r1 (FbCompositeOperand *op, CARD32 value); void -fbStore_a1r1g1b1 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a1r1g1b1 (FbCompositeOperand *op, CARD32 value); void -fbStore_a1b1g1r1 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a1b1g1r1 (FbCompositeOperand *op, CARD32 value); void -fbStore_a1 (FbBits *line, CARD32 offset, CARD32 value); +fbStore_a1 (FbCompositeOperand *op, CARD32 value); + +CARD32 +fbFetch_external (FbCompositeOperand *op); + +CARD32 +fbFetcha_external (FbCompositeOperand *op); + +void +fbStore_external (FbCompositeOperand *op, CARD32 value); + +Bool +fbBuildOneCompositeOperand (PicturePtr pPict, + FbCompositeOperand *op, + INT16 x, + INT16 y); Bool fbBuildCompositeOperand (PicturePtr pPict, @@ -347,6 +467,9 @@ CARD32 fbOver (CARD32 x, CARD32 y); CARD32 +fbOver24 (CARD32 x, CARD32 y); + +CARD32 fbIn (CARD32 x, CARD8 y); void @@ -378,6 +501,20 @@ fbCompositeSolidMask_nx8x0888 (CARD8 op, CARD16 height); void +fbCompositeSolidMask_nx8888x8888C (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + +void fbCompositeSolidMask_nx8x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, @@ -392,6 +529,20 @@ fbCompositeSolidMask_nx8x0565 (CARD8 op, CARD16 height); void +fbCompositeSolidMask_nx8888x0565C (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + +void fbCompositeSrc_8888x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, @@ -448,6 +599,62 @@ fbCompositeSrc_0565x0565 (CARD8 op, CARD16 height); void +fbCompositeSrcAdd_8000x8000 (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + +void +fbCompositeSrcAdd_8888x8888 (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + +void +fbCompositeSrcAdd_1000x1000 (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + +void +fbCompositeSolidMask_nx1xn (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + +void fbComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, 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 deleted file mode 100644 index 7c8a23fe9..000000000 --- a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/info.nib +++ /dev/null @@ -1,27 +0,0 @@ -<?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/Japanese.lproj/MainMenu.nib/info.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib deleted file mode 100644 index e2f8cf545..000000000 --- a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib +++ /dev/null @@ -1,27 +0,0 @@ -<?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/darwin.c b/xc/programs/Xserver/hw/darwin/darwin.c index 80299c505..018b9544b 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.23.2.2 2001/06/01 06:36:12 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.32 2001/08/12 00:10:01 torrey Exp $ */ #include "X.h" #include "Xproto.h" @@ -19,6 +19,7 @@ #include "site.h" #include "globals.h" #include "xf86Version.h" +#include "dix.h" #include <sys/types.h> #include <sys/time.h> @@ -36,13 +37,25 @@ #include "bundle/quartz.h" #include "xfIOKit.h" +// Quit after this many seconds if no quartz event poster is found. +// Leave undefined for no safety quit. +#undef QUARTZ_SAFETY_DELAY + +/* Fake button press/release for scroll wheel move. */ +#define SCROLLWHEELUPFAKE 4 +#define SCROLLWHEELDOWNFAKE 5 + // X server shared global variables -DarwinFramebufferRec dfb; +int darwinScreensFound = 0; +int darwinScreenIndex = 0; +DarwinInputRec hid; int darwinEventFD = -1; Bool quartz = FALSE; int quartzEventWriteFD = -1; int quartzStartClients = 1; +int quartzRootless = -1; int quartzUseSysBeep = 0; +int quartzMouseAccelChange = 1; int darwinFakeButtons = 0; UInt32 darwinDesiredWidth = 0, darwinDesiredHeight = 0; IOIndex darwinDesiredDepth = -1; @@ -50,17 +63,15 @@ SInt32 darwinDesiredRefresh = -1; UInt32 darwinScreenNumber = 0; char *darwinKeymapFile = NULL; -// Quit after this many seconds if no quartz event poster is found. -// Leave undefined for no safety quit. -#undef QUARTZ_SAFETY_DELAY - -/* Fake button press/release for scroll wheel move. */ -#define SCROLLWHEELUPFAKE 4 -#define SCROLLWHEELDOWNFAKE 5 +// modifier masks for faking mouse buttons +int darwinFakeMouse2Mask = NX_COMMANDMASK; +int darwinFakeMouse3Mask = NX_ALTERNATEMASK; static DeviceIntPtr darwinPointer; static DeviceIntPtr darwinKeyboard; -static unsigned char darwinKeyCommandL = 0, darwinKeyOptionL = 0; + +// button number of pressed fake button, or 0 if no fake button is pressed +static int darwinFakeMouseButtonDown = 0; // Common pixmap formats static PixmapFormatRec formats[] = { @@ -96,7 +107,7 @@ DarwinPrintBanner() "(http://www.XFree86.Org/cvs)\n"); #endif ErrorF("\nXFree86 Version %d.%d.%d", XF86_VERSION_MAJOR, XF86_VERSION_MINOR, - XF86_VERSION_PATCH); + XF86_VERSION_PATCH); #if XF86_VERSION_SNAP > 0 ErrorF(".%d", XF86_VERSION_SNAP); #endif @@ -108,8 +119,8 @@ DarwinPrintBanner() X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE ); ErrorF("Release Date: %s\n", XF86_DATE); ErrorF("\tIf the server is older than 6-12 months, or if your hardware is\n" - "\tnewer than the above date, look for a newer version before\n" - "\treporting problems. (See http://www.XFree86.Org/FAQ)\n"); + "\tnewer than the above date, look for a newer version before\n" + "\treporting problems. (See http://www.XFree86.Org/FAQ)\n"); ErrorF("Operating System:%s%s\n", OSNAME, OSVENDOR); #if defined(BUILDERSTRING) ErrorF("%s \n",BUILDERSTRING); @@ -133,7 +144,8 @@ static Bool DarwinSaveScreen(ScreenPtr pScreen, int on) /* * DarwinAddScreen - * This is a callback from X during AddScreen() from InitOutput() + * This is a callback from dix during AddScreen() from InitOutput(). + * Initialize the screen and communicate information about it back to dix. */ static Bool DarwinAddScreen( int index, @@ -142,29 +154,45 @@ static Bool DarwinAddScreen( char **argv ) { int bitsPerRGB, i, dpi; + static int foundIndex = 0; + Bool ret; VisualPtr visual; ColormapPtr pmap; + DarwinFramebufferPtr dfb; + + // allocate space for private per screen storage + dfb = xalloc(sizeof(DarwinFramebufferRec)); + SCREEN_PRIV(pScreen) = dfb; + + // setup hardware/mode specific details + if (quartz) { + ret = QuartzAddScreen(foundIndex, pScreen); + } else { + ret = XFIOKitAddScreen(foundIndex, pScreen); + } + foundIndex++; + if (! ret) + return FALSE; - /* Communicate the information about our initialized screen back to X. */ - bitsPerRGB = dfb.pixelInfo.bitsPerComponent; + bitsPerRGB = dfb->pixelInfo.bitsPerComponent; // reset the visual list miClearVisualTypes(); // setup a single visual appropriate for our pixel type // Note: Darwin kIORGBDirectPixels = X window TrueColor, not DirectColor - if (dfb.pixelInfo.pixelType == kIORGBDirectPixels) { - if (!miSetVisualTypes( dfb.colorBitsPerPixel, TrueColorMask, + if (dfb->pixelInfo.pixelType == kIORGBDirectPixels) { + if (!miSetVisualTypes( dfb->colorBitsPerPixel, TrueColorMask, bitsPerRGB, TrueColor )) { return FALSE; } - } else if (dfb.pixelInfo.pixelType == kIOCLUTPixels) { - if (!miSetVisualTypes( dfb.colorBitsPerPixel, PseudoColorMask, + } else if (dfb->pixelInfo.pixelType == kIOCLUTPixels) { + if (!miSetVisualTypes( dfb->colorBitsPerPixel, PseudoColorMask, bitsPerRGB, PseudoColor )) { return FALSE; } - } else if (dfb.pixelInfo.pixelType == kIOFixedCLUTPixels) { - if (!miSetVisualTypes( dfb.colorBitsPerPixel, StaticColorMask, + } else if (dfb->pixelInfo.pixelType == kIOFixedCLUTPixels) { + if (!miSetVisualTypes( dfb->colorBitsPerPixel, StaticColorMask, bitsPerRGB, StaticColor )) { return FALSE; } @@ -183,17 +211,17 @@ static Bool DarwinAddScreen( // initialize fb if (! fbScreenInit(pScreen, - dfb.framebuffer, // pointer to screen bitmap - dfb.width, dfb.height, // screen size in pixels - dpi, dpi, // dots per inch - dfb.pitch/(dfb.bitsPerPixel/8), // pixel width of framebuffer - dfb.bitsPerPixel)) // bits per pixel for screen + dfb->framebuffer, // pointer to screen bitmap + dfb->width, dfb->height, // screen size in pixels + dpi, dpi, // dots per inch + dfb->pitch/(dfb->bitsPerPixel/8), // pixel width of framebuffer + dfb->bitsPerPixel)) // bits per pixel for screen { return FALSE; } // set the RGB order correctly for TrueColor - if (dfb.bitsPerPixel > 8) { + if (dfb->bitsPerPixel > 8) { for (i = 0, visual = pScreen->visuals; // someday we may have more than 1 i < pScreen->numVisuals; i++, visual++) { if (visual->class == TrueColor) { @@ -205,16 +233,18 @@ static Bool DarwinAddScreen( visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen; visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue; #else - visual->redMask = dfb.pixelInfo.componentMasks[0]; - visual->greenMask = dfb.pixelInfo.componentMasks[1]; - visual->blueMask = dfb.pixelInfo.componentMasks[2]; + visual->redMask = dfb->pixelInfo.componentMasks[0]; + visual->greenMask = dfb->pixelInfo.componentMasks[1]; + visual->blueMask = dfb->pixelInfo.componentMasks[2]; #endif } } } #ifdef RENDER - fbPictureInit(pScreen, 0, 0); + if (! fbPictureInit(pScreen, 0, 0)) { + return FALSE; + } #endif #ifdef MITSHM @@ -224,13 +254,13 @@ static Bool DarwinAddScreen( // this must be initialized (why doesn't X have a default?) pScreen->SaveScreen = DarwinSaveScreen; - // Perform operations specific to the screen interface + // finish mode dependent screen setup including cursor support if (quartz) { - if (! QuartzAddScreen(pScreen)) { + if (! QuartzSetupScreen(index, pScreen)) { return FALSE; } } else { - if (! XFIOKitAddScreen(pScreen)) { + if (! XFIOKitSetupScreen(index, pScreen)) { return FALSE; } } @@ -245,8 +275,9 @@ static Bool DarwinAddScreen( * mode and we're using a fixed color map. Essentially this translates * to Darwin/x86 in 8-bit mode. */ - if( (dfb.colorBitsPerPixel == 8) && - (dfb.pixelInfo.pixelType == kIOFixedCLUTPixels) ) { + if( (dfb->colorBitsPerPixel == 8) && + (dfb->pixelInfo.pixelType == kIOFixedCLUTPixels) ) + { pmap = miInstalledMaps[pScreen->myNum]; visual = pmap->pVisual; for( i = 0; i < visual->ColormapEntries; i++ ) { @@ -256,6 +287,12 @@ static Bool DarwinAddScreen( } } + dixScreenOrigins[index].x = dfb->x; + dixScreenOrigins[index].y = dfb->y; + + ErrorF("Screen %d added: %dx%d @ %d,%d\n", + index, dfb->width, dfb->height, dfb->x, dfb->y); + return TRUE; } @@ -263,7 +300,7 @@ static Bool DarwinAddScreen( ============================================================================= mouse and keyboard callbacks - + ============================================================================= */ @@ -279,8 +316,11 @@ static void DarwinChangePointerControl( kern_return_t kr; double acceleration; + if (!quartzMouseAccelChange) + return; + acceleration = ctrl->num / ctrl->den; - kr = IOHIDSetMouseAcceleration( dfb.hidParam, acceleration ); + kr = IOHIDSetMouseAcceleration( hid.paramConnect, acceleration ); if (kr != KERN_SUCCESS) ErrorF( "Could not set mouse acceleration with kernel return = 0x%x.\n", kr ); } @@ -318,13 +358,13 @@ static int DarwinMouseProc( case DEVICE_ON: pPointer->public.on = TRUE; - AddEnabledDevice( darwinEventFD ); + AddEnabledDevice( darwinEventFD ); return Success; case DEVICE_CLOSE: case DEVICE_OFF: pPointer->public.on = FALSE; - RemoveEnabledDevice( darwinEventFD ); + RemoveEnabledDevice( darwinEventFD ); return Success; } @@ -340,8 +380,6 @@ static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff ) switch ( onoff ) { case DEVICE_INIT: DarwinKeyboardInit( pDev ); - darwinKeyCommandL = DarwinModifierKeycode(NX_MODIFIERKEY_COMMAND, 0); - darwinKeyOptionL = DarwinModifierKeycode(NX_MODIFIERKEY_ALTERNATE, 0); break; case DEVICE_ON: pDev->public.on = TRUE; @@ -422,6 +460,95 @@ static char * DarwinFindLibraryFile( } /* + * DarwinPressKeycode + * Press or release the given key, specified by NX keycode. + * xe must already have event time and mouse location filled in. + * pressed is KeyPress or KeyRelease. + * keycode is NX keycode without MIN_KEYCODE adjustment. + */ +#define DarwinPressKeycode(xe, pressed, keycode) \ + xe.u.u.type = (pressed); \ + xe.u.u.detail = (keycode) + MIN_KEYCODE; \ + (darwinKeyboard->public.processInputProc)(&(xe), darwinKeyboard, 1); + + +/* + * DarwinPressModifierMask + * Press or release the given modifier key, specified by its mask. + */ +static void DarwinPressModifierMask( + xEvent xe, // must already have time and mouse location filled in + BYTE pressed, // KeyPress or KeyRelease + int mask) // one of NX_*MASK constants +{ + int key = DarwinModifierNXMaskToNXKey(mask); + + if (key != -1) { + int keycode = DarwinModifierNXKeyToNXKeycode(key, 0); + if (keycode != 0) { + DarwinPressKeycode(xe, pressed, keycode); + } + } +} + +/* + * DarwinUpdateModifiers + * Send events to update the modifier state. + */ +static void DarwinUpdateModifiers( + xEvent xe, // event template with time and mouse position set + int pressed, // KeyPress or KeyRelease + int flags ) // modifier flags that have changed +{ + if (flags & NX_ALPHASHIFTMASK) { + DarwinPressModifierMask(xe, pressed, NX_ALPHASHIFTMASK); + } + if (flags & NX_COMMANDMASK) { + DarwinPressModifierMask(xe, pressed, NX_COMMANDMASK); + } + if (flags & NX_CONTROLMASK) { + DarwinPressModifierMask(xe, pressed, NX_CONTROLMASK); + } + if (flags & NX_ALTERNATEMASK) { + DarwinPressModifierMask(xe, pressed, NX_ALTERNATEMASK); + } + if (flags & NX_SHIFTMASK) { + DarwinPressModifierMask(xe, pressed, NX_SHIFTMASK); + } + if (flags & NX_SECONDARYFNMASK) { + DarwinPressModifierMask(xe, pressed, NX_SECONDARYFNMASK); + } +} + +/* + * DarwinParseModifierList + * Parse a list of modifier names and return a corresponding modifier mask + */ +static int DarwinParseModifierList( + const char *constmodifiers) // string containing list of modifier names +{ + int result = 0; + + if (constmodifiers) { + char *modifiers = strdup(constmodifiers); + char *modifier; + int nxkey; + char *p = modifiers; + + while (p) { + modifier = strsep(&p, " ,+&|/"); // allow lots of separators + nxkey = DarwinModifierStringToNXKey(modifier); + if (nxkey != -1) + result |= DarwinModifierNXKeyToNXMask(nxkey); + else + ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier); + } + free(modifiers); + } + return result; +} + +/* * DarwinSimulateMouseClick * Send a mouse click to X when multiple mouse buttons are simulated * with modifier-clicks, such as command-click for button 2. The dix @@ -436,19 +563,10 @@ static void DarwinSimulateMouseClick( // mouse position filled in int whichButton, // mouse button to be pressed int whichEvent, // ButtonPress or ButtonRelease - int keycodesUsed[], // list of keycodes of the modifiers used - // to create the fake click + MIN_KEYCODE - int numKeycodes ) // number of keycodes in list -{ - int i; - + int modifierMask) // modifiers used for the fake click +{ // 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 ); - } + DarwinUpdateModifiers(xe, KeyRelease, modifierMask); // push the mouse button xe.u.u.type = whichEvent; @@ -457,49 +575,9 @@ static void DarwinSimulateMouseClick( ( &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 ); - } + DarwinUpdateModifiers(xe, KeyPress, modifierMask); } -/* - * DarwinUpdateModifiers - * Send events to update the modifier state. - */ -static void DarwinUpdateModifiers( - xEvent xe, // event template with time, mouse position, - // and KeyPress or KeyRelease filled in - int flags ) // modifier flags that have changed -{ - if (flags & NX_ALPHASHIFTMASK) { - xe.u.u.detail = DarwinModifierKeycode(NX_MODIFIERKEY_ALPHALOCK, 0); - (darwinKeyboard->public.processInputProc) - (&xe, darwinKeyboard, 1); - } - if (flags & NX_COMMANDMASK) { - xe.u.u.detail = DarwinModifierKeycode(NX_MODIFIERKEY_COMMAND, 0); - (darwinKeyboard->public.processInputProc) - (&xe, darwinKeyboard, 1); - } - if (flags & NX_CONTROLMASK) { - xe.u.u.detail = DarwinModifierKeycode(NX_MODIFIERKEY_CONTROL, 0); - (darwinKeyboard->public.processInputProc) - (&xe, darwinKeyboard, 1); - } - if (flags & NX_ALTERNATEMASK) { - xe.u.u.detail = DarwinModifierKeycode(NX_MODIFIERKEY_ALTERNATE, 0); - (darwinKeyboard->public.processInputProc) - (&xe, darwinKeyboard, 1); - } - if (flags & NX_SHIFTMASK) { - xe.u.u.detail = DarwinModifierKeycode(NX_MODIFIERKEY_SHIFT, 0); - (darwinKeyboard->public.processInputProc) - (&xe, darwinKeyboard, 1); - } -} /* =========================================================================== @@ -515,9 +593,9 @@ static void DarwinUpdateModifiers( */ void ProcessInputEvents(void) { - xEvent xe; - NXEvent ev; - int r; + xEvent xe; + NXEvent ev; + int r; struct timeval tv; struct timezone tz; static int old_state = 0; @@ -527,7 +605,7 @@ void ProcessInputEvents(void) static int startsec = 0; // Quartz safety quit. Bail if we don't get any events from the event pipe. - // If the event writer fails to find us, we will have captured the screen + // If the event writer fails to find us, we will have captured the screen // but not be seeing any events and be unkillable from the console. if (quartz && ! gotread) { gettimeofday(&tv, &tz); @@ -543,7 +621,7 @@ void ProcessInputEvents(void) // try to read from our pipe r = read( darwinEventFD, &ev, sizeof(ev)); - + if ((r == -1) && (errno == EAGAIN)) { // no event available break; @@ -563,19 +641,19 @@ void ProcessInputEvents(void) gotread = true; #endif 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; @@ -589,55 +667,49 @@ void ProcessInputEvents(void) #else case NX_LMOUSEDOWN: #endif - // 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 { + // Mimic multi-button mouse with modifier-clicks + // If both sets of modifiers are pressed, button 2 is clicked. + if (darwinFakeButtons && + (ev.flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) + { + DarwinSimulateMouseClick(xe, 2, ButtonPress, + darwinFakeMouse2Mask); + darwinFakeMouseButtonDown = 2; + } + else if (darwinFakeButtons && + (ev.flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) + { + DarwinSimulateMouseClick(xe, 3, ButtonPress, + darwinFakeMouse3Mask); + darwinFakeMouseButtonDown = 3; + } + else { xe.u.u.detail = 1; xe.u.u.type = ButtonPress; (darwinPointer->public.processInputProc) ( &xe, darwinPointer, 1 ); } break; - + #ifdef __i386__ case NX_LMOUSEDOWN: #else case NX_LMOUSEUP: #endif - // 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); + // If last mousedown was a fake click, don't check for + // mouse modifiers here. The user may have released the + // modifiers before the mouse button. + if (darwinFakeMouseButtonDown) { + xe.u.u.detail = darwinFakeMouseButtonDown; + darwinFakeMouseButtonDown = 0; } else { xe.u.u.detail = 1; - xe.u.u.type = ButtonRelease; - (darwinPointer->public.processInputProc) - ( &xe, darwinPointer, 1 ); } + xe.u.u.type = ButtonRelease; + (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: @@ -648,7 +720,7 @@ void ProcessInputEvents(void) ( &xe, darwinPointer, 1 ); #endif break; - + case NX_RMOUSEUP: #if 0 xe.u.u.detail = 2; @@ -657,21 +729,15 @@ void ProcessInputEvents(void) ( &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 ); + DarwinPressKeycode(xe, KeyPress, ev.data.key.keyCode); 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); + DarwinPressKeycode(xe, KeyRelease, ev.data.key.keyCode); break; - + case NX_FLAGSCHANGED: { // Assumes only one flag has changed. In Quartz mode, this @@ -679,39 +745,24 @@ void ProcessInputEvents(void) 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; + // so we have to press and releasae it every time. + if (new_on_flags || new_off_flags & NX_ALPHASHIFTMASK) { + DarwinPressKeycode(xe, KeyPress, ev.data.key.keyCode); } - - if (new_on_flags) { - xe.u.u.type = KeyPress; - } else if (new_off_flags) { - xe.u.u.type = KeyRelease; - } else { - break; + if (new_off_flags || new_on_flags & NX_ALPHASHIFTMASK) { + DarwinPressKeycode(xe, KeyRelease, ev.data.key.keyCode); } - (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 < 5; i++) { if (hwDelta & (1 << i)) { // IOKit and X have different numbering for the @@ -740,18 +791,18 @@ void ProcessInputEvents(void) } } 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) @@ -771,10 +822,10 @@ void ProcessInputEvents(void) // 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); + DarwinUpdateModifiers(xe, KeyRelease, + old_state & ~ev.flags); + DarwinUpdateModifiers(xe, KeyPress, + ~old_state & ev.flags); old_state = ev.flags; break; @@ -783,7 +834,7 @@ void ProcessInputEvents(void) // The mouse location will have moved; track it. xe.u.u.type = MotionNotify; (darwinPointer->public.processInputProc) - ( &xe, darwinPointer, 1 ); + ( &xe, darwinPointer, 1 ); break; case kXDarwinHide: @@ -811,18 +862,21 @@ void ProcessInputEvents(void) 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.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.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); + 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, @@ -837,7 +891,7 @@ void ProcessInputEvents(void) * InitInput * Register the keyboard and mouse devices */ -void InitInput( int argc, char **argv ) +void InitInput( int argc, char **argv ) { if (serverGeneration == 1) { darwinPointer = AddInputDevice(DarwinMouseProc, TRUE); @@ -850,23 +904,50 @@ void InitInput( int argc, char **argv ) /* * InitOutput - * Initialize screenInfo for all actually accessible framebuffers. + * Initialize screenInfo for all actually accessible framebuffers. + * + * The display mode dependent code gets called three times. The mode + * specific InitOutput routines are expected to discover the number + * of potentially useful screens and cache routes to them internally. + * Inside DarwinAddScreen are two other mode specific calls. + * A mode specific AddScreen routine is called for each screen to + * actually initialize the screen with the ScreenPtr structure. + * After other screen setup has been done, a mode specific + * SetupScreen function can be called to finalize screen setup. */ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv ) { int i; + static unsigned long generation = 0; pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - // list how we want common pixmap formats to be padded + // List how we want common pixmap formats to be padded pScreenInfo->numPixmapFormats = NUMFORMATS; for (i = 0; i < NUMFORMATS; i++) pScreenInfo->formats[i] = formats[i]; - AddScreen( DarwinAddScreen, argc, argv ); + // Allocate private storage for each screen's Darwin specific info + if (generation != serverGeneration) { + darwinScreenIndex = AllocateScreenPrivateIndex(); + generation = serverGeneration; + } + + // Discover screens and do mode specific initialization + if (quartz) { + QuartzInitOutput(); + } else { + XFIOKitInitOutput(); + } + + // Add screens + // The first is the main screen. + for (i = 0; i < darwinScreensFound; i++) { + AddScreen( DarwinAddScreen, argc, argv ); + } } /* @@ -879,33 +960,34 @@ void OsVendorFatalError( void ) /* * OsVendorInit - * Initialization of Darwin support. - * Initialize display and event handling. + * Initialization of Darwin OS support. + * Nothing special to do here. */ void OsVendorInit(void) { DarwinPrintBanner(); - - if (quartz) { - QuartzOsVendorInit(); - } else { - XFIOKitOsVendorInit(); - } } /* * ddxProcessArgument -- - * Process device-dependent command line args. Returns 0 if argument is - * not device dependent, otherwise Count of number of elements of argv - * that are part of a device dependent commandline option. + * Process device-dependent command line args. Returns 0 if argument is + * not device dependent, otherwise Count of number of elements of argv + * that are part of a device dependent commandline option. */ int ddxProcessArgument( int argc, char *argv[], int i ) { +#ifdef DARWIN_WITH_QUARTZ + int numDone; + + if ((numDone = QuartzProcessArgument( argc, argv, i ))) + return numDone; +#endif + if ( !strcmp( argv[i], "-screen" ) ) { - if ( i == argc-1 ) { + if ( i == argc-1 ) { FatalError( "-screen must be followed by a number\n" ); } - darwinScreenNumber = atoi( argv[i+1] ); + darwinScreenNumber = atoi( argv[i+1] ); ErrorF( "Attempting to use screen number %i\n", darwinScreenNumber ); return 2; } @@ -922,47 +1004,51 @@ int ddxProcessArgument( int argc, char *argv[], int i ) return 1; } + if (!strcmp( argv[i], "-fakemouse2" ) ) { + if ( i == argc-1 ) { + FatalError( "-fakemouse2 must be followed by a modifer list\n" ); + } + if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], "")) + darwinFakeMouse2Mask = 0; + else + darwinFakeMouse2Mask = DarwinParseModifierList(argv[i+1]); + ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n", + darwinFakeMouse2Mask); + return 2; + } + + if (!strcmp( argv[i], "-fakemouse3" ) ) { + if ( i == argc-1 ) { + FatalError( "-fakemouse3 must be followed by a modifer list\n" ); + } + if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], "")) + darwinFakeMouse3Mask = 0; + else + darwinFakeMouse3Mask = DarwinParseModifierList(argv[i+1]); + ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n", + darwinFakeMouse3Mask); + return 2; + } + if ( !strcmp( argv[i], "-keymap" ) ) { - if ( i == argc-1 ) { + if ( i == argc-1 ) { FatalError( "-keymap must be followed by a filename\n" ); } - darwinKeymapFile = DarwinFindLibraryFile(argv[i+1], "Keyboards"); + darwinKeymapFile = DarwinFindLibraryFile(argv[i+1], "Keyboards"); if ( !darwinKeymapFile ) FatalError( "Could not find keymapping file %s.\n", argv[i+1] ); ErrorF( "Using keymapping provided in %s.\n", darwinKeymapFile ); return 2; } -#ifdef DARWIN_WITH_QUARTZ - if ( !strcmp( argv[i], "-quartz" ) ) { - 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 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" ) ) { - if ( i >= argc-2 ) { + if ( i >= argc-2 ) { FatalError( "-size must be followed by two numbers\n" ); } #ifdef OLD_POWERBOOK_G3 ErrorF( "Ignoring unsupported -size option on old PowerBook G3\n" ); #else - darwinDesiredWidth = atoi( argv[i+1] ); + darwinDesiredWidth = atoi( argv[i+1] ); darwinDesiredHeight = atoi( argv[i+2] ); ErrorF( "Attempting to use width x height = %i x %i\n", darwinDesiredWidth, darwinDesiredHeight ); @@ -972,13 +1058,14 @@ int ddxProcessArgument( int argc, char *argv[], int i ) if ( !strcmp( argv[i], "-depth" ) ) { int bitDepth; - if ( i == argc-1 ) { + + if ( i == argc-1 ) { FatalError( "-depth must be followed by a number\n" ); } #ifdef OLD_POWERBOOK_G3 ErrorF( "Ignoring unsupported -depth option on old PowerBook G3\n"); #else - bitDepth = atoi( argv[i+1] ); + bitDepth = atoi( argv[i+1] ); if (bitDepth == 8) darwinDesiredDepth = 0; else if (bitDepth == 15) @@ -993,13 +1080,13 @@ int ddxProcessArgument( int argc, char *argv[], int i ) } if ( !strcmp( argv[i], "-refresh" ) ) { - if ( i == argc-1 ) { + if ( i == argc-1 ) { FatalError( "-refresh must be followed by a number\n" ); } #ifdef OLD_POWERBOOK_G3 ErrorF( "Ignoring unsupported -refresh option on old PowerBook G3\n"); #else - darwinDesiredRefresh = atoi( argv[i+1] ); + darwinDesiredRefresh = atoi( argv[i+1] ); ErrorF( "Attempting to use refresh rate of %i\n", darwinDesiredRefresh ); #endif return 2; @@ -1015,8 +1102,8 @@ int ddxProcessArgument( int argc, char *argv[], int i ) /* * ddxUseMsg -- - * Print out correct use of device dependent commandline options. - * Maybe the user now knows what really to do ... + * Print out correct use of device dependent commandline options. + * Maybe the user now knows what really to do ... */ void ddxUseMsg( void ) { @@ -1026,12 +1113,19 @@ void ddxUseMsg( void ) ErrorF("\n"); ErrorF("-fakebuttons : fake a three button mouse with Command and Option keys.\n"); ErrorF("-nofakebuttons : don't fake a three button mouse.\n"); + ErrorF("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n"); + ErrorF("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n"); + ErrorF(" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n"); ErrorF("-keymap <file> : read the keymapping from a file instead of the kernel.\n"); ErrorF("-version : show the server version.\n"); + ErrorF("\n"); #ifdef DARWIN_WITH_QUARTZ - ErrorF("-quartz : run in parallel with Mac OS X Quartz window server.\n"); + ErrorF("Quartz modes:\n"); + ErrorF("-fullscreen : run full screen in parallel with Mac OS X window server.\n"); + ErrorF("-rootless : run rootless inside Mac OS X window server.\n"); + ErrorF("-quartz : use default Mac OS X window server mode\n"); ErrorF("\n"); - ErrorF("IOKit specific options (ignored with -quartz):\n"); + ErrorF("IOKit specific options (ignored in Quartz modes):\n"); #endif ErrorF("-screen <0,1,...> : use this screen number.\n"); ErrorF("-size <height> <width> : use a screen resolution of <height> x <width>.\n"); @@ -1046,7 +1140,7 @@ void ddxUseMsg( void ) */ void ddxGiveUp( void ) { - ErrorF( "Quitting XDarwin...\n" ); + ErrorF( "Quitting XDarwin...\n" ); if (quartz) { QuartzGiveUp(); @@ -1063,7 +1157,7 @@ void ddxGiveUp( void ) */ void AbortDDX( void ) { - ErrorF( " AbortDDX\n" ); + ErrorF( " AbortDDX\n" ); /* * This is needed for a abnormal server exit, since the normal exit stuff * MUST also be performed (i.e. the vt must be left in a defined state) @@ -1072,11 +1166,13 @@ void AbortDDX( void ) } Bool DPMSSupported(void) -{ return 0; +{ + return 0; } void DPMSSet(void) -{ return; +{ + return; } @@ -1134,7 +1230,7 @@ xf86SetRootClip (ScreenPtr pScreen, BOOL enable) pWin->valdata->before.resized = TRUE; } } - + /* * Use REGION_BREAK to avoid optimizations in ValidateTree * that assume the root borderClip can't change well, normally @@ -1154,9 +1250,9 @@ xf86SetRootClip (ScreenPtr pScreen, BOOL enable) REGION_EMPTY(pScreen, &pWin->borderClip); REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); } - + ResizeChildrenWinSize (pWin, 0, 0, 0, 0); - + if (WasViewable) { if (pWin->backStorage) @@ -1201,7 +1297,7 @@ xf86SetRootClip (ScreenPtr pScreen, BOOL enable) if (bsExposed) { RegionPtr valExposed = NullRegion; - + if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); diff --git a/xc/programs/Xserver/hw/kdrive/trident/trident.c b/xc/programs/Xserver/hw/kdrive/trident/trident.c index c2d3eae00..efe17001f 100644 --- a/xc/programs/Xserver/hw/kdrive/trident/trident.c +++ b/xc/programs/Xserver/hw/kdrive/trident/trident.c @@ -19,12 +19,10 @@ * 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.16 2001/03/21 16:43:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/trident/trident.c,v 1.18 2001/06/04 09:45:42 keithp Exp $ */ #include "trident.h" -#define extern -#include <asm/io.h> -#undef extern +#include <sys/io.h> #undef TRI_DEBUG @@ -157,6 +155,14 @@ tridentInitScreen (ScreenPtr pScreen) #endif } +Bool +tridentFinishInitScreen (ScreenPtr pScreen) +{ +#ifdef VESA + return vesaFinishInitScreen (pScreen); +#endif +} + CARD8 tridentReadIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index) { @@ -600,4 +606,5 @@ KdCardFuncs tridentFuncs = { fbdevGetColors, /* getColors */ fbdevPutColors, /* putColors */ #endif + tridentFinishInitScreen /* finishInitScreen */ }; diff --git a/xc/programs/Xserver/hw/kdrive/vesa/vbe.c b/xc/programs/Xserver/hw/kdrive/vesa/vbe.c index c955d924d..f9c05d59b 100644 --- a/xc/programs/Xserver/hw/kdrive/vesa/vbe.c +++ b/xc/programs/Xserver/hw/kdrive/vesa/vbe.c @@ -19,7 +19,7 @@ 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/vesa/vbe.c,v 1.8 2000/11/29 08:42:25 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vbe.c,v 1.9 2001/05/29 04:54:12 keithp Exp $ */ #include "vesa.h" @@ -196,7 +196,7 @@ VbeCleanup (Vm86InfoPtr vi, VbeInfoPtr vbe) } int -VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear) +VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear, int direct) { int code; VbeInfoBlock vib; @@ -223,13 +223,16 @@ VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear) vbe->windowA_offset = vbe->windowB_offset = -1; vbe->last_window = 1; - if(vib.Capabilities[0] & 1) - palette_hi = 1; - if(vib.Capabilities[0] & 4) - palette_wait = 1; - - if(palette_hi || palette_wait) - VbeSetPaletteOptions(vi, vbe, palette_hi?8:6, palette_wait); + if (!direct) + { + if(vib.Capabilities[0] & 1) + palette_hi = 1; + if(vib.Capabilities[0] & 4) + palette_wait = 1; + + if(palette_hi || palette_wait) + VbeSetPaletteOptions(vi, vbe, palette_hi?8:6, palette_wait); + } return 0; } diff --git a/xc/programs/Xserver/hw/kdrive/vesa/vbe.h b/xc/programs/Xserver/hw/kdrive/vesa/vbe.h index 0633e4084..f52fa673e 100644 --- a/xc/programs/Xserver/hw/kdrive/vesa/vbe.h +++ b/xc/programs/Xserver/hw/kdrive/vesa/vbe.h @@ -19,7 +19,7 @@ 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/vesa/vbe.h,v 1.5 2000/10/20 00:19:50 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vbe.h,v 1.6 2001/05/29 04:54:12 keithp Exp $ */ #ifndef _VBE_H #define _VBE_H @@ -128,7 +128,7 @@ VbeInfoPtr VbeInit (Vm86InfoPtr vi); int -VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear); +VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear, int direct); int VbeGetMode(Vm86InfoPtr vi, int *mode); diff --git a/xc/programs/Xserver/hw/kdrive/vesa/vesa.c b/xc/programs/Xserver/hw/kdrive/vesa/vesa.c index 90f4215a1..59c4ceeab 100644 --- a/xc/programs/Xserver/hw/kdrive/vesa/vesa.c +++ b/xc/programs/Xserver/hw/kdrive/vesa/vesa.c @@ -19,9 +19,12 @@ 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/vesa/vesa.c,v 1.9 2000/11/29 08:42:25 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.c,v 1.16 2001/07/24 19:06:04 keithp Exp $ */ #include "vesa.h" +#ifdef RANDR +#include <randrstr.h> +#endif int vesa_video_mode = 0; Bool vesa_force_mode = FALSE; @@ -29,14 +32,12 @@ Bool vesa_swap_rgb = FALSE; Bool vesa_shadow = FALSE; Bool vesa_linear_fb = TRUE; Bool vesa_restore = FALSE; -Bool vesa_rotate = FALSE; Bool vesa_verbose = FALSE; #define VesaPriv(scr) ((VesaScreenPrivPtr) (scr)->driver) -#define ScreenRotated(scr) (VesaPriv(scr)->rotate) -#define vesaWidth(scr,vmib) (ScreenRotated(scr) ? vmib->YResolution : vmib->XResolution) -#define vesaHeight(scr,vmib) (ScreenRotated(scr) ? vmib->XResolution : vmib->YResolution) +#define vesaWidth(scr,vmib) ((vmib)->XResolution) +#define vesaHeight(scr,vmib) ((vmib)->YResolution) static Bool vesaModeSupportable (VesaModePtr mode, Bool complain) @@ -368,13 +369,8 @@ vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr) VesaCardPrivPtr priv = screen->card->driver; VesaModePtr mode; Pixel allbits; - int depth; - int bpp, fbbpp; screen->driver = pscr; - pscr->rotate = FALSE; - if (screen->width < screen->height) - pscr->rotate = TRUE; if (!screen->width || !screen->height) { @@ -388,70 +384,40 @@ vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr) ErrorF ("Mode requested %dx%dx%d\n", screen->width, screen->height, screen->fb[0].depth); - pscr->mode = vesaSelectMode (screen); + mode = vesaSelectMode (screen); - if (!pscr->mode) + if (!mode) { if (vesa_verbose) ErrorF ("No selectable mode\n"); return FALSE; } + pscr->mode = *mode; if (vesa_verbose) { ErrorF ("\t"); - vesaReportMode (pscr->mode); + vesaReportMode (&pscr->mode); } + pscr->rotate = screen->rotation; pscr->shadow = vesa_shadow; pscr->origDepth = screen->fb[0].depth; - if (vesa_linear_fb) - pscr->mapping = VESA_LINEAR; - else - pscr->mapping = VESA_WINDOWED; - - mode = pscr->mode; + pscr->layerKind = LAYER_FB; - depth = vesaDepth (mode); - bpp = mode->BitsPerPixel; - - if (bpp > 24) - bpp = 32; - else if (bpp > 16) - bpp = 24; - else if (bpp > 8) - bpp = 16; - else if (bpp > 4) - bpp = 8; - else if (bpp > 1) - bpp = 4; - else - bpp = 1; - fbbpp = bpp; - - switch (mode->MemoryModel) { + /* + * Compute visual support for the selected depth + */ + switch (pscr->mode.MemoryModel) { case MEMORY_DIRECT: /* TrueColor or DirectColor */ screen->fb[0].visuals = (1 << TrueColor); screen->fb[0].redMask = - FbStipMask(mode->RedFieldPosition, mode->RedMaskSize); + FbStipMask(pscr->mode.RedFieldPosition, pscr->mode.RedMaskSize); screen->fb[0].greenMask = - FbStipMask(mode->GreenFieldPosition, mode->GreenMaskSize); + FbStipMask(pscr->mode.GreenFieldPosition, pscr->mode.GreenMaskSize); screen->fb[0].blueMask = - FbStipMask(mode->BlueFieldPosition, mode->BlueMaskSize); - allbits = - screen->fb[0].redMask | - screen->fb[0].greenMask | - screen->fb[0].blueMask; - depth = 32; - while (depth && !(allbits & (1 << (depth - 1)))) - depth--; - if (vesa_verbose) - ErrorF ("\tTrue Color bpp %d depth %d red 0x%x green 0x%x blue 0x%x\n", - bpp, depth, - screen->fb[0].redMask, - screen->fb[0].greenMask, - screen->fb[0].blueMask); + FbStipMask(pscr->mode.BlueFieldPosition, pscr->mode.BlueMaskSize); break; case MEMORY_PSEUDO: /* PseudoColor */ @@ -464,98 +430,25 @@ vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr) screen->fb[0].blueMask = 0x00; screen->fb[0].greenMask = 0x00; screen->fb[0].redMask = 0x00; - if (vesa_verbose) - ErrorF ("\tPseudo Color bpp %d depth %d\n", - bpp, depth); break; case MEMORY_PLANAR: /* 4 plane planar */ - if (mode->ModeAttributes & MODE_COLOUR) + if (pscr->mode.ModeAttributes & MODE_COLOUR) screen->fb[0].visuals = (1 << StaticColor); else screen->fb[0].visuals = (1 << StaticGray); screen->fb[0].blueMask = 0x00; screen->fb[0].greenMask = 0x00; screen->fb[0].redMask = 0x00; - if (bpp == 4) - { - bpp = screen->fb[0].bitsPerPixel; - if (bpp != 8) - bpp = 4; - depth = bpp; - } - if (bpp == 1) - { - pscr->mapping = VESA_MONO; - if (vesa_verbose) - ErrorF ("\tMonochrome\n"); - } - else - { - pscr->mapping = VESA_PLANAR; - if (vesa_verbose) - ErrorF ("\tStatic color bpp %d depth %d\n", - bpp, depth); - } - pscr->rotate = FALSE; break; default: ErrorF("Unsupported VESA MemoryModel 0x%02X\n", - mode->MemoryModel); + pscr->mode.MemoryModel); return FALSE; } - - screen->width = vesaWidth(screen, mode); - screen->height = vesaHeight(screen, mode); - screen->fb[0].depth = depth; - screen->fb[0].bitsPerPixel = bpp; - screen->fb[0].byteStride = mode->BytesPerScanLine; - screen->fb[0].pixelStride = ((mode->BytesPerScanLine * 8) / fbbpp); - - if (pscr->mapping == VESA_LINEAR && !(mode->ModeAttributes & MODE_LINEAR)) - pscr->mapping = VESA_WINDOWED; - - if (pscr->rotate) - pscr->shadow = TRUE; - - switch (pscr->mapping) { - case VESA_MONO: - pscr->shadow = TRUE; - /* fall through */ - case VESA_LINEAR: - if (mode->vbe) - pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo, - pscr->mode->mode, - &pscr->fb_size); - else - pscr->fb = VgaMapFramebuffer (priv->vi, - pscr->mode->mode, - &pscr->fb_size); - break; - case VESA_WINDOWED: - pscr->fb = NULL; - pscr->shadow = TRUE; - break; - case VESA_PLANAR: - pscr->fb = NULL; - pscr->shadow = TRUE; - break; - } - screen->rate = 72; - screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb); - if (pscr->rotate) - screen->softCursor = TRUE; - - if (pscr->shadow) - return KdShadowScreenInit (screen); - - if (vesa_verbose) - ErrorF ("Mode selected %dx%dx%d\n", - screen->width, screen->height, screen->fb[0].depth); - - return TRUE; + return vesaMapFramebuffer (screen); } Bool @@ -588,19 +481,19 @@ vesaSetWindowPlanar(ScreenPtr pScreen, plane = offset & 3; VgaSetWritePlaneMask (priv->vi, (1 << plane)); offset = offset >> 2; - if (pscr->mode->vbe) + if (pscr->mode.vbe) { base = VbeSetWindow (priv->vi, priv->vbeInfo, - pscr->mode->BytesPerScanLine * row + offset, + pscr->mode.BytesPerScanLine * row + offset, mode, &winSize); } else { base = VgaSetWindow (priv->vi, - pscr->mode->mode, - pscr->mode->BytesPerScanLine * row + offset, + pscr->mode.mode, + pscr->mode.BytesPerScanLine * row + offset, mode, &winSize); } @@ -619,8 +512,8 @@ vesaSetWindowLinear (ScreenPtr pScreen, VesaCardPrivPtr priv = pScreenPriv->card->driver; VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; - *size = pscr->mode->BytesPerScanLine; - return (CARD8 *) pscr->fb + row * pscr->mode->BytesPerScanLine + offset; + *size = pscr->mode.BytesPerScanLine; + return (CARD8 *) pscr->fb + row * pscr->mode.BytesPerScanLine + offset; } void * @@ -636,19 +529,19 @@ vesaSetWindowWindowed (ScreenPtr pScreen, int winSize; void *base; - if (pscr->mode->vbe) + if (pscr->mode.vbe) { base = VbeSetWindow (priv->vi, priv->vbeInfo, - pscr->mode->BytesPerScanLine * row + offset, + pscr->mode.BytesPerScanLine * row + offset, mode, &winSize); } else { base = VgaSetWindow (priv->vi, - pscr->mode->mode, - pscr->mode->BytesPerScanLine * row + offset, + pscr->mode.mode, + pscr->mode.BytesPerScanLine * row + offset, mode, &winSize); } @@ -661,7 +554,8 @@ vesaWindowPlanar (ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, + void *closure) { KdScreenPriv(pScreen); @@ -675,7 +569,8 @@ vesaWindowLinear (ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, + void *closure) { KdScreenPriv(pScreen); @@ -689,7 +584,8 @@ vesaWindowWindowed (ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, + void *closure) { KdScreenPriv(pScreen); @@ -709,7 +605,8 @@ vesaWindowCga (ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, + void *closure) { KdScreenPriv(pScreen); VesaCardPrivPtr priv = pScreenPriv->card->driver; @@ -718,16 +615,17 @@ vesaWindowCga (ScreenPtr pScreen, if (!pScreenPriv->enabled) return 0; - *size = pscr->mode->BytesPerScanLine; - line = ((row & 1) << 13) + (row >> 1) * pscr->mode->BytesPerScanLine; + *size = pscr->mode.BytesPerScanLine; + line = ((row & 1) << 13) + (row >> 1) * pscr->mode.BytesPerScanLine; return (CARD8 *) pscr->fb + line + offset; } void -vesaUpdateMono (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) +vesaUpdateMono (ScreenPtr pScreen, + shadowBufPtr pBuf) { + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; shadowScrPriv(pScreen); int nbox = REGION_NUM_RECTS (damage); BoxPtr pbox = REGION_RECTS (damage); @@ -736,6 +634,7 @@ vesaUpdateMono (ScreenPtr pScreen, FbStride shaStride; int scrBase, scrLine, scr; int shaBpp; + int shaXoff, shaYoff; /* XXX assumed to be zero */ int x, y, w, h, width; int i; FbBits *winBase, *winLine, *win; @@ -743,7 +642,7 @@ vesaUpdateMono (ScreenPtr pScreen, FbBits bits; int plane; - fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp); + fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); while (nbox--) { x = pbox->x1 * shaBpp; @@ -769,11 +668,12 @@ vesaUpdateMono (ScreenPtr pScreen, i = scrBase + winSize - scr; if (i <= 0 || scr < scrBase) { - winBase = (FbBits *) (*pScrPriv->window) (pScreen, - y, - scr * sizeof (FbBits), - SHADOW_WINDOW_WRITE, - &winSize); + winBase = (FbBits *) (*pBuf->window) (pScreen, + y, + scr * sizeof (FbBits), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); if(!winBase) return; scrBase = scr; @@ -823,6 +723,7 @@ vesaCreateColormap16 (ColormapPtr pmap) { int i, j; + if (pmap->pVisual->ColormapEntries == 16) for (i = 0; i < pmap->pVisual->ColormapEntries; i++) { j = i & 0xf; @@ -833,24 +734,89 @@ vesaCreateColormap16 (ColormapPtr pmap) return TRUE; } +void +vesaConfigureScreen (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + VesaCardPrivPtr priv = pScreenPriv->card->driver; + VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; -Bool -vesaInitScreen(ScreenPtr pScreen) + KdMouseMatrix m; + + if (pscr->mapping == VESA_PLANAR || pscr->mapping == VESA_MONO) + { + pscr->shadow = TRUE; + pscr->rotate = 0; + } + else switch (pscr->rotate) { + case 0: + pScreen->width = pscr->mode.XResolution; + pScreen->height = pscr->mode.YResolution; + pScreen->mmWidth = screen->width_mm; + pScreen->mmHeight = screen->height_mm; + if (pscr->mapping == VESA_WINDOWED) + pscr->shadow = TRUE; + else + pscr->shadow = vesa_shadow; + m.matrix[0][0] = 1; m.matrix[0][1] = 0; m.matrix[0][2] = 0; + m.matrix[1][0] = 0; m.matrix[1][1] = 1; m.matrix[1][2] = 0; + break; + case 90: + pScreen->width = pscr->mode.YResolution; + pScreen->height = pscr->mode.XResolution; + pScreen->mmWidth = screen->height_mm; + pScreen->mmHeight = screen->width_mm; + pscr->shadow = TRUE; + m.matrix[0][0] = 0; m.matrix[0][1] = -1; m.matrix[0][2] = pscr->mode.YResolution - 1; + m.matrix[1][0] = 1; m.matrix[1][1] = 0; m.matrix[1][2] = 0; + break; + case 180: + pScreen->width = pscr->mode.XResolution; + pScreen->height = pscr->mode.YResolution; + pScreen->mmWidth = screen->width_mm; + pScreen->mmHeight = screen->height_mm; + pscr->shadow = TRUE; + m.matrix[0][0] = -1; m.matrix[0][1] = 0; m.matrix[0][2] = pscr->mode.XResolution - 1; + m.matrix[1][0] = 0; m.matrix[1][1] = -1; m.matrix[1][2] = pscr->mode.YResolution - 1; + break; + case 270: + pScreen->width = pscr->mode.YResolution; + pScreen->height = pscr->mode.XResolution; + pScreen->mmWidth = screen->height_mm; + pScreen->mmHeight = screen->width_mm; + pscr->shadow = TRUE; + m.matrix[0][0] = 0; m.matrix[0][1] = 1; m.matrix[0][2] = 0; + m.matrix[1][0] = -1; m.matrix[1][1] = 0; m.matrix[1][2] = pscr->mode.XResolution - 1; + break; + } + KdSetMouseMatrix (&m); +} + +LayerPtr +vesaLayerCreate (ScreenPtr pScreen) { KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + VesaCardPrivPtr priv = pScreenPriv->card->driver; VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; + LayerPtr pLayer; ShadowUpdateProc update; ShadowWindowProc window; - + PixmapPtr pPixmap; + int kind; + if (pscr->shadow) { + if (pscr->rotate) + update = shadowUpdateRotatePacked; + else + update = shadowUpdatePacked; switch (pscr->mapping) { case VESA_LINEAR: - update = shadowUpdatePacked; window = vesaWindowLinear; break; case VESA_WINDOWED: - update = shadowUpdatePacked; window = vesaWindowWindowed; break; case VESA_PLANAR: @@ -860,68 +826,653 @@ vesaInitScreen(ScreenPtr pScreen) else update = shadowUpdatePlanar4; window = vesaWindowPlanar; - pscr->rotate = FALSE; break; case VESA_MONO: update = vesaUpdateMono; - if (pscr->mode->mode < 8) + if (pscr->mode.mode < 8) window = vesaWindowCga; else window = vesaWindowLinear; - pscr->rotate = FALSE; break; } - if (pscr->rotate) + + kind = LAYER_SHADOW; + pPixmap = 0; + } + else + { + kind = pscr->layerKind; + pPixmap = LAYER_SCREEN_PIXMAP; + update = 0; + window = 0; + } + + if (vesa_verbose) + ErrorF ("Mode selected %dx%dx%d\n", + pScreen->width, pScreen->height, screen->fb[0].depth); + + return LayerCreate (pScreen, kind, screen->fb[0].depth, + pPixmap, update, window, pscr->rotate, 0); +} + +Bool +vesaMapFramebuffer (KdScreenInfo *screen) +{ + VesaCardPrivPtr priv = screen->card->driver; + VesaScreenPrivPtr pscr = screen->driver; + int depth, bpp, fbbpp; + Pixel allbits; + + if (vesa_linear_fb) + pscr->mapping = VESA_LINEAR; + else + pscr->mapping = VESA_WINDOWED; + + depth = vesaDepth (&pscr->mode); + bpp = pscr->mode.BitsPerPixel; + + if (bpp > 24) + bpp = 32; + else if (bpp > 16) + bpp = 24; + else if (bpp > 8) + bpp = 16; + else if (bpp > 4) + bpp = 8; + else if (bpp > 1) + bpp = 4; + else + bpp = 1; + fbbpp = bpp; + + switch (pscr->mode.MemoryModel) { + case MEMORY_DIRECT: + allbits = (screen->fb[0].redMask | + screen->fb[0].greenMask | + screen->fb[0].blueMask); + depth = 32; + while (depth && !(allbits & (1 << (depth - 1)))) + depth--; + if (vesa_verbose) + ErrorF ("\tTrue Color red 0x%x green 0x%x blue 0x%x\n", + bpp, depth, + screen->fb[0].redMask, + screen->fb[0].greenMask, + screen->fb[0].blueMask); + break; + case MEMORY_PSEUDO: + if (vesa_verbose) + ErrorF ("\tPseudo Color bpp %d depth %d\n", + bpp, depth); + break; + case MEMORY_PLANAR: + if (bpp == 4) + { + bpp = screen->fb[0].bitsPerPixel; + if (bpp != 8) + bpp = 4; + depth = bpp; + } + if (bpp == 1) + { + pscr->mapping = VESA_MONO; + if (vesa_verbose) + ErrorF ("\tMonochrome\n"); + } + else + { + pscr->mapping = VESA_PLANAR; + if (vesa_verbose) + ErrorF ("\tStatic color bpp %d depth %d\n", + bpp, depth); + } + pscr->rotate = 0; + break; + default: + return 0; + } + + switch (fbbpp) { + case 8: + case 16: + case 32: + break; + default: + pscr->rotate = 0; + } + + screen->width = pscr->mode.XResolution; + screen->height = pscr->mode.YResolution; + screen->fb[0].depth = depth; + screen->fb[0].bitsPerPixel = bpp; + screen->fb[0].byteStride = pscr->mode.BytesPerScanLine; + screen->fb[0].pixelStride = ((pscr->mode.BytesPerScanLine * 8) / fbbpp); + + if (pscr->mapping == VESA_LINEAR && !(pscr->mode.ModeAttributes & MODE_LINEAR)) + pscr->mapping = VESA_WINDOWED; + + screen->softCursor = TRUE; + + switch (pscr->mapping) { + case VESA_MONO: + case VESA_LINEAR: + if (pscr->mode.vbe) + pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo, + pscr->mode.mode, + &pscr->fb_size); + else + pscr->fb = VgaMapFramebuffer (priv->vi, + pscr->mode.mode, + &pscr->fb_size); + if (!pscr->fb) + return FALSE; + break; + case VESA_WINDOWED: + pscr->fb = NULL; + break; + case VESA_PLANAR: + pscr->fb = NULL; + break; + } + screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb); + return TRUE; +} + +void +vesaUnmapFramebuffer (KdScreenInfo *screen) +{ + VesaCardPrivPtr priv = screen->card->driver; + VesaScreenPrivPtr pscr = screen->driver; + + if (pscr->fb) + { + if (pscr->mode.vbe) + VbeUnmapFramebuffer(priv->vi, priv->vbeInfo, pscr->mode.mode, pscr->fb); + else + VgaUnmapFramebuffer (priv->vi); + pscr->fb = 0; + } +} + +#ifdef RANDR +Bool +vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) +{ + KdScreenPriv(pScreen); + VesaModePtr modes, mode; + KdScreenInfo *screen = pScreenPriv->screen; + VesaCardPrivPtr priv = pScreenPriv->card->driver; + VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; + int nmode; + int n; + RRVisualGroupPtr pVisualGroup; + RRGroupOfVisualGroupPtr pGroupOfVisualGroup; + RRScreenSizePtr pSize; + + *rotations = RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270; + /* + * Get mode information from BIOS -- every time in case + * something changes, like an external monitor is plugged in + */ + modes = vesaGetModes (priv->vi, &nmode); + if (!modes) + return FALSE; + if (priv->modes) + xfree (priv->modes); + priv->modes = modes; + priv->nmode = nmode; + /* + * XXX Create a single set of visual sets that has all of the visuals + * for the root depth + */ + for (n = 0; n < pScreen->numDepths; n++) + if (pScreen->allowedDepths[n].numVids) + break; + if (n == pScreen->numDepths) + return FALSE; + + pVisualGroup = RRCreateVisualGroup (pScreen); + if (!pVisualGroup) + return FALSE; + + if (!RRAddDepthToVisualGroup (pScreen, + pVisualGroup, + &pScreen->allowedDepths[n])) + { + RRDestroyVisualGroup (pScreen, pVisualGroup); + return FALSE; + } + pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup); + if (!pVisualGroup) + return FALSE; + + pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen); + + if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen, + pGroupOfVisualGroup, + pVisualGroup)) + { + RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); + /* pVisualGroup left until screen closed */ + return FALSE; + } + + pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); + if (!pGroupOfVisualGroup) + return FALSE; + + for (n = 0; n < nmode; n++) + { + mode = &priv->modes[n]; + if (vesaModeSupported (priv, mode, FALSE)) { - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 8: - update = shadowUpdateRotate8; break; - case 16: - update = shadowUpdateRotate16; break; - case 32: - update = shadowUpdateRotate32; break; + /* + * XXX limit reported modes to those matching the current + * format + */ + if (mode->NumberOfPlanes == pscr->mode.NumberOfPlanes && + mode->BitsPerPixel == pscr->mode.BitsPerPixel && + mode->MemoryModel == pscr->mode.MemoryModel && + mode->RedMaskSize == pscr->mode.RedMaskSize && + mode->RedFieldPosition == pscr->mode.RedFieldPosition && + mode->GreenMaskSize == pscr->mode.GreenMaskSize && + mode->GreenFieldPosition == pscr->mode.GreenFieldPosition && + mode->BlueMaskSize == pscr->mode.BlueMaskSize && + mode->BlueFieldPosition == pscr->mode.BlueFieldPosition) + { + int width, height, width_mm, height_mm; + if (screen->rotation == 0 || screen->rotation == 180) + { + width = mode->XResolution; + height = mode->YResolution; + width_mm = screen->width_mm; + height_mm = screen->height_mm; + } + else + { + width = mode->YResolution; + height = mode->XResolution; + width_mm = screen->height_mm; + height_mm = screen->width_mm; + } + pSize = RRRegisterSize (pScreen, + width, height, + width_mm, height_mm, + pGroupOfVisualGroup); + if (mode->XResolution == screen->width && + mode->YResolution == screen->height) + { + int rotate = pscr->rotate - screen->rotation; + int rot; + if (rotate < 0) + rotate += 360; + switch (rotate) { + case 0: rot = RR_Rotate_0; break; + case 90: rot = RR_Rotate_90; break; + case 180: rot = RR_Rotate_180; break; + case 270: rot = RR_Rotate_270; break; + } + RRSetCurrentConfig (pScreen, rot, pSize, + pVisualGroup); + } } } + } + return TRUE; +} + +int +vesaLayerAdd (WindowPtr pWin, pointer value) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + LayerPtr pLayer = (LayerPtr) value; + + if (!LayerWindowAdd (pScreen, pLayer, pWin)) + return WT_STOPWALKING; + + return WT_WALKCHILDREN; +} + +int +vesaLayerRemove (WindowPtr pWin, pointer value) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + LayerPtr pLayer = (LayerPtr) value; + + LayerWindowRemove (pScreen, pLayer, pWin); + + return WT_WALKCHILDREN; +} + +Bool +vesaRandRSetConfig (ScreenPtr pScreen, + Rotation rotation, + RRScreenSizePtr pSize, + RRVisualGroupPtr pVisualGroup) +{ + KdScreenPriv(pScreen); + VesaModePtr mode; + KdScreenInfo *screen = pScreenPriv->screen; + VesaCardPrivPtr priv = pScreenPriv->card->driver; + VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; + int n; + Bool wasEnabled = pScreenPriv->enabled; + Bool ret = FALSE; + VesaScreenPrivRec oldscr; + int oldwidth; + int oldheight; + int oldmmwidth; + int oldmmheight; + LayerPtr pNewLayer; + int newwidth, newheight; + + if (screen->rotation == 0 || screen->rotation == 180) + { + newwidth = pSize->width; + newheight = pSize->height; + } + else + { + newwidth = pSize->height; + newheight = pSize->width; + } + for (n = 0; n < priv->nmode; n++) + { + mode = &priv->modes[n]; + if (vesaModeSupported (priv, mode, FALSE)) + { + /* + * XXX all we have to match is the size + */ + if (mode->XResolution == newwidth && + mode->YResolution == newheight && + mode->NumberOfPlanes == pscr->mode.NumberOfPlanes && + mode->BitsPerPixel == pscr->mode.BitsPerPixel && + mode->RedMaskSize == pscr->mode.RedMaskSize && + mode->RedFieldPosition == pscr->mode.RedFieldPosition && + mode->GreenMaskSize == pscr->mode.GreenMaskSize && + mode->GreenFieldPosition == pscr->mode.GreenFieldPosition && + mode->BlueMaskSize == pscr->mode.BlueMaskSize && + mode->BlueFieldPosition == pscr->mode.BlueFieldPosition) + break; + } + } + if (n == priv->nmode) + goto bail0; + + if (wasEnabled) + KdDisableScreen (pScreen); + + if (mode->mode != pscr->mode.mode) + { + ret = vesaSetMode (pScreen, mode); + if (!ret) + goto bail1; + } + + oldscr = *pscr; + + oldwidth = screen->width; + oldheight = screen->height; + oldmmwidth = pScreen->mmWidth; + oldmmheight = pScreen->mmHeight; + + /* + * Set new configuration + */ + + pscr->mode = *mode; + switch (rotation) { + case RR_Rotate_0: pscr->rotate = 0; break; + case RR_Rotate_90: pscr->rotate = 90; break; + case RR_Rotate_180: pscr->rotate = 180; break; + case RR_Rotate_270: pscr->rotate = 270; break; + } + + pscr->rotate += screen->rotation; + if (pscr->rotate >= 360) + pscr->rotate -= 360; + + /* + * Can't rotate some formats + */ + switch (screen->fb[0].bitsPerPixel) { + case 8: + case 16: + case 32: + break; + default: + if (pscr->rotate) + goto bail2; + break; + } + + vesaUnmapFramebuffer (screen); + if (!vesaMapFramebuffer (screen)) + goto bail3; + +#if 0 + /* + * XXX can't switch depths yet + */ + screen->fb[0].depth = depth; + screen->fb[0].bitsPerPixel = bpp; +#endif + screen->fb[0].byteStride = mode->BytesPerScanLine; + screen->fb[0].pixelStride = ((mode->BytesPerScanLine * 8) / screen->fb[0].bitsPerPixel); + + /* + * Compute screen geometry + */ + vesaConfigureScreen (pScreen); + + /* + * Set frame buffer mapping + */ + if (!pscr->shadow) + { + (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), + pScreen->width, + pScreen->height, + screen->fb[0].depth, + screen->fb[0].bitsPerPixel, + screen->fb[0].byteStride, + screen->fb[0].frameBuffer); + } - return KdShadowInitScreen (pScreen, update, window); + /* + * Create the layer + */ + pNewLayer = vesaLayerCreate (pScreen); + if (!pNewLayer) + goto bail4; + + if (WalkTree (pScreen, vesaLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING) + goto bail5; + + WalkTree (pScreen, vesaLayerRemove, (pointer) pscr->pLayer); + LayerDestroy (pScreen, pscr->pLayer); + + pscr->pLayer = pNewLayer; + + + if (wasEnabled) + KdEnableScreen (pScreen); + + return TRUE; + +bail5: + WalkTree (pScreen, vesaLayerRemove, (pointer) pNewLayer); + LayerDestroy (pScreen, pNewLayer); +bail4: + vesaUnmapFramebuffer (screen); + *pscr = oldscr; + (void) vesaMapFramebuffer (screen); + +bail3: + pScreen->width = oldwidth; + pScreen->height = oldheight; + pScreen->mmWidth = oldmmwidth; + pScreen->mmHeight = oldmmheight; + +bail2: + *pscr = oldscr; + + /* + * Set frame buffer mapping + */ + if (!pscr->shadow) + { + (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), + pScreen->width, + pScreen->height, + screen->fb[0].depth, + screen->fb[0].bitsPerPixel, + screen->fb[0].byteStride, + screen->fb[0].frameBuffer); } + + (void) vesaSetMode (pScreen, &pscr->mode); + +bail1: + if (wasEnabled) + KdEnableScreen (pScreen); +bail0: + + return FALSE; +} + +Bool +vesaRandRInit (ScreenPtr pScreen) +{ + rrScrPrivPtr pScrPriv; + if (!RRScreenInit (pScreen)) + return FALSE; + + pScrPriv = rrGetScrPriv(pScreen); + pScrPriv->rrGetInfo = vesaRandRGetInfo; + pScrPriv->rrSetConfig = vesaRandRSetConfig; return TRUE; } +#endif Bool -vesaEnable(ScreenPtr pScreen) +vesaInitScreen(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; + + if (!LayerStartInit (pScreen)) + return FALSE; + + return TRUE; +} + +Bool +vesaFinishInitScreen (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; + + pscr->layerKind = LayerNewKind (pScreen); + + if (!LayerFinishInit (pScreen)) + return FALSE; + + vesaConfigureScreen (pScreen); + + pscr->pLayer = vesaLayerCreate (pScreen); + if (!pscr->pLayer) + return FALSE; + +#ifdef RANDR + if (!vesaRandRInit (pScreen)) + return FALSE; +#endif + + return TRUE; +} + +Bool +vesaSetMode (ScreenPtr pScreen, + VesaModePtr mode) { KdScreenPriv(pScreen); VesaCardPrivPtr priv = pScreenPriv->card->driver; VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; int code; - int i; - CARD32 size; - char *p; - KdMouseMatrix m; - - if (pscr->mode->vbe) + + if (mode->vbe) { if (vesa_verbose) - ErrorF ("Enable VBE mode 0x%x\n", pscr->mode->mode); - code = VbeSetMode(priv->vi, priv->vbeInfo, pscr->mode->mode, - pscr->mapping == VESA_LINEAR); + ErrorF ("Enable VBE mode 0x%x\n", mode->mode); + code = VbeSetMode(priv->vi, priv->vbeInfo, mode->mode, + pscr->mapping == VESA_LINEAR, + mode->MemoryModel == MEMORY_DIRECT); } else { if (vesa_verbose) - ErrorF ("Enable BIOS mode 0x%x\n", pscr->mode->mode); - code = VgaSetMode (priv->vi, pscr->mode->mode); + ErrorF ("Enable BIOS mode 0x%x\n", mode->mode); + code = VgaSetMode (priv->vi, mode->mode); } if(code < 0) return FALSE; + return TRUE; +} + +Bool +vesaEnable(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + VesaCardPrivPtr priv = pScreenPriv->card->driver; + VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; + KdScreenInfo *screen = pScreenPriv->screen; + int code; + int i; + CARD32 size; + char *p; + + if (!vesaSetMode (pScreen, &pscr->mode)) + return FALSE; + switch (pscr->mapping) { case VESA_MONO: VgaSetWritePlaneMask (priv->vi, 0x1); case VESA_LINEAR: + /* + * Remap the frame buffer if necessary + */ + if (!pscr->fb) + { + if (pscr->mode.vbe) + pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo, + pscr->mode.mode, + &pscr->fb_size); + else + pscr->fb = VgaMapFramebuffer (priv->vi, + pscr->mode.mode, + &pscr->fb_size); + if (!pscr->fb) + return FALSE; + screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb); + /* + * Set frame buffer mapping + */ + if (!pscr->shadow) + { + (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), + pScreen->width, + pScreen->height, + screen->fb[0].depth, + screen->fb[0].bitsPerPixel, + screen->fb[0].byteStride, + screen->fb[0].frameBuffer); + } + } memcpy (priv->text, pscr->fb, VESA_TEXT_SAVE); break; case VESA_WINDOWED: @@ -947,17 +1498,6 @@ vesaEnable(ScreenPtr pScreen) } break; } - if (pscr->rotate) - { - m.matrix[0][0] = 0; m.matrix[0][1] = 1; m.matrix[0][2] = 0; - m.matrix[1][0] = -1; m.matrix[1][1] = 0; m.matrix[1][2] = pScreen->height - 1; - } - else - { - m.matrix[0][0] = 1; m.matrix[0][1] = 0; m.matrix[0][2] = 0; - m.matrix[1][0] = 0; m.matrix[1][1] = 1; m.matrix[1][2] = 0; - } - KdSetMouseMatrix (&m); return TRUE; } @@ -965,8 +1505,9 @@ void vesaDisable(ScreenPtr pScreen) { KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; VesaCardPrivPtr priv = pScreenPriv->card->driver; - VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; + VesaScreenPrivPtr pscr = screen->driver; int i=0; CARD32 size; char *p; @@ -999,6 +1540,7 @@ vesaDisable(ScreenPtr pScreen) } break; } + vesaUnmapFramebuffer (screen); } void @@ -1035,7 +1577,7 @@ vesaRestore(KdCardInfo *card) { if (vesa_verbose) ErrorF ("Restore VBE mode 0x%x\n", priv->old_vbe_mode); - VbeSetMode (priv->vi, priv->vbeInfo, priv->old_vbe_mode, 0); + VbeSetMode (priv->vi, priv->vbeInfo, priv->old_vbe_mode, 0, 0); } else { @@ -1052,6 +1594,8 @@ vesaCardFini(KdCardInfo *card) if (priv->vbeInfo) VbeCleanup (priv->vi, priv->vbeInfo); + if (priv->modes) + xfree (priv->modes); Vm86Cleanup(priv->vi); } @@ -1061,16 +1605,7 @@ vesaScreenFini(KdScreenInfo *screen) VesaScreenPrivPtr pscr = screen->driver; VesaCardPrivPtr priv = screen->card->driver; - if (pscr->fb) - { - if (pscr->mode->vbe) - VbeUnmapFramebuffer(priv->vi, priv->vbeInfo, pscr->mode->mode, pscr->fb); - else - VgaUnmapFramebuffer (priv->vi); - } - - if (pscr->shadow) - KdShadowScreenFini (screen); + vesaUnmapFramebuffer (screen); screen->fb[0].depth = pscr->origDepth; } @@ -1110,8 +1645,9 @@ vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; VesaCardPrivPtr priv = pScreenPriv->card->driver; int p; - CARD8 scratch[4]; + CARD8 *scratch; int red, green, blue; + int min, max; if (vesa_swap_rgb) { @@ -1126,13 +1662,20 @@ vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) blue = 2; } + min = 256; + max = 0; while (n--) { + p = pdefs->pixel; + if (p < min) + min = p; + if (p > max) + max = p; + scratch = priv->cmap + (p * 4); scratch[red] = pdefs->red >> 8; scratch[green] = pdefs->green >> 8; scratch[blue] = pdefs->blue >> 8; scratch[3] = 0; - p = pdefs->pixel; pdefs++; if (pscr->mapping == VESA_PLANAR) { @@ -1150,19 +1693,22 @@ vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) vesaSetPalette (priv, 0x14, 1, scratch); } } - else - vesaSetPalette(priv, p, 1, scratch); } + if (pscr->mapping != VESA_PLANAR) + vesaSetPalette (priv, min, max-min+1, priv->cmap + min * 4); } void vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) { KdScreenPriv(pScreen); + VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; VesaCardPrivPtr priv = pScreenPriv->card->driver; int first, i, j, k; - CARD8 scratch[4]; int red, green, blue; + int min, max; + int p; + CARD8 *scratch; if (vesa_swap_rgb) { @@ -1177,8 +1723,24 @@ vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) blue = 2; } - for(i = 0; i<n; i++) { - vesaGetPalette(priv, pdefs[i].pixel, 1, scratch); + min = 256; + max = 0; + for(i = 0; i < n; i++) + { + p = pdefs[i].pixel; + if (p < min) + min = p; + if (p > max) + max = p; + if (pscr->mapping == VESA_PLANAR) + vesaGetPalette (priv, p, 1, priv->cmap + p * 4); + } + if (pscr->mapping != VESA_PLANAR) + vesaGetPalette (priv, min, max - min + 1, priv->cmap + min * 4); + for (i = 0; i < n; i++) + { + p = pdefs[i].pixel; + scratch = priv->cmap + p * 4; pdefs[i].red = scratch[red]<<8; pdefs[i].green = scratch[green]<<8; pdefs[i].blue = scratch[blue]<<8; diff --git a/xc/programs/Xserver/hw/kdrive/vesa/vesa.h b/xc/programs/Xserver/hw/kdrive/vesa/vesa.h index 2f23ec054..7b69cf6dc 100644 --- a/xc/programs/Xserver/hw/kdrive/vesa/vesa.h +++ b/xc/programs/Xserver/hw/kdrive/vesa/vesa.h @@ -19,13 +19,17 @@ 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/vesa/vesa.h,v 1.7 2000/10/20 00:19:50 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesa.h,v 1.11 2001/07/20 19:35:30 keithp Exp $ */ #ifndef _VESA_H_ #define _VESA_H_ #include "kdrive.h" +#include "layer.h" #include "vm86.h" +#ifdef RANDR +#include "randrstr.h" +#endif #define VESA_TEXT_SAVE (64*1024) @@ -72,14 +76,15 @@ typedef struct _VesaMode { typedef struct _VesaCardPriv { int vbe; - Vm86InfoPtr vi; VesaModePtr modes; int nmode; + Vm86InfoPtr vi; int vga_palette; int old_vbe_mode; int old_vga_mode; VbeInfoPtr vbeInfo; char text[VESA_TEXT_SAVE]; + CARD8 cmap[256*4]; } VesaCardPrivRec, *VesaCardPrivPtr; #define VESA_LINEAR 0 @@ -88,13 +93,15 @@ typedef struct _VesaCardPriv { #define VESA_MONO 3 typedef struct _VesaScreenPriv { - VesaModePtr mode; + VesaModeRec mode; Bool shadow; - Bool rotate; + int rotate; int mapping; int origDepth; + int layerKind; void *fb; int fb_size; + LayerPtr pLayer; } VesaScreenPrivRec, *VesaScreenPrivPtr; extern int vesa_video_mode; @@ -118,10 +125,16 @@ vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr); Bool vesaScreenInit(KdScreenInfo *screen); +LayerPtr +vesaLayerCreate (ScreenPtr pScreen); + Bool vesaInitScreen(ScreenPtr pScreen); Bool +vesaFinishInitScreen(ScreenPtr pScreen); + +Bool vesaEnable(ScreenPtr pScreen); void diff --git a/xc/programs/Xserver/hw/kdrive/vesa/vesainit.c b/xc/programs/Xserver/hw/kdrive/vesa/vesainit.c index 3ea1a9264..7d12b5cc6 100644 --- a/xc/programs/Xserver/hw/kdrive/vesa/vesainit.c +++ b/xc/programs/Xserver/hw/kdrive/vesa/vesainit.c @@ -19,7 +19,7 @@ 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/vesa/vesainit.c,v 1.5 2000/12/08 21:40:29 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/vesa/vesainit.c,v 1.6 2001/06/04 09:45:42 keithp Exp $ */ #include "vesa.h" @@ -49,6 +49,8 @@ const KdCardFuncs vesaFuncs = { vesaGetColors, /* getColors */ vesaPutColors, /* putColors */ + + vesaFinishInitScreen, /* finishInitScreen */ }; void diff --git a/xc/programs/Xserver/hw/sunAmoeba/Imakefile b/xc/programs/Xserver/hw/sunAmoeba/Imakefile deleted file mode 100644 index b6ad97b9a..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/Imakefile +++ /dev/null @@ -1,56 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/2 1996/09/28 17:13:18 rws $ -#include <Server.tmpl> - -SRCS1 = sunAmInit.c \ - sunCfb.c \ - sunCursor.c \ - sunFbs.c \ - sunAmIo.c \ - sunAmKbd.c \ - sunMfb.c \ - sunAmMouse.c\ - sunGX.c \ - sunKeyMap.c \ - sunAmScreen.c \ - sunAmProbe.c - -SRCS = $(SRCS1) - -OFILES = sunInitColor.o sunInitMono.o sunInExMono.o - -OBJS = sunCfb.o \ - sunCursor.o \ - sunFbs.o \ - sunAmIo.o \ - sunAmKbd.o \ - sunMfb.o \ - sunAmMouse.o \ - sunGX.o \ - sunKeyMap.o \ - sunAmScreen.o \ - sunAmProbe.o - - INCLUDES = -I. -I../sun -I../.. -I../../mi -I../../mfb -I../../cfb \ - -I../../include -I$(XINCLUDESRC) -I$(FONTINCSRC) - LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ - ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ../cfb/llib-lcfb.ln - -NormalLibraryObjectRule() - -all:: $(OFILES) - -lintlib: - -NormalLibraryTarget(sun,$(OBJS)) -NormalLintTarget($(SRCS1)) - -sunInExMono.o: $(ICONFIGFILES) -ObjectFromSpecialSource(sunInExMono,../../mi/miinitext,-UPEXEXT) -ObjectFromSpecialSource(sunInitMono,sunAmInit,-DSUNMAXDEPTH=1) -ObjectFromSpecialSource(sunInitColor,sunAmInit,-DSUNMAXDEPTH=8) - -ObjectFromSpecialSource(sunGX,../sun/sunGX,/**/) -ObjectFromSpecialSource(sunKeyMap,../sun/sunKeyMap,/**/) -ObjectFromSpecialSource(sunMfb,../sun/sunMfb,/**/) - -DependTarget() diff --git a/xc/programs/Xserver/hw/sunAmoeba/sun.h b/xc/programs/Xserver/hw/sunAmoeba/sun.h deleted file mode 100644 index c53559765..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sun.h +++ /dev/null @@ -1,480 +0,0 @@ - -/* $XConsortium: sun.h /main/3 1996/10/31 14:15:43 kaleb $ */ - -/*- - * Copyright (c) 1987 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -/* $XFree86: xc/programs/Xserver/hw/sunAmoeba/sun.h,v 1.2 1998/06/27 12:53:54 hohndel Exp $ */ - -#ifndef _SUN_H_ -#define _SUN_H_ - -/* X headers */ -#include "Xos.h" -#undef index /* don't mangle silly Sun structure member names */ -#include "X.h" -#include "Xproto.h" - -/* general system headers */ -#ifndef NOSTDHDRS -# include <stdlib.h> -#else -# include <malloc.h> -extern char *getenv(); -#endif - -/* system headers common to both SunOS and Solaris */ -#include <sys/param.h> -#include <sys/file.h> -#include <sys/filio.h> -#include <sys/ioctl.h> -#include <sys/resource.h> -#ifdef SVR4 -#ifdef X_POSIX_C_SOURCE -#define _POSIX_C_SOURCE X_POSIX_C_SOURCE -#include <signal.h> -#undef _POSIX_C_SOURCE -#else -#define _POSIX_SOURCE -#include <signal.h> -#undef _POSIX_SOURCE -#endif -#endif -#include <fcntl.h> -#ifndef i386 -# include <poll.h> -#else -# include <sys/poll.h> -#endif -#include <errno.h> -#ifndef AMOEBA -#include <memory.h> -#else -#include <stdlib.h> -#endif - -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif - -#ifndef AMOEBA -/* - * Sun specific headers Sun moved in Solaris. - * - * Even if only needed by one source file, I have put them here - * to simplify finding them... - */ -#ifdef SVR4 -# include <sys/fbio.h> -# include <sys/kbd.h> -# include <sys/kbio.h> -# include <sys/msio.h> -# include <sys/vuid_event.h> -# include <sys/memreg.h> -# include <stropts.h> -# define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000) -# define GETTIMEOFDAY(x) gettimeofday(x) -#else -# include <sun/fbio.h> -# include <sundev/kbd.h> -# include <sundev/kbio.h> -# include <sundev/msio.h> -# include <sundev/vuid_event.h> -# include <pixrect/pixrect.h> -# include <pixrect/memreg.h> -# define GETTIMEOFDAY(x) gettimeofday(x, NULL); -extern int ioctl(); -extern int getrlimit(); -extern int setrlimit(); -extern int getpagesize(); -#endif -#else /* AMOEBA */ -#define NBBY 8 - -#include <pixrect/pixrect.h> -#include <pixrect/memreg.h> -#include <sun/fbio.h> -#endif /* AMOEBA */ -extern int gettimeofday(); - -/* - * Server specific headers - */ -#include "misc.h" -#undef abs /* don't munge function prototypes in headers, sigh */ -#undef fabs -#include "scrnintstr.h" -#ifdef NEED_EVENTS -# include "inputstr.h" -#endif -#include "input.h" -#include "colormapst.h" -#include "colormap.h" -#include "cursorstr.h" -#include "cursor.h" -#include "dixstruct.h" -#include "dix.h" -#include "opaque.h" -#include "resource.h" -#include "servermd.h" -#include "windowstr.h" - -/* - * ddx specific headers - */ -#ifndef PSZ -#define PSZ 8 -#endif - -#include "mi/mibstore.h" -#include "mi/mipointer.h" - -extern int monitorResolution; - - -/* Frame buffer devices */ -#ifdef SVR4 -# define CGTWO0DEV "/dev/fbs/cgtwo0" -# define CGTWO1DEV "/dev/fbs/cgtwo1" -# define CGTWO2DEV "/dev/fbs/cgtwo2" -# define CGTWO3DEV "/dev/fbs/cgtwo3" -# define CGTHREE0DEV "/dev/fbs/cgthree0" -# define CGTHREE1DEV "/dev/fbs/cgthree1" -# define CGTHREE2DEV "/dev/fbs/cgthree2" -# define CGTHREE3DEV "/dev/fbs/cgthree3" -# define CGFOUR0DEV "/dev/fbs/cgfour0" -# define CGSIX0DEV "/dev/fbs/cgsix0" -# define CGSIX1DEV "/dev/fbs/cgsix1" -# define CGSIX2DEV "/dev/fbs/cgsix2" -# define CGSIX3DEV "/dev/fbs/cgsix3" -# define BWTWO0DEV "/dev/fbs/bwtwo0" -# define BWTWO1DEV "/dev/fbs/bwtwo1" -# define BWTWO2DEV "/dev/fbs/bwtwo2" -# define BWTWO3DEV "/dev/fbs/bwtwo3" -# define CGEIGHT0DEV "/dev/fbs/cgeight0" -#else -# define CGTWO0DEV "/dev/cgtwo0" -# define CGTWO1DEV "/dev/cgtwo1" -# define CGTWO2DEV "/dev/cgtwo2" -# define CGTWO3DEV "/dev/cgtwo3" -# define CGTHREE0DEV "/dev/cgthree0" -# define CGTHREE1DEV "/dev/cgthree1" -# define CGTHREE2DEV "/dev/cgthree2" -# define CGTHREE3DEV "/dev/cgthree3" -# define CGFOUR0DEV "/dev/cgfour0" -# define CGSIX0DEV "/dev/cgsix0" -# define CGSIX1DEV "/dev/cgsix1" -# define CGSIX2DEV "/dev/cgsix2" -# define CGSIX3DEV "/dev/cgsix3" -# define BWTWO0DEV "/dev/bwtwo0" -# define BWTWO1DEV "/dev/bwtwo1" -# define BWTWO2DEV "/dev/bwtwo2" -# define BWTWO3DEV "/dev/bwtwo3" -# define CGEIGHT0DEV "/dev/cgeight0" -#endif - -/* - * MAXEVENTS is the maximum number of events the mouse and keyboard functions - * will read on a given call to their GetEvents vectors. - */ -#define MAXEVENTS 32 - -/* - * Data private to any sun keyboard. - */ -typedef struct { - int fd; - int type; /* Type of keyboard */ - int layout; /* The layout of the keyboard */ - int click; /* kbd click save state */ - Leds leds; /* last known LED state */ -} sunKbdPrivRec, *sunKbdPrivPtr; - -extern sunKbdPrivRec sunKbdPriv; - -/* - * Data private to any sun pointer device. - */ -typedef struct { - int fd; - int bmask; /* last known button state */ -#ifdef AMOEBA - int dx, dy; /* current coordinates of pointer */ - Bool mouseMoved; -#endif -} sunPtrPrivRec, *sunPtrPrivPtr; - -extern sunPtrPrivRec sunPtrPriv; - -typedef struct { - BYTE key; - CARD8 modifiers; -} SunModmapRec; - -typedef struct { - int width, height; - Bool has_cursor; - CursorPtr pCursor; /* current cursor */ -} sunCursorRec, *sunCursorPtr; - -typedef struct { - ColormapPtr installedMap; - CloseScreenProcPtr CloseScreen; - void (*UpdateColormap)(); - sunCursorRec hardwareCursor; - Bool hasHardwareCursor; -} sunScreenRec, *sunScreenPtr; - -#define GetScreenPrivate(s) ((sunScreenPtr) ((s)->devPrivates[sunScreenIndex].ptr)) -#define SetupScreen(s) sunScreenPtr pPrivate = GetScreenPrivate(s) - -typedef struct { - unsigned char* fb; /* Frame buffer itself */ - int fd; /* frame buffer for ioctl()s, */ - struct fbtype info; /* Frame buffer characteristics */ - void (*EnterLeave)();/* screen switch */ - unsigned char* fbPriv; /* fbattr stuff, for the real type */ -} fbFd; - -typedef Bool (*sunFbInitProc)( -#if NeedFunctionPrototypes - int /* screen */, - ScreenPtr /* pScreen */, - int /* argc */, - char** /* argv */ -#endif -); - -typedef struct { - sunFbInitProc init; /* init procedure for this fb */ - char* name; /* /usr/include/fbio names */ -#ifdef AMOEBA - Bool (*probeProc)(); /* probe procedure for this fb */ -#endif -} sunFbDataRec; - -#ifndef XKB -extern Bool sunAutoRepeatHandlersInstalled; -extern long sunAutoRepeatInitiate; -extern long sunAutoRepeatDelay; -#endif -extern sunFbDataRec sunFbData[]; -extern fbFd sunFbs[]; -extern Bool sunSwapLkeys; -extern Bool sunFlipPixels; -extern Bool sunActiveZaphod; -extern Bool sunFbInfo; -extern Bool sunCG4Frob; -extern int sunScreenIndex; -extern int* sunProtected; - -extern Bool sunCursorInitialize( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */ -#endif -); - -extern void sunDisableCursor( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */ -#endif -); - -extern int sunChangeKbdTranslation( -#if NeedFunctionPrototypes - int /* fd */, - Bool /* makeTranslated */ -#endif -); - -extern void sunNonBlockConsoleOff( -#if NeedFunctionPrototypes -#ifdef SVR4 - void -#else - char* /* arg */ -#endif -#endif -); - -extern void sunEnqueueEvents( -#if NeedFunctionPrototypes - void -#endif -); - -extern int sunGXInit( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */, - fbFd* /* fb */ -#endif -); - -extern Bool sunSaveScreen( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */, - int /* on */ -#endif -); - -extern Bool sunScreenInit( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */ -#endif -); - -extern pointer sunMemoryMap( -#if NeedFunctionPrototypes - size_t /* len */, - off_t /* off */, - int /* fd */ -#endif -); - -extern Bool sunScreenAllocate( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */ -#endif -); - -extern Bool sunInitCommon( -#if NeedFunctionPrototypes - int /* scrn */, - ScreenPtr /* pScrn */, - off_t /* offset */, - Bool (* /* init1 */)(), - void (* /* init2 */)(), - Bool (* /* cr_cm */)(), - Bool (* /* save */)(), - int /* fb_off */ -#endif -); - -#ifndef AMOEBA - -extern Firm_event* sunKbdGetEvents( -#if NeedFunctionPrototypes - int /* fd */, - int* /* pNumEvents */, - Bool* /* pAgain */ -#endif -); - -extern Firm_event* sunMouseGetEvents( -#if NeedFunctionPrototypes - int /* fd */, - int* /* pNumEvents */, - Bool* /* pAgain */ -#endif -); - -extern void sunKbdEnqueueEvent( -#if NeedFunctionPrototypes - DeviceIntPtr /* device */, - Firm_event* /* fe */ -#endif -); - -extern void sunMouseEnqueueEvent( -#if NeedFunctionPrototypes - DeviceIntPtr /* device */, - Firm_event* /* fe */ -#endif -); - -#endif /* AMOEBA */ - -extern int sunKbdProc( -#if NeedFunctionPrototypes - DeviceIntPtr /* pKeyboard */, - int /* what */ -#endif -); - -extern int sunMouseProc( -#if NeedFunctionPrototypes - DeviceIntPtr /* pMouse */, - int /* what */ -#endif -); - -extern void sunKbdWait( -#if NeedFunctionPrototypes - void -#endif -); - -/*- - * TVTOMILLI(tv) - * Given a struct timeval, convert its time into milliseconds... - */ -#define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000)) - -extern Bool sunCfbSetupScreen( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */, - pointer /* pbits */, /* pointer to screen bitmap */ - int /* xsize */, /* in pixels */ - int /* ysize */, - int /* dpix */, /* dots per inch */ - int /* dpiy */, /* dots per inch */ - int /* width */, /* pixel width of frame buffer */ - int /* bpp */ /* bits per pixel of root */ -#endif -); - -extern Bool sunCfbFinishScreenInit( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */, - pointer /* pbits */, /* pointer to screen bitmap */ - int /* xsize */, /* in pixels */ - int /* ysize */, - int /* dpix */, /* dots per inch */ - int /* dpiy */, /* dots per inch */ - int /* width */, /* pixel width of frame buffer */ - int /* bpp */ /* bits per pixel of root */ -#endif -); - -extern Bool sunCfbScreenInit( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */, - pointer /* pbits */, /* pointer to screen bitmap */ - int /* xsize */, /* in pixels */ - int /* ysize */, - int /* dpix */, /* dots per inch */ - int /* dpiy */, /* dots per inch */ - int /* width */, /* pixel width of frame buffer */ - int /* bpp */ /* bits per pixel of root */ -#endif -); - -extern void sunInstallColormap( -#if NeedFunctionPrototypes - ColormapPtr /* cmap */ -#endif -); - -extern void sunUninstallColormap( -#if NeedFunctionPrototypes - ColormapPtr /* cmap */ -#endif -); - -extern int sunListInstalledColormaps( -#if NeedFunctionPrototypes - ScreenPtr /* pScreen */, - Colormap* /* pCmapList */ -#endif -); - -#endif diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c deleted file mode 100644 index 71357c489..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c +++ /dev/null @@ -1,468 +0,0 @@ -/* $TOG: sunAmInit.c /main/4 1998/02/10 13:17:32 kaleb $ */ -/* - * sunAmInit.c -- - * Amoeba implementation of initialization functions - * for screen/keyboard/mouse, etc. - * - * Copyright 1987 by the Regents of the University of California - * Copyright 1994 by the Vrije Universiteit, Amsterdam. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * and the Vrije Universiteit make no representations about - * the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * - */ - -/* $XFree86: xc/programs/Xserver/hw/sunAmoeba/sunAmInit.c,v 1.5 1998/10/04 09:38:41 dawes Exp $ */ - -/* This file was partly derived from sunInit.c (5.49 94/02/21 10:21:02) */ - -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE 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 "sun.h" -#include "gcstruct.h" -#include "mibstore.h" - -Bool sunAutoRepeatHandlersInstalled; /* FALSE each time InitOutput called */ -Bool sunSwapLkeys = FALSE; -Bool sunFlipPixels = FALSE; -Bool sunFbInfo = FALSE; -Bool sunCG4Frob = FALSE; - -/* maximum pixmap depth */ -#ifndef SUNMAXDEPTH -#define SUNMAXDEPTH 8 -#endif - -typedef Bool initfunc ( -#if NeedFunctionPrototypes - int /* screen */, - ScreenPtr /* pScreen */, - int /* argc */, - char** /* argv */ -#endif -); - -extern initfunc sunBW2Init; -extern initfunc sunCG6Init; -extern initfunc sunCG3Init; - -extern Bool sunBW2Probe(); -extern Bool sunCG3CProbe(); -extern Bool sunCG6CProbe(); - -sunFbDataRec sunFbData[] = { - sunBW2Init, "bwtwo0", sunBW2Probe, -#if SUNMAXDEPTH > 1 - sunCG6Init, "cgsix0", sunCG6CProbe, - sunCG3Init, "cgthree0", sunCG3CProbe, -#endif -}; - -#define NUMSCREENS (sizeof(sunFbData)/sizeof(sunFbData[0])) - -fbFd sunFbs[MAXSCREENS]; - -static PixmapFormatRec formats[] = { - { 1, 1, BITMAP_SCANLINE_PAD } /* 1-bit deep */ -#if SUNMAXDEPTH > 1 - ,{ 8, 8, BITMAP_SCANLINE_PAD} /* 8-bit deep */ -#if SUNMAXDEPTH > 8 - ,{ 12, 24, BITMAP_SCANLINE_PAD } /* 12-bit deep */ - ,{ 24, 32, BITMAP_SCANLINE_PAD } /* 24-bit deep */ -#endif -#endif -}; -#define NUMFORMATS (sizeof formats)/(sizeof formats[0]) - -void OsVendorInit( -#if NeedFunctionPrototypes - void -#endif -) -{ - /* nothing special to do for Amoeba */ -} - -/*- - *----------------------------------------------------------------------- - * InitOutput -- - * Initialize screenInfo for all actually accessible framebuffers. - * The - * - * Results: - * screenInfo init proc field set - * - * Side Effects: - * None - * - *----------------------------------------------------------------------- - */ - -void InitOutput(pScreenInfo, argc, argv) - ScreenInfo *pScreenInfo; - int argc; - char **argv; -{ - static Bool sunDevsInited = FALSE; - static int screen_type[MAXSCREENS]; - static int nscreens; - int i, scr; - - if (!monitorResolution) - monitorResolution = 90; - pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - - pScreenInfo->numPixmapFormats = NUMFORMATS; - for (i=0; i< NUMFORMATS; i++) - pScreenInfo->formats[i] = formats[i]; - sunAutoRepeatHandlersInstalled = FALSE; - - if (!sunDevsInited) { - /* first time ever */ - nscreens = 0; - for (i = 0; - sunFbData[i].probeProc != NULL && nscreens < NUMSCREENS; - i++) - { - if ((*sunFbData[i].probeProc)(pScreenInfo, nscreens, - sunFbData[i].name, argc, argv)) - { - printf("Found screen %s (%d)\n", sunFbData[i].name, i); - screen_type[nscreens] = i; - nscreens++; - break; /* we only support one screen, currently */ - } - } - sunDevsInited = TRUE; - } - - for (scr = 0; scr < nscreens; scr++) { - if (AddScreen (sunFbData[screen_type[scr]].init, argc, argv) < 0) { - extern void AbortDDX(); - - FatalError("AddScreen failed"); - AbortDDX(); /* forcing loader not to ignore SunIo.o */ - } - } -} - -/*- - *----------------------------------------------------------------------- - * InitInput -- - * Initialize all supported input devices...what else is there - * besides pointer and keyboard? - * - * Results: - * None. - * - * Side Effects: - * Two DeviceRec's are allocated and registered as the system pointer - * and keyboard devices. - * - *----------------------------------------------------------------------- - */ -void InitInput(argc, argv) - int argc; - char **argv; -{ - int i; - DevicePtr p, k; - extern Bool mieqInit(); - - p = AddInputDevice(sunMouseProc, TRUE); - k = AddInputDevice(sunKbdProc, TRUE); - if (!p || !k) - FatalError("failed to create input devices in InitInput"); - - RegisterPointerDevice(p); - RegisterKeyboardDevice(k); - miRegisterPointerDevice(screenInfo.screens[0], p); - (void) mieqInit (k, p); -} - - -/* The rest of this file is identical to the code in sunInit.c */ - -#if SUNMAXDEPTH == 8 - -Bool -sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ - int bpp; /* bits per pixel of root */ -{ - return cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, - width); -} - -Bool -sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ - int bpp; /* bits per pixel of root */ -{ - return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, - width); -} - -Bool -sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ - int bpp; /* bits per pixel of root */ -{ - return cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width); -} - -#else /* SUNMAXDEPTH != 8 */ -#if SUNMAXDEPTH == 32 - -static Bool -sunCfbCreateGC(pGC) - GCPtr pGC; -{ - if (pGC->depth == 1) - { - return mfbCreateGC (pGC); - } - else if (pGC->depth <= 8) - { - return cfbCreateGC (pGC); - } - else if (pGC->depth <= 16) - { - return cfb16CreateGC (pGC); - } - else if (pGC->depth <= 32) - { - return cfb32CreateGC (pGC); - } - return FALSE; -} - -static void -sunCfbGetSpans(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 32: - cfb32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart); - break; - } - return; -} - -static void -sunCfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine) - DrawablePtr pDrawable; - int sx, sy, w, h; - unsigned int format; - unsigned long planeMask; - char *pdstLine; -{ - switch (pDrawable->bitsPerPixel) - { - case 1: - mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; - case 8: - cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; - case 16: - cfb16GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; - case 32: - cfb32GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; - } -} - -Bool -sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ - int bpp; /* bits per pixel of root */ -{ - extern int cfbWindowPrivateIndex; - extern int cfbGCPrivateIndex; - int ret; - - switch (bpp) { - case 8: - ret = cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width); - break; - case 16: - ret = cfb16SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width); - break; - case 32: - ret = cfb32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width); - break; - default: - return FALSE; - } - pScreen->CreateGC = sunCfbCreateGC; - pScreen->GetImage = sunCfbGetImage; - pScreen->GetSpans = sunCfbGetSpans; - return ret; -} - -extern BSFuncRec cfbBSFuncRec, cfb16BSFuncRec, cfb32BSFuncRec; -extern int cfb16ScreenPrivateIndex, cfb32ScreenPrivateIndex; -extern Bool cfbCloseScreen(), cfb16CloseScreen(), cfb32CloseScreen(); - -Bool -sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ - int bpp; -{ - int i; - pointer oldDevPrivate; - VisualPtr visuals; - int nvisuals; - DepthPtr depths; - int ndepths; - VisualID defaultVisual; - int rootdepth = 0; - - if (!cfbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, - &rootdepth, &defaultVisual, 1 << (bpp - 1), 8)) - return FALSE; - oldDevPrivate = pScreen->devPrivate; - if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, - rootdepth, ndepths, depths, - defaultVisual, nvisuals, visuals)) - return FALSE; - switch (bpp) - { - case 8: - pScreen->CloseScreen = cfbCloseScreen; - pScreen->BackingStoreFuncs = cfbBSFuncRec; - break; - case 16: - pScreen->CloseScreen = cfb16CloseScreen; - pScreen->devPrivates[cfb16ScreenPrivateIndex].ptr = - pScreen->devPrivate; - pScreen->devPrivate = oldDevPrivate; - pScreen->BackingStoreFuncs = cfb16BSFuncRec; - break; - case 32: - pScreen->CloseScreen = cfb32CloseScreen; - pScreen->devPrivates[cfb32ScreenPrivateIndex].ptr = - pScreen->devPrivate; - pScreen->devPrivate = oldDevPrivate; - pScreen->BackingStoreFuncs = cfb32BSFuncRec; - break; - } - return TRUE; -} - - -Bool -sunCfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ - int bpp; -{ - if (!sunCfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, - width, bpp)) - return FALSE; - return sunCfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, - dpiy, width, bpp); -} - -#endif /* SUNMAXDEPTH == 32 */ -#endif /* SUNMAXDEPTH */ - -#ifdef XDPMS -/************************************************************** - * DPMSSet(), DPMSGet(), DPMSSupported() - * - * stubs - * - ***************************************************************/ - -void DPMSSet (level) - int level; -{ -} - -int DPMSGet (level) - int* level; -{ - return -1; -} - -Bool DPMSSupported () -{ - return FALSE; -} -#endif diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmIo.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmIo.c deleted file mode 100644 index 6624d6ff9..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunAmIo.c +++ /dev/null @@ -1,175 +0,0 @@ -/* $XConsortium: sunAmIo.c,v 1.1 94/04/01 17:54:49 dpw Exp $ */ -/*- - * sunAmIo.c -- - * Amoeba implementation of functions to handle input from - * the keyboard and mouse. - * - * Copyright (c) 1994 by the Vrije Universiteit, Amsterdam - * Copyright (c) 1994 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The Vrije Universiteit and - * the University of California make no representations about - * the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - */ - -#define NEED_EVENTS -#include "sun.h" - -#include "amoeba.h" -#include "server/iop/iop.h" - -static int lastEventTime; - -int -TimeSinceLastInputEvent() -{ - /* Return the time in milliseconds since there last was any input */ - register long now; - - now = GetTimeInMillis(); - if (lastEventTime == 0) - lastEventTime = now; - return (now - lastEventTime); -} - -void -SetTimeSinceLastInputEvent() -{ - lastEventTime = GetTimeInMillis(); -} - -/*- - *----------------------------------------------------------------------- - * ProcessInputEvents -- - * Retrieve all waiting input events and pass them to DIX in their - * correct chronological order. Only reads from the system pointer - * and keyboard. - * - * Results: - * None. - * - * Side Effects: - * Events are passed to the DIX layer. - * - *----------------------------------------------------------------------- - */ -void -ProcessInputEvents () -{ - DevicePtr pPointer; - DevicePtr pKeyboard; - register sunPtrPrivPtr ptrPriv; - register sunKbdPrivPtr kbdPriv; - int i; - register IOPEvent *e, *elast; - IOPEvent events[MAXEVENTS]; - xEvent x; - static int firsttime = TRUE; - - pPointer = LookupPointerDevice(); - pKeyboard = LookupKeyboardDevice(); - ptrPriv = (sunPtrPrivPtr)pPointer->devicePrivate; - kbdPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate; - - while ((i = AmoebaGetEvents(events, MAXEVENTS)) > 0) { - for (e = &events[0], elast = &events[i]; e < elast; e++) { - x.u.keyButtonPointer.time = lastEventTime = e->time; - switch (e->type) { - case EV_PointerDelta: - x.u.u.type = MotionNotify; - x.u.keyButtonPointer.rootX = e->x; - x.u.keyButtonPointer.rootY = e->y; - sunMouseProcessEvent(pPointer, &x); - break; - case EV_ButtonPress: - x.u.u.type = ButtonPress; - x.u.u.detail = e->keyorbut; - sunMouseProcessEvent(pPointer, &x); - break; - case EV_ButtonRelease: - x.u.u.type = ButtonRelease; - x.u.u.detail = e->keyorbut; - sunMouseProcessEvent(pPointer, &x); - break; - case EV_KeyPressEvent: - /* device dependent code goes here */ - x.u.u.type = KeyPress; - x.u.u.detail = e->keyorbut; - sunKbdProcessEvent(pKeyboard, &x); - break; - case EV_KeyReleaseEvent: - x.u.u.type = KeyRelease; - x.u.u.detail = e->keyorbut; - sunKbdProcessEvent(pKeyboard, &x); - /* device dependent code goes here */ - break; - default: - /* this shouldn't happen */ - ErrorF("stray event %d (%d,%d) %x\n", - e->type, e->x, e->y, e->keyorbut); - break; - } - } - - sunMouseDoneEvents(pPointer, TRUE); - } - - mieqProcessInputEvents(); - miPointerUpdate(); -} - -/* - * DDX - specific abort routine. Called by AbortServer(). - */ -void AbortDDX() -{ - int i; - ScreenPtr pScreen; - - for (i = 0; i < screenInfo.numScreens; i++) - { - pScreen = screenInfo.screens[i]; - (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF); - sunDisableCursor (pScreen); - } -} - -/* Called by GiveUp(). */ -void -ddxGiveUp() -{ - AbortDDX (); -} - -void -ddxUseMsg() -{ - ErrorF("-swapLkeys swap keysyms on L1..L10\n"); - ErrorF("-mono force monochrome-only screen\n"); - ErrorF("-flipPixels flip black and white pixels\n"); -} - -int -ddxProcessArgument (argc, argv, i) - int argc; - char *argv[]; - int i; -{ - if (strcmp (argv[i], "-swapLkeys") == 0) { /* -swapLkeys */ - sunSwapLkeys = TRUE; - return 1; - } - if (strcmp (argv[i], "-mono") == 0) { /* -mono */ - return 1; - } - if (strcmp (argv[i], "-flipPixels") == 0) { /* -flipPixels */ - sunFlipPixels = TRUE; - return 1; - } - return 0; -} - diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmKbd.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmKbd.c deleted file mode 100644 index ca0d9a051..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunAmKbd.c +++ /dev/null @@ -1,630 +0,0 @@ -/* $TOG: sunAmKbd.c /main/3 1998/02/10 13:17:46 kaleb $ */ -/*- - * Copyright 1987 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -/* This is a modified version of sunKbd.c (version 5.39 94/02/23 15:55:52), - * making it work for Amoeba. - */ - -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE 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. - -********************************************************/ - -#define NEED_EVENTS -#include "sun.h" -#include "keysym.h" -#include "Sunkeysym.h" - -#include <amoeba.h> -#include <cmdreg.h> -#include <stdcom.h> -#include <stderr.h> -#include <server/iop/iop.h> - -extern capability iopcap; - -#define SUN_LED_MASK 0x0f -#define MIN_KEYCODE 8 /* necessary to avoid the mouse buttons */ -#define MAX_KEYCODE 255 /* limited by the protocol */ -#ifndef KB_SUN4 -#define KB_SUN4 4 -#endif - -#define AUTOREPEAT_INITIATE 200 -#define AUTOREPEAT_DELAY 50 - -extern KeySymsRec sunKeySyms[]; -extern SunModmapRec *sunModMaps[]; -extern int sunMaxLayout; -extern KeySym *sunType4KeyMaps[]; -extern SunModmapRec *sunType4ModMaps[]; - -long sunAutoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE; -long sunAutoRepeatDelay = 1000 * AUTOREPEAT_DELAY; - -static int autoRepeatKeyDown = 0; -static int autoRepeatReady; -static int autoRepeatFirst; -long autoRepeatLastKeyDown; -long autoRepeatDelta; - -static sunKbdPrivRec sysKbPriv = { - -1, /* Type */ - -1, /* Layout */ - 0, /* click */ - (Leds)0 /* leds */ -}; - -static void SwapKeys(keysyms) - KeySymsRec* keysyms; -{ - unsigned int i; - KeySym k; - - for (i = 2; i < keysyms->maxKeyCode * keysyms->mapWidth; i++) - if (keysyms->map[i] == XK_L1 || - keysyms->map[i] == XK_L2 || - keysyms->map[i] == XK_L3 || - keysyms->map[i] == XK_L4 || - keysyms->map[i] == XK_L5 || - keysyms->map[i] == XK_L6 || - keysyms->map[i] == XK_L7 || - keysyms->map[i] == XK_L8 || - keysyms->map[i] == XK_L9 || - keysyms->map[i] == XK_L10) { - /* yes, I could have done a clever two line swap! */ - k = keysyms->map[i - 2]; - keysyms->map[i - 2] = keysyms->map[i]; - keysyms->map[i] = k; - } -} - -static void SetLights (ctrl) - KeybdCtrl* ctrl; -{ - /* TODO */ -} - - -static void ModLight (device, on, led) - DeviceIntPtr device; - Bool on; - int led; -{ - KeybdCtrl* ctrl = &device->kbdfeed->ctrl; - sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate; - - if(on) { - ctrl->leds |= led; - pPriv->leds |= led; - } else { - ctrl->leds &= ~led; - pPriv->leds &= ~led; - } - SetLights (ctrl); -} - -/*- - *----------------------------------------------------------------------- - * sunBell -- - * Ring the terminal/keyboard bell - * - * Results: - * Ring the keyboard bell for an amount of time proportional to - * "loudness." - * - * Side Effects: - * None, really... - * - *----------------------------------------------------------------------- - */ - -#if NeedFunctionPrototypes -static void sunBell ( - int percent, - DeviceIntPtr device, - pointer ctrl, - int unused) -#else -static void sunBell (percent, device, ctrl, unused) - int percent; /* Percentage of full volume */ - DeviceIntPtr device; /* Keyboard to ring */ - pointer ctrl; - int unused; -#endif -{ - int kbdCmd; /* Command to give keyboard */ - KeybdCtrl* kctrl = (KeybdCtrl*) ctrl; - - if (percent == 0 || kctrl->bell == 0) - return; - - (void) iop_ringbell(&iopcap, percent, - kctrl->bell_pitch, kctrl->bell_duration); -} - - -static void EnqueueEvent (xE) - xEvent* xE; -{ - mieqEnqueue (xE); -} - -#define XLED_NUM_LOCK 0x1 -#define XLED_COMPOSE 0x4 -#define XLED_SCROLL_LOCK 0x2 -#define XLED_CAPS_LOCK 0x8 - -static KeyCode LookupKeyCode (keysym, keysymsrec) - KeySym keysym; - KeySymsPtr keysymsrec; -{ - KeyCode i; - int ii, index = 0; - - for (i = keysymsrec->minKeyCode; i < keysymsrec->maxKeyCode; i++) - for (ii = 0; ii < keysymsrec->mapWidth; ii++) - if (keysymsrec->map[index++] == keysym) - return i; -} - -static void pseudoKey(device, down, keycode) - DeviceIntPtr device; - Bool down; - KeyCode keycode; -{ - int bit; - CARD8 modifiers; - CARD16 mask; - BYTE* kptr; - - kptr = &device->key->down[keycode >> 3]; - bit = 1 << (keycode & 7); - modifiers = device->key->modifierMap[keycode]; - if (down) { - /* fool dix into thinking this key is now "down" */ - int i; - *kptr |= bit; - device->key->prev_state = device->key->state; - for (i = 0, mask = 1; modifiers; i++, mask <<= 1) - if (mask & modifiers) { - device->key->modifierKeyCount[i]++; - device->key->state += mask; - modifiers &= ~mask; - } - } else { - /* fool dix into thinking this key is now "up" */ - if (*kptr & bit) { - int i; - *kptr &= ~bit; - device->key->prev_state = device->key->state; - for (i = 0, mask = 1; modifiers; i++, mask <<= 1) - if (mask & modifiers) { - if (--device->key->modifierKeyCount[i] <= 0) { - device->key->state &= ~mask; - device->key->modifierKeyCount[i] = 0; - } - modifiers &= ~mask; - } - } - } -} - -static void DoLEDs(device, ctrl, pPriv) - DeviceIntPtr device; /* Keyboard to alter */ - KeybdCtrl* ctrl; - sunKbdPrivPtr pPriv; -{ - if ((ctrl->leds & XLED_CAPS_LOCK) && !(pPriv->leds & XLED_CAPS_LOCK)) - pseudoKey(device, TRUE, - LookupKeyCode(XK_Caps_Lock, &device->key->curKeySyms)); - - if (!(ctrl->leds & XLED_CAPS_LOCK) && (pPriv->leds & XLED_CAPS_LOCK)) - pseudoKey(device, FALSE, - LookupKeyCode(XK_Caps_Lock, &device->key->curKeySyms)); - - if ((ctrl->leds & XLED_NUM_LOCK) && !(pPriv->leds & XLED_NUM_LOCK)) - pseudoKey(device, TRUE, - LookupKeyCode(XK_Num_Lock, &device->key->curKeySyms)); - - if (!(ctrl->leds & XLED_NUM_LOCK) && (pPriv->leds & XLED_NUM_LOCK)) - pseudoKey(device, FALSE, - LookupKeyCode(XK_Num_Lock, &device->key->curKeySyms)); - - if ((ctrl->leds & XLED_SCROLL_LOCK) && !(pPriv->leds & XLED_SCROLL_LOCK)) - pseudoKey(device, TRUE, - LookupKeyCode(XK_Scroll_Lock, &device->key->curKeySyms)); - - if (!(ctrl->leds & XLED_SCROLL_LOCK) && (pPriv->leds & XLED_SCROLL_LOCK)) - pseudoKey(device, FALSE, - LookupKeyCode(XK_Scroll_Lock, &device->key->curKeySyms)); - - if ((ctrl->leds & XLED_COMPOSE) && !(pPriv->leds & XLED_COMPOSE)) - pseudoKey(device, TRUE, - LookupKeyCode(SunXK_Compose, &device->key->curKeySyms)); - - if (!(ctrl->leds & XLED_COMPOSE) && (pPriv->leds & XLED_COMPOSE)) - pseudoKey(device, FALSE, - LookupKeyCode(SunXK_Compose, &device->key->curKeySyms)); - - pPriv->leds = ctrl->leds & 0x0f; - SetLights (ctrl); -} - -/*- - *----------------------------------------------------------------------- - * sunKbdCtrl -- - * Alter some of the keyboard control parameters - * - * Results: - * None. - * - * Side Effects: - * Some... - * - *----------------------------------------------------------------------- - */ - -#if NeedFunctionPrototypes -static void sunKbdCtrl ( - DeviceIntPtr device, - KeybdCtrl* ctrl) -#else -static void sunKbdCtrl (device, ctrl) - DeviceIntPtr device; /* Keyboard to alter */ - KeybdCtrl* ctrl; -#endif -{ - sunKbdPrivPtr pPriv = (sunKbdPrivPtr) device->public.devicePrivate; - - if (ctrl->click != pPriv->click) { - pPriv->click = ctrl->click; - (void) iop_keyclick(&iopcap, ctrl->click); - } - if (pPriv->type == KB_SUN4 && pPriv->leds != ctrl->leds & 0x0f) - DoLEDs(device, ctrl, pPriv); -} - -/*- - *----------------------------------------------------------------------- - * sunKbdProc -- - * Handle the initialization, etc. of a keyboard. - * - * Results: - * None. - * - *----------------------------------------------------------------------- - */ - -#if NeedFunctionPrototypes -int sunKbdProc ( - DeviceIntPtr device, - int what) -#else -int sunKbdProc (device, what) - DeviceIntPtr device; /* Keyboard to manipulate */ - int what; /* What to do to it */ -#endif -{ - int i; - DevicePtr pKeyboard = (DevicePtr) device; - sunKbdPrivPtr pPriv; - KeybdCtrl* ctrl = &device->kbdfeed->ctrl; - - static CARD8 *workingModMap = NULL; - static KeySymsRec *workingKeySyms; - - switch (what) { - case DEVICE_INIT: - if (pKeyboard != LookupKeyboardDevice()) { - ErrorF ("Cannot open non-system keyboard\n"); - return (!Success); - } - - /* - * First open and find the current state of the keyboard. - */ - if (!workingKeySyms) { - errstat err; - - if ((err = iop_kbdtype(&iopcap, &sysKbPriv.type)) != STD_OK) { - ErrorF("Xsun: iop_kbdtype failed: %s\n", err_why(err)); - FatalError("Cannot get keyboard type\n"); - } - if (sysKbPriv.type == KB_SUN4) { - /* TODO: we also need to get the layout from iop_kbdtype. - * For now we'll just assume layout 0 by default. - */ - sysKbPriv.layout = 0; - sunKeySyms[KB_SUN4].map = sunType4KeyMaps[sysKbPriv.layout]; - sunModMaps[KB_SUN4] = sunType4ModMaps[sysKbPriv.layout]; - } - - if (sysKbPriv.type < 0 || sysKbPriv.type > KB_SUN4 || - sunKeySyms[sysKbPriv.type].map == NULL) - { - FatalError("Unsupported keyboard type %d\n",sysKbPriv.type); - } - - /* - * Perform final initialization of the system private keyboard - * structure and fill in various slots in the device record - * itself which couldn't be filled in before. - */ - (void) memset ((void *) defaultKeyboardControl.autoRepeats, - ~0, sizeof defaultKeyboardControl.autoRepeats); - autoRepeatKeyDown = 0; - /* - * Initialize the keysym map - */ - workingKeySyms = &sunKeySyms[sysKbPriv.type]; - - /* - * Create and initialize the modifier map. - */ - if (!workingModMap) { - workingModMap=(CARD8 *)xalloc(MAP_LENGTH); - (void) memset(workingModMap, 0, MAP_LENGTH); - for(i=0; sunModMaps[sysKbPriv.type][i].key != 0; i++) - workingModMap[sunModMaps[sysKbPriv.type][i].key + MIN_KEYCODE] = - sunModMaps[sysKbPriv.type][i].modifiers; - } - - if (sysKbPriv.type == KB_SUN4 && sunSwapLkeys) - SwapKeys(workingKeySyms); - /* - * ensure that the keycodes on the wire are >= MIN_KEYCODE - * and <= MAX_KEYCODE - */ - if (workingKeySyms->minKeyCode < MIN_KEYCODE) { - workingKeySyms->minKeyCode += MIN_KEYCODE; - workingKeySyms->maxKeyCode += MIN_KEYCODE; - } - if (workingKeySyms->maxKeyCode > MAX_KEYCODE) - workingKeySyms->maxKeyCode = MAX_KEYCODE; - } - pKeyboard->devicePrivate = (pointer)&sysKbPriv; - pKeyboard->on = FALSE; - - InitKeyboardDeviceStruct(pKeyboard, - workingKeySyms, workingModMap, - sunBell, sunKbdCtrl); - break; - - case DEVICE_ON: - pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate; - pKeyboard->on = TRUE; - break; - - case DEVICE_CLOSE: - case DEVICE_OFF: - pPriv = (sunKbdPrivPtr)pKeyboard->devicePrivate; - if (pPriv->type == KB_SUN4) { - /* dumb bug in Sun's keyboard! Turn off LEDS before resetting */ - pPriv->leds = 0; - ctrl->leds = 0; - SetLights(ctrl); - } - pKeyboard->on = FALSE; - break; - default: - FatalError("Unknown keyboard operation\n"); - } - return Success; -} - -/*- - *----------------------------------------------------------------------- - * sunKbdEnqueueEvent -- - * - *----------------------------------------------------------------------- - */ -static xEvent autoRepeatEvent; - -static Bool DoSpecialKeys(device, xE) - DeviceIntPtr device; - xEvent* xE; -{ - int shift_index, map_index, bit; - KeySym ksym; - BYTE* kptr; - sunKbdPrivPtr pPriv = (sunKbdPrivPtr)device->public.devicePrivate; - BYTE keycode = xE->u.u.detail; - CARD8 keyModifiers = device->key->modifierMap[keycode]; - - /* look up the present idea of the keysym */ - shift_index = 0; - if (device->key->state & ShiftMask) - shift_index ^= 1; - if (device->key->state & LockMask) - shift_index ^= 1; - /* TODO: find out how to get a map_index under Amoeba. - * For now just ignore special keys. - */ - ksym = 0; - - if (ksym == XK_Num_Lock) { - if (pPriv->type == KB_SUN4) - ModLight (device, xE->u.u.type == KeyPress, XLED_NUM_LOCK); - } else if (ksym == XK_Scroll_Lock) { - if (pPriv->type == KB_SUN4) - ModLight (device, xE->u.u.type == KeyPress, XLED_SCROLL_LOCK); - } else if (ksym == SunXK_Compose) { - if (pPriv->type == KB_SUN4) - ModLight (device, xE->u.u.type == KeyPress, XLED_COMPOSE); - } else if (keyModifiers & LockMask) { - if (pPriv->type == KB_SUN4) - ModLight (device, xE->u.u.type == KeyPress, XLED_CAPS_LOCK); - } else if ((xE->u.u.type == KeyPress) && (keyModifiers == 0)) { - /* initialize new AutoRepeater event & mark AutoRepeater on */ - autoRepeatEvent = *xE; - autoRepeatFirst = TRUE; - autoRepeatKeyDown++; - autoRepeatLastKeyDown = GetTimeInMillis(); - } - return FALSE; -} - - -void -sunKbdProcessEvent(device, xeva) - DeviceIntPtr device; - xEvent *xeva; -{ - xEvent xE; - BYTE keycode; - CARD8 keyModifiers; - - xE = *xeva; - xE.u.u.detail &= 0x7f; - xE.u.u.detail += MIN_KEYCODE; - keycode = xE.u.u.detail; - keyModifiers = device->key->modifierMap[keycode]; - if (autoRepeatKeyDown && (keyModifiers == 0) && - (xE.u.u.type == KeyPress || (keycode == autoRepeatEvent.u.u.detail))) { - /* - * Kill AutoRepeater on any real non-modifier key down, or auto key up - */ - autoRepeatKeyDown = 0; - } - if (DoSpecialKeys(device, &xE)) - return; - mieqEnqueue (&xE); -} - -void sunEnqueueAutoRepeat () -{ - int delta; - int i, mask; - KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl; - - if (ctrl->autoRepeat != AutoRepeatModeOn) { - autoRepeatKeyDown = 0; - return; - } - i=(autoRepeatEvent.u.u.detail >> 3); - mask=(1 << (autoRepeatEvent.u.u.detail & 7)); - if (!(ctrl->autoRepeats[i] & mask)) { - autoRepeatKeyDown = 0; - return; - } - - /* - * Generate auto repeat event. XXX one for now. - * Update time & pointer location of saved KeyPress event. - */ - - delta = autoRepeatDelta; - autoRepeatFirst = FALSE; - - /* - * Fake a key up event and a key down event - * for the last key pressed. - */ - autoRepeatEvent.u.keyButtonPointer.time += delta; - autoRepeatEvent.u.u.type = KeyRelease; - - EnqueueEvent (&autoRepeatEvent); - autoRepeatEvent.u.u.type = KeyPress; - EnqueueEvent (&autoRepeatEvent); - - /* Update time of last key down */ - autoRepeatLastKeyDown += autoRepeatDelta; -} - -/*ARGSUSED*/ -Bool LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return TRUE; -} - -/*ARGSUSED*/ -void sunBlockHandler(nscreen, pbdata, pptv, pReadmask) - int nscreen; - pointer pbdata; - struct timeval **pptv; - pointer pReadmask; -{ - KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl; - static struct timeval artv = { 0, 0 }; /* autorepeat timeval */ - - if (!autoRepeatKeyDown) - return; - - if (ctrl->autoRepeat != AutoRepeatModeOn) - return; - - if (autoRepeatFirst == TRUE) - artv.tv_usec = sunAutoRepeatInitiate; - else - artv.tv_usec = sunAutoRepeatDelay; - *pptv = &artv; - -} - -/*ARGSUSED*/ -void sunWakeupHandler(nscreen, pbdata, err, pReadmask) - int nscreen; - pointer pbdata; - unsigned long err; - pointer pReadmask; -{ - KeybdCtrl* ctrl = &((DeviceIntPtr)LookupKeyboardDevice())->kbdfeed->ctrl; - struct timeval tv; - - if (ctrl->autoRepeat != AutoRepeatModeOn) - return; - - if (autoRepeatKeyDown) { - register long tv = GetTimeInMillis(); - - autoRepeatDelta = tv - autoRepeatLastKeyDown; - if ((!autoRepeatFirst && (autoRepeatDelta > (sunAutoRepeatDelay/1000))) - || (autoRepeatDelta > (sunAutoRepeatInitiate/1000))) - { - autoRepeatReady++; - } - } - - if (autoRepeatReady) - { - sunEnqueueAutoRepeat (); - autoRepeatReady = 0; - } -} diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmMouse.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmMouse.c deleted file mode 100644 index 872c9dead..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunAmMouse.c +++ /dev/null @@ -1,323 +0,0 @@ -/* $TOG: sunAmMouse.c /main/3 1998/02/10 13:17:51 kaleb $ */ - -/*- - * Copyright 1987 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -/* This is a modified version of sunMouse.c, making it work for Amoeba */ - -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE 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. - -********************************************************/ -/* - * Copyright 1991, 1992, 1993 Kaleb S. Keithley - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. Kaleb S. Keithley makes no - * representations about the suitability of this software for - * any purpose. It is provided "as is" without express or - * implied warranty. - */ - -#define NEED_EVENTS -#include "sun.h" - -Bool sunActiveZaphod = TRUE; - -static Bool sunCursorOffScreen(); -static void sunCrossScreen(); -static void sunWarpCursor(); - -miPointerScreenFuncRec sunPointerScreenFuncs = { - sunCursorOffScreen, - sunCrossScreen, - sunWarpCursor, -}; - -static sunPtrPrivRec sysMousePriv = { - 0, - 0, /* Current button state */ - 0, - 0, - 0 -}; - -/*- - *----------------------------------------------------------------------- - * sunMouseCtrl -- - * Alter the control parameters for the mouse. Since acceleration - * etc. is done from the PtrCtrl record in the mouse's device record, - * there's nothing to do here. - * - * Results: - * None. - * - * Side Effects: - * None. - * - *----------------------------------------------------------------------- - */ -/*ARGSUSED*/ -static -#if NeedFunctionPrototypes -void sunMouseCtrl ( - DeviceIntPtr device, - PtrCtrl* ctrl) -#else -void sunMouseCtrl (device, ctrl) - DeviceIntPtr device; - PtrCtrl* ctrl; -#endif -{ -} - -/*- - *----------------------------------------------------------------------- - * sunMouseProc -- - * Handle the initialization, etc. of a mouse - * - * Results: - * none. - * - * Side Effects: - * - * Note: - * When using sunwindows, all input comes off a single fd, stored in the - * global windowFd. Therefore, only one device should be enabled and - * disabled, even though the application still sees both mouse and - * keyboard. We have arbitrarily chosen to enable and disable windowFd - * in the keyboard routine sunKbdProc rather than in sunMouseProc. - * - *----------------------------------------------------------------------- - */ -#if NeedFunctionPrototypes -int sunMouseProc ( - DeviceIntPtr device, - int what) -#else -int sunMouseProc (device, what) - DeviceIntPtr device; /* Mouse to play with */ - int what; /* What to do with it */ -#endif -{ - DevicePtr pMouse = (DevicePtr) device; - int format; - static int oformat; - BYTE map[4]; - char *dev; - - switch (what) { - case DEVICE_INIT: - if (pMouse != LookupPointerDevice()) { - ErrorF ("Cannot open non-system mouse"); - return !Success; - } - pMouse->devicePrivate = (pointer) &sysMousePriv; - pMouse->on = FALSE; - map[1] = 1; - map[2] = 2; - map[3] = 3; - InitPointerDeviceStruct( - pMouse, map, 3, miPointerGetMotionEvents, - sunMouseCtrl, miPointerGetMotionBufferSize()); - break; - - case DEVICE_ON: - pMouse->on = TRUE; - break; - - case DEVICE_CLOSE: - break; - - case DEVICE_OFF: - pMouse->on = FALSE; - break; - } - return Success; -} - -/*- - *----------------------------------------------------------------------- - * MouseAccelerate -- - * Given a delta and a mouse, return the acceleration of the delta. - * - * Results: - * The corrected delta - * - * Side Effects: - * None. - * - *----------------------------------------------------------------------- - */ -static short -MouseAccelerate (device, delta) - DeviceIntPtr device; - int delta; -{ - int sgn = sign(delta); - PtrCtrl *pCtrl; - short ret; - - delta = abs(delta); - pCtrl = &device->ptrfeed->ctrl; - if (delta > pCtrl->threshold) { - ret = - (short) sgn * - (pCtrl->threshold + ((delta - pCtrl->threshold) * pCtrl->num) / - pCtrl->den); - } else { - ret = (short) sgn * delta; - } - return ret; -} - -/* - * Given an xEvent for a mouse, pass it off the the dix layer - * properly converted ... - */ -void -sunMouseProcessEvent(pMouse, xeva) - DevicePtr pMouse; /* mouse from which the event came */ - xEvent *xeva; -{ - int index; /* screen index */ - xEvent xE; - sunPtrPrivPtr pPriv; /* private data for pointer */ - register int bmask; /* temporary button mask */ - int x,y; - - xE = *xeva; - pPriv = (sunPtrPrivPtr)pMouse->devicePrivate; - - bmask = pPriv->bmask; - switch (xE.u.u.type) { - case ButtonRelease: - if (!(bmask & (1 << xE.u.u.detail))) { - /* This may happen when the server starts up; ignore it */ - /* ErrorF("Xsun: Ignoring spurious button release\n"); */ - return; - } - pPriv->bmask &= ~(1<<xE.u.u.detail); - break; - case ButtonPress: - if ((bmask & (1 << xE.u.u.detail))) { - ErrorF("Xsun: Ignoring spurious button press\n"); - return; - } - pPriv->bmask |= (1<<xE.u.u.detail); - break; - case MotionNotify: - /* - * When we detect a change in the mouse coordinates, we call - * the cursor module to move the cursor. It has the option of - * simply removing the cursor or just shifting it a bit. - * If it is removed, DIX will restore it before we goes to sleep... - * - * What should be done if it goes off the screen? Move to another - * screen? For now, we just force the pointer to stay on the - * screen... - */ - pPriv->dx += MouseAccelerate(pMouse, xE.u.keyButtonPointer.rootX); - pPriv->dy += MouseAccelerate(pMouse, xE.u.keyButtonPointer.rootY); - pPriv->mouseMoved = TRUE; - return; - default: - FatalError("sunMouseProcessEvent: unrecognized id\n"); - break; - } - - miPointerPosition(&x, &y); - xE.u.keyButtonPointer.rootX = x; - xE.u.keyButtonPointer.rootY = y; - mieqEnqueue(&xE); -} - -/* - * Finish off any mouse motions we haven't done yet - */ -/*ARGSUSED*/ -void -sunMouseDoneEvents(pMouse,final) - DevicePtr pMouse; - Bool final; -{ - sunPtrPrivPtr pPriv; - xEvent xE; - int dx, dy; - - pPriv = (sunPtrPrivPtr) pMouse->devicePrivate; - - if (pPriv->mouseMoved) { - dx = pPriv->dx; - dy = pPriv->dy; - pPriv->dx = pPriv->dy = 0; - pPriv->mouseMoved = FALSE; - miPointerDeltaCursor(dx, dy, TimeSinceLastInputEvent()); - } -} - -/*ARGSUSED*/ -static Bool -sunCursorOffScreen (pScreen, x, y) - ScreenPtr *pScreen; - int *x, *y; -{ - extern Bool PointerConfinedToScreen(); - - if (PointerConfinedToScreen()) return TRUE; - - /* since we support only one screen anyway: */ - return FALSE; -} - -static void -sunCrossScreen (pScreen, entering) - ScreenPtr pScreen; - Bool entering; -{ - if (sunFbs[pScreen->myNum].EnterLeave) - (*sunFbs[pScreen->myNum].EnterLeave) (pScreen, entering ? 0 : 1); -} - -static void -sunWarpCursor (pScreen, x, y) - ScreenPtr pScreen; - int x, y; -{ - miPointerWarpCursor (pScreen, x, y); -} diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmProbe.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmProbe.c deleted file mode 100644 index fee016800..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunAmProbe.c +++ /dev/null @@ -1,238 +0,0 @@ -/* $TOG: sunAmProbe.c /main/3 1998/02/10 13:17:55 kaleb $ */ -/*- - * sunAmProbe.c: - * Amoeba implementation of functions to probe and map in the - * frame buffer of several supported video cards (CG6, CG3, BW2). - */ - -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE 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 "sun.h" - -#include <pixrect/memreg.h> -#include "colormap.h" -#include "colormapst.h" -#include "resource.h" -#include <cfb.h> -#include <sundev/bw2reg.h> - -#include <amoeba.h> -#include <cmdreg.h> -#include <stderr.h> -#include <machdep.h> -#include <proc.h> -#include <server/iop/iop.h> -#include <ampolicy.h> - -extern bufptr sunMapAmoebaScreen(); -extern int sunAmoebaScreen(); - -/* - * Code partly derived from the X11R5 version of sunCG6C.c: - */ - -#ifdef FBTYPE_SUNFAST_COLOR - -#define CG6_VBASE 0x70000000 - -#define CG6_IMAGE(fb) ((caddr_t)(&(fb)->cpixel)) -#define CG6_IMAGEOFF ((off_t)0x16000) -#define CG6_GXOFF ((off_t)0) - -/*- - *----------------------------------------------------------------------- - * sunCG6Probe -- - * Attempt to find and initialize a cg6 framebuffer - * - * Results: - * TRUE if everything went ok. FALSE if not. - * - * Side Effects: - * Memory is allocated for the frame buffer and the buffer is mapped. - * - *----------------------------------------------------------------------- - */ - -Bool -sunCG6CProbe (pScreenInfo, index, fbNum, argc, argv) - ScreenInfo *pScreenInfo; /* The screenInfo struct */ - int index; /* The index of pScreen in the ScreenInfo */ - int fbNum; /* Index into the sunFbData array */ - int argc; /* The number of the Server's arguments. */ - char **argv; /* The arguments themselves. Don't change! */ -{ - IOPFrameBufferInfo screen; - pointer fb; - int imagelen; - int offset; - - if (sunAmoebaScreen(&screen, "cgsix", 8) == 0) - return FALSE; - /* We have a little problem with Amoeba. The CG6_IMAGEOFF = 0x16000 - * means that the start of the hardware segment is not click-aligned. - * Therefore we round it up to a multiple of the pagesize and add that - * extra bit to fb to make it point to the right part of the hardware - */ - offset = (CG6_IMAGEOFF + CLICKSIZE - 1) & ~(CLICKSIZE - 1); - imagelen = offset + screen.width * screen.height; - fb = (pointer) sunMapAmoebaScreen(&screen.fb, imagelen); - if (fb == NULL) { - Error("Mapping cg6c: sunMapAmoebaScreen failed"); - return FALSE; - } - /* Move the pointer up to where the hardware begins */ - fb += offset - CG6_IMAGEOFF; - - sunFbs[index].fd = -1; /* we never use this but we set it from paranoia */ - sunFbs[index].fb = fb; - sunFbs[index].info.fb_width = screen.width; - sunFbs[index].info.fb_height = screen.height; - sunFbs[index].info.fb_depth = screen.depth; - sunFbs[index].EnterLeave = NULL; - return TRUE; -} - -#endif /* FBTYPE_SUNFAST_COLOR */ - -/* - * Code derived from the X11R5 version of sunCG3C.c: - */ - -#define CG3A_HEIGHT 900 -#define CG3A_WIDTH 1152 -#define CG3B_HEIGHT 768 -#define CG3B_WIDTH 1024 - -typedef struct cg3ac { -#ifdef sparc - u_char mpixel[128*1024]; /* bit-per-pixel memory */ - u_char epixel[128*1024]; /* enable plane */ -#endif - u_char cpixel[CG3A_HEIGHT][CG3A_WIDTH]; /* byte-per-pixel memory */ -} CG3AC, CG3ACRec, *CG3ACPtr; - -typedef struct cg3bc { -#ifdef sparc - u_char mpixel[128*1024]; /* bit-per-pixel memory */ - u_char epixel[128*1024]; /* enable plane */ -#endif - u_char cpixel[CG3B_HEIGHT][CG3B_WIDTH]; /* byte-per-pixel memory */ -} CG3BC, CG3BCRec, *CG3BCPtr; - -#define CG3AC_IMAGE(fb) ((caddr_t)((fb)->cpixel)) -#define CG3AC_IMAGELEN (((sizeof (CG3AC) + 4095)/4096)*4096) -#define CG3BC_IMAGE(fb) ((caddr_t)((fb)->cpixel)) -#define CG3BC_IMAGELEN (((sizeof (CG3BC) + 4095)/4096)*4096) - -/*- - *----------------------------------------------------------------------- - * sunCG3CProbe -- - * Attempt to find and initialize a cg3 framebuffer - * - * Results: - * TRUE if everything went ok. FALSE if not. - * - * Side Effects: - * Memory is allocated for the frame buffer and the buffer is mapped. - * - *----------------------------------------------------------------------- - */ - -/*ARGSUSED*/ -Bool -sunCG3CProbe (pScreenInfo, index, fbNum, argc, argv) - ScreenInfo *pScreenInfo; /* The screenInfo struct */ - int index; /* The index of pScreen in the ScreenInfo */ - int fbNum; /* Index into the sunFbData array */ - int argc; /* The number of the Server's arguments. */ - char **argv; /* The arguments themselves. Don't change! */ -{ - IOPFrameBufferInfo screen; - CG3ACPtr CG3ACfb; - CG3BCPtr CG3BCfb; - pointer fb; - - if (sunAmoebaScreen(&screen, "cgthree", 8) == 0) - return FALSE; - if (screen.width == CG3A_WIDTH) { - CG3ACfb = (CG3ACPtr) sunMapAmoebaScreen(&screen.fb, CG3AC_IMAGELEN); - if (CG3ACfb == NULL) - return FALSE; - fb = (pointer) CG3AC_IMAGE(CG3ACfb); - } - else if (screen.width == CG3B_WIDTH) { - CG3BCfb = (CG3BCPtr) sunMapAmoebaScreen(&screen.fb, CG3BC_IMAGELEN); - if (CG3BCfb == NULL) - return FALSE; - fb = (pointer) CG3BC_IMAGE(CG3BCfb); - } - else { - Error("Mapping cg3c: unexpected width"); - return FALSE; - } - - sunFbs[index].fd = -1; /* we never use this but we set it from paranoia */ - sunFbs[index].fb = fb; - sunFbs[index].info.fb_width = screen.width; - sunFbs[index].info.fb_height = screen.height; - sunFbs[index].info.fb_depth = screen.depth; - sunFbs[index].EnterLeave = NULL; - return TRUE; -} - -/* Code derived from sunMfb.c, 1.3 94/02/01 11:02:34 kaleb: */ - -typedef struct bw2 { - u_char image[BW2_FBSIZE]; /* Pixel buffer */ -} BW2, BW2Rec, *BW2Ptr; - -Bool -sunBW2Probe(pScreenInfo, index, fbNum, argc, argv) - ScreenInfo *pScreenInfo; /* The screenInfo struct */ - int index; /* The index of pScreen in the ScreenInfo */ - int fbNum; /* Index into the sunFbData array */ - int argc; /* The number of the Server's arguments. */ - char **argv; /* The arguments themselves. Don't change! */ -{ - IOPFrameBufferInfo screen; - BW2Ptr BW2fb; /* Place the bitmap is mapped in addr space */ - - if (sunAmoebaScreen(&screen, "bwtwo", 1) == 0) - return FALSE; - BW2fb = (BW2Ptr) sunMapAmoebaScreen(&screen.fb, - screen.stride * screen.height / 8); - if (BW2fb == NULL) - return FALSE; - sunFbs[index].fb = (pointer)BW2fb; - sunFbs[index].info.fb_width = screen.width; - sunFbs[index].info.fb_height = screen.height; - sunFbs[index].EnterLeave = NULL; - return TRUE; -} diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunAmScreen.c b/xc/programs/Xserver/hw/sunAmoeba/sunAmScreen.c deleted file mode 100644 index 35a8c5a2f..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunAmScreen.c +++ /dev/null @@ -1,88 +0,0 @@ -/* $XConsortium: sunAmScreen.c,v 1.1 94/04/01 17:55:13 dpw Exp $ */ -/* - * Copyright 1993 Vrije Universiteit, The Netherlands - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, 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 the Vrije Universiteit not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The Vrije Universiteit makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * THE VRIJE UNIVERSITEIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE VRIJE UNIVERSITEIT 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. - */ - -/* - * This is the code that Amoeba uses to probe and map in a sun bitmap display. - */ - -#include "sun.h" - -#include "amoeba.h" -#include "cmdreg.h" -#include "stderr.h" -#include "ampolicy.h" -#include "proc.h" -#include "server/iop/iop.h" - -bufptr -sunMapAmoebaScreen(cap, nbytes) - capability *cap; - int nbytes; -{ - static char *addr; - segid seg; - char *findhole(); - - if (addr) return addr; - - /* First find a place to map in the segment: */ - addr = findhole(nbytes); - seg = seg_map(cap, addr, nbytes, MAP_TYPEDATA|MAP_READWRITE|MAP_INPLACE); - if (seg < 0) { - ErrorF("Xsun: map_segment(bitmap) %x %x: %s\n", - addr, nbytes, err_why(ERR_CONVERT(seg))); - return NULL; - } - - return addr; -} - -extern capability iopcap; - -int -sunAmoebaScreen(screen, name, depth) - IOPFrameBufferInfo *screen; - char *name; /* The name of the device we want to find */ - unsigned short depth; /* framebuffer depth we expect to find */ -{ - errstat err; - - if ((err = iop_framebufferinfo(&iopcap, screen)) != STD_OK) { - ErrorF("Xsun: get frame buffer info failed: %s\n", err_why(err)); - return 0; - } - - if (screen->xmm <= 0 || screen->ymm <= 0) { - ErrorF("X or Y dimensions of screen <= 0\n"); - return 0; - } - if (screen->depth != depth || - strncmp(name, screen->name, IOPNAMELEN) != 0) { - return 0; - } - - /* printf("Screen information: width %d, height %d, stride %d\n", - screen->width, screen->height, screen->stride); */ - - return 1; -} diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunCfb.c b/xc/programs/Xserver/hw/sunAmoeba/sunCfb.c deleted file mode 100644 index c2d5d38d9..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunCfb.c +++ /dev/null @@ -1,471 +0,0 @@ - -/* $TOG: sunCfb.c /main/3 1998/02/10 13:18:04 kaleb $ */ - -/* -Copyright 1990, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - */ - -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE 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. - -********************************************************/ - -/* - * Copyright 1987 by the Regents of the University of California - * Copyright 1987 by Adam de Boor, UC Berkeley - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -/* $XFree86: xc/programs/Xserver/hw/sunAmoeba/sunCfb.c,v 1.3 1998/10/04 09:38:42 dawes Exp $ */ - -/****************************************************************/ -/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */ -/****************************************************************/ - -/* - * Copyright 1991, 1992, 1993 Kaleb S. Keithley - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. Kaleb S. Keithley makes no - * representations about the suitability of this software for - * any purpose. It is provided "as is" without express or - * implied warranty. - */ - -#include "sun.h" -#include "cfb/cfb.h" -#ifdef AMOEBA -#include "amoeba.h" -#include "cmdreg.h" -#include "stderr.h" -#include "server/iop/colourmap.h" -#include "server/iop/iop.h" -#endif /* AMOEBA */ - -static void CGUpdateColormap(pScreen, dex, count, rmap, gmap, bmap) - ScreenPtr pScreen; - int dex, count; - u_char *rmap, *gmap, *bmap; -{ -#ifndef AMOEBA - struct fbcmap sunCmap; - - sunCmap.index = dex; - sunCmap.count = count; - sunCmap.red = &rmap[dex]; - sunCmap.green = &gmap[dex]; - sunCmap.blue = &bmap[dex]; - - if (ioctl(sunFbs[pScreen->myNum].fd, FBIOPUTCMAP, &sunCmap) < 0) { - Error("CGUpdateColormap"); - FatalError( "CGUpdateColormap: FBIOPUTCMAP failed\n" ); - } -#else - extern capability iopcap; - colour_map sunCmap; - errstat err; - - sunCmap.c_index = dex; - sunCmap.c_count = count; - sunCmap.c_red = &rmap[dex]; - sunCmap.c_green = &gmap[dex]; - sunCmap.c_blue = &bmap[dex]; - - if ((err = iop_setcmap(&iopcap, &sunCmap)) != STD_OK) { - ErrorF("Xsun: iop_setcmap failed: %s\n", err_why(err)); - FatalError( "sunCGUpdateColormap: failed\n" ); - } -#endif -} - -void sunInstallColormap(cmap) - ColormapPtr cmap; -{ - SetupScreen(cmap->pScreen); - register int i; - register Entry *pent; - register VisualPtr pVisual = cmap->pVisual; - u_char rmap[256], gmap[256], bmap[256]; - - if (cmap == pPrivate->installedMap) - return; - if (pPrivate->installedMap) - WalkTree(pPrivate->installedMap->pScreen, TellLostMap, - (pointer) &(pPrivate->installedMap->mid)); - if ((pVisual->class | DynamicClass) == DirectColor) { - for (i = 0; i < 256; i++) { - rmap[i] = cmap->red[i].co.local.red >> 8; - gmap[i] = cmap->green[i].co.local.green >> 8; - bmap[i] = cmap->blue[i].co.local.blue >> 8; - } - } else { - for (i = 0, pent = cmap->red; - i < pVisual->ColormapEntries; - i++, pent++) { - if (pent->fShared) { - rmap[i] = pent->co.shco.red->color >> 8; - gmap[i] = pent->co.shco.green->color >> 8; - bmap[i] = pent->co.shco.blue->color >> 8; - } - else { - rmap[i] = pent->co.local.red >> 8; - gmap[i] = pent->co.local.green >> 8; - bmap[i] = pent->co.local.blue >> 8; - } - } - } - pPrivate->installedMap = cmap; - (*pPrivate->UpdateColormap) (cmap->pScreen, 0, 256, rmap, gmap, bmap); - WalkTree(cmap->pScreen, TellGainedMap, (pointer) &(cmap->mid)); -} - -void sunUninstallColormap(cmap) - ColormapPtr cmap; -{ - SetupScreen(cmap->pScreen); - if (cmap == pPrivate->installedMap) { - Colormap defMapID = cmap->pScreen->defColormap; - - if (cmap->mid != defMapID) { - ColormapPtr defMap = (ColormapPtr) LookupIDByType(defMapID, - RT_COLORMAP); - - if (defMap) - (*cmap->pScreen->InstallColormap)(defMap); - else - ErrorF("sunFbs: Can't find default colormap\n"); - } - } -} - -int sunListInstalledColormaps(pScreen, pCmapList) - ScreenPtr pScreen; - Colormap *pCmapList; -{ - SetupScreen(pScreen); - *pCmapList = pPrivate->installedMap->mid; - return (1); -} - -static void CGStoreColors(pmap, ndef, pdefs) - ColormapPtr pmap; - int ndef; - xColorItem *pdefs; -{ - SetupScreen(pmap->pScreen); - u_char rmap[256], gmap[256], bmap[256]; - xColorItem expanddefs[256]; - register int i; - - if (pPrivate->installedMap != NULL && pPrivate->installedMap != pmap) - return; - if ((pmap->pVisual->class | DynamicClass) == DirectColor) { - ndef = cfbExpandDirectColors(pmap, ndef, pdefs, expanddefs); - pdefs = expanddefs; - } - while (ndef--) { - i = pdefs->pixel; - rmap[i] = pdefs->red >> 8; - gmap[i] = pdefs->green >> 8; - bmap[i] = pdefs->blue >> 8; - (*pPrivate->UpdateColormap) (pmap->pScreen, i, 1, rmap, gmap, bmap); - pdefs++; - } -} - -static void CGScreenInit (pScreen) - ScreenPtr pScreen; -{ -#ifndef STATIC_COLOR /* { */ - SetupScreen (pScreen); - pScreen->InstallColormap = sunInstallColormap; - pScreen->UninstallColormap = sunUninstallColormap; - pScreen->ListInstalledColormaps = sunListInstalledColormaps; - pScreen->StoreColors = CGStoreColors; - pPrivate->UpdateColormap = CGUpdateColormap; - if (sunFlipPixels) { - Pixel pixel = pScreen->whitePixel; - pScreen->whitePixel = pScreen->blackPixel; - pScreen->blackPixel = pixel; - } -#endif /* } */ -} - -static void checkMono (argc, argv) - int argc; - char** argv; -{ - int i; - - for (i = 1; i < argc; i++) - if (strcmp (argv[i], "-mono") == 0) - ErrorF ("-mono not appropriate for CG3/CG4/CG6\n"); -} - -/* - * CG3_MMAP_OFFSET is #defined in <pixrect/cg3var.h> or <sys/cg3var.h> - * on SunOS and Solaris respectively. Under Solaris, cg3var.h - * #includes a non-existent file, and causes the make to abort. Since all - * cg3var.h is needed for is this one #define, we'll just #define it here - * and let it go at that. - */ - -#ifdef SVR4 -#define CG3_MMAP_OFFSET 0x04000000 -#else -#include <pixrect/cg3var.h> -#endif - -Bool sunCG3Init (screen, pScreen, argc, argv) - int screen; /* what screen am I going to be */ - ScreenPtr pScreen; /* The Screen to initialize */ - int argc; /* The number of the Server's arguments. */ - char **argv; /* The arguments themselves. Don't change! */ -{ - checkMono (argc, argv); - sunFbs[screen].EnterLeave = (void (*)())NoopDDA; - return sunInitCommon (screen, pScreen, (off_t) CG3_MMAP_OFFSET, - sunCfbScreenInit, CGScreenInit, - cfbCreateDefColormap, sunSaveScreen, 0); -} - -#ifndef i386 /* { */ - -#ifdef SVR4 -#include <sys/cg2reg.h> -#else -#include <pixrect/cg2reg.h> -#endif - -typedef struct { - struct cg2memfb mem; - struct cg2fb regs; -} *CG2Ptr; - -static void CG2UpdateColormap(pScreen, index, count, rmap, gmap,bmap) - ScreenPtr pScreen; - int index, count; - u_char *rmap, *gmap, *bmap; -{ - CG2Ptr fb = (CG2Ptr) sunFbs[pScreen->myNum].fb; -#if __STDC__ - volatile -#endif - struct cg2statusreg *regp = &fb->regs.status.reg; - - regp->update_cmap = 0; - while (count--) { - fb->regs.redmap[index] = rmap[index]; - fb->regs.greenmap[index] = gmap[index]; - fb->regs.bluemap[index] = bmap[index]; - index++; - } - regp->update_cmap = 1; -} - -static Bool CG2SaveScreen (pScreen, on) - ScreenPtr pScreen; - int on; -{ - CG2Ptr fb = (CG2Ptr) sunFbs[pScreen->myNum].fb; -#if __STDC__ - volatile -#endif - struct cg2statusreg *regp = &fb->regs.status.reg; - - if (on != SCREEN_SAVER_FORCER) - regp->video_enab = (on == SCREEN_SAVER_ON) ? 0 : 1; -} - -static void CG2ScreenInit (pScreen) - ScreenPtr pScreen; -{ - SetupScreen (pScreen); - CGScreenInit (pScreen); - pPrivate->UpdateColormap = CG2UpdateColormap; -} - -Bool sunCG2Init (screen, pScreen, argc, argv) - int screen; /* what screen am I going to be */ - ScreenPtr pScreen; /* The Screen to initialize */ - int argc; /* The number of the Server's arguments. */ - char** argv; /* The arguments themselves. Don't change! */ -{ - sunScreenPtr pPrivate; - int i; - Bool ret; - Bool mono = FALSE; - - for (i = 1; i < argc; i++) - if (strcmp (argv[i], "-mono") == 0) - mono = TRUE; - - sunFbs[screen].EnterLeave = (void (*)())NoopDDA; - pScreen->SaveScreen = CG2SaveScreen; - if (mono) { - pScreen->whitePixel = 0; - pScreen->blackPixel = 1; - ret = sunInitCommon (screen, pScreen, (off_t) 0, - mfbScreenInit, NULL, - mfbCreateDefColormap, CG2SaveScreen, 0); - ((CG2Ptr) sunFbs[screen].fb)->regs.ppmask.reg = 1; - } else { - ret = sunInitCommon (screen, pScreen, (off_t) 0, - sunCfbScreenInit, CG2ScreenInit, - cfbCreateDefColormap, CG2SaveScreen, - (int) &((struct cg2memfb *) 0)->pixplane); - ((CG2Ptr) sunFbs[screen].fb)->regs.ppmask.reg = 0xFF; - } - return ret; -} - -#ifdef SVR4 -#include <sys/cg4reg.h> -#else -#include <sundev/cg4reg.h> -#endif - -#define CG4_HEIGHT 900 -#define CG4_WIDTH 1152 - -#define CG4_MELEN (128*1024) - -typedef struct { - u_char mpixel[CG4_MELEN]; /* bit-per-pixel memory */ - u_char epixel[CG4_MELEN]; /* enable plane */ - u_char cpixel[CG4_HEIGHT][CG4_WIDTH]; /* byte-per-pixel memory */ -} *CG4Ptr; - -static void CG4Switch (pScreen, select) - ScreenPtr pScreen; - int select; -{ - CG4Ptr fb = (CG4Ptr) sunFbs[pScreen->myNum].fb; - - (void) memset ((char *)fb->epixel, select ? ~0 : 0, CG4_MELEN); -} - -Bool sunCG4Init (screen, pScreen, argc, argv) - int screen; /* what screen am I going to be */ - ScreenPtr pScreen; /* The Screen to initialize */ - int argc; /* The number of the Server's arguments. */ - char** argv; /* The arguments themselves. Don't change! */ -{ - checkMono (argc, argv); - if (sunCG4Frob) - sunFbs[screen].EnterLeave = (void (*)())NoopDDA; - else - sunFbs[screen].EnterLeave = CG4Switch; - return sunInitCommon (screen, pScreen, (off_t) 0, - sunCfbScreenInit, CGScreenInit, - cfbCreateDefColormap, sunSaveScreen, (int) ((CG4Ptr) 0)->cpixel); -} - -#ifdef FBTYPE_SUNFAST_COLOR /* { */ - -#define CG6_MMAP_OFFSET 0x70000000 -#define CG6_IMAGE_OFFSET 0x16000 - -Bool sunCG6Init (screen, pScreen, argc, argv) - int screen; /* The index of pScreen in the ScreenInfo */ - ScreenPtr pScreen; /* The Screen to initialize */ - int argc; /* The number of the Server's arguments. */ - char** argv; /* The arguments themselves. Don't change! */ -{ - pointer fb; - - checkMono (argc, argv); - if (!sunScreenAllocate (pScreen)) - return FALSE; -#ifndef AMOEBA - if (!sunFbs[screen].fb) { -/* Sun's VME, Sbus, and SVR4 drivers all return different values */ -#define FBSIZE (size_t) sunFbs[screen].info.fb_width * \ - sunFbs[screen].info.fb_height + CG6_IMAGE_OFFSET - if ((fb = sunMemoryMap (FBSIZE, - (off_t) CG6_MMAP_OFFSET, - sunFbs[screen].fd)) == NULL) - return FALSE; - sunFbs[screen].fb = fb; -#undef FBSIZE - } -#endif - sunFbs[screen].EnterLeave = (void (*)())NoopDDA; - if (!sunCfbSetupScreen (pScreen, - sunFbs[screen].fb + CG6_IMAGE_OFFSET, - sunFbs[screen].info.fb_width, - sunFbs[screen].info.fb_height, - monitorResolution, monitorResolution, - sunFbs[screen].info.fb_width, - sunFbs[screen].info.fb_depth)) - return FALSE; -#ifndef AMOEBA - if (!sunGXInit (pScreen, &sunFbs[screen])) - return FALSE; -#endif - if (!sunCfbFinishScreenInit(pScreen, - sunFbs[screen].fb + CG6_IMAGE_OFFSET, - sunFbs[screen].info.fb_width, - sunFbs[screen].info.fb_height, - monitorResolution, monitorResolution, - sunFbs[screen].info.fb_width, - sunFbs[screen].info.fb_depth)) - return FALSE; - miInitializeBackingStore(pScreen); - CGScreenInit (pScreen); - if (!sunScreenInit (pScreen)) - return FALSE; - sunSaveScreen (pScreen, SCREEN_SAVER_OFF); - return cfbCreateDefColormap(pScreen); -} -#endif /* } */ -#endif /* } */ diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunCursor.c b/xc/programs/Xserver/hw/sunAmoeba/sunCursor.c deleted file mode 100644 index 37cd223fb..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunCursor.c +++ /dev/null @@ -1,250 +0,0 @@ -/* $XConsortium: sunCursor.c,v 5.17 94/04/01 17:55:24 dpw Exp $ */ -/*- - * sunCursor.c -- - * Functions for maintaining the Sun software cursor... - * - */ - -#define NEED_EVENTS -#include "sun.h" - -#ifdef AMOEBA -#undef FBIOGCURMAX /* software cursor only, currently */ -#endif - -#ifdef FBIOGCURMAX /* has hardware cursor kernel support */ - -#define GetCursorPrivate(s) (&(GetScreenPrivate(s)->hardwareCursor)) -#define SetupCursor(s) sunCursorPtr pCurPriv = GetCursorPrivate(s) - -static void sunLoadCursor(); - -static Bool -sunRealizeCursor (pScreen, pCursor) - ScreenPtr pScreen; - CursorPtr pCursor; -{ - SetupCursor(pScreen); - int x, y; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - miPointerPosition (&x, &y); - sunLoadCursor (pScreen, pCursor, x, y); - } - return TRUE; -} - -static Bool -sunUnrealizeCursor (pScreen, pCursor) - ScreenPtr pScreen; - CursorPtr pCursor; -{ - return TRUE; -} - -static void -sunCursorRepad (pScreen, bits, src_bits, dst_bits, ptSrc, w, h) - ScreenPtr pScreen; - CursorBitsPtr bits; - unsigned char *src_bits, *dst_bits; - DDXPointPtr ptSrc; - int w, h; -{ - SetupCursor(pScreen); - PixmapPtr src, dst; - BoxRec box; - RegionRec rgnDst; - extern int mfbDoBitblt(); - - if (!(src = GetScratchPixmapHeader(pScreen, bits->width, bits->height, - /*bpp*/ 1, /*depth*/ 1, - PixmapBytePad(bits->width,1), src_bits))) - return; - if (!(dst = GetScratchPixmapHeader(pScreen, w, h, /*bpp*/ 1, /*depth*/ 1, - PixmapBytePad(w,1), dst_bits))) - { - FreeScratchPixmapHeader(src); - return; - } - box.x1 = 0; - box.y1 = 0; - box.x2 = w; - box.y2 = h; - REGION_INIT(pScreen, &rgnDst, &box, 1); - mfbDoBitblt(src, dst, GXcopy, &rgnDst, ptSrc); - REGION_UNINIT(pScreen, &rgnDst); - FreeScratchPixmapHeader(src); - FreeScratchPixmapHeader(dst); -} - -static void -sunLoadCursor (pScreen, pCursor, x, y) - ScreenPtr pScreen; - CursorPtr pCursor; - int x, y; -{ - SetupCursor(pScreen); - struct fbcursor fbcursor; - int w, h; - unsigned char r[2], g[2], b[2]; - DDXPointRec ptSrc; - unsigned char source_temp[1024], mask_temp[1024]; - - fbcursor.set = FB_CUR_SETALL; - fbcursor.enable = 1; - fbcursor.pos.x = x; - fbcursor.pos.y = y; - fbcursor.hot.x = pCursor->bits->xhot; - fbcursor.hot.y = pCursor->bits->yhot; - r[0] = pCursor->backRed >> 8; - g[0] = pCursor->backGreen >> 8; - b[0] = pCursor->backBlue >> 8; - r[1] = pCursor->foreRed >> 8; - g[1] = pCursor->foreGreen >> 8; - b[1] = pCursor->foreBlue >> 8; - fbcursor.cmap.index = 0; - fbcursor.cmap.count = 2; - fbcursor.cmap.red = r; - fbcursor.cmap.green = g; - fbcursor.cmap.blue = b; - fbcursor.image = (char *) pCursor->bits->source; - fbcursor.mask = (char *) pCursor->bits->mask; - w = pCursor->bits->width; - h = pCursor->bits->height; - if (w > pCurPriv->width || h > pCurPriv->height) { - ptSrc.x = 0; - ptSrc.y = 0; - if (w > pCurPriv->width) - w = pCurPriv->width; - if (h > pCurPriv->height) - h = pCurPriv->height; - sunCursorRepad (pScreen, pCursor->bits, pCursor->bits->source, - source_temp, &ptSrc, w, h); - sunCursorRepad (pScreen, pCursor->bits, pCursor->bits->mask, - mask_temp, &ptSrc, w, h); - fbcursor.image = (char *) source_temp; - fbcursor.mask = (char *) mask_temp; - } - fbcursor.size.x = w; - fbcursor.size.y = h; - (void) ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURSOR, &fbcursor); -} - -static void -sunSetCursor (pScreen, pCursor, x, y) - ScreenPtr pScreen; - CursorPtr pCursor; - int x, y; -{ - SetupCursor(pScreen); - - if (pCursor) - sunLoadCursor (pScreen, pCursor, x, y); - else - sunDisableCursor (pScreen); - pCurPriv->pCursor = pCursor; -} - -static void -sunMoveCursor (pScreen, x, y) - ScreenPtr pScreen; - int x, y; -{ - SetupCursor(pScreen); - struct fbcurpos pos; - - pos.x = x; - pos.y = y; - ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURPOS, &pos); -} - -miPointerSpriteFuncRec sunPointerSpriteFuncs = { - sunRealizeCursor, - sunUnrealizeCursor, - sunSetCursor, - sunMoveCursor, -}; - -static void -sunQueryBestSize (class, pwidth, pheight, pScreen) - int class; - unsigned short *pwidth, *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: - mfbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -extern miPointerScreenFuncRec sunPointerScreenFuncs; - -#endif - -#if NeedFunctionPrototypes -Bool sunCursorInitialize ( - ScreenPtr pScreen) -#else -Bool sunCursorInitialize (pScreen) - ScreenPtr pScreen; -#endif -{ -#ifdef FBIOGCURMAX - SetupCursor (pScreen); - struct fbcurpos maxsize; - - pCurPriv->has_cursor = FALSE; - if (ioctl (sunFbs[pScreen->myNum].fd, FBIOGCURMAX, &maxsize) == -1) - return FALSE; - pCurPriv->width = maxsize.x; - pCurPriv->height= maxsize.y; - pScreen->QueryBestSize = sunQueryBestSize; - miPointerInitialize (pScreen, - &sunPointerSpriteFuncs, - &sunPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -#else - return FALSE; -#endif -} - -#if NeedFunctionPrototypes -void sunDisableCursor ( - ScreenPtr pScreen) -#else -void sunDisableCursor (pScreen) - ScreenPtr pScreen; -#endif -{ -#ifdef FBIOGCURMAX - SetupCursor (pScreen); - struct fbcursor fbcursor; - - if (pCurPriv->has_cursor) - { - fbcursor.set = FB_CUR_SETCUR; - fbcursor.enable = 0; - (void) ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURSOR, &fbcursor); - pCurPriv->pCursor = NULL; - } -#endif -} diff --git a/xc/programs/Xserver/hw/sunAmoeba/sunFbs.c b/xc/programs/Xserver/hw/sunAmoeba/sunFbs.c deleted file mode 100644 index 29bbd63b9..000000000 --- a/xc/programs/Xserver/hw/sunAmoeba/sunFbs.c +++ /dev/null @@ -1,304 +0,0 @@ - -/* $TOG: sunFbs.c /main/3 1998/02/10 13:18:13 kaleb $ */ - -/* -Copyright 1990, 1993, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - */ - -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE 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. - -********************************************************/ - -/* - * Copyright 1987 by the Regents of the University of California - * Copyright 1987 by Adam de Boor, UC Berkeley - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -/* $XFree86: xc/programs/Xserver/hw/sunAmoeba/sunFbs.c,v 1.3 1998/10/04 09:38:42 dawes Exp $ */ - -/****************************************************************/ -/* Modified from sunCG4C.c for X11R3 by Tom Jarmolowski */ -/****************************************************************/ - -#include "sun.h" -#include <sys/mman.h> - -int sunScreenIndex; - -static unsigned long generation = 0; - -#ifndef AMOEBA - -#if NeedFunctionPrototypes -pointer sunMemoryMap ( - size_t len, - off_t off, - int fd) -#else -pointer sunMemoryMap (len, off, fd) - size_t len; - off_t off; - int fd; -#endif -{ - int pagemask, mapsize; - caddr_t addr; - pointer mapaddr; - -#ifdef SVR4 - pagemask = sysconf(_SC_PAGESIZE) - 1; -#else - pagemask = getpagesize() - 1; -#endif - mapsize = ((int) len + pagemask) & ~pagemask; - addr = 0; - -#ifndef _MAP_NEW - if ((addr = (caddr_t) valloc (mapsize)) == NULL) { - Error ("Couldn't allocate frame buffer memory"); - (void) close (fd); - return NULL; - } -#endif - - /* - * try and make it private first, that way once we get it, an - * interloper, e.g. another server, can't get this frame buffer, - * and if another server already has it, this one won't. - */ - if ((int)(mapaddr = (pointer) mmap (addr, - mapsize, - PROT_READ | PROT_WRITE, MAP_PRIVATE, - fd, off)) == -1) - mapaddr = (pointer) mmap (addr, - mapsize, - PROT_READ | PROT_WRITE, MAP_SHARED, - fd, off); - if (mapaddr == (pointer) -1) { - Error ("mapping frame buffer memory"); - (void) close (fd); - mapaddr = (pointer) NULL; - } - return mapaddr; -} - -#endif /* AMOEBA */ - -#if NeedFunctionPrototypes -Bool sunScreenAllocate ( - ScreenPtr pScreen) -#else -Bool sunScreenAllocate (pScreen) - ScreenPtr pScreen; -#endif -{ - sunScreenPtr pPrivate; - extern int AllocateScreenPrivateIndex(); - - if (generation != serverGeneration) - { - sunScreenIndex = AllocateScreenPrivateIndex(); - if (sunScreenIndex < 0) - return FALSE; - generation = serverGeneration; - } - pPrivate = (sunScreenPtr) xalloc (sizeof (sunScreenRec)); - if (!pPrivate) - return FALSE; - - pScreen->devPrivates[sunScreenIndex].ptr = (pointer) pPrivate; - return TRUE; -} - -#if NeedFunctionPrototypes -Bool sunSaveScreen ( - ScreenPtr pScreen, - int on) -#else -Bool sunSaveScreen (pScreen, on) - ScreenPtr pScreen; - int on; -#endif -{ -#ifndef AMOEBA - int state; - - if (on != SCREEN_SAVER_FORCER) - { - if (on == SCREEN_SAVER_ON) - state = 0; - else - state = 1; - (void) ioctl(sunFbs[pScreen->myNum].fd, FBIOSVIDEO, &state); - } - return( TRUE ); -#else - if (on != SCREEN_SAVER_ON) { - SetTimeSinceLastInputEvent(); - return TRUE; - } else { - /* Return false to force screen saving in software */ - return FALSE; - } -#endif -} - -static Bool closeScreen (i, pScreen) - int i; - ScreenPtr pScreen; -{ - SetupScreen(pScreen); - Bool ret; - -#ifndef AMOEBA - (void) OsSignal (SIGIO, SIG_IGN); -#endif - sunDisableCursor (pScreen); - pScreen->CloseScreen = pPrivate->CloseScreen; - ret = (*pScreen->CloseScreen) (i, pScreen); - (void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF); - xfree ((pointer) pPrivate); - return ret; -} - -#if NeedFunctionPrototypes -Bool sunScreenInit ( - ScreenPtr pScreen) -#else -Bool sunScreenInit (pScreen) - ScreenPtr pScreen; -#endif -{ - SetupScreen(pScreen); -#ifndef XKB - extern void sunBlockHandler(); - extern void sunWakeupHandler(); - static ScreenPtr autoRepeatScreen; -#endif - extern miPointerScreenFuncRec sunPointerScreenFuncs; - - pPrivate->installedMap = 0; - pPrivate->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = closeScreen; - pScreen->SaveScreen = sunSaveScreen; -#ifndef XKB - /* - * Block/Unblock handlers - */ - if (sunAutoRepeatHandlersInstalled == FALSE) { - autoRepeatScreen = pScreen; - sunAutoRepeatHandlersInstalled = TRUE; - } - - if (pScreen == autoRepeatScreen) { - pScreen->BlockHandler = sunBlockHandler; - pScreen->WakeupHandler = sunWakeupHandler; - } -#endif - if (!sunCursorInitialize (pScreen)) - miDCInitialize (pScreen, &sunPointerScreenFuncs); - return TRUE; -} - -#if NeedFunctionPrototypes -Bool sunInitCommon ( - int scrn, - ScreenPtr pScrn, - off_t offset, - Bool (*init1)(), - void (*init2)(), - Bool (*cr_cm)(), - Bool (*save)(), - int fb_off) -#else -Bool sunInitCommon (scrn, pScrn, offset, init1, init2, cr_cm, save, fb_off) - int scrn; - ScreenPtr pScrn; - off_t offset; - Bool (*init1)(); - void (*init2)(); - Bool (*cr_cm)(); - Bool (*save)(); - int fb_off; -#endif -{ - unsigned char* fb = sunFbs[scrn].fb; - - if (!sunScreenAllocate (pScrn)) - return FALSE; -#ifndef AMOEBA - if (!fb) { - if ((fb = sunMemoryMap ((size_t) sunFbs[scrn].info.fb_size, - offset, - sunFbs[scrn].fd)) == NULL) - return FALSE; - sunFbs[scrn].fb = fb; - } -#endif - /* mfbScreenInit() or cfbScreenInit() */ - if (!(*init1)(pScrn, fb + fb_off, - sunFbs[scrn].info.fb_width, - sunFbs[scrn].info.fb_height, - monitorResolution, monitorResolution, - sunFbs[scrn].info.fb_width, - sunFbs[scrn].info.fb_depth)) - return FALSE; - miInitializeBackingStore(pScrn); - /* sunCGScreenInit() if cfb... */ - if (init2) - (*init2)(pScrn); - if (!sunScreenInit(pScrn)) - return FALSE; - (void) (*save) (pScrn, SCREEN_SAVER_OFF); - return (*cr_cm)(pScrn); -} - diff --git a/xc/programs/Xserver/hw/xfree86/Imakefile b/xc/programs/Xserver/hw/xfree86/Imakefile index 8d9b504ec..28826fc14 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.76 2001/05/15 18:22:20 paulo Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.77 2001/07/23 13:15:46 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -149,19 +149,6 @@ DPI100USFONTPATH=\"$(LIBDIR)/fonts/100dpi/:unscaled\" LINUXMOUSEDEV="XCOMM Option \"Device\" \"/dev/mouse\"" #endif -#ifdef MinixArchitecture -CppFileTarget($(XF86CONFIG), XF86Conf.cpp, - -DRGBPATH=$(RGBPATH) -DMISCFONTPATH=$(MISCFONTPATH) - -DLOCALFONTPATH=$(LOCALFONTPATH) - -DT1FONTPATH=$(T1FONTPATH) -DCIDFONTPATH=$(CIDFONTPATH) - -DSPFONTPATH=$(SPFONTPATH) - -DDPI75FONTPATH=$(DPI75FONTPATH) -DDPI100FONTPATH=$(DPI100FONTPATH) - -DDPI75USFONTPATH=$(DPI75USFONTPATH) -DDPI100USFONTPATH=$(DPI100USFONTPATH) - -DMANPAGE=$(MANPAGE) -DMODULEPATH=\"$(MODULEDIR)\", - $(ICONFIGFILES)) - -InstallDriverSDKNonExecFile($(XF86CONFIG),$(DRIVERSDKDIR)) -#else CppFileTarget($(XF86CONFIG), XF86Conf.cpp, \ -DRGBPATH=$(RGBPATH) -DMISCFONTPATH=$(MISCFONTPATH) \ -DLOCALFONTPATH=$(LOCALFONTPATH) \ @@ -192,7 +179,6 @@ CppFileTarget($(XF98CONFIG), XF98Conf.cpp, \ $(ICONFIGFILES)) InstallDriverSDKNonExecFile($(XF86CONFIG),$(DRIVERSDKDIR)) InstallDriverSDKNonExecFile($(XF98CONFIG),$(DRIVERSDKDIR)) -#endif EXTRAMANDEFS=-D__logdir__=$(LOGDIRECTORY) InstallManPage(XFree86,$(MANDIR)) diff --git a/xc/programs/Xserver/hw/xfree86/XFree86.man b/xc/programs/Xserver/hw/xfree86/XFree86.man index 2a2ea232c..7cfed8cea 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.52 2001/04/05 19:29:41 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.53 2001/08/06 18:31:01 dawes Exp $ .TH XFree86 1 __vendorversion__ .SH NAME XFree86 - X11R6 X server @@ -202,14 +202,13 @@ 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 +as the core keyboard. This option is ignored when the .B Layout -section are used, or the first relevant +section specifies a core keyboard. +In the absence of both a Layout section and this option, +the first relevant .B InputDevice -section when there are no -.B Layout -sections. +section is used for the core keyboard. .TP 8 .B \-layout \fIlayout-name\fP Use the XF86Config(__filemansuffix__) file @@ -273,14 +272,13 @@ 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 +as the core pointer. This option is ignored when the .B Layout -section are used, or the first relevant +section specifies a core pointer. +In the absence of both a Layout section and this option, +the first relevant .B InputDevice -section when there are no -.B Layout -sections. +section is used for the core pointer. .TP 8 .B \-probeonly Causes the server to exit after the device probing stage. The XF86Config diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h index f35d33cf5..b84432d5e 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.81 2001/04/23 16:17:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.85 2001/08/06 20:51:09 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -31,28 +31,6 @@ #define _COMPILER_H -#ifndef __STDC__ -# ifdef signed -# undef signed -# endif -# ifdef volatile -# undef volatile -# endif -# ifdef const -# undef const -# endif -# define signed /**/ -# ifdef __GNUC__ -# define volatile __volatile__ -# define const __const__ -# else -# define const /**/ -# ifdef __HIGHC__ -# define __inline__ _Inline -# endif -# endif /* __GNUC__ */ -#endif /* !__STDC__ */ - #if defined(IODEBUG) && defined(__GNUC__) #define outb RealOutb #define outw RealOutw @@ -1123,7 +1101,7 @@ inl(unsigned short port) #define mem_barrier() /* NOP */ #define write_mem_barrier() /* NOP */ -#if !defined(FAKEIT) && !defined(__mc68000__) +#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__sh__) #ifdef GCCUSESGAS /* @@ -1232,7 +1210,7 @@ inl(unsigned short port) #endif /* GCCUSESGAS */ -#else /* !defined(FAKEIT) && !defined(__mc68000__) */ +#else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__sh__) */ static __inline__ void outb(unsigned short port, unsigned char val) @@ -1352,7 +1330,7 @@ extern void outl(unsigned int a, unsigned int l); #endif /* !PPCIO_DEBUG */ #else /* !GNUC && !PPC */ -#if !defined(AMOEBA) && !defined(MINIX) && !defined(QNX4) +#if !defined(QNX4) # if defined(__STDC__) && (__STDC__ == 1) # ifndef asm # define asm __asm @@ -1596,6 +1574,8 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); (*xf86WriteMmioNB8)((CARD8)(val), base, offset) #define MMIO_ONB16(base, offset, val) \ (*xf86WriteMmioNB16)((CARD16)(val), base, offset) +#define MMIO_MOVE32(base, offset, val) \ + MMIO_OUT32(base, offset, val) #elif defined(__powerpc__) /* @@ -1633,6 +1613,9 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); xf86WriteMmioNB32Le(base, offset, (CARD32)(val)) # endif +#define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) + static __inline__ void ppc_flush_icache(char *addr) { __asm__ volatile ( @@ -1682,6 +1665,9 @@ static __inline__ void ppc_flush_icache(char *addr) xf86WriteMmio32LeNB(base, offset, (CARD32)(val)) # endif +#define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) + #else /* !__alpha__ && !__powerpc__ && !__sparc__ */ #define MMIO_IN8(base, offset) \ @@ -1700,6 +1686,8 @@ static __inline__ void ppc_flush_icache(char *addr) #define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val) #define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val) +#define MMIO_MOVE32(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 484433741..c1ac384c0 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.152 2001/05/16 20:08:35 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.154 2001/06/13 23:10:39 dawes Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -179,6 +179,7 @@ Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags); Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num); +xf86SetDGAModeProc xf86SetDGAMode; /* xf86Events.c */ @@ -263,6 +264,8 @@ void xf86UnloadSubModule(pointer mod); Bool xf86LoaderCheckSymbol(const char *name); void xf86LoaderReqSymLists(const char **, ...); void xf86LoaderReqSymbols(const char *, ...); +void xf86LoaderRefSymLists(const char **, ...); +void xf86LoaderRefSymbols(const char *, ...); void xf86SetBackingStore(ScreenPtr pScreen); void xf86SetSilkenMouse(ScreenPtr pScreen); int xf86NewSerialNumber(WindowPtr p, pointer unused); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c index 8a488eac8..e0bd73c6c 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.242 2001/05/16 20:08:35 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.247 2001/08/19 02:47:50 tsi Exp $ */ /* @@ -699,7 +699,9 @@ typedef enum { FLAG_PC98, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, FLAG_NOPM, - FLAG_XINERAMA + FLAG_XINERAMA, + FLAG_ALLOW_DEACTIVATE_GRABS, + FLAG_ALLOW_CLOSEDOWN_GRABS } FlagValues; static OptionInfoRec FlagOptions[] = { @@ -751,8 +753,12 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_ALLOW_DEACTIVATE_GRABS,"AllowDeactivateGrabs", OPTV_BOOLEAN, + {0}, FALSE }, + { FLAG_ALLOW_CLOSEDOWN_GRABS, "AllowClosedownGrabs", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, - {0}, FALSE } + {0}, FALSE }, }; static Bool @@ -802,6 +808,11 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap); xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom); + xf86GetOptValBool(FlagOptions, FLAG_ALLOW_DEACTIVATE_GRABS, + &(xf86Info.grabInfo.allowDeactivate)); + xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS, + &(xf86Info.grabInfo.allowClosedown)); + /* * Set things up based on the config file information. Some of these * settings may be overridden later when the command line options are @@ -986,7 +997,7 @@ configInputKbd(IDevPtr inputp) s = xf86SetStrOption(inputp->commonOptions, "Protocol", "standard"); if (xf86NameCmp(s, "standard") == 0) { xf86Info.kbdProc = xf86KbdProc; -#if defined(AMOEBA) || defined(__CYGWIN__) +#if defined(__CYGWIN__) xf86Info.kbdEvents = NULL; #else xf86Info.kbdEvents = xf86KbdEvents; @@ -1008,6 +1019,11 @@ configInputKbd(IDevPtr inputp) xfree(s); s = xf86SetStrOption(inputp->commonOptions, "Device", NULL); xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n"); + if (s == NULL) { + xf86ConfigError("A \"device\" option is required with" + " the \"wskbd\" keyboard protocol"); + return FALSE; + } xf86Info.kbdFd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL); if (xf86Info.kbdFd == -1) { xf86ConfigError("cannot open \"%s\"", s); @@ -1063,7 +1079,7 @@ configInputKbd(IDevPtr inputp) if (noXkbExtension) xf86Msg(from, "XKB: disabled\n"); -#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), NULL)) +#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), (char *)NULL)) if (!noXkbExtension && !XkbInitialMap) { if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) { diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c index 3ce0592ff..52168a7ee 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.55 2001/05/07 21:38:51 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.62 2001/08/18 12:31:54 dawes Exp $ */ /* * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. * @@ -26,6 +26,10 @@ #include <ctype.h> #include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> #include "X.h" #include "Xmd.h" #include "os.h" @@ -36,6 +40,7 @@ #include "xf86Config.h" #include "xf86Priv.h" #include "xf86PciInfo.h" +#define IN_XSERVER #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" @@ -64,8 +69,12 @@ Bool xf86DoConfigurePass1 = TRUE; Bool foundMouse = FALSE; #ifndef __EMX__ +#if defined(SCO) +static char *DFLT_MOUSE_PROTO = "OSMouse"; +#else static char *DFLT_MOUSE_DEV = "/dev/mouse"; static char *DFLT_MOUSE_PROTO = "auto"; +#endif #else #define DFLT_MOUSE_DEV "mouse$" #define DFLT_MOUSE_PROTO "OS2Mouse" @@ -297,11 +306,15 @@ configureInputSection (void) } #endif +#ifndef SCO fd = open(DFLT_MOUSE_DEV, 0); if (fd != -1) { foundMouse = TRUE; close(fd); } +#else + foundMouse = TRUE; +#endif } mouse = xf86confmalloc(sizeof(XF86ConfInputRec)); @@ -310,8 +323,10 @@ configureInputSection (void) mouse->inp_driver = "mouse"; mouse->inp_option_lst = xf86addNewOption(mouse->inp_option_lst, "Protocol", DFLT_MOUSE_PROTO); +#ifndef SCO mouse->inp_option_lst = xf86addNewOption(mouse->inp_option_lst, "Device", DFLT_MOUSE_DEV); +#endif ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse); return ptr; } @@ -319,9 +334,13 @@ configureInputSection (void) static XF86ConfDRIPtr configureDRISection (void) { +#ifdef NOTYET parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec) return ptr; +#else + return NULL; +#endif } static XF86ConfVendorPtr @@ -366,7 +385,7 @@ configureScreenSection (int screennum) return ptr; } -static char* +static const char* optionTypeToSting(OptionValueType type) { switch (type) { @@ -395,7 +414,9 @@ configureDeviceSection (int screennum) char identifier[16]; OptionInfoPtr p; int i = 0; +#ifdef DO_FBDEV_PROBE Bool foundFBDEV = FALSE; +#endif parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec) /* Move device info to parser structure */ @@ -426,29 +447,48 @@ configureDeviceSection (int screennum) /* Make sure older drivers don't segv */ if (DevToConfig[screennum].GDev.options) { /* Fill in the available driver options for people to use */ - ptr->dev_comment = xnfalloc(240 + 1); - strcpy(ptr->dev_comment, "Available Driver options are:-\n"); - strcat(ptr->dev_comment, " ### Values: <i>: integer, <f>: " - "float, <bool>: \"True\"/\"False\",\n" - " ### <string>: \"String\", " - "<freq>: \"<f> Hz/kHz/MHz\"\n"); - strcat(ptr->dev_comment, " ### [arg]: arg optional\n"); - for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) { - char *optname = xnfalloc(strlen(p->name) + 6); - char *p_e; - ptr->dev_comment = xrealloc(ptr->dev_comment, - strlen(ptr->dev_comment) + 80 + 1); - p_e = ptr->dev_comment + strlen(ptr->dev_comment); - sprintf(optname,"\"%s\"",p->name); - sprintf(p_e, " #Option %-20s \t# %s\n", - optname, optionTypeToSting(p->type)); - xfree(optname); + const char *descrip = + " ### Available Driver options are:-\n" + " ### Values: <i>: integer, <f>: float, " + "<bool>: \"True\"/\"False\",\n" + " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\"\n" + " ### [arg]: arg optional\n"; + ptr->dev_comment = xstrdup(descrip); + if (ptr->dev_comment) { + for (p = DevToConfig[screennum].GDev.options; + p->name != NULL; p++) { + char *p_e; + const char *prefix = " #Option "; + const char *middle = " \t# "; + const char *suffix = "\n"; + const char *opttype = optionTypeToSting(p->type); + char *optname; + int len = strlen(ptr->dev_comment) + strlen(prefix) + + strlen(middle) + strlen(suffix) + 1; + + optname = xalloc(strlen(p->name) + 2 + 1); + if (!optname) + break; + sprintf(optname, "\"%s\"", p->name); + + len += max(20, strlen(optname)); + len += strlen(opttype); + + ptr->dev_comment = xrealloc(ptr->dev_comment, len); + if (!ptr->dev_comment) + break; + p_e = ptr->dev_comment + strlen(ptr->dev_comment); + sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle, + opttype, suffix); + xfree(optname); + } } } +#ifdef DO_FBDEV_PROBE /* Crude mechanism to auto-detect fbdev (os dependent) */ /* Skip it for now. Options list it anyway, and we can't - * determine which screen/driver this belongs too anyway. + * determine which screen/driver this belongs too anyway. */ { int fd; @@ -469,7 +509,7 @@ configureDeviceSection (int screennum) ptr->dev_option_lst = (XF86OptionPtr)xf86addListItem( (glp)ptr->dev_option_lst, (glp)fbdev); } - */ +#endif return ptr; } @@ -477,8 +517,6 @@ configureDeviceSection (int screennum) static XF86ConfLayoutPtr configureLayoutSection (void) { - pciVideoPtr xf86PciCard; - int i = 0; int scrnum = 0; parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec) @@ -540,9 +578,13 @@ configureLayoutSection (void) static XF86ConfModesPtr configureModesSection (void) { +#ifdef NOTYET parsePrologue (XF86ConfModesPtr, XF86ConfModesRec) return ptr; +#else + return NULL; +#endif } static XF86ConfVideoAdaptorPtr @@ -574,6 +616,10 @@ configureModuleSection (void) "extensions", NULL }; + const char *fsubdirs[] = { + "fonts", + NULL + }; #endif parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec) @@ -593,6 +639,28 @@ configureModuleSection (void) } xfree(elist); } + + /* Process list of font backends separately to include only required ones */ + elist = LoaderListDirs(fsubdirs, NULL); + if (elist) { + for (el = elist; *el; el++) { + XF86LoadPtr module; + + module = xf86confmalloc(sizeof(XF86LoadRec)); + memset((XF86LoadPtr)module,0,sizeof(XF86LoadRec)); + module->load_name = *el; + + /* Add only those font backends which are referenced by fontpath */ + /* 'strstr(dFP,"/dir")' is meant as 'dFP =~ m(/dir\W)' */ + if (defaultFontPath && ( + strcmp(*el, "type1") == 0 && strstr(defaultFontPath, "/Type1") || + strcmp(*el, "speedo") == 0 && strstr(defaultFontPath, "/Speedo") + )) + ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem( + (glp)ptr->mod_load_lst, (glp)module); + } + xfree(elist); + } #endif return ptr; @@ -749,9 +817,9 @@ DoConfigure() xf86config->conf_modules = configureModuleSection(); xf86config->conf_flags = configureFlagsSection(); xf86config->conf_videoadaptor_lst = configureVideoAdaptorSection(); -/* xf86config->conf_modes_lst = configureModesSection(); */ + xf86config->conf_modes_lst = configureModesSection(); xf86config->conf_vendor_lst = configureVendorSection(); -/* xf86config->conf_dri = configureDRISection(); */ + xf86config->conf_dri = configureDRISection(); xf86config->conf_input_lst = configureInputSection(); xf86config->conf_layout_lst = configureLayoutSection(); @@ -761,6 +829,9 @@ DoConfigure() #ifdef __EMX__ #define PATH_MAX 2048 #endif +#if defined(SCO) || defined(SCO325) +#define PATH_MAX 1024 +#endif const char* configfile = XF86CONFIGFILE".new"; char homebuf[PATH_MAX]; /* getenv might return R/O memory, as with OS/2 */ @@ -877,17 +948,23 @@ DoConfigure() ErrorF("\n"); +#ifdef SCO + ErrorF("\nXFree86 is using the kernel event driver to access the mouse.\n" + "If you wish to use the internal XFree86 mouse drivers, please\n" + "edit the file and correct the Device.\n"); +#else /* !SCO */ if (!foundMouse) { ErrorF("\nXFree86 is not able to detect your mouse.\n" "Edit the file and correct the Device.\n"); } else { -#ifndef __EMX__ /* OS/2 definitely has a mouse */ +#ifndef __EMX__ /* OS/2 definitely has a mouse */ ErrorF("\nXFree86 detected your mouse at device %s.\n" "Please check your config if the mouse is still not\n" "operational, as by default XFree86 tries to autodetect\n" "the protocol.\n",DFLT_MOUSE_DEV); #endif } +#endif /* !SCO */ if (xf86NumScreens > 1) { ErrorF("\nXFree86 has configured a multihead system, please check your config.\n"); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c index 948dcda91..4a7e2ba8e 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.109 2001/05/18 16:03:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.116 2001/08/17 22:08:12 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -31,12 +31,12 @@ #include "compiler.h" +#include "Xpoll.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSlib.h" #include "atKeynames.h" -#include "Xpoll.h" #ifdef XFreeXDGA @@ -53,6 +53,11 @@ #include "mipointer.h" +#ifdef XF86BIGFONT +#define _XF86BIGFONT_SERVER_ +#include "xf86bigfont.h" +#endif + #ifdef XKB extern Bool noXkbExtension; #endif @@ -146,7 +151,7 @@ static IHPtr InputHandlers = NULL; /* * TimeSinceLastInputEvent -- - * Function used for screensaver purposes by the os module. Retruns the + * Function used for screensaver purposes by the os module. Returns the * time in milliseconds since there last was any input. */ @@ -189,20 +194,6 @@ ProcessInputEvents () static int generation = 0; #endif -#ifdef AMOEBA -#define MAXEVENTS 32 -#define BUTTON_PRESS 0x1000 -#define MAP_BUTTON(ev,but) (((ev) == EV_ButtonPress) ? \ - ((but) | BUTTON_PRESS) : ((but) & ~BUTTON_PRESS)) -#define KEY_RELEASE 0x80 -#define MAP_KEY(ev, key) (((ev) == EV_KeyReleaseEvent) ? \ - ((key) | KEY_RELEASE) : ((key) & ~KEY_RELEASE)) - - register IOPEvent *e, *elast; - IOPEvent events[MAXEVENTS]; - int dx, dy, nevents; -#endif - /* * With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock * and ScrollLock will be set to match that of the VT the server is @@ -239,37 +230,6 @@ ProcessInputEvents () } #endif -#ifdef AMOEBA - /* - * Get all events from the IOP server - */ - while ((nevents = AmoebaGetEvents(events, MAXEVENTS)) > 0) { - for (e = &events[0], elast = &events[nevents]; e < elast; e++) { - xf86Info.lastEventTime = e->time; - switch (e->type) { - case EV_PointerDelta: - if (e->x != 0 || e->y != 0) { - xf86PostMseEvent(&xf86Info.pMouse, 0, e->x, e->y); - } - break; - case EV_ButtonPress: - case EV_ButtonRelease: - xf86PostMseEvent(&xf86Info.pMouse, MAP_BUTTON(e->type, e->keyorbut), 0, 0); - break; - case EV_KeyPressEvent: - case EV_KeyReleaseEvent: - xf86PostKbdEvent(MAP_KEY(e->type, e->keyorbut)); - break; - default: - /* this shouldn't happen */ - ErrorF("stray event %d (%d,%d) %x\n", - e->type, e->x, e->y, e->keyorbut); - break; - } - } - } -#endif - xf86Info.inputPending = FALSE; #ifdef XINPUT @@ -283,7 +243,14 @@ ProcessInputEvents () xf86SetViewport(xf86Info.currentScreen, x, y); } +void +xf86GrabServerCallback(CallbackListPtr *callbacks, pointer data, pointer args) +{ + ServerGrabInfoRec *grab = (ServerGrabInfoRec*)args; + xf86Info.grabInfo.server.client = grab->client; + xf86Info.grabInfo.server.grabstate = grab->grabstate; +} /* * xf86PostKbdEvent -- @@ -434,7 +401,7 @@ xf86PostKbdEvent(unsigned key) case 0x36: return; default: - xf86MsgVerb(X_INFO, 2, "Unreported Prefix0 scancode: 0x%02x\n", + xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n", scanCode); /* * "Internet" keyboards are generating lots of new codes. Let them @@ -464,12 +431,17 @@ xf86PostKbdEvent(unsigned key) specialkey = scanCode; +#ifdef __linux__ customkeycodes: +#endif if (xf86IsPc98()) { switch (scanCode) { case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */ case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */ + + /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ + case 0x62: specialkey = 0x3b; break; /* KEY_F1 */ case 0x63: specialkey = 0x3c; break; /* KEY_F2 */ case 0x64: specialkey = 0x3d; break; /* KEY_F3 */ @@ -493,6 +465,9 @@ special: case 0x2b: specialkey = KEY_BackSpace; break; case 0x47: specialkey = KEY_KP_Minus; break; case 0x7d: specialkey = KEY_KP_Plus; break; + + /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ + case 0x05: specialkey = KEY_F1; break; case 0x06: specialkey = KEY_F2; break; case 0x08: specialkey = KEY_F3; break; @@ -533,6 +508,45 @@ special: GiveUp(0); } break; + + /* + * Check grabs + */ + case KEY_KP_Divide: + if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) { + if (inputInfo.pointer && inputInfo.pointer->grab != NULL && + inputInfo.pointer->DeactivateGrab) + inputInfo.pointer->DeactivateGrab(inputInfo.pointer); + if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL && + inputInfo.keyboard->DeactivateGrab) + inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard); + } + break; + case KEY_KP_Multiply: + if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowClosedown) { + ClientPtr pointer, keyboard, server; + + pointer = keyboard = server = NULL; + if (inputInfo.pointer && inputInfo.pointer->grab != NULL) + pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)]; + if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) { + keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)]; + if (keyboard == pointer) + keyboard = NULL; + } + if (xf86Info.grabInfo.server.grabstate == SERVER_GRABBED && + (server = xf86Info.grabInfo.server.client) == pointer || + server == keyboard) + server = NULL; + + if (pointer) + CloseDownClient(pointer); + if (keyboard) + CloseDownClient(keyboard); + if (server) + CloseDownClient(server); + } + break; /* * The idea here is to pass the scancode down to a list of @@ -861,9 +875,6 @@ special: */ if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { #if !defined(CSRG_BASED) && \ - !defined(MACH386) && \ - !defined(MINIX) && \ - !defined(__OSF__) && \ !defined(__GNU__) && \ !defined(__CYGWIN__) && \ defined(KB_84) @@ -877,7 +888,7 @@ special: UsePrefix = TRUE; Direction = TRUE; } -#endif /* !CSRG_BASED && !MACH386 && !MINIX && !__OSF__ */ +#endif /* !CSRG_BASED && ... */ } } if (updateLeds) xf86KbdLeds(); @@ -922,8 +933,6 @@ special: #endif /* !__EMX__ */ -#ifndef AMOEBA - /* * xf86Wakeup -- * Os wakeup handler. @@ -934,10 +943,6 @@ void xf86Wakeup(pointer blockData, int err, pointer pReadmask) { #if !defined(__EMX__) && !defined(__QNX__) && !defined(__CYGWIN__) -#ifdef __OSF__ - fd_set kbdDevices; - fd_set mseDevices; -#endif /* __OSF__ */ fd_set* LastSelectMask = (fd_set*)pReadmask; fd_set devicesWithInput; InputInfoPtr pInfo; @@ -945,7 +950,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) if (err >= 0) { XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices); -#ifndef __OSF__ if (XFD_ANYSET(&devicesWithInput)) { (xf86Info.kbdEvents)(); pInfo = xf86InputDevs; @@ -965,25 +969,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) pInfo = pInfo->next; } } -#else /* __OSF__ */ - /* - * Until the two devices are made nonblock on read, we have to do this. - */ - MASKANDSETBITS(devicesWithInput, pReadmask, EnabledDevices); - - CLEARBITS(kbdDevices); - BITSET(kbdDevices, xf86Info.consoleFd); - MASKANDSETBITS(kbdDevices, kbdDevices, devicesWithInput); - - CLEARBITS(mseDevices); - BITSET(mseDevices, xf86Info.mouseDev->mseFd); - MASKANDSETBITS(mseDevices, mseDevices, devicesWithInput); - - if (ANYSET(kbdDevices) || xf86Info.kbdRate) - (xf86Info.kbdEvents)(ANYSET(kbdDevices)); - if (ANYSET(mseDevices)) - (xf86Info.mouseDev->mseEvents)(1); -#endif /* __OSF__ */ } #else /* __EMX__ and __QNX__ */ @@ -1025,7 +1010,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) if (xf86Info.inputPending) ProcessInputEvents(); } -#endif /* AMOEBA */ /* * xf86SigioReadInput -- diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c b/xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c deleted file mode 100644 index 471fcdb14..000000000 --- a/xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdSol8.c,v 1.1 1999/09/25 14:45:02 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */ - -/* Dummy C File for place holder - see os-support/sol8_x86 */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h index 6cd064971..9f995ad19 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.98 2001/05/11 07:56:10 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.104 2001/08/18 17:25:50 alanh Exp $ */ /* * PCI Probe * @@ -38,7 +38,9 @@ #ifndef _XF86_PCIINFO_H #define _XF86_PCIINFO_H +#ifndef SELF_CONTAINED_PCI_INFO #include "xf86str.h" +#endif /* PCI Pseudo Vendor */ #define PCI_VENDOR_GENERIC 0x00FF @@ -93,6 +95,7 @@ #define PCI_VENDOR_LEADTEK 0x107D #define PCI_VENDOR_CONTAQ 0x1080 #define PCI_VENDOR_FOREX 0x1083 +#define PCI_VENDOR_SBS 0x108A #define PCI_VENDOR_OLICOM 0x108D #define PCI_VENDOR_SUN 0x108E #define PCI_VENDOR_DIAMOND 0x1092 @@ -230,6 +233,9 @@ #define PCI_CHIP_MACH64LP 0x4C50 #define PCI_CHIP_MACH64LR 0x4C52 #define PCI_CHIP_MACH64LS 0x4C53 +#define PCI_CHIP_RADEON_LW 0x4C57 +#define PCI_CHIP_RADEON_LY 0x4C59 +#define PCI_CHIP_RADEON_LZ 0x4C5A #define PCI_CHIP_RAGE128MF 0x4D46 #define PCI_CHIP_RAGE128ML 0x4D4C #define PCI_CHIP_RAGE128PD 0x5044 @@ -239,12 +245,19 @@ #define PCI_CHIP_RADEON_QE 0x5145 #define PCI_CHIP_RADEON_QF 0x5146 #define PCI_CHIP_RADEON_QG 0x5147 -#define PCI_CHIP_RADEON_VE 0x5159 +#define PCI_CHIP_RADEON_QY 0x5159 +#define PCI_CHIP_RADEON_QZ 0x515A #define PCI_CHIP_RAGE128RE 0x5245 #define PCI_CHIP_RAGE128RF 0x5246 #define PCI_CHIP_RAGE128RG 0x5247 #define PCI_CHIP_RAGE128RK 0x524B #define PCI_CHIP_RAGE128RL 0x524C +#define PCI_CHIP_RAGE128SM 0x534D +#define PCI_CHIP_RAGE128TF 0x5446 +#define PCI_CHIP_RAGE128TL 0x544C +#define PCI_CHIP_RAGE128TR 0x5452 + + #define PCI_CHIP_MACH64VT 0x5654 #define PCI_CHIP_MACH64VU 0x5655 #define PCI_CHIP_MACH64VV 0x5656 @@ -362,6 +375,7 @@ #define PCI_CHIP_MGAG100_PCI 0x1000 #define PCI_CHIP_MGAG100 0x1001 +#define PCI_CARD_G400_TH 0x2179 #define PCI_CARD_MILL_G200_SD 0xff00 #define PCI_CARD_PROD_G100_SD 0xff01 #define PCI_CARD_MYST_G200_SD 0xff02 @@ -494,10 +508,11 @@ #define PCI_CHIP_GEFORCE2GTS_1 0x0151 #define PCI_CHIP_GEFORCE2ULTRA 0x0152 #define PCI_CHIP_QUADRO2PRO 0x0153 +#define PCI_CHIP_IGEFORCE2 0x01A0 #define PCI_CHIP_GEFORCE3 0x0200 #define PCI_CHIP_GEFORCE3_1 0x0201 #define PCI_CHIP_GEFORCE3_2 0x0202 -#define PCI_CHIP_GEFORCE3_3 0x0203 +#define PCI_CHIP_QUADRO_DDC 0x0203 /* NVIDIA & SGS */ #define PCI_CHIP_RIVA128 0x0018 @@ -672,6 +687,7 @@ static SymTabRec xf86PCIVendorNameInfoData[] = { {PCI_VENDOR_LEADTEK, "Leadtek"}, {PCI_VENDOR_CONTAQ, "Contaq"}, {PCI_VENDOR_FOREX, "FOREX"}, + {PCI_VENDOR_SBS, "SBS Technologies"}, /* Formerly Bit 3 Computer Corp */ {PCI_VENDOR_OLICOM, "Olicom"}, {PCI_VENDOR_SUN, "Sun"}, {PCI_VENDOR_DIAMOND, "Diamond"}, @@ -828,11 +844,18 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_RAGE128PD, "Rage 128 Pro PD",0}, {PCI_CHIP_RAGE128PF, "Rage 128 Pro PF",0}, {PCI_CHIP_RAGE128PR, "Rage 128 Pro PR",0}, + {PCI_CHIP_RAGE128TF, "Rage 128 Pro TF",0}, + {PCI_CHIP_RAGE128TL, "Rage 128 Pro TL",0}, + {PCI_CHIP_RAGE128TR, "Rage 128 Pro TR",0}, {PCI_CHIP_RADEON_QD, "Radeon QD",0}, {PCI_CHIP_RADEON_QE, "Radeon QE",0}, {PCI_CHIP_RADEON_QF, "Radeon QF",0}, {PCI_CHIP_RADEON_QG, "Radeon QG",0}, - {PCI_CHIP_RADEON_VE, "Radeon VE",0}, + {PCI_CHIP_RADEON_QY, "Radeon VE QY",0}, + {PCI_CHIP_RADEON_QZ, "Radeon VE QZ",0}, + {PCI_CHIP_RADEON_LY, "Radeon Mobility M6 LY",0}, + {PCI_CHIP_RADEON_LZ, "Radeon Mobility M6 LZ",0}, + {PCI_CHIP_RAGE128SM, "Rage 128 SM",0}, {PCI_CHIP_RAGE128RE, "Rage 128 RE",0}, {PCI_CHIP_RAGE128RF, "Rage 128 RF",0}, {PCI_CHIP_RAGE128RK, "Rage 128 RK",0}, @@ -1122,6 +1145,11 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_VENDOR_FOREX, { {0x0000, NULL,0}}}, #endif +#ifdef VENDOR_INCLUDE_NONVIDEO + {PCI_VENDOR_SBS, { + {0x0040, "dataBLIZZARD",0 }, + {0x0000, NULL,0}}}, +#endif {PCI_VENDOR_OLICOM, { {0x0001, "OC-3136",0 }, {0x0011, "OC-2315",0 }, @@ -1248,15 +1276,17 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_QUADRO, "Quadro",0}, {PCI_CHIP_GEFORCE2MX, "GeForce2 MX",0}, {PCI_CHIP_GEFORCE2MXDDR,"GeForce2 MX DDR",0}, + {PCI_CHIP_GEFORCE2GO, "GeForce2 Go", 0}, {PCI_CHIP_QUADRO2MXR, "GeForce2 MXR",0}, {PCI_CHIP_GEFORCE2GTS, "GeForce2 GTS",0}, {PCI_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)",0}, {PCI_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra",0}, {PCI_CHIP_QUADRO2PRO, "Quadro 2 Pro",0}, + {PCI_CHIP_IGEFORCE2, "GeForce2 Integrated",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}, + {PCI_CHIP_QUADRO_DDC, "Quadro DDC",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_IMS, { {PCI_CHIP_IMSTT128, "TwinTurbo 128", 0}, @@ -1465,6 +1495,7 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_CHIP_968, "968",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_INTEL,{ +#ifdef VENDOR_INCLUDE_NONVIDEO {0x0482, "82375EB pci-eisa bridge",0}, {0x0483, "82424ZX cache dram controller",0}, {0x0484, "82378IB/ZB pci-isa bridge",0x0601}, @@ -1504,15 +1535,16 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {0x71a2, "82443GX Host (no AGP)",0}, {0x84C4, "P6",0}, {0x84C5, "82450GX20",0}, - {PCI_CHIP_I740_AGP, "i740 (AGP)",0}, - {PCI_CHIP_I815_BRIDGE, "i815 Bridge",0}, - {PCI_CHIP_I815, "i815",0}, {PCI_CHIP_I810_BRIDGE, "i810 Bridge",0}, - {PCI_CHIP_I810, "i810",0}, {PCI_CHIP_I810_DC100_BRIDGE, "i810-dc100 Bridge",0}, - {PCI_CHIP_I810_DC100, "i810-dc100",0}, {PCI_CHIP_I810_E_BRIDGE,"i810e Bridge",0}, + {PCI_CHIP_I815_BRIDGE, "i815 Bridge",0}, +#endif + {PCI_CHIP_I740_AGP, "i740 (AGP)",0}, + {PCI_CHIP_I810, "i810",0}, + {PCI_CHIP_I810_DC100, "i810-dc100",0}, {PCI_CHIP_I810_E, "i810e",0}, + {PCI_CHIP_I815, "i815",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_ADAPTEC, { {0x0010, "2940U2",0 }, @@ -1747,8 +1779,11 @@ static pciVendorCardInfo xf86PCICardInfoData[] = { {PCI_VENDOR_INTEL, { #ifdef VENDOR_INCLUDE_NONVIDEO { 0x0009, "PCI 10/100Mb/s ethernet card",0, NF }, + { 0x0040, "PRO/100 S Desktop Adapter PCI 10/100Mb/s ethernet card",0, NF }, /* Seattle AL440BX is 0x8080, is anything else ? */ { 0x8080, "motherboard",0, NF }, + { 0x3013, "Integrated LAN (82562ET)",0, NF }, + { 0x4541, "Eastern (D815EEA) motherboard",0, NF }, { 0x4d55, "Maui (MU) motherboard",0, NF }, #endif { 0x0000, (char *)NULL,0, NF } } }, @@ -1763,6 +1798,7 @@ static pciVendorCardInfo xf86PCICardInfoData[] = { { PCI_CARD_MILL_G200_SG, "Millennium G200 SG",0, NF }, { PCI_CARD_MARV_G200_SD, "Marvel G200 SD",0, NF }, { 0x1001, "Productiva G100 SG",0, NF }, + { PCI_CARD_G400_TH, "G400 Twin Head",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_SIS, { { 0x6306, "530 based motherboard",0, NF }, diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h index eb1639617..c185adbc8 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.72 2001/05/15 18:22:21 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.75 2001/08/17 22:08:12 tsi Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -61,6 +61,7 @@ extern const char *xf86ModulePath; extern MessageType xf86ModPathFrom; extern const char *xf86LogFile; extern MessageType xf86LogFileFrom; +extern Bool xf86LogFileWasOpened; extern serverLayoutRec xf86ConfigLayout; extern Pix24Flags xf86ConfigPix24; @@ -157,7 +158,7 @@ void xf86SigHandler(int signo); void xf86HandlePMEvents(int fd, pointer data); extern int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num); extern pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event); - +void xf86GrabServerCallback(CallbackListPtr *, pointer, pointer); /* xf86Helper.c */ void xf86LogInit(void); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c b/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c deleted file mode 100644 index cbcfb83a2..000000000 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 1997-1998 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.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 Frederic Lepied not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Frederic Lepied makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FREDERIC LEPIED 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. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Switch.c,v 3.8 1999/05/07 02:56:14 dawes Exp $ */ - -#if !defined(sun) || defined(i386) -#include "xf86.h" -#include "xf86Xinput.h" -#else -#include "extio.h" -#endif - -/****************************************************************************** - * debugging macro - *****************************************************************************/ -#ifdef DBG -#undef DBG -#endif -#ifdef DEBUG -#undef DEBUG -#endif - -static int debug_level = 0; -#define DEBUG 1 -#if DEBUG -#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} -#else -#define DBG(lvl, f) -#endif - -/****************************************************************************** - * device records - *****************************************************************************/ - -typedef struct -{ - XID last; /* last core pointer */ -} SwitchDevRec, *SwitchDevPtr; - -/* - *************************************************************************** - * - * xf86SwtConvert -- - * Convert valuators to X and Y. - * - *************************************************************************** - */ -static Bool -xf86SwtConvert(LocalDevicePtr local, - int first, - int num, - int v0, - int v1, - int v2, - int v3, - int v4, - int v5, - int* x, - int* y) -{ - return FALSE; -} - -/* - * xf86SwitchCoreDevice -- - * Test if the core device has changed and send a motion event accordingly. - */ -void -xf86SwitchCoreDevice(LocalDevicePtr local, - DeviceIntPtr core) -{ - SwitchDevPtr priv; - - if (!local) - return; - - priv = (SwitchDevPtr) local->private; - - if (core->id != priv->last) { - DBG(3, ErrorF("xf86SwitchCoreDevice new core id=%d old=%d\n", core->id, priv->last)); - priv->last = core->id; - xf86PostMotionEvent(local->dev, 1, 0, 1, core->id); - } -} - -static void -xf86SwtControlProc(DeviceIntPtr device, - PtrCtrl *ctrl) -{ - DBG(2, ErrorF("xf86SwtControlProc\n")); -} - -/* - * xf86SwtProc -- - * Handle the initialization, etc. of a switch - */ -static int -xf86SwtProc(pSwt, what) - DeviceIntPtr pSwt; - int what; -{ - int loop; - int nbaxes; - LocalDevicePtr local = (LocalDevicePtr)pSwt->public.devicePrivate; - SwitchDevPtr priv = (SwitchDevPtr)XI_PRIVATE(pSwt); - - DBG(2, ErrorF("BEGIN xf86SwtProc dev=0x%x priv=0x%x\n", pSwt, priv)); - - switch (what) - { - case DEVICE_INIT: - DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=INIT\n", pSwt)); - - nbaxes = 1; - - if (InitFocusClassDeviceStruct(pSwt) == FALSE) - { - ErrorF("unable to init Focus class device\n"); - return !Success; - } - - if (InitValuatorClassDeviceStruct(pSwt, - nbaxes, - xf86GetMotionEvents, - local->history_size, - Absolute) /* relatif ou absolute */ - == FALSE) - { - ErrorF("unable to allocate Valuator class device\n"); - return !Success; - } - else - { - for(loop=0; loop<nbaxes; loop++) { - InitValuatorAxisStruct(pSwt, - loop, - 0, /* min val */ - 1000, /* max val */ - 1); /* resolution */ - } - /* allocate the motion history buffer if needed */ - xf86MotionHistoryAllocate(local); - - AssignTypeAndName(pSwt, local->atom, local->name); - } - - break; - - case DEVICE_ON: - DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=ON\n", pSwt)); - pSwt->public.on = TRUE; - break; - - case DEVICE_OFF: - case DEVICE_CLOSE: - DBG(1, ErrorF("xf86SwtProc pSwt=0x%x what=%s\n", pSwt, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - pSwt->public.on = FALSE; - break; - - default: - ErrorF("unsupported mode=%d\n", what); - return !Success; - break; - } - DBG(2, ErrorF("END xf86SwtProc dev=0x%x priv=0x%x\n", pSwt, priv)); - return Success; -} - -/* - * xf86SwtAllocate -- - * Allocate Switch device structures. - */ -static LocalDevicePtr -xf86SwtAllocate() -{ - LocalDevicePtr local = (LocalDevicePtr) xalloc(sizeof(LocalDeviceRec)); - SwitchDevPtr priv = (SwitchDevPtr) xalloc(sizeof(SwitchDevRec)); - - local->name = "SWITCH"; - local->flags = 0; - local->device_control = xf86SwtProc; - local->read_input = NULL; - local->close_proc = NULL; - local->control_proc = NULL; - local->switch_mode = NULL; - local->conversion_proc = xf86SwtConvert; - local->fd = -1; - local->atom = 0; - local->dev = NULL; - local->private = priv; - local->type_name = "Switch"; - local->history_size = 0; - - priv->last = -1; - - return local; -} - -/* - * switch association - */ -DeviceAssocRec switch_assoc = -{ - " ", /* config_section_name */ - xf86SwtAllocate /* device_allocate */ -}; - -/* end of xf86Switch.c */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c index 9b1e3f000..410cfd7cf 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.42 2001/05/16 07:56:06 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.43 2001/06/12 04:27:14 tsi Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -671,6 +671,10 @@ savePciBusState(BusAccPtr ptr) pciReadWord(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_PMEM_REG); ptr->busdep.pci.save.control = pciReadByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG); + /* Allow master aborts to complete normally on non-root buses */ + if (ptr->busdep.pci.save.control & PCI_PCI_BRIDGE_MASTER_ABORT_EN) + pciWriteByte(ptr->busdep.pci.acc,PCI_PCI_BRIDGE_CONTROL_REG, + ptr->busdep.pci.save.control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); } /* move to OS layer */ diff --git a/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c b/xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c index 3df992941..def271371 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.7 2001/04/05 17:42:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.8 2001/07/14 19:38:29 paulo Exp $ */ #include "misc.h" #include "xf86.h" @@ -48,8 +48,8 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC) if (DDC->ver.version == 1) { makeEDID1prop = TRUE; } else if (DDC->ver.version == 2) { - int checksum1 = 0; - int checksum2 = 0; + int checksum1; + int checksum2; makeEDID2prop = TRUE; /* Some monitors (eg Panasonic PanaSync4) @@ -58,14 +58,16 @@ xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC) * * Try using checksum to determine when we have such a monitor. */ + checksum2 = 0; 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"); + checksum1 = 0; 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"); + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID1_RAWDATA property created\n"); makeEDID1prop = TRUE; } } diff --git a/xc/programs/Xserver/hw/xfree86/doc/Install b/xc/programs/Xserver/hw/xfree86/doc/Install index fc1a90ca9..ed8e3680f 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Install +++ b/xc/programs/Xserver/hw/xfree86/doc/Install @@ -366,7 +366,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.11.2.2 2001/06/01 18:09:48 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.12 2001/06/01 18:26:04 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.11.2.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.12 2001/06/01 18:28:40 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRI b/xc/programs/Xserver/hw/xfree86/doc/README.DRI index 0d3f897f4..8ecad955c 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DRI +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRI @@ -1234,4 +1234,4 @@ demo programs is available from http://dri.sourceforge.net/res.phtml Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.24 2001/05/19 00:42:22 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.16.2.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.17 2001/06/01 18:28:40 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp index ae1f31e12..5addc30a6 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp @@ -601,4 +601,4 @@ 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.14 2001/05/02 15:06:08 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.10.2.1 2001/06/01 18:26:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.11 2001/06/01 18:28:40 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.i810 b/xc/programs/Xserver/hw/xfree86/doc/README.i810 index 38e255969..5cbd28b9f 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.i810 +++ b/xc/programs/Xserver/hw/xfree86/doc/README.i810 @@ -109,4 +109,4 @@ http://www.precisioninsight.com Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.3 2001/04/04 01:34:18 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i810,v 1.6.2.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i810,v 1.7 2001/06/01 18:28:42 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.newport b/xc/programs/Xserver/hw/xfree86/doc/README.newport index 9ef0f4d10..a3703cd3f 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.newport +++ b/xc/programs/Xserver/hw/xfree86/doc/README.newport @@ -41,4 +41,4 @@ The following Section "Device" options are supported by the newport driver: Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.2 2000/12/12 18:54:29 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.2.4.1 2001/06/01 18:26:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.3 2001/06/01 18:28:42 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml index 2630b2336..9ee4f4ff2 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml @@ -13,7 +13,7 @@ <date>15 June 2001 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.24 2001/05/19 00:42:22 dawes Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.25 2001/08/18 02:51:11 dawes Exp $ </ident> <toc> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml index 97b5da3e3..24fa59101 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>1 June 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11.2.2 2001/06/01 18:09:48 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.12 2001/06/01 18:26:04 dawes Exp $ </ident> <abstract> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml deleted file mode 100644 index daf7d7a76..000000000 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml +++ /dev/null @@ -1,213 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> -<article> - -<title>Notes on Rebuilding XFree86/OS2 from Scratch -<author>Holger Veit -<date>Last modified August 1st, 1999 - -<toc> - -<sect>Preface -<p> -X11 and XFree86 were initially developed on Unix-based systems. Usually -Unix systems provide a rich number of tools and utilities to get certain -things done. Under OS/2, these tools are not installed, but ports are -available which are sometimes functionally equivalent to Unix utilities -with the same name, but also differ sometimes in a subtle way. -This guide will give you hints if you intend to rebuild the system -from scratch under OS/2. -<p> -Please also read <htmlurl name=README.OS2 url=OS2.html> for end-user -information, and set at least the environment variables described there. -<p> -At the current time, the most recent version available is XFree86-3.3.5. -This is a full and unrestricted version which comes with complete source -code. 3.3.5 is not only a bugfix release, but also supports new hardware, -some of which might not even supported by OS/2 itself. See the RELEASE NOTES -document for details. - -If you want to join the XFree86 developer team, e.g. to add support for -certain hardware, please send a request to BOD@XFree86.org. Please -think about such a step carefully before, though, since much work is -involved. Please use the XFree86-3.3.5 source code as a test example how -to compile the system. The ability to manage that is a basic requirement -for becoming a developer. - - -<sect>Tools required -<p> - -I have tried to reduce the number of external tools, but when looking back -it seems I were not very successful. At least I managed to get everything -working with the native CMD.EXE shell only. However, there is still plenty -of software required. -Most of this software is available from <tt/hobbes.nmsu.edu/ or <tt/ftp.leo.org/ -via anonymous FTP. The following shopping list shows what you will need: - -<itemize> -<item>gcc EMX/gcc emx 0.9C patch4 or later (0.9d preferred!) -<item>gzip GNU zip/unzip -<item>tar GNU tar -<item>patch Larry Wall's patch utility (attention: incompatible tool with same name in OS/2) -<item>install BSD/GNU install -<item>rm,mv,cp GNU file utilities -<item>tee,.. GNU shell utilities -<item>groff GNU nroff/troff -<item>sed GNU sed stream editor -<item>grep GNU grep -<item>gawk GNU awk -<item>make GNU make 3.71/3.72 (use the one from Xprog.zip!) -<item>flex GNU flex -<item>bison GNU bison -<item>find GNU find (attention: incompatible tool with the same name in OS/2) -</itemize> - -If there is no version number given, any new version will do. Particularly -critical is only EMX/gcc and GNU make. Note that the second GCC implementation -which might still be available from some archives is NOT compatible. - -Furthermore, you need the XFree86 sources. These are available from -the common XFree86 repositories. Look into a directory which is -often named /pub/XFree86/3.3.5/source. - -<sect>Compiling and Installing -<p> - -You need about 300MB of free HPFS space for the whole system. This does not -include space for the postscript and troff documentation files. I have never -installed them. Nor did I install the test subtree. - -<enum> -<item>Install all the above utilities. Refer to the corresponding documentation. - Verify that everything works well, particularly EMX. -<item>It is a good idea to use the same or a similar structure I have. - I have made a directory <tt>\x11</tt> on the partition for compiling and have - put everything below this tree. I found that a clean tree occupies - less than the half space of the disk, this gives me the opportunity to - rename this tree to <tt>\x11old</tt> and copy a new version to the - same disk to produce diffs. Last time the complete tree was - arranged under the root directory <tt>xc</tt>, this would become - <tt>\x11\xc</tt> then. -<item>To unpack the files you would usually execute the command - <verb>gzip -dc file.tar.gz | tar xvf -</verb> - in the <tt>\x11</tt> directory. At the end you will usually see the - irritating, but non-fatal message "gzip: stdout Broken pipe". Ignore it. -<item>After that, is is likely necessary to apply some patches, either from - the XConsortium or from the XFree86 project. Before you do this, enter - <verb> - chmod -R a+rw \x11\xc - </verb> - to make certain files in the tree writable. -<item>There should be a file <tt>added-XXX</tt> accompanying the patch file - which lists the files that are newly created. The patch program has - a problem with creating new directories, so we need to create them - on advance. For each <tt/added-XXX/ file you find, execute from - <tt>\x11</tt> <verb>xc\config\util\added added-XXX</verb> - If there is no <tt>added-XXX</tt> file available, you can make one with - the following instructions: - <verb> - grep "\*\*\* xc/" patchfile >added-file - </verb> - Edit <tt/added-file/ with a text editor and remove the <tt/*** / at - the beginning and the time stamp at the end (search for a TAB and - erase to the end of the line). You get a list of file paths, one in a - line, which is the input to the added utility. -<item>After that you can apply the patches in the right order. Usually this - is done by a command - <verb> - patch -p -E <patchfile 2>&1 | tee patchlog - </verb> - from the <tt>\x11</tt> directory. Be aware to use the right - patch - OS/2 has a utility with the same name and different functionality. - Don't use the recommended <tt/-s/ option, this makes <tt/patch/ quiet, - and you won't see problems in the patchlog file. Use - <verb> - find \x11 -name *.rej -print - find \x11 -name *# -print - </verb> - to find any rejects and unapplied patches (attention: yet another OS/2 - program with wrong functionality). Normally there shouldn't - be any problems of this kind, else you have made a mistake. Finally - remove the original files with - <verb> - find \x11 -name *.orig -print -exec rm {} ; - </verb> -<item>Go to the <tt>xc/config/cf</tt> directory and edit the <tt>xf86site.def</tt> - file to match your requirements (you probably don't want to compile - all X servers). Certain changes must be set to the following values: - <itemize> - <item>Disable if not already done any PC98 server; PC98 (Japanese XFree86) - does not work yet. Porters from Japan are welcome! - <item><tt>#define WacomSupport NO - #define ElographicsSupport NO</tt> - Both options are not yet supported. - <item>Tcl* and Tk* don't need to be set explicitly. Reasonable defaults - are in the other config files, provided you have a complete - XFree86/OS2 binary tree with the tcl/tk runtime support installed. - <item><tt>#define BuildDynamicLoading NO</tt> - This does not work. - </itemize> -<item>Go to the directory <tt>xc\util\compress</tt> and - <tt>make compress.exe</tt> there. Install the program produced - there in your path. I stumbled more than once on half-ported - compress programs on OS/2 ftp servers that are defective w.r.t. - reading and writing stdin/stdout. In some stage (font compression) - otherwise you will get a core dump of mkfontdir, because all - compressed fonts are corrupt. -<item>Set the environment variable <tt/X11ROOT/ to something different than - it is; otherwise the installation process will overwrite your - original XFree86/OS2 installation. If you have not set this variable, - go back to the prefix section of this document: you have forgotten - something. -<item>Copy the file <tt>xc/programs/Xserver/hw/xfree86/etc/bindist/OS2/host.def.os2</tt> - to the location <tt>xc/config/cf/host.def</tt>. Use this file to do - any specific modifications to imake variables, rather than editing - the file xfree86.cf, imake.tmpl, or os2.cf directly. -<item>Copy the file <tt>xc/config/util/buildos2.cmd</tt> into the <tt/xc/ - directory. If this is a second or later attempt, you might need to - copy the saved toplevel Makefile.os2 back to Makefile. -<item>Execute this <tt/buildos2.cmd/ command in the <tt/xc/ directory; - it will produce a logfile <tt>buildxc.log</tt> in this directory. -<item>Go have a bucket of coffee, or better, buy new coffee - in Colombia! - The compile will need between 2 and 20 hours, depending on your - selections, and the horse power of your hardware. -<item>When finished, view the logfile for errors, and fix the problems if - there are some. I have managed to compile the whole system - flawlessly, so there is at least one configuration that works. -<item>Finally, from the <tt/xc/ dir, execute - <verb> - xmake install - xmake install.man - </verb> -<item>There are a few minor glitches in the installation: -<enum> -<item>The xdm and linkkit directories will fail in compile and installation. - This is no problem and has no effect on the rest of the system. -<item>The imake.exe which is installed in <tt/\XFree86\bin/ is usually defective. - The one which was built initially and installed in the root directory - of the drive where you have the source tree is okay. So simply copy - this <tt/\imake.exe/ to the <tt/\XFree86\bin/ directory - manually. Some day this might be fixed. -<item><tt/XF86Setup/ is not ported yet and won't work with the tcl/tk port - available for XFree86/OS2. My idea was to replace this by some native - installation tool, which I didn't find the time to do yet. Feel free - to spend a bit of time to play with XF86Setup if you like. -</enum> -</enum> - -Well, you see, this was quite easy :-) - - - - -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OS2note.sgml,v 3.6 1999/08/23 06:38:50 dawes Exp $ - - - - - -$XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $ -</verb> - -</article> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml deleted file mode 100644 index 85e6e2f39..000000000 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml +++ /dev/null @@ -1,677 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> - -<article> - -<title>Quick-Start Guide to XFree86 Setup - -<author>Joe Moss -<date>27 February 1998 - -<abstract> - Current releases of XFree86 include several tools that can help -to automate the process of server configuration. Much of the existing -documentation, however, describes how to do the job manually, including -many technical details. - - For those users with esoteric hardware or with the desire to -get their hands dirty under the hood, this is great, but many users are -using common hardware and just want to get X up and running quickly. -This guide is for them. - -</abstract> - -<toc> - -<sect> Before You Start -<p> - There are a few bits of information that you will need to have - before you can setup the server: - <descrip> - <tag> The model name of your video card </tag> - Make sure you know the exact model name of the card. It - may help to also know the graphics chipset, RAMDAC, and - clock chip used on your card. - <tag> The amount of memory on your video card </tag> - Find out how many megabytes of RAM are on your video card. - <tag> Whether or not your card is VGA compatible </tag> - Most cards these days are VGA compatible, but for example, - if you have and older monochrome card, it might not be. - <tag> Your monitor's specifications </tag> - Specifically, you need to know the horizontal sync rate(s), - and vertical refresh rate(s). These are <bf>important</bf>! - Consult your monitor's manual. - <tag> The protocol used by your mouse </tag> - It will help speed up the process, if you know which protocol - is used by your mouse to communicate. Some mice are capable - of using two different protocols, although the method of - switching between them varies. In some cases, with new - Plug-n-Play mice, the protocol can be determined - automatically. - </descrip> - -<sect> What to Do - An Overview -<p> - There are three tools that can be used to set up XFree86: - <itemize> - <item>XF86Setup - <item>xf86config - <item>xvidtune - </itemize> -<p> - XF86Setup primarily uses a graphical user interface and - is the preferred tool for initial setup, but there - are a few cases where it can't be used. If you are using a - card that is not VGA compatible, have a fixed-frequency - monitor, or are running OS/2, you'll not be able to use - XF86Setup, read about xf86config instead. - If you have limited RAM or a slow system, you might be better - off using xf86config as well. -<p> - The xf86config program is text based only, but works for almost - any hardware combination. If you have a fixed frequency - monitor that won't work with standard text modes, you - will have to read the necessary documentation and - do the configuration manually. -<p> - To get things looking just right, you may need to use - <tt>xvidtune</tt>, a program that allows you to make adjustments - to the displayed image (e.g. make it wider, move it a little - to the left, etc.). XF86Setup will allow you to run xvidtune - at the appropriate time; if you use xf86config, you can use - xvidtune afterwards. -<p> - All of these are explained in detail in the following - sections. If you're the type that doesn't like to read - the documentation, but would rather just try and figure - your way through things, you can just type <tt/XF86Setup/ - now. - If you have problems, the documentation will still be here. -<p> - Although it is possible to use XF86Setup from within X to - make changes to your existing configuration, such use is - not specifically documented here. These instructions are - primarily for those initially setting up XFree86 on their - system. - -<sect> Using <tt>XF86Setup</tt> -<p> - XF86Setup will first check around to make sure certain files - are installed and that you are running as root. If a problem - is found, it will display a message and exit. Correct the - problem (e.g. install the missing files) and run it again. - - XF86Setup is internationalized. If you are Japanese and set - the LANG environment variable to ja, japan, japanese, etc., - XF86Setup's screen can be Japanized. But it is necessary that - XF86Setup is built with Japanized Tcl/Tk. Other language can - be added, if you prepare its own directory under the directory - XF86Setup/texts. Please see under the directory - XF86Setup/texts/generic. - -<sect1> Initial questions -<p> - If you have an existing XF86Config file, you will be asked if - you would like to use it to set the default values of various - configuration settings. If you've already got an (at least - somewhat) working configuration you will want to do this. - - If you are running on an OS which has a mouse driver in the - kernel (e.g. SCO or SVR4), you may be asked if you'd like to - use it. - - Once the questions (if any) are completed, you will see a message - indicating that the program is ready to switch into graphics mode. - Just press Enter. If you don't get a graphics screen saying - <it/Welcome to XFree86 Setup/ within a minute, something has - probably hung, you can try pressing Ctrl-Alt-Backspace to - switch back to text mode and you'll probably have to use - xf86config instead of XF86Setup. - -<sect1> Configuration areas -<p> - Once the VGA16 server is started, and once the program has - finished loading, you will see a screen with six - buttons along the top and three along the bottom. - The buttons along the top correspond to the general categories - of configuration settings. They can be done in any order. - Each of these areas is explained in detail below. - The bottom row consists of the <bf/Abort/, - <bf/Done/, and <bf/Help/ buttons. -<p> - <bf/Abort/ does as it name implies. It exits the program - without saving any changes that have been made. The one - possible exception is the link to the mouse device. Any - change to that is made as soon as <bf/Apply/ is selected. -<p> - <bf/Done/ should be selected when you've finished - configuration in each of the various categories. -<p> - The <bf/Help/ can be pressed at any time to get on-line - help regarding the current configuration screen. -<p> - You should start with configuring your mouse as it will make - things a lot easier to perform the configuration of other - categories. - -<sect2> Mouse -<p> - The mouse configuration screen is used to get the mouse working - properly. There are key bindings for everything so that you - can easily configure the mouse, if it's not already working. -<p> - The screen includes a representation of a white mouse with - three buttons. As you move your mouse it should show the - pointer coordinates on the mouse and the buttons should turn - black as you press the corresponding button on your mouse. - If that is not happening, then your mouse is not correctly - configured. -<p> - Along the top are some rows of buttons corresponding to - the various possible protocols. There will also be - several buttons and a couple of sliders - for other settings, a visual representation of the mouse, - and a button to apply any changes. - There may also be an entry box in which the - device can be set along with a list of possible devices. -<p> - First try moving your mouse around and see if the pointer moves - correctly. If so, try testing that the buttons are working - properly. If those are working as desired, go ahead and go on - to another configuration area. -<p> - If the mouse pointer doesn't move at all, you need to fix - either the mouse device or the protocol (or both). - You can press 'n' followed by a Tab, to move to the list - of mouse devices and select a different one. - Pressing 'p' will pick the next available protocol on the list - (protocols that are not available on your OS will be - greyed-out). If you have a PnP mouse, it may be easiest to - just select "Auto" as the protocol. - After changing these, press 'a' to apply the changes and try - again. Repeat the process until you are getting some response - from your mouse. -<p> - If the mouse pointer or button indicators do something when you - move the mouse, but the pointer is not moving properly, you - probably have the wrong protocol selected. Try with a different - one. -<p> - Most mice these days use the <bf/Microsoft/ protocol, the second - most common is <bf/MouseSystems/. Some mice do both. - These <it/dual-protocol/ mice have various methods of switching - between the two protocols. - Some have a switch on the mouse itself. - Some are switched by sending a certain signal to the mouse - when opening a connection to the mouse. - These signals can be controlled by using different - combinations of the 'ClearDTR' and 'ClearRTS' settings. - Other mice require a button to be depressed when the mouse - is opened (when the mouse driver first tries to talk to it). - If your mouse uses this method, hold down the appropriate - button while selecting apply (pressing 'a'). -<p> - Once the mouse pointer is moving correctly, test that all - three buttons are working properly. If your mouse only has - two buttons, select 'Emulate3Buttons' and you should be able - to press both buttons simultaneously to emulate the missing - middle button. If not all of the buttons are working, try - changing the 'ChordMiddle' setting or you may be using a - protocol that is similar to that of your mouse, - but not quite right. - -<sect2> Keyboard -<p> - You need to specify the model and layout of your keyboard (and - press apply) if they are not already correct. - The graphical representation of the keyboard will be - updated when you choose a different model. -<p> - For non-U.S. keyboards you may wish to choose a variant from - the list (at this time there is only one available variant: - <tt/nodeadkeys/>). -<p> - You can also pick from the options to the right, if you wish. - -<sect2> Card -<p> - Pick your card from the list. -<p> - If there are README files that may pertain to your card - the 'Read README file' button will then be usable (i.e. not - greyed out). - Please read them. -<p> - If your card is not in the list, or if there are any - special settings listed in the README file as required - by your card, you can press the 'Detailed Setup' - button to make sure that the required settings are selected. - Otherwise, you're finished with configuring your card. -<p> - To use 'Detailed Setup': - First select the appropriate server for your card. - Then read the README file corresponding to the selected - server by pressing the 'Read README file' button - (it won't do anything, if there is no README). -<p> - Next, pick the chipset, and Ramdac of your card, if - directed by the README file. - In most cases, you don't need to select these, - as the server will detect (probe) them automatically. -<p> - The clockchip should generally be picked, if your card - has one, as these are often impossible to probe - (the exception is when the clockchip is built - into one of the other chips). -<p> - Choose whatever options are appropriate (again, - according to the README). -<p> - You can also set the maximum speed of your Ramdac. - Some Ramdacs are available with various speed ratings. - The max speed cannot be detected by the server - so it will use the speed rating of the slowest version - of the specified Ramdac, if you don't specify one. -<p> - Additionally, you can also specify the amount of RAM on your - card, though the server will usually be able to detect this. - - -<sect2> Modeselect -<p> - Use this one to pick which depth you prefer to use (this - determines how many colors can be displayed at a time) - and to select all of the modes you are interested in - possibly using. -<p> - Your hardware may not be able to support all - of depth and mode combinations that can be selected. - Any unsupported combinations will automatically be - rejected by the server when it tries to startup. - Note also that if you select multiple modes, you will - get a virtual screen as large as the largest of the - usable modes. - -<sect2> Monitor -<p> - Enter the horizontal and vertical frequency ranges that your - monitor supports in the corresponding entry boxes near the - top of the screen. - You can enter specific frequencies or ranges of frequencies - (separated by hyphens). - If the monitor supports several different frequencies or - ranges, list them all, separated by commas. -<p> - If you can not find this information in you monitor's manual, - pick one of the choices from the list of common monitor - capabilities. The program will use conservative values - for each of these, so you'll get better performance if you - type in the correct values from your monitor manual. - -<sect2> Other -<p> - You can probably just skip this one. - -<sect2> Completing the configuration -<p> - Once you've finished with the above, press the 'Done' button - and then the 'Okay' button which will appear. You will then - be switched back to text mode. - -<sect1> Back to text mode -<p> - The program will now attempt to start the appropriate server - for your card, with all of the - configuration settings you selected. - If for some reason it is unable to start the server, you have - likely selected an improper setting and will be asked if you - would like to return to the graphical configuration screen - and try again. - -<sect1> The second server -<p> - This is unlikely to happen, but - if when the server starts, the display is unreadable, try - pressing Ctrl-Alt-+ (using the plus on the numeric keypad) - to switch to a different video mode. -<p> - The display will show an entry box and three buttons. -<p> - The first button allows you to run xvidtune to adjust your - video modes. One important point to keep in mind when using - xvidtune is that switching video modes with Ctrl-Alt-+ is - disabled while xvidtune is running. - You must use the 'Next' and 'Prev' buttons to switch modes. - Because of this, you should be careful not to move the mouse - when pressing either of these. If by some chance the mode - you switch to doesn't produce a readable display on your - monitor, you can then just press the mouse button again to - move to the next (hopefully readable) mode. -<p> - The second button causes the settings you've made to be - written to the filename given in the entry box. - After saving the settings a message will appear indicating - that it has finished. Just press the 'Okay' button and - you're done. -<p> - And the third button causes the program to exit without - saving any of the configuration settings. - -<sect1> Ending text -<p> - You are returned to text mode and the program will print a - `Configuration complete.' message. You should now have a - usable configuration file and can start the X server by - whichever method you wish (usually either the 'startx' - command or via 'xdm'). - -<sect> Running <tt>xf86config</tt> -<p> - From a text screen, run the <tt/xf86config/ program. This - program should be run as <it/root/ (although not absolutely - necessary, it will allow xf86config to do more of the work - for you). You can press your interrupt character (usually - Control-C or perhaps Delete), at any time to stop the program, - if you need to. You can just start it over again. - - The <tt/xf86config/ program provides instructions on screen - as to what you need to do. Following are some notes that - document the various stages in the process. They should help - you get through the process quickly and provide some - documentation for those people who like to know what they're - getting themselves into, before running a program. - -<sect1> The intro screen -<p> - First, <tt/xf86config/ begins by telling you a few things like - the fact that it can help you setup an XF86Config file or that - you can do the job yourself with an editor. Just read what - it says and press <sf/Enter/ when done. - -<sect1> Getting your <tt>PATH</tt> right -<p> - The program will next check that you have the directory - <tt>/usr/X11R6</tt> (the standard installation directory) - on your system and tell you that it needs to be in your - <tt/PATH/ environment variable. - - It will also check if you have the - <tt>/usr/X386</tt> directory as used by older (pre 3.0) - versions of XFree86. If by chance you do, it will warn you - that <tt>/usr/X11R6</tt> must be before <tt>/usr/X386</tt> - in your <tt/PATH/. - - If everything is okay, just press Enter and go on, otherwise - press Control-C to exit and make any necessary changes and - restart <tt/xf86config/. - -<sect1> Mouse setup -<p> - Pick the mouse type from the menu and enter the name of the - device to which mouse is connected, as directed. - - If you are using an OS (e.g. SVR4, SCO) that has a built in - mouse driver that the Xserver could use, you'll need to edit - the XF86Config file to setup your mouse, so just pick any - mouse from the list and press enter when asked for the device. - - If you don't know which protocol your mouse uses, you'll just - have to guess (the xf86config program will give you some hints - as to which might be most likely) and then see the - troubleshooting section if it doesn't work when you run the - server. - - The xf86config program has not been updated to allow you to - select the latest mouse protocols, so you may have to edit - the config file by hand after xf86config has finished. - -<sect1> Keyboard setup -<p> - Simply answer yes to the question regarding keyboard setup. - - If there is some reason you need to use the right-alt and - control keys for something else, you can enter no. - -<sect1> Monitor setup -<p> - Setting up a monitor consists of entering the specifications - of your monitor and a description of the model and manufacturer. - - You are first asked for the horizontal sync rate. It is - <bf/VERY/ important to enter the correct value(s) from the - manual. If one of the ranges given matches the rate of your - monitor, then pick it, otherwise pick <tt/custom/ and enter - the values from your manual. - - Next is the vertical refresh rate. Again, it is <bf/VERY/ - important that this parameter be specified correctly. - Enter it in a manner similar to the horizontal sync rate. - - <it>If either rate is mis-specified, it can result in damage - to your monitor.</it> - - Finally, you are asked for an "identifier", your monitor - manufacturer, and model. You can just press enter to - get through these quickly. - -<sect1> Selecting your card -<p> - You are next asked if you would like to view the database of - cards. Picking your card from the list will cause the answers - to the questions in the next two sections to be filled in for - you and so can save a little time. - - If your card does not appear in the list, just press <tt/q/ - and enter to skip on to the next step - where you'll have to - answer the questions yourself. - -<sect1> Server selection -<p> - If you selected your card in the previous step, then server - selection is easy - just use the recommendation from the - database. - - If you have a card which uses one of the chipsets for which a - specific server exists (Mach8, Mach32, Mach64, AGX/XGA, - 8514/A, S3, I128, P9000) you'll want to pick the - <tt/accel/ option. - - Otherwise you'll probably want to use the SVGA server. - - Next, answer yes when the program asks if you want it to - set the symbolic link for you. If you picked the <tt/accel/ - option, you'll also need to indicate which particular - accelerated server to link to. - -<sect1> Screen/Video configuration -<p> - Pick the appropriate option from the list to indicate the - amount of memory on your video card. - - Then you are asked to provide and identifier, the manufacturer, - and the model of your card. You can just press enter to skip - through these, if you wish. - - Next, the program will ask for the type of RAMDAC and Clockchip - on your card. If your card was in the database, you should - just to tell it to use the values from the database. - - If you don't have one of the listed RAMDACs or Clockchips - on your card, just press enter when asked what type you have. - If you do not have a programmable clock chip, the program will - next attempt to probe to find out what clock rates are - supported by your clock chip. - -<sect1> Mode Selection -<p> - Now you get to tell the program which video modes you would - like to be able to run. - - The program will show you the common modes that should work - with your card (some might not work with your monitor, but - if you've correctly specified the monitor's sync rates, the - X server will just ignore them when it runs). - - You could just accept the settings as they are given, but - you'll probably wish to reverse the order. For example, if - you have a card with 1 Meg RAM, it will list the modes - <tscreen><verb> - "640x480" "800x600" "1024x768" for 8bpp - </verb></tscreen> - - Select <tt/1/ to change the settings for 8bpp and the type - <tt/432/ to select the reverse order. - - When you've select the modes, in the order you wish, select - option <tt/4/ to continue. - -<sect1> Creating the <tt>XF86Config</tt> file -<p> - The program will now ask if you would like to write the - configuration settings you've selected to the file - <tt/XF86Config/. Answer yes. - -<sect1> Some final notes -<p> - Lastly, the program tells you that it's finished its part - of this process and counsels you to check the file before - using it. The next section covers the changes that are most - likely to be needed. - -<sect> Fixing the XF86Config file -<p> - Use an editor to look at the <tt/XF86Config/ file. Here are - some things that may need to be changed: - <itemize> - <item>If you are running an operating system which has - built-in mouse support, you'll want to change the - <tt/Pointer/ section. Specifically, you should set - the <tt/Protocol/ to <tt/OSMouse/ (SCO) or <tt/Xqueue/ - (SVR4, some SVR3) and you should remove the <tt/Device/ - line. - <item>If you are running a system with the Xqueue event driver - and would like to use it, change the <tt/Protocol/ - setting in the <tt/Keyboard/ section to <tt/Xqueue/. -<!-- What else should be added here? --> - </itemize> - - Once you are satisfied that the configuration is correct, copy - the XF86Config file to <tt>/usr/X11R6/lib/X11</tt> and run - the 'startx' command. - - You should now have a running X server. If it's running but - the display doesn't look as good as you think it should (i.e. - it doesn't fill the whole screen, it's off-center, it's wrapping - around on one side, etc.) see the section on <tt/xvidtune/. - If there is some other problem, see the troubleshooting section. - -<sect> Running <tt>xvidtune</tt> -<p> - If you need to make adjustments to the video display, - <tt/xvidtune/ is the tool to use. - - Simply enter the command <tt/xvidtune/ from a shell prompt - within an xterm. Read the warning and click on <tt/OK/. - Next click on the <tt/Auto/ button. - - Now click on whatever combination of <tt>Up/Down/Left/Right</tt> - <tt>Shorter/Taller/Wider/Narrower</tt> is need to adjust - the display to your liking. - - If you are using a recent S3-based card there will be some - extra buttons and entries at the bottom (InvertVCLK, EarlySC, - and Blank Delays). These can help solve problems of the - display wrapping around a few pixels. - - Once the display has been adjusted properly, press the <tt/show/ - button to printout the correct <tt/ModeLine/ to put in the - <tt/XF86Config/ to make the server always use the current - display settings. To aid in copying this information to your - XF86Config file, the modeline is also made the current - selection allowing you to just paste it into your editor. - - If you would like to adjust your other modes, you can click - on the <tt/Next/ and <tt/Prev/ buttons to switch modes. - - When you are through using <tt/xvidtune/ simply press on the - <tt/Quit/ button. - -<sect> Troubleshooting -<p> - Since you're reading this, something must not have gone - the way you had hoped (or else you just really enjoy reading). - - Below are listed some common problems that may occur - during configuration and some hints for solving them. - However, there are just too many different combinations - of hardware and software configurations, and, well, just - too many things that can go wrong, for this document - and the tools it documents, to cover every case. - - If after trying the steps in the previous sections and - checking the hints in this section, you still are unable - to get your system working, you'll have to read the full - documentation. Read the README file for your card and - OS (if they exist), the XFree86 Configuration Guide - (README.Config), and the XF86Config man page. - - You should also look at - <url name="the XFree86 FAQ" url="http://www.XFree86.org/FAQ"> - for more up-to-date information, - especially if you are trying to configure a fairly new card. - - If all else fails, you can try posting a message to - comp.windows.x.i386unix or comp.os.linux.x or send email - to XFree86@XFree86.org. - -<sect1> The mouse doesn't move correctly, it stays in one area of the screen -<p> - You've selected the wrong protocol for your mouse. Try a - different one. - -<sect1> The server doesn't start, it says the mouse is busy. -<p> - Well, it's probably right. This most often happens on - Linux systems that have <tt/gpm/ running. Kill the <tt/gpm/ - process and try <tt/startx/ again. - -<sect1> The middle button doesn't work. -<p> - There's no easy answer to this one. It's a lot of trial - and error. You need to make sure you're running the right - protocol for your mouse. - - Many three button mice are "dual protocol" which means that - they have both a 2-button and 3-button mode. The way to get - the mouse to switch into 3-button mode (which usually then - uses MouseSystems protocol) varies between different models. - - You may need to slide a switch on the mouse or hold down the - middle button when starting the server. Other methods of - switching modes can be done by the server, you just have to - find the right combination of settings for your mouse. See - the Pointer section of the XF86Config man page for a complete - list of settings. - -<sect1> The display is shifted to the left/right/top/bottom -<p> - See the section on xvidtune. - -<sect1> I don't appear to have xf86config or xvidtune on my system -<p> - Hmmm. A couple of possibilities: - <enum> - <item>Your <tt/PATH/ is not set correctly. Make sure it includes - the bin directory for the XFree86 binaries (usually, - <tt>/usr/X11R6/bin</tt> - <item>You don't have a complete installation of XFree86. - Go back to wherever you got XFree86 and get the missing - pieces. - </enum> - -<!-- Lots of things still need to be added --> - -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/QStart.sgml,v 3.7 1999/08/23 06:38:51 dawes Exp $ -</verb> - -</article> diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml deleted file mode 100644 index e9f8c6747..000000000 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml +++ /dev/null @@ -1,1428 +0,0 @@ -<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN"> - -<!-- This is the Linux Distribution HOWTO, SGML source -- > -<!-- Eric S. Raymond, esr@snark.thyrsus.com -- > -<!-- The submission address is gregh@sunsite.unc.edu -- > - -<article> - -<title>XFree86 Video Timings HOWTO -<author>Eric S. Raymond <esr@thyrsus.com> -<date>Version 3.0, 8 Aug 1997 - -<abstract> -How to compose a mode line for your card/monitor combination under XFree86. -The XFree86 distribution now includes good facilities for configuring most -standard combinations; this document is mainly useful if you are tuning a -custom mode line for a high-performance monitor or very unusual hardware. -It may also help you in using xvidtune to tweak a standard mode that is -not quite right for your monitor. -</abstract> - -<toc> - -<sect>Disclaimer -<p> - -You use the material herein SOLELY AT YOUR OWN RISK. It is possible -to harm both your monitor and yourself when driving it outside the -manufacturer's specs. Read <ref id="overd" name="Overdriving Your -Monitor"> for detailed cautions. Any damages to you or your monitor -caused by overdriving it are your problem. - -The most up-to-date version of this HOWTO can be found at the <url -url="http://sunsite.unc.edu/LDP" -name="Linux Documentation Project"> web page. - -Please direct comments, criticism, and suggestions for improvement to -<htmlurl url="mailto:esr@thyrsus.com" name="esr@snark.thyrsus.com">. Please do -<em>not</em> send email pleading for a magic solution to your -special monitor problem, as doing so will only burn up my time and -frustrate you -- everything I know about the subject is already in -here. - -<sect>Introduction<label id="intro"> -<p> - -The XFree86 server allows users to configure their video subsystem and thus -encourages best use of existing hardware. This tutorial is intended to help -you learn how to generate your own timing numbers to make optimum use of your -video card and monitor. - -We'll present a method for getting something that works, and then show you how -you can experiment starting from that base to develop settings that optimize -for your taste. - -Starting with XFree86 3.2, XFree86 provides an <bf>XF86Setup</bf>(1) -program that makes it easy to generate a working monitor mode -interactively, without messing with video timing number directly. So -you shouldn't actually need to calculate a base monitor mode in most -cases. Unfortunately, <bf>XF86Setup</bf>(1) has some limitations; it -only knows about standard video modes up to 1280x1024. If you have a -very high-performance monitor capable of 1600x1200 or more you will -still have to compute your base monitor mode yourself. - -Recent versions of XFree86 provide a tool called <bf>xvidtune</bf>(1) -which you will probably find quite useful for testing and tuning -monitor modes. It begins with a gruesome warning about the possible -consequences of mistakes with it. If you pay careful attention to -this document and learn what is behind the pretty numbers in -xvidtune's boxes, you will become able to use xvidtune effectively and -with confidence. - -If you already have a mode that almost works (in particular, if one of -predefined VESA modes gives you a stable display but one that's -displaced right or left, or too small, or too large) you can go -straight to the section on <ref id="fixes" name="Fixing Problems with the -Image">. This will enlighten you on ways to tweak the timing -numbers to achieve particular effects. - -If you have <bf>xvidtune</bf>(1), you'll be able to test new modes on the fly, -without modifying your X configuration files or even rebooting your X server. -Otherwise, XFree86 allows you to hot-key between different modes defined in -Xconfig (see XFree86.man for details). Use this capabilty to save -yourself hassles! When you want to test a new mode, give it a unique -mode label and add it to the <EM>end</EM> of your hot-key list. Leave a -known-good mode as the default to fall back on if the test mode -doesn't work. - -<sect>How Video Displays Work<label id="video"> -<p> - -Knowing how the display works is essential to understanding what numbers to put -in the various fields in the file Xconfig. Those values are used in the lowest -levels of controlling the display by the XFree86 server. - -The display generates a picture from a series of dots. The dots are arranged -from left to right to form lines. The lines are arranged from top to bottom to -form the picture. The dots emit light when they are struck by the electron -beam inside the display. To make the beam strike each dot for an equal amount -of time, the beam is swept across the display in a constant pattern. - -The pattern starts at the top left of the screen, goes across the screen to the -right in a straight line, and stops temporarily on the right side of the -screen. Then the beam is swept back to the left side of the display, but down -one line. The new line is swept from left to right just as the first line was. -This pattern is repeated until the bottom line on the display has been swept. -Then the beam is moved from the bottom right corner of the display to the top -left corner, and the pattern is started over again. - -There is one variation of this scheme known as interlacing: here only -every second line is swept during one half-frame and the others are filled in -in during a second half-frame. - -Starting the beam at the top left of the display is called the beginning of a -frame. The frame ends when the beam reaches the the top left corner again as -it comes from the bottom right corner of the display. A frame is made up of -all of the lines the beam traced from the top of the display to the bottom. - -If the electron beam were on all of the time it was sweeping through the frame, -all of the dots on the display would be illuminated. There would be no black -border around the edges of the display. At the edges of the display the -picture would become distorted because the beam is hard to control there. To -reduce the distortion, the dots around the edges of the display are not -illuminated by the beam even though the beam may be pointing at them. The -viewable area of the display is reduced this way. - -Another important thing to understand is what becomes of the beam when no spot -is being painted on the visible area. The time the beam would have been -illuminating the side borders of the display is used for sweeping the beam back -from the right edge to the left and moving the beam down to the next line. The -time the beam would have been illuminating the top and bottom borders of the -display is used for moving the beam from the bottom-right corner of the display -to the top-left corner. - -The adapter card generates the signals which cause the display to turn on the -electron beam at each dot to generate a picture. The card also controls when -the display moves the beam from the right side to the left and down a line by -generating a signal called the horizontal sync (for synchronization) pulse. -One horizontal sync pulse occurs at the end of every line. The adapter also -generates a vertical sync pulse which signals the display to move the beam to -the top-left corner of the display. A vertical sync pulse is generated near -the end of every frame. - -The display requires that there be short time periods both before and after the -horizontal and vertical sync pulses so that the position of the electron beam -can stabilize. If the beam can't stabilize, the picture will not be steady. - -In a later section, we'll come back to these basics with definitions, -formulas and examples to help you use them. - -<sect>Basic Things to Know about your Display and Adapter<label id="basic"> -<p> - -There are some fundamental things you need to know before hacking an Xconfig -entry. These are: - -<itemize> -<item>your monitor's horizontal and vertical sync frequency options -<item>your video adapter's driving clock frequency, or "dot clock" -<item>your monitor's bandwidth -</itemize> -The monitor sync frequencies: - -The horizontal sync frequency is just the number of times per second the -monitor can write a horizontal scan line; it is the single most important -statistic about your monitor. The vertical sync frequency is the number of -times per second the monitor can traverse its beam vertically. - -Sync frequencies are usually listed on the specifications page of your monitor -manual. The vertical sync frequency number is typically calibrated in Hz -(cycles per second), the horizontal one in KHz (kilocycles per second). The -usual ranges are between 50 and 150Hz vertical, and between 31 and 135KHz -horizontal. - -If you have a multisync monitor, these frequencies will be given as ranges. -Some monitors, especially lower-end ones, have multiple fixed frequencies. -These can be configured too, but your options will be severely limited by the -built-in monitor characteristics. Choose the highest frequency pair for best -resolution. And be careful --- trying to clock a fixed-frequency monitor at a -higher speed than it's designed for can easily damage it. - -Earlier versions of this guide were pretty cavalier about overdriving -multisync monitors, pushing them past their nominal highest vertical -sync frequency in order to get better performance. We have since had more -reasons pointed out to us for caution on this score; we'll cover those under -<ref id="overd" name="Overdriving Your Monitor"> below. - -The card driving clock frequency: - -Your video adapter manual's spec page will usually give you the card's dot -clock (that is, the total number of pixels per second it can write to the -screen). If you don't have this information, the X server will get it for -you. Even if your X locks up your monitor, it will emit a line of clock and -other info to standard output. If you redirect this to a file, it should be -saved even if you have to reboot to get your console back. (Recent versions -of the X servers allsupport a --probeonly option that prints out this -information and exits without actually starting up X or changing the -video mode.) - -Your X startup message should look something like one of the following -examples: - -If you're using XFree86: - -<tscreen><verb> -Xconfig: /usr/X11R6/lib/X11/Xconfig -(**) stands for supplied, (--) stands for probed/default values -(**) Mouse: type: MouseMan, device: /dev/ttyS1, baudrate: 9600 -Warning: The directory "/usr/andrew/X11fonts" does not exist. - Entry deleted from font path. -(**) FontPath set to "/usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/" -(--) S3: card type: 386/486 localbus -(--) S3: chipset: 924 - --- - Chipset -- this is the exact chip type; an early mask of the 86C911 - -(--) S3: chipset driver: s3_generic -(--) S3: videoram: 1024k - ----- - Size of on-board frame-buffer RAM - -(**) S3: clocks: 25.00 28.00 40.00 3.00 50.00 77.00 36.00 45.00 -(**) S3: clocks: 0.00 0.00 79.00 31.00 94.00 65.00 75.00 71.00 - ------------------------------------------------------ - Possible driving frequencies in MHz - -(--) S3: Maximum allowed dot-clock: 110MHz - ------ - Bandwidth -(**) S3: Mode "1024x768": mode clock = 79.000, clock used = 79.000 -(--) S3: Virtual resolution set to 1024x768 -(--) S3: Using a banksize of 64k, line width of 1024 -(--) S3: Pixmap cache: -(--) S3: Using 2 128-pixel 4 64-pixel and 8 32-pixel slots -(--) S3: Using 8 pages of 768x255 for font caching -</verb></tscreen> - -If you're using SGCS or X/Inside X: - -<tscreen><verb> -WGA: 86C911 (mem: 1024k clocks: 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71) ---- ------ ----- -------------------------------------------- - | | | Possible driving frequencies in MHz - | | +-- Size of on-board frame-buffer RAM - | +-- Chip type - +-- Server type -</verb></tscreen> - -Note: do this with your machine unloaded (if at all possible). Because X is -an application, its timing loops can collide with disk activity, rendering the -numbers above inaccurate. Do it several times and watch for the numbers to -stabilize; if they don't, start killing processes until they do. SVr4 users: -the mousemgr process is particularly likely to mess you up. - -In order to avoid the clock-probe inaccuracy, you should clip out the clock -timings and put them in your Xconfig as the value of the Clocks property --- -this suppresses the timing loop and gives X an exact list of the clock values -it can try. Using the data from the example above: - -<tscreen><verb> -wga - Clocks 25 28 40 3 50 77 36 45 0 0 79 31 94 65 75 71 -</verb></tscreen> -On systems with a highly variable load, this may help you avoid mysterious X -startup failures. It's possible for X to come up, get its timings wrong due -to system load, and then not be able to find a matching dot clock in its -config database --- or find the wrong one! - -<sect1>The monitor's video bandwidth: -<p> - -If you're running XFree86, your server will probe your card and tell you -what your highest-available dot clock is. - -Otherwise, your highest available dot clock is approximately the monitor's -video bandwidth. There's a lot of give here, though --- some monitors -can run as much as 30% over their nominal bandwidth. The risks here have -to do with exceeding the monitor's rated vertical-sync frequency; we'll -discuss them in detail below. - -Knowing the bandwidth will enable you to make more intelligent choices -between possible configurations. It may affect your display's visual -quality (especially sharpness for fine details). - -Your monitor's video bandwidth should be included on the manual's spec page. -If it's not, look at the monitor's higest rated resolution. As a rule of -thumb, here's how to translate these into bandwidth estimates (and thus into -rough upper bounds for the dot clock you can use): - -<tscreen><verb> - 640x480 25 - 800x600 36 - 1024x768 65 - 1024x768 interlaced 45 - 1280x1024 110 - 1600x1200 185 -</verb></tscreen> - -BTW, there's nothing magic about this table; these numbers are just -the lowest dot clocks per resolution in the standard XFree86 Modes -database (except for the last, which I interpolated). The bandwidth -of your monitor may actually be higher than the minimum needed for its -top resolution, so don't be afraid to try a dot clock a few MHz -higher. - -Also note that bandwidth is seldom an issue for dot clocks under 65MHz -or so. With an SVGA card and most hi-res monitors, you can't get -anywhere near the limit of your monitor's video bandwidth. The -following are examples: - -<tscreen><verb> - Brand Video Bandwidth - ---------- --------------- - NEC 4D 75Mhz - Nano 907a 50Mhz - Nano 9080i 60Mhz - Mitsubishi HL6615 110Mhz - Mitsubishi Diamond Scan 100Mhz - IDEK MF-5117 65Mhz - IOCOMM Thinksync-17 CM-7126 136Mhz - HP D1188A 100Mhz - Philips SC-17AS 110Mhz - Swan SW617 85Mhz - Viewsonic 21PS 185Mhz -</verb></tscreen> -Even low-end monitors usually aren't terribly bandwidth-constrained for their -rated resolutions. The NEC Multisync II makes a good example --- it can't -even display 800x600 per its spec. It can only display 800x560. For such low -resolutions you don't need high dot clocks or a lot of bandwidth; probably the -best you can do is 32Mhz or 36Mhz, both of them are still not too far from the -monitor's rated video bandwidth of 30Mhz. - -At these two driving frequencies, your screen image may not be as sharp as it -should be, but definitely of tolerable quality. Of course it would be nicer if -NEC Multisync II had a video bandwidth higher than, say, 36Mhz. But this is -not critical for common tasks like text editing, as long as the difference is -not so significant as to cause severe image distortion (your eyes would tell -you right away if this were so). - -<sect1>What these control: -<p> - -The sync frequency ranges of your monitor, together with your video adapter's -dot clock, determine the ultimate resolution that you can use. But it's up to -the driver to tap the potential of your hardware. A superior hardware -combination without an equally competent device driver is a waste of money. -On the other hand, with a versatile device driver but less capable hardware, -you can push the hardware's envelope a little. This is the design philosophy -of XFree86. - -<sect>Interpreting the Basic Specifications<label id="specs"> -<p> - -This section explains what the specifications above mean, and some other -things you'll need to know. First, some definitions. Next to each in parens -is the variable name we'll use for it when doing calculations - -<descrip> -<tag/horizontal sync frequency (HSF)/ - Horizontal scans per second (see above). - -<tag/vertical sync frequency (VSF) / - Vertical scans per second (see above). Mainly important as the upper - limit on your refresh rate. - -<tag/dot clock (DCF)/ - More formally, `driving clock frequency'; The frequency of the - crystal or VCO on your adaptor --- the maximum dots-per-second it can - emit. - -<tag/video bandwidth (VB)/ - The highest frequency you can feed into your monitor's video - input and still expect to see anything discernible. If your adaptor - produces an alternating on/off pattern, its lowest frequency is half - the DCF, so in theory bandwidth starts making sense at DCF/2. For - tolerately crisp display of fine details in the video image, however, - you don't want it much below your highest DCF, and preferably higher. - -<tag/frame length (HFL, VFL)/ - Horizontal frame length (HFL) is the number of dot-clock ticks - needed for your monitor's electron gun to scan one horizontal line, - <em>including the inactive left and right borders</em>. Vertical - frame length (VFL) is the number of scan lines in the - <em>entire</em> image, including the inactive top and bottom - borders. - -<tag/screen refresh rate (RR)/ - The number of times per second your screen is repainted (this is - also called "frame rate"). Higher frequencies are better, as they - reduce flicker. 60Hz is good, VESA-standard 72Hz is better. - Compute it as -<tscreen><verb> - RR = DCF / (HFL * VFL) -</verb></tscreen> - - Note that the product in the denominator is <em>not</em> the same - as the monitor's visible resolution, but typically somewhat larger. - We'll get to the details of this below. - -The rates for which interlaced modes are usually specified (like 87Hz -interlaced) are actually the half-frame rates: an entire screen seems -to have about that flicker frequency for typical displays, but every -single line is refreshed only half as often. - -For calculation purposes we reckon an interlaced display at its -full-frame (refresh) rate, i.e. 43.5Hz. The quality of an interlaced -mode is better than that of a non-interlaced mode with the same -full-frame rate, but definitely worse then the non-interlaced one -corresponding to the half-frame rate. -</descrip> - -<sect1>About Bandwidth: -<p> - -Monitor makers like to advertise high bandwidth because it constrains the -sharpness of intensity and color changes on the screen. A high bandwidth -means smaller visible details. - -Your monitor uses electronic signals to present an image to -your eyes. Such signals always come in in wave form once they are converted -into analog form from digitized form. They can be considered as combinations -of many simpler wave forms each one of which has a fixed frequency, many of -them are in the Mhz range, eg, 20Mhz, 40Mhz, or even 70Mhz. Your monitor -video bandwidth is, effectively, the highest-frequency analog signal it can -handle without distortion. - -For our purposes, bandwidth is mainly important as an approximate cutoff point -for the highest dot clock you can use. - -<sect1>Sync Frequencies and the Refresh Rate: -<p> - -Each horizontal scan line on the display is just the visible portion of a -frame-length scan. At any instant there is actually only one dot active on -the screen, but with a fast enough refresh rate your eye's persistence of -vision enables you to "see" the whole image. - -Here are some pictures to help: - -<code> - _______________________ - | | The horizontal sync frequency - |->->->->->->->->->->-> | is the number of times per - | )| second that the monitor's - |<-----<-----<-----<--- | electron beam can trace - | | a pattern like this - | | - | | - | | - |_______________________| - _______________________ - | ^ | The vertical sync frequency - | ^ | | is the number of times per - | | v | second that the monitor's - | ^ | | electron beam can trace - | | | | a pattern like this - | ^ | | - | | v | - | ^ | | - |_______|_v_____________| -</code> - -Remember that the actual raster scan is a very tight zigzag pattern; that is, -the beam moves left-right and at the same time up-down. - -Now we can see how the dot clock and frame size relates to refresh rate. By -definition, one hertz (hz) is one cycle per second. So, if your horizontal -frame length is HFL and your vertical frame length is VFL, then to cover the -entire screen takes (HFL * VFL) ticks. Since your card emits DCF ticks per -second by definition, then obviously your monitor's electron gun(s) can sweep -the screen from left to right and back and from bottom to top and back DCF / -(HFL * VFL) times/sec. This is your screen's refresh rate, because it's how -many times your screen can be updated (thus <em>refreshed</em>) per second! - -You need to understand this concept to design a configuration which trades off -resolution against flicker in whatever way suits your needs. - -For those of you who handle visuals better than text, here is one: - -<code> - RR VB - | min HSF max HSF | - | | R1 R2 | | -max VSF -+----|------------/----------/---|------+----- max VSF - | |:::::::::::/::::::::::/:::::\ | - | \::::::::::/::::::::::/:::::::\ | - | |::::::::/::::::::::/:::::::::| | - | |:::::::/::::::::::/::::::::::\ | - | \::::::/::::::::::/::::::::::::\ | - | \::::/::::::::::/::::::::::::::| | - | |::/::::::::::/:::::::::::::::| | - | \/::::::::::/:::::::::::::::::\| - | /\:::::::::/:::::::::::::::::::| - | / \:::::::/::::::::::::::::::::|\ - | / |:::::/:::::::::::::::::::::| | - | / \::::/::::::::::::::::::::::| \ -min VSF -+----/-------\--/-----------------------|--\--- min VSF - | / \/ | \ - +--/----------/\------------------------+----\- DCF - R1 R2 \ | \ - min HSF | max HSF - VB -</code> - -This is a generic monitor mode diagram. The x axis of the diagram -shows the clock rate (DCF), the y axis represents the refresh rate -(RR). The filled region of the diagram describes the monitor's -capabilities: every point within this region is a possible video -mode. - -The lines labeled `R1' and `R2' represent a fixed resolutions (such as -640x480); they are meant to illustrate how one resolution can be realized -by many different combinations of dot clock and refresh rate. The R2 -line would represent a higher resolution than R1. - -The top and bottom boundaries of the permitted region are simply -horizontal lines representing the limiting values for the vertical sync -frequency. The video bandwidth is an upper limit to the clock rate and -hence is represented by a vertical line bounding the capability region on -the right. - -Under <ref id="cplot" name="Plotting Monitor Capabilities">) you'll -find a program that will help you plot a diagram like -this (but much nicer, with X graphics) for your individual monitor. -That section also discusses the interesting part; the derivation of -the boundaries resulting from the limits on the horizontal sync -frequency. - -<sect>Tradeoffs in Configuring your System<label id="trade"> -<p> - -Another way to look at the formula we derived above is - -<tscreen><verb> - DCF = RR * HFL * VFL -</verb></tscreen> -That is, your dot clock is fixed. You can use those dots per second to buy -either refresh rate, horizontal resolution, or vertical resolution. If one -of those increases, one or both of the others must decrease. - -Note, though, that your refresh rate cannot be greater than the maximum -vertical sync frequency of your monitor. Thus, for any given monitor at a -given dot clock, there is a minimum product of frame lengths below which you -can't force it. - -In choosing your settings, remember: if you set RR too low, you will get -mugged by screen flicker. - -You probably do not want to pull your refresh rate below 60Hz. This is the -flicker rate of fluorescent lights; if you're sensitive to those, you need -to hang with 72Hz, the VESA ergonomic standard. - -Flicker is very eye-fatiguing, though human eyes are adaptable and peoples' -tolerance for it varies widely. If you face your monitor at a 90% viewing -angle, are using a dark background and a good contrasting color for -foreground, and stick with low to medium intensity, you *may* be comfortable -at as little as 45Hz. - -The acid test is this: open a xterm with pure white back-ground and black -foreground using <TT>xterm -bg white -fg black</TT> and make it so large as -to cover the entire viewable area. Now turn your monitor's intensity to 3/4 of -its maximum setting, and turn your face away from the monitor. Try peeking at -your monitor sideways (bringing the more sensitive peripheral-vision cells into -play). If you don't sense any flicker or if you feel the flickering is -tolerable, then that refresh rate is fine with you. Otherwise you better -configure a higher refresh rate, because that semi-invisible flicker is going -to fatigue your eyes like crazy and give you headaches, even if the screen -looks OK to normal vision. - -For interlaced modes, the amount of flicker depends on more factors -such as the current vertical resolution and the actual screen -contents. So just experiment. You won't want to go much below about -85Hz half frame rate, though. - -So let's say you've picked a minimum acceptable refresh rate. In choosing -your HFL and VFL, you'll have some room for maneuver. - -<sect>Memory Requirements<label id="sizes"> -<p> - -Available frame-buffer RAM may limit the resolution you can achieve on color or -gray-scale displays. It probably isn't a factor on displays that have only two -colors, white and black with no shades of gray in between. - -For 256-color displays, a byte of video memory is required for each visible -dot to be shown. This byte contains the information that determines what mix -of red, green, and blue is generated for its dot. To get the amount of memory -required, multiply the number of visible dots per line by the number of -visible lines. For a display with a resolution of 800x600, this would be 800 -x 600 = 480,000, which is the number of visible dots on the display. This is -also, at one byte per dot, the number of bytes of video memory that are -necessary on your adapter card. - -Thus, your memory requirement will typically be (HR * VR)/1024 Kbytes of VRAM, -rounded up. If you have more memory than strictly required, you'll have extra -for virtual-screen panning. - -However, if you only have 512K on board, then you can't use this -resolution. Even if you have a good monitor, without enough video -RAM, you can't take advantage of your monitor's potential. On the -other hand, if your SVGA has one meg, but your monitor can display at -most 800x600, then high resolution is beyond your reach anyway (see -<ref id="inter" name="Using Interlaced Modes"> for a possible -remedy). - -Don't worry if you have more memory than required; XFree86 will make -use of it by allowing you to scroll your viewable area (see the -Xconfig file documentation on the virtual screen size parameter). -Remember also that a card with 512K bytes of memory really doesn't -have 512,000 bytes installed, it has 512 x 1024 = 524,288 bytes. - -If you're running SGCS X (now called X/Inside) using an S3 card, and -are willing to live with 16 colors (4 bits per pixel), you can set -depth 4 in Xconfig and effectively double the resolution your card can -handle. S3 cards, for example, normally do 1024x768x256. You can -make them do 1280x1024x16 with depth 4. - -<sect>Computing Frame Sizes<label id="frame"> -<p> - -Warning: this method was developed for multisync monitors. It will probably -work with fixed-frequency monitors as well, but no guarantees! - -Start by dividing DCF by your highest available HSF to get a horizontal -frame length. - -For example; suppose you have a Sigma Legend SVGA with a 65MHz dot clock, and -your monitor has a 55KHz horizontal scan frequency. The quantity (DCF / HSF) -is then 1181 (65MHz = 65000KHz; 65000/55 = 1181). - -Now for our first bit of black magic. You need to round this figure to the -nearest multiple of 8. This has to do with the VGA hardware controller used by -SVGA and S3 cards; it uses an 8-bit register, left-shifted 3 bits, for what's -really an 11-bit quantity. Other card types such as ATI 8514/A may not have -this requirement, but we don't know and the correction can't hurt. So round -the usable horizontal frame length figure down to 1176. - -This figure (DCF / HSF rounded to a multiple of 8) is the minimum HFL you can -use. You can get longer HFLs (and thus, possibly, more horizontal dots on the -screen) by setting the sync pulse to produce a lower HSF. But you'll pay with -a slower and more visible flicker rate. - -As a rule of thumb, 80% of the horizontal frame length is available for -horizontal resolution, the visible part of the horizontal scan line (this -allows, roughly, for borders and sweepback time -- that is, the time required -for the beam to move from the right screen edge to the left edge of the next -raster line). In this example, that's 944 ticks. - -Now, to get the normal 4:3 screen aspect ratio, set your vertical resolution -to 3/4ths of the horizontal resolution you just calculated. For this -example, that's 708 ticks. To get your actual VFL, multiply that by 1.05 -to get 743 ticks. - -The 4:3 is not technically magic; nothing prevents you from using a -non-Golden-Section ratio if that will get the best use out of your -screen real estate. It does make figuring frame height and frame -width from the diagonal size convenient, you just multiply the -diagonal by by 0.8 to get width and 0.6 to get height. - -So, HFL=1176 and VFL=743. Dividing 65MHz by the product of the two gives -us a nice, healthy 74.4Hz refresh rate. Excellent! Better than VESA standard! -And you got 944x708 to boot, more than the 800 by 600 you were probably -expecting. Not bad at all! - -You can even improve the refresh rate further, to almost 76 Hz, by using the -fact that monitors can often sync horizontally at 2khz or so higher than rated, -and by lowering VFL somewhat (that is, taking less than 75% of 944 in the -example above). But before you try this "overdriving" maneuver, if you do, -make <em>sure</em> that your monitor electron guns can sync up to 76 Hz -vertical. (the popular NEC 4D, for instance, cannot. It goes only up to 75 Hz -VSF). (See <ref id="overd" name="Overdriving Your Monitor"> for more general -discussion of this issue. ) - -So far, most of this is simple arithmetic and basic facts about raster -displays. Hardly any black magic at all! - -<sect>Black Magic and Sync Pulses<label id="magic"> -<p> - -OK, now you've computed HFL/VFL numbers for your chosen dot clock, found the -refresh rate acceptable, and checked that you have enough VRAM. Now for the -real black magic -- you need to know when and where to place synchronization -pulses. - -The sync pulses actually control the horizontal and vertical scan frequebcies -of the monitor. The HSF and VSF you've pulled off the spec sheet are nominal, -approximate maximum sync frequencies. The sync pulse in the signal from the -adapter card tells the monitor how fast to actually run. - -Recall the two pictures above? Only part of the time required for -raster-scanning a frame is used for displaying viewable image (ie. your -resolution). - -<sect1>Horizontal Sync: -<p> - -By previous definition, it takes HFL ticks to trace the a horizontal scan line. -Let's call the visible tick count (your horizontal screen resolution) HR. Then -Obviously, HR < HFL by definition. For concreteness, let's assume both start -at the same instant as shown below: -<code> - |___ __ __ __ __ __ __ __ __ __ __ __ __ - |_ _ _ _ _ _ _ _ _ _ _ _ | - |_______________________|_______________|_____ - 0 ^ ^ unit: ticks - | ^ ^ | - HR | | HFL - | |<----->| | - |<->| HSP |<->| - HGT1 HGT2 -</code> - -Now, we would like to place a sync pulse of length HSP as shown above, ie, -between the end of clock ticks for display data and the end of clock ticks for -the entire frame. Why so? because if we can achieve this, then your screen -image won't shift to the right or to the left. It will be where it supposed to -be on the screen, covering squarely the monitor's viewable area. - -Furthermore, we want about 30 ticks of "guard time" on either side of the sync -pulse. This is represented by HGT1 and HGT2. In a typical configuration HGT1 -!= HGT2, but if you're building a configuration from scratch, you want to start -your experimentation with them equal (that is, with the sync pulse centered). - -The symptom of a misplaced sync pulse is that the image is displaced on the -screen, with one border excessively wide and the other side of the image -wrapped around the screen edge, producing a white edge line and a band of -"ghost image" on that side. A way-out-of-place vertical sync pulse can -actually cause the image to roll like a TV with a mis-adjusted vertical hold -(in fact, it's the same phenomenon at work). - -If you're lucky, your monitor's sync pulse widths will be documented on its -specification page. If not, here's where the real black magic starts... - -You'll have to do a little trial and error for this part. But most of the -time, we can safely assume that a sync pulse is about 3.5 to 4.0 microsecond -in length. - -For concretness again, let's take HSP to be 3.8 microseconds (which btw, is not -a bad value to start with when experimenting). - -Now, using the 65Mhz clock timing above, we know HSP is equivalent to 247 clock -ticks (= 65 * 10**6 * 3.8 * 10^-6) [recall M=10^6, micro=10^-6] - -Some makers like to quote their horizontal framing parameters as timings rather -than dot widths. You may see the following terms: -<descrip> -<tag/active time (HAT)/ - Corresponds to HR, but in milliseconds. HAT * DCF = HR. -<tag/blanking time (HBT)/ - Corresponds to (HFL - HR), but in milliseconds. HBT * DCF = (HFL - - HR). -<tag/front porch (HFP)/ - This is just HGT1. -<tag/sync time/ - This is just HSP. -<tag/back porch (HBP)/ - This is just HGT2. -</descrip> - -<sect1>Vertical Sync: -<p> - -Going back to the picture above, how do we place the 247 clock ticks as shown -in the picture? - -Using our example, HR is 944 and HFL is 1176. The difference between the two -is 1176 - 944=232 < 247! Obviously we have to do some adjustment here. What -can we do? - -The first thing is to raise 1176 to 1184, and lower 944 to 936. Now the -difference = 1184-936= 248. Hmm, closer. - -Next, instead using 3.8, we use 3.5 for calculating HSP; then, we have -65*3.5=227. Looks better. But 248 is not much higher than 227. It's normally -necessary to have 30 or so clock ticks between HR and the start of SP, and the -same for the end of SP and HFL. AND they have to be multiple of eight! Are we -stuck? - -No. Let's do this, 936 % 8 = 0, (936 + 32) % 8 = 0 too. But 936 + 32 = 968, -968 + 227 = 1195, 1195 + 32 = 1227. Hmm.. this looks not too bad. But it's -not a multiple of 8, so let's round it up to 1232. - -But now we have potential trouble, the sync pulse is no longer placed right in -the middle between h and H any more. Happily, using our calculator we find -1232 - 32 = 1200 is also a multiple of 8 and (1232 - 32) - 968 = 232 -corresponding using a sync pulse of 3.57 micro second long, still -reasonable. - -In addition, 936/1232 ~ 0.76 or 76%, still not far from 80%, so it should be -all right. - -Furthermore, using the current horizontal frame length, we basically ask our -monitor to sync at 52.7khz (= 65Mhz/1232) which is within its capability. No -problems. - -Using rules of thumb we mentioned before, 936*75%=702, This is our new vertical -resolution. 702 * 1.05 = 737, our new vertical frame length. - -Screen refresh rate = 65Mhz/(737*1232)=71.6 Hz. This is still excellent. - -Figuring the vertical sync pulse layout is similar: -<code> - |___ __ __ __ __ __ __ __ __ __ __ __ __ - |_ _ _ _ _ _ _ _ _ _ _ _ | - |_______________________|_______________|_____ - 0 VR VFL unit: ticks - ^ ^ ^ - | | | - |<->|<----->| - VGT VSP -</code> - -We start the sync pulse just past the end of the vertical display data ticks. -VGT is the vertical guard time required for the sync pulse. Most monitors are -comfortable with a VGT of 0 (no guard time) and we'll use that in this -example. A few need two or three ticks of guard time, and it usually doesn't -hurt to add that. - -Returning to the example: since by the defintion of frame length, a vertical -tick is the time for tracing a complete HORIZONTAL frame, therefore in our -example, it is 1232/65Mhz=18.95us. - -Experience shows that a vertical sync pulse should be in the range of 50us and -300us. As an example let's use 150us, which translates into 8 vertical clock -ticks (150us/18.95us~8). - -Some makers like to quote their vertical framing parameters as timings rather -than dot widths. You may see the following terms: - -<descrip> -<tag/active time (VAT)/ - Corresponds to VR, but in milliseconds. VAT * VSF = VR. -<tag/blanking time (VBT)/ - Corresponds to (VFL - VR), but in milliseconds. VBT * VSF = (VFL - VR). -<tag/front porch (VFP)/ - This is just VGT. -<tag/sync time/ - This is just VSP. -<tag/back porch (VBP)/ - This is like a second guard time after the vertical sync pulse. It - is often zero. -</descrip> - -<sect>Putting it All Together<label id="synth"> -<p> - -The Xconfig file Table of Video Modes contains lines of numbers, with each line -being a complete specification for one mode of X-server operation. The fields -are grouped into four sections, the name section, the clock frequency section, -the horizontal section, and the vertical section. - -The name section contains one field, the name of the video mode specified by -the rest of the line. This name is referred to on the "Modes" line of the -Graphics Driver Setup section of the Xconfig file. The name field may be -omitted if the name of a previous line is the same as the current line. - -The dot clock section contains only the dot clock (what we've called DCF) field -of the video mode line. The number in this field specifies what dot clock was -used to generate the numbers in the following sections. - -The horizontal section consists of four fields which specify how each -horizontal line on the display is to be generated. The first field of the -section contains the number of dots per line which will be illuminated to form -the picture (what we've called HR). The second field of the section indicates -at which dot the horizontal sync pulse will begin. The third field indicates -at which dot the horizontal sync pulse will end. The fourth field specifies -the toal horzontal frame length (HFL). - -The vertical section also contains four fields. The first field contains the -number of visible lines which will appear on the display (VR). The second -field indicates the line number at which the vertical sync pulse will begin. -The third field specifies the line number at which the vertical sync pulse will -end. The fourth field contains the total vertical frame length (VFL). - -Example: -<tscreen><verb> - #Modename clock horizontal timing vertical timing - - "752x564" 40 752 784 944 1088 564 567 569 611 - 44.5 752 792 976 1240 564 567 570 600 -</verb></tscreen> -(Note: stock X11R5 doesn't support fractional dot clocks.) - -For Xconfig, all of the numbers just mentioned - the number of illuminated dots -on the line, the number of dots separating the illuminated dots from the -beginning of the sync pulse, the number of dots representing the duration of -the pulse, and the number of dots after the end of the sync pulse - are added -to produce the number of dots per line. The number of horizontal dots must be -evenly divisible by eight. - -Example horizontal numbers: 800 864 1024 1088 - -This sample line has the number of illuminated dots (800) followed by the -number of the dot when the sync pulse starts (864), followed by the number of -the dot when the sync pulse ends (1024), followed by the number of the last dot -on the horizontal line (1088). - -Note again that all of the horizontal numbers (800, 864, 1024, and 1088) are -divisible by eight! This is not required of the vertical numbers. - -The number of lines from the top of the display to the bottom form the frame. -The basic timing signal for a frame is the line. A number of lines will -contain the picture. After the last illuminated line has been displayed, a -delay of a number of lines will occur before the vertical sync pulse is -generated. Then the sync pulse will last for a few lines, and finally the last -lines in the frame, the delay required after the pulse, will be generated. The -numbers that specify this mode of operation are entered in a manner similar to -the following example. - -Example vertical numbers: 600 603 609 630 - -This example indicates that there are 600 visible lines on the display, that -the vertical sync pulse starts with the 603rd line and ends with the 609th, and -that there are 630 total lines being used. - -Note that the vertical numbers don't have to be divisible by eight! - -Let's return to the example we've been working. According to the above, all -we need to do from now on is to write our result into Xconfig as follows: -<tscreen><verb> -<name> DCF HR SH1 SH2 HFL VR SV1 SV2 VFL -</verb></tscreen> -where SH1 is the start tick of the horizontal sync pulse and SH2 is its end -tick; similarly, SV1 is the start tick of the vertical sync pulse and SV2 is -its end tick. -<tscreen><verb> -#name clock horizontal timing vertical timing flag -936x702 65 936 968 1200 1232 702 702 710 737 -</verb></tscreen> -No special flag necessary; this is a non-interlaced mode. Now we are really -done. - -<sect>Overdriving Your Monitor<label id="overd"> -<p> - -You should absolutely <EM>not</EM> try exceeding your monitor's scan -rates if it's a fixed-frequency type. You can smoke your hardware -doing this! There are potentially subtler problems with overdriving a -multisync monitor which you should be aware of. - -Having a pixel clock higher than the monitor's maximum bandwidth is -rather harmless, in contrast. (Note: the theoretical limit of -discernible features is reached when the pixel clock reaches double -the monitor's bandwidth. This is a straightforward application of -Nyquist's Theorem: consider the pixels as a spatially distributed -series of samples of the drive signals and you'll see why.) - -It's exceeding the rated maximum sync frequencies that's problematic. -Some modern monitors might have protection circuitry that shuts the -monitor down at dangerous scan rates, but don't rely on it. In -particular there are older multisync monitors (like the Multisync II) -which use just one horizontal transformer. These monitors will not -have much protection against overdriving them. While you necessarily -have high voltage regulation circuitry (which can be absent in fixed -frequency monitors), it will not necessarily cover every conceivable -frequency range, especially in cheaper models. This not only implies -more wear on the circuitry, it can also cause the screen phosphors to -age faster, and cause more than the specified radiation (including X-rays) -to be emitted from the monitor. - -Another importance of the bandwidth is that the monitor's input -impedance is specified only for that range, and using higher -frequencies can cause reflections probably causing minor screen -interferences, and radio disturbance. - -However, the basic problematic magnitude in question here is the slew -rate (the steepness of the video signals) of the video output drivers, -and that is usually independent of the actual pixel frequency, but -(if your board manufacturer cares about such problems) related -to the maximum pixel frequency of the board. - -So be careful out there... - -<sect>Using Interlaced Modes<label id="inter"> -<p> - -(This section is largely due to David Kastrup -<dak@pool.informatik.rwth-aachen.de>) - -At a fixed dot clock, an interlaced display is going to have -considerably less noticable flicker than a non-interlaced display, if -the vertical circuitry of your monitor is able to support it stably. -It is because of this that interlaced modes were invented in the first -place. - -Interlaced modes got their bad repute because they are inferior to -their non-interlaced companions at the same vertical scan frequency, -VSF (which is what is usually given in advertisements). But they are -definitely superior at the same horizontal scan rate, and that's where -the decisive limits of your monitor/graphics card usually lie. - -At a fixed <EM>refresh rate</EM> (or half frame rate, or VSF) the -interlaced display will flicker more: a 90Hz interlaced display will -be inferior to a 90Hz non-interlaced display. It will, however, need -only half the video bandwidth and half the horizontal scan rate. If -you compared it to a non-interlaced mode with the same dot clock and -the same scan rates, it would be vastly superior: 45Hz non-interlaced -is intolerable. With 90Hz interlaced, I have worked for years with my -Multisync 3D (at 1024x768) and am very satisfied. I'd guess you'd need -at least a 70Hz non-interlaced display for similar comfort. - -You have to watch a few points, though: use interlaced modes only at -high resolutions, so that the alternately lighted lines are close -together. You might want to play with sync pulse widths and positions -to get the most stable line positions. If alternating lines are bright -and dark, interlace will <EM>jump</EM> at you. I have one application that -chooses such a dot pattern for a menu background (XCept, no other -application I know does that, fortunately). I switch to 800x600 for -using XCept because it really hurts my eyes otherwise. - -For the same reason, use at least 100dpi fonts, or other fonts where -horizontal beams are at least two lines thick (for high resolutions, -nothing else will make sense anyhow). - -And of course, never use an interlaced mode when your hardware would -support a non-interlaced one with similar refresh rate. - -If, however, you find that for some resolution you are pushing either -monitor or graphics card to their upper limits, and getting -dissatisfactorily flickery or outwashed (bandwidth exceeded) display, -you might want to try tackling the same resolution using an -interlaced mode. Of course this is useless if the VSF -of your monitor is already close to its limits. - -Design of interlaced modes is easy: do it like a non-interlaced -mode. Just two more considerations are necessary: you need an odd -total number of vertical lines (the last number in your mode line), and -when you specify the "interlace" flag, the actual vertical frame rate -for your monitor doubles. Your monitor needs to support a 90Hz frame -rate if the mode you specified looks like a 45Hz mode apart from the -"Interlace" flag. - -As an example, here is my modeline for 1024x768 interlaced: my -Multisync 3D will support up to 90Hz vertical and 38kHz horizontal. - -<tscreen><verb> -ModeLine "1024x768" 45 1024 1048 1208 1248 768 768 776 807 Interlace -</verb></tscreen> - -Both limits are pretty much exhausted with this mode. Specifying the -same mode, just without the "Interlace" flag, still is almost at the -limit of the monitor's horizontal capacity (and strictly speaking, a -bit under the lower limit of vertical scan rate), but produces an -intolerably flickery display. - -Basic design rules: if you have designed a mode at less than half of -your monitor's vertical capacity, make the vertical total of lines odd -and add the "Interlace" flag. The display's quality should vastly -improve in most cases. - -If you have a non-interlaced mode otherwise exhausting your monitor's -specs where the vertical scan rate lies about 30% or more under the -maximum of your monitor, hand-designing an interlaced mode (probably -with somewhat higher resolution) could deliver superior results, but I -won't promise it. - -<sect>Questions and Answers<label id="answe"> -<p> - - Q. The example you gave is not a standard screen size, can I use it? - - A. Why not? There is NO reason whatsover why you have to use 640x480, -800x600, or even 1024x768. The XFree86 servers let you configure your hardware -with a lot of freedom. It usually takes two to three tries to come up the -right one. The important thing to shoot for is high refresh rate with -reasonable viewing area. not high resolution at the price of eye-tearing -flicker! - - Q. It this the only resolution given the 65Mhz dot clock and 55Khz HSF? - - A. Absolutely not! You are encouraged to follow the general procedure and -do some trial-and-error to come up a setting that's really to your liking. -Experimenting with this can be lots of fun. Most settings may just give you -nasty video hash, but in practice a modern multi-sync monitor is usually not -damaged easily. Be sure though, that your monitor can support the frame -rates of your mode before using it for longer times. - - Beware fixed-frequency monitors! This kind of hacking around can damage -them rather quickly. Be sure you use valid refresh rates for <EM>every</EM> -experiment on them. - - Q. You just mentioned two standard resolutions. In Xconfig, there are many -standard resolutions available, can you tell me whether there's any point in -tinkering with timings? - - A. Absolutely! Take, for example, the "standard" 640x480 listed in the -current Xconfig. It employes 25Mhz driving frequency, frame lengths are 800 -and 525 => refresh rate ~ 59.5Hz. Not too bad. But 28Mhz is a commonly -available driving frequency from many SVGA boards. If we use it to drive -640x480, following the procedure we discussed above, you would get frame -lengths like 812 and 505. Now the refresh rate is raised to 68Hz, a -quite significant improvement over the standard one. - - Q. Can you summarize what we have discussed so far? - - A. In a nutshell: - -<enum> -<item> -for any fixed driving frequency, raising max resolution incurs the penalty -of lowering refresh rate and thus introducing more flicker. -<item> -if high resolution is desirable and your monitor supports it, try to -get a SVGA card that provides a matching dot clock or DCF. The higher, -the better! -</enum> - -<sect>Fixing Problems with the Image.<label id="fixes"> -<p> - -OK, so you've got your X configuration numbers. You put them in Xconfig with -a test mode label. You fire up X, hot-key to the new mode, ... and the image -doesn't look right. What do you do? Here's a list of common problems and how -to fix them. - -(Fixing these minor distortions is where <bf>xvidtune</bf>(1) really shines.) - -You <em>move</em> the image by changing the sync pulse timing. You -<em>scale</em> it by changing the frame length (you need to move the -sync pulse to keep it in the same relative position, otherwise scaling will -move the image as well). Here are some more specific recipes: - -The horizontal and vertical positions are independent. That is, moving the -image horizontally doesn't affect placement vertically, or vice-versa. -However, the same is not quite true of scaling. While changing the horizontal -size does nothing to the vertical size or vice versa, the total change in both -may be limited. In particular, if your image is too large in both dimensions -you will probably have to go to a higher dot clock to fix it. Since this -raises the usable resolution, it is seldom a problem! - -<sect1>The image is displaced to the left or right -<p> - -To fix this, move the horizontal sync pulse. That is, increment or decrement -(by a multiple of 8) the middle two numbers of the horizontal timing section -that define the leading and trailing edge of the horizontal sync pulse. - -If the image is shifted left (right border too large, you want to move -the image to the right) decrement the numbers. If the image is shifted right -(left border too large, you want it to move left) increment the sync pulse. - -<sect1>The image is displaced up or down -<p> - -To fix this, move the vertical sync pulse. That is, increment or decrement the -middle two numbers of the vertical timing section that define the leading and -trailing edge of the vertical sync pulse. - -If the image is shifted up (lower border too large, you want to move the image -down) decrement the numbers. If the image is shifted down (top border too -large, you want it to move up) increment the numbers. - -<sect1>The image is too large both horizontally and vertically -<p> - -Switch to a higher card clock speed. If you have multiple modes in your -clock file, possibly a lower-speed one is being activated by mistake. - -<sect1>The image is too wide (too narrow) horizontally -<p> - -To fix this, increase (decrease) the horizontal frame length. That is, change -the fourth number in the first timing section. To avoid moving the image, also -move the sync pulse (second and third numbers) half as far, to keep it in the -same relative position. - -<sect1>The image is too deep (too shallow) vertically -<p> - -To fix this, increase (decrease) the vertical frame length. That is, change -the fourth number in the second timing section. To avoid moving the image, -also move the sync pulse (second and third numbers) half as far, to keep it in -the same relative position. - -Any distortion that can't be handled by combining these techniques is probably -evidence of something more basically wrong, like a calculation mistake or a -faster dot clock than the monitor can handle. - -Finally, remember that increasing either frame length will decrease your -refresh rate, and vice-versa. - -<sect>Plotting Monitor Capabilities<label id="cplot"> -<p> - -To plot a monitor mode diagram, you'll need the gnuplot package (a -freeware plotting language for UNIX-like operating systems) and the -tool <TT>modeplot</TT>, a shell/gnuplot script to plot the diagram from your -monitor characteristics, entered as command-line options. - -Here is a copy of modeplot: - -<code> -#!/bin/sh -# -# modeplot -- generate X mode plot of available monitor modes -# -# Do `modeplot -?' to see the control options. -# -# (Id: video-modes.sgml,v 1.2 1997/08/08 15:07:24 esr Exp $) - -# Monitor description. Bandwidth in MHz, horizontal frequencies in kHz -# and vertical frequencies in Hz. -TITLE="Viewsonic 21PS" -BANDWIDTH=185 -MINHSF=31 -MAXHSF=85 -MINVSF=50 -MAXVSF=160 -ASPECT="4/3" -vesa=72.5 # VESA-recommended minimum refresh rate - -while [ "$1" != "" ] -do - case $1 in - -t) TITLE="$2"; shift;; - -b) BANDWIDTH="$2"; shift;; - -h) MINHSF="$2" MAXHSF="$3"; shift; shift;; - -v) MINVSF="$2" MAXVSF="$3"; shift; shift;; - -a) ASPECT="$2"; shift;; - -g) GNUOPTS="$2"; shift;; - -?) cat <<EOF -modeplot control switches: - --t "<description>" name of monitor defaults to "Viewsonic 21PS" --b <nn> bandwidth in MHz defaults to 185 --h <min> <max> min & max HSF (kHz) defaults to 31 85 --v <min> <max> min & max VSF (Hz) defaults to 50 160 --a <aspect ratio> aspect ratio defaults to 4/3 --g "<options>" pass options to gnuplot - -The -b, -h and -v options are required, -a, -t, -g optional. You can -use -g to pass a device type to gnuplot so that (for example) modeplot's -output can be redirected to a printer. See gnuplot(1) for details. - -The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on -analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de> - -This is modeplot Revision: 1.2 $ -EOF - exit;; - esac - shift -done - -gnuplot $GNUOPTS <<EOF -set title "$TITLE Mode Plot" - -# Magic numbers. Unfortunately, the plot is quite sensitive to changes in -# these, and they may fail to represent reality on some monitors. We need -# to fix values to get even an approximation of the mode diagram. These come -# from looking at lots of values in the ModeDB database. -F1 = 1.30 # multiplier to convert horizontal resolution to frame width -F2 = 1.05 # multiplier to convert vertical resolution to frame height - -# Function definitions (multiplication by 1.0 forces real-number arithmetic) -ac = (1.0*$ASPECT)*F1/F2 -refresh(hsync, dcf) = ac * (hsync**2)/(1.0*dcf) -dotclock(hsync, rr) = ac * (hsync**2)/(1.0*rr) -resolution(hv, dcf) = dcf * (10**6)/(hv * F1 * F2) - -# Put labels on the axes -set xlabel 'DCF (MHz)' -set ylabel 'RR (Hz)' 6 # Put it right over the Y axis - -# Generate diagram -set grid -set label "VB" at $BANDWIDTH+1, ($MAXVSF + $MINVSF) / 2 left -set arrow from $BANDWIDTH, $MINVSF to $BANDWIDTH, $MAXVSF nohead -set label "max VSF" at 1, $MAXVSF-1.5 -set arrow from 0, $MAXVSF to $BANDWIDTH, $MAXVSF nohead -set label "min VSF" at 1, $MINVSF-1.5 -set arrow from 0, $MINVSF to $BANDWIDTH, $MINVSF nohead -set label "min HSF" at dotclock($MINHSF, $MAXVSF+17), $MAXVSF + 17 right -set label "max HSF" at dotclock($MAXHSF, $MAXVSF+17), $MAXVSF + 17 right -set label "VESA $vesa" at 1, $vesa-1.5 -set arrow from 0, $vesa to $BANDWIDTH, $vesa nohead # style -1 -plot [dcf=0:1.1*$BANDWIDTH] [$MINVSF-10:$MAXVSF+20] \ - refresh($MINHSF, dcf) notitle with lines 1, \ - refresh($MAXHSF, dcf) notitle with lines 1, \ - resolution(640*480, dcf) title "640x480 " with points 2, \ - resolution(800*600, dcf) title "800x600 " with points 3, \ - resolution(1024*768, dcf) title "1024x768 " with points 4, \ - resolution(1280*1024, dcf) title "1280x1024" with points 5, \ - resolution(1600*1280, dcf) title "1600x1200" with points 6 - -pause 9999 -EOF -</code> - -Once you know you have <TT>modeplot</TT> and the gnuplot package in -place, you'll need the following monitor characteristics: - -<itemize> -<item> video bandwidth (VB) -<item> range of horizontal sync frequency (HSF) -<item> range of vertical sync frequency (VSF) -</itemize> - -The plot program needs to make some simplifying assumptions which are -not necessarily correct. This is the reason why the resulting diagram is -only a rough description. These assumptions are: - -<enum> -<item> All resolutions have a single fixed aspect ratio AR = HR/VR. -Standard resolutions have AR = 4/3 or AR = 5/4. The <TT>modeplot</TT> -programs assumes 4/3 by default, but you can override this. -<item> For the modes considered, horizontal and vertical frame lengths are -fixed multiples of horizontal and vertical resolutions, respectively: - -<tscreen><verb> - HFL = F1 * HR - VFL = F2 * VR -</verb></tscreen> -</enum> - -As a rough guide, take F1 = 1.30 and F2 = 1.05 (see <ref id=frame> -"Computing Frame Sizes"). - -Now take a particular sync frequency, HSF. Given the assumptions just -presented, every value for the clock rate DCF already determines the -refresh rate RR, i.e. for every value of HSF there is a function RR(DCF). -This can be derived as follows. - -The refresh rate is equal to the clock rate divided by the product of the -frame sizes: - -<tscreen><verb> - RR = DCF / (HFL * VFL) (*) -</verb></tscreen> - -On the other hand, the horizontal frame length is equal to the clock rate -divided by the horizontal sync frequency: - -<tscreen><verb> - HFL = DCF / HSF (**) -</verb></tscreen> - -VFL can be reduced to HFL be means of the two assumptions above: - -<tscreen><verb> - VFL = F2 * VR - = F2 * (HR / AR) - = (F2/F1) * HFL / AR (***) -</verb></tscreen> - -Inserting (**) and (***) into (*) we obtain: - -<tscreen><verb> - RR = DCF / ((F2/F1) * HFL**2 / AR) - = (F1/F2) * AR * DCF * (HSF/DCF)**2 - = (F1/F2) * AR * HSF**2 / DCF -</verb></tscreen> - -For fixed HSF, F1, F2 and AR, this is a hyperbola in our diagram. Drawing -two such curves for minimum and maximum horizontal sync frequencies we -have obtained the two remaining boundaries of the permitted region. - -The straight lines crossing the capability region represent particular -resolutions. This is based on (*) and the second assumption: - -<tscreen><verb> - RR = DCF / (HFL * VFL) = DCF / (F1 * HR * F2 * VR) -</verb></tscreen> - -By drawing such lines for all resolutions one is interested in, one -can immediately read off the possible relations between resolution, -clock rate and refresh rate of which the monitor is capable. Note that -these lines do not depend on monitor properties, but they do depend on -the second assumption. - -The <TT>modeplot</TT> tool provides you with an easy way to do this. Do -<TT>modeplot -?</TT> to see its control options. A typical invocation -looks like this: - -<tscreen><verb> - modeplot -t "Swan SW617" -b 85 -v 50 90 -h 31 58 -</verb></tscreen> - -The -b option specifies video bandwidth; -v and -h set horizontal and -vertical sync frequency ranges. - -When reading the output of <TT>modeplot</TT>, always bear in mind that -it gives only an approximate description. For example, it disregards -limitations on HFL resulting from a minimum required sync pulse width, -and it can only be accurate as far as the assumptions are. It is -therefore no substitute for a detailed calculation (involving some -black magic) as presented in <ref id="synth" name="Putting it All -Together">. However, it should give you a better feeling for what -is possible and which tradeoffs are involved. - -<sect>Credits<label id="credi"> -<p> - -The original ancestor of this document was by Chin Fang -<fangchin@leland.stanford.edu>. - -Eric S. Raymond <esr@snark.thyrsus.com> reworked, reorganized, and -massively rewrote Chin Fang's original in an attempt to understand it. In -the process, he merged in most of a different how-to by Bob Crosson -<crosson@cam.nist.gov>. - -The material on interlaced modes is largely by David Kastrup -<dak@pool.informatik.rwth-aachen.de> - -Martin Lottermoser <Martin.Lottermoser@mch.sni.de> contributed -the idea of using gnuplot to make mode diagrams and did the -mathematical analysis behind <TT>modeplot</TT>. The distributed -<TT>modeplot</TT> was redesigned and generalized by ESR from -Martin's original gnuplot code for one case. -<verb> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/VidModes.sgml,v 3.16 2000/02/23 20:30:16 dawes Exp $ - - - - - -$XConsortium: VidModes.sgml /main/7 1996/02/21 17:46:17 kaleb $ -</verb> - -</article> - -<!-- -The following sets edit modes for GNU EMACS -Local Variables: -fill-prefix:"\t" -fill-column:75 -End: --- > diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c index a5d63c30f..5762026cd 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.14 2001/05/10 16:48:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.17 2001/08/07 07:04:42 keithp Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> * @@ -113,29 +113,30 @@ static const OptionInfoRec ARKOptions[] = { }; static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; static const char *vgaHWSymbols[] = { - "vgaHWGetHWRec", "vgaHWFreeHWRec", + "vgaHWGetHWRec", "vgaHWGetIOBase", - "vgaHWSave", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWLock", "vgaHWProtect", "vgaHWRestore", - "vgaHWMapMem", - "vgaHWUnmapMem", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWLock", + "vgaHWUnlock", + "vgaHWUnmapMem", NULL }; static const char *xaaSymbols[] = { "XAACreateInfoRec", - "XAADestroyInfoRec", "XAAInit", - "XAAScreenIndex", NULL }; @@ -483,11 +484,18 @@ static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags) xf86PrintModes(pScrn); xf86SetDpi(pScrn, 0, 0); - xf86LoadSubModule(pScrn, "fb"); - xf86LoaderReqSymbols("fbScreenInit", NULL); + if (!xf86LoadSubModule(pScrn, "fb")) { + ARKFreeRec(pScrn); + return FALSE; + } + + xf86LoaderReqSymLists(fbSymbols, NULL); if (!pARK->NoAccel) { - xf86LoadSubModule(pScrn, "xaa"); + if (!xf86LoadSubModule(pScrn, "xaa")) { + ARKFreeRec(pScrn); + return FALSE; + } xf86LoaderReqSymLists(xaaSymbols, NULL); } @@ -536,8 +544,6 @@ static Bool ARKScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; - fbPictureInit (pScreen, 0, 0); - xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -556,6 +562,9 @@ static Bool ARKScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, } } + /* must be after RGB order fixed */ + + fbPictureInit (pScreen, 0, 0); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -819,7 +828,6 @@ static Bool ARKModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* set display FIFO threshold */ { int threshold; - unsigned char tmp; int bandwidthused, percentused; /* mostly guesses here as I would need to know more about @@ -1067,6 +1075,7 @@ static void ARKUnmapMem(ScrnInfoPtr pScrn) { ARKPtr pARK = ARKPTR(pScrn); + /* XXX vgaHWMapMem() isn't called explicitly, so is this correct? */ vgaHWUnmapMem(pScrn); xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pARK->FBBase, @@ -1092,6 +1101,8 @@ Bool ARKCloseScreen(int scrnIndex, ScreenPtr pScreen) pScrn->vtSema = FALSE; pScreen->CloseScreen = pARK->CloseScreen; + /* XXX Shouldn't XAADestroyInfoRec() be called? */ + return (*pScreen->CloseScreen)(scrnIndex, pScreen); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c index 42d52a061..662917d88 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.5 2001/01/06 20:58:05 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.6 2001/05/25 02:44:35 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -87,9 +87,9 @@ ATIDGASetMode DGAModePtr pDGAMode ) { - ATIPtr pATI = ATIPTR(pScreenInfo); + ATIPtr pATI = ATIPTR(pScreenInfo); DisplayModePtr pMode; - int scrnIndex = pScreenInfo->pScreen->myNum; + int iScreen = pScreenInfo->scrnIndex; int frameX0, frameY0; if (pDGAMode) @@ -123,11 +123,11 @@ ATIDGASetMode ATIAdjustPreInit(pATI); ATIModePreInit(pScreenInfo, pATI, &pATI->NewHW); - if (!(*pScreenInfo->SwitchMode)(scrnIndex, pMode, 0)) + if (!(*pScreenInfo->SwitchMode)(iScreen, pMode, 0)) return FALSE; if (!pDGAMode) pATI->currentMode = NULL; - (*pScreenInfo->AdjustFrame)(scrnIndex, frameX0, frameY0, 0); + (*pScreenInfo->AdjustFrame)(iScreen, frameX0, frameY0, 0); return TRUE; } @@ -164,18 +164,102 @@ ATIDGAGetViewport return 0; /* There are never any pending requests */ } -static DGAFunctionRec ATIDGAFunctions = +/* + * ATIDGAFillRect -- + * + * This function calls XAA solid fill primitives to fill a rectangle. + */ +static void +ATIDGAFillRect +( + ScrnInfoPtr pScreenInfo, + int x, + int y, + int w, + int h, + unsigned long colour +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; + + (*pXAAInfo->SetupForSolidFill)(pScreenInfo, (int)colour, GXcopy, + (CARD32)(~0)); + (*pXAAInfo->SubsequentSolidFillRect)(pScreenInfo, x, y, w, h); + + if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) + SET_SYNC_FLAG(pXAAInfo); +} + +/* + * ATIDGABlitRect -- + * + * This function calls XAA screen-to-screen copy primitives to copy a + * rectangle. + */ +static void +ATIDGABlitRect +( + ScrnInfoPtr pScreenInfo, + int xSrc, + int ySrc, + int w, + int h, + int xDst, + int yDst +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; + int xdir = ((xSrc < xDst) && (ySrc == yDst)) ? -1 : 1; + int ydir = (ySrc < yDst) ? -1 : 1; + + (*pXAAInfo->SetupForScreenToScreenCopy)(pScreenInfo, + xdir, ydir, GXcopy, (CARD32)(~0), -1); + (*pXAAInfo->SubsequentScreenToScreenCopy)(pScreenInfo, + xSrc, ySrc, xDst, yDst, w, h); + + if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) + SET_SYNC_FLAG(pXAAInfo); +} + +/* + * ATIDGABlitTransRect -- + * + * This function calls XAA screen-to-screen copy primitives to transparently + * copy a rectangle. + */ +static void +ATIDGABlitTransRect +( + ScrnInfoPtr pScreenInfo, + int xSrc, + int ySrc, + int w, + int h, + int xDst, + int yDst, + unsigned long colour +) { - ATIDGAOpenFramebuffer, - NULL, /* CloseFramebuffer */ - ATIDGASetMode, - ATIDGASetViewport, - ATIDGAGetViewport, - NULL, /* Sync */ - NULL, /* FillRect */ - NULL, /* BlitRect */ - NULL, /* BlitTransRect */ -}; + ATIPtr pATI = ATIPTR(pScreenInfo); + XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; + int xdir = ((xSrc < xDst) && (ySrc == yDst)) ? -1 : 1; + int ydir = (ySrc < yDst) ? -1 : 1; + + pATI->XAAForceTransBlit = TRUE; + + (*pXAAInfo->SetupForScreenToScreenCopy)(pScreenInfo, + xdir, ydir, GXcopy, (CARD32)(~0), (int)colour); + + pATI->XAAForceTransBlit = FALSE; + + (*pXAAInfo->SubsequentScreenToScreenCopy)(pScreenInfo, + xSrc, ySrc, xDst, yDst, w, h); + + if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) + SET_SYNC_FLAG(pXAAInfo); +} /* * ATIDGAAddModes -- @@ -187,6 +271,7 @@ ATIDGAAddModes ( ScrnInfoPtr pScreenInfo, ATIPtr pATI, + int flags, int depth, int bitsPerPixel, int redMask, @@ -237,13 +322,13 @@ ATIDGAAddModes /* Fill in the mode structure */ pDGAMode->mode = pMode; - pDGAMode->flags = DGA_CONCURRENT_ACCESS; + pDGAMode->flags = flags; if (bitsPerPixel == pScreenInfo->bitsPerPixel) { pDGAMode->flags |= DGA_PIXMAP_AVAILABLE; pDGAMode->address = pATI->pMemory; - if (pATI->OptionAccel) + if (pATI->pXAAInfo) pDGAMode->flags &= ~DGA_CONCURRENT_ACCESS; } if ((pMode->Flags & V_DBLSCAN) || (pMode->VScan > 1)) @@ -305,6 +390,9 @@ ATIDGAInit ATIPtr pATI ) { + XAAInfoRecPtr pXAAInfo; + int flags; + if (!pATI->nDGAMode) { @@ -320,40 +408,68 @@ ATIDGAInit #endif /* AVOID_CPIO */ - ATIDGAAddModes(pScreenInfo, pATI, + /* Set up DGA callbacks */ + pATI->ATIDGAFunctions.OpenFramebuffer = ATIDGAOpenFramebuffer; + pATI->ATIDGAFunctions.SetMode = ATIDGASetMode; + pATI->ATIDGAFunctions.SetViewport = ATIDGASetViewport; + pATI->ATIDGAFunctions.GetViewport = ATIDGAGetViewport; + + flags = 0; + if ((pXAAInfo = pATI->pXAAInfo)) + { + pATI->ATIDGAFunctions.Sync = pXAAInfo->Sync; + if (pXAAInfo->SetupForSolidFill && + pXAAInfo->SubsequentSolidFillRect) + { + flags |= DGA_FILL_RECT; + pATI->ATIDGAFunctions.FillRect = ATIDGAFillRect; + } + if (pXAAInfo->SetupForScreenToScreenCopy && + pXAAInfo->SubsequentScreenToScreenCopy) + { + flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; + pATI->ATIDGAFunctions.BlitRect = ATIDGABlitRect; + pATI->ATIDGAFunctions.BlitTransRect = ATIDGABlitTransRect; + } + } + if (!flags) + flags = DGA_CONCURRENT_ACCESS; + + ATIDGAAddModes(pScreenInfo, pATI, flags, 8, 8, 0, 0, 0, PseudoColor); if ((pATI->Chip >= ATI_CHIP_264CT) && (pATI->Chipset == ATI_CHIPSET_ATI)) { - ATIDGAAddModes(pScreenInfo, pATI, 15, 16, - 0x7C00U, 0x03E0U, 0x001FU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 15, 16, 0x7C00U, 0x03E0U, 0x001FU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, 16, 16, - 0xF800U, 0x07E0U, 0x001FU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 16, 16, 0xF800U, 0x07E0U, 0x001FU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, 24, 24, - 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 24, 24, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); - ATIDGAAddModes(pScreenInfo, pATI, 24, 32, - 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 24, 32, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, TrueColor); if (pATI->DAC != ATI_DAC_INTERNAL) /* Not first revision */ { - ATIDGAAddModes(pScreenInfo, pATI, 15, 16, - 0x7C00U, 0x03E0U, 0x001FU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 15, 16, 0x7C00U, 0x03E0U, 0x001FU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, 16, 16, - 0xF800U, 0x07E0U, 0x001FU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 16, 16, 0xF800U, 0x07E0U, 0x001FU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, 24, 24, - 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 24, 24, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); - ATIDGAAddModes(pScreenInfo, pATI, 24, 32, - 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); + ATIDGAAddModes(pScreenInfo, pATI, flags, + 24, 32, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, DirectColor); } } } - return DGAInit(pScreen, &ATIDGAFunctions, pATI->pDGAMode, pATI->nDGAMode); + return DGAInit(pScreen, &pATI->ATIDGAFunctions, pATI->pDGAMode, + pATI->nDGAMode); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h index e69709149..3cf340f74 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.9 2001/04/16 15:02:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.11 2001/07/21 13:50:22 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -63,6 +63,20 @@ * registers are non-FIFO'ed. * * in8/out8 8-bit counterparts to inr/outr. + * + * For portability reasons, inr/outr/in8/out8 should be used in preference to + * inl/outl/inb/outb to/from any register space starting with CRTC_H_TOTAL_DISP + * but before DST_OFF_PITCH (in the order defined by atiregs.h). None of + * inm/outm/outf should ever be used for these registers. + * + * outf()'s should be grouped together as much as possible, while respecting + * any ordering constraints the engine might impose. Groups larger than 16 + * outf()'s should be split up into two or more groups as needed (but not + * necessarily wanted). The outf() groups that result should be immediately + * preceeded by an ATIMach64WaitForFIFO(n) call, where "n" is the number of + * outf()'s in the group with the exception that groups containing a single + * outf() should not be thus preceeded. This means "n" should not be less than + * 2, nor larger than 16. */ /* @@ -130,7 +144,19 @@ extern void ATIMach64PollEngineStatus FunctionPrototype((ATIPtr)); /* - * MMIO cache definitions + * MMIO cache definitions. + * + * Many FIFO'ed registers can be cached by the driver. Registers that qualify + * for caching must not contain values that can change without driver + * intervention. Thus registers that contain hardware counters, strobe lines, + * etc., cannot be cached. This caching is intended to minimise FIFO use. + * There is therefore not much point to enable it for non-FIFO'ed registers. + * + * The cache for a particular 32-bit register is enabled by coding a + * CacheRegister() line for that register in the ATIMach64Set() function. The + * integrity of the cache for a particular register should be verified by the + * ATIMach64Sync() function. This code should be kept in register order, as + * defined in atiregs.h. */ #define CacheByte(___Register) pATI->MMIOCached[CacheSlotOf(___Register) >> 3] #define CacheBit(___Register) (0x80U >> (CacheSlotOf(___Register) & 0x07U)) @@ -213,4 +239,31 @@ extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8, outr(TV_OUT_DATA, _Value); \ } while (0) +/* + * Block transfer definitions. + */ + +#if defined(GCCUSESGAS) && \ + (defined(i386) || defined(__i386) || defined(__i386__)) + +#define ATIMove32(_pDst, _pSrc, _nCount) \ + do \ + { \ + long d0, d1, d2; \ + __asm__ __volatile__ \ + ( \ + "cld\n\t" \ + "rep ; movsl" \ + : "=&c" (d0), \ + "=&D" (d1), \ + "=&S" (d2) \ + : "0" (_nCount), \ + "1" (_pDst), \ + "2" (_pSrc) \ + : "memory" \ + ); \ + } while (0) + +#endif + #endif /* ___ATIMACH64IO_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h index 4e2f846d3..b9c0aaed7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.13 2001/05/15 10:19:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.14 2001/05/25 02:44:36 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -229,6 +229,12 @@ typedef struct { unsigned long cursor_start; unsigned long cursor_end; + /* + * XAAForceTransBlit is used to change the behavior of the XAA + * SetupForScreenToScreenCopy function, to make it DGA-friendly. + */ + Bool XAAForceTransBlit; + int fifo_slots; /* Free slots in the FIFO (64 max) */ int pix24bpp; /* Depth of pixmap for 24bpp framebuffer */ Bool dac6bits; /* Use 6 bit DAC? */ @@ -257,6 +263,7 @@ typedef struct { int numDGAModes; Bool DGAactive; int DGAViewportStatus; + DGAFunctionRec DGAFuncs; R128FBLayout CurrentLayout; #ifdef XF86DRI 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 b1ace42be..b8dcb3baa 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.9 2001/04/10 16:07:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.11 2001/08/09 19:14:12 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -408,11 +408,17 @@ static void R128SetupForDashedLine(ScrnInfoPtr pScrn, R128CCE_TO_MMIO(pScrn, info); #endif +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +# define PAT_SHIFT(pat,n) pat << n +#else +# define PAT_SHIFT(pat,n) pat >> n +#endif + switch (length) { - case 2: pat |= pat << 2; /* fall through */ - case 4: pat |= pat << 4; /* fall through */ - case 8: pat |= pat << 8; /* fall through */ - case 16: pat |= pat << 16; + case 2: pat |= PAT_SHIFT(pat,2); /* fall through */ + case 4: pat |= PAT_SHIFT(pat,4); /* fall through */ + case 8: pat |= PAT_SHIFT(pat,8); /* fall through */ + case 16: pat |= PAT_SHIFT(pat,16); } R128WaitForFifo(pScrn, 5); @@ -552,7 +558,7 @@ static void R128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, ? R128_DST_Y_TOP_TO_BOTTOM : 0))); - if (trans_color != -1) { + if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { /* Set up for transparency */ R128WaitForFifo(pScrn, 3); OUTREG(R128_CLR_CMP_CLR_SRC, trans_color); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c index d18cb18b6..3e3fc97b7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c,v 1.4 2000/11/21 23:10:33 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dga.c,v 1.5 2001/05/25 02:44:36 tsi Exp $ */ /* * Authors: * Ove Kåven <ovek@transgaming.com>, @@ -23,27 +23,8 @@ static int R128_GetViewport(ScrnInfoPtr); static void R128_SetViewport(ScrnInfoPtr, int, int, int); static void R128_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void R128_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 static void R128_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); -#endif - -static -DGAFunctionRec R128_DGAFuncs = { - R128_OpenFramebuffer, - NULL, - R128_SetMode, - R128_SetViewport, - R128_GetViewport, - R128WaitForIdle, - R128_FillRect, - R128_BlitRect, -#if 0 - R128_BlitTransRect -#else - NULL -#endif -}; + unsigned long); static DGAModePtr @@ -92,12 +73,23 @@ SECOND_PASS: (*num)++; currentMode->mode = pMode; - /* FIXME: is concurrent access really possible? */ currentMode->flags = DGA_CONCURRENT_ACCESS; if(pixmap) currentMode->flags |= DGA_PIXMAP_AVAILABLE; - if(info->accel) - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if(info->accel) { + if(info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + currentMode->flags |= DGA_FILL_RECT; + if(info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) + currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; + + if(currentMode->flags & + (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT | + DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS)) + currentMode->flags &= -DGA_CONCURRENT_ACCESS; + } + if(pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if(pMode->Flags & V_INTERLACE) @@ -213,7 +205,30 @@ R128DGAInit(ScreenPtr pScreen) info->numDGAModes = num; info->DGAModes = modes; - return DGAInit(pScreen, &R128_DGAFuncs, modes, num); + info->DGAFuncs.OpenFramebuffer = R128_OpenFramebuffer; + info->DGAFuncs.CloseFramebuffer = NULL; + info->DGAFuncs.SetMode = R128_SetMode; + info->DGAFuncs.SetViewport = R128_SetViewport; + info->DGAFuncs.GetViewport = R128_GetViewport; + + info->DGAFuncs.Sync = NULL; + info->DGAFuncs.FillRect = NULL; + info->DGAFuncs.BlitRect = NULL; + info->DGAFuncs.BlitTransRect = NULL; + + if (info->accel) { + info->DGAFuncs.Sync = R128WaitForIdle; + if (info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + info->DGAFuncs.FillRect = R128_FillRect; + if (info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) { + info->DGAFuncs.BlitRect = R128_BlitRect; + info->DGAFuncs.BlitTransRect = R128_BlitTransRect; + } + } + + return DGAInit(pScreen, &(info->DGAFuncs), modes, num); } @@ -291,11 +306,11 @@ R128_FillRect ( ){ R128InfoPtr info = R128PTR(pScrn); - if(info->accel) { - (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); - (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); + (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); + (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); + + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) SET_SYNC_FLAG(info->accel); - } } static void @@ -306,21 +321,19 @@ R128_BlitRect( int dstx, int dsty ){ R128InfoPtr info = R128PTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; - if(info->accel) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; + (*info->accel->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, (CARD32)(~0), -1); + (*info->accel->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); - (*info->accel->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, (CARD32)(~0), -1); - (*info->accel->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) SET_SYNC_FLAG(info->accel); - } } -#if 0 static void R128_BlitTransRect( ScrnInfoPtr pScrn, @@ -329,10 +342,23 @@ R128_BlitTransRect( int dstx, int dsty, unsigned long color ){ - /* this one should be separate since the XAA function would - prohibit usage of ~0 as the key */ + R128InfoPtr info = R128PTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + info->XAAForceTransBlit = TRUE; + + (*info->accel->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, (CARD32)(~0), color); + + info->XAAForceTransBlit = FALSE; + + (*info->accel->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); + + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) + SET_SYNC_FLAG(info->accel); } -#endif static Bool 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 d5d70c2b5..3cd54ce57 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.14 2001/05/02 15:06:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.17 2001/08/18 17:25:51 alanh Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -714,7 +714,11 @@ static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen) case PCI_CHIP_RAGE128RF: case PCI_CHIP_RAGE128RG: case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128SM: case PCI_CHIP_RAGE128PF: + case PCI_CHIP_RAGE128TF: + case PCI_CHIP_RAGE128TL: + case PCI_CHIP_RAGE128TR: default: /* This is really an AGP card, force PCI GART mode */ chunk = INREG(R128_BM_CHUNK_0_VAL); 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 c8003be38..2bca10b87 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.29.2.1 2001/05/24 19:43:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.38 2001/08/18 17:25:51 alanh Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -53,7 +53,6 @@ * DDC1 & DDC2 * shadowfb * overlay planes - * DGA * * Modified by Marc Aurele La France <tsi@xfree86.org> for ATI driver merge. */ @@ -186,12 +185,13 @@ R128RAMRec R128RAM[] = { /* Memory Specifications }; static const char *vgahwSymbols[] = { - "vgaHWGetHWRec", "vgaHWFreeHWRec", + "vgaHWGetHWRec", + "vgaHWGetIndex", "vgaHWLock", - "vgaHWUnlock", - "vgaHWSave", "vgaHWRestore", + "vgaHWSave", + "vgaHWUnlock", NULL }; @@ -199,40 +199,38 @@ static const char *fbdevHWSymbols[] = { "fbdevHWInit", "fbdevHWUseBuildinMode", - "fbdevHWGetDepth", "fbdevHWGetVidmem", /* colormap */ "fbdevHWLoadPalette", /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", "fbdevHWModeInit", + "fbdevHWRestore", "fbdevHWSave", + "fbdevHWSwitchMode", + "fbdevHWValidMode", - "fbdevHWUnmapMMIO", - "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", + "fbdevHWUnmapMMIO", + "fbdevHWUnmapVidmem", NULL }; static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", - "xf86DoEDID_DDC2", + "xf86SetDDCproperties", NULL }; -#ifdef XFree86LOADER #ifdef USE_FB static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; @@ -248,25 +246,16 @@ static const char *cfbSymbols[] = { #endif static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", - NULL -}; - -static const char *xf8_32bppSymbols[] = { - "xf86Overlay8Plus32Init", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; @@ -285,39 +274,33 @@ static const char *drmSymbols[] = { "drmAgpUnbind", "drmAgpVendorId", "drmAvailable", - "drmCtlAddCommand", - "drmCtlInstHandler", "drmFreeVersion", - "drmGetInterruptFromBusID", "drmGetVersion", "drmMap", "drmMapBufs", - "drmMarkBufs", "drmR128CleanupCCE", "drmR128InitCCE", "drmR128ResetCCE", "drmR128StartCCE", "drmR128StopCCE", "drmR128WaitForIdleCCE", + "drmScatterGatherAlloc", + "drmScatterGatherFree", "drmUnmap", "drmUnmapBufs", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", - "DRILock", - "DRIUnlock", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", "DRIGetSAREAPrivate", - "DRIGetContext", + "DRILock", "DRIQueryVersion", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; @@ -329,7 +312,14 @@ static const char *vbeSymbols[] = { "vbeFree", NULL }; -#endif + +static const char *int10Symbols[] = { + "xf86InitInt10", + "xf86FreeInt10", + "xf86int10Addr", + NULL +}; + /* Allocate our private R128InfoRec. */ static Bool R128GetRec(ScrnInfoPtr pScrn) @@ -894,8 +884,14 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) case PCI_CHIP_RAGE128RG: case PCI_CHIP_RAGE128RK: case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128SM: case PCI_CHIP_RAGE128PD: case PCI_CHIP_RAGE128PF: + case PCI_CHIP_RAGE128PR: + /* R128 ULTRA can have dual-head and DFP, not support yet */ + case PCI_CHIP_RAGE128TF: + case PCI_CHIP_RAGE128TL: + case PCI_CHIP_RAGE128TR: default: info->HasPanelRegs = FALSE; break; } } @@ -919,25 +915,25 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) config file setting. BIOS_5_SCRATCH holds the display device on flat panel systems only. */ if (info->HasPanelRegs) { - char *display = xf86GetOptValString(info->Options, OPTION_DISPLAY); + char *Display = xf86GetOptValString(info->Options, OPTION_DISPLAY); if (info->FBDev) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Option \"Display\" ignored " "(framebuffer device determines display type)\n"); - else if (!display || !xf86NameCmp(display, "FP")) + else if (!Display || !xf86NameCmp(Display, "FP")) info->BIOSDisplay = R128_BIOS_DISPLAY_FP; - else if (!xf86NameCmp(display, "BIOS")) + else if (!xf86NameCmp(Display, "BIOS")) info->BIOSDisplay = INREG8(R128_BIOS_5_SCRATCH); - else if (!xf86NameCmp(display, "Mirror")) + else if (!xf86NameCmp(Display, "Mirror")) info->BIOSDisplay = R128_BIOS_DISPLAY_FP_CRT; - else if (!xf86NameCmp(display, "CRT")) + else if (!xf86NameCmp(Display, "CRT")) info->BIOSDisplay = R128_BIOS_DISPLAY_CRT; else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unsupported type \"%s\" specified for Option \"Display\".\n" "\tSupported types are: " - "\"BIOS\", \"Mirror\", \"CRT\" and \"FP\"\n", display); + "\"BIOS\", \"Mirror\", \"CRT\" and \"FP\"\n", Display); return FALSE; } } else { @@ -951,6 +947,9 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) switch (info->MemCntl & 0x3) { case 0: /* SDR SGRAM 1:1 */ switch (info->Chipset) { + case PCI_CHIP_RAGE128TF: + case PCI_CHIP_RAGE128TL: + case PCI_CHIP_RAGE128TR: case PCI_CHIP_RAGE128LE: case PCI_CHIP_RAGE128LF: case PCI_CHIP_RAGE128MF: @@ -960,6 +959,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) case PCI_CHIP_RAGE128RG: offset = 0; break; /* 128-bit SDR SGRAM 1:1 */ case PCI_CHIP_RAGE128RK: case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128SM: default: offset = 1; break; /* 64-bit SDR SGRAM 1:1 */ } break; @@ -1025,6 +1025,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) case PCI_CHIP_RAGE128LE: case PCI_CHIP_RAGE128RE: case PCI_CHIP_RAGE128RK: + case PCI_CHIP_RAGE128PR: case PCI_CHIP_RAGE128PD: info->IsPCI = TRUE; break; case PCI_CHIP_RAGE128LF: case PCI_CHIP_RAGE128MF: @@ -1032,7 +1033,11 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn) case PCI_CHIP_RAGE128RF: case PCI_CHIP_RAGE128RG: case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128SM: case PCI_CHIP_RAGE128PF: + case PCI_CHIP_RAGE128TF: + case PCI_CHIP_RAGE128TL: + case PCI_CHIP_RAGE128TR: default: info->IsPCI = FALSE; break; } } @@ -1054,9 +1059,7 @@ static Bool R128PreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) return TRUE; #else if (xf86LoadSubModule(pScrn, "vbe")) { -#ifdef XFree86LOADER xf86LoaderReqSymLists(vbeSymbols,NULL); -#endif pVbe = VBEInit(pInt10,info->pEnt->index); if (!pVbe) return FALSE; @@ -1085,7 +1088,9 @@ static Bool R128PreInitModes(ScrnInfoPtr pScrn) ClockRangePtr clockRanges; int modesFound; char *mod = NULL; +#ifndef USE_FB const char *Sym = NULL; +#endif /* Get mode information */ pScrn->progClock = TRUE; @@ -1139,7 +1144,6 @@ static Bool R128PreInitModes(ScrnInfoPtr pScrn) /* Get ScreenInit function */ #ifdef USE_FB mod = "fb"; - Sym = "fbScreenInit"; #else switch (pScrn->bitsPerPixel) { case 8: mod = "cfb"; Sym = "cfbScreenInit"; break; @@ -1155,9 +1159,10 @@ static Bool R128PreInitModes(ScrnInfoPtr pScrn) } #endif if (mod && !xf86LoadSubModule(pScrn, mod)) return FALSE; - xf86LoaderReqSymbols(Sym, NULL); #ifdef USE_FB - xf86LoaderReqSymbols("fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); +#else + xf86LoaderReqSymbols(Sym, NULL); #endif info->CurrentLayout.displayWidth = pScrn->displayWidth; @@ -1173,6 +1178,7 @@ static Bool R128PreInitCursor(ScrnInfoPtr pScrn) if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); } return TRUE; } @@ -1184,6 +1190,7 @@ static Bool R128PreInitAccel(ScrnInfoPtr pScrn) if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; + xf86LoaderReqSymLists(xaaSymbols, NULL); } return TRUE; } @@ -1194,6 +1201,7 @@ static Bool R128PreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) #if 1 && !defined(__alpha__) /* int10 is broken on some Alphas */ if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); *ppInt10 = xf86InitInt10(info->pEnt->index); } @@ -1331,19 +1339,17 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) R128TRACE(("R128PreInit\n")); -#ifdef XFree86LOADER /* * Tell the loader about symbols from other modules that this module might * refer to. */ - LoaderRefSymLists(vgahwSymbols, + xf86LoaderRefSymLists(vgahwSymbols, #ifdef USE_FB fbSymbols, #else cfbSymbols, #endif xaaSymbols, - xf8_32bppSymbols, ramdacSymbols, #ifdef XF86DRI drmSymbols, @@ -1351,11 +1357,11 @@ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) #endif fbdevHWSymbols, vbeSymbols, - /* ddcsymbols, */ + int10Symbols, + ddcSymbols, /* i2csymbols, */ /* shadowSymbols, */ NULL); -#endif if (pScrn->numEntities != 1) return FALSE; @@ -1636,7 +1642,6 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; - fbPictureInit (pScreen, 0, 0); #else switch (pScrn->bitsPerPixel) { case 8: @@ -1696,8 +1701,10 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } - R128DGAInit(pScreen); - +#ifdef USE_FB + /* must be after RGB order fixed */ + fbPictureInit (pScreen, 0, 0); +#endif /* Memory manager setup */ #ifdef XF86DRI if (info->directRenderingEnabled) { @@ -1933,6 +1940,9 @@ Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) info->accelOn = FALSE; } + /* DGA setup */ + R128DGAInit(pScreen); + /* Cursor setup */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); 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 0e2783916..4ee63dac6 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.10 2001/05/04 19:05:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.15 2001/08/18 17:25:51 alanh Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -80,8 +80,13 @@ SymTabRec R128Chipsets[] = { { PCI_CHIP_RAGE128RG, "ATI Rage 128 RG (AGP)" }, { PCI_CHIP_RAGE128RK, "ATI Rage 128 RK (PCI)" }, { PCI_CHIP_RAGE128RL, "ATI Rage 128 RL (AGP)" }, + { PCI_CHIP_RAGE128SM, "ATI Rage 128 SM (AGP)" }, { PCI_CHIP_RAGE128PD, "ATI Rage 128 Pro PD (PCI)" }, { PCI_CHIP_RAGE128PF, "ATI Rage 128 Pro PF (AGP)" }, + { PCI_CHIP_RAGE128PR, "ATI Rage 128 Pro PR (PCI)" }, + { PCI_CHIP_RAGE128TF, "ATI Rage 128 Pro ULTRA TF (AGP)" }, + { PCI_CHIP_RAGE128TL, "ATI Rage 128 Pro ULTRA TL (AGP)" }, + { PCI_CHIP_RAGE128TR, "ATI Rage 128 Pro ULTRA TR (AGP)" }, { PCI_CHIP_RAGE128LE, "ATI Rage 128 Mobility LE (PCI)" }, { PCI_CHIP_RAGE128LF, "ATI Rage 128 Mobility LF (AGP)" }, { PCI_CHIP_RAGE128MF, "ATI Rage 128 Mobility MF (AGP)" }, @@ -95,8 +100,13 @@ PciChipsets R128PciChipsets[] = { { PCI_CHIP_RAGE128RG, PCI_CHIP_RAGE128RG, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RK, PCI_CHIP_RAGE128RK, RES_SHARED_VGA }, { PCI_CHIP_RAGE128RL, PCI_CHIP_RAGE128RL, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128SM, PCI_CHIP_RAGE128SM, RES_SHARED_VGA }, { PCI_CHIP_RAGE128PD, PCI_CHIP_RAGE128PD, RES_SHARED_VGA }, { PCI_CHIP_RAGE128PF, PCI_CHIP_RAGE128PF, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128PR, PCI_CHIP_RAGE128PR, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TF, PCI_CHIP_RAGE128TF, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TL, PCI_CHIP_RAGE128TL, RES_SHARED_VGA }, + { PCI_CHIP_RAGE128TR, PCI_CHIP_RAGE128TR, RES_SHARED_VGA }, { PCI_CHIP_RAGE128LE, PCI_CHIP_RAGE128LE, RES_SHARED_VGA }, { PCI_CHIP_RAGE128LF, PCI_CHIP_RAGE128LF, RES_SHARED_VGA }, { PCI_CHIP_RAGE128MF, PCI_CHIP_RAGE128MF, RES_SHARED_VGA }, 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 586eec9d4..321495e1d 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.18 2001/03/03 22:26:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.19 2001/08/09 19:14:12 dawes Exp $ */ #include "r128.h" #include "r128_reg.h" @@ -854,9 +854,24 @@ R128PutImage( } nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; - R128CopyData420(buf + s1offset, buf + s2offset, buf + s3offset, - info->FB+d1offset, info->FB+d2offset, info->FB+d3offset, - srcPitch, srcPitch2, dstPitch, nlines, npixels); + { +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned char *R128MMIO = info->MMIO; + CARD32 config_cntl; + + /* We need to disable byte swapping, or the data gets mangled */ + config_cntl = INREG(R128_CONFIG_CNTL); + OUTREG(R128_CONFIG_CNTL, config_cntl & + ~(APER_0_BIG_ENDIAN_16BPP_SWAP|APER_0_BIG_ENDIAN_32BPP_SWAP)); +#endif + R128CopyData420(buf + s1offset, buf + s2offset, buf + s3offset, + info->FB+d1offset, info->FB+d2offset, info->FB+d3offset, + srcPitch, srcPitch2, dstPitch, nlines, npixels); +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* restore byte swapping */ + OUTREG(R128_CONFIG_CNTL, config_cntl); +#endif + } break; case FOURCC_UYVY: case FOURCC_YUY2: diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h index 9b4a3e2be..9c06847fe 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.19 2001/05/04 19:05:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.21 2001/07/25 08:04:43 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -47,6 +47,9 @@ #include "xaa.h" #include "xf86Cursor.h" + /* DDC support */ +#include "xf86DDC.h" + /* Xv support */ #include "xf86xv.h" @@ -136,6 +139,15 @@ typedef struct { /* CRTC2 registers */ CARD32 crtc2_gen_cntl; + CARD32 dac2_cntl; + CARD32 disp_output_cntl; + CARD32 crtc2_h_total_disp; + CARD32 crtc2_h_sync_strt_wid; + CARD32 crtc2_v_total_disp; + CARD32 crtc2_v_sync_strt_wid; + CARD32 crtc2_offset; + CARD32 crtc2_offset_cntl; + CARD32 crtc2_pitch; /* Flat panel registers */ CARD32 fp_crtc_h_total_disp; CARD32 fp_crtc_v_total_disp; @@ -146,6 +158,7 @@ typedef struct { CARD32 fp_v_sync_strt_wid; CARD32 fp_vert_stretch; CARD32 lvds_gen_cntl; + CARD32 lvds_pll_cntl; CARD32 tmds_crc; /* Computed values for PLL */ @@ -159,6 +172,17 @@ typedef struct { CARD32 ppll_div_3; CARD32 htotal_cntl; + /* Computed values for PLL2 */ + CARD32 dot_clock_freq_2; + CARD32 pll_output_freq_2; + int feedback_div_2; + int post_div_2; + + /* PLL2 registers */ + CARD32 p2pll_ref_div; + CARD32 p2pll_div_0; + CARD32 htotal_cntl2; + /* DDA register */ CARD32 dda_config; CARD32 dda_on_off; @@ -166,6 +190,7 @@ typedef struct { /* Pallet */ Bool palette_valid; CARD32 palette[256]; + CARD32 palette2[256]; } RADEONSaveRec, *RADEONSavePtr; typedef struct { @@ -185,6 +210,34 @@ typedef struct { DisplayModePtr mode; } RADEONFBLayout; +typedef enum +{ + MT_NONE, + MT_CRT, + MT_LCD, + MT_DFP, + MT_CTV, + MT_STV +}RADEONMonitorType; + +typedef enum +{ + DDC_NONE_DETECTED, + DDC_MONID, + DDC_DVI, + DDC_VGA, + DDC_CRT2 +}RADEONDDCType; + +typedef enum +{ + CONNECTOR_NONE, + CONNECTOR_PROPRIETARY, + CONNECTOR_CRT, + CONNECTOR_DVI_I, + CONNECTOR_DVI_D +}RADEONConnectorType; + typedef struct { EntityInfoPtr pEnt; pciVideoPtr PciInfo; @@ -207,16 +260,37 @@ typedef struct { unsigned long FbMapSize; /* Size of frame buffer, in bytes */ int Flags; /* Saved copy of mode flags */ -#ifdef ENABLE_FLAT_PANEL - Bool HasPanelRegs; /* Current chip can connect to a FP */ - Bool CRTOnly; /* Only use External CRT instead of FP */ + /****** Added for VE/M6 support *******************/ + RADEONMonitorType DisplayType; /* Monitor connected on*/ + RADEONDDCType DDCType; + RADEONConnectorType ConnectorType; + BOOL HasCRTC2; /* VE/M6/M7 */ + BOOL IsM7; /* M7 chip */ + BOOL IsSecondary; /* second Screen */ + BOOL UseCRT; /* force use CRT port as primary */ + BOOL IsM6; /* M6 card, for some workarounds */ + BOOL SwitchingMode; int FPBIOSstart; /* Start of the flat panel info */ /* Computed values for FPs */ int PanelXRes; int PanelYRes; + int HOverPlus; + int HSyncWidth; + int HBlank; + int VOverPlus; + int VSyncWidth; + int VBlank; int PanelPwrDly; -#endif + /****************************************************/ + + /*for getting EDID data using DDC interface*/ + BOOL ddc_bios; + BOOL ddc1; + BOOL ddc2; + I2CBusPtr pI2CBus; + CARD32 DDCReg; + BOOL HasEDID; RADEONPLLRec pll; RADEONRAMPtr ram; @@ -235,6 +309,12 @@ typedef struct { unsigned long cursor_start; unsigned long cursor_end; + /* + * XAAForceTransBlit is used to change the behavior of the XAA + * SetupForScreenToScreenCopy function, to make it DGA-friendly. + */ + Bool XAAForceTransBlit; + int fifo_slots; /* Free slots in the FIFO (64 max) */ int pix24bpp; /* Depth of pixmap for 24bpp framebuffer */ Bool dac6bits; /* Use 6 bit DAC? */ @@ -263,6 +343,7 @@ typedef struct { int numDGAModes; Bool DGAactive; int DGAViewportStatus; + DGAFunctionRec DGAFuncs; RADEONFBLayout CurrentLayout; #ifdef XF86DRI 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 023dcd3f4..8f82abfd0 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.14 2001/05/02 15:06:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.17 2001/08/17 22:08:13 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -72,6 +72,7 @@ /* Driver data structures */ #include "radeon.h" +#include "radeon_probe.h" #include "radeon_reg.h" #ifdef XF86DRI #define _XF86DRI_SERVER_ @@ -107,6 +108,8 @@ static struct { { RADEON_ROP3_ONE, RADEON_ROP3_ONE } /* GXset */ }; +extern int gRADEONEntityIndex; + /* The FIFO has 64 slots. This routines waits until at least `entries' of these slots are empty. */ void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries) @@ -232,6 +235,7 @@ void RADEONEngineReset(ScrnInfoPtr pScrn) CARD32 clock_cntl_index; CARD32 mclk_cntl; CARD32 rbbm_soft_reset; + CARD32 host_path_cntl; RADEONEngineFlush(pScrn); @@ -246,6 +250,11 @@ void RADEONEngineReset(ScrnInfoPtr pScrn) RADEON_FORCEON_MC | RADEON_FORCEON_AIC)); + /*Soft resetting HDP thru RBBM_SOFT_RESET register can + cause some unexpected behaviour on some machines. + Here we use RADEON_HOST_PATH_CNTL to reset it.*/ + host_path_cntl = INREG(RADEON_HOST_PATH_CNTL); + rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset | @@ -255,8 +264,7 @@ void RADEONEngineReset(ScrnInfoPtr pScrn) RADEON_SOFT_RESET_RE | RADEON_SOFT_RESET_PP | RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB | - RADEON_SOFT_RESET_HDP); + RADEON_SOFT_RESET_RB ); INREG(RADEON_RBBM_SOFT_RESET); OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset & (CARD32) ~(RADEON_SOFT_RESET_CP | @@ -265,13 +273,18 @@ void RADEONEngineReset(ScrnInfoPtr pScrn) RADEON_SOFT_RESET_RE | RADEON_SOFT_RESET_PP | RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB | - RADEON_SOFT_RESET_HDP)); + RADEON_SOFT_RESET_RB )); INREG(RADEON_RBBM_SOFT_RESET); - OUTPLL(RADEON_MCLK_CNTL, mclk_cntl); - OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); + OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl | RADEON_HDP_SOFT_RESET); + INREG(RADEON_HOST_PATH_CNTL); + OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl); + OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); + + OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); + OUTPLL(RADEON_MCLK_CNTL, mclk_cntl); + } /* Restore the acceleration hardware to its previous state. */ @@ -323,6 +336,67 @@ void RADEONEngineRestore(ScrnInfoPtr pScrn) RADEONWaitForIdle(pScrn); } +/* This callback is required for multiheader cards using XAA */ +static +void RADEONRestoreAccelState(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 pitch64; + RADEONEntPtr pRADEONEnt; + DevUnion* pPriv; + + /*xf86DrvMsg(pScrn->scrnIndex, X_INFO, "===>Restore\n");*/ + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + if(pRADEONEnt->IsDRIEnabled) + { + /*not working yet*/ + /* + RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + RADEONCP_TO_MMIO(pRADEONEnt->pPrimaryScrn, info0); + */ + } + pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6; + + OUTREG(RADEON_DEFAULT_OFFSET, (pScrn->fbOffset>>10) | + (pitch64 << 22)); + + /* FIXME: May need to restore other things, + like BKGD_CLK FG_CLK...*/ + + RADEONWaitForIdle(pScrn); + + /*xf86DrvMsg(pScrn->scrnIndex, X_INFO, "<===Restore\n");*/ + +} + +/* This callback is required for multiheader cards using XAA */ +#ifdef XF86DRI +static +void RADEONRestoreCPAccelState(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + /*xf86DrvMsg(pScrn->scrnIndex, X_INFO, "===>RestoreCP\n");*/ + + RADEONWaitForFifo(pScrn, 1); + OUTREG( RADEON_DEFAULT_OFFSET, info->frontPitchOffset); + + RADEONWaitForIdle(pScrn); + + /*Not working yet*/ + /* + RADEONMMIO_TO_CP(pScrn, info); + */ + + /* FIXME: May need to restore other things, + like BKGD_CLK FG_CLK...*/ + +} +#endif + /* Initialize the acceleration hardware. */ static void RADEONEngineInit(ScrnInfoPtr pScrn) { @@ -517,6 +591,7 @@ static void RADEONSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, if (xa < xb) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT; if (ya < yb) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM; + RADEONWaitForFifo(pScrn, 5); if (!(flags & OMIT_LAST)) OUTREG(RADEON_DP_CNTL_XDIR_YDIR_YMAJOR, direction); @@ -554,7 +629,7 @@ static void RADEONSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, ? RADEON_DST_Y_TOP_TO_BOTTOM : 0))); - if (trans_color != -1) { + if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { /* Set up for transparency */ RADEONWaitForFifo(pScrn, 3); OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color); @@ -999,7 +1074,7 @@ static void RADEONCPSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, ADVANCE_RING(); - if ( trans_color != -1 ) { + if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) { BEGIN_RING( 6 ); OUT_RING_REG( RADEON_CLR_CMP_CLR_SRC, trans_color ); @@ -1200,6 +1275,10 @@ static void RADEONCPAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) a->ScreenToScreenCopyFlags = 0; a->SetupForScreenToScreenCopy = RADEONCPSetupForScreenToScreenCopy; a->SubsequentScreenToScreenCopy = RADEONCPSubsequentScreenToScreenCopy; + + if(!info->IsSecondary && xf86IsEntityShared(pScrn->entityList[0])) + a->RestoreAccelState = RADEONRestoreCPAccelState; + } #endif @@ -1271,6 +1350,21 @@ static void RADEONMMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED | LINE_PATTERN_POWER_OF_2_ONLY); + if(xf86IsEntityShared(pScrn->entityList[0])) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + + /*if there are more than one devices sharing this entity, we + have to assign this call back, otherwise the XAA will be + disabled */ + if(pRADEONEnt->HasSecondary || pRADEONEnt->BypassSecondary) + a->RestoreAccelState = RADEONRestoreAccelState; + } + /* ImageWrite */ a->NumScanlineImageWriteBuffers = 1; a->ScanlineImageWriteBuffers = info->scratch_buffer; @@ -1311,8 +1405,12 @@ Bool RADEONAccelInit(ScreenPtr pScreen) RADEONInfoPtr info = RADEONPTR(pScrn); XAAInfoRecPtr a; - if (!(a = info->accel = XAACreateInfoRec())) return FALSE; - + if (!(a = info->accel = XAACreateInfoRec())) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "XAACreateInfoRec Error\n"); + return FALSE; + } #ifdef XF86DRI if (info->directRenderingEnabled) RADEONCPAccelInit(pScrn, a); @@ -1321,5 +1419,12 @@ Bool RADEONAccelInit(ScreenPtr pScreen) RADEONMMIOAccelInit(pScrn, a); RADEONEngineInit(pScrn); - return XAAInit(pScreen, a); + + if(!XAAInit(pScreen, a)) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "XAAInit Error\n"); + return FALSE; + } + return TRUE; } 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 1cf9a2bc6..99bdc79c1 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.5 2001/03/03 22:26:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.7 2001/08/17 22:08:13 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -72,10 +72,19 @@ static void RADEONSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + if(info->IsSecondary) + { + OUTREG(RADEON_CUR2_CLR0, bg); + OUTREG(RADEON_CUR2_CLR1, fg); + } + else + { OUTREG(RADEON_CUR_CLR0, bg); OUTREG(RADEON_CUR_CLR1, fg); + } } + /* Set cursor position to (x,y) with offset into cursor bitmap at (xorigin,yorigin). */ static void RADEONSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) @@ -94,13 +103,31 @@ static void RADEONSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) if (xorigin >= cursor->MaxWidth) xorigin = cursor->MaxWidth - 1; if (yorigin >= cursor->MaxHeight) yorigin = cursor->MaxHeight - 1; + if(x >= 0) + { + if(!info->IsSecondary) + { OUTREG(RADEON_CUR_HORZ_VERT_OFF, (RADEON_CUR_LOCK | (xorigin << 16) | yorigin)); OUTREG(RADEON_CUR_HORZ_VERT_POSN, (RADEON_CUR_LOCK | ((xorigin ? 0 : x) << 16) | (yorigin ? 0 : y))); - OUTREG(RADEON_CUR_OFFSET, info->cursor_start + yorigin * 16); + OUTREG(RADEON_CUR_OFFSET, + info->cursor_start + yorigin * 16); + } + else + { + OUTREG(RADEON_CUR2_HORZ_VERT_OFF, (RADEON_CUR2_LOCK + | (xorigin << 16) + | yorigin)); + OUTREG(RADEON_CUR2_HORZ_VERT_POSN, (RADEON_CUR2_LOCK + | ((xorigin ? 0 : x) << 16) + | (yorigin ? 0 : y))); + OUTREG(RADEON_CUR2_OFFSET, + info->cursor_start + pScrn->fbOffset + yorigin * 16); + } + } } /* Copy cursor image from `image' to video memory. RADEONSetCursorPosition @@ -114,8 +141,16 @@ static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) int y; CARD32 save; + if(!info->IsSecondary) + { save = INREG(RADEON_CRTC_GEN_CNTL); - OUTREG(RADEON_CRTC_GEN_CNTL, save & (CARD32)~RADEON_CRTC_CUR_EN); + OUTREG(RADEON_CRTC_GEN_CNTL, save & (CARD32)~RADEON_CRTC_CUR_EN); + } + else + { + save = INREG(RADEON_CRTC2_GEN_CNTL); + OUTREG(RADEON_CRTC2_GEN_CNTL, save & (CARD32)~RADEON_CRTC2_CUR_EN); + } #if X_BYTE_ORDER == X_BIG_ENDIAN switch(info->CurrentLayout.pixel_bytes) { @@ -170,7 +205,11 @@ static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) *d++ = 0x00000000; } + if(!info->IsSecondary) OUTREG(RADEON_CRTC_GEN_CNTL, save); + else + OUTREG(RADEON_CRTC2_GEN_CNTL, save); + } /* Hide hardware cursor. */ @@ -179,7 +218,11 @@ static void RADEONHideCursor(ScrnInfoPtr pScrn) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + if(info->IsSecondary) + OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~RADEON_CRTC2_CUR_EN); + else OUTREGP(RADEON_CRTC_GEN_CNTL, 0, ~RADEON_CRTC_CUR_EN); + } /* Show hardware cursor. */ @@ -188,7 +231,16 @@ static void RADEONShowCursor(ScrnInfoPtr pScrn) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - OUTREGP(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_CUR_EN, ~RADEON_CRTC_CUR_EN); + if(info->IsSecondary) + { + OUTREGP(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_CUR_EN, + ~RADEON_CRTC2_CUR_EN); + } + else + { + OUTREGP(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_CUR_EN, + ~RADEON_CRTC_CUR_EN); + } } /* Determine if hardware cursor is in use. */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c index 742c557ba..ccf6e482a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c,v 1.5 2000/11/21 23:10:35 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dga.c,v 1.6 2001/05/25 02:44:36 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -57,27 +57,8 @@ static int RADEON_GetViewport(ScrnInfoPtr); static void RADEON_SetViewport(ScrnInfoPtr, int, int, int); static void RADEON_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void RADEON_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 static void RADEON_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); -#endif - -static -DGAFunctionRec RADEON_DGAFuncs = { - RADEON_OpenFramebuffer, - NULL, - RADEON_SetMode, - RADEON_SetViewport, - RADEON_GetViewport, - RADEONWaitForIdle, - RADEON_FillRect, - RADEON_BlitRect, -#if 0 - RADEON_BlitTransRect -#else - NULL -#endif -}; static DGAModePtr RADEONSetupDGAMode(ScrnInfoPtr pScrn, @@ -123,12 +104,22 @@ SECOND_PASS: (*num)++; currentMode->mode = pMode; - /* FIXME: is concurrent access really possible? */ currentMode->flags = DGA_CONCURRENT_ACCESS; if (pixmap) currentMode->flags |= DGA_PIXMAP_AVAILABLE; - if (info->accel) - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if (info->accel) { + if (info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + currentMode->flags |= DGA_FILL_RECT; + if (info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) + currentMode->flags |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS; + + if (currentMode->flags & + (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT | + DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS)) + currentMode->flags &= ~DGA_CONCURRENT_ACCESS; + } if (pMode->Flags & V_DBLSCAN) currentMode->flags |= DGA_DOUBLESCAN; if (pMode->Flags & V_INTERLACE) @@ -239,7 +230,30 @@ Bool RADEONDGAInit(ScreenPtr pScreen) info->numDGAModes = num; info->DGAModes = modes; - return DGAInit(pScreen, &RADEON_DGAFuncs, modes, num); + info->DGAFuncs.OpenFramebuffer = RADEON_OpenFramebuffer; + info->DGAFuncs.CloseFramebuffer = NULL; + info->DGAFuncs.SetMode = RADEON_SetMode; + info->DGAFuncs.SetViewport = RADEON_SetViewport; + info->DGAFuncs.GetViewport = RADEON_GetViewport; + + info->DGAFuncs.Sync = NULL; + info->DGAFuncs.FillRect = NULL; + info->DGAFuncs.BlitRect = NULL; + info->DGAFuncs.BlitTransRect = NULL; + + if (info->accel) { + info->DGAFuncs.Sync = RADEONWaitForIdle; + if (info->accel->SetupForSolidFill && + info->accel->SubsequentSolidFillRect) + info->DGAFuncs.FillRect = RADEON_FillRect; + if (info->accel->SetupForScreenToScreenCopy && + info->accel->SubsequentScreenToScreenCopy) { + info->DGAFuncs.BlitRect = RADEON_BlitRect; + info->DGAFuncs.BlitTransRect = RADEON_BlitTransRect; + } + } + + return DGAInit(pScreen, &info->DGAFuncs, modes, num); } static Bool RADEON_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) @@ -303,11 +317,11 @@ static void RADEON_FillRect(ScrnInfoPtr pScrn, { RADEONInfoPtr info = RADEONPTR(pScrn); - if (info->accel) { - (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); - (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); + (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, (CARD32)(~0)); + (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h); + + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) SET_SYNC_FLAG(info->accel); - } } static void RADEON_BlitRect(ScrnInfoPtr pScrn, @@ -315,28 +329,39 @@ static void RADEON_BlitRect(ScrnInfoPtr pScrn, int dstx, int dsty) { RADEONInfoPtr info = RADEONPTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; - if (info->accel) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; + (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, + GXcopy, (CARD32)(~0), -1); + (*info->accel->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, + dstx, dsty, w, h); - (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, - GXcopy, (CARD32)(~0), -1); - (*info->accel->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, - dstx, dsty, w, h); + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) SET_SYNC_FLAG(info->accel); - } } -#if 0 static void RADEON_BlitTransRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long color) { - /* this one should be separate since the XAA function would prohibit - usage of ~0 as the key */ + RADEONInfoPtr info = RADEONPTR(pScrn); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + info->XAAForceTransBlit = TRUE; + + (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, + GXcopy, (CARD32)(~0), color); + + info->XAAForceTransBlit = FALSE; + + (*info->accel->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, + dstx, dsty, w, h); + + if (pScrn->bitsPerPixel == info->CurrentLayout.bitsPerPixel) + SET_SYNC_FLAG(info->accel); } -#endif static Bool RADEON_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, 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 3edf4a1e4..d1d128940 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.25.2.2 2001/05/31 08:36:15 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.34 2001/08/17 22:08:13 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -133,15 +133,7 @@ typedef enum { OPTION_BUFFER_SIZE, OPTION_DEPTH_MOVE, #endif -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ -#if 0 - /* FIXME: Disable CRTOnly until it is tested */ - OPTION_CRT, -#endif - OPTION_PANEL_WIDTH, - OPTION_PANEL_HEIGHT, -#endif + OPTION_CRT_SCREEN, OPTION_FBDEV } RADEONOpts; @@ -160,15 +152,8 @@ const OptionInfoRec RADEONOptions[] = { { OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_DEPTH_MOVE, "EnableDepthMoves", OPTV_BOOLEAN, {0}, FALSE }, #endif -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ -#if 0 - /* FIXME: Disable CRTOnly until it is tested */ - { OPTION_CRT, "CRTOnly", OPTV_BOOLEAN, {0}, FALSE }, -#endif - { OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE }, - { OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE }, -#endif + { OPTION_CRT_SCREEN, "crt_screen", OPTV_BOOLEAN, {0}, +FALSE}, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -180,12 +165,13 @@ RADEONRAMRec RADEONRAM[] = { /* Memory Specifications }; static const char *vgahwSymbols[] = { - "vgaHWGetHWRec", "vgaHWFreeHWRec", + "vgaHWGetHWRec", + "vgaHWGetIndex", "vgaHWLock", - "vgaHWUnlock", - "vgaHWSave", "vgaHWRestore", + "vgaHWSave", + "vgaHWUnlock", NULL }; @@ -193,41 +179,38 @@ static const char *fbdevHWSymbols[] = { "fbdevHWInit", "fbdevHWUseBuildinMode", - "fbdevHWGetDepth", "fbdevHWGetVidmem", /* colormap */ "fbdevHWLoadPalette", - /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", "fbdevHWModeInit", + "fbdevHWRestore", "fbdevHWSave", + "fbdevHWSwitchMode", + "fbdevHWValidMode", - "fbdevHWUnmapMMIO", - "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", + "fbdevHWUnmapMMIO", + "fbdevHWUnmapVidmem", NULL }; static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", - "xf86DoEDID_DDC2", + "xf86SetDDCproperties", NULL }; -#ifdef XFree86LOADER #ifdef USE_FB static const char *fbSymbols[] = { "fbScreenInit", + "fbPictureInit", NULL }; #else @@ -242,25 +225,23 @@ static const char *cfbSymbols[] = { #endif static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; +#if 0 static const char *xf8_32bppSymbols[] = { "xf86Overlay8Plus32Init", NULL }; +#endif static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; @@ -268,32 +249,46 @@ static const char *ramdacSymbols[] = { static const char *drmSymbols[] = { "drmAddBufs", "drmAddMap", - "drmAvailable", - "drmCtlAddCommand", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", - "drmMapBufs", - "drmMarkBufs", - "drmUnmapBufs", + "drmAgpAcquire", + "drmAgpAlloc", + "drmAgpBind", + "drmAgpDeviceId", + "drmAgpEnable", + "drmAgpFree", + "drmAgpGetMode", + "drmAgpRelease", + "drmAgpUnbind", + "drmAgpVendorId", + "drmDMA", "drmFreeVersion", "drmGetVersion", + "drmMap", + "drmMapBufs", + "drmRadeonCleanupCP", + "drmRadeonClear", + "drmRadeonFlushIndirectBuffer", + "drmRadeonInitCP", + "drmRadeonResetCP", + "drmRadeonStartCP", + "drmRadeonStopCP", + "drmRadeonWaitForIdleCP", + "drmScatterGatherFree" + "drmUnmap", + "drmUnmapBufs", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", - "DRILock", - "DRIUnlock", - "DRIGetSAREAPrivate", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", "DRIGetContext", + "DRIGetSAREAPrivate", + "DRILock", "DRIQueryVersion", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; @@ -304,7 +299,21 @@ static const char *vbeSymbols[] = { "vbeDoEDID", NULL }; -#endif + +static const char *int10Symbols[] = { + "xf86InitInt10", + "xf86FreeInt10", + "xf86int10Addr", + NULL +}; + +static const char *i2cSymbols[] = { + "xf86CreateI2CBusRec", + "xf86I2CBusInit", + NULL +}; + +extern int gRADEONEntityIndex; #if !defined(__alpha__) # define RADEONPreInt10Save(s, r1, r2) @@ -515,9 +524,9 @@ unsigned RADEONINPLL(ScrnInfoPtr pScrn, int addr) unsigned char *RADEONMMIO = info->MMIO; #if !RADEON_ATOMIC_UPDATE - while ( (INREG8(RADEON_CLOCK_CNTL_INDEX) & 0x9f) != addr) { + while ( (INREG8(RADEON_CLOCK_CNTL_INDEX) & 0xbf) != addr) { #endif - OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x1f); + OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x3f); #if !RADEON_ATOMIC_UPDATE } #endif @@ -555,6 +564,15 @@ static void RADEONBlank(ScrnInfoPtr pScrn) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + if(!info->IsSecondary) + { + switch(info->DisplayType) + { + case MT_LCD: + OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, + ~RADEON_LVDS_DISPLAY_DIS); + case MT_CRT: + case MT_DFP: OUTREGP(RADEON_CRTC_EXT_CNTL, RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | @@ -562,6 +580,22 @@ static void RADEONBlank(ScrnInfoPtr pScrn) ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS)); + break; + case MT_NONE: + default: + break; + } + } + else + { + OUTREGP(RADEON_CRTC2_GEN_CNTL, + RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + } } /* Unblank screen. */ @@ -569,12 +603,91 @@ static void RADEONUnblank(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - - OUTREGP(RADEON_CRTC_EXT_CNTL, 0, + if(!info->IsSecondary) + { + switch(info->DisplayType) + { + case MT_LCD: + OUTREGP(RADEON_LVDS_GEN_CNTL, 0, + ~RADEON_LVDS_DISPLAY_DIS); + case MT_CRT: + case MT_DFP: + OUTREGP(RADEON_CRTC_EXT_CNTL, + RADEON_CRTC_CRT_ON, ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS)); + break; + case MT_NONE: + default: + break; + } + } + else + { + switch(info->DisplayType) + { + case MT_LCD: + case MT_DFP: + case MT_CRT: + OUTREGP(RADEON_CRTC2_GEN_CNTL, + 0, + ~(RADEON_CRTC2_DISP_DIS | + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS)); + break; + case MT_NONE: + default: + break; + } + } +} + +/***Used to turn particular crtc or dac off + Not tested, comment out for now*/ +#if 0 +static void RADEONSetDisplayOff(ScrnInfoPtr pScrn, int crtc, int dac) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 tmp; + + if(crtc == 0) /* primary crtc*/ + { + tmp = INREG(RADEON_CRTC_EXT_CNTL); + tmp |= RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_SYNC_TRISTAT; + OUTREG(RADEON_CRTC_EXT_CNTL, tmp); + tmp &= ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_CRT_ON); + OUTREG(RADEON_CRTC_EXT_CNTL, tmp); + /*TODO update BIOS scratch register*/ + } + else /* secondary crtc*/ + { + tmp = INREG(RADEON_CRTC2_GEN_CNTL); + tmp |= RADEON_CRTC2_SYNC_TRISTAT | RADEON_CRTC2_DISP_DIS; + OUTREG(RADEON_CRTC2_GEN_CNTL, tmp); + tmp &= ~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_CRT2_ON); + OUTREG(RADEON_CRTC2_GEN_CNTL, tmp); + /*TODO update BIOS scratch register*/ + } + if(dac == 0) + { + tmp = INREG(RADEON_DAC_CNTL); + tmp |= RADEON_DAC_PDWN; + OUTREG(RADEON_DAC_CNTL, tmp); + } + else + { + tmp = INREG(RADEON_TV_DAC_CNTL); + if(RADEON_TV_DAC_STD_MASK & tmp) + { + tmp |= RADEON_TV_DAC_RDACPD | RADEON_TV_DAC_GDACPD + | RADEON_TV_DAC_BDACPD; + OUTREG(RADEON_TV_DAC_CNTL, tmp); + } + } } +#endif /* Compute log base 2 of val. */ int RADEONMinBits(int val) @@ -596,10 +709,8 @@ static int RADEONDiv(int n, int d) static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { RADEONInfoPtr info = RADEONPTR(pScrn); -#ifdef ENABLE_FLAT_PANEL - int i; - int FPHeader = 0; -#endif + unsigned long tmp, i; + unsigned char *RADEONMMIO; #define RADEON_BIOS8(v) (info->VBIOS[v]) #define RADEON_BIOS16(v) (info->VBIOS[v] | \ @@ -609,19 +720,25 @@ static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) (info->VBIOS[(v) + 2] << 16) | \ (info->VBIOS[(v) + 3] << 24)) - if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) { + if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) + { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot allocate space for hold Video BIOS!\n"); return FALSE; } - if (pInt10) { + + if (pInt10) + { info->BIOSAddr = pInt10->BIOSseg << 4; (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), RADEON_VBIOS_SIZE); - } else { + } + else + { xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, RADEON_VBIOS_SIZE); - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) + { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Video BIOS not detected in PCI space!\n"); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -630,48 +747,218 @@ static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, RADEON_VBIOS_SIZE); } } - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) + { info->BIOSAddr = 0x00000000; xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Video BIOS not found!\n"); } -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) { + info->FPBIOSstart = RADEON_BIOS16(0x48); + + { + BOOL BypassSecondary = FALSE; + RADEONMapMMIO(pScrn); + RADEONMMIO = info->MMIO; + /*FIXME: using BIOS scratch registers to detect connected monitors + may not be a reliable way.... should use EDID data. + Also it only works with for VE/M6, no + such registers in regular RADEON!!!*/ + /***** + VE and M6 have both DVI and CRT ports (for M6 DVI port can be switch to + DFP port). The DVI port can also be conneted to a CRT with an adapter. + Here is the definition of ports for this driver--- + (1) If both port are connected, DVI port will be treated as the Primary + port (first screen in XF86Config, uses CRTC1) and CRT port will be + treated as the Secondary port (second screen in XF86Config, uses CRTC2) + (2) If only one screen specified in XF86Config, it will be used for DVI port + if a monitor is connected to DVI port, otherwise (only one monitor is + connected the CRT port) it will be used for CRT port. + *****/ + if(info->HasCRTC2) + { + /*FIXME: this may not be reliable*/ + tmp = INREG(RADEON_BIOS_4_SCRATCH); + if(info->IsSecondary) + { + /*check Port2 (CRT port, for the existing boards + (VE & M6),this port can only be connected to a CRT*/ + if(tmp & 0x02) info->DisplayType = MT_CRT; + else if(tmp & 0x800) info->DisplayType = MT_DFP; + else if(tmp & 0x400) info->DisplayType = MT_LCD; + else if(tmp & 0x1000) info->DisplayType = MT_CTV; + else if(tmp & 0x2000) info->DisplayType = MT_STV; + else info->DisplayType = MT_CRT; + + if(info->DisplayType > MT_NONE) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->HasSecondary = TRUE; + + } + else return FALSE; + + } + else + { + /*check Primary (DVI/DFP port)*/ + if(tmp & 0x08) info->DisplayType = MT_DFP; + else if(tmp & 0x04) info->DisplayType = MT_LCD; + else if(tmp & 0x0200) info->DisplayType = MT_CRT; + else if(tmp & 0x10) info->DisplayType = MT_CTV; + else if(tmp & 0x20) info->DisplayType = MT_STV; + else + { + /*DVI port has no monitor connected, try CRT port. + If something on CRT port, treat it as primary*/ + if(xf86IsEntityShared(pScrn->entityList[0])) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->BypassSecondary = TRUE; + } + + if(tmp & 0x02) info->DisplayType = MT_CRT; + else if(tmp & 0x800) info->DisplayType = MT_DFP; + else if(tmp & 0x400) info->DisplayType = MT_LCD; + else if(tmp & 0x1000) info->DisplayType = MT_CTV; + else if(tmp & 0x2000) info->DisplayType = MT_STV; + else + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No monitor detected!!!\n"); + return FALSE; + } + BypassSecondary = TRUE; + } + } + } + else + { + /*Regular Radeon ASIC, only one CRTC, but it could be + used for DFP with a DVI output, like AIW board*/ + tmp = INREG(RADEON_FP_GEN_CNTL); + if(tmp & RADEON_FP_EN_TMDS) info->DisplayType = MT_DFP; + else info->DisplayType = MT_CRT; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Display == Type %d\n", + (info->IsSecondary ? "Secondary" : "Primary"), + info->DisplayType); + + RADEONMMIO = NULL; + RADEONUnmapMMIO(pScrn); + + /* Detect connector type from BIOS, used for + I2C/DDC qeurying EDID*/ + tmp = RADEON_BIOS16(info->FPBIOSstart + 0x50); + for(i=1; i<4; i++) + { + if(!RADEON_BIOS8(tmp + i*2) && i>1) break; + + /*Note: our Secondary port (CRT port) + actually uses primary DAC*/ + if(RADEON_BIOS16(tmp + i*2) & 0x01) + { + if(!info->IsSecondary) + { + info->DDCType = + (RADEON_BIOS16(tmp + i*2) & 0x0f00) >> 8; + break; + } + } + else /*Primary DAC*/ + { + if(info->IsSecondary || !info->HasCRTC2 + || BypassSecondary) + { + info->DDCType = + (RADEON_BIOS16(tmp + i*2) & 0x0f00) >> 8; + break; + } + } + } + + /* Note: One card can have multiple output formats */ + /* Note: TV support has not been implemented yet */ + + /***** + if(RADEON_BIOS16(info->FPBIOSstart + 0x32)) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "This card supports TV output\n"); + + if(RADEON_BIOS16(info->FPBIOSstart + 0x34)) + { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "This card supports DFP output\n"); + } + + if(RADEON_BIOS16(info->FPBIOSstart + 0x40)) + { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "This card supports LCD output\n"); + } + ******/ + } + +#if 0 + /*retrieving panel size info from BIOS doesn't quite work at present + */ + if(info->Port1 == MT_LCD) + { + int FPHeader = 0; + int i; info->FPBIOSstart = 0; + return TRUE; /* FIXME: There should be direct access to the start of the FP info tables, but until we find out where that offset is stored, we - must search for the ATI signature string: "M3 ". */ - for (i = 4; i < RADEON_VBIOS_SIZE-8; i++) { + must search for the ATI signature string: "M6 ". */ + for (i = 4; i < RADEON_VBIOS_SIZE-8; i++) + { if (RADEON_BIOS8(i) == 'M' && - RADEON_BIOS8(i+1) == '3' && + RADEON_BIOS8(i+1) == '6' && RADEON_BIOS8(i+2) == ' ' && RADEON_BIOS8(i+3) == ' ' && RADEON_BIOS8(i+4) == ' ' && RADEON_BIOS8(i+5) == ' ' && RADEON_BIOS8(i+6) == ' ' && - RADEON_BIOS8(i+7) == ' ') { + RADEON_BIOS8(i+7) == ' ') + { FPHeader = i-2; break; } } - if (!FPHeader) return TRUE; - + if (!FPHeader) + { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Cannot find Flat Panel Header\n"); + return TRUE; + } /* Assume that only one panel is attached and supported */ - for (i = FPHeader+20; i < FPHeader+84; i += 2) { - if (RADEON_BIOS16(i) != 0) { + for (i = FPHeader+20; i < FPHeader+84; i += 2) + { + if (RADEON_BIOS16(i) != 0) + { info->FPBIOSstart = RADEON_BIOS16(i); break; } } - if (!info->FPBIOSstart) return TRUE; - - if (!info->PanelXRes) + if (!info->FPBIOSstart) + { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Cannot find Flat Panel BIOS Start\n"); + return TRUE; + } info->PanelXRes = RADEON_BIOS16(info->FPBIOSstart+25); - if (!info->PanelYRes) info->PanelYRes = RADEON_BIOS16(info->FPBIOSstart+27); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n", info->PanelXRes, info->PanelYRes); @@ -688,18 +975,34 @@ static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) else ErrorF("Monochrome, "); if (i & 2) ErrorF("Dual(split), "); else ErrorF("Single, "); - switch ((i >> 2) & 0x3f) { - case 0: ErrorF("STN"); break; - case 1: ErrorF("TFT"); break; - case 2: ErrorF("Active STN"); break; - case 3: ErrorF("EL"); break; - case 4: ErrorF("Plasma"); break; - default: ErrorF("UNKNOWN"); break; + switch ((i >> 2) & 0x3f) + { + case 0: + ErrorF("STN"); + break; + case 1: + ErrorF("TFT"); + break; + case 2: + ErrorF("Active STN"); + break; + case 3: + ErrorF("EL"); + break; + case 4: + ErrorF("Plasma"); + break; + default: + ErrorF("UNKNOWN"); + break; } ErrorF("\n"); - if (RADEON_BIOS8(info->FPBIOSstart+61) & 1) { + if (RADEON_BIOS8(info->FPBIOSstart+61) & 1) + { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Interface: LVDS\n"); - } else { + } + else + { /* FIXME: Add Non-LVDS flat pael support */ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Non-LVDS panel interface detected! " @@ -708,7 +1011,6 @@ static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) } } #endif - return TRUE; } @@ -762,7 +1064,7 @@ static Bool RADEONPreInitVisual(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) + if(!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) return FALSE; switch (pScrn->depth) { @@ -886,6 +1188,27 @@ static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn) pScrn->chipset, info->Chipset); + + info->IsM6 = FALSE; + switch (info->Chipset) + { + case PCI_CHIP_RADEON_LY: + case PCI_CHIP_RADEON_LZ: + info->IsM6 = TRUE; + case PCI_CHIP_RADEON_QY: + case PCI_CHIP_RADEON_QZ: + /*VE or M6 has secondary CRTC*/ + info->HasCRTC2 = TRUE; + break; + case PCI_CHIP_RADEON_LW: + /* M7 */ + info->HasCRTC2 = TRUE; + info->IsM7 = TRUE; + break; + default: + info->HasCRTC2 = FALSE; + } + /* Framebuffer */ from = X_PROBED; @@ -938,31 +1261,34 @@ static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn) "BIOS at 0x%08lx\n", info->BIOSAddr); } -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - /* Flat panel (part 1) */ - /* FIXME: Make this an option */ - switch (info->Chipset) { -#if 0 - case PCI_CHIP_RADEON_XX: info->HasPanelRegs = TRUE; break; -#endif - case PCI_CHIP_RADEON_QD: - case PCI_CHIP_RADEON_QE: - case PCI_CHIP_RADEON_QF: - case PCI_CHIP_RADEON_QG: - case PCI_CHIP_RADEON_VE: - default: info->HasPanelRegs = FALSE; break; - } -#endif + RADEONMapMMIO(pScrn); + RADEONMMIO = info->MMIO; /* Read registers used to determine options */ from = X_PROBED; - RADEONMapMMIO(pScrn); - RADEONMMIO = info->MMIO; if (info->FBDev) pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024; else pScrn->videoRam = INREG(RADEON_CONFIG_MEMSIZE) / 1024; + + + if(info->IsSecondary) + { + /*FIXME: For now, split FB into two equal sections. This should + be able to be adjusted by user with a config option*/ + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + RADEONInfoPtr info1; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pScrn->videoRam /= 2; + pRADEONEnt->pPrimaryScrn->videoRam = pScrn->videoRam; + info1 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + info1->FbMapSize = pScrn->videoRam * 1024; + info->LinearAddr += pScrn->videoRam * 1024; + } + info->MemCntl = INREG(RADEON_SDRAM_MODE_REG); info->BusCntl = INREG(RADEON_BUS_CNTL); RADEONMMIO = NULL; @@ -976,7 +1302,8 @@ static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn) } info->ram = &RADEONRAM[offset]; - if (dev->videoRam) { + if (dev->videoRam) + { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Video RAM override, using %d kB instead of %d kB\n", dev->videoRam, @@ -989,45 +1316,6 @@ static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte (%s)\n", pScrn->videoRam, info->ram->name); -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - /* Flat panel (part 2) */ - if (info->HasPanelRegs) { -#if 1 - info->CRTOnly = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using flat panel for display\n"); -#else - /* Panel CRT mode override */ - if ((info->CRTOnly = xf86ReturnOptValBool(info->Options, - OPTION_CRT, FALSE))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using external CRT instead of " - "flat panel for display\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using flat panel for display\n"); - } -#endif - - /* Panel width/height overrides */ - info->PanelXRes = 0; - info->PanelYRes = 0; - if (xf86GetOptValInteger(info->Options, - OPTION_PANEL_WIDTH, &(info->PanelXRes))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Flat panel width: %d\n", info->PanelXRes); - } - if (xf86GetOptValInteger(info->Options, - OPTION_PANEL_HEIGHT, &(info->PanelYRes))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Flat panel height: %d\n", info->PanelYRes); - } - } else { - info->CRTOnly = FALSE; - } -#endif - #ifdef XF86DRI /* AGP/PCI */ if (xf86ReturnOptValBool(info->Options, OPTION_IS_PCI, FALSE)) { @@ -1038,11 +1326,15 @@ static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn) #if 0 case PCI_CHIP_RADEON_XX: info->IsPCI = TRUE; break; #endif + case PCI_CHIP_RADEON_QY: + case PCI_CHIP_RADEON_QZ: + case PCI_CHIP_RADEON_LW: + case PCI_CHIP_RADEON_LY: + case PCI_CHIP_RADEON_LZ: case PCI_CHIP_RADEON_QD: case PCI_CHIP_RADEON_QE: case PCI_CHIP_RADEON_QF: case PCI_CHIP_RADEON_QG: - case PCI_CHIP_RADEON_VE: default: info->IsPCI = FALSE; break; } } @@ -1051,21 +1343,293 @@ static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn) return TRUE; } -static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) +static void +RADEONI2CGetBits(I2CBusPtr b, int *Clock, int *data) { + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; RADEONInfoPtr info = RADEONPTR(pScrn); - vbeInfoPtr pVbe; + unsigned long val; + unsigned char *RADEONMMIO = info->MMIO; + + /* Get the result. */ + val = INREG(info->DDCReg); + + *Clock = (val & RADEON_GPIO_Y_1) != 0; + *data = (val & RADEON_GPIO_Y_0) != 0; + +} + +static void +RADEONI2CPutBits(I2CBusPtr b, int Clock, int data) +{ + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned long val; + unsigned char *RADEONMMIO = info->MMIO; + + val = INREG(info->DDCReg) & + (CARD32)~(RADEON_GPIO_EN_0 | RADEON_GPIO_EN_1); + val |= (Clock ? 0:RADEON_GPIO_EN_1); + val |= (data ? 0:RADEON_GPIO_EN_0); + OUTREG(info->DDCReg, val); +} + + +static Bool +RADEONI2cInit(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + info->pI2CBus = xf86CreateI2CBusRec(); + if(!info->pI2CBus) return FALSE; + + info->pI2CBus->BusName = "DDC"; + info->pI2CBus->scrnIndex = pScrn->scrnIndex; + info->pI2CBus->I2CPutBits = RADEONI2CPutBits; + info->pI2CBus->I2CGetBits = RADEONI2CGetBits; + info->pI2CBus->AcknTimeout = 5; - if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE; + switch(info->DDCType) + { + case DDC_MONID: + info->DDCReg = RADEON_GPIO_MONID; + break; + case DDC_DVI: + info->DDCReg = RADEON_GPIO_DVI_DDC; + break; + case DDC_VGA: + info->DDCReg = RADEON_GPIO_VGA_DDC; + break; + case DDC_CRT2: + info->DDCReg = RADEON_GPIO_CRT2_DDC; + break; + default: + return FALSE; + } + + if (!xf86I2CBusInit(info->pI2CBus)) return FALSE; + return TRUE; +} + +static void RADEONPreInitDDC(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + /*vbeInfoPtr pVbe;*/ + + info->ddc1 = FALSE; + info->ddc_bios = FALSE; + if (!xf86LoadSubModule(pScrn, "ddc")) + { + info->ddc2 = FALSE; + } + else + { xf86LoaderReqSymLists(ddcSymbols, NULL); - if (xf86LoadSubModule(pScrn, "vbe")) { - pVbe = VBEInit(pInt10, info->pEnt->index); - if (!pVbe) return FALSE; + info->ddc2 = TRUE; + } - xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); - return TRUE; - } else - return FALSE; + /*info->ddc1 = TRUE;*/ + + /* - DDC can use I2C bus */ + /* Load I2C if we have the code to use it */ + if(info->ddc2) + { + if ( xf86LoadSubModule(pScrn, "i2c") ) + { + xf86LoaderReqSymLists(i2cSymbols,NULL); + info->ddc2 = RADEONI2cInit(pScrn); + } + else info->ddc2 = FALSE; + } +} + +static xf86MonPtr +RADEONDoDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + xf86MonPtr MonInfo = NULL; + unsigned char *RADEONMMIO; + + + /** + We'll use DDC2, BIOS EDID can only detect the monitor + connected to one port. For VE, BIOS EDID detects the + monitor connected to DVI port by default. If no monitor + their, it will try CRT port + */ + + /* Read and output monitor info using DDC2 over I2C bus */ + if (info->pI2CBus && info->ddc2) + { + if (!RADEONMapMMIO(pScrn)) return NULL; + RADEONMMIO = info->MMIO; + /*OUTREG(RADEON_I2C_CNTL_1, 0); + OUTREG(RADEON_DVI_I2C_CNTL_1, 0);*/ + OUTREG(info->DDCReg, INREG(info->DDCReg) & + (CARD32)~(RADEON_GPIO_A_0 | RADEON_GPIO_A_1)); + + MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, info->pI2CBus); + if(!MonInfo) info->ddc2 = FALSE; + RADEONUnmapMMIO(pScrn); + } + + if(!MonInfo) + { + if (xf86LoadSubModule(pScrn, "vbe")) + { + vbeInfoPtr pVbe; + pVbe = VBEInit(pInt10, info->pEnt->index); + if (pVbe) + { + MonInfo = vbeDoEDID(pVbe,NULL); + info->ddc_bios = TRUE; + } + else + info->ddc_bios = FALSE; + } + } + +/***Not used for now + if(!MonInfo && info->ddc1) + { + if (info->ddc1Read && info->DDC1SetSpeed) + { + MonInfo = xf86DoEDID_DDC1(pScrn->scrnIndex, + info->DDC1SetSpeed, + info->ddc1Read); + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "DDC Monitor info: %p\n", MonInfo); + xf86PrintEDID( MonInfo ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of DDC Monitor info\n\n"); + } +***/ + + if(MonInfo) + { + if(info->ddc2) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C EDID Info:\n"); + else if(info->ddc_bios) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS EDID Info:\n"); + else return NULL; + + xf86PrintEDID(MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of DDC Monitor info\n\n"); + + xf86SetDDCproperties(pScrn, MonInfo); + return MonInfo; + } + else return NULL; +} + +/*********** + xfree's xf86ValidateModes routine deosn't work well with DFPs + here is our own validation routine. All modes between + 640<=XRes<=MaxRes and 480<=YRes<=MaxYRes will be permitted. +************/ +static int RADEONValidateFPModes(ScrnInfoPtr pScrn) +{ + int i, j, count=0, width, height; + RADEONInfoPtr info = RADEONPTR(pScrn); + DisplayModePtr last = NULL, new = NULL, first = NULL; + + /* Free any allocated modes during configuration. We don't need them*/ + while (pScrn->modes) + { + xf86DeleteMode(&pScrn->modes, pScrn->modes); + } + while (pScrn->modePool) + { + xf86DeleteMode(&pScrn->modePool, pScrn->modePool); + } + + pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + + /* If no mode specified in config, we use native resolution*/ + if(!pScrn->display->modes[0]) + { + pScrn->display->modes[0] = xnfalloc(16); + sprintf(pScrn->display->modes[0], "%dx%d", + info->PanelXRes, info->PanelYRes); + } + + for(i=0; pScrn->display->modes[i] != NULL; i++) + { + if (sscanf(pScrn->display->modes[i], "%dx%d", &width, &height) == 2) + { + + if(width < 640 || width > info->PanelXRes || + height < 480 || height > info->PanelYRes) + { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Mode %s is out of range.\n" + "Valid mode should be between 640x480-%dx%d\n", + pScrn->display->modes[i], info->PanelXRes, info->PanelYRes); + continue; + } + + new = xnfcalloc(1, sizeof(DisplayModeRec)); + new->prev = last; + new->name = xnfalloc(strlen(pScrn->display->modes[i]) + 1); + strcpy(new->name, pScrn->display->modes[i]); + new->HDisplay = new->CrtcHDisplay = width; + new->VDisplay = new->CrtcVDisplay = height; + + if(info->HasEDID) + { + xf86MonPtr ddc = pScrn->monitor->DDC; + for(j=0; j<DET_TIMINGS; j++) + { + /*We use native mode clock only*/ + if(ddc->det_mon[j].type == 0) + new->Clock = ddc->det_mon[j].section.d_timings.clock / 1000; + } + } + + if(new->prev) new->prev->next = new; + last = new; + if(!first) first = new; + pScrn->display->virtualX = + pScrn->virtualX = MAX(pScrn->virtualX, width); + pScrn->display->virtualY = + pScrn->virtualY = MAX(pScrn->virtualY, height); + count++; + } + else + { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Mode name %s is invalid\n", pScrn->display->modes[i]); + continue; + } + } + + if(last) + { + last->next = first; + first->prev = last; + pScrn->modes = first; + + /*FIXME: May need to validate line pitch here*/ + { + int dummy = 0; + switch(pScrn->depth / 8) + { + case 1: + dummy = 128 - pScrn->virtualX % 128; + break; + case 2: + dummy = 32 - pScrn->virtualX % 32; + break; + case 3: + case 4: + dummy = 16 - pScrn->virtualX % 16; + } + pScrn->displayWidth = pScrn->virtualX + dummy; + } + + } + + return count; } /* This is called by RADEONPreInit to initialize gamma correction. */ @@ -1077,6 +1641,129 @@ static Bool RADEONPreInitGamma(ScrnInfoPtr pScrn) return TRUE; } +static void RADEONSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) +{ + int i; + xf86MonPtr ddc = pScrn->monitor->DDC; + if(flag) /*HSync*/ + { + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == DS_RANGES) + { + pScrn->monitor->nHsync = 1; + pScrn->monitor->hsync[0].lo = + ddc->det_mon[i].section.ranges.min_h; + pScrn->monitor->hsync[0].hi = + ddc->det_mon[i].section.ranges.max_h; + return; + } + } + /*if no sync ranges detected in detailed timing table, + let's try to derive them from supported VESA modes + Are we doing too much here!!!? + **/ + i = 0; + if(ddc->timings1.t1 & 0x02) /*800x600@56*/ + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 35.2; + i++; + } + if(ddc->timings1.t1 & 0x04) /*640x480@75*/ + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 37.5; + i++; + } + if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t1 & 0x01)) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 37.9; + i++; + } + if(ddc->timings1.t2 & 0x40) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 46.9; + i++; + } + if((ddc->timings1.t2 & 0x80) || (ddc->timings1.t2 & 0x08)) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 48.1; + i++; + } + if(ddc->timings1.t2 & 0x04) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 56.5; + i++; + } + if(ddc->timings1.t2 & 0x02) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 60.0; + i++; + } + if(ddc->timings1.t2 & 0x01) + { + pScrn->monitor->hsync[i].lo = + pScrn->monitor->hsync[i].hi = 64.0; + i++; + } + pScrn->monitor->nHsync = i; + } + else /*Vrefresh*/ + { + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == DS_RANGES) + { + pScrn->monitor->nVrefresh = 1; + pScrn->monitor->vrefresh[0].lo = + ddc->det_mon[i].section.ranges.min_v; + pScrn->monitor->vrefresh[0].hi = + ddc->det_mon[i].section.ranges.max_v; + return; + } + } + i = 0; + if(ddc->timings1.t1 & 0x02) /*800x600@56*/ + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 56; + i++; + } + if((ddc->timings1.t1 & 0x01) || (ddc->timings1.t2 & 0x08)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 60; + i++; + } + if(ddc->timings1.t2 & 0x04) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 70; + i++; + } + if((ddc->timings1.t1 & 0x08) || (ddc->timings1.t2 & 0x80)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 72; + i++; + } + if((ddc->timings1.t1 & 0x04) || (ddc->timings1.t2 & 0x40) + || (ddc->timings1.t2 & 0x02) || (ddc->timings1.t2 & 0x01)) + { + pScrn->monitor->vrefresh[i].lo = + pScrn->monitor->vrefresh[i].hi = 75; + i++; + } + pScrn->monitor->nVrefresh = i; + } +} + /* This is called by RADEONPreInit to validate modes and compute parameters for all of the valid modes. */ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) @@ -1085,8 +1772,15 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) ClockRangePtr clockRanges; int modesFound; char *mod = NULL; +#ifndef USE_FB const char *Sym = NULL; +#endif + /*We'll use our own mode validation routine for DFP/LCD, since + xf86ValidateModes is not working well with the DFP/LCD modes + 'stretched' from their native mode.*/ + if(info->DisplayType == MT_CRT || info->UseCRT) + { /* Get mode information */ pScrn->progClock = TRUE; clockRanges = xnfcalloc(sizeof(*clockRanges), 1); @@ -1094,19 +1788,25 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) clockRanges->minClock = info->pll.min_pll_freq; clockRanges->maxClock = info->pll.max_pll_freq * 10; clockRanges->clockIndex = -1; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) { - clockRanges->interlaceAllowed = FALSE; - clockRanges->doubleScanAllowed = FALSE; - } else { + clockRanges->interlaceAllowed = TRUE; clockRanges->doubleScanAllowed = TRUE; + + if(info->HasEDID) + { + /*if we still don't know sync range yet, let's try EDID. + Note that, since we can have dual heads, the Xconfigurator + may not be able to probe both monitors correctly through + vbe probe function (RADEONProbeDDC). Here we provide an + additional way to auto-detect sync ranges if they haven't + been added to XF86Config manually. + **/ + if(pScrn->monitor->nHsync <= 0) + RADEONSetSyncRangeFromEdid(pScrn, 1); + if(pScrn->monitor->nVrefresh <= 0) + RADEONSetSyncRangeFromEdid(pScrn, 0); } -#else - clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = TRUE; -#endif + modesFound = xf86ValidateModes(pScrn, pScrn->monitor->Modes, @@ -1123,19 +1823,36 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) info->FbMapSize, LOOKUP_BEST_REFRESH); - if (modesFound < 1 && info->FBDev) { + if(modesFound < 1 && info->FBDev) + { fbdevHWUseBuildinMode(pScrn); pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */ modesFound = 1; } - if (modesFound == -1) return FALSE; + if(modesFound == -1) return FALSE; + xf86PruneDriverModes(pScrn); - if (!modesFound || !pScrn->modes) { + if(!modesFound || !pScrn->modes) + { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); return FALSE; } xf86SetCrtcForModes(pScrn, 0); + } + else + { + + /*DFP/LCD mode validation routine*/ + modesFound = RADEONValidateFPModes(pScrn); + if(modesFound < 1) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No valid mode found for this DFP/LCD\n"); + return FALSE; + } + } + pScrn->currentMode = pScrn->modes; xf86PrintModes(pScrn); @@ -1145,7 +1862,6 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) /* Get ScreenInit function */ #ifdef USE_FB mod = "fb"; - Sym = "fbScreenInit"; #else switch (pScrn->bitsPerPixel) { case 8: mod = "cfb"; Sym = "cfbScreenInit"; break; @@ -1153,11 +1869,13 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn) case 32: mod = "cfb32"; Sym = "cfb32ScreenInit"; break; } #endif + if (mod && !xf86LoadSubModule(pScrn, mod)) return FALSE; - xf86LoaderReqSymbols(Sym, NULL); #ifdef USE_FB - xf86LoaderReqSymbols("fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); +#else + xf86LoaderReqSymbols(Sym, NULL); #endif info->CurrentLayout.displayWidth = pScrn->displayWidth; @@ -1173,6 +1891,7 @@ static Bool RADEONPreInitCursor(ScrnInfoPtr pScrn) if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); } return TRUE; } @@ -1184,6 +1903,7 @@ static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn) if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; + xf86LoaderReqSymLists(xaaSymbols, NULL); } return TRUE; } @@ -1193,12 +1913,14 @@ static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) RADEONInfoPtr info = RADEONPTR(pScrn); if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); *ppInt10 = xf86InitInt10(info->pEnt->index); } return TRUE; } + #ifdef XF86DRI static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn) { @@ -1309,32 +2031,146 @@ static void RADEONProbeDDC(ScrnInfoPtr pScrn, int indx) { vbeInfoPtr pVbe; - if (xf86LoadSubModule(pScrn, "vbe")) { + if (xf86LoadSubModule(pScrn, "vbe")) + { pVbe = VBEInit(NULL,indx); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); } } +/*This funtion is used to reverse calculate + panel information from register settings in VGA mode. + More graceful way is to use EDID information... if it can be detected. + This way may be better than directly probing BIOS image. Because + BIOS image could change from version to version, while the + registers should always(?) contain right information, otherwise + the VGA mode display will not be correct. Well, if someone + messes up these registers before our driver is loaded, we'll be in + trouble...*/ +static Bool RadeonGetDFPInfo(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + unsigned long r; + unsigned short a, b; + unsigned char* RADEONMMIO; + unsigned long mapped; + + if(info->HasEDID) + { + int i; + xf86MonPtr ddc = pScrn->monitor->DDC; + for(i=0; i<4; i++) + { + if(ddc->det_mon[i].type == 0) + { + info->PanelXRes = + ddc->det_mon[i].section.d_timings.h_active; + info->PanelYRes = + ddc->det_mon[i].section.d_timings.v_active; + + info->HOverPlus = + ddc->det_mon[i].section.d_timings.h_sync_off; + info->HSyncWidth = + ddc->det_mon[i].section.d_timings.h_sync_width; + info->HBlank = + ddc->det_mon[i].section.d_timings.h_blanking; + info->VOverPlus = + ddc->det_mon[i].section.d_timings.v_sync_off; + info->VSyncWidth = + ddc->det_mon[i].section.d_timings.v_sync_width; + info->VBlank = + ddc->det_mon[i].section.d_timings.v_blanking; + return TRUE; + } + } + } + + mapped = RADEONMapMem(pScrn); + RADEONMMIO = info->MMIO; + + r = INREG(RADEON_FP_VERT_STRETCH); + r &= 0x00fff000; + info->PanelYRes = (unsigned short)(r >> 0x0c) + 1; + + switch(info->PanelYRes) + { + case 480: info->PanelXRes = 640; + break; + case 600: info->PanelXRes = 800; + break; + case 768: info->PanelXRes = 1024; + break; + case 1024: info->PanelXRes = 1280; + break; + case 1050: info->PanelXRes = 1400; + break; + case 1200: info->PanelXRes = 1600; + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to detect the panel size.\n"); + return FALSE; + + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected panel size: %dx%d\n", info->PanelXRes, info->PanelYRes); + + r = INREG(RADEON_FP_CRTC_H_TOTAL_DISP); + a = (r & RADEON_FP_CRTC_H_TOTAL_MASK) + 4; + b = (r & 0x01FF0000) >> RADEON_FP_CRTC_H_DISP_SHIFT; + info->HBlank = (a - b + 1) * 8; + + r = INREG(RADEON_FP_H_SYNC_STRT_WID); + info->HOverPlus = + (unsigned short)((r & RADEON_FP_H_SYNC_STRT_CHAR_MASK) + >> RADEON_FP_H_SYNC_STRT_CHAR_SHIFT) - b - 1; + info->HOverPlus *= 8; + info->HSyncWidth = + (unsigned short)((r & RADEON_FP_H_SYNC_WID_MASK) + >> RADEON_FP_H_SYNC_WID_SHIFT); + info->HSyncWidth *= 8; + r = INREG(RADEON_FP_CRTC_V_TOTAL_DISP); + a = (r & RADEON_FP_CRTC_V_TOTAL_MASK) + 1; + b = (r & RADEON_FP_CRTC_V_DISP_MASK) >> RADEON_FP_CRTC_V_DISP_SHIFT; + info->VBlank = a - b /*+ 24*/; + + r = INREG(RADEON_FP_V_SYNC_STRT_WID); + info->VOverPlus = (unsigned short)(r & RADEON_FP_V_SYNC_STRT_MASK) + - b + 1; + info->VSyncWidth = (unsigned short)((r & RADEON_FP_V_SYNC_WID_MASK) + >> RADEON_FP_V_SYNC_WID_SHIFT); + + if(mapped) RADEONUnmapMem(pScrn); + + return TRUE; +} + + /* RADEONPreInit is called once at server startup. */ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) { RADEONInfoPtr info; xf86Int10InfoPtr pInt10 = NULL; +#ifdef __alpha__ CARD32 save1, save2; +#endif -#ifdef XFree86LOADER /* * Tell the loader about symbols from other modules that this module might * refer to. */ - LoaderRefSymLists(vgahwSymbols, + xf86LoaderRefSymLists(vgahwSymbols, #ifdef USE_FB fbSymbols, #else cfbSymbols, #endif xaaSymbols, +#if 0 xf8_32bppSymbols, +#endif ramdacSymbols, #ifdef XF86DRI drmSymbols, @@ -1342,11 +2178,11 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) #endif fbdevHWSymbols, vbeSymbols, - /* ddcsymbols, */ + int10Symbols, + ddcSymbols, /* i2csymbols, */ /* shadowSymbols, */ NULL); -#endif RADEONTRACE(("RADEONPreInit\n")); if (pScrn->numEntities != 1) return FALSE; @@ -1354,13 +2190,44 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) if (!RADEONGetRec(pScrn)) return FALSE; info = RADEONPTR(pScrn); - + info->IsSecondary = FALSE; info->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (info->pEnt->location.type != BUS_PCI) goto fail; RADEONPreInt10Save(pScrn, &save1, &save2); - if (flags & PROBE_DETECT) { + if(xf86IsEntityShared(pScrn->entityList[0])) + { + if(xf86IsPrimInitDone(pScrn->entityList[0])) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + info->IsSecondary = TRUE; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + if(pRADEONEnt->BypassSecondary) return FALSE; + pRADEONEnt->pSecondaryScrn = pScrn; + } + else + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + xf86SetPrimInitDone(pScrn->entityList[0]); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->pPrimaryScrn = pScrn; + pRADEONEnt->IsDRIEnabled = FALSE; + pRADEONEnt->BypassSecondary = FALSE; + pRADEONEnt->HasSecondary = FALSE; + pRADEONEnt->RestorePrimary = FALSE; + pRADEONEnt->IsSecondaryRestored = FALSE; + } + } + + if (flags & PROBE_DETECT) + { RADEONProbeDDC(pScrn, info->pEnt->index); RADEONPostInt10Check(pScrn, save1, save2); return TRUE; @@ -1368,7 +2235,8 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; xf86LoaderReqSymLists(vgahwSymbols, NULL); - if (!vgaHWGetHWRec(pScrn)) { + if (!vgaHWGetHWRec(pScrn)) + { RADEONFreeRec(pScrn); return FALSE; } @@ -1384,7 +2252,8 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) info->PciInfo->device, info->PciInfo->func); - if (xf86RegisterResources(info->pEnt->index, 0, ResNone)) goto fail; + if (xf86RegisterResources(info->pEnt->index, 0, ResExclusive)) + goto fail; pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; pScrn->monitor = pScrn->confScreen->monitor; @@ -1406,7 +2275,18 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) "Using framebuffer device\n"); } - if (info->FBDev) { + info->UseCRT = FALSE; + + /*This option is used to force the ONLY DEVICE in XFConfig to + use CRT port, instead of default DVI port*/ + if (xf86ReturnOptValBool(info->Options, OPTION_CRT_SCREEN, FALSE)) + { + if(!xf86IsEntityShared(pScrn->entityList[0])) + info->UseCRT = TRUE; + } + + if (info->FBDev) + { /* check for linux framebuffer device */ if (!xf86LoadSubModule(pScrn, "fbdevhw")) return FALSE; xf86LoaderReqSymLists(fbdevHWSymbols, NULL); @@ -1427,12 +2307,15 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) if (!RADEONGetBIOSParameters(pScrn, pInt10)) goto fail; - if (!RADEONGetPLLParameters(pScrn)) goto fail; + RADEONPreInitDDC(pScrn); + info->HasEDID = + ((pScrn->monitor->DDC = RADEONDoDDC(pScrn, pInt10)) ? TRUE:FALSE); - /* shouldn't fail just because we can't get DDC */ - RADEONPreInitDDC(pScrn, pInt10); + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + if(!RadeonGetDFPInfo(pScrn)) goto fail; - RADEONPostInt10Check(pScrn, save1, save2); + if (!RADEONGetPLLParameters(pScrn)) goto fail; if (!RADEONPreInitGamma(pScrn)) goto fail; @@ -1445,9 +2328,9 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) #ifdef XF86DRI if (!RADEONPreInitDRI(pScrn)) goto fail; #endif - /* Free the video bios (if applicable) */ - if (info->VBIOS) { + if (info->VBIOS) + { xfree(info->VBIOS); info->VBIOS = NULL; } @@ -1458,11 +2341,12 @@ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) return TRUE; - fail: +fail: /* Pre-init failed. */ /* Free the video bios (if applicable) */ - if (info->VBIOS) { + if (info->VBIOS) + { xfree(info->VBIOS); info->VBIOS = NULL; } @@ -1483,14 +2367,15 @@ static void RADEONLoadPalette(ScrnInfoPtr pScrn, int numColors, RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; int i; - int idx; + int idx, j; unsigned char r, g, b; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); -#endif + /* If the second monitor is connected, we also + need to deal with the secondary palette*/ + if (info->IsSecondary) j = 1; + else j = 0; + + PAL_SELECT(j); if (info->CurrentLayout.depth == 15) { /* 15bpp mode. This sends 32 values. */ @@ -1574,15 +2459,17 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Turn off the CP for now. */ info->CPInUse = FALSE; #endif - - if (!RADEONMapMem(pScrn)) return FALSE; pScrn->fbOffset = 0; + if(info->IsSecondary) pScrn->fbOffset = pScrn->videoRam * 1024; + if (!RADEONMapMem(pScrn)) return FALSE; + #ifdef XF86DRI info->fbX = 0; info->fbY = 0; #endif info->PaletteSavedOnVT = FALSE; + info->SwitchingMode = FALSE; RADEONSave(pScrn); if (info->FBDev) { @@ -1592,8 +2479,8 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } RADEONSaveScreen(pScreen, SCREEN_SAVER_ON); - pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); /* Visual setup */ miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, @@ -1628,7 +2515,33 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024); info->directRenderingEnabled = FALSE; } else { - info->directRenderingEnabled = RADEONDRIScreenInit(pScreen); + if(info->IsSecondary) + info->directRenderingEnabled = FALSE; + else + { + /* Xinerama has sync problem with DRI, disable it for now */ + if(xf86IsEntityShared(pScrn->entityList[0])) + { + info->directRenderingEnabled = FALSE; + xf86DrvMsg(scrnIndex, X_WARNING, + "Direct Rendering Disabled -- " + "Dual-head configuration is not working with DRI " + "at present.\nPlease use only one Device/Screen " + "section in your XFConfig file.\n"); + } + else + info->directRenderingEnabled = + RADEONDRIScreenInit(pScreen); + if(xf86IsEntityShared(pScrn->entityList[0])) + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->IsDRIEnabled = info->directRenderingEnabled; + } + } } } #endif @@ -1639,7 +2552,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; - fbPictureInit (pScreen, 0, 0); #else switch (pScrn->bitsPerPixel) { case 8: @@ -1683,8 +2595,10 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } } - - RADEONDGAInit(pScreen); +#ifdef USE_FB + /* must be after RGB order fixed */ + fbPictureInit (pScreen, 0, 0); +#endif /* Memory manager setup */ #ifdef XF86DRI @@ -1852,11 +2766,13 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) y2 = (info->FbMapSize / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes)); + if (y2 >= 32768) y2 = 32767; /* because MemBox.y2 is signed short */ + MemBox.y2 = y2; + /* The acceleration engine uses 14 bit signed coordinates, so we can't have any drawable caches beyond this region. */ - if (y2 > 8191) y2 = 8191; - MemBox.y2 = y2; + if (MemBox.y2 > 8191) MemBox.y2 = 8191; if (!xf86InitFBManager(pScreen, &MemBox)) { xf86DrvMsg(scrnIndex, X_ERROR, @@ -1887,7 +2803,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } } - /* Backing store setup */ miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -1911,6 +2826,9 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) info->accelOn = FALSE; } + /* DGA setup */ + RADEONDGAInit(pScreen); + /* Cursor setup */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -1950,13 +2868,12 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) )) return FALSE; /* DPMS setup */ -#ifdef ENABLE_FLAT_PANEL - if (!info->HasPanelRegs || info->CRTOnly) -#endif +#ifdef DPMSExtension + if (info->DisplayType == MT_CRT) xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); +#endif RADEONInitVideo(pScreen); - /* Provide SaveScreen */ pScreen->SaveScreen = RADEONSaveScreen; @@ -2038,45 +2955,75 @@ static void RADEONRestoreCrtcRegisters(ScrnInfoPtr pScrn, OUTREG(RADEON_CRTC_PITCH, restore->crtc_pitch); } -#ifdef ENABLE_FLAT_PANEL +/* Write CRTC2 registers. */ +static void RADEONRestoreCrtc2Registers(ScrnInfoPtr pScrn, + RADEONSavePtr restore) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + +/* OUTREG(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl);*/ + OUTREGP(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl, + RADEON_CRTC2_VSYNC_DIS | + RADEON_CRTC2_HSYNC_DIS | + RADEON_CRTC2_DISP_DIS); + + OUTREG(RADEON_DAC_CNTL2, restore->dac2_cntl); + OUTREG(RADEON_DISP_OUTPUT_CNTL, restore->disp_output_cntl); + + OUTREG(RADEON_CRTC2_H_TOTAL_DISP, restore->crtc2_h_total_disp); + OUTREG(RADEON_CRTC2_H_SYNC_STRT_WID, restore->crtc2_h_sync_strt_wid); + OUTREG(RADEON_CRTC2_V_TOTAL_DISP, restore->crtc2_v_total_disp); + OUTREG(RADEON_CRTC2_V_SYNC_STRT_WID, restore->crtc2_v_sync_strt_wid); + OUTREG(RADEON_CRTC2_OFFSET, restore->crtc2_offset); + OUTREG(RADEON_CRTC2_OFFSET_CNTL, restore->crtc2_offset_cntl); + OUTREG(RADEON_CRTC2_PITCH, restore->crtc2_pitch); + +} + /* Note: Radeon flat panel support has been disabled for now */ /* Write flat panel registers */ static void RADEONRestoreFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 tmp; + unsigned long tmp; - OUTREG(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl); OUTREG(RADEON_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp); OUTREG(RADEON_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp); - OUTREG(RADEON_FP_GEN_CNTL, restore->fp_gen_cntl); OUTREG(RADEON_FP_H_SYNC_STRT_WID, restore->fp_h_sync_strt_wid); - OUTREG(RADEON_FP_HORZ_STRETCH, restore->fp_horz_stretch); - OUTREG(RADEON_FP_PANEL_CNTL, restore->fp_panel_cntl); OUTREG(RADEON_FP_V_SYNC_STRT_WID, restore->fp_v_sync_strt_wid); - OUTREG(RADEON_FP_VERT_STRETCH, restore->fp_vert_stretch); OUTREG(RADEON_TMDS_CRC, restore->tmds_crc); + OUTREG(RADEON_FP_HORZ_STRETCH, restore->fp_horz_stretch); + OUTREG(RADEON_FP_VERT_STRETCH, restore->fp_vert_stretch); + OUTREG(RADEON_FP_GEN_CNTL, restore->fp_gen_cntl); + if(info->DisplayType == MT_LCD) + { tmp = INREG(RADEON_LVDS_GEN_CNTL); if ((tmp & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) == - (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON))) { + (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON))) + { OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); - } else { - if (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) { - OUTREG(RADEON_LVDS_GEN_CNTL, - restore->lvds_gen_cntl & ~RADEON_LVDS_BLON); + } + else + { + if (restore->lvds_gen_cntl & + (RADEON_LVDS_ON | RADEON_LVDS_BLON)) + { usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000); OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); - } else { + } + else + { OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl | RADEON_LVDS_BLON); usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000); OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl); } } + } } -#endif #if RADEON_ATOMIC_UPDATE static void RADEONPLLWaitForReadUpdateComplete(ScrnInfoPtr pScrn) @@ -2099,6 +3046,8 @@ static void RADEONRestorePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; + OUTPLLP(pScrn, 0x08, 0x00, ~(0x03)); + #if !RADEON_ATOMIC_UPDATE while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & RADEON_PLL_DIV_SEL) != RADEON_PLL_DIV_SEL) { @@ -2177,6 +3126,104 @@ static void RADEONRestorePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore) restore->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK, restore->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK, (restore->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16)); + + OUTPLLP(pScrn, 0x08, 0x03, ~(0x03)); + +} + + +/* Write PLL2 registers. */ +static void RADEONRestorePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr restore) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + OUTPLLP(pScrn, 0x2d, 0x00, ~(0x03)); + + +#if !RADEON_ATOMIC_UPDATE + while (INREG(RADEON_CLOCK_CNTL_INDEX) & ~(RADEON_PLL2_DIV_SEL_MASK)) { +#endif + OUTREGP(RADEON_CLOCK_CNTL_INDEX, 0, RADEON_PLL2_DIV_SEL_MASK); +#if !RADEON_ATOMIC_UPDATE + } +#endif + + +#if RADEON_ATOMIC_UPDATE + OUTPLLP(pScrn, + RADEON_P2PLL_CNTL, + RADEON_P2PLL_RESET + | RADEON_P2PLL_ATOMIC_UPDATE_EN + | RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN, + 0xffff); +#else + OUTPLLP(pScrn, + RADEON_P2PLL_CNTL, + RADEON_P2PLL_RESET, + 0xffff); +#endif + +#if RADEON_ATOMIC_UPDATE + RADEONPLLWaitForReadUpdateComplete(pScrn); +#endif + while ( (INPLL(pScrn, RADEON_P2PLL_REF_DIV) & RADEON_P2PLL_REF_DIV_MASK) != + (restore->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK)) { + OUTPLLP(pScrn, RADEON_P2PLL_REF_DIV, restore->p2pll_ref_div, ~RADEON_P2PLL_REF_DIV_MASK); + } +#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); +#endif + +#if RADEON_ATOMIC_UPDATE + RADEONPLLWaitForReadUpdateComplete(pScrn); +#endif + while ( (INPLL(pScrn, RADEON_P2PLL_DIV_0) & RADEON_P2PLL_FB0_DIV_MASK) != + (restore->p2pll_div_0 & +RADEON_P2PLL_FB0_DIV_MASK)) { + OUTPLLP(pScrn, RADEON_P2PLL_DIV_0, + restore->p2pll_div_0, ~RADEON_P2PLL_FB0_DIV_MASK); + } +#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); +#endif + +#if RADEON_ATOMIC_UPDATE + RADEONPLLWaitForReadUpdateComplete(pScrn); +#endif + while ( (INPLL(pScrn, RADEON_P2PLL_DIV_0) & RADEON_P2PLL_POST0_DIV_MASK) != + (restore->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK)) { + OUTPLLP(pScrn, RADEON_P2PLL_DIV_0, + restore->p2pll_div_0, ~RADEON_P2PLL_POST0_DIV_MASK); + } +#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); +#endif + +#if RADEON_ATOMIC_UPDATE + RADEONPLLWaitForReadUpdateComplete(pScrn); +#endif + OUTPLL(RADEON_HTOTAL2_CNTL, restore->htotal_cntl2); +#if RADEON_ATOMIC_UPDATE + RADEONPLLWriteUpdate(pScrn); +#endif + + OUTPLLP(pScrn, RADEON_P2PLL_CNTL, 0, + ~(RADEON_P2PLL_RESET | RADEON_P2PLL_SLEEP)); + + RADEONTRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n", + restore->p2pll_ref_div, + restore->p2pll_div_0, + restore->htotal_cntl2, + INPLL(pScrn, RADEON_P2PLL_CNTL))); + RADEONTRACE(("Wrote: rd=%d, fd=%d, pd=%d\n", + restore->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, + restore->p2pll_div_0 & RADEON_P2PLL_FB3_DIV_MASK, + (restore->p2pll_div_0 & RADEON_P2PLL_POST3_DIV_MASK) >>16)); + + OUTPLLP(pScrn, 0x2d, 0x03, ~(0x03)); + + } /* Write DDA registers. */ @@ -2198,12 +3245,14 @@ static void RADEONRestorePalette(ScrnInfoPtr pScrn, RADEONSavePtr restore) if (!restore->palette_valid) return; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); -#endif + PAL_SELECT(1); + OUTPAL_START(0); + for (i = 0; i < 256; i++) { + RADEONWaitForFifo(pScrn, 32); /* delay */ + OUTPAL_NEXT_CARD32(restore->palette2[i]); + } + PAL_SELECT(0); OUTPAL_START(0); for (i = 0; i < 256; i++) { RADEONWaitForFifo(pScrn, 32); /* delay */ @@ -2212,26 +3261,103 @@ static void RADEONRestorePalette(ScrnInfoPtr pScrn, RADEONSavePtr restore) } /* Write out state to define a new video mode. */ -static void RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore) +static void +RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore) { -#ifdef ENABLE_FLAT_PANEL RADEONInfoPtr info = RADEONPTR(pScrn); -#endif + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + static RADEONSaveRec restore0; - RADEONTRACE(("RADEONRestoreMode(%p)\n", restore)); + /* for Non-dual head card, we don't have private field in the Entity*/ + if(!info->HasCRTC2) + { RADEONRestoreCommonRegisters(pScrn, restore); + RADEONRestoreDDARegisters(pScrn, restore); RADEONRestoreCrtcRegisters(pScrn, restore); -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + { RADEONRestoreFPRegisters(pScrn, restore); - if (!info->HasPanelRegs || info->CRTOnly) - RADEONRestorePLLRegisters(pScrn, restore); -#else + } RADEONRestorePLLRegisters(pScrn, restore); -#endif + return; + } + + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + + RADEONTRACE(("RADEONRestoreMode(%p)\n", restore)); + + /***** + When changing mode with Dual-head card (VE/M6), care must + be taken for the special order in setting registers. CRTC2 has + to be set before changing CRTC_EXT register. + In the dual-head setup, X server calls this routine twice with + primary and secondary pScrn pointers respectively. The calls + can come with different order. Regardless the order of X server issuing + the calls, we have to ensure we set registers in the right order!!! + Otherwise we may get a blank screen. + *****/ + if(info->IsSecondary) + { + RADEONRestoreCrtc2Registers(pScrn, restore); + RADEONRestorePLL2Registers(pScrn, restore); + + if(!info->SwitchingMode) + pRADEONEnt->IsSecondaryRestored = TRUE; + + if(pRADEONEnt->RestorePrimary) + { + RADEONInfoPtr info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); + pRADEONEnt->RestorePrimary = FALSE; + + RADEONRestoreCrtcRegisters(pScrn, &restore0); + if((info0->DisplayType == MT_DFP) || + (info0->DisplayType == MT_LCD)) + { + RADEONRestoreFPRegisters(pScrn, &restore0); + } + + RADEONRestorePLLRegisters(pScrn, &restore0); + pRADEONEnt->IsSecondaryRestored = FALSE; + + } + } + else + { + RADEONRestoreCommonRegisters(pScrn, restore); RADEONRestoreDDARegisters(pScrn, restore); - RADEONRestorePalette(pScrn, restore); + if(!pRADEONEnt->HasSecondary || pRADEONEnt->IsSecondaryRestored + || info->SwitchingMode) + { + pRADEONEnt->IsSecondaryRestored = FALSE; + RADEONRestoreCrtcRegisters(pScrn, restore); + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + { + RADEONRestoreFPRegisters(pScrn, restore); + } + RADEONRestorePLLRegisters(pScrn, restore); + } + else + { + memcpy(&restore0, restore, sizeof(restore0)); + pRADEONEnt->RestorePrimary = TRUE; + } + } + + /* if only one screen is used, we should turn off + the unused screen, not working for now */ + /* + if(!xf86IsEntityShared(pScrn->entityList[0])) + { + RADEONSetDisplayOff(pScrn, 1, 1); + } + */ + + /*RADEONRestorePalette(pScrn, &info->SavedReg);*/ } /* Read common registers. */ @@ -2271,9 +3397,9 @@ static void RADEONSaveCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) save->crtc_offset = INREG(RADEON_CRTC_OFFSET); save->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL); save->crtc_pitch = INREG(RADEON_CRTC_PITCH); + } -#ifdef ENABLE_FLAT_PANEL /* Note: Radeon flat panel support has been disabled for now */ /* Read flat panel registers */ static void RADEONSaveFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) @@ -2281,19 +3407,37 @@ static void RADEONSaveFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - save->crtc2_gen_cntl = INREG(RADEON_CRTC2_GEN_CNTL); save->fp_crtc_h_total_disp = INREG(RADEON_FP_CRTC_H_TOTAL_DISP); save->fp_crtc_v_total_disp = INREG(RADEON_FP_CRTC_V_TOTAL_DISP); save->fp_gen_cntl = INREG(RADEON_FP_GEN_CNTL); save->fp_h_sync_strt_wid = INREG(RADEON_FP_H_SYNC_STRT_WID); save->fp_horz_stretch = INREG(RADEON_FP_HORZ_STRETCH); - save->fp_panel_cntl = INREG(RADEON_FP_PANEL_CNTL); save->fp_v_sync_strt_wid = INREG(RADEON_FP_V_SYNC_STRT_WID); save->fp_vert_stretch = INREG(RADEON_FP_VERT_STRETCH); save->lvds_gen_cntl = INREG(RADEON_LVDS_GEN_CNTL); + save->lvds_pll_cntl = INREG(RADEON_LVDS_PLL_CNTL); save->tmds_crc = INREG(RADEON_TMDS_CRC); } -#endif + +/* Read CRTC2 registers. */ +static void RADEONSaveCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr +save) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + save->dac2_cntl = INREG(RADEON_DAC_CNTL2); + save->disp_output_cntl = INREG(RADEON_DISP_OUTPUT_CNTL); + + save->crtc2_gen_cntl = INREG(RADEON_CRTC2_GEN_CNTL); + save->crtc2_h_total_disp = INREG(RADEON_CRTC2_H_TOTAL_DISP); + save->crtc2_h_sync_strt_wid = INREG(RADEON_CRTC2_H_SYNC_STRT_WID); + save->crtc2_v_total_disp = INREG(RADEON_CRTC2_V_TOTAL_DISP); + save->crtc2_v_sync_strt_wid = INREG(RADEON_CRTC2_V_SYNC_STRT_WID); + save->crtc2_offset = INREG(RADEON_CRTC2_OFFSET); + save->crtc2_offset_cntl = INREG(RADEON_CRTC2_OFFSET_CNTL); + save->crtc2_pitch = INREG(RADEON_CRTC2_PITCH); +} /* Read PLL registers. */ static void RADEONSavePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) @@ -2312,6 +3456,23 @@ static void RADEONSavePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) (save->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16)); } +/* Read PLL registers. */ +static void RADEONSavePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save) +{ + save->p2pll_ref_div = INPLL(pScrn, RADEON_P2PLL_REF_DIV); + save->p2pll_div_0 = INPLL(pScrn, RADEON_P2PLL_DIV_0); + save->htotal_cntl2 = INPLL(pScrn, RADEON_HTOTAL2_CNTL); + + RADEONTRACE(("Read: 0x%08x 0x%08x 0x%08x\n", + save->p2pll_ref_div, + save->p2pll_div_0, + save->htotal_cntl2)); + RADEONTRACE(("Read: rd=%d, fd=%d, pd=%d\n", + save->p2pll_ref_div & RADEON_P2PLL_REF_DIV_MASK, + save->p2pll_div_0 & RADEON_P2PLL_FB0_DIV_MASK, + (save->p2pll_div_0 & RADEON_P2PLL_POST0_DIV_MASK) >> 16)); +} + /* Read DDA registers. */ static void RADEONSaveDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save) { @@ -2330,11 +3491,13 @@ static void RADEONSavePalette(ScrnInfoPtr pScrn, RADEONSavePtr save) int i; #ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ /* Select palette 0 (main CRTC) if using FP-enabled chip */ - if (info->HasPanelRegs) PAL_SELECT(0); + /*if (info->Port1 == MT_DFP) PAL_SELECT(1);*/ #endif - + PAL_SELECT(1); + INPAL_START(0); + for (i = 0; i < 256; i++) save->palette2[i] = INPAL_NEXT(); + PAL_SELECT(0); INPAL_START(0); for (i = 0; i < 256; i++) save->palette[i] = INPAL_NEXT(); save->palette_valid = TRUE; @@ -2343,19 +3506,27 @@ static void RADEONSavePalette(ScrnInfoPtr pScrn, RADEONSavePtr save) /* Save state that defines current video mode. */ static void RADEONSaveMode(ScrnInfoPtr pScrn, RADEONSavePtr save) { - RADEONTRACE(("RADEONSaveMode(%p)\n", save)); + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONTRACE(("RADEONSaveMode(%p)\n", save)); + if(info->IsSecondary) + { + RADEONSaveCrtc2Registers(pScrn, save); + RADEONSavePLL2Registers(pScrn, save); + } + else + { RADEONSaveCommonRegisters(pScrn, save); RADEONSaveCrtcRegisters(pScrn, save); -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (RADEONPTR(pScrn)->HasPanelRegs) + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + { RADEONSaveFPRegisters(pScrn, save); -#endif + } RADEONSavePLLRegisters(pScrn, save); RADEONSaveDDARegisters(pScrn, save); - RADEONSavePalette(pScrn, save); - + /*RADEONSavePalette(pScrn, save);*/ + } RADEONTRACE(("RADEONSaveMode returns %p\n", save)); } @@ -2372,17 +3543,22 @@ static void RADEONSave(ScrnInfoPtr pScrn) fbdevHWSave(pScrn); return; } + + if(!info->IsSecondary) + { vgaHWUnlock(hwp); - vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts, cmap */ + vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts,cmap */ vgaHWLock(hwp); - - RADEONSaveMode(pScrn, save); - save->dp_datatype = INREG(RADEON_DP_DATATYPE); save->rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); save->clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX); save->amcgpio_en_reg = INREG(RADEON_AMCGPIO_EN_REG); save->amcgpio_mask = INREG(RADEON_AMCGPIO_MASK); + } + + + RADEONSaveMode(pScrn, save); + } /* Restore the original (text) mode. */ @@ -2398,7 +3574,6 @@ static void RADEONRestore(ScrnInfoPtr pScrn) fbdevHWRestore(pScrn); return; } - RADEONBlank(pScrn); OUTREG(RADEON_AMCGPIO_MASK, restore->amcgpio_mask); @@ -2407,17 +3582,43 @@ static void RADEONRestore(ScrnInfoPtr pScrn) OUTREG(RADEON_RBBM_SOFT_RESET, restore->rbbm_soft_reset); OUTREG(RADEON_DP_DATATYPE, restore->dp_datatype); + /* M6 card has trouble restoring text mode for its CRT. + Needs this workaround.*/ + if(xf86IsEntityShared(pScrn->entityList[0])) /* && info->IsM6)*/ + OUTREG(RADEON_DAC_CNTL2, restore->dac2_cntl); + RADEONRestoreMode(pScrn, restore); + if(!info->IsSecondary) + { vgaHWUnlock(hwp); vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); vgaHWLock(hwp); + } + else + { + DevUnion* pPriv; + RADEONEntPtr pRADEONEnt; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + pRADEONEnt = pPriv->ptr; + { + ScrnInfoPtr pScrn0 = pRADEONEnt->pPrimaryScrn; + vgaHWPtr hwp0 = VGAHWPTR(pScrn0); + vgaHWUnlock(hwp0); + vgaHWRestore(pScrn0, &hwp0->SavedReg, + VGA_SR_MODE | VGA_SR_FONTS ); + vgaHWLock(hwp0); + } + } + RADEONUnblank(pScrn); + #if 0 RADEONWaitForVerticalSync(pScrn); #endif - RADEONUnblank(pScrn); } + /* Define common registers for requested video mode. */ static void RADEONInitCommonRegisters(RADEONSavePtr save, RADEONInfoPtr info) { @@ -2453,11 +3654,7 @@ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, int vsync_wid; int bytpp; int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - int hsync_fudge_fp[] = { 0x12, 0x11, 0x09, 0x09, 0x05, 0x05 }; - int hsync_fudge_fp_crt[] = { 0x12, 0x10, 0x08, 0x08, 0x04, 0x04 }; -#endif + int hsync_fudge_fp[] = { 0x02, 0x02, 0x00, 0x00, 0x05, 0x05 }; switch (info->CurrentLayout.pixel_code) { case 4: format = 1; bytpp = 0; break; @@ -2473,15 +3670,11 @@ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, } RADEONTRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp)); -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) - if (info->CRTOnly) hsync_fudge = hsync_fudge_fp_crt[format-1]; - else hsync_fudge = hsync_fudge_fp[format-1]; - else hsync_fudge = hsync_fudge_default[format-1]; -#else + if ((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + hsync_fudge = hsync_fudge_fp[format-1]; + else hsync_fudge = hsync_fudge_default[format-1]; -#endif save->crtc_gen_cntl = (RADEON_CRTC_EXT_DISP_EN | RADEON_CRTC_EN @@ -2493,30 +3686,51 @@ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, ? RADEON_CRTC_INTERLACE_EN : 0)); - if (info->Chipset == PCI_CHIP_RADEON_VE) { - save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_CRTC_CRT_ON; - } else { - save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_XCRT_CNT_EN; + if((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) + { + save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | + RADEON_XCRT_CNT_EN; + save->crtc_gen_cntl &= ~(RADEON_CRTC_DBL_SCAN_EN | + RADEON_CRTC_INTERLACE_EN); } + else + save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | + RADEON_XCRT_CNT_EN | + RADEON_CRTC_CRT_ON; + save->dac_cntl = (RADEON_DAC_MASK_ALL | RADEON_DAC_VGA_ADR_EN | (info->dac6bits ? 0 : RADEON_DAC_8BIT_EN)); - - save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff) - | (((mode->CrtcHDisplay / 8) - 1) << 16)); + + if(((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD)) && !info->UseCRT) + { + if(info->PanelXRes < mode->CrtcHDisplay) + mode->HDisplay = mode->CrtcHDisplay = info->PanelXRes; + if(info->PanelYRes < mode->CrtcVDisplay) + mode->VDisplay = mode->CrtcVDisplay = info->PanelYRes; + mode->CrtcHTotal = mode->CrtcHDisplay + info->HBlank; + mode->CrtcHSyncStart = mode->CrtcHDisplay + info->HOverPlus; + mode->CrtcHSyncEnd = mode->CrtcHSyncStart + info->HSyncWidth; + mode->CrtcVTotal = mode->CrtcVDisplay + info->VBlank; + mode->CrtcVSyncStart = mode->CrtcVDisplay + info->VOverPlus; + mode->CrtcVSyncEnd = mode->CrtcVSyncStart + info->VSyncWidth; + } + save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0x3ff) + | ((((mode->CrtcHDisplay / 8) - 1) & 0x1ff) << 16)); hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8; if (!hsync_wid) hsync_wid = 1; if (hsync_wid > 0x3f) hsync_wid = 0x3f; - hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge; save->crtc_h_sync_strt_wid = ((hsync_start & 0x1fff) - | (hsync_wid << 16) + | (hsync_wid << 16) | ((mode->Flags & V_NHSYNC) ? RADEON_CRTC_H_SYNC_POL - : 0)); - + : RADEON_CRTC_H_SYNC_POL)); + #if 1 /* This works for double scan mode. */ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) @@ -2538,7 +3752,8 @@ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, | (vsync_wid << 16) | ((mode->Flags & V_NVSYNC) ? RADEON_CRTC_V_SYNC_POL - : 0)); + : RADEON_CRTC_V_SYNC_POL)); + save->crtc_offset = 0; save->crtc_offset_cntl = 0; @@ -2553,7 +3768,107 @@ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, return TRUE; } -#ifdef ENABLE_FLAT_PANEL +/* Define CRTC2 registers for requested video mode. */ +static Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save, + DisplayModePtr mode, RADEONInfoPtr info) +{ + int format; + int hsync_start; + int hsync_wid; + int hsync_fudge; + int vsync_wid; + int bytpp; + int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 }; + + switch (info->CurrentLayout.pixel_code) { + case 4: format = 1; bytpp = 0; break; + case 8: format = 2; bytpp = 1; break; + case 15: format = 3; bytpp = 2; break; /* 555 */ + case 16: format = 4; bytpp = 2; break; /* 565 */ + case 24: format = 5; bytpp = 3; break; /* RGB */ + case 32: format = 6; bytpp = 4; break; /* xRGB */ + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel); + return FALSE; + } + RADEONTRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp)); + + hsync_fudge = hsync_fudge_default[format-1]; + + save->crtc2_gen_cntl = (RADEON_CRTC2_EN + | RADEON_CRTC2_CRT2_ON + | (format << 8) + | ((mode->Flags & V_DBLSCAN) + ? RADEON_CRTC2_DBL_SCAN_EN + : 0) + | ((mode->Flags & V_INTERLACE) + ? RADEON_CRTC2_INTERLACE_EN + : 0)); + + if(!info->IsM7) + save->dac2_cntl = info->SavedReg.dac2_cntl + /*| RADEON_DAC2_DAC2_CLK_SEL*/ + | RADEON_DAC2_DAC_CLK_SEL; + else + { + save->disp_output_cntl = + ((info->SavedReg.disp_output_cntl & + (CARD32)~RADEON_DISP_DAC_SOURCE_MASK) + | RADEON_DISP_DAC_SOURCE_CRTC2); + } + + save->crtc2_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0x3ff) + | ((((mode->CrtcHDisplay / 8) - 1) & 0x1ff) << 16)); + + hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8; + if (!hsync_wid) hsync_wid = 1; + if (hsync_wid > 0x3f) hsync_wid = 0x3f; + hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge; + + save->crtc2_h_sync_strt_wid = ((hsync_start & 0x1fff) + | (hsync_wid << 16) + | ((mode->Flags & V_NHSYNC) + ? RADEON_CRTC_H_SYNC_POL + : RADEON_CRTC_H_SYNC_POL)); + +#if 1 + /* This works for double scan mode. */ + save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) + | ((mode->CrtcVDisplay - 1) << 16)); +#else + /* This is what cce/nbmode.c example code + does -- is this correct? */ + save->crtc2_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff) + | ((mode->CrtcVDisplay + * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1) + << 16)); +#endif + + vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; + if (!vsync_wid) vsync_wid = 1; + if (vsync_wid > 0x1f) vsync_wid = 0x1f; + + save->crtc2_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff) + | (vsync_wid << 16) + | ((mode->Flags & V_NVSYNC) + ? RADEON_CRTC2_V_SYNC_POL + : RADEON_CRTC2_V_SYNC_POL)); + + save->crtc2_offset = 0; + save->crtc2_offset_cntl = 0; + + save->crtc2_pitch = ((pScrn->displayWidth * pScrn->bitsPerPixel) + + ((pScrn->bitsPerPixel * 8) -1)) / + (pScrn->bitsPerPixel * 8); + save->crtc2_pitch |= save->crtc2_pitch << 16; + + RADEONTRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n", + save->crtc2_pitch, pScrn->virtualX, + info->CurrentLayout.displayWidth)); + return TRUE; +} + /* Note: Radeon flat panel support has been disabled for now */ /* Define CRTC registers for requested video mode. */ static void RADEONInitFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr orig, @@ -2564,92 +3879,90 @@ static void RADEONInitFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr orig, int yres = mode->CrtcVDisplay; float Hratio, Vratio; - if (info->CRTOnly) { - save->crtc_ext_cntl |= RADEON_CRTC_CRT_ON; - save->crtc2_gen_cntl = 0; - save->fp_gen_cntl = orig->fp_gen_cntl; - save->fp_gen_cntl &= ~(RADEON_FP_FPON | - RADEON_FP_CRTC_USE_SHADOW_VEND | - RADEON_FP_CRTC_HORZ_DIV2_EN | - RADEON_FP_CRTC_HOR_CRT_DIV2_DIS | - RADEON_FP_USE_SHADOW_EN); - save->fp_gen_cntl |= (RADEON_FP_SEL_CRTC2 | - RADEON_FP_CRTC_DONT_SHADOW_VPAR); - save->fp_panel_cntl = orig->fp_panel_cntl & ~RADEON_FP_DIGON; - save->lvds_gen_cntl = orig->lvds_gen_cntl & ~(RADEON_LVDS_ON | - RADEON_LVDS_BLON); - return; + if(info->PanelXRes == 0 || info->PanelYRes == 0) + { + Hratio = 1; + Vratio = 1; } - + else + { if (xres > info->PanelXRes) xres = info->PanelXRes; if (yres > info->PanelYRes) yres = info->PanelYRes; Hratio = (float)xres/(float)info->PanelXRes; Vratio = (float)yres/(float)info->PanelYRes; + } + if (Hratio == 1.0) + { + save->fp_horz_stretch = orig->fp_horz_stretch; + save->fp_horz_stretch &= ~(RADEON_HORZ_STRETCH_BLEND | + RADEON_HORZ_STRETCH_ENABLE); + } + else + { save->fp_horz_stretch = - (((((int)(Hratio * RADEON_HORZ_STRETCH_RATIO_MAX + 0.5)) - & RADEON_HORZ_STRETCH_RATIO_MASK) - << RADEON_HORZ_STRETCH_RATIO_SHIFT) | + ((((unsigned long)(Hratio * RADEON_HORZ_STRETCH_RATIO_MAX + + 0.5)) & RADEON_HORZ_STRETCH_RATIO_MASK)) | (orig->fp_horz_stretch & (RADEON_HORZ_PANEL_SIZE | RADEON_HORZ_FP_LOOP_STRETCH | - RADEON_HORZ_STRETCH_RESERVED))); - save->fp_horz_stretch &= ~RADEON_HORZ_AUTO_RATIO_FIX_EN; - if (Hratio == 1.0) save->fp_horz_stretch &= ~(RADEON_HORZ_STRETCH_BLEND | - RADEON_HORZ_STRETCH_ENABLE); - else save->fp_horz_stretch |= (RADEON_HORZ_STRETCH_BLEND | + RADEON_HORZ_AUTO_RATIO_INC)); + save->fp_horz_stretch |= (RADEON_HORZ_STRETCH_BLEND | RADEON_HORZ_STRETCH_ENABLE); + } + save->fp_horz_stretch &= ~RADEON_HORZ_AUTO_RATIO; + if (Vratio == 1.0) + { + save->fp_vert_stretch = orig->fp_vert_stretch; + save->fp_vert_stretch &= ~(RADEON_VERT_STRETCH_ENABLE| + RADEON_VERT_STRETCH_BLEND); + } + else + { save->fp_vert_stretch = - (((((int)(Vratio * RADEON_VERT_STRETCH_RATIO_MAX + 0.5)) - & RADEON_VERT_STRETCH_RATIO_MASK) - << RADEON_VERT_STRETCH_RATIO_SHIFT) | + (((((unsigned long)(Vratio * RADEON_VERT_STRETCH_RATIO_MAX + + 0.5)) & RADEON_VERT_STRETCH_RATIO_MASK)) | (orig->fp_vert_stretch & (RADEON_VERT_PANEL_SIZE | RADEON_VERT_STRETCH_RESERVED))); - save->fp_vert_stretch &= ~RADEON_VERT_AUTO_RATIO_EN; - if (Vratio == 1.0) save->fp_vert_stretch &= ~(RADEON_VERT_STRETCH_ENABLE | - RADEON_VERT_STRETCH_BLEND); - else save->fp_vert_stretch |= (RADEON_VERT_STRETCH_ENABLE | + save->fp_vert_stretch |= (RADEON_VERT_STRETCH_ENABLE | RADEON_VERT_STRETCH_BLEND); + } + save->fp_vert_stretch &= ~RADEON_VERT_AUTO_RATIO_EN; - save->fp_gen_cntl = (orig->fp_gen_cntl & ~(RADEON_FP_SEL_CRTC2 | - RADEON_FP_CRTC_USE_SHADOW_VEND | - RADEON_FP_CRTC_HORZ_DIV2_EN | - RADEON_FP_CRTC_HOR_CRT_DIV2_DIS | - RADEON_FP_USE_SHADOW_EN)); - if (orig->fp_gen_cntl & RADEON_FP_DETECT_SENSE) { + save->fp_gen_cntl = (orig->fp_gen_cntl & (CARD32) + ~(RADEON_FP_SEL_CRTC2 | + RADEON_FP_RMX_HVSYNC_CONTROL_EN | + RADEON_FP_DFP_SYNC_SEL | + RADEON_FP_CRT_SYNC_SEL | + RADEON_FP_CRTC_LOCK_8DOT | + RADEON_FP_USE_SHADOW_EN | + RADEON_FP_CRTC_USE_SHADOW_VEND | + RADEON_FP_CRT_SYNC_ALT)); save->fp_gen_cntl |= (RADEON_FP_CRTC_DONT_SHADOW_VPAR | - RADEON_FP_TDMS_EN); - } + RADEON_FP_CRTC_DONT_SHADOW_HEND ); - save->fp_panel_cntl = orig->fp_panel_cntl; save->lvds_gen_cntl = orig->lvds_gen_cntl; - + save->lvds_pll_cntl = orig->lvds_pll_cntl; save->tmds_crc = orig->tmds_crc; - /* Disable CRT output by disabling CRT output and setting the CRT - DAC to use CRTC2, which we set to 0's. In the future, we will - want to use the dual CRTC capabilities of the RADEON to allow both - the flat panel and external CRT to either simultaneously display - the same image or display two different images. */ + /* Disable CRT output by disabling CRT output for DFP*/ save->crtc_ext_cntl &= ~RADEON_CRTC_CRT_ON; - save->dac_cntl |= RADEON_DAC_CRT_SEL_CRTC2; - save->crtc2_gen_cntl = 0; - /* WARNING: Be careful about turning on the flat panel */ -#if 1 + if(info->DisplayType == MT_LCD) + { save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_BLON); -#else - save->fp_panel_cntl |= (RADEON_FP_DIGON | RADEON_FP_BLON); - save->fp_gen_cntl |= (RADEON_FP_FPON); -#endif + save->fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); + } + else if(info->DisplayType == MT_DFP) + save->fp_gen_cntl |= (RADEON_FP_FPON | RADEON_FP_TMDS_EN); + + save->fp_crtc_h_total_disp = orig->fp_crtc_h_total_disp; + save->fp_crtc_v_total_disp = orig->fp_crtc_v_total_disp; + save->fp_h_sync_strt_wid = orig->fp_h_sync_strt_wid; + save->fp_v_sync_strt_wid = orig->fp_v_sync_strt_wid; - save->fp_crtc_h_total_disp = save->crtc_h_total_disp; - save->fp_crtc_v_total_disp = save->crtc_v_total_disp; - save->fp_h_sync_strt_wid = save->crtc_h_sync_strt_wid; - save->fp_v_sync_strt_wid = save->crtc_v_sync_strt_wid; } -#endif /* Define PLL registers for requested video mode. */ static void RADEONInitPLLRegisters(RADEONSavePtr save, RADEONPLLPtr pll, @@ -2702,6 +4015,57 @@ static void RADEONInitPLLRegisters(RADEONSavePtr save, RADEONPLLPtr pll, save->htotal_cntl = 0; } +/* Define PLL2 registers for requested video mode. */ +static void RADEONInitPLL2Registers(RADEONSavePtr save, RADEONPLLPtr pll, + double dot_clock) +{ + unsigned long freq = dot_clock * 100; + struct { + int divider; + int bitvalue; + } *post_div, + post_divs[] = { + /* From RAGE 128 VR/RAGE 128 GL Register + Reference Manual (Technical Reference + Manual P/N RRG-G04100-C Rev. 0.04), page + 3-17 (PLL_DIV_[3:0]). */ + { 1, 0 }, /* VCLK_SRC */ + { 2, 1 }, /* VCLK_SRC/2 */ + { 4, 2 }, /* VCLK_SRC/4 */ + { 8, 3 }, /* VCLK_SRC/8 */ + { 3, 4 }, /* VCLK_SRC/3 */ + { 16, 5 }, /* VCLK_SRC/16 */ + { 6, 6 }, /* VCLK_SRC/6 */ + { 12, 7 }, /* VCLK_SRC/12 */ + { 0, 0 } + }; + + if (freq > pll->max_pll_freq) freq = pll->max_pll_freq; + if (freq * 12 < pll->min_pll_freq) freq = pll->min_pll_freq / 12; + + for (post_div = &post_divs[0]; post_div->divider; ++post_div) { + save->pll_output_freq_2 = post_div->divider * freq; + if (save->pll_output_freq_2 >= pll->min_pll_freq + && save->pll_output_freq_2 <= pll->max_pll_freq) break; + } + + save->dot_clock_freq_2 = freq; + save->feedback_div_2 = RADEONDiv(pll->reference_div + * save->pll_output_freq_2, + pll->reference_freq); + save->post_div_2 = post_div->divider; + + RADEONTRACE(("dc=%d, of=%d, fd=%d, pd=%d\n", + save->dot_clock_freq_2, + save->pll_output_freq_2, + save->feedback_div_2, + save->post_div_2)); + + save->p2pll_ref_div = pll->reference_div; + save->p2pll_div_0 = (save->feedback_div_2 | (post_div->bitvalue<<16)); + save->htotal_cntl2 = 0; +} + /* Define DDA registers for requested video mode. */ static Bool RADEONInitDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, RADEONPLLPtr pll, RADEONInfoPtr info) @@ -2770,10 +4134,12 @@ static Bool RADEONInitDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, /* Define initial palette for requested video mode. This doesn't do anything for XFree86 4.0. */ +/* static void RADEONInitPalette(RADEONSavePtr save) { save->palette_valid = FALSE; } +*/ /* Define registers for a requested video mode. */ static Bool RADEONInit(ScrnInfoPtr pScrn, DisplayModePtr mode, @@ -2831,17 +4197,43 @@ static Bool RADEONInit(ScrnInfoPtr pScrn, DisplayModePtr mode, info->Flags = mode->Flags; + if(info->IsSecondary) + { + if (!RADEONInitCrtc2Registers(pScrn, save, + pScrn->currentMode,info)) + return FALSE; + RADEONInitPLL2Registers(save, &info->pll, dot_clock); + } + else + { RADEONInitCommonRegisters(save, info); - if (!RADEONInitCrtcRegisters(pScrn, save, mode, info)) return FALSE; -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ - if (info->HasPanelRegs) - RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info); -#endif + if(!RADEONInitCrtcRegisters(pScrn, save, mode, info)) + return FALSE; + if(dot_clock) + { RADEONInitPLLRegisters(save, &info->pll, dot_clock); if (!RADEONInitDDARegisters(pScrn, save, &info->pll, info)) return FALSE; - if (!info->PaletteSavedOnVT) RADEONInitPalette(save); + } + else + { + save->ppll_ref_div = info->SavedReg.ppll_ref_div; + save->ppll_div_3 = info->SavedReg.ppll_div_3; + save->htotal_cntl = info->SavedReg.htotal_cntl; + save->dda_config = info->SavedReg.dda_config; + save->dda_on_off = info->SavedReg.dda_on_off; + + } + /* not used for now */ + /*if (!info->PaletteSavedOnVT) RADEONInitPalette(save);*/ + } + + + if (((info->DisplayType == MT_DFP) || + (info->DisplayType == MT_LCD))) + { + RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info); + } RADEONTRACE(("RADEONInit returns %p\n", save)); return TRUE; @@ -2854,13 +4246,13 @@ static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!RADEONInit(pScrn, mode, &info->ModeReg)) return FALSE; /* FIXME? DRILock/DRIUnlock here? */ + pScrn->vtSema = TRUE; RADEONBlank(pScrn); RADEONRestoreMode(pScrn, &info->ModeReg); RADEONUnblank(pScrn); info->CurrentLayout.mode = mode; - return TRUE; } @@ -2884,31 +4276,38 @@ static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode) Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + /* when switch mode in dual-head setup, this function will be called + separately for each screen (depending on which screen the cursor is + in when user press ctrl-alt-+). Since this function is always + called when screen already in extensive mode, the sequence of + setting CRTC2 and CRT_EXT regesters doesn't matter any more, + So we set the flag for RADEONRestoreMode here. */ + info->SwitchingMode = TRUE; return RADEONModeInit(xf86Screens[scrnIndex], mode); + info->SwitchingMode = FALSE; } /* Used to disallow modes that are not supported by the hardware. */ int RADEONValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flag) { -#ifdef ENABLE_FLAT_PANEL - /* Note: Radeon flat panel support has been disabled for now */ + + /* Searching for native mode timing table embedded in BIOS image. + Not working yet. Currently we calculate from FP registers*/ + /****** ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RADEONInfoPtr info = RADEONPTR(pScrn); - - if (info->HasPanelRegs) { - if (mode->Flags & V_INTERLACE) return MODE_NO_INTERLACE; - if (mode->Flags & V_DBLSCAN) return MODE_NO_DBLESCAN; - } - - if (info->HasPanelRegs && !info->CRTOnly && info->VBIOS) { + if (info->DisplayType == MT_LCD && info->VBIOS) + { int i; - for (i = info->FPBIOSstart+64; RADEON_BIOS16(i) != 0; i += 2) { + for (i = info->FPBIOSstart+0x40; RADEON_BIOS16(i) != 0; i += 2) { int j = RADEON_BIOS16(i); if (mode->CrtcHDisplay == RADEON_BIOS16(j) && mode->CrtcVDisplay == RADEON_BIOS16(j+2)) { - /* Assume we are using expanded mode */ if (RADEON_BIOS16(j+5)) j = RADEON_BIOS16(j+5); else j += 9; @@ -2931,13 +4330,11 @@ int RADEONValidMode(int scrnIndex, DisplayModePtr mode, mode->CrtcVSyncStart + ((RADEON_BIOS16(j+19) >> 11)&0x1f); mode->VTotal = mode->CrtcVTotal = (RADEON_BIOS16(j+15) & 0x07ff)+1; - return MODE_OK; } } return MODE_NOMODE; - } -#endif + }*****/ return MODE_OK; } @@ -2962,7 +4359,14 @@ void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags) Base &= ~7; /* 3 lower bits are always 0 */ + if(info->IsSecondary) + { + Base += pScrn->fbOffset; + OUTREG(RADEON_CRTC2_OFFSET, Base); + } + else OUTREG(RADEON_CRTC_OFFSET, Base); + } /* Called when VT switching back to the X server. Reinitialize the video @@ -2980,12 +4384,12 @@ Bool RADEONEnterVT(int scrnIndex, int flags) } #endif if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE; + if (info->accelOn) RADEONEngineRestore(pScrn); - info->PaletteSavedOnVT = FALSE; + /*info->PaletteSavedOnVT = FALSE;*/ RADEONAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - return TRUE; } @@ -2995,7 +4399,7 @@ void RADEONLeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONSavePtr save = &info->ModeReg; + /*RADEONSavePtr save = &info->ModeReg;*/ RADEONTRACE(("RADEONLeaveVT\n")); #ifdef XF86DRI @@ -3004,8 +4408,11 @@ void RADEONLeaveVT(int scrnIndex, int flags) RADEONCP_STOP(pScrn, info); } #endif + /* not used at present */ + /* RADEONSavePalette(pScrn, save); - info->PaletteSavedOnVT = TRUE; + info->PaletteSavedOnVT = TRUE;*/ + RADEONRestore(pScrn); } @@ -3049,7 +4456,8 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) } #endif - if (pScrn->vtSema) { + if (pScrn->vtSema) + { RADEONRestore(pScrn); RADEONUnmapMem(pScrn); } @@ -3068,6 +4476,8 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) pScrn->vtSema = FALSE; + xf86ClearPrimInitDone(pScrn->entityList[0]); + pScreen->BlockHandler = info->BlockHandler; pScreen->CloseScreen = info->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); @@ -3078,6 +4488,7 @@ void RADEONFreeScreen(int scrnIndex, int flags) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; RADEONTRACE(("RADEONFreeScreen\n")); + if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) vgaHWFreeHWRec(pScrn); RADEONFreeRec(pScrn); @@ -3114,3 +4525,5 @@ static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn, break; } } + + 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 474943ce8..962ff1c36 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.9 2001/05/04 19:05:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.12 2001/07/25 08:04:43 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -78,7 +78,11 @@ SymTabRec RADEONChipsets[] = { { PCI_CHIP_RADEON_QE, "ATI Radeon QE (AGP)" }, { PCI_CHIP_RADEON_QF, "ATI Radeon QF (AGP)" }, { PCI_CHIP_RADEON_QG, "ATI Radeon QG (AGP)" }, - { PCI_CHIP_RADEON_VE, "ATI Radeon VE (AGP)" }, + { PCI_CHIP_RADEON_QY, "ATI Radeon VE QY (AGP)" }, + { PCI_CHIP_RADEON_QZ, "ATI Radeon VE QZ (AGP)" }, + { PCI_CHIP_RADEON_LW, "ATI Radeon Mobility LW (AGP)" }, + { PCI_CHIP_RADEON_LY, "ATI Radeon Mobility LY (AGP)" }, + { PCI_CHIP_RADEON_LZ, "ATI Radeon Mobility LZ (AGP)" }, { -1, NULL } }; @@ -87,10 +91,16 @@ PciChipsets RADEONPciChipsets[] = { { PCI_CHIP_RADEON_QE, PCI_CHIP_RADEON_QE, RES_SHARED_VGA }, { PCI_CHIP_RADEON_QF, PCI_CHIP_RADEON_QF, RES_SHARED_VGA }, { PCI_CHIP_RADEON_QG, PCI_CHIP_RADEON_QG, RES_SHARED_VGA }, - { PCI_CHIP_RADEON_VE, PCI_CHIP_RADEON_VE, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_QY, PCI_CHIP_RADEON_QY, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_QZ, PCI_CHIP_RADEON_QZ, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_LW, PCI_CHIP_RADEON_LW, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_LY, PCI_CHIP_RADEON_LY, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_LZ, PCI_CHIP_RADEON_LZ, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; +int gRADEONEntityIndex = -1; + /* Return the options for supported chipset 'n'; NULL otherwise */ const OptionInfoRec * RADEONAvailableOptions(int chipid, int busid) @@ -127,7 +137,6 @@ RADEONProbe(DriverPtr drv, int flags) int numDevSections, nATIGDev, nRadeonGDev; int *usedChips; GDevPtr *devSections, *ATIGDevs, *RadeonGDevs; - EntityInfoPtr pEnt; Bool foundScreen = FALSE; int i; @@ -170,14 +179,16 @@ RADEONProbe(DriverPtr drv, int flags) if (numUsed<=0) return FALSE; - if (flags & PROBE_DETECT) - foundScreen = TRUE; - else for (i = 0; i < numUsed; i++) { - pEnt = xf86GetEntityInfo(usedChips[i]); - - if (pEnt->active) { - ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); + if (flags & PROBE_DETECT) foundScreen = TRUE; + else for (i = 0; i < numUsed; i++) + { + ScrnInfoPtr pScrn; + EntityInfoPtr pEnt; + pScrn = NULL; + if((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], + RADEONPciChipsets, 0, 0, 0, 0, 0))) + { #ifdef XFree86LOADER if (!xf86LoadSubModule(pScrn, "radeon")) { @@ -188,7 +199,6 @@ RADEONProbe(DriverPtr drv, int flags) } xf86LoaderReqSymLists(RADEONSymbols, NULL); - #endif pScrn->driverVersion = RADEON_VERSION_CURRENT; @@ -203,11 +213,44 @@ RADEONProbe(DriverPtr drv, int flags) pScrn->LeaveVT = RADEONLeaveVT; pScrn->FreeScreen = RADEONFreeScreen; pScrn->ValidMode = RADEONValidMode; - foundScreen = TRUE; - xf86ConfigActivePciEntity(pScrn, usedChips[i], RADEONPciChipsets, - 0, 0, 0, 0, 0); + } + + pEnt = xf86GetEntityInfo(usedChips[i]); + + /* VE/M6 card support Dual-Head, mark the entity as sharable*/ + if(pEnt->chipset == PCI_CHIP_RADEON_QY || + pEnt->chipset == PCI_CHIP_RADEON_QZ || + pEnt->chipset == PCI_CHIP_RADEON_LW || + pEnt->chipset == PCI_CHIP_RADEON_LY || + pEnt->chipset == PCI_CHIP_RADEON_LZ) + { + static int instance = 0; + DevUnion* pPriv; + + xf86SetEntitySharable(usedChips[i]); + xf86SetEntityInstanceForScreen(pScrn, + pScrn->entityList[0], instance); + + if(gRADEONEntityIndex < 0) + { + gRADEONEntityIndex = xf86AllocateEntityPrivateIndex(); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + gRADEONEntityIndex); + + if (!pPriv->ptr) + { + RADEONEntPtr pRADEONEnt; + pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1); + pRADEONEnt = pPriv->ptr; + pRADEONEnt->IsDRIEnabled = FALSE; + pRADEONEnt->BypassSecondary = FALSE; + pRADEONEnt->HasSecondary = FALSE; + pRADEONEnt->IsSecondaryRestored = FALSE; + } + } + instance++; } xfree(pEnt); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h index 94f11d01e..8439de232 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.6 2001/07/25 08:04:43 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -41,6 +41,21 @@ #include "xf86str.h" +typedef struct +{ + Bool IsDRIEnabled; + + Bool HasSecondary; + Bool BypassSecondary; + /*These two registers are used to make sure the CRTC2 is + retored before CRTC_EXT, otherwise it could lead to blank screen.*/ + Bool IsSecondaryRestored; + Bool RestorePrimary; + + ScrnInfoPtr pSecondaryScrn; + ScrnInfoPtr pPrimaryScrn; +}RADEONEntRec, *RADEONEntPtr; + /* radeon_probe.c */ extern const OptionInfoRec * RADEONAvailableOptions FunctionPrototype((int, int)); 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 68d4d2685..4b8b727c9 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.9 2001/05/02 15:06:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.11 2001/08/17 22:08:13 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -85,9 +85,9 @@ #if !RADEON_ATOMIC_UPDATE #define OUTPLL(addr, val) \ do { \ - while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & 0x9f) != \ + while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & 0xbf) != \ (addr | RADEON_PLL_WR_EN)) { \ - OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x1f) | \ + OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \ RADEON_PLL_WR_EN)); \ } \ OUTREG(RADEON_CLOCK_CNTL_DATA, val); \ @@ -95,7 +95,7 @@ #else #define OUTPLL(addr, val) \ do { \ - OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x1f) | \ + OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \ RADEON_PLL_WR_EN)); \ OUTREG(RADEON_CLOCK_CNTL_DATA, val); \ } while (0) @@ -139,15 +139,16 @@ #define PAL_SELECT(idx) \ do { \ - if (idx) { \ - OUTREG(RADEON_DAC_CNTL, INREG(RADEON_DAC_CNTL) | \ - RADEON_DAC_PALETTE_ACC_CTL); \ + if (!idx) { \ + OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) & \ + (CARD32)~RADEON_DAC2_PALETTE_ACC_CTL); \ } else { \ - OUTREG(RADEON_DAC_CNTL, INREG(RADEON_DAC_CNTL) & \ - (CARD32)~RADEON_DAC_PALETTE_ACC_CTL); \ + OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) | \ + RADEON_DAC2_PALETTE_ACC_CTL); \ } \ } while (0) + #define RADEON_ADAPTER_ID 0x0f2c /* PCI */ #define RADEON_AGP_BASE 0x0170 #define RADEON_AGP_CNTL 0x0174 @@ -203,6 +204,10 @@ #define RADEON_BIOS_1_SCRATCH 0x0014 #define RADEON_BIOS_2_SCRATCH 0x0018 #define RADEON_BIOS_3_SCRATCH 0x001c +#define RADEON_BIOS_4_SCRATCH 0x0020 +#define RADEON_BIOS_5_SCRATCH 0x0024 +#define RADEON_BIOS_6_SCRATCH 0x0028 +#define RADEON_BIOS_7_SCRATCH 0x002c #define RADEON_BIOS_ROM 0x0f30 /* PCI */ #define RADEON_BIST 0x0f0f /* PCI */ #define RADEON_BRUSH_DATA0 0x1480 @@ -292,6 +297,7 @@ #define RADEON_CLOCK_CNTL_INDEX 0x0008 # define RADEON_PLL_WR_EN (1 << 7) # define RADEON_PLL_DIV_SEL (3 << 8) +# define RADEON_PLL2_DIV_SEL_MASK ~(3 << 8) #define RADEON_CLR_CMP_CLR_3D 0x1a24 #define RADEON_CLR_CMP_CLR_DST 0x15c8 #define RADEON_CLR_CMP_CLR_SRC 0x15c4 @@ -329,6 +335,7 @@ # define RADEON_CRTC_HSYNC_DIS (1 << 8) # define RADEON_CRTC_VSYNC_DIS (1 << 9) # define RADEON_CRTC_DISPLAY_DIS (1 << 10) +# define RADEON_CRTC_SYNC_TRISTAT (1 << 11) # define RADEON_CRTC_CRT_ON (1 << 15) #define RADEON_CRTC_EXT_CNTL_DPMS_BYTE 0x0055 # define RADEON_CRTC_HSYNC_DIS_BYTE (1 << 0) @@ -344,23 +351,54 @@ # define RADEON_CRTC_EXT_DISP_EN (1 << 24) # define RADEON_CRTC_EN (1 << 25) # define RADEON_CRTC_DISP_REQ_EN_B (1 << 26) +#define RADEON_CRTC2_GEN_CNTL 0x03f8 +# define RADEON_CRTC2_DBL_SCAN_EN (1 << 0) +# define RADEON_CRTC2_INTERLACE_EN (1 << 1) +# define RADEON_CRTC2_SYNC_TRISTAT (1 << 4) +# define RADEON_CRTC2_HSYNC_TRISTAT (1 << 5) +# define RADEON_CRTC2_VSYNC_TRISTAT (1 << 6) +# define RADEON_CRTC2_CRT2_ON (1 << 7) +# define RADEON_CRTC2_ICON_EN (1 << 15) +# define RADEON_CRTC2_CUR_EN (1 << 16) +# define RADEON_CRTC2_CUR_MODE_MASK (7 << 20) +# define RADEON_CRTC2_DISP_DIS (1 << 23) +# define RADEON_CRTC2_EN (1 << 25) +# define RADEON_CRTC2_DISP_REQ_EN_B (1 << 26) +# define RADEON_CRTC2_HSYNC_DIS (1 << 28) +# define RADEON_CRTC2_VSYNC_DIS (1 << 29) #define RADEON_CRTC_GUI_TRIG_VLINE 0x0218 #define RADEON_CRTC_H_SYNC_STRT_WID 0x0204 # define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0) -# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x1ff << 3) +# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x3ff << 3) # define RADEON_CRTC_H_SYNC_STRT_CHAR_SHIFT 3 # define RADEON_CRTC_H_SYNC_WID (0x3f << 16) # define RADEON_CRTC_H_SYNC_WID_SHIFT 16 # define RADEON_CRTC_H_SYNC_POL (1 << 23) +#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304 +# define RADEON_CRTC2_H_SYNC_STRT_PIX (0x07 << 0) +# define RADEON_CRTC2_H_SYNC_STRT_CHAR (0x3ff << 3) +# define RADEON_CRTC2_H_SYNC_STRT_CHAR_SHIFT 3 +# define RADEON_CRTC2_H_SYNC_WID (0x3f << 16) +# define RADEON_CRTC2_H_SYNC_WID_SHIFT 16 +# define RADEON_CRTC2_H_SYNC_POL (1 << 23) #define RADEON_CRTC_H_TOTAL_DISP 0x0200 -# define RADEON_CRTC_H_TOTAL (0x01ff << 0) +# define RADEON_CRTC_H_TOTAL (0x03ff << 0) # define RADEON_CRTC_H_TOTAL_SHIFT 0 -# define RADEON_CRTC_H_DISP (0x00ff << 16) +# define RADEON_CRTC_H_DISP (0x01ff << 16) # define RADEON_CRTC_H_DISP_SHIFT 16 +#define RADEON_CRTC2_H_TOTAL_DISP 0x0300 +# define RADEON_CRTC2_H_TOTAL (0x03ff << 0) +# define RADEON_CRTC2_H_TOTAL_SHIFT 0 +# define RADEON_CRTC2_H_DISP (0x01ff << 16) +# define RADEON_CRTC2_H_DISP_SHIFT 16 #define RADEON_CRTC_OFFSET 0x0224 +#define RADEON_CRTC2_OFFSET 0x0324 #define RADEON_CRTC_OFFSET_CNTL 0x0228 # define RADEON_CRTC_TILE_EN (1 << 15) +#define RADEON_CRTC2_OFFSET_CNTL 0x0328 +# define RADEON_CRTC2_TILE_EN (1 << 15) #define RADEON_CRTC_PITCH 0x022c +#define RADEON_CRTC2_PITCH 0x032c #define RADEON_CRTC_STATUS 0x005c # define RADEON_CRTC_VBLANK_SAVE (1 << 1) #define RADEON_CRTC_V_SYNC_STRT_WID 0x020c @@ -369,25 +407,28 @@ # define RADEON_CRTC_V_SYNC_WID (0x1f << 16) # define RADEON_CRTC_V_SYNC_WID_SHIFT 16 # define RADEON_CRTC_V_SYNC_POL (1 << 23) +#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c +# define RADEON_CRTC2_V_SYNC_STRT (0x7ff << 0) +# define RADEON_CRTC2_V_SYNC_STRT_SHIFT 0 +# define RADEON_CRTC2_V_SYNC_WID (0x1f << 16) +# define RADEON_CRTC2_V_SYNC_WID_SHIFT 16 +# define RADEON_CRTC2_V_SYNC_POL (1 << 23) #define RADEON_CRTC_V_TOTAL_DISP 0x0208 # define RADEON_CRTC_V_TOTAL (0x07ff << 0) # define RADEON_CRTC_V_TOTAL_SHIFT 0 # define RADEON_CRTC_V_DISP (0x07ff << 16) # define RADEON_CRTC_V_DISP_SHIFT 16 +#define RADEON_CRTC2_V_TOTAL_DISP 0x0308 +# define RADEON_CRTC2_V_TOTAL (0x07ff << 0) +# define RADEON_CRTC2_V_TOTAL_SHIFT 0 +# define RADEON_CRTC2_V_DISP (0x07ff << 16) +# define RADEON_CRTC2_V_DISP_SHIFT 16 #define RADEON_CRTC_VLINE_CRNT_VLINE 0x0210 # define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16) #define RADEON_CRTC2_CRNT_FRAME 0x0314 #define RADEON_CRTC2_DEBUG 0x031c -#define RADEON_CRTC2_GEN_CNTL 0x03f8 #define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318 -#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304 -#define RADEON_CRTC2_H_TOTAL_DISP 0x0300 -#define RADEON_CRTC2_OFFSET 0x0324 -#define RADEON_CRTC2_OFFSET_CNTL 0x0328 -#define RADEON_CRTC2_PITCH 0x032c #define RADEON_CRTC2_STATUS 0x03fc -#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c -#define RADEON_CRTC2_V_TOTAL_DISP 0x0308 #define RADEON_CRTC2_VLINE_CRNT_VLINE 0x0310 #define RADEON_CRTC8_DATA 0x03d5 /* VGA, 0x3b5 */ #define RADEON_CRTC8_IDX 0x03d4 /* VGA, 0x3b4 */ @@ -397,15 +438,33 @@ #define RADEON_CUR_HORZ_VERT_POSN 0x0264 #define RADEON_CUR_OFFSET 0x0260 # define RADEON_CUR_LOCK (1 << 31) +#define RADEON_CUR2_CLR0 0x036c +#define RADEON_CUR2_CLR1 0x0370 +#define RADEON_CUR2_HORZ_VERT_OFF 0x0368 +#define RADEON_CUR2_HORZ_VERT_POSN 0x0364 +#define RADEON_CUR2_OFFSET 0x0360 +# define RADEON_CUR2_LOCK (1 << 31) #define RADEON_DAC_CNTL 0x0058 # define RADEON_DAC_RANGE_CNTL (3 << 0) # define RADEON_DAC_BLANKING (1 << 2) -# define RADEON_DAC_CRT_SEL_CRTC2 (1 << 4) -# define RADEON_DAC_PALETTE_ACC_CTL (1 << 5) # define RADEON_DAC_8BIT_EN (1 << 8) # define RADEON_DAC_VGA_ADR_EN (1 << 13) +# define RADEON_DAC_PDWN (1 << 15) # define RADEON_DAC_MASK_ALL (0xff << 24) +#define RADEON_DAC_CNTL2 0x007c +# define RADEON_DAC2_DAC_CLK_SEL (1 << 0) +# define RADEON_DAC2_DAC2_CLK_SEL (1 << 1) +# define RADEON_DAC2_PALETTE_ACC_CTL (1 << 5) +#define RADEON_TV_DAC_CNTL 0x088c +# define RADEON_TV_DAC_STD_MASK 0x0300 +# define RADEON_TV_DAC_RDACPD (1 << 24) +# define RADEON_TV_DAC_GDACPD (1 << 25) +# define RADEON_TV_DAC_BDACPD (1 << 26) +#define RADEON_DISP_OUTPUT_CNTL 0x0d64 +# define RADEON_DISP_DAC_SOURCE_MASK 0x03 +# define RADEON_DISP_DAC_SOURCE_CRTC2 0x01 + #define RADEON_DAC_CRC_SIG 0x02cc #define RADEON_DAC_DATA 0x03c9 /* VGA */ #define RADEON_DAC_MASK 0x03c6 /* VGA */ @@ -568,45 +627,85 @@ #define RADEON_FOG_TABLE_DATA 0x1a18 #define RADEON_FP_CRTC_H_TOTAL_DISP 0x0250 #define RADEON_FP_CRTC_V_TOTAL_DISP 0x0254 +#define RADEON_FP_CRTC2_H_TOTAL_DISP 0x0350 +#define RADEON_FP_CRTC2_V_TOTAL_DISP 0x0354 +/*added for FP support------------------------------------------*/ +# define RADEON_FP_CRTC_H_TOTAL_MASK 0x000003ff +# define RADEON_FP_CRTC_H_DISP_MASK 0x01ff0000 +# define RADEON_FP_CRTC_V_TOTAL_MASK 0x00000fff +# define RADEON_FP_CRTC_V_DISP_MASK 0x0fff0000 +# define RADEON_FP_H_SYNC_STRT_CHAR_MASK 0x00001ff8 +# define RADEON_FP_H_SYNC_WID_MASK 0x003f0000 +# define RADEON_FP_V_SYNC_STRT_MASK 0x00000fff +# define RADEON_FP_V_SYNC_WID_MASK 0x001f0000 +# define RADEON_FP_CRTC_H_TOTAL_SHIFT 0x00000000 +# define RADEON_FP_CRTC_H_DISP_SHIFT 0x00000010 +# define RADEON_FP_CRTC_V_TOTAL_SHIFT 0x00000000 +# define RADEON_FP_CRTC_V_DISP_SHIFT 0x00000010 +# define RADEON_FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003 +# define RADEON_FP_H_SYNC_WID_SHIFT 0x00000010 +# define RADEON_FP_V_SYNC_STRT_SHIFT 0x00000000 +# define RADEON_FP_V_SYNC_WID_SHIFT 0x00000010 +/*-----------------------------------------------------------------*/ #define RADEON_FP_GEN_CNTL 0x0284 -# define RADEON_FP_FPON (1 << 0) -# define RADEON_FP_TDMS_EN (1 << 2) +# define RADEON_FP_FPON (1 << 0) +# define RADEON_FP_TMDS_EN (1 << 2) +# define RADEON_FP_EN_TMDS (1 << 7) # define RADEON_FP_DETECT_SENSE (1 << 8) # define RADEON_FP_SEL_CRTC2 (1 << 13) +# define RADEON_FP_CRTC_DONT_SHADOW_HPAR (1 << 15) # define RADEON_FP_CRTC_DONT_SHADOW_VPAR (1 << 16) +# define RADEON_FP_CRTC_DONT_SHADOW_HEND (1 << 17) # define RADEON_FP_CRTC_USE_SHADOW_VEND (1 << 18) -# define RADEON_FP_CRTC_HORZ_DIV2_EN (1 << 20) -# define RADEON_FP_CRTC_HOR_CRT_DIV2_DIS (1 << 21) +# define RADEON_FP_RMX_HVSYNC_CONTROL_EN (1 << 20) +# define RADEON_FP_DFP_SYNC_SEL (1 << 21) +# define RADEON_FP_CRTC_LOCK_8DOT (1 << 22) +# define RADEON_FP_CRT_SYNC_SEL (1 << 23) # define RADEON_FP_USE_SHADOW_EN (1 << 24) +# define RADEON_FP_CRT_SYNC_ALT (1 << 26) +#define RADEON_FP2_GEN_CNTL 0x0288 +# define RADEON_FP2_FPON (1 << 0) +# define RADEON_FP2_TMDS_EN (1 << 2) +# define RADEON_FP2_EN_TMDS (1 << 7) +# define RADEON_FP2_DETECT_SENSE (1 << 8) +# define RADEON_FP2_SEL_CRTC2 (1 << 13) +# define RADEON_FP2_FP_POL (1 << 16) +# define RADEON_FP2_LP_POL (1 << 17) +# define RADEON_FP2_SCK_POL (1 << 18) +# define RADEON_FP2_LCD_CNTL_MASK (7 << 19) +# define RADEON_FP2_PAD_FLOP_EN (1 << 22) +# define RADEON_FP2_CRC_EN (1 << 23) +# define RADEON_FP2_CRC_READ_EN (1 << 24) + #define RADEON_FP_H_SYNC_STRT_WID 0x02c4 +#define RADEON_FP_H2_SYNC_STRT_WID 0x03c4 #define RADEON_FP_HORZ_STRETCH 0x028c +#define RADEON_FP_HORZ2_STRETCH 0x038c # define RADEON_HORZ_STRETCH_RATIO_MASK 0xffff -# define RADEON_HORZ_STRETCH_RATIO_SHIFT 0 # define RADEON_HORZ_STRETCH_RATIO_MAX 4096 -# define RADEON_HORZ_PANEL_SIZE (0xff << 16) +# define RADEON_HORZ_PANEL_SIZE (0x1ff << 16) # define RADEON_HORZ_PANEL_SHIFT 16 # define RADEON_HORZ_STRETCH_PIXREP (0 << 25) -# define RADEON_HORZ_STRETCH_BLEND (1 << 25) -# define RADEON_HORZ_STRETCH_ENABLE (1 << 26) -# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 27) -# define RADEON_HORZ_STRETCH_RESERVED (1 << 30) -# define RADEON_HORZ_AUTO_RATIO_FIX_EN (1 << 31) - -#define RADEON_FP_PANEL_CNTL 0x0288 -# define RADEON_FP_DIGON (1 << 0) -# define RADEON_FP_BLON (1 << 1) +# define RADEON_HORZ_STRETCH_BLEND (1 << 26) +# define RADEON_HORZ_STRETCH_ENABLE (1 << 25) +# define RADEON_HORZ_AUTO_RATIO (1 << 27) +# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 28) +# define RADEON_HORZ_AUTO_RATIO_INC (1 << 31) + #define RADEON_FP_V_SYNC_STRT_WID 0x02c8 #define RADEON_FP_VERT_STRETCH 0x0290 -# define RADEON_VERT_PANEL_SIZE (0x7ff << 0) -# define RADEON_VERT_PANEL_SHIFT 0 -# define RADEON_VERT_STRETCH_RATIO_MASK 0x3ff -# define RADEON_VERT_STRETCH_RATIO_SHIFT 11 -# define RADEON_VERT_STRETCH_RATIO_MAX 1024 -# define RADEON_VERT_STRETCH_ENABLE (1 << 24) -# define RADEON_VERT_STRETCH_LINEREP (0 << 25) -# define RADEON_VERT_STRETCH_BLEND (1 << 25) -# define RADEON_VERT_AUTO_RATIO_EN (1 << 26) -# define RADEON_VERT_STRETCH_RESERVED 0xf8e00000 +#define RADEON_FP_V2_SYNC_STRT_WID 0x03c8 +#define RADEON_FP_VERT2_STRETCH 0x0390 +# define RADEON_VERT_PANEL_SIZE (0xfff << 12) +# define RADEON_VERT_PANEL_SHIFT 12 +# define RADEON_VERT_STRETCH_RATIO_MASK 0xfff +# define RADEON_VERT_STRETCH_RATIO_SHIFT 0 +# define RADEON_VERT_STRETCH_RATIO_MAX 4096 +# define RADEON_VERT_STRETCH_ENABLE (1 << 25) +# define RADEON_VERT_STRETCH_LINEREP (0 << 26) +# define RADEON_VERT_STRETCH_BLEND (1 << 26) +# define RADEON_VERT_AUTO_RATIO_EN (1 << 27) +# define RADEON_VERT_STRETCH_RESERVED 0xf1000000 #define RADEON_GEN_INT_CNTL 0x0040 #define RADEON_GEN_INT_STATUS 0x0044 @@ -619,24 +718,24 @@ #define RADEON_GENMO_WT 0x03c2 /* VGA */ #define RADEON_GENS0 0x03c2 /* VGA */ #define RADEON_GENS1 0x03da /* VGA, 0x03ba */ + +/*DDC interface using I2C*/ #define RADEON_GPIO_MONID 0x0068 -# define RADEON_GPIO_MONID_A_0 (1 << 0) -# define RADEON_GPIO_MONID_A_1 (1 << 1) -# define RADEON_GPIO_MONID_A_2 (1 << 2) -# define RADEON_GPIO_MONID_A_3 (1 << 3) -# define RADEON_GPIO_MONID_Y_0 (1 << 8) -# define RADEON_GPIO_MONID_Y_1 (1 << 9) -# define RADEON_GPIO_MONID_Y_2 (1 << 10) -# define RADEON_GPIO_MONID_Y_3 (1 << 11) -# define RADEON_GPIO_MONID_EN_0 (1 << 16) -# define RADEON_GPIO_MONID_EN_1 (1 << 17) -# define RADEON_GPIO_MONID_EN_2 (1 << 18) -# define RADEON_GPIO_MONID_EN_3 (1 << 19) -# define RADEON_GPIO_MONID_MASK_0 (1 << 24) -# define RADEON_GPIO_MONID_MASK_1 (1 << 25) -# define RADEON_GPIO_MONID_MASK_2 (1 << 26) -# define RADEON_GPIO_MONID_MASK_3 (1 << 27) #define RADEON_GPIO_MONIDB 0x006c +#define RADEON_GPIO_CRT2_DDC 0x006c +#define RADEON_GPIO_DVI_DDC 0x0064 +#define RADEON_GPIO_VGA_DDC 0x0060 +# define RADEON_GPIO_A_0 (1 << 0) +# define RADEON_GPIO_A_1 (1 << 1) +# define RADEON_GPIO_Y_0 (1 << 8) +# define RADEON_GPIO_Y_1 (1 << 9) +# define RADEON_GPIO_Y_SHIFT_0 8 +# define RADEON_GPIO_Y_SHIFT_1 9 +# define RADEON_GPIO_EN_0 (1 << 16) +# define RADEON_GPIO_EN_1 (1 << 17) +# define RADEON_GPIO_MASK_0 (1 << 24) /*??*/ +# define RADEON_GPIO_MASK_1 (1 << 25) /*??*/ + #define RADEON_GRPH8_DATA 0x03cf /* VGA */ #define RADEON_GRPH8_IDX 0x03ce /* VGA */ #define RADEON_GUI_DEBUG0 0x16a0 @@ -663,11 +762,14 @@ #define RADEON_HOST_DATA7 0x17dc #define RADEON_HOST_DATA_LAST 0x17e0 #define RADEON_HOST_PATH_CNTL 0x0130 +# define RADEON_HDP_SOFT_RESET (1 << 26) #define RADEON_HTOTAL_CNTL 0x0009 /* PLL */ +#define RADEON_HTOTAL2_CNTL 0x002e /* PLL */ #define RADEON_HW_DEBUG 0x0128 #define RADEON_HW_DEBUG2 0x011c #define RADEON_I2C_CNTL_1 0x0094 /* ? */ +#define RADEON_DVI_I2C_CNTL_1 0x02e4 /* ? */ #define RADEON_INTERRUPT_LINE 0x0f3c /* PCI */ #define RADEON_INTERRUPT_PIN 0x0f3d /* PCI */ #define RADEON_IO_BASE 0x0f14 /* PCI */ @@ -678,8 +780,15 @@ #define RADEON_LEAD_BRES_LNTH_SUB 0x1624 #define RADEON_LVDS_GEN_CNTL 0x02d0 # define RADEON_LVDS_ON (1 << 0) +# define RADEON_LVDS_DISPLAY_DIS (1 << 1) +# define RADEON_LVDS_PANEL_TYPE (1 << 2) +# define RADEON_LVDS_PANEL_FORMAT (1 << 3) +# define RADEON_LVDS_EN (1 << 7) +# define RADEON_LVDS_DIGON (1 << 18) # define RADEON_LVDS_BLON (1 << 19) # define RADEON_LVDS_SEL_CRTC2 (1 << 23) +#define RADEON_LVDS_PLL_CNTL 0x02d4 + # define RADEON_HSYNC_DELAY_SHIFT 28 # define RADEON_HSYNC_DELAY_MASK (0xf << 28) @@ -860,6 +969,19 @@ # define RADEON_PPLL_REF_DIV_MASK 0x03ff # define RADEON_PPLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ # define RADEON_PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ +#define RADEON_P2PLL_CNTL 0x002a /* P2PLL */ +# define RADEON_P2PLL_RESET (1 << 0) +# define RADEON_P2PLL_SLEEP (1 << 1) +# define RADEON_P2PLL_ATOMIC_UPDATE_EN (1 << 16) +# define RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN (1 << 17) +# define RADEON_P2PLL_ATOMIC_UPDATE_VSYNC (1 << 18) +#define RADEON_P2PLL_DIV_0 0x002c +# define RADEON_P2PLL_FB0_DIV_MASK 0x07ff +# define RADEON_P2PLL_POST0_DIV_MASK 0x00070000 +#define RADEON_P2PLL_REF_DIV 0x002B /* PLL */ +# define RADEON_P2PLL_REF_DIV_MASK 0x03ff +# define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */ +# define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ #define RADEON_PWR_MNGMT_CNTL_STATUS 0x0f60 /* PCI */ #define RADEON_RBBM_SOFT_RESET 0x00f0 # define RADEON_SOFT_RESET_CP (1 << 0) @@ -1630,3 +1752,4 @@ #define RADEON_CP_VC_CNTL_NUM_SHIFT 16 #endif + 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 f4758c793..3a136781e 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.11 2001/03/03 22:26:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.12 2001/07/19 02:22:50 tsi Exp $ */ #include "radeon.h" #include "radeon_reg.h" @@ -205,7 +205,7 @@ RADEONSetupImageVideo(ScreenPtr pScreen) adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "ATI Rage128 Video Overlay"; + adapt->name = "ATI Radeon Video Overlay"; adapt->nEncodings = 1; adapt->pEncodings = &DummyEncoding; adapt->nFormats = NUM_FORMATS; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c index 6f3e7fb8c..3470f1fcb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.7 2001/05/15 10:19:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.8 2001/06/15 21:22:48 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -402,7 +402,7 @@ CHIPSClipVideo( } static void -CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shadow) { CHIPSPortPrivPtr pPriv = (CHIPSPortPrivPtr)data; CHIPSPtr cPtr = CHIPSPTR(pScrn); @@ -410,7 +410,7 @@ CHIPSStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) REGION_EMPTY(pScrn->pScreen, &pPriv->clip); CHIPSHiQVSync(pScrn); - if(exit) { + if(shadow) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c & 0xFE)); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c index 3c678f6f9..89eb3192f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.20 2001/05/04 19:05:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.24 2001/08/17 13:27:55 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -155,53 +155,53 @@ static int gd7548_MaxClocks[] = { 80100, 80100, 80100, 80100, 80100 }; */ static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWHandleColormaps", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWddc1SetSpeed", + "vgaHWSetMmioFuncs", + "vgaHWSetStdFuncs", + "vgaHWUnlock", NULL }; -#ifdef XFree86LOADER - -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", + NULL +}; + +static const char *fbSymbols[] = { "fbScreenInit", "fbPictureInit", NULL }; -#endif - static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *int10Symbols[] = { - "xf86InitInt10", "xf86FreeInt10", + "xf86InitInt10", NULL }; @@ -210,14 +210,10 @@ static const char *shadowSymbols[] = { NULL }; -#define ALPuseI2C 0 - static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", -#if ALPuseI2C "xf86DoEDID_DDC2", -#endif + "xf86SetDDCproperties", NULL }; @@ -262,7 +258,7 @@ alpSetup(pointer module, pointer opts, int *errmaj, int *errmin) if (!setupDone) { setupDone = TRUE; LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, - ramdacSymbols,int10Symbols, + miscfbSymbols, ramdacSymbols,int10Symbols, ddcSymbols, i2cSymbols, shadowSymbols, NULL); } return (pointer)1; @@ -1090,7 +1086,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags) AlpFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); break; } @@ -1464,6 +1460,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) CirPtr pCir; AlpPtr pAlp; int i, ret; + int init_picture = 0; VisualPtr visual; int displayWidth,width,height; unsigned char * FbBase = NULL; @@ -1582,6 +1579,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) width,height, pScrn->xDpi, pScrn->yDpi, displayWidth,pScrn->bitsPerPixel); + init_picture = 1; break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1592,7 +1590,6 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } if (!ret) return FALSE; - fbPictureInit (pScreen, 0, 0); #ifdef ALP_DEBUG ErrorF("AlpScreenInit after depth dependent init\n"); @@ -1613,6 +1610,10 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit (pScreen, 0, 0); + miInitializeBackingStore(pScreen); /* @@ -1807,9 +1808,10 @@ AlpEnterVT(int scrnIndex, int flags) /* Should we re-save the text mode on each VT enter? */ if (!(ret = AlpModeInit(pScrn, pScrn->currentMode))) - return FALSE; + return FALSE; - pCir->InitAccel(pScrn); + if (!pCir->NoAccel) + pCir->InitAccel(pScrn); return ret; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile index a23fb7820..487789761 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.34.2.1 2001/05/25 11:19:31 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.35 2001/05/25 11:19:58 alanh Exp $ XCOMM XCOMM This is an Imakefile for the GLINT driver. XCOMM diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 index c4db56f6b..fbbd34628 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.11 2001/05/08 19:31:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.12 2001/08/18 11:37:30 alanh Exp $ */ STATUS as of Tue, 8 May 2001 19:01:39 +0200 @@ -23,22 +23,24 @@ Working : - Bitmap Writes using direct FIFO writes with or without FIFO Disconnect. - 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. * Xv : Hardware video scaler : - Needs checking on a big endian machine. - - Needs acceleration to work. - - Clipping supported trough the alpha channel in depth 15 and 24 - and with an overlay key color in depth 8 and 16. + - Needs acceleration to work - there is a hardware bug in YV12 mode. - Support both dual head and single head, trough gamma or permedia3. + - NOTE: depth 15 and 16 currently broken as I can't figure out the + colorKey equation. From the docs it needs to be padded to 8bits per RGB, + but that doesn't seem to work either. FIXME. - Attributes are : - FILTER : None, Partial (X only) or Full filtering. - - MIRROR : X and/or Y Axis mirroring. - - ALPHA : + - COLORKEY : Speaks for itself + - DOUBLE_BUFFER : Speaks for itself + - AUTOPAINT_COLORKEY : Speaks for itself + - MIRROR : X and/or Y Axis mirroring. (NOT DONE) + - ALPHA : (NOT DONE) - 0 -> FB Only - 1 -> 25% Video, 75% FB - 2 -> 75% Video, 25% FB - 3 -> Video Only - - [TODO] VIDEOKEY : Overlay Key Color for clipping in depth 8 and 16. * DRI : Work is underway. Not Working : @@ -51,14 +53,6 @@ Not Working : - Render extension initialization. - CPUToScreenTexture. - CPUToScreenAlphaTexture. - * [NEED FIX] Xv has still some minor problems : - - depth 8 does not work, but then it may be the app i am using. - - when using 2D accels there is some unstability in the video display. I - guess this is because there is then not enough bandwith to do the - copying of the data in time. After a time of the above, the images - becomes black. It will come back once stopvideo is called. - [FIX] i will disable VideoOverlay each 25 frames, this causes a flicker, - but at least it will bing the image back. * [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 @@ -66,24 +60,12 @@ Not Working : Known problems : - * Console gets broken when using dual headed mode. The culprit seems to be - the vga graphics index & port (GraphicsIndexReg : 0x63ce, GraphicsPort : - 0x3cf). I had to use IO acces for both these two, because if not, console - fonts would get trashed even in mono headed mode. - [FIX] Well, if you really need the console and are running linux, just use - 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. - [FIX2] try : consolechars -d, it should reload the console fonts. * [FIXED] 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. - * [FIXED] When moving a window around a lot quickly, the video outputs dies. - Well, this is partly fixed, but still appears under very heavy load. - => [NOTE] If this two still happens, try disabling the Hardware cursor, with + => [NOTE] If this still happens, try disabling the Hardware cursor, with the "SWCursor" option to your device XF86Config section. - * Sometimes there are blue transparent garbage in the form of small - horizontal bands, few pixels high, and more pixels width, maybe 64pixels ? - This may be a hardware bug. + => [NOTE2] Or, try starting the Xserver with the -nosilk option. Sven Luther <luther@dpt-info.u-strasbg.fr> +Alan Hourihane <alanh@fairlite.demon.co.uk> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h index 3db30c12d..3a1a883da 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.48.2.1 2001/05/24 20:12:47 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.51 2001/08/19 02:47:50 tsi Exp $ */ /* * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * @@ -35,6 +35,7 @@ #include "xf86cmap.h" #include "xf86i2c.h" #include "xf86DDC.h" +#include "xf86xv.h" #ifdef XF86DRI #include "xf86drm.h" #include "sarea.h" @@ -162,6 +163,11 @@ typedef struct { CARD32 PM3_AreaStippleMode; CARD32 PM3_VideoControl; int InFifoSpace; +#ifdef XvExtension + void (*VideoTimerCallback)(ScrnInfoPtr, Time); + XF86VideoAdaptorPtr adaptor; + int videoKey; +#endif #ifdef XF86DRI Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; @@ -189,6 +195,8 @@ typedef struct { ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_PERMEDIA2V) #define PCI_VENDOR_3DLABS_CHIP_PERMEDIA3 \ ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_PERMEDIA3) +#define PCI_VENDOR_3DLABS_CHIP_PERMEDIA4 \ + ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_PERMEDIA4) #define PCI_VENDOR_3DLABS_CHIP_300SX \ ((PCI_VENDOR_3DLABS << 16) | PCI_CHIP_300SX) #define PCI_VENDOR_3DLABS_CHIP_500TX \ @@ -237,6 +245,7 @@ void Permedia3InitializeEngine(ScrnInfoPtr pScrn); void Permedia3EnableOffscreen(ScreenPtr pScreen); void Permedia3Sync(ScrnInfoPtr pScrn); void DualPermedia3Sync(ScrnInfoPtr pScrn); +void Permedia3InitVideo(ScreenPtr pScreen); void TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void TXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); 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 76f0b0620..df222f6ef 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.125.2.4 2001/05/29 11:32:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.135 2001/08/18 11:37:30 alanh Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -45,6 +45,7 @@ #include "xf86RAC.h" #include "xf86Resources.h" #include "xf86int10.h" +#include "dixstruct.h" #include "vbe.h" #include "compiler.h" @@ -66,7 +67,6 @@ #include "extensions/dpms.h" #define DEBUG 0 -#define PM3Video 1 #if DEBUG # define TRACE_ENTER(str) ErrorF("glint: " str " %d\n",pScrn->scrnIndex) @@ -130,15 +130,18 @@ DriverRec GLINT = { static SymTabRec GLINTVGAChipsets[] = { { PCI_VENDOR_TI_CHIP_PERMEDIA2, "ti_pm2" }, { PCI_VENDOR_TI_CHIP_PERMEDIA, "ti_pm" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, "pm4" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, "pm3" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, "pm2v" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, "pm2" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA, "pm" }, + {-1, NULL } }; static PciChipsets GLINTVGAPciChipsets[] = { { PCI_VENDOR_TI_CHIP_PERMEDIA2, PCI_VENDOR_TI_CHIP_PERMEDIA2, RES_SHARED_VGA }, { PCI_VENDOR_TI_CHIP_PERMEDIA, PCI_VENDOR_TI_CHIP_PERMEDIA, NULL }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, RES_SHARED_VGA }, @@ -150,6 +153,7 @@ static SymTabRec GLINTChipsets[] = { { PCI_VENDOR_3DLABS_CHIP_GAMMA, "gamma" }, { PCI_VENDOR_TI_CHIP_PERMEDIA2, "ti_pm2" }, { PCI_VENDOR_TI_CHIP_PERMEDIA, "ti_pm" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, "pm4" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, "pm3" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, "pm2v" }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, "pm2" }, @@ -165,6 +169,7 @@ static PciChipsets GLINTPciChipsets[] = { { PCI_VENDOR_3DLABS_CHIP_GAMMA, PCI_VENDOR_3DLABS_CHIP_GAMMA, NULL }, { PCI_VENDOR_TI_CHIP_PERMEDIA2, PCI_VENDOR_TI_CHIP_PERMEDIA2, RES_SHARED_VGA }, { PCI_VENDOR_TI_CHIP_PERMEDIA, PCI_VENDOR_TI_CHIP_PERMEDIA, NULL }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, PCI_VENDOR_3DLABS_CHIP_PERMEDIA4, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, RES_SHARED_VGA }, { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, RES_SHARED_VGA }, @@ -185,7 +190,8 @@ typedef enum { OPTION_OVERLAY, OPTION_SHADOW_FB, OPTION_FBDEV, - OPTION_FLATPANEL + OPTION_FLATPANEL, + OPTION_VIDEO_KEY } GLINTOpts; static const OptionInfoRec GLINTOptions[] = { @@ -198,6 +204,7 @@ static const OptionInfoRec GLINTOptions[] = { { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FLATPANEL, "UseFlatPanel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -215,42 +222,40 @@ static RamDacSupportedInfoRec TIRamdacs[] = { }; static const char *xf8_32bppSymbols[] = { + "cfb8_32ScreenInit", "xf86Overlay8Plus32Init", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAFillSolidRects", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", "XAAPolyLines", "XAAPolySegment", - "XAAFillSolidRects", + "XAAScreenIndex", NULL }; static const char *fbSymbols[] = { - "cfb8_32ScreenInit", + "fbBres", "fbPictureInit", "fbScreenInit", - "fbBres", NULL }; static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86SetDDCproperties", NULL }; static const char *i2cSymbols[] = { "xf86CreateI2CBusRec", "xf86DestroyI2CBusRec", + "xf86DestroyI2CDevRec", "xf86I2CBusInit", "xf86I2CDevInit", "xf86I2CProbeAddress", @@ -271,12 +276,30 @@ static const char *vbeSymbols[] = { NULL }; +static const char *ramdacSymbols[] = { + "IBMramdac526CalculateMNPCForClock", + "IBMramdac640CalculateMNPCForClock", + "IBMramdacProbe", + "RamDacCreateInfoRec", + "RamDacDestroyInfoRec", + "RamDacFreeRec", + "RamDacGetHWIndex", + "RamDacHandleColormaps", + "RamDacInit", + "TIramdacCalculateMNPForClock", + "TIramdacLoadPalette", + "TIramdacProbe", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + "xf86InitCursor", + NULL +}; + + static const char *fbdevHWSymbols[] = { - "fbdevHWInit", "fbdevHWFreeRec", + "fbdevHWInit", "fbdevHWProbe", - "fbdevHWFreeRec", - "fbdevHWGetName", "fbdevHWUseBuildinMode", "fbdevHWGetDepth", @@ -286,18 +309,18 @@ static const char *fbdevHWSymbols[] = { "fbdevHWLoadPalette", /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", + "fbdevHWMapMMIO", + "fbdevHWMapVidmem", "fbdevHWModeInit", + "fbdevHWRestore", "fbdevHWSave", + "fbdevHWSwitchMode", "fbdevHWUnmapMMIO", "fbdevHWUnmapVidmem", - "fbdevHWMapMMIO", - "fbdevHWMapVidmem", + "fbdevHWValidMode", NULL }; @@ -312,27 +335,22 @@ static const char *int10Symbols[] = { static const char *drmSymbols[] = { "drmAddBufs", "drmAddMap", - "drmCtlAddCommand", "drmCtlInstHandler", - "drmGetInterruptFromBusID", - "drmMapBufs", - "drmMarkBufs", - "drmUnmapBufs", "drmFreeVersion", "drmGetVersion", + "drmMapBufs", + "drmUnmapBufs", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", + "DRIGetDrawableIndex", "DRIQueryVersion", + "DRIScreenInit", "GlxSetVisualConfigs", NULL }; @@ -369,7 +387,7 @@ glintSetup(pointer module, pointer opts, int *errmaj, int *errmin) LoaderRefSymLists(fbSymbols, ddcSymbols, i2cSymbols, xaaSymbols, xf8_32bppSymbols, shadowSymbols, fbdevHWSymbols, int10Symbols, - vbeSymbols, + vbeSymbols, ramdacSymbols, #ifdef XF86DRI drmSymbols, driSymbols, #endif @@ -575,9 +593,7 @@ static void GLINTProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; -#ifdef XFree86LOADER if (xf86LoadSubModule(pScrn, "vbe")) -#endif { pVbe = VBEInit(NULL,index); vbeDoEDID(pVbe, NULL); @@ -856,6 +872,7 @@ GetAccelPitchValues(ScrnInfoPtr pScrn) linep = &partprod500TX[0]; break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: linep = &partprodPermedia[0]; break; } @@ -946,6 +963,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) ClockRangePtr clockRanges; char *mod = NULL; const char *s; + const char **syms = NULL; TRACE_ENTER("GLINTPreInit"); @@ -1002,6 +1020,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pPci = xf86GetPciInfoForEntity(pEnt->index); if ( (pPci->chipType == PCI_CHIP_MX) || (pPci->chipType == PCI_CHIP_PERMEDIA) || + (pPci->chipType == PCI_CHIP_TI_PERMEDIA) || (pPci->chipType == PCI_CHIP_500TX) || (pPci->chipType == PCI_CHIP_300SX) || (pPci->chipType == PCI_CHIP_PERMEDIA3) ) { @@ -1175,6 +1194,16 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\" - acceleration disabled\n"); } + if(xf86GetOptValInteger(pGlint->Options, OPTION_VIDEO_KEY, + &(pGlint->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", + pGlint->videoKey); + } else { + /* Needs 8bit values for all modes */ + pGlint->videoKey = (1 << 16) | + (1 << 8) | + ((pScrn->mask.blue - 1) << 0); + } /* Check whether to use the FBDev stuff and fill in the rest of pScrn */ if (xf86ReturnOptValBool(pGlint->Options, OPTION_FBDEV, FALSE)) { @@ -1412,7 +1441,8 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) int temp, base3copro, offset; if( (basedelta & 0x20000) ^ (basecopro & 0x20000) ) { - if (pGlint->MultiChip == PCI_CHIP_PERMEDIA) { + if ((pGlint->MultiChip == PCI_CHIP_PERMEDIA) || + (pGlint->MultiChip == PCI_CHIP_TI_PERMEDIA)) { offset = 0x20; /* base4 */ } else { offset = 0x1c; /* base3 */ @@ -1490,6 +1520,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pScrn->videoRam = (((GLINT_READ_REG(PMMemConfig) >> 29) & 0x03) + 1) * 2048; break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); break; @@ -1497,6 +1528,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) case PCI_VENDOR_3DLABS_CHIP_GAMMA: switch (pGlint->MultiChip) { case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Attached Rasterizer is GLINT Permedia\n"); pScrn->videoRam = (((GLINT_READ_REG(PMMemConfig)>>29) & @@ -1590,6 +1622,8 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); + /* Let's check what type of DAC we have and reject if necessary */ switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: @@ -1627,6 +1661,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: pGlint->FIFOSize = 120; maxheight = 4096; @@ -1694,6 +1729,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pGlint->FIFOSize = 15; switch (pGlint->MultiChip) { case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: maxheight = 1024; maxwidth = 1536; GLINTProbeIBMramdac(pScrn); @@ -1889,7 +1925,8 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) if ( (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && - (pGlint->MultiChip == PCI_CHIP_PERMEDIA)) ) { + ((pGlint->MultiChip == PCI_CHIP_PERMEDIA) || + (pGlint->MultiChip == PCI_CHIP_TI_PERMEDIA))) ) { switch (pScrn->bitsPerPixel) { case 8: pGlint->MaxClock = 200000; @@ -1924,6 +1961,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) } } if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) pGlint->MaxClock = 300000; @@ -1953,6 +1991,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) /* Select valid modes from those available */ if ((pGlint->NoAccel) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { /* @@ -2103,6 +2142,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) pGlint->bppalign = 0; break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: pGlint->pprod = partprodPermedia[pScrn->displayWidth >> 5]; pGlint->bppalign = bppand[(pScrn->bitsPerPixel>>3)-1]; break; @@ -2212,22 +2252,25 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) case 16: case 24: mod = "fb"; + syms = fbSymbols; break; case 32: if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { - if (xf86LoadSubModule(pScrn, "xf8_32bpp") == NULL) { - GLINTFreeRec(pScrn); - return FALSE; - } else - xf86LoaderReqSymLists(xf8_32bppSymbols,NULL); - } else + mod = "xf8_32bpp"; + syms = xf8_32bppSymbols; + } else { mod = "fb"; + syms = fbSymbols; + } break; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { GLINTFreeRec(pScrn); return FALSE; } + if (mod && syms) { + xf86LoaderReqSymLists(syms, NULL); + } /* Load XAA if needed */ if (!pGlint->NoAccel) { @@ -2252,14 +2295,17 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) GLINTFreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(ddcSymbols, NULL); /* Load I2C if needed */ if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2)) { if (xf86LoadSubModule(pScrn, "i2c")) { I2CBusPtr pBus; + xf86LoaderReqSymLists(i2cSymbols, NULL); if ((pBus = xf86CreateI2CBusRec())) { pBus->BusName = "DDC"; pBus->scrnIndex = pScrn->scrnIndex; @@ -2407,6 +2453,7 @@ GLINTSave(ScrnInfoPtr pScrn) Permedia2VSave(pScrn, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: Permedia3Save(pScrn, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2438,6 +2485,7 @@ GLINTSave(ScrnInfoPtr pScrn) (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaSave(pScrn, glintReg); (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); break; @@ -2483,6 +2531,7 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) ret = Permedia2VInit(pScrn, mode); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: ret = Permedia3Init(pScrn, mode, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2508,6 +2557,7 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) ret = TXInit(pScrn, mode, glintReg); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: ret = PermediaInit(pScrn, mode); break; case PCI_CHIP_PERMEDIA3: @@ -2540,6 +2590,7 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) Permedia2VRestore(pScrn, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: Permedia3Restore(pScrn, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2571,6 +2622,7 @@ GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaRestore(pScrn, glintReg); (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; @@ -2623,10 +2675,7 @@ GLINTRestore(ScrnInfoPtr pScrn) Permedia2VRestore(pScrn, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: -#ifdef PM3Video - TRACE("PM3Video : VideoLeaveVT"); - Permedia3VideoLeaveVT(pScrn); -#endif + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: Permedia3Restore(pScrn, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2658,14 +2707,11 @@ GLINTRestore(ScrnInfoPtr pScrn) (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaRestore(pScrn, glintReg); (*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); @@ -2691,6 +2737,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); int ret, displayWidth; + int init_picture = 0; unsigned char *FBStart; VisualPtr visual; @@ -2812,8 +2859,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit(pScreen, 0, 0); + init_picture = 1; break; case 32: if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR) @@ -2826,8 +2872,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit(pScreen, 0, 0); + init_picture = 1; } break; default: @@ -2865,6 +2910,9 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit(pScreen, 0, 0); if (!pGlint->NoAccel) { switch (pGlint->Chipset) { @@ -2874,6 +2922,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) Permedia2AccelInit(pScreen); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: Permedia3AccelInit(pScreen); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2895,6 +2944,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) SXAccelInit(pScreen); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaAccelInit(pScreen); break; case PCI_CHIP_PERMEDIA3: @@ -2923,6 +2973,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) Permedia2vHWCursorInit(pScreen); @@ -2943,6 +2994,7 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA4) || ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, @@ -3006,6 +3058,8 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } #endif + pScrn->fbOffset = 0; + pGlint->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = GLINTCloseScreen; pScreen->SaveScreen = GLINTSaveScreen; @@ -3021,18 +3075,15 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoInit(pScreen); break; -#ifdef PM3Video case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: - TRACE("PM3Video : VideoInit"); - Permedia3VideoInit(pScreen); + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + Permedia3InitVideo(pScreen); break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: switch (pGlint->MultiChip) { case PCI_CHIP_PERMEDIA3: - TRACE("PM3Video : VideoInit"); - Permedia3VideoInit(pScreen); + Permedia3InitVideo(pScreen); } -#endif } #if 0 @@ -3067,6 +3118,7 @@ GLINTSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) Permedia2InitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: Permedia3InitializeEngine(pScrn); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -3091,6 +3143,7 @@ GLINTSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) SXInitializeEngine(pScrn); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaInitializeEngine(pScrn); break; case PCI_CHIP_PERMEDIA3: @@ -3145,6 +3198,7 @@ GLINTAdjustFrame(int scrnIndex, int x, int y, int flags) GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: base = (y * pScrn->displayWidth + x) >> pGlint->BppShift; GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; @@ -3156,6 +3210,7 @@ GLINTAdjustFrame(int scrnIndex, int x, int y, int flags) GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; } @@ -3194,18 +3249,6 @@ GLINTEnterVT(int scrnIndex, int flags) 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) { @@ -3216,6 +3259,7 @@ GLINTEnterVT(int scrnIndex, int flags) Permedia2InitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: Permedia3InitializeEngine(pScrn); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -3240,6 +3284,7 @@ GLINTEnterVT(int scrnIndex, int flags) SXInitializeEngine(pScrn); break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: PermediaInitializeEngine(pScrn); break; case PCI_CHIP_PERMEDIA3: @@ -3305,17 +3350,6 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen) 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) { @@ -3389,6 +3423,7 @@ GLINTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) * side appears if not aligned properly */ switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: @@ -3448,6 +3483,7 @@ GLINTSaveScreen(ScreenPtr pScreen, int mode) switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_TI_CHIP_PERMEDIA: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: @@ -3466,6 +3502,7 @@ GLINTSaveScreen(ScreenPtr pScreen, int mode) switch (pGlint->MultiChip) { case PCI_CHIP_PERMEDIA3: case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: temp = GLINT_READ_REG(PMVideoControl); if (unblank) temp |= 1; else temp &= 0xFFFFFFFE; @@ -3500,6 +3537,11 @@ GLINTBlockHandler ( pScreen->BlockHandler = pGlint->BlockHandler; (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); pScreen->BlockHandler = GLINTBlockHandler; + + if(pGlint->VideoTimerCallback) { + UpdateCurrentTime(); + (*pGlint->VideoTimerCallback)(pScrn, currentTime.milliseconds); + } } #ifdef DEBUG @@ -3651,6 +3693,7 @@ Shiftbpp(ScrnInfoPtr pScrn, int value) logbytesperaccess = 2; break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: logbytesperaccess = 4; break; case PCI_VENDOR_3DLABS_CHIP_300SX: @@ -3675,6 +3718,7 @@ Shiftbpp(ScrnInfoPtr pScrn, int value) logbytesperaccess = 3; break; case PCI_CHIP_PERMEDIA: + case PCI_CHIP_TI_PERMEDIA: logbytesperaccess = 2; break; case PCI_CHIP_PERMEDIA3: diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h index 4690035ea..6b5ac64b2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.26.2.1 2001/05/24 20:12:47 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.28 2001/08/18 11:37:31 alanh Exp $ */ /* * glint register file @@ -29,6 +29,7 @@ #define PCI_CHIP_3DLABS_GAMMA 0x08 #define PCI_CHIP_3DLABS_PERMEDIA2V 0x09 #define PCI_CHIP_3DLABS_PERMEDIA3 0x0A +#define PCI_CHIP_3DLABS_PERMEDIA4 0x0C #define PCI_CHIP_TI_PERMEDIA 0x3d04 /* The boards we know */ 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 67c7c2b18..cf98fc79b 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.29.2.1 2001/05/30 11:42:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.30 2001/05/30 11:41:53 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" 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 2a8b55891..05bcaa36c 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.25 2001/04/18 09:24:47 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.28 2001/08/18 11:41:45 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -129,6 +129,13 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn) GLINT_SLOW_WRITE_REG(3, BroadcastMask); } + /* Disable LocalBuffer. Fixes stripes problems when + * doing screen-to-screen copies */ + GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LBDestReadMode); + GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LBDestReadEnables); + GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LBSourceReadMode); + GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LBWriteMode); + /* Host out PreInit */ /* Set filter mode to enable sync tag & data output */ GLINT_SLOW_WRITE_REG(0x400, FilterMode); 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 9e330e190..933d1c241 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.24 2001/05/16 07:56:07 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.25 2001/08/18 11:37:31 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -159,6 +159,121 @@ PM3DAC_CalculateClock return(actualclock); } +static unsigned long +PM4DAC_CalculateClock +( + unsigned long req_clock, /* In kHz units */ + unsigned long ref_clock, /* In kHz units */ + unsigned char *param_m, /* ClkPreScale */ + unsigned char *param_n, /* ClkFeedBackScale */ + unsigned char *param_p /* ClkPostScale */ + ) +{ +#define INITIALFREQERR 10000 + + long fMinVCO = 200000; /* min fVCO is 200MHz (in 10000Hz units) */ + long fMaxVCO = 400000; /* max fVCO is 400MHz (in 10000Hz units) */ + unsigned long int M, N, P; + unsigned long int fVCO; + unsigned long int ActualClock; + int Error; + int LowestError = INITIALFREQERR; + short bFoundFreq = FALSE; + int cInnerLoopIterations = 0; + int LoopCount; + + /* + * Actual Equations: + * fVCO = (ref_clock * M)/(N+1) + * PIXELCLOCK = fVCO/(1<<p) + * 200 <= fVCO <= 400 + * 24 <= N <= 80 + * 1 <= M <= 15 + * 0 <= P <= 3 + * 1Mhz < ref_clock/(N+1) <= 2Mhz - not used + * For refclk == 14.318 we have the tighter equations: + * 32 <= N <= 80 + * 3 <= M <= 12 + * Notes: + * The spec says that the PLLs will only do 260Mhz, but I have assumed 300Mhz 'cos + * 260Mhz is a crap limit. + */ + +#define P4RD_PLL_MIN_P 0 +#define P4RD_PLL_MAX_P 3 +#define P4RD_PLL_MIN_M 1 +#define P4RD_PLL_MAX_M 12 +#define P4RD_PLL_MIN_N 24 +#define P4RD_PLL_MAX_N 80 + + for(P = P4RD_PLL_MIN_P; P <= P4RD_PLL_MAX_P; ++P) { + unsigned long int fVCOLowest, fVCOHighest; + + /* it's pointless going through the main loop if all values of + * N produce an fVCO outside the acceptable range */ + + M = P4RD_PLL_MIN_M; + N = ((M + 1) * (1 << P) * req_clock) / ref_clock; + + fVCOLowest = (ref_clock * N) / (M + 1); + + M = P4RD_PLL_MAX_M; + N = ((M + 1) * (1 << P) * req_clock) / ref_clock; + + fVCOHighest = (ref_clock * N) / (M + 1); + + if(fVCOHighest < fMinVCO || fVCOLowest > fMaxVCO) + continue; + + for(M = P4RD_PLL_MIN_M; M <= P4RD_PLL_MAX_M; ++M, ++cInnerLoopIterations) + { + N = ((M + 1) * (1 << P) * req_clock) / ref_clock; + + if(N > P4RD_PLL_MAX_N || N < P4RD_PLL_MIN_N) + continue; + + /* we can expect rounding errors in calculating M, which will always be rounded down. */ + /* So we'll checkout our calculated value of M along with (M+1) */ + + for(LoopCount = (N == P4RD_PLL_MAX_N) ? 1 : 2; --LoopCount >= 0; ++N) + { + fVCO = (ref_clock * N) / (M + 1); + + if( (fVCO >= fMinVCO) && (fVCO <= fMaxVCO) ) + { + ActualClock = (fVCO / (1 << P)); + + Error = ActualClock - req_clock; + + if(Error < 0) + Error = -Error; + + /* It is desirable that we use the lowest value of M if the*/ + /* frequencies are the same.*/ + if(Error < LowestError || (Error == LowestError && M < *param_m)) + { + bFoundFreq = TRUE; + LowestError = Error; + *param_m = M; + *param_n = N; + *param_p = P; + if(Error == 0) + goto Done; + } + } + } + } + } + +Done: + if(bFoundFreq) + ActualClock = (ref_clock * (*param_n)) / (((*param_m) + 1) * (1 << (*param_p))); + else + ActualClock = 0; + + return(ActualClock); +} + void Permedia3PreInit(ScrnInfoPtr pScrn) { @@ -296,8 +411,15 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) unsigned long clockused; /* Let's program the dot clock */ - clockused = PM3DAC_CalculateClock(mode->Clock, - pGlint->RefClock, &m,&n,&p); + switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA4: + clockused = PM4DAC_CalculateClock(mode->Clock * 1, /* HACK */ + pGlint->RefClock, &m,&n,&p); + break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + clockused = PM3DAC_CalculateClock(mode->Clock, + pGlint->RefClock, &m,&n,&p); + } STOREDAC(PM3RD_DClk0PreScale, m); STOREDAC(PM3RD_DClk0FeedbackScale, n); STOREDAC(PM3RD_DClk0PostScale, p); @@ -342,7 +464,7 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) case 24: temp3 |= PM3RD_MiscControl_DIRECTCOLOR_ENABLE; STOREDAC(PM2VDACRDPixelSize, 0x04); - STOREDAC(PM2VDACRDColorFormat, 0x60); + STOREDAC(PM2VDACRDColorFormat, 0x20); break; case 32: temp3 |= PM3RD_MiscControl_DIRECTCOLOR_ENABLE; @@ -509,9 +631,7 @@ void Permedia3LoadPalette( LOCO *colors, VisualPtr pVisual ){ -#if 0 /* NOT YET */ GLINTPtr pGlint = GLINTPTR(pScrn); -#endif int i, index, shift = 0, j, repeat = 1; if (pScrn->depth == 15) { @@ -527,14 +647,11 @@ void Permedia3LoadPalette( Permedia2WriteData(pScrn, colors[index].green); Permedia2WriteData(pScrn, colors[index].blue); } - /* for video i/o */ -#if 0 /* NOT YET */ GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | ((colors[index].green & 0xFF) << 8) | ((colors[index].blue & 0xFF) << 16), PM3LUTData); -#endif } } @@ -546,9 +663,7 @@ void Permedia3LoadPalette16( LOCO *colors, VisualPtr pVisual ){ -#if 0 /* NOT YET */ GLINTPtr pGlint = GLINTPTR(pScrn); -#endif int i, index, j; for(i = 0; i < numColors; i++) { @@ -559,13 +674,11 @@ void Permedia3LoadPalette16( Permedia2WriteData(pScrn, colors[index].green); Permedia2WriteData(pScrn, colors[index >> 1].blue); } -#if 0 /* NOT YET */ GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | ((colors[index].green & 0xFF) << 8) | ((colors[index].blue & 0xFF) << 16), PM3LUTData); -#endif if(index <= 31) { for (j = 0; j < 4; j++) { 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 d707bee94..7754e1bdc 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.7 2001/05/08 19:31:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.8 2001/08/18 11:37:31 alanh Exp $ */ /* * glint register file @@ -915,6 +915,8 @@ #define PM3TextureIndexMode1 0xb340 #define PM3TextureIndexMode1And 0xb3d0 #define PM3TextureIndexMode1Or 0xb3d8 +#define PM3TextureLODBiasS 0x8450 +#define PM3TextureLODBiasT 0x8458 /* ... */ #define PM3TextureMapSize 0xb428 #define PM3TextureMapWidth0 0x8580 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c index 589eb8d5c..26f31b5c2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c @@ -1,185 +1,149 @@ /* - * Permedia 3 Xv Driver + * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales. * - * Copyright (C) 2001 Sven Luther <luther@dpt-info.u-strasbg.fr> + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. * - * 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: + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. * - * 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> + * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Sven Luther <luther@dpt-info.u-strasbg.fr> */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.6 2001/05/08 19:31:22 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.7 2001/08/18 11:37:31 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" +#include "xf86Resources.h" #include "xf86_ansic.h" -#include "xf86Pci.h" +#include "compiler.h" #include "xf86PciInfo.h" -#include "xf86Xinput.h" +#include "xf86Pci.h" #include "xf86fbman.h" -#include "xf86xv.h" -#include "Xv.h" #include "regionstr.h" -#include "xaa.h" -#include "xaalocal.h" +#include "glint.h" #include "glint_regs.h" #include "pm3_regs.h" -#include "glint.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" -#define DEBUG(x) -#define USE_HARDWARE_COPY 1 -#define SUPPORT_CLIPPING 1 -#define BLACKNESS_WORKAROUND 1 +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 -#ifndef XvExtension +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 -void Permedia3VideoInit(ScreenPtr pScreen) {} -void Permedia3VideoUninit(ScrnInfoPtr pScrn) {} -void Permedia3VideoEnterVT(ScrnInfoPtr pScrn) {} -void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) {} +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) +#ifndef XvExtension +void Permedia3InitVideo(ScreenPtr pScreen) {} +void Permedia3ResetVideo(ScrnInfoPtr pScrn) {} #else -#undef MIN -#undef ABS -#undef CLAMP -#undef ENTRIES +static XF86VideoAdaptorPtr Permedia3SetupImageVideo(ScreenPtr); +static void Permedia3InitOffscreenImages(ScreenPtr); +static void Permedia3StopVideo(ScrnInfoPtr, pointer, Bool); +static int Permedia3SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int Permedia3GetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void Permedia3QueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, unsigned int *, pointer); +static int Permedia3PutImage( ScrnInfoPtr, + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static int Permedia3QueryImageAttributes(ScrnInfoPtr, + int, unsigned short *, unsigned short *, int *, int *); +static void Permedia3VideoTimerCallback(ScrnInfoPtr pScrn, Time time); -#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])) - -enum { - OVERLAY_DATA_NONE, - OVERLAY_DATA_COLORKEY, - OVERLAY_DATA_ALPHAKEY, - OVERLAY_DATA_ALPHABLEND -} ; - -#define MAX_BUFFERS 3 - -typedef struct _PortPrivRec { - struct _AdaptorPrivRec * pAdaptor; - - /* Sync function */ - void (*Sync) (ScrnInfoPtr pScrn); - - /* Attributes */ - INT32 ColorKey; - INT32 OverlayAlpha; - INT32 OverlayMode; - INT32 Attribute[3]; - - /* Clipping */ - RegionRec clip; - -#if 0 /* Adding this cause the server to crash if we minimize the video */ - /* Frame counter */ - char Frames; -#endif - - /* Ramdac save values, ... */ - INT32 ramdac_x, ramdac_w; - INT32 ramdac_y, ramdac_h; - Bool ramdac_on; - - /* Buffers */ - int Id, Format; - int FB_Shift, Video_Shift; - short display, copy; - FBAreaPtr Buffer[MAX_BUFFERS]; - CARD32 BufferBase[MAX_BUFFERS]; - - /* Buffer and Drawable size and position */ - INT32 vx, vy, vw, vh; /* 12.10 fp */ - int dx, dy, dw, dh; +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) - /* Timer stuff */ - OsTimerPtr Timer; - Bool TimerInUse; - int Delay, Instant, StopDelay; +static Atom xvColorKey, xvDoubleBuffer, xvAutopaintColorKey, xvFilter; -} PortPrivRec, *PortPrivPtr; +void Permedia3InitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + GLINTPtr pGlint = GLINTPTR(pScrn); + int num_adaptors; + + /* Because of bugs in the PM3 when uploading images via the + * bypass to the framebuffer, we always have to use the accelerator. + */ + if (pGlint->NoAccel) + return; -typedef struct _AdaptorPrivRec { - struct _AdaptorPrivRec * Next; - ScrnInfoPtr pScrn; - PortPrivPtr pPort; -} AdaptorPrivRec, *AdaptorPrivPtr; + newAdaptor = Permedia3SetupImageVideo(pScreen); + Permedia3InitOffscreenImages(pScreen); -static AdaptorPrivPtr AdaptorPrivList = NULL; + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); -/* - * Proprietary Attributes - */ - -#define XV_FILTER "XV_FILTER" -/* We support 3 sorts of filters : - * 0 : None. - * 1 : Partial (only in the X directrion). - * 2 : Full (incompatible with X mirroring). - */ + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } -#define XV_MIRROR "XV_MIRROR" -/* We also support mirroring of the image : - * bit 0 : if set, will mirror in the X direction - * (incompatible with full filtering). - * bit 1 : if set, will mirror in the Y direction. - */ + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); -#define XV_ALPHA "XV_ALPHA" -/* We support the following alpha blend factors : - * 0 -> 0% Video, 100% Framebuffer - * 1 -> 25% Video, 75% Framebuffer - * 2 -> 75% Video, 25% Framebuffer - * 3 -> 100% Video, 0% Framebuffer - */ + if(newAdaptors) + xfree(newAdaptors); +} -static XF86AttributeRec -ScalerAttributes[] = +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = { - { XvSettable | XvGettable, 0, 2, XV_FILTER }, - { XvSettable | XvGettable, 0, 3, XV_MIRROR }, - { XvSettable | XvGettable, 0, 3, XV_ALPHA }, + { + 0, + "XV_IMAGE", + 2047, 2047, + {1, 1} + } }; -#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) - -static Atom xvFilter, xvMirror, xvAlpha; - +#define NUM_FORMATS 4 -/* Scaler */ - -static XF86VideoEncodingRec -ScalerEncodings[] = +static XF86VideoFormatRec Formats[NUM_FORMATS] = { - { 0, "XV_IMAGE", 2047, 2047, { 1, 1 }}, + {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }; -static XF86VideoFormatRec -ScalerVideoFormats[] = +#define NUM_ATTRIBUTES 4 + +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { - { 8, TrueColor }, /* Dithered */ - { 15, TrueColor }, - { 16, TrueColor }, - { 24, TrueColor }, + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}, + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"}, + {XvSettable | XvGettable, 0, 2, "XV_FILTER"}, }; /* @@ -191,8 +155,9 @@ ScalerVideoFormats[] = #define NoOrder LSBFirst -static XF86ImageRec -ScalerImages[] = +#define NUM_IMAGES 15 + +static XF86ImageRec Images[NUM_IMAGES] = { /* Planar YVU 4:2:0 (emulated) */ { LE4CC('Y','V','1','2'), XvYUV, NoOrder, GUID4CC('Y','V','1','2'), @@ -269,135 +234,277 @@ ScalerImages[] = 8, XvPacked, 1, 8, 0xC0, 0x38, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGR", XvTopToBottom }, }; -/* - * Buffer management - */ -static void -RemoveBufferCallback(FBAreaPtr Buffer) -{ - PortPrivPtr pPPriv = (PortPrivPtr) Buffer->devPrivate.ptr; - int i = -1; +#define MAX_BUFFERS 2 + +typedef struct { + FBAreaPtr area[MAX_BUFFERS]; + RegionRec clip; + CARD32 colorKey; + CARD32 videoStatus; + Time offTime; + Time freeTime; + int Video_Shift; + int Format; + Bool ramdacOn; + Bool doubleBuffer; + Bool autopaintColorKey; + int Filter; + int sx, sy; + int offset[MAX_BUFFERS]; + int buffer; +} GLINTPortPrivRec, *GLINTPortPrivPtr; + +#define GET_PORT_PRIVATE(pScrn) \ + (GLINTPortPrivPtr)((GLINTPTR(pScrn))->adaptor->pPortPrivates[0].ptr) - /* Find the buffer that is being removed */ - for (i = 0; i < MAX_BUFFERS && pPPriv->Buffer[i] != Buffer; i++); - if (i >= MAX_BUFFERS) return; - - if (i == pPPriv->display) pPPriv->display = -1; - if (i == pPPriv->copy) pPPriv->copy = -1; - pPPriv->Buffer[i] = NULL; +#define RAMDAC_WRITE(data,index) \ +do{ \ + GLINT_WRITE_REG(((index)>>8)&0xff, PM3RD_IndexHigh); \ + GLINT_WRITE_REG((index)&0xff, PM3RD_IndexLow); \ + GLINT_WRITE_REG(data, PM3RD_IndexedData); \ +}while(0) + +void Permedia3ResetVideo(ScrnInfoPtr pScrn) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + GLINTPortPrivPtr pPriv = pGlint->adaptor->pPortPrivates[0].ptr; + + GLINT_WAIT(15); + GLINT_WRITE_REG(0xfff0|(0xffff<<16), PM3VideoOverlayFifoControl); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, PM3VideoOverlayMode); + pPriv->ramdacOn = FALSE; + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, PM3RD_VideoOverlayControl); + RAMDAC_WRITE((pPriv->colorKey&0xff0000)>>16, PM3RD_VideoOverlayKeyR); + RAMDAC_WRITE((pPriv->colorKey&0x00ff00)>>8, PM3RD_VideoOverlayKeyG); + RAMDAC_WRITE(pPriv->colorKey&0x0000ff, PM3RD_VideoOverlayKeyB); + GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE, PM3VideoOverlayUpdate); } -static void -FreeBuffers(PortPrivPtr pPPriv, Bool from_timer) + +static XF86VideoAdaptorPtr +Permedia3SetupImageVideo(ScreenPtr pScreen) { - int i = -1; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GLINTPtr pGlint = GLINTPTR(pScrn); + XF86VideoAdaptorPtr adapt; + GLINTPortPrivPtr pPriv; - if (!from_timer) { - if (pPPriv->TimerInUse) { - pPPriv->TimerInUse = FALSE; - TimerCancel(pPPriv->Timer); - } - } + if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(GLINTPortPrivRec) + + sizeof(DevUnion)))) + return NULL; - pPPriv->display = -1; - pPPriv->copy = -1; - for (i=0; i < MAX_BUFFERS; i++) - if (pPPriv->Buffer[i]) { - xf86FreeOffscreenArea (pPPriv->Buffer[i]); - pPPriv->Buffer[i] = NULL; - } + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "Permedia3 Backend Scaler"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + pPriv = (GLINTPortPrivPtr)(&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 = Permedia3StopVideo; + adapt->SetPortAttribute = Permedia3SetPortAttribute; + adapt->GetPortAttribute = Permedia3GetPortAttribute; + adapt->QueryBestSize = Permedia3QueryBestSize; + adapt->PutImage = Permedia3PutImage; + adapt->QueryImageAttributes = Permedia3QueryImageAttributes; + + /* FIXME : depth 15 and 16 doesn't work here */ + pPriv->colorKey = pGlint->videoKey; + pPriv->videoStatus = 0; + pPriv->buffer = 0; /* double buffer (or maybe triple later) */ + pPriv->doubleBuffer = TRUE; + pPriv->autopaintColorKey = TRUE; + pPriv->Filter = PM3VideoOverlayMode_FILTER_FULL; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pGlint->adaptor = adapt; + + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + xvFilter = MAKE_ATOM("XV_FILTER"); + + Permedia3ResetVideo(pScrn); + + return adapt; } -static CARD32 -TimerCallback(OsTimerPtr pTim, CARD32 now, pointer p) + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) { - PortPrivPtr pPPriv = (PortPrivPtr) p; + int *dataA, *dataB; + int num; - if (pPPriv->StopDelay >= 0) { - if (!(pPPriv->StopDelay--)) { - FreeBuffers(pPPriv, TRUE); - pPPriv->TimerInUse = FALSE; - } - } + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; - if (pPPriv->TimerInUse) - return pPPriv->Instant; + 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); - return 0; /* Cancel */ + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; } -static int -AllocateBuffers(PortPrivPtr pPPriv, int w_bpp, int h) +static void +Permedia3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; - int i = -1; - - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "We try to allocate a %dx%d buffer.\n", w_bpp, h)); - /* we start a timer to free the buffers if they are nto used within - * 5 seconds (pPPriv->Delay * pPPriv->Instant) */ - pPPriv->StopDelay = pPPriv->Delay; - if (!pPPriv->TimerInUse) { - pPPriv->TimerInUse = TRUE; - TimerSet(pPPriv->Timer, 0, 80, TimerCallback, pAPriv); - } + GLINTPtr pGlint = GLINTPTR(pScrn); + GLINTPortPrivPtr pPriv = (GLINTPortPrivPtr)data; + int i; - for (i=0; i < MAX_BUFFERS - && (i == pPPriv->display || i == pPPriv->copy); i++); - - if (pPPriv->Buffer[i]) { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Buffer %d exists.\n", i)); - if ((pPPriv->Buffer[i]->box.x2 - pPPriv->Buffer[i]->box.x1) == w_bpp && - (pPPriv->Buffer[i]->box.y2 - pPPriv->Buffer[i]->box.y1) == h) { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Buffer %d is of the good size, let's use it.\n", i)); - return (pPPriv->copy = i); - } - else if (xf86ResizeOffscreenArea (pPPriv->Buffer[i], w_bpp, h)) { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "I was able to resize buffer %d, let's use it.\n", i)); - pPPriv->BufferBase[i] = - ((pPPriv->Buffer[i]->box.y1 * pScrn->displayWidth) + - pPPriv->Buffer[i]->box.x1)<<pPPriv->FB_Shift; - return (pPPriv->copy = i); - } - else { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "I was not able to resize buffer %d.\n", i)); - xf86FreeOffscreenArea (pPPriv->Buffer[i]); - pPPriv->Buffer[i] = NULL; - } + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if(shutdown) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->ramdacOn = FALSE; + GLINT_WAIT(4); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, + PM3RD_VideoOverlayControl); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + } + for (i = 0; i < (pPriv->doubleBuffer ? 2 : 1); i++) { + if(pPriv->area[i]) { + xf86FreeOffscreenArea(pPriv->area[i]); + pPriv->area[i] = NULL; + } + } + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } +} + +static int +Permedia3SetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +){ + GLINTPortPrivPtr pPriv = (GLINTPortPrivPtr)data; + GLINTPtr pGlint = GLINTPTR(pScrn); + + if (attribute == xvDoubleBuffer) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; + } + else if (attribute == xvColorKey) + { + pPriv->colorKey = value; + GLINT_WAIT(9); + RAMDAC_WRITE((value & 0xff0000)>>16, PM3RD_VideoOverlayKeyR); + RAMDAC_WRITE((value & 0x00ff00)>>8, PM3RD_VideoOverlayKeyG); + RAMDAC_WRITE((value & 0x0000ff), PM3RD_VideoOverlayKeyB); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); } - if ((pPPriv->Buffer[i] = xf86AllocateOffscreenArea (pScrn->pScreen, - w_bpp, h, 4 >> pPPriv->FB_Shift, NULL, NULL, (pointer) pPPriv))) { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Sucessfully allocated buffer %d, let's use it.\n", i)); - pPPriv->BufferBase[i] = - ((pPPriv->Buffer[i]->box.y1 * pScrn->displayWidth) + - pPPriv->Buffer[i]->box.x1)<<pPPriv->FB_Shift; - return (pPPriv->copy = i); + else if (attribute == xvAutopaintColorKey) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->autopaintColorKey = value; + } + else if (attribute == xvFilter) + { + if ((value < 0) || (value > 2)) + return BadValue; + switch (value) { + case 0: + pPriv->Filter = PM3VideoOverlayMode_FILTER_OFF; + break; + case 1: + pPriv->Filter = PM3VideoOverlayMode_FILTER_FULL; + break; + case 2: + pPriv->Filter = PM3VideoOverlayMode_FILTER_PARTIAL; + break; + } } - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Unable to allocate a buffer.\n")); - return -1; + else + return BadMatch; + + return Success; } -/* - * Xv interface - */ +static int +Permedia3GetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + GLINTPortPrivPtr pPriv = (GLINTPortPrivPtr)data; + + if (attribute == xvDoubleBuffer) + *value = (pPriv->doubleBuffer) ? 1 : 0; + else if (attribute == xvColorKey) + *value = pPriv->colorKey; + else if (attribute == xvAutopaintColorKey) + *value = (pPriv->autopaintColorKey) ? 1 : 0; + else if (attribute == xvFilter) + *value = pPriv->Filter >> 14; + else + return BadMatch; + + 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 +){ + 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; +} -#if USE_HARDWARE_COPY static void -HWCopySetup(PortPrivPtr pPPriv, int x, int y, int w, int h) +HWCopySetup(ScrnInfoPtr pScrn, int x, int y, int w, int h) { - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; GLINTPtr pGlint = GLINTPTR(pScrn); - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "x = %d, y = %d, w = %d, h = %d.\n", x, y, w, h)); GLINT_WAIT(4); GLINT_WRITE_REG(0xffffffff, FBHardwareWriteMask); @@ -418,37 +525,41 @@ HWCopySetup(PortPrivPtr pPPriv, int x, int y, int w, int h) PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); } + static void -HWCopyYV12(PortPrivPtr pPPriv, CARD8 *Y, int w, int h) +HWCopyYV12(ScrnInfoPtr pScrn, CARD8 *Y, int w, int h) { - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; GLINTPtr pGlint = GLINTPTR(pScrn); - int Y_size = w * h; - CARD8 *V = Y + Y_size; - CARD8 *U = V + (Y_size >> 2); + int size = w * h; + CARD8 *V = Y + size; + CARD8 *U = V + (size >> 2); CARD32 *dst; - int dwords, i, x; + int pass2 = 0; + int dwords, i, x = 0; + + dwords = size >> 1; - dwords = Y_size >> 1; + w >>= 1; - x = 0; while (dwords >= pGlint->FIFOSize) { dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - for (i = pGlint->FIFOSize - 1; i; i--, Y += 2, U++, V++, dst++, x++) { - /* mmm, i don't know if this is really needed, as we perform - * endianess inversion as usual, let's check it before removing */ -#if X_BYTE_ORDER == X_BIG_ENDIAN - *dst = V[0] + (Y[1] << 8) + (U[0] << 16) + (Y[0] << 24); -#else - *dst = Y[0] + (U[0] << 8) + (Y[1] << 16) + (V[0] << 24); -#endif - if (x == w>>1) { U -= w>>1; V -= w>>1; } - if (x == w) x = 0; + for (i = pGlint->FIFOSize - 1; i; i--, Y += 2, x++) { + if (x == w) { + x = 0; + if (pass2 == 0) + pass2 = 1; + else + if (pass2 == 1) { + pass2 = 0; + U += w; + V += w; + } + } + *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); } dwords -= pGlint->FIFOSize - 1; } @@ -458,125 +569,112 @@ HWCopyYV12(PortPrivPtr pPPriv, CARD8 *Y, int w, int h) /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - for (i = dwords; i; i--, Y += 2, U++, V++, dst++, x++) { - /* mmm, i don't know if this is really needed, as we perform - * endianess inversion as usual, let's check it before removing */ -#if X_BYTE_ORDER == X_BIG_ENDIAN - *dst = V[0] + (Y[1] << 8) + (U[0] << 16) + (Y[0] << 24); -#else - *dst = Y[0] + (U[0] << 8) + (Y[1] << 16) + (V[0] << 24); -#endif - if (x == w>>1) { U -= w>>1; V -= w>>1; } - if (x == w) x = 0; + for (i = dwords; i; i--, Y += 2, x++) { + if (x == w) { + x = 0; + if (pass2 == 0) + pass2 = 1; + else + if (pass2 == 1) { + pass2 = 0; + U += w; + V += w; + } + } + *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); } } } + static void -HWCopyFlat(PortPrivPtr pPPriv, CARD8 *src, int w, int h) +HWCopyFlat(ScrnInfoPtr pScrn, CARD8 *src, int w, int h) { - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; GLINTPtr pGlint = GLINTPTR(pScrn); - int size = w * h; - int pitch = pScrn->displayWidth<<pPPriv->FB_Shift; - CARD32 *dst; + GLINTPortPrivPtr pPriv = pGlint->adaptor->pPortPrivates[0].ptr; + int pitch = pScrn->displayWidth; CARD8 *tmp_src; - int dwords, i; + int dwords; if (w == pitch) { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "HWCopyFlat : src = %08x, w = pitch = %d, h = %d.\n", - src, w, h)); - dwords = size >> pPPriv->Video_Shift; - while (dwords >= pGlint->FIFOSize) { - dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + dwords = (w * h) >> (2 - pPriv->Video_Shift); + while(dwords >= pGlint->FIFOSize) { GLINT_WAIT(pGlint->FIFOSize); - GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - for (i = pGlint->FIFOSize - 1; i; i--, dst++, src++) *dst = *src; + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)src, pGlint->FIFOSize - 1); dwords -= pGlint->FIFOSize - 1; - } - if (dwords) { - dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + src += pGlint->FIFOSize - 1; + } + if(dwords) { GLINT_WAIT(dwords + 1); - GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - for (i = dwords; i; i--, dst++, src++) *dst = *src; - } + GLINT_WRITE_REG(((dwords - 1) << 16)|(0x15 << 4) |0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)src, dwords); + } } else { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "HWCopyFlat : src = %08x, w = %d, pitch = %d, h = %d.\n", - src, w, pitch, h)); - while (h) { - tmp_src = src; - dwords = w >> pPPriv->Video_Shift; - while (dwords >= pGlint->FIFOSize) { - dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + while (h--) { + tmp_src = src; + dwords = w >> (2 - pPriv->Video_Shift); + while(dwords >= pGlint->FIFOSize) { GLINT_WAIT(pGlint->FIFOSize); - GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - for (i = pGlint->FIFOSize - 1; i; i--, dst++, src++) *dst = *src; + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)src, pGlint->FIFOSize - 1); dwords -= pGlint->FIFOSize - 1; - } - if (dwords) { - dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + src += pGlint->FIFOSize - 1; + } + if(dwords) { GLINT_WAIT(dwords + 1); - GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - for (i = dwords; i; i--, dst++, src++) *dst = *src; - } - src = tmp_src + pitch; - } - } -} -#else -static void -CopyYV12(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++) -#if X_BYTE_ORDER == X_BIG_ENDIAN - *dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24); -#else - *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); -#endif - dst += pad; - for (x = 0; x < width; Y += 2, x++) -#if X_BYTE_ORDER == X_BIG_ENDIAN - *dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24); -#else - *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); -#endif - dst += pad; - U += width; - V += width; + GLINT_WRITE_REG(((dwords-1)<<16)|(0x15<<4) | 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)src, dwords); + } + src = tmp_src + (w << pPriv->Video_Shift); + } } } -static void -CopyFlat(CARD8 *src, CARD8 *dst, int width, int height, int pitch) +static FBAreaPtr +Permedia3AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area, int width, int height) { - if (width == pitch) { - memcpy(dst, src, width * height); - return; - } + ScreenPtr pScreen; + FBAreaPtr new_area; - while (height > 0) { - memcpy(dst, src, width); - dst += pitch; - src += width; - height--; - } + if (area) { + if ((area->box.x2 - area->box.x1 >= width) && + (area->box.y2 - area->box.y1 >= height)) + return area; + + if (xf86ResizeOffscreenArea(area, width, height)) + return area; + + xf86FreeOffscreenArea(area); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_area = xf86AllocateOffscreenArea(pScreen, width, height, pScrn->bitsPerPixel / 8, NULL, NULL, NULL); + + if (!new_area) { + int max_width, max_height; + + xf86QueryLargestOffscreenArea(pScreen, &max_width, &max_height, pScrn->bitsPerPixel / 8, 0, PRIORITY_EXTREME); + + if (max_width < width || max_height < height) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_area = xf86AllocateOffscreenArea(pScreen, width, height, pScrn->bitsPerPixel / 8, NULL, NULL, NULL); + } + + return new_area; } -#endif #define FORMAT_RGB8888 PM3VideoOverlayMode_COLORFORMAT_RGB8888 #define FORMAT_RGB4444 PM3VideoOverlayMode_COLORFORMAT_RGB4444 @@ -594,153 +692,73 @@ CopyFlat(CARD8 *src, CARD8 *dst, int width, int height, int pitch) #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) - -#define RAMDAC_WRITE_OLD(data,index) \ - Permedia2vOutIndReg(pScrn, index, 0x00, data) - /* Notice, have to check that we dont overflow the deltas here ... */ static void compute_scale_factor( - unsigned int* src_w, unsigned int* dst_w, + short* src_w, short* dst_w, unsigned int* shrink_delta, unsigned int* zoom_delta) { + /* NOTE: If we don't return reasonable values here then the video + * unit can potential shut off and won't display an image until re-enabled. + * Seems as though the zoom_delta is o.k, and I've not had the problem. + * The 'shrink_delta' is prone to this the most - FIXME ! */ + if (*src_w >= *dst_w) { + *src_w &= ~0x3; *dst_w &= ~0x3; - *shrink_delta = (((*src_w << 16) / *dst_w) & 0x0ffffff0) + 0x10; + *shrink_delta = (((*src_w << 16) / *dst_w) + 0x0f) & 0x0ffffff0; *zoom_delta = 1<<16; + if ( ((*shrink_delta * *dst_w) >> 16) & 0x03 ) + *shrink_delta += 0x10; } else { - if (*src_w & 0x3) *src_w = (*src_w & ~0x3) + 4; + *src_w &= ~0x3; + *dst_w &= ~0x3; + *zoom_delta = (((*src_w << 16) / *dst_w) + 0x0f) & 0x0001fff0; *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; + if ( ((*zoom_delta * *dst_w) >> 16) & 0x03 ) + *zoom_delta += 0x10; } } static void -BeginOverlay(PortPrivPtr pPPriv, int display) -{ - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; +Permedia3DisplayVideo( + ScrnInfoPtr pScrn, + int id, + int offset, + short width, short height, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned int src_x = pPPriv->vx, dst_x = pPPriv->dx; - unsigned int src_y = pPPriv->vy, dst_y = pPPriv->dy; - unsigned int src_w = pPPriv->vw, dst_w = pPPriv->dw; - unsigned int src_h = pPPriv->vh, dst_h = pPPriv->dh; - unsigned int shrink_delta, zoom_delta; -#if BLACKNESS_WORKAROUND - static int Frames = 50; -#endif - unsigned int stride = - (pScrn->displayWidth << pPPriv->FB_Shift) >> pPPriv->Video_Shift; + GLINTPortPrivPtr portPriv = pGlint->adaptor->pPortPrivates[0].ptr; + unsigned int shrink, zoom; + unsigned int newx1, newx2; /* Let's overlay only to visible parts of the screen */ - if (pPPriv->dx < pScrn->frameX0) { - dst_w = dst_w - pScrn->frameX0 + dst_x; - dst_x = 0; - src_w = dst_w * pPPriv->vw / pPPriv->dw; - src_x = src_x + pPPriv->vw - src_w; - } else if (pScrn->frameX0 > 0) dst_x = dst_x - pScrn->frameX0; - if (pPPriv->dy < pScrn->frameY0) { - dst_h = dst_h - pScrn->frameY0 + pPPriv->dy; - dst_y = 0; - src_h = dst_h * pPPriv->vh / pPPriv->dh; - src_y = src_y + pPPriv->vh - src_h; - } else if (pScrn->frameY0 > 0) dst_y = dst_y - pScrn->frameY0; - if (dst_x + dst_w > (pScrn->frameX1 - pScrn->frameX0)) { - unsigned int old_w = dst_w; - dst_w = pScrn->frameX1 - pScrn->frameX0 - dst_x; - src_w = dst_w * src_w / old_w; + if (dstBox->x1 == 0) { + x1 = drw_w - dstBox->x2; + drw_w = dstBox->x2; } - if (dst_y + dst_h > (pScrn->frameY1 - pScrn->frameY0)) { - unsigned int old_h = dst_h; - dst_h = pScrn->frameY1 - pScrn->frameY0 - dst_y; - src_h = dst_h * src_h / old_h; + if (dstBox->x2 == pScrn->frameX1) { + x2 = drw_w - (dstBox->x2 - dstBox->x1); + drw_w = (dstBox->x2 - dstBox->x1); } /* 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); - -#if BLACKNESS_WORKAROUND - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "BeginOverlay %d (buffer %d)\n", Frames, display)); -#else - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "BeginOverlay (buffer %d)\n", display)); -#endif - 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.\n", - pPPriv->dw, dst_w)); - - if (display != -1) pPPriv->display = display; - -#if BLACKNESS_WORKAROUND - if (++Frames>25) { - Frames = 0; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Registers (1) : %08x, %08x, %08x, %08x, %08x.\n", - GLINT_READ_REG(PM3VideoOverlayFifoControl), - GLINT_READ_REG(PM3VideoOverlayMode), - GLINT_READ_REG(PM3VideoOverlayBase0), - GLINT_READ_REG(PM3VideoOverlayBase1), - GLINT_READ_REG(PM3VideoOverlayBase2))); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Registers (2) : %08x, %08x, %08x, %08x.\n", - GLINT_READ_REG(PM3VideoOverlayStride), - GLINT_READ_REG(PM3VideoOverlayWidth), - GLINT_READ_REG(PM3VideoOverlayHeight), - GLINT_READ_REG(PM3VideoOverlayOrigin))); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Registers (3) : %08x, %08x, %08x, %08x.\n", - GLINT_READ_REG(PM3VideoOverlayYDelta), - GLINT_READ_REG(PM3VideoOverlayShrinkXDelta), - GLINT_READ_REG(PM3VideoOverlayZoomXDelta), - GLINT_READ_REG(PM3VideoOverlayIndex))); - GLINT_WAIT(8); - GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, - PM3VideoOverlayMode); - } else GLINT_WAIT(7); -#else - GLINT_WAIT(7); -#endif - GLINT_WRITE_REG(3|(12<<16), PM3VideoOverlayFifoControl); - /* Updating the Video Overlay Source Image Parameters */ - GLINT_WRITE_REG( - pPPriv->BufferBase[pPPriv->display]>>pPPriv->Video_Shift, - PM3VideoOverlayBase+(pPPriv->display*8)); - GLINT_WRITE_REG(pPPriv->Format | - PM3VideoOverlayMode_BUFFERSYNC_MANUAL | - PM3VideoOverlayMode_FLIP_VIDEO | - /* Filtering & Mirroring Attributes */ - pPPriv->OverlayMode | - PM3VideoOverlayMode_ENABLE, - PM3VideoOverlayMode); - /* Let's set the source stride. */ - GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(stride), + newx1 = src_w; newx2 = drw_w; + compute_scale_factor(&src_w, &drw_w, &shrink, &zoom); + dstBox->x2 -= (newx2 - drw_w); + + /* We do a long wait here - for everything that needs to be written */ + GLINT_WAIT(39); + GLINT_WRITE_REG(offset>>portPriv->Video_Shift, + portPriv->buffer ? PM3VideoOverlayBase1 : PM3VideoOverlayBase0); + /* Let's set the source pitch. */ + GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(pScrn->displayWidth<< + (pScrn->bitsPerPixel>>4) >>portPriv->Video_Shift), PM3VideoOverlayStride); /* Let's set the position and size of the visible part of the source. */ GLINT_WRITE_REG(PM3VideoOverlayWidth_WIDTH(src_w), @@ -748,834 +766,551 @@ BeginOverlay(PortPrivPtr pPPriv, int display) GLINT_WRITE_REG(PM3VideoOverlayHeight_HEIGHT(src_h), PM3VideoOverlayHeight); GLINT_WRITE_REG( - PM3VideoOverlayOrigin_XORIGIN(src_x) | - PM3VideoOverlayOrigin_YORIGIN(src_y), + PM3VideoOverlayOrigin_XORIGIN(x1) | + PM3VideoOverlayOrigin_YORIGIN(y1), PM3VideoOverlayOrigin); - - GLINT_WAIT(5); /* Scale the source to the destinationsize */ - if (src_h == dst_h) { + if (src_h == drw_h) { GLINT_WRITE_REG( PM3VideoOverlayYDelta_NONE, PM3VideoOverlayYDelta); } else { GLINT_WRITE_REG( - PM3VideoOverlayYDelta_DELTA(src_h,dst_h), + PM3VideoOverlayYDelta_DELTA(src_h,drw_h), PM3VideoOverlayYDelta); } - GLINT_WRITE_REG(shrink_delta, PM3VideoOverlayShrinkXDelta); - GLINT_WRITE_REG(zoom_delta, PM3VideoOverlayZoomXDelta); - GLINT_WRITE_REG(pPPriv->display, PM3VideoOverlayIndex); - GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE, - PM3VideoOverlayUpdate); - - - /* Now set the ramdac video overlay region and mode */ - if ((pPPriv->ramdac_x != dst_x) || (pPPriv->ramdac_w != dst_w)) { - RAMDAC_WRITE((dst_x&0xff), PM3RD_VideoOverlayXStartLow); - RAMDAC_WRITE((dst_x&0xf00)>>8, PM3RD_VideoOverlayXStartHigh); - RAMDAC_WRITE(((dst_x+dst_w)&0xff), PM3RD_VideoOverlayXEndLow); - RAMDAC_WRITE(((dst_x+dst_w)&0xf00)>>8,PM3RD_VideoOverlayXEndHigh); - pPPriv->ramdac_x = dst_x; - pPPriv->ramdac_w = dst_w; - } - if ((pPPriv->ramdac_y != dst_y) || (pPPriv->ramdac_h != dst_h)) { - RAMDAC_WRITE((dst_y&0xff), PM3RD_VideoOverlayYStartLow); - RAMDAC_WRITE((dst_y&0xf00)>>8, PM3RD_VideoOverlayYStartHigh); - RAMDAC_WRITE(((dst_y+dst_h)&0xff), PM3RD_VideoOverlayYEndLow); - RAMDAC_WRITE(((dst_y+dst_h)&0xf00)>>8,PM3RD_VideoOverlayYEndHigh); - pPPriv->ramdac_y = dst_y; - pPPriv->ramdac_h = dst_h; - } - - if (!pPPriv->ramdac_on) { - if (pPPriv->OverlayAlpha<(3<<6)) { - RAMDAC_WRITE(pPPriv->OverlayAlpha, PM3RD_VideoOverlayBlend); - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_BLEND | - PM3RD_VideoOverlayControl_BLENDSRC_REGISTER, - PM3RD_VideoOverlayControl); - } else { -#if SUPPORT_CLIPPING - switch (pScrn->depth) { - case 8: - case 16: - RAMDAC_WRITE((pPPriv->ColorKey&0xff0000)>>16, - PM3RD_VideoOverlayKeyR); - RAMDAC_WRITE((pPPriv->ColorKey&0x00ff00)>>8, - PM3RD_VideoOverlayKeyG); - RAMDAC_WRITE(pPPriv->ColorKey&0x0000ff, - PM3RD_VideoOverlayKeyB); - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_MAINKEY | - PM3RD_VideoOverlayControl_KEY_COLOR, - PM3RD_VideoOverlayControl); - break; - case 15: - RAMDAC_WRITE(0x1, PM3RD_VideoOverlayKeyR); - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_MAINKEY | - PM3RD_VideoOverlayControl_KEY_ALPHA, - PM3RD_VideoOverlayControl); - break; - case 24: - RAMDAC_WRITE(0xff, PM3RD_VideoOverlayKeyR); - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_MAINKEY | - PM3RD_VideoOverlayControl_KEY_ALPHA, - PM3RD_VideoOverlayControl); - break; - } -#else - RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_ALWAYS, - PM3RD_VideoOverlayControl); -#endif - } - pPPriv->ramdac_on = TRUE; - } - - pPPriv->Buffer[pPPriv->display]->RemoveAreaCallback = - RemoveBufferCallback; - if (display != -1) pPPriv->copy = -1; -} - -#if SUPPORT_CLIPPING - -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} -static void Clip (PortPrivPtr pPPriv, RegionPtr clipBoxes) -{ - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; - - /* Let's handle the clipping here. */ - if(!RegionsEqual(&pPPriv->clip, clipBoxes)) { - REGION_COPY(pScrn->pScreen, &pPPriv->clip, clipBoxes); - if (pPPriv->OverlayAlpha<(3<<6)) { - XAAFillSolidRects(pScrn, pPPriv->OverlayAlpha<<24, GXcopy, - 0xff000000, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - } else { - switch (pScrn->depth) { - case 8: /* CI8 */ - XAAFillSolidRects(pScrn, pPPriv->ColorKey, - GXcopy, 0xffffffff, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - break; - case 15: /* RGB5551 */ - XAAFillSolidRects(pScrn, 0xffffffff, GXcopy, 0x80008000, - REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); - break; - case 16: /* RGB565 */ - XAAFillSolidRects(pScrn, pPPriv->ColorKey, GXcopy, - 0xffffffff, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - break; - case 24: /* RGB8888 */ - XAAFillSolidRects(pScrn, 0xffffffff, GXcopy, - 0xff000000, REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - break; - } - } + if (src_w == drw_w) { + GLINT_WRITE_REG(1<<16, PM3VideoOverlayShrinkXDelta); + GLINT_WRITE_REG(1<<16, PM3VideoOverlayZoomXDelta); + } else { + GLINT_WRITE_REG(shrink, PM3VideoOverlayShrinkXDelta); + GLINT_WRITE_REG(zoom, PM3VideoOverlayZoomXDelta); } -} -#endif - -static void -StopOverlay(PortPrivPtr pPPriv, int cleanup) -{ - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - ScrnInfoPtr pScrn = pAPriv->pScrn; - GLINTPtr pGlint = GLINTPTR(pScrn); + GLINT_WRITE_REG(portPriv->buffer, PM3VideoOverlayIndex); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "StopOverlay.\n")); - /* Stop the Video Overlay in the RAMDAC */ - if (pPPriv->ramdac_on) { - RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, - PM3RD_VideoOverlayControl); - pPPriv->ramdac_on = FALSE; - } - /* Stop the Video Overlay in the Video Overlay Unit */ - GLINT_WAIT(1); - GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + /* Now set the ramdac video overlay region and mode */ + RAMDAC_WRITE((dstBox->x1&0xff), PM3RD_VideoOverlayXStartLow); + RAMDAC_WRITE((dstBox->x1&0xf00)>>8, PM3RD_VideoOverlayXStartHigh); + RAMDAC_WRITE((dstBox->x2&0xff), PM3RD_VideoOverlayXEndLow); + RAMDAC_WRITE((dstBox->x2&0xf00)>>8,PM3RD_VideoOverlayXEndHigh); + RAMDAC_WRITE((dstBox->y1&0xff), PM3RD_VideoOverlayYStartLow); + RAMDAC_WRITE((dstBox->y1&0xf00)>>8, PM3RD_VideoOverlayYStartHigh); + RAMDAC_WRITE((dstBox->y2&0xff), PM3RD_VideoOverlayYEndLow); + RAMDAC_WRITE((dstBox->y2&0xf00)>>8,PM3RD_VideoOverlayYEndHigh); + + GLINT_WRITE_REG(portPriv->Video_Shift << 5 | + portPriv->Format | + portPriv->Filter | + PM3VideoOverlayMode_BUFFERSYNC_MANUAL | + PM3VideoOverlayMode_FLIP_VIDEO | + PM3VideoOverlayMode_ENABLE, PM3VideoOverlayMode); -} -/* ReputImage is used if only the destination position or - * the clipboxes change. */ -static int -Permedia3ReputImage(ScrnInfoPtr pScrn, - short drw_x, short drw_y, - RegionPtr clipBoxes, pointer data) -{ - PortPrivPtr pPPriv = (PortPrivPtr) data; - - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "ReputImage %d,%d.\n", drw_x, drw_y)); - -#if !SUPPORT_CLIPPING - /* If the clip region is not a rectangle */ - if (REGION_SIZE(clipBoxes) != 0) { - StopOverlay (pPPriv, FALSE); - return Success; - } -#endif - - /* If the buffer was freed, we cannot overlay it. */ - if (pPPriv->display == -1) { - StopOverlay (pPPriv, FALSE); - return Success; - } - /* Check that the dst area is some part of the visible screen. */ - if ((drw_x + pPPriv->dw) < pScrn->frameX0 || - (drw_y + pPPriv->dh) < pScrn->frameY0 || - drw_x > pScrn->frameX1 || drw_y > pScrn->frameY1) { - return Success; + if (!portPriv->ramdacOn) { + RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_KEY_COLOR | + PM3RD_VideoOverlayControl_MODE_MAINKEY | + PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED, + PM3RD_VideoOverlayControl); + portPriv->ramdacOn = TRUE; } - /* Copy the destinations coordinates */ - pPPriv->dx = drw_x; - pPPriv->dy = drw_y; - -#if SUPPORT_CLIPPING - /* Clipping */ - Clip (pPPriv, clipBoxes); -#endif - - /* Restart the overlay */ - BeginOverlay(pPPriv, -1); - - return Success; + GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE, + PM3VideoOverlayUpdate); } -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; -#if !USE_HARDWARE_COPY - GLINTPtr pGlint = GLINTPTR(pScrn); -#endif - int copy = -1; - Bool copy_flat = TRUE; - int w_bpp; - - 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)); - -#if !SUPPORT_CLIPPING - /* If the clip region is not a rectangle */ - if (REGION_SIZE(clipBoxes) != 0) { - StopOverlay (pPPriv, FALSE); - return Success; - } -#endif - - /* Check that the src area to put is included in the buffer. */ - if ((src_x + src_w) > width || - (src_y + src_h) > height || - src_x < 0 || src_y < 0) { - StopOverlay(pPPriv, FALSE); - return BadValue; - } - - /* Check that the dst area is some part of the visible screen. */ - if ((drw_x + drw_w) < pScrn->frameX0 || - (drw_y + drw_h) < pScrn->frameY0 || - drw_x > pScrn->frameX1 || drw_y > pScrn->frameY1) { - StopOverlay(pPPriv, FALSE); - return Success; - } - - /* Copy the source and destinations coordinates and size */ - 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; - - /* If the image format changed since a previous call, - * let's check if it is supported. By default, we suppose that - * the previous image format was ScalerImages[0].id */ - if (id != pPPriv->Id) { - int i; - for (i = 0; i < ENTRIES(ScalerImages); i++) - if (id == ScalerImages[i].id) - break; - if (i >= ENTRIES(ScalerImages)) - return XvBadAlloc; - pPPriv->Id = id; - } - - /* Let's find the image format and Video_Shift values */ - switch (id) { +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 +){ + GLINTPtr pGlint = GLINTPTR(pScrn); + GLINTPortPrivPtr pPriv = (GLINTPortPrivPtr)data; + INT32 x1, x2, y1, y2; + int pitch; + int i; + int w_bpp, bpp; + Bool copy_flat = TRUE; + BoxRec dstBox; + + /* Let's find the image format and Video_Shift values */ + switch (id) { case LE4CC('Y','V','1','2'): - pPPriv->Format = FORMAT_YUV422; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_YUV422; + pPriv->Video_Shift = 1; copy_flat = FALSE; break; case LE4CC('Y','U','Y','2'): - pPPriv->Format = FORMAT_YUV422; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_YUV422; + pPriv->Video_Shift = 1; break; case LE4CC('U','Y','V','Y'): - pPPriv->Format = FORMAT_VUY422; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_VUY422; + pPriv->Video_Shift = 1; break; case LE4CC('Y','U','V','A'): - pPPriv->Format = FORMAT_YUV444; - pPPriv->Video_Shift = 2; + pPriv->Format = FORMAT_YUV444; + pPriv->Video_Shift = 2; break; case LE4CC('V','U','Y','A'): - pPPriv->Format = FORMAT_VUY444; - pPPriv->Video_Shift = 2; + pPriv->Format = FORMAT_VUY444; + pPriv->Video_Shift = 2; break; case 0x41: /* RGBA 8:8:8:8 */ - pPPriv->Format = FORMAT_RGB8888; - pPPriv->Video_Shift = 2; + pPriv->Format = FORMAT_RGB8888; + pPriv->Video_Shift = 2; break; case 0x42: /* RGB 5:6:5 */ - pPPriv->Format = FORMAT_RGB565; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_RGB565; + pPriv->Video_Shift = 1; break; case 0x43: /* RGB 1:5:5:5 */ - pPPriv->Format = FORMAT_RGB5551; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_RGB5551; + pPriv->Video_Shift = 1; break; case 0x44: /* RGB 4:4:4:4 */ - pPPriv->Format = FORMAT_RGB4444; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_RGB4444; + pPriv->Video_Shift = 1; break; case 0x46: /* RGB 2:3:3 */ - pPPriv->Format = FORMAT_RGB332; - pPPriv->Video_Shift = 0; + pPriv->Format = FORMAT_RGB332; + pPriv->Video_Shift = 0; break; case 0x47: /* BGRA 8:8:8:8 */ - pPPriv->Format = FORMAT_BGR8888; - pPPriv->Video_Shift = 2; + pPriv->Format = FORMAT_BGR8888; + pPriv->Video_Shift = 2; break; case 0x48: /* BGR 5:6:5 */ - pPPriv->Format = FORMAT_BGR565; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_BGR565; + pPriv->Video_Shift = 1; break; case 0x49: /* BGR 1:5:5:5 */ - pPPriv->Format = FORMAT_BGR5551; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_BGR5551; + pPriv->Video_Shift = 1; break; case 0x4A: /* BGR 4:4:4:4 */ - pPPriv->Format = FORMAT_BGR4444; - pPPriv->Video_Shift = 1; + pPriv->Format = FORMAT_BGR4444; + pPriv->Video_Shift = 1; break; case 0x4C: /* BGR 2:3:3 */ - pPPriv->Format = FORMAT_BGR332; - pPPriv->Video_Shift = 0; + pPriv->Format = FORMAT_BGR332; + pPriv->Video_Shift = 0; break; - default: + default: return XvBadAlloc; } - /* Now we allocate a buffer, if it is needed */ - w_bpp = (width << pPPriv->Video_Shift) >> pPPriv->FB_Shift; - if ((copy = AllocateBuffers(pPPriv, w_bpp, height)) == -1) - return XvBadAlloc; - - /* Let's copy the image to the framebuffer */ -#if USE_HARDWARE_COPY - /* Erm, ... removing this log message will make the server crash. */ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Hardware image upload.\n")); - HWCopySetup(pPPriv, pPPriv->Buffer[copy]->box.x1, - pPPriv->Buffer[copy]->box.y1, w_bpp, height); - if (copy_flat) HWCopyFlat(pPPriv, buf, width, height); - else HWCopyYV12(pPPriv, buf, width, height); -#else - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Software image upload (1).\n")); - pPPriv->Sync(pScrn); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Software image upload (2).\n")); - if (copy_flat) CopyFlat(buf, - (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[copy], - width << pPPriv->FB_Shift, height, - pScrn->displayWidth << pPPriv->FB_Shift); - else CopyYV12(buf, - (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[copy]), - width, height, pScrn->displayWidth << pPPriv->FB_Shift); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Software image upload (3).\n")); - pPPriv->Sync(pScrn); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Software image upload (4).\n")); -#endif + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; -#if SUPPORT_CLIPPING - /* Clipping*/ - Clip (pPPriv, clipBoxes); -#endif + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; - /* We start the overlay */ - BeginOverlay(pPPriv, copy); + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + width, height)) + return Success; - /* We sync the chip again (if needed). */ - if (sync) pPPriv->Sync(pScrn); + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; - return Success; -} - -static void -Permedia3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) -{ - PortPrivPtr pPPriv = (PortPrivPtr) data; + bpp = pScrn->bitsPerPixel >> 3; + pitch = bpp * pScrn->displayWidth; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "StopVideo : exit=%d\n", cleanup)); + w_bpp = (width << pPriv->Video_Shift) >> (pScrn->bitsPerPixel >> 4); - REGION_EMPTY(pScrn->pScreen, &pPPriv->clip); - StopOverlay(pPPriv, cleanup); + for (i = 0; i < (pPriv->doubleBuffer ? 2 : 1); i++) { + if (!(pPriv->area[i] = + Permedia3AllocateMemory(pScrn,pPriv->area[i],w_bpp,src_h))) + return BadAlloc; - if (cleanup) { - FreeBuffers(pPPriv, FALSE); + pPriv->offset[i] = (pPriv->area[i]->box.x1 * bpp) + + (pPriv->area[i]->box.y1 * pitch); } -} - -static int -Permedia3SetPortAttribute(ScrnInfoPtr pScrn, - Atom attribute, INT32 value, pointer data) -{ - PortPrivPtr pPPriv = (PortPrivPtr) data; - if (attribute == xvFilter) { - switch (value) { - case 0: /* No Filtering */ - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~PM3VideoOverlayMode_FILTER_MASK) | - PM3VideoOverlayMode_FILTER_OFF; - break; - case 1: /* Partial Filtering (X axis only) */ - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~PM3VideoOverlayMode_FILTER_MASK) | - PM3VideoOverlayMode_FILTER_PARTIAL; - break; - case 2: /* Full Bilinear Filtering */ - /* We have to disable X mirroring also */ - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~(PM3VideoOverlayMode_FILTER_MASK | - PM3VideoOverlayMode_MIRRORX_ON)) | - PM3VideoOverlayMode_FILTER_FULL; - pPPriv->Attribute[1] &= 2; - break; - default: - return BadValue; - } - pPPriv->Attribute[0] = value; - } - else if (attribute == xvMirror) { - switch (value) { - case 0: /* No Mirroring */ - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~PM3VideoOverlayMode_MIRROR_MASK) | - PM3VideoOverlayMode_MIRRORX_OFF | - PM3VideoOverlayMode_MIRRORY_OFF; - break; - case 1: /* X Axis Mirroring */ - /* If full filtering was enabled, rever to partial. */ - if (pPPriv->Attribute[0] == 2) { - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~(PM3VideoOverlayMode_MIRROR_MASK | - PM3VideoOverlayMode_FILTER_MASK)) | - PM3VideoOverlayMode_MIRRORX_ON | - PM3VideoOverlayMode_MIRRORY_OFF | - PM3VideoOverlayMode_FILTER_PARTIAL; - pPPriv->Attribute[0] = 1; - } else { - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~PM3VideoOverlayMode_MIRROR_MASK) | - PM3VideoOverlayMode_MIRRORX_ON | - PM3VideoOverlayMode_MIRRORY_OFF; - } - break; - case 2: /* Y Axis Mirroring */ - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~PM3VideoOverlayMode_MIRROR_MASK) | - PM3VideoOverlayMode_MIRRORX_OFF | - PM3VideoOverlayMode_MIRRORY_ON; - break; - case 3: /* X and Y Axis Mirroring */ - /* If full filtering was enabled, rever to partial. */ - if (pPPriv->Attribute[0] == 2) { - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~(PM3VideoOverlayMode_MIRROR_MASK | - PM3VideoOverlayMode_FILTER_MASK)) | - PM3VideoOverlayMode_MIRRORX_ON | - PM3VideoOverlayMode_MIRRORY_ON | - PM3VideoOverlayMode_FILTER_PARTIAL; - pPPriv->Attribute[0] = 1; - } else { - pPPriv->OverlayMode = - (pPPriv->OverlayMode & - ~PM3VideoOverlayMode_MIRROR_MASK) | - PM3VideoOverlayMode_MIRRORX_ON | - PM3VideoOverlayMode_MIRRORY_ON; - } - break; - default: - return BadValue; - } - pPPriv->Attribute[1] = value; - } - else if (attribute == xvAlpha) { - if (value >= 0 && value <= 3) { - pPPriv->OverlayAlpha = value << 6; - } else return BadValue; - pPPriv->Attribute[2] = value; + HWCopySetup(pScrn, pPriv->area[pPriv->buffer]->box.x1, + pPriv->area[pPriv->buffer]->box.y1, w_bpp, src_h); + + if (copy_flat) + HWCopyFlat(pScrn, buf, src_w, src_h); + else + HWCopyYV12(pScrn, buf, src_w, src_h); + + /* paint the color key */ + if(pPriv->autopaintColorKey && !RegionsEqual(&pPriv->clip, clipBoxes)) { + /* update cliplist */ + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); +#if 0 + GLINT_WAIT(1); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + pPriv->ramdacOn = FALSE; +#endif + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } - else return BadMatch; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SPA attr=%d val=%d\n", - attribute, value)); - - return Success; -} + Permedia3Sync(pScrn); -static int -Permedia3GetPortAttribute(ScrnInfoPtr pScrn, - Atom attribute, INT32 *value, pointer data) -{ - PortPrivPtr pPPriv = (PortPrivPtr) data; + Permedia3DisplayVideo(pScrn, id, pPriv->offset[pPriv->buffer], width,height, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); - if (attribute == xvFilter) - *value = pPPriv->Attribute[0]; - else if (attribute == xvMirror) - *value = pPPriv->Attribute[1]; - else if (attribute == xvAlpha) - *value = pPPriv->Attribute[2]; - else return BadMatch; + /* Switch buffer on next run - double buffer */ + if (pPriv->doubleBuffer) { + if (!pPriv->buffer) + pPriv->buffer = 1; + else + pPriv->buffer = 0; + } - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "GPA attr=%d val=%d\n", - attribute, *value)); + pPriv->videoStatus = CLIENT_VIDEO_ON; 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; +static int +Permedia3QueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + int size, tmp; + + if(*w > 2047) *w = 2047; + if(*h > 2047) *h = 2047; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_YV12: /* YV12 */ + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + default: /* RGB15, RGB16, YUY2 */ + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } - *p_w = drw_w; - compute_scale_factor (&src_w, p_w, &shrink_delta, &zoom_delta); - *p_h = drw_h; + return size; } -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; +/****************** Offscreen stuff ***************/ + +typedef struct { + FBAreaPtr area; + Bool isOn; + int Video_Shift; + int Format; + Bool ramdacOn; +} OffscreenPrivRec, * OffscreenPrivPtr; + +static int +Permedia3AllocateSurface( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +){ + FBAreaPtr area; + int fbpitch, bpp; + OffscreenPrivPtr pPriv; + + if((w > 2047) || (h > 2047)) + return BadAlloc; + + w = (w + 1) & ~1; + bpp = pScrn->bitsPerPixel >> 3; + fbpitch = bpp * pScrn->displayWidth; + + if(!(area = Permedia3AllocateMemory(pScrn, NULL, w, h))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if(!(surface->offsets = xalloc(sizeof(int)))) { + xf86FreeOffscreenArea(area); + return BadAlloc; + } + if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->offsets); + xf86FreeOffscreenArea(area); + return BadAlloc; + } - if (pitches) - pitches[0] = pitch; + pPriv->area = area; + pPriv->isOn = FALSE; - return pitch * *height; + surface->pScrn = pScrn; + surface->id = id; + surface->offsets[0] = (area->box.x1 * bpp) + (area->box.y1 * fbpitch); + surface->devPrivate.ptr = (pointer)pPriv; - default: - for (i = 0; i < ENTRIES(ScalerImages); i++) - if (ScalerImages[i].id == id) - break; + return Success; +} - if (i >= ENTRIES(ScalerImages)) - break; +static int +Permedia3StopSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) { + GLINTPtr pGlint = GLINTPTR(surface->pScrn); + pPriv->ramdacOn = FALSE; + GLINT_WAIT(4); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, + PM3RD_VideoOverlayControl); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + pPriv->isOn = FALSE; + } - pitch = *width * (ScalerImages[i].bits_per_pixel >> 3); + return Success; +} - if (pitches) - pitches[0] = pitch; +static int +Permedia3FreeSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; - return pitch * *height; - } + if(pPriv->isOn) + Permedia3StopSurface(surface); + xf86FreeOffscreenArea(pPriv->area); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); - return 0; + return Success; } -static void -DeleteAdaptorPriv(AdaptorPrivPtr pAPriv) -{ - FreeBuffers(pAPriv->pPort, FALSE); - - TimerFree(pAPriv->pPort->Timer); +static int +Permedia3GetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +){ + return Permedia3GetPortAttribute(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} - xfree(pAPriv); +static int +Permedia3SetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +){ + return Permedia3SetPortAttribute(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); } -static AdaptorPrivPtr -NewAdaptorPriv(ScrnInfoPtr pScrn) -{ - AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) xcalloc(1, sizeof(AdaptorPrivRec)); - PortPrivPtr pPPriv = (PortPrivPtr) xcalloc(1, sizeof(PortPrivRec)); +static int +Permedia3DisplaySurface( + 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 +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; GLINTPtr pGlint = GLINTPTR(pScrn); - int i; + GLINTPortPrivPtr portPriv = pGlint->adaptor->pPortPrivates[0].ptr; + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + 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; + + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) + { + return Success; + } - if (!pAPriv) return NULL; - pAPriv->pScrn = pScrn; - if (!pPPriv) return NULL; - pAPriv->pPort = pPPriv; + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; - - /* We allocate a timer */ - if (!(pPPriv->Timer = TimerSet(NULL, 0, 0, TimerCallback, pPPriv))) { - DeleteAdaptorPriv(pAPriv); - return NULL; + /* Let's find the image format and Video_Shift values */ + switch (surface->id) { + case LE4CC('Y','V','1','2'): + pPriv->Format = FORMAT_YUV422; + pPriv->Video_Shift = 1; + break; + case LE4CC('Y','U','Y','2'): + pPriv->Format = FORMAT_YUV422; + pPriv->Video_Shift = 1; + break; + case LE4CC('U','Y','V','Y'): + pPriv->Format = FORMAT_VUY422; + pPriv->Video_Shift = 1; + break; + case LE4CC('Y','U','V','A'): + pPriv->Format = FORMAT_YUV444; + pPriv->Video_Shift = 2; + break; + case LE4CC('V','U','Y','A'): + pPriv->Format = FORMAT_VUY444; + pPriv->Video_Shift = 2; + break; + case 0x41: /* RGBA 8:8:8:8 */ + pPriv->Format = FORMAT_RGB8888; + pPriv->Video_Shift = 2; + break; + case 0x42: /* RGB 5:6:5 */ + pPriv->Format = FORMAT_RGB565; + pPriv->Video_Shift = 1; + break; + case 0x43: /* RGB 1:5:5:5 */ + pPriv->Format = FORMAT_RGB5551; + pPriv->Video_Shift = 1; + break; + case 0x44: /* RGB 4:4:4:4 */ + pPriv->Format = FORMAT_RGB4444; + pPriv->Video_Shift = 1; + break; + case 0x46: /* RGB 2:3:3 */ + pPriv->Format = FORMAT_RGB332; + pPriv->Video_Shift = 0; + break; + case 0x47: /* BGRA 8:8:8:8 */ + pPriv->Format = FORMAT_BGR8888; + pPriv->Video_Shift = 2; + break; + case 0x48: /* BGR 5:6:5 */ + pPriv->Format = FORMAT_BGR565; + pPriv->Video_Shift = 1; + break; + case 0x49: /* BGR 1:5:5:5 */ + pPriv->Format = FORMAT_BGR5551; + pPriv->Video_Shift = 1; + break; + case 0x4A: /* BGR 4:4:4:4 */ + pPriv->Format = FORMAT_BGR4444; + pPriv->Video_Shift = 1; + break; + case 0x4C: /* BGR 2:3:3 */ + pPriv->Format = FORMAT_BGR332; + pPriv->Video_Shift = 0; + break; + default: + return XvBadAlloc; } - pPPriv->pAdaptor = pAPriv; - /* Sync */ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, - "Sync is using : %sPermedia3Sync.\n", - pGlint->MultiAperture?"Dual":"")); - if (pGlint->MultiAperture) pPPriv->Sync = DualPermedia3Sync; - else pPPriv->Sync = Permedia3Sync; - - /* Framebuffer bpp shift */ - pPPriv->FB_Shift = pScrn->bitsPerPixel >> 4; - - /* Attributes */ - pPPriv->Attribute[0] = 2; /* Full filtering enabled */ - pPPriv->Attribute[1] = 0; /* No mirroring */ - pPPriv->Attribute[2] = 3; /* Opaque overlay mode */ - pPPriv->ColorKey = 0; - pPPriv->OverlayAlpha = - PM3RD_VideoOverlayBlend_FACTOR_100_PERCENT; - pPPriv->OverlayMode = - PM3VideoOverlayMode_FILTER_FULL | - PM3VideoOverlayMode_MIRRORX_OFF | - PM3VideoOverlayMode_MIRRORY_OFF; - - /* Clipping */ - REGION_EMPTY(pScrn->pScreen, &pPPriv->clip); - - /* RAMDAC saved values */ - pPPriv->ramdac_x = 0; - pPPriv->ramdac_w = 0; - pPPriv->ramdac_y = 0; - pPPriv->ramdac_h = 0; - pPPriv->ramdac_on = FALSE; - - /* Buffers */ - pPPriv->Id = ScalerImages[0].id; - pPPriv->copy = -1; - pPPriv->display = -1; - for (i = 0; i < MAX_BUFFERS; i++) - pPPriv->Buffer[i] = NULL; - - /* Timer */ - pPPriv->StopDelay = -1; - pPPriv->Delay = 125; - pPPriv->Instant = 1000 / 25; - - return pAPriv; -} + Permedia3DisplayVideo(pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); -/* - * Glint interface - */ + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); -void -Permedia3VideoEnterVT(ScrnInfoPtr pScrn) -{ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv enter VT\n")); -} + pPriv->isOn = TRUE; + /* we've prempted the XvImage stream so set its free timer */ + if(portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + pGlint->VideoTimerCallback = Permedia3VideoTimerCallback; + } -void -Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) -{ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv leave VT\n")); + return Success; } -void -Permedia3VideoUninit(ScrnInfoPtr pScrn) +static void +Permedia3InitOffscreenImages(ScreenPtr pScreen) { - AdaptorPrivPtr pAPriv, *ppAPriv; + XF86OffscreenImagePtr offscreenImages; - for (ppAPriv = &AdaptorPrivList; (pAPriv = *ppAPriv); ppAPriv = &(pAPriv->Next)) - if (pAPriv->pScrn == pScrn) { - *ppAPriv = pAPriv->Next; - DeleteAdaptorPriv(pAPriv); - break; - } + /* need to free this someplace */ + if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv cleanup\n")); + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | + VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = Permedia3AllocateSurface; + offscreenImages[0].free_surface = Permedia3FreeSurface; + offscreenImages[0].display = Permedia3DisplaySurface; + offscreenImages[0].stop = Permedia3StopSurface; + offscreenImages[0].setAttribute = Permedia3SetSurfaceAttribute; + offscreenImages[0].getAttribute = Permedia3GetSurfaceAttribute; + offscreenImages[0].max_width = 2047; + offscreenImages[0].max_height = 2047; + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); } -void -Permedia3VideoInit(ScreenPtr pScreen) +static void +Permedia3VideoTimerCallback(ScrnInfoPtr pScrn, Time time) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); - AdaptorPrivPtr pAPriv; - DevUnion Private[1]; - XF86VideoAdaptorRec VAR; - XF86VideoAdaptorPtr VARPtrs; - - switch (pGlint->Chipset) { - case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, - "Using the Permedia3 chipset.\n"); - break; - case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, - "Using the Gamma chipset.\n"); - break; - } - default: - xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, - "No Xv support for chipset %d.\n", pGlint->Chipset); - return; - } - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, - "Initializing Permedia3 Xv driver rev. 1\n"); - - if (pGlint->NoAccel) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Xv initialization failed : XAA is needed\n"); - return; - } - - if (!(pAPriv = NewAdaptorPriv(pScrn))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Xv initialization failed\n"); - return; - } + GLINTPortPrivPtr pPriv = pGlint->adaptor->pPortPrivates[0].ptr; + int i; - memset(&VAR, 0, sizeof(VAR)); - - Private[0].ptr = (pointer) pAPriv->pPort; - - VARPtrs = &VAR; - - VAR.type = XvInputMask | XvWindowMask | XvImageMask; - VAR.flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - VAR.name = "Permedia 3 Frontend Scaler"; - VAR.nEncodings = ENTRIES(ScalerEncodings); - VAR.pEncodings = ScalerEncodings; - VAR.nFormats = ENTRIES(ScalerVideoFormats); - VAR.pFormats = ScalerVideoFormats; - VAR.nPorts = 1; - 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.ReputImage = Permedia3ReputImage; - VAR.QueryImageAttributes = Permedia3QueryImageAttributes; - - if (xf86XVScreenInit(pScreen, &VARPtrs, 1)) { - xvFilter = MAKE_ATOM(XV_FILTER); - xvMirror = MAKE_ATOM(XV_MIRROR); - xvAlpha = MAKE_ATOM(XV_ALPHA); - -#if USE_HARDWARE_COPY - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Xv frontend scaler enabled (HW)\n"); -#else - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Xv frontend scaler enabled (SW)\n"); -#endif - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Xv initialization failed\n"); - DeleteAdaptorPriv(pAPriv); - } + if(pPriv->videoStatus & TIMER_MASK) { + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < time) { + pPriv->ramdacOn = FALSE; + GLINT_WAIT(4); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, + PM3RD_VideoOverlayControl); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = time + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < time) { + for (i = 0; i < (pPriv->doubleBuffer ? 2 : 1); i++) { + if(pPriv->area[i]) { + xf86FreeOffscreenArea(pPriv->area[i]); + pPriv->area[i] = NULL; + } + } + pPriv->videoStatus = 0; + pGlint->VideoTimerCallback = NULL; + } + } + } else /* shouldn't get here */ + pGlint->VideoTimerCallback = NULL; } -#endif /* XvExtension */ +#endif /* !XvExtension */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c index 271754097..9e30ec395 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c @@ -28,7 +28,7 @@ * * GLINT 500TX / MX accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.26.2.2 2001/05/30 10:08:19 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.28 2001/05/30 10:07:56 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" 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 0e158c379..2c69c4bfa 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.20 2001/05/04 19:05:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.23 2001/06/15 21:22:51 dawes Exp $ */ /* All drivers should typically include these */ @@ -176,11 +176,10 @@ static const char *vgahwSymbols[] = { "vgaHWFreeHWRec", "vgaHWGetHWRec", "vgaHWGetIOBase", - "vgaHWLock", + "vgaHWGetIndex", "vgaHWProtect", "vgaHWRestore", "vgaHWSave", - "vgaHWUnlock", NULL }; @@ -191,27 +190,24 @@ static const char *fbSymbols[] = { }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; static const char *ddcSymbols[] = { - "xf86PrintEDID", "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; @@ -221,12 +217,14 @@ static const char *i2cSymbols[] = { NULL }; +/* XXX The vbe module isn't currently loaded. */ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", NULL }; +/* XXX The int10 module isn't currently loaded. */ static const char *int10Symbols[] = { "xf86InitInt10", "xf86FreeInt10", @@ -523,7 +521,6 @@ I128PreInit(ScrnInfoPtr pScrn, int flags) int bytesPerPixel; ClockRangePtr clockRanges; MessageType from; - char *mod = NULL; CARD32 iobase; char *ramdac = NULL; CARD32 tmpl, tmph, tmp; @@ -858,7 +855,6 @@ I128PreInit(ScrnInfoPtr pScrn, int flags) /* see if we can find a flatpanel */ if (!pI128->FlatPanel && mon) { - int i; for (i=0; i<4; i++) if (mon->det_mon[i].type == DS_NAME) { if (strncmp((char *)mon->det_mon[i].section.name, @@ -1148,16 +1144,11 @@ I128PreInit(ScrnInfoPtr pScrn, int flags) /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { - I128FreeRec(pScrn); - return FALSE; - } - if (!xf86LoadSubModule(pScrn, "fb")) { I128FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); /* Load XAA if needed */ if (!pI128->NoAccel) { @@ -1266,6 +1257,7 @@ I128CountRam(ScrnInfoPtr pScrn) default: /* Unknown board... */ break; } + break; case PCI_CHIP_I128_T2R: switch ((pI128->PciInfo->subsysCard) & 0xFFF7) { case 0x00: /* 4MB card, no daughtercard */ @@ -1568,7 +1560,7 @@ I128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Initialize HW cursor layer. Must follow software cursor initialization*/ if (pI128->HWCursor) { - Bool ret = TRUE; + ret = TRUE; switch(pI128->RamdacType) { case TI3025_DAC: ret = I128TIHWCursorInit(pScrn); break; 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 d11e8d067..37d8b10b1 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.21 2001/05/19 00:26:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.23 2001/08/18 02:51:12 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -835,8 +835,6 @@ I810DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, oldContextType == DRI_2D_CONTEXT && newContextType == DRI_2D_CONTEXT) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("I810DRISwapContext (in)\n"); 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 5e3ae9c45..03be327e5 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.49.2.1 2001/05/23 20:21:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.52 2001/06/13 23:34:14 dawes Exp $ */ /* * Authors: @@ -136,32 +136,29 @@ static const OptionInfoRec I810Options[] = { }; static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWSave", - "vgaHWRestore", - "vgaHWProtect", + "vgaHWGetIOBase", + "vgaHWGetIndex", "vgaHWInit", + "vgaHWLock", "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", + "vgaHWSaveScreen", "vgaHWSetMmioFuncs", - "vgaHWGetIOBase", - "vgaHWLock", "vgaHWUnlock", - "vgaHWFreeHWRec", - "vgaHWSaveScreen", - "vgaHWHandleColormaps", - 0 + "vgaHWUnmapMem", + NULL }; static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; -static const char *miscSymbols[] = { - "GetTimeInMillis", - NULL -}; - static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", @@ -176,57 +173,49 @@ static const char *ddcSymbols[] = { }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAFillSolidRects" "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; #ifdef XF86DRI static const char *drmSymbols[] = { - "drmAvailable", "drmAddBufs", "drmAddMap", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", "drmAgpAcquire", - "drmAgpRelease", - "drmAgpEnable", "drmAgpAlloc", - "drmAgpFree", "drmAgpBind", - "drmI810CleanupDma", - "drmI810InitDma", + "drmAgpEnable", + "drmAgpFree", + "drmAgpRelease", + "drmCtlInstHandler", "drmFreeVersion", + "drmGetInterruptFromBusID", "drmGetVersion", + "drmI810CleanupDma", + "drmI810InitDma", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", - "DRILock", - "DRIUnlock", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", "DRIGetSAREAPrivate", - "DRIGetContext", + "DRILock", "DRIQueryVersion", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; @@ -295,16 +284,12 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) fbSymbols, xaaSymbols, ramdacSymbols, - miscSymbols, #ifdef XF86DRI drmSymbols, driSymbols, #endif vbeSymbols, ddcSymbols, - NULL /* i2csymbols */, - NULL /* shadowSymbols */, - NULL /* fbdevsymbols */, NULL); /* @@ -447,6 +432,7 @@ I810DoDDC(ScrnInfoPtr pScrn, int index) } if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL,index))) { + xf86LoaderReqSymLists(vbeSymbols, NULL); MonInfo = vbeDoEDID(pVbe, NULL); xf86PrintEDID( MonInfo ); xf86SetDDCproperties(pScrn, MonInfo); @@ -801,13 +787,14 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) { I810FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); if (!xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) { I810FreeRec(pScrn); return FALSE; } + xf86LoaderReqSymLists(xaaSymbols, NULL); } if (!xf86ReturnOptValBool(pI810->Options, OPTION_SW_CURSOR, FALSE)) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_drm.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_drm.c deleted file mode 100644 index 13f2658e1..000000000 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_drm.c +++ /dev/null @@ -1,59 +0,0 @@ -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86Resources.h" -#include "xf86_ansic.h" -#include "compiler.h" -#include "xf86PciInfo.h" -#include "xf86Pci.h" -#include "xf86Priv.h" -#include "i810.h" - -#ifndef XFree86LOADER -#include <sys/stat.h> -#include <sys/mman.h> -#endif - -#include "xf86drm.h" -#include "drm.h" -#include "i810_drm_public.h" - -Bool I810drmCleanupDma(ScrnInfoPtr pScrn) -{ - I810Ptr pI810 = I810PTR(pScrn); - drm_i810_init_t init; - - memset(&init, 0, sizeof(drm_i810_init_t)); - init.func = I810_CLEANUP_DMA; - - if(ioctl(pI810->drmSubFD, DRM_IOCTL_I810_INIT, &init)) { - ErrorF("I810 Dma Cleanup Failed\n"); - return FALSE; - } - - return TRUE; -} - -Bool I810drmInitDma(ScrnInfoPtr pScrn) -{ - I810Ptr pI810 = I810PTR(pScrn); - I810RingBuffer *ring = &(pI810->LpRing); - - drm_i810_init_t init; - - memset(&init, 0, sizeof(drm_i810_init_t)); - init.func = I810_INIT_DMA; - init.ring_map_idx = 6; - init.buffer_map_idx = 5; - init.ring_start = ring->mem.Start; - init.ring_end = ring->mem.End; - init.ring_size = ring->mem.Size; - init.sarea_priv_offset = sizeof(XF86DRISAREARec); - ErrorF("I810 Dma Initialization start\n"); - - if(ioctl(pI810->drmSubFD, DRM_IOCTL_I810_INIT, &init)) { - ErrorF("I810 Dma Initialization Failed\n"); - return FALSE; - } - ErrorF("I810 Dma Initialization done\n"); - return TRUE; -} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c index a5085ddc1..9fa50c854 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c @@ -23,7 +23,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.17 2001/04/18 14:52:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.18 2001/06/15 21:22:52 dawes Exp $ */ /* * i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich. @@ -502,7 +502,7 @@ I810ClipVideo( } static void -I810StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +I810StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { I810PortPrivPtr pPriv = (I810PortPrivPtr)data; I810Ptr pI810 = I810PTR(pScrn); @@ -511,7 +511,7 @@ I810StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - if(exit) { + if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { overlay->OV0CMD &= 0xFFFFFFFE; OVERLAY_UPDATE(pI810->OverlayPhysical); 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 23631ee12..c3146ad01 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.15 2001/05/16 06:48:09 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.17 2001/08/07 07:04:47 keithp Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -147,39 +147,33 @@ static const OptionInfoRec IMSTTOptions[] = }; static const char *fbSymbols[] = { - "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif + "fbScreenInit", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", "XAACreateInfoRec", "XAAInit", - "XAAScreenIndex", NULL }; static const char *fbdevHWSymbols[] = { - "fbdevHWInit", - "fbdevHWUseBuildinMode", - "fbdevHWGetDepth", - "fbdevHWGetVidmem", - "fbdevHWLoadPalette", - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", + "fbdevHWGetVidmem", + "fbdevHWInit", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", + "fbdevHWLoadPalette", + "fbdevHWMapVidmem", "fbdevHWModeInit", + "fbdevHWSave", + "fbdevHWSwitchMode", "fbdevHWUnmapMMIO", "fbdevHWUnmapVidmem", - "fbdevHWMapMMIO", - "fbdevHWMapVidmem", + "fbdevHWUseBuildinMode", + "fbdevHWValidMode", NULL }; @@ -551,7 +545,9 @@ static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags) xf86PrintModes(pScrn); xf86SetDpi(pScrn, 0, 0); - xf86LoadSubModule(pScrn, "fb"); + if (!xf86LoadSubModule(pScrn, "fb")) + return FALSE; + xf86LoaderReqSymLists(fbSymbols, NULL); if (!xf86LoadSubModule(pScrn, "xaa")) @@ -798,10 +794,6 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, return FALSE; } -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - if (pScrn->bitsPerPixel > 8) { visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { @@ -816,6 +808,8 @@ static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, } } + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); 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 ebb885bcc..011faa94e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c @@ -45,7 +45,7 @@ * Added digital screen option for first head */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.202.2.2 2001/05/28 14:23:38 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.207 2001/08/07 07:04:47 keithp Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -263,105 +263,92 @@ static const OptionInfoRec MGAOptions[] = { */ static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", + "vgaHWSetMmioFuncs", + "vgaHWUnlock", + "vgaHWUnmapMem", "vgaHWddc1SetSpeed", NULL }; -static const char *cfbSymbols[] = { - "cfb8_32ScreenInit", - NULL -}; - static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; static const char *xf8_32bppSymbols[] = { + "cfb8_32ScreenInit", "xf86Overlay8Plus32Init", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", - "XAACreateInfoRec", - "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", "XAACachePlanarMonoStipple", - "XAAScreenIndex", + "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAFallbackOps", "XAAFillSolidRects", + "XAAInit", "XAAMoveDWORDS", + "XAAScreenIndex", + "XAA_888_plus_PICT_a8_to_8888", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", + "xf86InitCursor", NULL }; #ifdef XF86DRI static const char *drmSymbols[] = { - "drmAvailable", "drmAddBufs", "drmAddMap", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", - "drmFreeVersion", - "drmGetVersion", - "drmMap", - "drmUnmap", - "drmMapBufs", - "drmUnmapBufs", "drmAgpAcquire", - "drmAgpRelease", - "drmAgpEnable", "drmAgpAlloc", - "drmAgpFree", "drmAgpBind", - "drmAgpUnbind", + "drmAgpDeviceId", + "drmAgpEnable", + "drmAgpFree", "drmAgpGetMode", - "drmAgpBase", - "drmAgpSize", + "drmAgpRelease", + "drmAgpUnbind", "drmAgpVendorId", - "drmAgpDeviceId", - "drmMGAInitDMA", + "drmFreeVersion", + "drmGetVersion", "drmMGACleanupDMA", - "drmMGAFlushDMA", "drmMGAEngineReset", + "drmMGAFlushDMA", + "drmMGAInitDMA", + "drmMapBufs", + "drmMap", + "drmUnmap", + "drmUnmapBufs", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIDestroyInfoRec", "DRICreateInfoRec", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", "DRILock", - "DRIUnlock", - "DRIGetSAREAPrivate", - "DRIGetContext", "DRIQueryVersion", - "DRIAdjustFrame", - "DRIOpenFullScreen", - "DRICloseFullScreen", + "DRIScreenInit", + "DRIUnlock", "GlxSetVisualConfigs", NULL }; @@ -370,11 +357,12 @@ static const char *driSymbols[] = { #define MGAuseI2C 1 static const char *ddcSymbols[] = { - "xf86PrintEDID", "xf86DoEDID_DDC1", #if MGAuseI2C "xf86DoEDID_DDC2", #endif + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; @@ -392,12 +380,13 @@ static const char *shadowSymbols[] = { static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", NULL }; static const char *int10Symbols[] = { - "xf86InitInt10", "xf86FreeInt10", + "xf86InitInt10", NULL }; @@ -405,26 +394,25 @@ static const char *fbdevHWSymbols[] = { "fbdevHWInit", "fbdevHWUseBuildinMode", - "fbdevHWGetDepth", "fbdevHWGetVidmem", /* colormap */ "fbdevHWLoadPalette", /* ScrnInfo hooks */ - "fbdevHWSwitchMode", "fbdevHWAdjustFrame", "fbdevHWEnterVT", "fbdevHWLeaveVT", - "fbdevHWValidMode", - "fbdevHWRestore", "fbdevHWModeInit", + "fbdevHWRestore", "fbdevHWSave", + "fbdevHWSwitchMode", + "fbdevHWValidMode", - "fbdevHWUnmapMMIO", - "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", + "fbdevHWUnmapMMIO", + "fbdevHWUnmapVidmem", NULL }; @@ -432,16 +420,16 @@ static const char *fbdevHWSymbols[] = { #ifdef USEMGAHAL static const char *halSymbols[] = { "MGACloseLibrary", - "MGASaveVgaState", + "MGAGetBOARDHANDLESize", + "MGAGetHardwareInfo", + "MGAOpenLibrary", "MGARestoreVgaState", - "MGASetVgaMode", + "MGASaveVgaState", "MGASetMode", + "MGASetVgaMode", "MGAValidateMode", "MGAValidateVideoParameters", - "MGAGetBOARDHANDLESize", - "MGAGetHardwareInfo", - "MGAOpenLibrary", - NULL + NULL }; #endif #ifdef XFree86LOADER @@ -484,7 +472,7 @@ mgaSetup(pointer module, pointer opts, int *errmaj, int *errmin) * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, + LoaderRefSymLists(vgahwSymbols, xaaSymbols, xf8_32bppSymbols, ramdacSymbols, ddcSymbols, i2cSymbols, shadowSymbols, fbdevHWSymbols, vbeSymbols, @@ -1192,7 +1180,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) double real; int bytesPerPixel; ClockRangePtr clockRanges; - const char *reqSym = NULL; const char *s; int flags24; MGAEntPtr pMgaEnt = NULL; @@ -1431,6 +1418,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; + xf86LoaderReqSymLists(int10Symbols, NULL); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); pInt = xf86InitInt10(pMga->pEnt->index); if (pInt) pMga->softbooted = TRUE; @@ -2302,16 +2290,14 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) MGAFreeRec(pScrn); return FALSE; } - reqSym = "cfb8_32ScreenInit"; + xf86LoaderReqSymLists(xf8_32bppSymbols, NULL); } else { if (!xf86LoadSubModule(pScrn, "fb")) { MGAFreeRec(pScrn); return FALSE; } - reqSym = "fbScreenInit"; - xf86LoaderReqSymbols("fbPictureInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); } - xf86LoaderReqSymbols(reqSym, NULL); /* Load XAA if needed */ @@ -3097,8 +3083,6 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit (pScreen, 0, 0); } if (!ret) @@ -3120,6 +3104,10 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } + /* must be after RGB ordering fixed */ + if (!pMga->Overlay8Plus24) + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); pMga->BlockHandler = pScreen->BlockHandler; 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 443099a9d..6631e384b 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.24.2.1 2001/06/01 02:24:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.25 2001/06/01 02:10:06 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" 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 3edac64d3..7137bb496 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.10 2001/05/16 06:48:09 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.12 2001/08/07 07:04:48 keithp Exp $ */ /* function prototypes, common data structures & generic includes */ #include "newport.h" @@ -101,10 +101,8 @@ static SymTabRec NewportChipsets[] = { /* List of Symbols from other modules that this module references */ static const char *fbSymbols[] = { - "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif + "fbScreenInit", NULL }; @@ -491,10 +489,6 @@ NewportScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) if(!ret) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - /* we need rgb ordering if bitsPerPixel > 8 */ if (pScrn->bitsPerPixel > 8) { for (i = 0, visual = pScreen->visuals; @@ -510,6 +504,8 @@ NewportScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) } } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c b/xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c index 3e48d0845..1988f1fac 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c @@ -3,7 +3,7 @@ * * accelerator functions for X */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.9 2001/05/16 06:48:10 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.10 2001/06/15 21:22:54 dawes Exp $ */ @@ -30,17 +30,17 @@ * defines */ -#define waitfifo(size) do { int c=0; \ - while ((c++<0xfffff)&&((verite_in8(iob+FIFOINFREE)&0x1f)<size)) /* if(!(c%0xffff))ErrorF("#1# !0x%x! -- ",verite_in8(iob+FIFOINFREE)) */; \ - if (c >= 0xfffff) { \ +#define waitfifo(size) do { int _c=0; \ + while ((_c++<0xfffff)&&((verite_in8(iob+FIFOINFREE)&0x1f)<size)) /* if(!(_c%0xffff))ErrorF("#1# !0x%x! -- ",verite_in8(iob+FIFOINFREE)) */; \ + if (_c >= 0xfffff) { \ ErrorF("RENDITION: Input fifo full (1) FIFO in == %d\n",verite_in8(iob+FIFOINFREE)&0x1f); \ return; \ } \ } while (0) -#define waitfifo2(size, rv) do { int c=0; \ - while ((c++<0xfffff)&&((verite_in8(iob+FIFOINFREE)&0x1f)<size)) /* if(!(c%0xffff))ErrorF("#2# !0x%x! -- ",verite_in8(iob+FIFOINFREE)) */; \ - if (c >= 0xfffff) { \ +#define waitfifo2(size, rv) do { int _c=0; \ + while ((_c++<0xfffff)&&((verite_in8(iob+FIFOINFREE)&0x1f)<size)) /* if(!(_c%0xffff))ErrorF("#2# !0x%x! -- ",verite_in8(iob+FIFOINFREE)) */; \ + if (_c >= 0xfffff) { \ ErrorF("RENDITION: Input fifo full (2) FIFO in ==%d\n",verite_in8(iob+FIFOINFREE)&0x1f); \ RENDITIONAccelNone(pScreenInfo); \ pRendition->board.accel=0; \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c index 2353118fa..8973dfec5 100755 --- a/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.3 2001/02/09 03:23:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.4 2001/06/15 21:22:56 dawes Exp $ */ /* Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. @@ -625,7 +625,7 @@ S3VClipVideo( static void -S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { S3VPtr ps3v = S3VPTR(pScrn); S3VPortPrivPtr pPriv = ps3v->portPrivate; @@ -646,7 +646,7 @@ S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - if(exit) { + if(shutdown) { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { #if 0 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 c97c67e27..70e45b3ec 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.10 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.11 2001/08/09 19:14:13 dawes Exp $ */ /* * @@ -1163,6 +1163,7 @@ static void SavageDisableClipping( ScrnInfoPtr pScrn ) /* Routines for debugging. */ + unsigned long writedw( unsigned long addr, unsigned long value ) { @@ -1208,11 +1209,11 @@ writescan( unsigned long scan, unsigned long color ) *videobuffer++ = color; break; case 16: - *(unsigned short*)videobuffer = color; + *(CARD16 *)videobuffer = color; videobuffer += 2; break; case 32: - *(unsigned long*)videobuffer = color; + *(CARD32 *)videobuffer = color; videobuffer += 4; break; } 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 2b2a5ef4d..70ac35563 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.19 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.22 2001/08/09 19:14:13 dawes Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -187,35 +187,44 @@ static const OptionInfoRec SavageOptions[] = static const char *vgaHWSymbols[] = { + "vgaHWBlankScreen", + "vgaHWCopyReg", "vgaHWGetHWRec", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWSave", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWLock", "vgaHWProtect", "vgaHWRestore", - "vgaHWMapMem", - "vgaHWUnmapMem", - "vgaHWInit", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWLock", + "vgaHWSetMmioFuncs", + "vgaHWSetStdFuncs", + "vgaHWUnmapMem", + "vgaHWddc1SetSpeed", #if 0 - "vgaHWUnlock", "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWUnlock", #endif NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", +#if 0 "xf86DestroyCursorInfoRec", +#endif + "xf86InitCursor", NULL }; static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", +#if 0 "vbeFree", +#endif NULL }; @@ -226,7 +235,10 @@ static const char *vbeOptSymbols[] = { }; static const char *ddcSymbols[] = { - "xf86InterpretEDID", + "xf86DoEDID_DDC1", + "xf86DoEDID_DDC2", + "xf86PrintEDID", + "xf86SetDDCproperties", NULL }; @@ -241,10 +253,12 @@ static const char *xaaSymbols[] = { "XAACopyROP_PM", "XAACreateInfoRec", "XAADestroyInfoRec", + "XAAFillSolidRects", "XAAHelpPatternROP", +#if 0 "XAAHelpSolidROP", +#endif "XAAInit", - "XAAFillSolidRects", "XAAScreenIndex", NULL }; @@ -256,16 +270,19 @@ static const char *shadowSymbols[] = { static const char *int10Symbols[] = { "xf86ExecX86int10", +#if 0 "xf86FreeInt10", +#endif "xf86InitInt10", "xf86Int10AllocPages", "xf86Int10FreePages", + "xf86int10Addr", NULL }; static const char *fbSymbols[] = { - "fbScreenInit", "fbPictureInit", + "fbScreenInit", NULL }; @@ -297,7 +314,7 @@ static pointer SavageSetup(pointer module, pointer opts, int *errmaj, setupDone = TRUE; xf86AddDriver(&SAVAGE, module, 0); LoaderRefSymLists(vgaHWSymbols, fbSymbols, ramdacSymbols, - xaaSymbols, shadowSymbols, vbeSymbols, + xaaSymbols, shadowSymbols, vbeSymbols, vbeOptSymbols, int10Symbols, i2cSymbols, ddcSymbols, NULL); return (pointer) 1; } else { @@ -856,9 +873,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) if (xf86LoadSubModule(pScrn, "vbe")) { xf86LoaderReqSymLists(vbeSymbols, NULL); -#ifdef XFree86LOADER - LoaderRefSymLists(vbeOptSymbols, NULL); -#endif psav->pVbe = VBEInit(psav->pInt10, pEnt->index); } @@ -1113,11 +1127,11 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) if ( xf86LoadSubModule(pScrn, "i2c") ) { xf86LoaderReqSymLists(i2cSymbols,NULL); if (SavageI2CInit(pScrn)) { - CARD32 tmp = (INREG(DDC_REG)); - OUTREG(DDC_REG,(tmp | 0x13)); + CARD32 temp = (INREG(DDC_REG)); + OUTREG(DDC_REG,(temp | 0x13)); xf86SetDDCproperties(pScrn,xf86PrintEDID( xf86DoEDID_DDC2(pScrn->scrnIndex,psav->I2C))); - OUTREG(DDC_REG,tmp); + OUTREG(DDC_REG,temp); } } } @@ -1287,7 +1301,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) else /*if( xf86Verbose )*/ { - int i; SavageModeEntryPtr pmt; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, @@ -1321,7 +1334,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); if( !psav->NoAccel ) { if( !xf86LoadSubModule(pScrn, "xaa") ) { @@ -2096,7 +2109,7 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, psav->ShadowPhysical = psav->FrameBufferBase + psav->CursorKByte*1024 + 4096 - 32; - psav->ShadowVirtual = (unsigned long*) + psav->ShadowVirtual = (CARD32 *) (psav->FBBase + psav->CursorKByte*1024 + 4096 - 32); xf86DrvMsg( pScrn->scrnIndex, X_PROBED, @@ -2159,6 +2172,9 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, } } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); + if( !psav->NoAccel ) { SavageInitAccel(pScreen); } @@ -2268,9 +2284,6 @@ static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen) pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - if (ret) - fbPictureInit (pScreen, 0, 0); - return ret; } @@ -2417,7 +2430,6 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) if( (pmt->Width == mode->HDisplay) && (pmt->Height == mode->VDisplay) ) { - int j; int jDelta = 99; int jBest = 0; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h index 1bb0bfc5e..f5dace294 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.10 2001/05/18 23:35:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.11 2001/08/09 19:14:13 dawes Exp $ */ #ifndef SAVAGE_VGAHWMMIO_H #define SAVAGE_VGAHWMMIO_H @@ -95,7 +95,7 @@ typedef struct _Savage { unsigned char* MapBaseDense; unsigned char* FBBase; unsigned char* FBStart; - unsigned long volatile * ShadowVirtual; + CARD32 volatile * ShadowVirtual; Bool PrimaryVidMapped; int dacSpeedBpp; 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 60e1202a1..528bbc1d1 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.12.2.1 2001/05/25 18:15:46 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.15 2001/08/07 07:04:50 keithp Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -190,41 +190,46 @@ static const OptionInfoRec SMIOptions[] = * Note that vgahwSymbols and xaaSymbols are referenced outside the * XFree86LOADER define in later code, so are defined outside of that * define here also. - * fbSymbols and ramdacSymbols are only referenced from within the - * ...LOADER define. */ static const char *vgahwSymbols[] = { + "vgaHWCopyReg", "vgaHWGetHWRec", - "vgaHWSetMmioFuncs", "vgaHWGetIOBase", - "vgaHWSave", + "vgaHWGetIndex", + "vgaHWInit", + "vgaHWLock", + "vgaHWMapMem", "vgaHWProtect", "vgaHWRestore", - "vgaHWMapMem", - "vgaHWUnmapMem", - "vgaHWInit", + "vgaHWSave", "vgaHWSaveScreen", - "vgaHWLock", + "vgaHWSetMmioFuncs", + "vgaHWSetStdFuncs", + "vgaHWUnmapMem", + "vgaHWddc1SetSpeed", NULL }; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", + "XAACopyROP", "XAACreateInfoRec", + "XAADestroyInfoRec", + "XAAFallbackOps", + "XAAFillSolidRects", "XAAInit", - "XAAOverlayFBfuncs", + "XAAPatternROP", + "XAAScreenIndex", NULL }; static const char *ramdacSymbols[] = { - "xf86InitCursor", "xf86CreateCursorInfoRec", "xf86DestroyCursorInfoRec", - "xf86CursorScreenIndex", + "xf86InitCursor", NULL }; @@ -233,17 +238,19 @@ static const char *ddcSymbols[] = "xf86PrintEDID", "xf86DoEDID_DDC1", "xf86DoEDID_DDC2", + "xf86SetDDCproperties", NULL }; static const char *i2cSymbols[] = { "xf86CreateI2CBusRec", + "xf86CreateI2CDevRec", "xf86DestroyI2CBusRec", + "xf86DestroyI2CDevRec", "xf86I2CBusInit", - "xf86CreateI2CDevRec", + "xf86I2CDevInit", "xf86I2CWriteByte", - "xf86DestroyI2CDevRec", NULL }; @@ -255,9 +262,9 @@ static const char *shadowSymbols[] = static const char *int10Symbols[] = { - "xf86InitInt10", "xf86ExecX86int10", "xf86FreeInt10", + "xf86InitInt10", NULL }; @@ -272,8 +279,8 @@ static const char *vbeSymbols[] = static const char *fbSymbols[] = { #ifdef USE_FB - "fbScreenInit", "fbPictureInit", + "fbScreenInit", #else "cfbScreenInit", "cfb16ScreenInit", @@ -2031,6 +2038,10 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } +#ifdef USE_FB + /* must be after RGB ordering fixed */ + fbPictureInit(pScreen, 0, 0); +#endif /* Initialize acceleration layer */ if (!pSmi->NoAccel) { @@ -2214,10 +2225,6 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen) return(FALSE); } -#ifdef USE_FB - if (ret) - fbPictureInit(pScreen, 0, 0); -#endif LEAVE_PROC("SMI_InternalScreenInit"); return(ret); } 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 ff6a713aa..fce6644db 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.4 2001/03/03 22:26:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.5 2001/06/15 21:22:58 dawes Exp $ */ #include "smi.h" #include "smi_video.h" @@ -49,7 +49,7 @@ static int SMI_GetVideo(ScrnInfoPtr pScrn, short vid_w, short vid_h, short drw_w, short drw_h, RegionPtr clipBoxes, pointer data); #endif -static void SMI_StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit); +static void SMI_StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown); static int SMI_SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data); static int SMI_GetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, @@ -682,7 +682,7 @@ static void SMI_StopVideo( ScrnInfoPtr pScrn, pointer data, - Bool exit + Bool shutdown ) { SMI_PortPtr ptrPort = (SMI_PortPtr) data; @@ -692,7 +692,7 @@ SMI_StopVideo( REGION_EMPTY(pScrn->pScreen, &ptrPort->clip); - if (exit) + if (shutdown) { if (ptrPort->videoStatus & CLIENT_VIDEO_ON) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c index 44c1fe20f..df71e66a2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c,v 1.8 2001/04/19 14:11:37 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c,v 1.9 2001/06/15 21:22:59 dawes Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -300,8 +300,8 @@ static void SetLockRegs(void); static void GetVBInfo(UShort BaseAddr,ULong ROMAddr); static Bool BridgeIsEnable(UShort BaseAddr); static Bool BridgeInSlave(void); -static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4); -static void PresetScratchregister(UShort P3d4); +static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4Reg); +static void PresetScratchregister(UShort P3d4Reg); static Bool GetLCDDDCInfo(ScrnInfoPtr pScrn); static void SetTVSystem(void); static void LongWait(void); @@ -3984,11 +3984,11 @@ static Bool BridgeInSlave(void) } } -static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4) +static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4Reg) { UShort tempah,tempbh,tempflag; - tempah=(UChar)GetReg1(P3d4,0x36); + tempah=(UChar)GetReg1(P3d4Reg,0x36); tempbh=tempah; tempah=tempah&0x0F; /* if(tempah!=0) tempah--; */ @@ -3997,7 +3997,7 @@ static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4) tempbh=tempbh>>4; LCDTypeInfo=tempbh; - tempah=(UChar)GetReg1(P3d4,0x37); + tempah=(UChar)GetReg1(P3d4Reg,0x37); LCDInfo=tempah; if(IF_DEF_LVDS==1){ @@ -4043,9 +4043,9 @@ static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4) return 1; } -static void PresetScratchregister(UShort P3d4) +static void PresetScratchregister(UShort P3d4Reg) { - SetReg1(P3d4,0x37,0x00); + SetReg1(P3d4Reg,0x37,0x00); } static Bool GetLCDDDCInfo(ScrnInfoPtr pScrn) 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 d85d09ea0..4af718de2 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.15.2.1 2001/05/22 21:25:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.18 2001/08/18 02:51:13 dawes Exp $ */ /* modified from tdfx_dri.c, mga_dri.c */ @@ -454,6 +454,7 @@ SISDRIFinishScreenInit(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); SISDRIPtr pSISDRI; + drmVersionPtr version; pSiS->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; /* pSiS->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */ 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 56accb362..588b8b18e 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.64.2.1 2001/05/22 21:25:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.67 2001/08/07 07:04:51 keithp Exp $ */ #include "fb.h" #include "xf1bpp.h" @@ -184,37 +184,39 @@ int sis2Reg32MMIO[]={0x8200,0x8204,0x8208,0x820C,0x8210,0x8214,0x8218,0x821C, 0x8240, 0x8300}; static const char *xaaSymbols[] = { - "XAADestroyInfoRec", - "XAACreateInfoRec", - "XAAInit", - "XAAStippleScanlineFuncLSBFirst", - "XAAOverlayFBfuncs", - "XAACachePlanarMonoStipple", - "XAAScreenIndex", "XAACopyROP", - "XAAHelpPatternROP", + "XAACreateInfoRec", + "XAADestroyInfoRec", "XAAFillSolidRects", + "XAAHelpPatternROP", + "XAAInit", NULL }; static const char *vgahwSymbols[] = { + "vgaHWFreeHWRec", "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWSave", - "vgaHWRestore", - "vgaHWProtect", "vgaHWGetIOBase", - "vgaHWMapMem", + "vgaHWGetIndex", + "vgaHWInit", "vgaHWLock", - "vgaHWFreeHWRec", + "vgaHWMapMem", + "vgaHWProtect", + "vgaHWRestore", + "vgaHWSave", "vgaHWSaveScreen", + "vgaHWUnlock", NULL }; -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", + NULL +}; + +static const char *fbSymbols[] = { + "fbPictureInit", "fbScreenInit", NULL }; @@ -224,10 +226,16 @@ static const char *shadowSymbols[] = { NULL }; +static const char *ramdacSymbols[] = { + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + "xf86InitCursor", + NULL +}; static const char *ddcSymbols[] = { "xf86PrintEDID", - "xf86DoEDID_DDC1", + "xf86SetDDCproperties", NULL }; @@ -237,43 +245,40 @@ static const char *i2cSymbols[] = { NULL }; +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; + #ifdef XF86DRI static const char *drmSymbols[] = { - "drmAddBufs", "drmAddMap", - "drmAvailable", - "drmCtlAddCommand", - "drmCtlInstHandler", - "drmGetInterruptFromBusID", - "drmMapBufs", - "drmMarkBufs", - "drmUnmapBufs", "drmAgpAcquire", - "drmAgpRelease", - "drmAgpEnable", "drmAgpAlloc", - "drmAgpFree", + "drmAgpBase", "drmAgpBind", + "drmAgpEnable", + "drmAgpFree", "drmAgpGetMode", - "drmAgpBase", - "drmAgpSize", + "drmAgpRelease", + "drmCtlInstHandler", + "drmGetInterruptFromBusID", "drmSiSAgpInit", NULL }; static const char *driSymbols[] = { - "DRIGetDrawableIndex", - "DRIFinishScreenInit", - "DRIDestroyInfoRec", "DRICloseScreen", - "DRIDestroyInfoRec", - "DRIScreenInit", - "DRIQueryVersion", "DRICreateInfoRec", + "DRIDestroyInfoRec", + "DRIFinishScreenInit", + "DRIGetSAREAPrivate", "DRILock", + "DRIQueryVersion", + "DRIScreenInit", "DRIUnlock", - "DRIGetSAREAPrivate", - "DRIGetContext", "GlxSetVisualConfigs", NULL }; @@ -309,11 +314,12 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin) setupDone = TRUE; xf86AddDriver(&SIS, module, 0); LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, xaaSymbols, - shadowSymbols, + miscfbSymbols, shadowSymbols, ramdacSymbols, + vbeSymbols, #ifdef XF86DRI - drmSymbols, driSymbols, + drmSymbols, driSymbols, #endif - NULL); + NULL); return (pointer)TRUE; } @@ -645,6 +651,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; + xf86LoaderReqSymLists(ramdacSymbols, NULL); + /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -1002,8 +1010,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) case 24: case 32: mod = "fb"; - Sym = "fbScreenInit"; - break; + break; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { @@ -1011,7 +1018,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - xf86LoaderReqSymbols(Sym, NULL); + if (mod) { + if (Sym) { + xf86LoaderReqSymbols(Sym, NULL); + } else { + xf86LoaderReqSymLists(fbSymbols, NULL); + } + } if (!xf86LoadSubModule(pScrn, "i2c")) { SISFreeRec(pScrn); @@ -1051,6 +1064,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) { Bool ret; if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); if ((pVbe = VBEInit(NULL,pSiS->pEnt->index))) { ret = xf86SetDDCproperties(pScrn, xf86PrintEDID(vbeDoEDID(pVbe,NULL))); @@ -1264,6 +1278,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) vgaHWPtr hwp; SISPtr pSiS; int ret; + int init_picture = 0; VisualPtr visual; unsigned long OnScreenSize; int height, width, displayWidth; @@ -1398,7 +1413,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); - fbPictureInit(pScreen, 0, 0); + init_picture = 1; break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1431,6 +1446,9 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) SIS1bppColorMap(pScrn); } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit(pScreen, 0, 0); if (!pSiS->ShadowFB) /* hardware cursor needs to wrap this layer */ SISDGAInit(pScreen); xf86SetBlackWhitePixels(pScreen); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c index 565e3973f..5989ae07d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_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/suncg14/cg14_driver.c,v 1.4 2001/05/16 06:48:10 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c,v 1.5 2001/08/07 07:04:51 keithp Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -479,10 +479,6 @@ CG14ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!ret) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); @@ -504,6 +500,11 @@ CG14ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } +#ifdef RENDER + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); +#endif + /* Initialise cursor functions */ miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c index b2dc24dcf..83a19470e 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_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/suntcx/tcx_driver.c,v 1.5 2001/05/16 06:48:11 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c,v 1.6 2001/08/07 07:04:51 keithp Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -551,14 +551,6 @@ TCXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!ret) return FALSE; -#ifdef RENDER - fbPictureInit (pScreen, 0, 0); -#endif - - miInitializeBackingStore(pScreen); - xf86SetBackingStore(pScreen); - xf86SetSilkenMouse(pScreen); - xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -576,6 +568,15 @@ TCXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } +#ifdef RENDER + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); +#endif + + miInitializeBackingStore(pScreen); + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + /* Initialise cursor functions */ miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h index 1eb6d6fae..bfd519f46 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.24 2001/05/21 21:43:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.25 2001/08/18 02:51:13 dawes Exp $ */ #ifndef _TDFX_H_ #define _TDFX_H_ 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 3480dc937..62c611315 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -27,7 +27,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.83 2001/06/26 08:41:58 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.85 2001/08/18 02:51:13 dawes Exp $ */ /* * Authors: @@ -366,7 +366,7 @@ TDFXIdentify(int flags) { static const OptionInfoRec * TDFXAvailableOptions(int chipid, int busid) { - return (OptionInfoPtr)TDFXOptions; + return TDFXOptions; } static void @@ -2151,7 +2151,6 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; - fbPictureInit (pScreen, 0, 0); break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -2174,6 +2173,9 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { } } + /* must be after RGB ordering fixed */ + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); TDFXDGAInit(pScreen); 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 86823ed80..bcb57f2c9 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.12 2001/06/05 12:52:42 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.15 2001/08/01 00:44:54 tsi Exp $ */ #include "xf86.h" #include "tdfx.h" @@ -32,6 +32,9 @@ static Atom xvColorKey, xvFilterQuality; #define TDFX_MAX_OVERLAY_PORTS 1 #define TDFX_MAX_TEXTURE_PORTS 32 +#define GET_PORT_PRIVATE(pScrn) \ + (TDFXPortPrivPtr)((TDFXPTR(pScrn))->overlayAdaptor->pPortPrivates[0].ptr) + /* Doesn't matter what screen we use */ #define DummyScreen screenInfo.screens[0] @@ -62,6 +65,8 @@ static void TDFXResetVideoOverlay(ScrnInfoPtr); static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); +static void TDFXInitOffscreenImages(ScreenPtr); + /* * ADAPTOR INFORMATION */ @@ -127,13 +132,13 @@ void TDFXInitVideo(ScreenPtr pScreen) if(pTDFX->cpp == 1) return; - /* Start with the generic adaptors */ - num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); - if(!pTDFX->AccelInfoRec || !pTDFX->AccelInfoRec->FillSolidRects) return; if (!pTDFX->TextureXvideo) { + /* Offscreen support for Overlay only */ + TDFXInitOffscreenImages(pScreen); + /* Overlay adaptor */ newAdaptor = TDFXSetupImageVideoOverlay(pScreen); } else { @@ -141,15 +146,23 @@ void TDFXInitVideo(ScreenPtr pScreen) newAdaptor = TDFXSetupImageVideoTexture(pScreen); } - /* Add the adaptor to the list */ + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + if(newAdaptor) { - newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) { - if (num_adaptors) memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } + if (!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } } if(num_adaptors) @@ -1124,3 +1137,207 @@ TDFXAllocateMemoryLinear (ScrnInfoPtr pScrn, FBLinearPtr linear, int size) return new_linear; } +/****************** Offscreen stuff ***************/ + +typedef struct { + FBLinearPtr linear; + Bool isOn; +} OffscreenPrivRec, * OffscreenPrivPtr; + +static int +TDFXAllocateSurface( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +){ + TDFXPtr pTDFX = TDFXPTR(pScrn); + FBLinearPtr linear; + int pitch, fbpitch, size, bpp; + OffscreenPrivPtr pPriv; + + if((w > 2048) || (h > 2048)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + bpp = pScrn->bitsPerPixel >> 3; + fbpitch = bpp * pScrn->displayWidth; + size = ((pitch * h) + bpp - 1) / bpp; + + if(!(linear = TDFXAllocateMemoryLinear(pScrn, NULL, size))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if(!(surface->pitches = xalloc(sizeof(int)))) { + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if(!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + xf86FreeOffscreenLinear(linear); + return BadAlloc; + } + + pPriv->linear = linear; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = pTDFX->fbOffset + (linear->offset * bpp); + surface->devPrivate.ptr = (pointer)pPriv; + + return Success; +} + +static int +TDFXStopSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) { + TDFXPtr pTDFX = TDFXPTR(surface->pScrn); + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + pPriv->isOn = FALSE; + } + + return Success; +} + + +static int +TDFXFreeSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) + TDFXStopSurface(surface); + xf86FreeOffscreenLinear(pPriv->linear); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +TDFXGetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +){ + return TDFXGetPortAttributeOverlay(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} + +static int +TDFXSetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +){ + return TDFXSetPortAttributeOverlay(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} + +static int +TDFXDisplaySurface( + 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 +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + ScrnInfoPtr pScrn = surface->pScrn; + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr portPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + 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; + + if(!TDFXClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) + { + return Success; + } + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + +#if 0 + TDFXResetVideoOverlay(pScrn); +#endif + + TDFXDisplayVideoOverlay(pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], + x1, y1, x2, &dstBox, src_w, src_h, drw_w, drw_h); + + (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, portPriv->colorKey, + GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + + pPriv->isOn = TRUE; + /* we've prempted the XvImage stream so set its free timer */ + if(portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + pTDFX->VideoTimerCallback = TDFXVideoTimerCallback; + } + + return Success; +} + +static void +TDFXInitOffscreenImages(ScreenPtr pScreen) +{ + XF86OffscreenImagePtr offscreenImages; + + /* need to free this someplace */ + if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; + + offscreenImages[0].image = &OverlayImages[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | + VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = TDFXAllocateSurface; + offscreenImages[0].free_surface = TDFXFreeSurface; + offscreenImages[0].display = TDFXDisplaySurface; + offscreenImages[0].stop = TDFXStopSurface; + offscreenImages[0].setAttribute = TDFXSetSurfaceAttribute; + offscreenImages[0].getAttribute = TDFXGetSurfaceAttribute; + offscreenImages[0].max_width = 2048; + offscreenImages[0].max_height = 2048; + offscreenImages[0].num_attributes = 2; + offscreenImages[0].attributes = OverlayAttributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} 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 ccbe7bbd5..efa4eab96 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.12 2001/03/19 11:00:54 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.14 2001/08/01 00:44:54 tsi Exp $ */ /* * Copyright 1996,1997 by Alan Hourihane, Wigan, England. @@ -152,7 +152,7 @@ DEC21030AccelInit(ScreenPtr pScreen) BIT_ORDER_IN_BYTE_LSBFIRST; TGA_AccelInfoRec->NumScanlineColorExpandBuffers = 1; - pTga->buffers[0] = (CARD32 *)malloc(CE_BUFSIZE); + pTga->buffers[0] = (CARD32 *)xnfalloc(CE_BUFSIZE); TGA_AccelInfoRec->ScanlineColorExpandBuffers = (unsigned char **)pTga->buffers; TGA_AccelInfoRec->SetupForScanlineCPUToScreenColorExpandFill = @@ -595,7 +595,7 @@ TGASubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, */ int i = 0; - void (*copy_func)(); + void (*copy_func)(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w); #ifdef PROFILE unsigned int stop, start; #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c index 26d0f11d0..75b24d3a7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c,v 1.2 2000/11/16 19:45:01 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_shadow.c,v 1.3 2001/06/14 02:23:50 keithp Exp $ */ /* Copyright (c) 1999, 2000 The XFree86 Project Inc. @@ -43,8 +43,9 @@ TRIDENTRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) } void -TRIDENTShadowUpdate (ScreenPtr pScreen, PixmapPtr pShadow, RegionPtr damage) +TRIDENTShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf) { + RegionPtr damage = &pBuf->damage; ScrnInfoPtr pScrn; pScrn = xf86Screens[pScreen->myNum]; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c index 358589096..bc74043d6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c @@ -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.16.2.2 2001/05/28 21:36:43 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.23 2001/08/07 07:04:53 keithp Exp $ */ #include "vesa.h" @@ -42,6 +42,10 @@ #include "micmap.h" #include "xf86cmap.h" +/* DPMS */ +#define DPMS_SERVER +#include "extensions/dpms.h" + /* Mandatory functions */ static const OptionInfoRec * VESAAvailableOptions(int chipid, int busid); static void VESAIdentify(int flags); @@ -77,11 +81,11 @@ static Bool VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); static void *VESAWindowPlanar(ScreenPtr pScrn, CARD32 row, CARD32 offset, - int mode, CARD32 *size); + int mode, CARD32 *size, void *closure); static void *VESAWindowLinear(ScreenPtr pScrn, CARD32 row, CARD32 offset, - int mode, CARD32 *size); + int mode, CARD32 *size, void *closure); static void *VESAWindowWindowed(ScreenPtr pScrn, CARD32 row, CARD32 offset, - int mode, CARD32 *size); + int mode, CARD32 *size, void *closure); static Bool VESADGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen); @@ -141,18 +145,21 @@ static const OptionInfoRec VESAOptions[] = { * xf86LoaderReqSymLists(). The purpose is this is to avoid warnings about * unresolved symbols that are not required. */ -static const char *fbSymbols[] = { +static const char *miscfbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", "afbScreenInit", - "fbScreenInit", - "fbPictureInit", - "cfbScreenInit", "mfbScreenInit", "cfb24_32ScreenInit", NULL }; +static const char *fbSymbols[] = { + "fbPictureInit", + "fbScreenInit", + NULL +}; + static const char *shadowSymbols[] = { "shadowAlloc", "shadowInit", @@ -163,7 +170,18 @@ static const char *shadowSymbols[] = { }; static const char *vbeSymbols[] = { + "VBEBankSwitch", + "VBEFreeModeInfo", + "VBEGetModeInfo", + "VBEGetVBEInfo", + "VBEGetVBEMode", "VBEInit", + "VBESaveRestore", + "VBESetDisplayStart", + "VBESetGetDACPaletteFormat", + "VBESetGetLogicalScanlineLength", + "VBESetGetPaletteData", + "VBESetVBEMode", "vbeDoEDID", NULL }; @@ -171,7 +189,15 @@ static const char *vbeSymbols[] = { static const char *ddcSymbols[] = { "xf86PrintEDID", "xf86SetDDCproperties", - NULL}; + NULL +}; + +#if 0 +static const char *vgahwSymbols[] = { + "vgaHWDPMSSet", + NULL +}; +#endif #ifdef XFree86LOADER @@ -207,7 +233,8 @@ vesaSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) { Initialised = TRUE; xf86AddDriver(&VESA, Module, 0); - LoaderRefSymLists(fbSymbols, + LoaderRefSymLists(miscfbSymbols, + fbSymbols, shadowSymbols, vbeSymbols, ddcSymbols, @@ -365,8 +392,8 @@ static void VESAFreeRec(ScrnInfoPtr pScrn) { VESAPtr pVesa = VESAGetRec(pScrn); - DisplayModePtr mode = pScrn->modes; #if 0 + DisplayModePtr mode = pScrn->modes; /* I am not sure if the modes will ever get freed. * Anyway, the data unknown to other modules is being freed here. */ @@ -422,13 +449,20 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) pVesa->device = xf86GetDevFromEntity(pScrn->entityList[0], pScrn->entityInstanceList[0]); +#if 0 /* Load vgahw module */ if (!xf86LoadSubModule(pScrn, "vgahw")) return (FALSE); - + + xf86LoaderReqSymLists(vgahwSymbols, NULL); +#endif + /* Load vbe module */ if ((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL) return (FALSE); + + xf86LoaderReqSymLists(vbeSymbols, NULL); + if ((pVesa->pVbe = VBEInit(NULL, pVesa->pEnt->index)) == NULL) return (FALSE); @@ -784,7 +818,6 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) case 0x3: /* Planar */ if (pVesa->shadowFB) { mod = "fb"; - reqSym = "fbScreenInit"; pScrn->bitmapBitOrder = BITMAP_BIT_ORDER; xf86LoaderReqSymbols("fbPictureInit", NULL); @@ -809,9 +842,7 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) case 0x4: /* Packed pixel */ case 0x6: /* Direct Color */ mod = "fb"; - reqSym = "fbScreenInit"; pScrn->bitmapBitOrder = BITMAP_BIT_ORDER; - xf86LoaderReqSymbols("fbPictureInit", NULL); switch (pScrn->bitsPerPixel) { case 8: @@ -847,7 +878,14 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) VESAFreeRec(pScrn); return (FALSE); } - xf86LoaderReqSymbols(reqSym, NULL); + + if (mod) { + if (reqSym) { + xf86LoaderReqSymbols(reqSym, NULL); + } else { + xf86LoaderReqSymLists(fbSymbols, NULL); + } + } return (TRUE); } @@ -860,6 +898,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) VisualPtr visual; VbeModeInfoBlock *mode; int flags; + int init_picture = 0; if (pVesa->mapPhys == 0) { mode = ((ModeInfoData*)(pScrn->currentMode->Private))->data; @@ -942,7 +981,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return (FALSE); - fbPictureInit(pScreen, 0, 0); + init_picture = 1; } } else { switch (pScrn->bitsPerPixel) { @@ -991,7 +1030,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return (FALSE); - fbPictureInit(pScreen, 0, 0); + init_picture = 1; break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1017,6 +1056,10 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } + /* must be after RGB ordering fixed */ + if (init_picture) + fbPictureInit(pScreen, 0, 0); + if (pVesa->shadowFB) { ShadowUpdateProc update; ShadowWindowProc window; @@ -1124,6 +1167,7 @@ VESACloseScreen(int scrnIndex, ScreenPtr pScreen) if (pVesa->pDGAMode) { xfree(pVesa->pDGAMode); pVesa->pDGAMode = NULL; + pVesa->nDGAMode = 0; } pScrn->vtSema = FALSE; @@ -1210,8 +1254,14 @@ VESAMapVidMem(ScrnInfoPtr pScrn) pScrn->memPhysBase = pVesa->mapPhys; pScrn->fbOffset = pVesa->mapOff; - pVesa->base = xf86MapVidMem(pScrn->scrnIndex, 0, - pScrn->memPhysBase, pVesa->mapSize); + if (pVesa->mapPhys != 0xa0000 && pVesa->pEnt->location.type == BUS_PCI) + pVesa->base = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, + pVesa->pciTag, pScrn->memPhysBase, + pVesa->mapSize); + else + pVesa->base = xf86MapVidMem(pScrn->scrnIndex, 0, + pScrn->memPhysBase, pVesa->mapSize); + if (pVesa->base) { if (pVesa->mapPhys != 0xa0000) pVesa->VGAbase = xf86MapVidMem(pScrn->scrnIndex, 0, @@ -1242,7 +1292,7 @@ VESAUnmapVidMem(ScrnInfoPtr pScrn) void * VESAWindowPlanar(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); @@ -1264,7 +1314,7 @@ VESAWindowPlanar(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, static void * VESAWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); @@ -1275,7 +1325,7 @@ VESAWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, static void * VESAWindowWindowed(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, - CARD32 *size) + CARD32 *size, void *closure) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); @@ -1397,6 +1447,16 @@ ReadGr(int index) return (inb(VGA_GRAPH_DATA)); } +#define WriteCrtc(index, value) outb(VGA_CRTC_INDEX_OFFSET, index);\ + outb(VGA_CRTC_DATA_OFFSET, value) + +static int +ReadCrtc(int index) +{ + outb(VGA_CRTC_INDEX_OFFSET, index); + return inb(VGA_CRTC_DATA_OFFSET); +} + static void SeqReset(Bool start) { @@ -1652,7 +1712,45 @@ static void VESADisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode, int flags) { +#if 0 + /* XXX How can this work without the vgahw module being initialized? */ vgaHWDPMSSet(pScrn, mode, flags); +#else + unsigned char seq1 = 0, crtc17 = 0; + + if (!pScrn->vtSema) + return; + + switch (mode) { + case DPMSModeOn: + /* Screen: On; HSync: On, VSync: On */ + seq1 = 0x00; + crtc17 = 0x80; + break; + case DPMSModeStandby: + /* Screen: Off; HSync: Off, VSync: On -- Not Supported */ + seq1 = 0x20; + crtc17 = 0x80; + break; + case DPMSModeSuspend: + /* Screen: Off; HSync: On, VSync: Off -- Not Supported */ + seq1 = 0x20; + crtc17 = 0x80; + break; + case DPMSModeOff: + /* Screen: Off; HSync: Off, VSync: Off */ + seq1 = 0x20; + crtc17 = 0x00; + break; + } + WriteSeq(0x00, 0x01); /* Synchronous Reset */ + seq1 |= ReadSeq(0x01) & ~0x20; + WriteSeq(0x01, seq1); + crtc17 |= ReadCrtc(0x17) & ~0x80; + usleep(10000); + WriteCrtc(0x17, crtc17); + WriteSeq(0x00, 0x03); /* End Reset */ +#endif } diff --git a/xc/programs/Xserver/hw/xfree86/etc/Imakefile b/xc/programs/Xserver/hw/xfree86/etc/Imakefile index f719acd6d..8d7084136 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.38.2.1 2001/05/29 14:41:54 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.40 2001/06/24 20:19:11 herrb Exp $ #include <Server.tmpl> #if SystemV @@ -88,7 +88,7 @@ SYS_LIBRARIES = -li386 AllTarget(ProgramTargetName(scanpci)) -NormalProgramTarget(scanpci,scanpci.o,NullParameter,-L../os-support -lxf86_os -L../scanpci -lscanpci -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) +NormalProgramTarget(scanpci,scanpci.o,$(XF86OSSRC)/libxf86_os.a,-L../os-support -lxf86_os -L../scanpci -lscanpci -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) InstallProgram(scanpci,$(BINDIR)) InstallManPage(scanpci,$(MANDIR)) #endif @@ -105,7 +105,7 @@ InstallProgram(joycal,$(BINDIR)) SRCS4 = pcitweak.c AllTarget(ProgramTargetName(pcitweak)) -NormalProgramTarget(pcitweak,pcitweak.o,NullParameter,-L../os-support -lxf86_os -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) +NormalProgramTarget(pcitweak,pcitweak.o,$(XF86OSSRC)/libxf86_os.a,-L../os-support -lxf86_os -L../dummylib -ldummy $(SERVEREXTRASYSLIBS),NullParameter) InstallProgram(pcitweak,$(BINDIR)) InstallManPage(pcitweak,$(MANDIR)) diff --git a/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh b/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh index a8ff3fffb..80fc88ea2 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh +++ b/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.20.2.4 2001/06/01 17:16:57 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.28 2001/07/02 09:37:18 alanh Exp $ # # Copyright © 2000 by Precision Insight, Inc. # Copyright © 2000, 2001 by VA Linux Systems, Inc. @@ -79,6 +79,10 @@ BASEDIST=" \ Xfenc.tgz \ " +UPDDIST=" \ + Xupd.tgz \ + " + UPDATEDIST=" \ Xupdate.tgz \ Xdrivers.tgz \ @@ -229,6 +233,8 @@ Description() echo "a.out compatibility libraries";; Xquartz*) echo "Mac OS X Quartz compatible X server";; + Xupd.tgz) + echo "Post-release updates";; *) echo "unknown";; esac @@ -394,6 +400,16 @@ DoOsChecks() FindDistName() { case "$OsName" in + CYGWIN*) + case "$OsArch" in + i*86) + DistName="Cygwin-ix86" + ;; + *) + Message="Cygwin binaries are only available for ix86 platforms" + ;; + esac + ;; Darwin) case "$OsArch" in Power*) @@ -509,6 +525,19 @@ FindDistName() ;; esac ;; + ppc) + case "$OsLibcMajor.$OsLibcMinor" in + 6.1) + DistName="Linux-ppc-glibc21" + ;; + 6.*) + Message="No Linux/ppc binaries for glibc 2.$OsLibcMinor. Try Linux-ppc-glibc21" + ;; + *) + Message="No Linux/ppc binaries for this libc version" + ;; + esac + ;; alpha) case "$OsLibcMajor.$OsLibcMinor" in 6.1) @@ -547,7 +576,7 @@ FindDistName() 1.[4-9]*) # Check this case "$OsObjFormat" in a.out) - DistName="NetBSD-1.4.1" + DistName="NetBSD-1.4.x" ;; *) DistName="NetBSD-1.5" @@ -568,8 +597,8 @@ FindDistName() case "$OsArch" in i386) case "$OsVersion" in - 2.[89]*) # Check this - DistName="OpenBSD-2.8" + 2.9*) # Check this + DistName="OpenBSD-2.9" ;; *) Message="No OpenBSD/i386 binaries available for this version" @@ -838,6 +867,9 @@ GetOsInfo # Make OS-specific adjustments case "$OsName" in +CYGWIN*) + SERVDIST="Xxserv.tgz" + ;; Darwin) SERVDIST="Xxserv.tgz" EXTRAOPTDIST="Xquartz.tgz" @@ -923,8 +955,16 @@ if [ X"$ExtractOK" != XYES ]; then fi # Link extract to gnu-tar so it can also be used as a regular tar -rm -f gnu-tar -ln extract gnu-tar +case "$OsName" in +CYGWIN*) + rm -f gnu-tar + ln -s extract.exe gnu-tar + ;; +*) + rm -f gnu-tar + ln extract gnu-tar + ;; +esac EXTRACT=$WDIR/extract TAR=$WDIR/gnu-tar @@ -1212,6 +1252,22 @@ if [ X"$XKBDIR" != X -a X"$XKBDIR" != X"$RUNDIR/lib/X11/xkb/compiled" -a \ ln -s $XKBDBDIR $RUNDIR/lib/X11/xkb/compiled fi +echo "Checking for post-release updates ..." +for i in $UPDDIST; do + if [ -f $i ]; then + Echo "Do you want to install update $i (`Description $i`)? (y/n) [y] " + read response + case "$response" in + [nN]*) + : skip this one + ;; + *) + (cd $RUNDIR; $EXTRACT $WDIR/$i) + ;; + esac + fi +done + echo "Checking for optional components to install ..." for i in $OPTDIST $EXTRAOPTDIST; do if [ -f $i ]; then diff --git a/xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c b/xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c deleted file mode 100644 index b96a28a8d..000000000 --- a/xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c +++ /dev/null @@ -1,1037 +0,0 @@ -/* - * Copyright 1996 by Steven Lang <tiger@tyger.org> - * Modified for the AceCad Tablet, - * by Shane Watts <shane@bofh.asn.au> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Steven Lang not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. Steven Lang makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * STEVEN LANG DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL STEVEN LANG BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTIONS, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/acecad/xf86AceCad.c,v 1.3 1999/06/13 05:18:54 dawes Exp $ */ - -#define NEED_EVENTS -#include "X.h" -#include "Xproto.h" -#include "misc.h" -#include "inputstr.h" -#include "scrnintstr.h" -#include "XI.h" -#include "XIproto.h" - -#if defined(sun) && !defined(i386) -#define POSIX_TTY -#include <errno.h> -#include <termio.h> -#include <fcntl.h> -#include <ctype.h> - -#include "extio.h" -#else -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSproc.h" -#ifdef XFree86LOADER -#include "xf86_ansic.h" -#endif -#include "xf86Config.h" -#include "xf86Xinput.h" -#include "atKeynames.h" -#include "xf86Version.h" -#endif - -#if !defined(sun) || defined(i386) -#include "osdep.h" -#include "exevents.h" - -#include "extnsionst.h" -#include "extinit.h" -#endif - -/* -** Debugging macros -*/ -#ifdef DBG -#undef DBG -#endif -#ifdef DEBUG -#undef DEBUG -#endif - -static int debug_level = 0; -#define DEBUG 1 -#if DEBUG -#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} -#else -#define DBG(lvl, f) -#endif - -/* -** Device records -*/ -#define ABSOLUTE_FLAG 1 -#define STYLUS_FLAG 2 - -typedef struct -{ - char *acecadDevice; /* device file name */ - int acecadInc; /* increment between transmits */ - int acecadButTrans; /* button translation flags */ - int acecadOldX; /* previous X position */ - int acecadOldY; /* previous Y position */ - int acecadOldProximity; /* previous proximity */ - int acecadOldButtons; /* previous buttons state */ - int acecadMaxX; /* max X value */ - int acecadMaxY; /* max Y value */ - int acecadXLeft; /* screen left */ - int acecadXRight; /* screen right */ - int acecadYtop; /* screen top */ - int acecadYbot; /* screen bottom */ - int acecadRes; /* resolution in lines per inch */ - int flags; /* various flags */ - int acecadIndex; /* number of bytes read */ - unsigned char acecadData[5]; /* data read on the device */ -} AceCadDeviceRec, *AceCadDevicePtr; - -/* -** Configuration data -*/ -#define ACECAD_SECTION_NAME "AceCad" -#define PORT 1 -#define DEVICENAME 2 -#define THE_MODE 3 -#define CURSOR 4 -#define INCREMENT 5 -#define BORDER 6 -#define DEBUG_LEVEL 7 -#define HISTORY_SIZE 8 -#define ALWAYS_CORE 9 - -#if !defined(sun) || defined(i386) -static SymTabRec AceCadTab[] = { - {ENDSUBSECTION, "endsubsection"}, - {PORT, "port"}, - {DEVICENAME, "devicename"}, - {THE_MODE, "mode"}, - {CURSOR, "cursor"}, - {INCREMENT, "increment"}, - {BORDER, "border"}, - {DEBUG_LEVEL, "debuglevel"}, - {HISTORY_SIZE, "historysize"}, - { ALWAYS_CORE, "alwayscore" }, - {-1, ""} -}; - -#define RELATIVE 1 -#define ABSOLUTE 2 - -static SymTabRec AceCadModeTabRec[] = { - {RELATIVE, "relative"}, - {ABSOLUTE, "absolute"}, - {-1, ""} -}; - -#define PUCK 1 -#define STYLUS 2 - -static SymTabRec AceCadPointTabRec[] = { - {PUCK, "puck"}, - {STYLUS, "stylus"}, - {-1, ""} -}; - -#endif - -/* -** Contants and macro -*/ -#define BUFFER_SIZE 256 /* size of reception buffer */ -#define XI_NAME "ACECAD" /* X device name for the stylus */ - -#define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) - -#define ACECAD_CONFIG "a" /* Send configuration (max coords) */ - -#define ACECAD_ABSOLUTE 'F' /* Absolute mode */ -#define ACECAD_RELATIVE 'E' /* Relative mode */ - -#define ACECAD_UPPER_ORIGIN "b" /* Origin upper left */ - -#define ACECAD_PROMPT_MODE "B" /* Prompt mode */ -#define ACECAD_STREAM_MODE "@" /* Stream mode */ -#define ACECAD_INCREMENT 'I' /* Set increment */ -#define ACECAD_BINARY_FMT "zb" /* Binary reporting */ - -#define ACECAD_PROMPT "P" /* Prompt for current position */ - -static const char * acecad_initstr = ACECAD_BINARY_FMT ACECAD_STREAM_MODE; - -#define PHASING_BIT 0x80 -#define PROXIMITY_BIT 0x40 -#define TABID_BIT 0x20 -#define XSIGN_BIT 0x10 -#define YSIGN_BIT 0x08 -#define BUTTON_BITS 0x07 -#define COORD_BITS 0x7f - -/* -** External declarations -*/ -#if defined(sun) && !defined(i386) -#define ENQUEUE suneqEnqueue -#else -#define ENQUEUE xf86eqEnqueue - -extern void xf86eqEnqueue( -#if NeedFunctionPrototypes - xEventPtr /*e*/ -#endif -); -#endif - -extern void miPointerDeltaCursor( -#if NeedFunctionPrototypes - int /*dx*/, - int /*dy*/, - unsigned long /*time*/ -#endif -); - -#if !defined(sun) || defined(i386) -/* -** xf86AceCadConfig -** Reads the AceCad section from the XF86Config file -*/ -static Bool -xf86AceCadConfig(LocalDevicePtr *array, int inx, int max, LexPtr val) -{ - LocalDevicePtr dev = array[inx]; - AceCadDevicePtr priv = (AceCadDevicePtr)(dev->private); - int token; - int mtoken; - - DBG(1, ErrorF("xf86AceCadConfig\n")); - - while ((token = xf86GetToken(AceCadTab)) != ENDSUBSECTION) { - switch(token) { - case DEVICENAME: - if (xf86GetToken(NULL) != STRING) - xf86ConfigError("Option string expected"); - else { - dev->name = strdup(val->str); - if (xf86Verbose) - ErrorF("%s AceCad X device name is %s\n", XCONFIG_GIVEN, - dev->name); - } - break; - - case PORT: - if (xf86GetToken(NULL) != STRING) - xf86ConfigError("Option string expected"); - else { - priv->acecadDevice = strdup(val->str); - if (xf86Verbose) - ErrorF("%s AceCad port is %s\n", XCONFIG_GIVEN, - priv->acecadDevice); - } - break; - - case THE_MODE: - mtoken = xf86GetToken(AceCadModeTabRec); - if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) - xf86ConfigError("Mode type token expected"); - else { - switch (mtoken) { - case ABSOLUTE: - priv->flags |= ABSOLUTE_FLAG; - break; - case RELATIVE: - priv->flags &= ~ABSOLUTE_FLAG; - break; - default: - xf86ConfigError("Illegal Mode type"); - break; - } - } - break; - - case CURSOR: - mtoken = xf86GetToken(AceCadPointTabRec); - if ((mtoken == EOF) || (mtoken == STRING) || (mtoken == NUMBER)) - xf86ConfigError("Cursor token expected"); - else { - switch (mtoken) { - case STYLUS: - priv->flags |= STYLUS_FLAG; - break; - case PUCK: - priv->flags &= ~STYLUS_FLAG; - break; - default: - xf86ConfigError("Illegal cursor type"); - break; - } - } - break; - - case INCREMENT: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - priv->acecadInc = val->num; - if (xf86Verbose) - ErrorF("%s AceCad increment value is %d\n", XCONFIG_GIVEN, - priv->acecadInc); - break; - - case DEBUG_LEVEL: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - debug_level = val->num; - if (xf86Verbose) { -#if DEBUG - ErrorF("%s AceCad debug level sets to %d\n", XCONFIG_GIVEN, - debug_level); -#else - ErrorF("%s AceCad debug level not sets to %d because" - " debugging is not compiled\n", XCONFIG_GIVEN, - debug_level); -#endif - } - break; - - case HISTORY_SIZE: - if (xf86GetToken(NULL) != NUMBER) - xf86ConfigError("Option number expected"); - dev->history_size = val->num; - if (xf86Verbose) - ErrorF("%s AceCad Motion history size is %d\n", XCONFIG_GIVEN, - dev->history_size); - break; - - case ALWAYS_CORE: - xf86AlwaysCore(dev, TRUE); - if (xf86Verbose) - ErrorF("%s AceCad device always stays core pointer\n", - XCONFIG_GIVEN); - break; - - case EOF: - FatalError("Unexpected EOF (missing EndSubSection)"); - break; - - default: - xf86ConfigError("AceCad subsection keyword expected"); - break; - } - } - - DBG(1, ErrorF("xf86AceCadConfig name=%s\n", priv->acecadDevice)); - - return Success; -} -#endif - -/* -** xf86AceCadReadInput -** Reads from the AceCad and posts any new events to the server. -*/ -static void -xf86AceCadReadInput(LocalDevicePtr local) -{ - AceCadDevicePtr priv = (AceCadDevicePtr) local->private; - int len, loop; - int is_core_pointer, is_absolute; - int x, y, buttons, prox; - DeviceIntPtr device; - unsigned char buffer[BUFFER_SIZE]; - - DBG(7, ErrorF("xf86AceCadReadInput BEGIN device=%s fd=%d\n", - priv->acecadDevice, local->fd)); - - SYSCALL(len = read(local->fd, buffer, sizeof(buffer))); - - if (len <= 0) { - Error("error reading AceCad device"); - return; - } - - for(loop=0; loop<len; loop++) { - -/* Format of 5 bytes data packet for AceCad Tablets - Byte 1 - bit 7 Phasing bit always 1 - bit 6 Proximity bit - bit 5 Tablet ID - bit 4 X sign (Always 1 for absolute) - bit 3 Y sign (Always 1 for absolute) - bit 2-0 Button status - - Byte 2 - bit 7 Always 0 - bits 6-0 = X6 - X0 - - Byte 3 (Absolute mode only) - bit 7 Always 0 - bits 6-0 = X13 - X7 - - Byte 4 - bit 7 Always 0 - bits 6-0 = Y6 - Y0 - - Byte 5 (Absolute mode only) - bit 7 Always 0 - bits 6-0 = Y13 - Y7 -*/ - - if ((priv->acecadIndex == 0) && !(buffer[loop] & PHASING_BIT)) { /* magic bit is not OK */ - DBG(6, ErrorF("xf86AceCadReadInput bad magic number 0x%x\n", buffer[loop]));; - continue; - } - - priv->acecadData[priv->acecadIndex++] = buffer[loop]; - - if (priv->acecadIndex == (priv->flags & ABSOLUTE_FLAG? 5: 3)) { -/* the packet is OK */ -/* reset char count for next read */ - priv->acecadIndex = 0; - - if (priv->flags & ABSOLUTE_FLAG) { - x = (int)priv->acecadData[1] + ((int)priv->acecadData[2] << 7); - y = (int)priv->acecadData[3] + ((int)priv->acecadData[4] << 7); - } else { - x = priv->acecadData[0] & XSIGN_BIT? priv->acecadData[1]: -priv->acecadData[1]; - y = priv->acecadData[0] & YSIGN_BIT? priv->acecadData[2]: -priv->acecadData[2]; - } - -/* x = priv->acecadMaxX - x; /**/ - y = priv->acecadMaxY - y; /**/ - - prox = (priv->acecadData[0] & PROXIMITY_BIT)? 0: 1; - - buttons = (priv->acecadData[0] & BUTTON_BITS); - - device = local->dev; - - DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tbuttons=%d\n", - prox ? "true" : "false", x, y, buttons)); - - is_absolute = (priv->flags & ABSOLUTE_FLAG); - is_core_pointer = xf86IsCorePointer(device); - - if (is_core_pointer) { - x = x * screenInfo.screens[0]->width / priv->acecadMaxX; - y = y * screenInfo.screens[0]->height / priv->acecadMaxY; - DBG(6, ErrorF("Adjusted coords x=%d y=%d\n", x, y)); - } - -/* coordonates are ready we can send events */ - if (prox) { - if (!(priv->acecadOldProximity)) - if (!is_core_pointer) - xf86PostProximityEvent(device, 1, 0, 2, x, y); - - if ((is_absolute && ((priv->acecadOldX != x) || (priv->acecadOldY != y))) - || (!is_absolute && (x || y))) { - if (is_absolute || priv->acecadOldProximity) { - xf86PostMotionEvent(device, is_absolute, 0, 2, x, y); - } - } - - if (priv->acecadOldButtons != buttons) { - int delta; - int button; - - delta = buttons - priv->acecadOldButtons; - button = (delta > 0)? delta: ((delta == 0)? - priv->acecadOldButtons : -delta); - - if (priv->acecadOldButtons != buttons) { - DBG(6, ErrorF("xf86AceCadReadInput button=%d\n", button)); - - xf86PostButtonEvent(device, is_absolute, button, - (delta >0), 0, 2, x, y); - } - - } - - priv->acecadOldButtons = buttons; - priv->acecadOldX = x; - priv->acecadOldY = y; - priv->acecadOldProximity = prox; - } else { /* !PROXIMITY */ -/* Any changes in buttons are ignored when !proximity */ - if (!is_core_pointer) - if (priv->acecadOldProximity) - xf86PostProximityEvent(device, 0, 0, 2, x, y); - priv->acecadOldProximity = 0; - } - } - } - DBG(7, ErrorF("xf86AceCadReadInput END device=0x%x priv=0x%x\n", - local->dev, priv)); -} - -/* -** xf86AceCadControlProc -** It really does do something. Honest! -*/ -static void -xf86AceCadControlProc(DeviceIntPtr device, PtrCtrl *ctrl) -{ - DBG(2, ErrorF("xf86AceCadControlProc\n")); -} - -/* -** write_and_read -** Write data, and get the response. -*/ -static char * -write_and_read(int fd, char *data, char *buffer, int len, int cr_term) -{ - int err, numread = 0; - fd_set readfds; - struct timeval timeout; - - SYSCALL(err = write(fd, data, strlen(data))); - if (err == -1) { - Error("AceCad write"); - return NULL; - } - - FD_ZERO(&readfds); - FD_SET(fd, &readfds); - while (numread < len) { - timeout.tv_sec = 0; - timeout.tv_usec = 200000; - - SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); - if (err == -1) { - Error("AceCad select"); - return NULL; - } - if (!err) { - ErrorF("Timeout while reading AceCad tablet. No tablet connected ???\n"); - return NULL; - } - - SYSCALL(err = read(fd, buffer + numread++, 1)); - if (err == -1) { - Error("AceCad read"); - return NULL; - } - if (!err) { - --numread; - break; - } - if (cr_term && buffer[numread - 1] == '\r') { - break; - buffer[numread - 1] = 0; - } - } - buffer[numread] = 0; - return buffer; -} - -/* -** xf86AceCadOpen -** Open and initialize the tablet, as well as probe for any needed data. -*/ -static Bool -xf86AceCadOpen(LocalDevicePtr local) -{ - struct termios termios_tty; - struct timeval timeout; - char buffer[256]; - int err; - AceCadDevicePtr priv = (AceCadDevicePtr)local->private; - - DBG(1, ErrorF("opening %s\n", priv->acecadDevice)); - - SYSCALL(local->fd = open(priv->acecadDevice, O_RDWR|O_NDELAY, 0)); - if (local->fd == -1) { - Error(priv->acecadDevice); - return !Success; - } - DBG(2, ErrorF("%s opened as fd %d\n", priv->acecadDevice, local->fd)); - -#ifdef POSIX_TTY - err = tcgetattr(local->fd, &termios_tty); - if (err == -1) { - Error("AceCad tcgetattr"); - return !Success; - } - termios_tty.c_iflag = IXOFF; - termios_tty.c_cflag = B9600|CS8|CREAD|CLOCAL|HUPCL|PARENB|PARODD; - termios_tty.c_lflag = 0; - -/* I wonder what these all do, anyway */ - termios_tty.c_cc[VINTR] = 0; - termios_tty.c_cc[VQUIT] = 0; - termios_tty.c_cc[VERASE] = 0; -#ifdef VWERASE - termios_tty.c_cc[VWERASE] = 0; -#endif -#ifdef VREPRINT - termios_tty.c_cc[VREPRINT] = 0; -#endif - termios_tty.c_cc[VKILL] = 0; - termios_tty.c_cc[VEOF] = 0; - termios_tty.c_cc[VEOL] = 0; -#ifdef VEOL2 - termios_tty.c_cc[VEOL2] = 0; -#endif - termios_tty.c_cc[VSUSP] = 0; -#ifdef VDISCARD - termios_tty.c_cc[VDISCARD] = 0; -#endif -#ifdef VLNEXT - termios_tty.c_cc[VLNEXT] = 0; -#endif - - termios_tty.c_cc[VMIN] = 1 ; - termios_tty.c_cc[VTIME] = 10 ; - - err = tcsetattr(local->fd, TCSANOW, &termios_tty); - if (err == -1) { - Error("AceCad tcsetattr TCSANOW"); - return !Success; - } -#else - Code for someone else to write to handle OSs without POSIX tty functions -#endif - - DBG(1, ErrorF("initializing AceCad tablet\n")); - -/* Send reset (NULL) to the tablet */ - SYSCALL(err = write(local->fd, "\0", 1)); - if (err == -1) { - Error("AceCad write"); - return !Success; - } - -/* wait 200 mSecs, just in case */ - timeout.tv_sec = 0; - timeout.tv_usec = 200000; - SYSCALL(err = select(0, NULL, NULL, NULL, &timeout)); - if (err == -1) { - Error("AceCad select"); - return !Success; - } - -/* Put it in prompt mode so it doens't say anything before we're ready */ - SYSCALL(err = write(local->fd, ACECAD_PROMPT_MODE, strlen(ACECAD_PROMPT_MODE))); - if (err == -1) { - Error("AceCad write"); - return !Success; - } -/* Clear any pending input */ - tcflush(local->fd, TCIFLUSH); - -/* DBG(2, ErrorF("Reading Firmware ID\n")); */ -/* if (!write_and_read(local->fd, ACECAD_PROMPT, buffer, 5, 1)) */ -/* return !Success; */ - -/* DBG(2, ErrorF("%s\n", buffer)); */ - -/* if (xf86Verbose) */ -/* ErrorF("%s AceCad firmware ID : %s\n", XCONFIG_PROBED, buffer); */ - - DBG(2, ErrorF("reading max coordinates\n")); - if (!write_and_read(local->fd, ACECAD_CONFIG, buffer, 5, 0)) - return !Success; - priv->acecadMaxX = (int)buffer[1] + ((int)buffer[2] << 7); - priv->acecadMaxY = (int)buffer[3] + ((int)buffer[4] << 7); - -/* priv->acecadMaxX = 6000; */ -/* priv->acecadMaxY = 6000; */ - - if (xf86Verbose) - ErrorF("%s AceCad tablet size is %d.%1dinx%d.%1din, %dx%d " - "lines of resolution\n", XCONFIG_PROBED, - priv->acecadMaxX / 500, (priv->acecadMaxX / 50) % 10, - priv->acecadMaxY / 500, (priv->acecadMaxY / 50) % 10, - priv->acecadMaxX, priv->acecadMaxY); - - if (priv->acecadInc > 95) - priv->acecadInc = 95; - if (priv->acecadInc < 1) { -/* Make a guess as to the best increment value given video mode */ - if (priv->acecadMaxX / screenInfo.screens[0]->width < - priv->acecadMaxY / screenInfo.screens[0]->height) - priv->acecadInc = priv->acecadMaxX / screenInfo.screens[0]->width; - else - priv->acecadInc = priv->acecadMaxY / screenInfo.screens[0]->height; - if (priv->acecadInc < 1) - priv->acecadInc = 1; - if (xf86Verbose) - ErrorF("%s Using increment value of %d\n", XCONFIG_PROBED, - priv->acecadInc); - } - -/* Sets up the tablet mode to increment, stream, and such */ - sprintf(buffer, "%s%c%c%c", acecad_initstr, ACECAD_INCREMENT, 32 + priv->acecadInc, - (priv->flags & ABSOLUTE_FLAG)? ACECAD_ABSOLUTE: ACECAD_RELATIVE); - - SYSCALL(err = write(local->fd, buffer, strlen(buffer))) - if (err == -1) { - Error("AceCad write"); - return !Success; - } - - if (err <= 0) { - SYSCALL(close(local->fd)); - return !Success; - } - - return Success; -} - -/* -** xf86AceCadOpenDevice -** Opens and initializes the device driver stuff or sumpthin. -*/ -static int -xf86AceCadOpenDevice(DeviceIntPtr pAceCad) -{ - LocalDevicePtr local = (LocalDevicePtr)pAceCad->public.devicePrivate; - AceCadDevicePtr priv = (AceCadDevicePtr)XI_PRIVATE(pAceCad); - - if (xf86AceCadOpen(local) != Success) { - if (local->fd >= 0) { - SYSCALL(close(local->fd)); - } - local->fd = -1; - } - -/* Set the real values */ - InitValuatorAxisStruct(pAceCad, - 0, - 0, /* min val */ - priv->acecadMaxX, /* max val */ - 500000, /* resolution */ - 0, /* min_res */ - 500000); /* max_res */ - InitValuatorAxisStruct(pAceCad, - 1, - 0, /* min val */ - priv->acecadMaxY, /* max val */ - 500000, /* resolution */ - 0, /* min_res */ - 500000); /* max_res */ - return (local->fd != -1); -} - -/* -** xf86AceCadProc -** Handle requests to do stuff to the driver. -*/ -static int -xf86AceCadProc(DeviceIntPtr pAceCad, int what) -{ - CARD8 map[25]; - int nbaxes; - int nbbuttons; - int loop; - LocalDevicePtr local = (LocalDevicePtr)pAceCad->public.devicePrivate; - AceCadDevicePtr priv = (AceCadDevicePtr)PRIVATE(pAceCad); - - DBG(2, ErrorF("BEGIN xf86AceCadProc dev=0x%x priv=0x%x what=%d\n", pAceCad, priv, what)); - - switch (what) { - case DEVICE_INIT: - DBG(1, ErrorF("xf86AceCadProc pAceCad=0x%x what=INIT\n", pAceCad)); - - nbaxes = 2; /* X, Y */ - nbbuttons = (priv->flags & STYLUS_FLAG)? 2: 4; - - for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop; - - if (InitButtonClassDeviceStruct(pAceCad, - nbbuttons, - map) == FALSE) { - ErrorF("unable to allocate Button class device\n"); - return !Success; - } - - if (InitFocusClassDeviceStruct(pAceCad) == FALSE) { - ErrorF("unable to init Focus class device\n"); - return !Success; - } - - if (InitPtrFeedbackClassDeviceStruct(pAceCad, - xf86AceCadControlProc) == FALSE) { - ErrorF("unable to init ptr feedback\n"); - return !Success; - } - - if (InitProximityClassDeviceStruct(pAceCad) == FALSE) { - ErrorF("unable to init proximity class device\n"); - return !Success; - } - - if (InitValuatorClassDeviceStruct(pAceCad, - nbaxes, - xf86GetMotionEvents, - local->history_size, - (priv->flags & ABSOLUTE_FLAG)? Absolute: Relative) - == FALSE) { - ErrorF("unable to allocate Valuator class device\n"); - return !Success; - } -/* allocate the motion history buffer if needed */ - xf86MotionHistoryAllocate(local); - - AssignTypeAndName(pAceCad, local->atom, local->name); -/* open the device to gather informations */ - xf86AceCadOpenDevice(pAceCad); - break; - - case DEVICE_ON: - DBG(1, ErrorF("xf86AceCadProc pAceCad=0x%x what=ON\n", pAceCad)); - - if ((local->fd < 0) && (!xf86AceCadOpenDevice(pAceCad))) { - return !Success; - } -/* SYSCALL(write(local->fd, ACECAD_PROMPT, strlen(ACECAD_PROMPT))); */ - AddEnabledDevice(local->fd); - pAceCad->public.on = TRUE; - break; - - case DEVICE_OFF: - DBG(1, ErrorF("xf86AceCadProc pAceCad=0x%x what=%s\n", pAceCad, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - if (local->fd >= 0) - RemoveEnabledDevice(local->fd); - pAceCad->public.on = FALSE; - break; - - case DEVICE_CLOSE: - DBG(1, ErrorF("xf86AceCadProc pAceCad=0x%x what=%s\n", pAceCad, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - SYSCALL(close(local->fd)); - local->fd = -1; - break; - - default: - ErrorF("unsupported mode=%d\n", what); - return !Success; - break; - } - DBG(2, ErrorF("END xf86AceCadProc Success what=%d dev=0x%x priv=0x%x\n", - what, pAceCad, priv)); - return Success; -} - -/* -** xf86AceCadClose -** It... Uh... Closes the physical device? -*/ -static void -xf86AceCadClose(LocalDevicePtr local) -{ - if (local->fd >= 0) { - SYSCALL(close(local->fd)); - } - local->fd = -1; -} - -/* -** xf86AceCadChangeControl -** When I figure out what it does, it will do it. -*/ -static int -xf86AceCadChangeControl(LocalDevicePtr local, pointer control) -{ - xDeviceResolutionCtl *res; - - res = (xDeviceResolutionCtl *)control; - - if ((res->control != DEVICE_RESOLUTION) || - (res->num_valuators < 1)) - return (BadMatch); - - return(Success); -} - -/* -** xf86AceCadSwitchMode -** Switches the mode. For now just absolute or relative, hopefully -** more on the way. -*/ -static int -xf86AceCadSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) -{ - LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; - AceCadDevicePtr priv = (AceCadDevicePtr)(local->private); - char newmode; - - DBG(3, ErrorF("xf86AceCadSwitchMode dev=0x%x mode=%d\n", dev, mode)); - - switch(mode) { - case Absolute: - priv->flags |= ABSOLUTE_FLAG; - newmode = ACECAD_ABSOLUTE; - break; - - case Relative: - priv->flags &= ~ABSOLUTE_FLAG; - newmode = ACECAD_RELATIVE; - break; - - default: - DBG(1, ErrorF("xf86AceCadSwitchMode dev=0x%x invalid mode=%d\n", - dev, mode)); - return BadMatch; - } - SYSCALL(write(local->fd, &newmode, 1)); - return Success; -} - -/* -** xf86AceCadAllocate -** Allocates the device structures for the AceCad. -*/ -static LocalDevicePtr -xf86AceCadAllocate() -{ - LocalDevicePtr local = xalloc(sizeof(LocalDeviceRec)); - AceCadDevicePtr priv = xalloc(sizeof(AceCadDeviceRec)); -#if defined (sun) && !defined(i386) - char *dev_name = getenv("ACECAD_DEV"); -#endif - - local->name = XI_NAME; - local->type_name = "AceCad Tablet"; - local->flags = 0; -#if !defined(sun) || defined(i386) - local->device_config = xf86AceCadConfig; -#endif - local->device_control = xf86AceCadProc; - local->read_input = xf86AceCadReadInput; - local->control_proc = xf86AceCadChangeControl; - local->close_proc = xf86AceCadClose; - local->switch_mode = xf86AceCadSwitchMode; - local->fd = -1; - local->atom = 0; - local->dev = NULL; - local->private = priv; - local->private_flags = 0; - local->history_size = 0; - -#if defined(sun) && !defined(i386) - if (def_name) { - priv->acecadDevice = xalloc(strlen(dev_name) + 1); - strcpy(priv->acecadDevice, device_name); - ErrorF("xf86AceCadOpen port changed to '%s'\n", priv->acecadDevice); - } else { - priv->acecadDevice = ""; - } -#else - priv->acecadDevice = ""; /* device file name */ -#endif - priv->acecadInc = -1; /* re-transmit position on increment */ - priv->acecadOldX = -1; /* previous X position */ - priv->acecadOldY = -1; /* previous Y position */ - priv->acecadOldProximity = 0; /* previous proximity */ - priv->acecadOldButtons = 0; /* previous buttons state */ - priv->acecadMaxX = -1; /* max X value */ - priv->acecadMaxY = -1; /* max Y value */ - priv->flags = 0; /* various flags */ - priv->acecadIndex = 0; /* number of bytes read */ - - return local; -} - - -/* -** AceCad device association -** Device section name and allocation function. -*/ -DeviceAssocRec acecad_assoc = -{ - ACECAD_SECTION_NAME, /* config_section_name */ - xf86AceCadAllocate /* device_allocate */ -}; - -#ifdef DYNAMIC_MODULE -/* -** init_module -** Entry point for dynamic module. -*/ -int -#ifndef DLSYM_BUG -init_module(unsigned long server_version) -#else -init_xf86AceCad(unsigned long server_version) -#endif -{ - xf86AddDeviceAssoc(&acecad_assoc); - - if (server_version != XF86_VERSION_CURRENT) { - ErrorF("Warning: AceCad module compiled for version%s\n", - XF86_VERSION); - return 0; - } else { - return 1; - } -} -#endif - -#ifdef XFree86LOADER -/* - * Entry point for the loader code - */ -XF86ModuleVersionInfo xf86AceCadVersion = { - "xf86AceCad", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - 0x00010000, - {0,0,0,0} -}; - -void -xf86AceCadModuleInit(data, magic) - pointer *data; - INT32 *magic; -{ - static int cnt = 0; - - switch (cnt) { - case 0: - *magic = MAGIC_VERSION; - *data = &xf86AceCadVersion; - cnt++; - break; - - case 1: - *magic = MAGIC_ADD_XINPUT_DEVICE; - *data = &acecad_assoc; - cnt++; - break; - - default: - *magic = MAGIC_DONE; - *data = NULL; - break; - } -} -#endif - diff --git a/xc/programs/Xserver/hw/xfree86/input/citron/citron.c b/xc/programs/Xserver/hw/xfree86/input/citron/citron.c index 9d12f26b6..5a6e00626 100644 --- a/xc/programs/Xserver/hw/xfree86/input/citron/citron.c +++ b/xc/programs/Xserver/hw/xfree86/input/citron/citron.c @@ -25,7 +25,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.6 2001/04/05 17:42:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.7 2001/07/02 17:29:20 dawes Exp $ */ /* * Based, in part, on code with the following copyright notice: @@ -137,7 +137,6 @@ char version[]="Touch Driver V2.09 (c) 1999-2001 Citron GmbH"; #define NEED_XF86_TYPES #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*/ diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c index a36c48e3f..68a5f6450 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.193 2001/05/19 00:26:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.197 2001/08/15 19:08:55 herrb Exp $ */ /* * @@ -392,6 +392,8 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86LoadOneModule) SYMFUNC(xf86UnloadSubModule) SYMFUNC(xf86LoaderCheckSymbol) + SYMFUNC(xf86LoaderRefSymLists) + SYMFUNC(xf86LoaderRefSymbols) SYMFUNC(xf86LoaderReqSymLists) SYMFUNC(xf86LoaderReqSymbols) SYMFUNC(xf86SetBackingStore) @@ -519,6 +521,8 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86XVQueryOffscreenImages) SYMFUNC(xf86XVAllocateVideoAdaptorRec) SYMFUNC(xf86XVFreeVideoAdaptorRec) + SYMFUNC(xf86XVFillKeyHelper) + SYMFUNC(xf86XVClipVideoHelper) /* xf86xvmc.c */ SYMFUNC(xf86XvMCScreenInit) @@ -564,6 +568,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(MiscExtGetKbdSettings) SYMFUNC(MiscExtGetKbdValue) SYMFUNC(MiscExtSetKbdValue) + SYMFUNC(MiscExtSetGrabKeysState) SYMFUNC(MiscExtCreateStruct) SYMFUNC(MiscExtDestroyStruct) SYMFUNC(MiscExtApply) @@ -1021,7 +1026,7 @@ LOOKUP xfree86LookupTab[] = { SYMVAR(res8514Shared) SYMVAR(PciAvoid) -#if defined(__powerpc__) && (!defined(NO_INLINE) || defined(Lynx)) && !defined(__OpenBSD__) +#if defined(__powerpc__) && (!defined(NO_INLINE) || defined(Lynx)) SYMVAR(ioBase) #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/Imakefile index 9c3eee263..d6488a304 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.44 2001/04/23 12:08:14 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.48 2001/08/17 22:08:14 tsi Exp $ @@ -14,7 +14,9 @@ XCOMM $XConsortium: Imakefile /main/9 1996/10/25 15:38:46 kaleb $ (defined(LinuxArchitecture) && defined(AlphaArchitecture)) || \ (defined(FreeBSDArchitecture) && defined(AlphaArchitecture)) || \ defined(PpcArchitecture) || defined(SparcArchitecture) || \ - (defined(LinuxArchitecture) && defined(MipsArchitecture)) + (defined(LinuxArchitecture) && defined(MipsArchitecture)) || \ + (defined(LinuxArchitecture) && defined(SuperHArchitecture)) || \ + (defined(LinuxArchitecture) && defined(SuperHebArchitecture)) BUS_SUBDIR = bus #endif @@ -36,11 +38,7 @@ OS_SUBDIR = sysv #if defined(SVR4Architecture) # if defined(SunArchitecture) -# if OSMinorVersion < 8 -OS_SUBDIR = solx86 -# else -OS_SUBDIR = sol8_x86 -# endif +OS_SUBDIR = sunos # elif defined(PmaxOSArchitecture) OS_SUBDIR = pmax # elif defined(DguxArchitecture) @@ -67,20 +65,8 @@ OS_SUBDIR = bsd OS_SUBDIR = bsdi #endif -#if defined(i386MachArchitecture) || defined(OsfArchitecture) #if defined(GNUMachArchitecture) OS_SUBDIR = hurd -#else -OS_SUBDIR = mach -#endif -#endif - -#if defined(AmoebaArchitecture) -OS_SUBDIR = amoeba -#endif - -#if defined(MinixArchitecture) -OS_SUBDIR = minix #endif #if defined(OS2Architecture) @@ -91,18 +77,26 @@ OS_SUBDIR = os2 OS_SUBDIR = sco #endif -#if BuildXF86DRI && !DoLoadableServer +#if !DoLoadableServer + +#if BuildXF86DRI DRM_SRC = $(OS_SUBDIR)/drm/?*.c DRM_OBJ = $(OS_SUBDIR)/drm/?*.o -DRM_DONES = $(OS_SUBDIR)/drm/DONE +DRMDONE = $(OS_SUBDIR)/drm/DONE +#endif + +VBE_SRC = vbe/?*.c +VBE_OBJ = vbe/?*.o +VBEDONE = vbe/DONE + #endif SUBDIRS = $(OS_SUBDIR) $(BUS_SUBDIR) misc vbe -SRCS = $(OS_SUBDIR)/?*.c $(BUS_SUBDIR)/?*.c misc/?*.c vbe/?*.c $(DRM_SRC) -OBJS = $(OS_SUBDIR)/?*.o $(BUS_SUBDIR)/?*.o misc/?*.o vbe/?*.o $(DRM_OBJ) +SRCS = $(OS_SUBDIR)/?*.c $(BUS_SUBDIR)/?*.c misc/?*.c $(VBE_SRC) $(DRM_SRC) +OBJS = $(OS_SUBDIR)/?*.o $(BUS_SUBDIR)/?*.o misc/?*.o $(VBE_OBJ) $(DRM_OBJ) -DONES = $(OS_SUBDIR)/DONE $(BUS_SUBDIR)/DONE misc/DONE vbe/DONE $(DRM_DONES) +DONES = $(OS_SUBDIR)/DONE $(BUS_SUBDIR)/DONE misc/DONE $(VBEDONE) $(DRMDONE) #if HasParallelMake MakeMutex($(SUBDIRS) $(OBJS) $(DONES)) 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 ac503f679..b1dfcc685 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.48.2.1 2001/05/21 05:00:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.49 2001/05/21 03:45:31 tsi Exp $ */ /* * Pci.c - New server PCI access functions * diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h b/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h index 51552a620..cdf8e7b83 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.27 2001/05/15 10:19:42 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.28 2001/06/12 04:27:15 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -334,8 +334,13 @@ #define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFFF0000) #define PCI_PCI_BRIDGE_CONTROL_REG 0x3E +#define PCI_PCI_BRIDGE_PARITY_EN 0x01 +#define PCI_PCI_BRIDGE_SERR_EN 0x02 #define PCI_PCI_BRIDGE_ISA_EN 0x04 #define PCI_PCI_BRIDGE_VGA_EN 0x08 +#define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20 +#define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40 +#define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80 /* Subsystem identification register */ #define PCI_SUBSYSTEM_ID_REG 0x2c diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h index 1f33a1e2a..2e5f7bb3e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h @@ -24,7 +24,7 @@ * DEALINGS IN THE SOFTWARE. * */ -/* $XFree86$ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h,v 1.1 2001/05/19 18:29:22 dawes Exp $ */ #ifndef __SIS_H__ #define __SIS_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 5ed8f1f86..4916e0323 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c @@ -27,7 +27,7 @@ * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.22 2001/05/19 00:26:45 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.24 2001/08/18 02:51:13 dawes Exp $ * */ 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 a7f69d95a..62e7c323d 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.9.2.1 2001/05/23 18:58:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.10 2001/05/23 16:03:50 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c index fb36a2883..0fb4ae63e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.6.2.1 2001/05/22 21:25:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.8 2001/08/01 00:44:56 tsi Exp $ */ #ifdef XFree86Server # include "xf86.h" @@ -53,7 +53,7 @@ Bool drmSiSAgpInit(int driSubFD, int offset, int size) agp.offset = offset; agp.size = size; - xf86ioctl(driSubFD, SIS_IOCTL_AGP_INIT, &agp); + ioctl(driSubFD, SIS_IOCTL_AGP_INIT, &agp); return TRUE; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c index fe34b6382..f4c5f1b75 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.15 2001/02/16 14:45:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.16 2001/08/06 20:51:11 dawes Exp $ */ /* Resource information code */ @@ -165,7 +165,7 @@ xf86AccResFromOS(resPtr ret) return ret; } -#elif defined(__powerpc__) || defined(__sparc__) || defined(__mips__) +#elif defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__sh__) /* XXX this isn't exactly correct but it will get the server working * for now until we get something better. 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 2a4c958ef..39993c40a 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.6.2.1 2001/06/01 20:03:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.7 2001/06/01 20:03:05 dawes Exp $ */ #include <stdio.h> #include "X.h" 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 8ed02faf5..be4074f7f 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.51.2.3 2001/05/29 16:38:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.58 2001/08/06 20:51:11 dawes Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -49,8 +49,22 @@ static Bool ExtendedEnabled = FALSE; #ifdef __ia64__ + #include "compiler.h" #include <sys/io.h> + +#elif !defined(__powerpc__) && \ + !defined(__mc68000__) && \ + !defined(__sparc__) && \ + !defined(__mips__) + +/* + * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare + * these. + */ +extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on); +extern int iopl(int __level); + #endif #ifdef __alpha__ @@ -517,7 +531,7 @@ xf86EnableIO(void) #endif } close(fd); -#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) if (ioperm(0, 1024, 1) || iopl(3)) FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n"); # if !defined(__alpha__) @@ -538,7 +552,7 @@ xf86DisableIO(void) #if defined(__powerpc__) munmap(ioBase, 0x20000); ioBase = NULL; -#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) iopl(0); ioperm(0, 1024, 0); #endif @@ -556,11 +570,11 @@ Bool xf86DisableInterrupts() { if (!ExtendedEnabled) -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) if (iopl(3) || ioperm(0, 1024, 1)) return (FALSE); #endif -#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) +#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__sh__) #else #ifdef __GNUC__ #if defined(__ia64__) @@ -574,7 +588,7 @@ xf86DisableInterrupts() asm("cli"); #endif #endif -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) if (!ExtendedEnabled) { iopl(0); ioperm(0, 1024, 0); @@ -588,11 +602,11 @@ void xf86EnableInterrupts() { if (!ExtendedEnabled) -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) if (iopl(3) || ioperm(0, 1024, 1)) return; #endif -#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) +#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__sh__) #else #ifdef __GNUC__ #if defined(__ia64__) @@ -606,7 +620,7 @@ xf86EnableInterrupts() asm("sti"); #endif #endif -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) if (!ExtendedEnabled) { iopl(0); ioperm(0, 1024, 0); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile index dc7af59b0..9dc4dba72 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile,v 3.11 2000/12/13 18:38:05 robin Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/Imakefile,v 3.12 2001/06/30 22:41:49 tsi Exp $ @@ -7,18 +7,18 @@ XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:24:25 rws $ #include <Server.tmpl> -SRCS = sco_init.c sco_video.c sco_io.c bios_devmem.c VTsw_sco.c \ - sysv_kbd.c std_kbdEv.c sysv_tty.c sco_mouse.c \ +SRCS = sco_init.c sco_video.c sco_io.c sco_mouse.c VTsw_sco.c \ + std_kbdEv.c posix_tty.c bios_devmem.c vidmem.c \ libc_wrapper.c stdResource.c stdPci.o sigiostubs.c pm_noop.c \ kmod_noop.c agp_noop.c -OBJS = sco_init.o sco_video.o sco_io.o bios_devmem.o VTsw_sco.o \ - sysv_kbd.o std_kbdEv.o sysv_tty.o sco_mouse.o \ +OBJS = sco_init.o sco_video.o sco_io.o sco_mouse.o VTsw_sco.o \ + std_kbdEv.o posix_tty.o bios_devmem.o vidmem.o \ libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \ kmod_noop.o agp_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) + -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) RESDEFINES = -DUSESTDRES @@ -28,9 +28,8 @@ SubdirLibraryRule($(OBJS)) NormalLibraryObjectRule() LinkSourceFile(bios_devmem.c,../shared) -LinkSourceFile(sysv_kbd.c,../shared) LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(sysv_tty.c,../shared) +LinkSourceFile(posix_tty.c,../shared) LinkSourceFile(libc_wrapper.c,../shared) LinkSourceFile(stdResource.c,../shared) LinkSourceFile(stdPci.c,../shared) @@ -38,6 +37,7 @@ LinkSourceFile(sigiostubs.c,../shared) LinkSourceFile(pm_noop.c,../shared) LinkSourceFile(kmod_noop.c,../shared) LinkSourceFile(agp_noop.c,../shared) +LinkSourceFile(vidmem.c,../shared) DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c index 9ba4edf24..2f2f44a69 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.75 2001/05/18 20:22:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.79 2001/08/17 22:08:14 tsi Exp $ */ /* * Copyright 1997 by The XFree86 Project, Inc. * @@ -23,6 +23,9 @@ * */ +#if defined(linux) && !defined(__GLIBC__) +#undef __STRICT_ANSI__ +#endif #include <X.h> #include <Xmd.h> #include <Xos.h> @@ -38,7 +41,6 @@ #include <fcntl.h> #include "Xfuncproto.h" #include "os.h" -#include <stdarg.h> #include <ctype.h> #include <unistd.h> #include <string.h> @@ -133,7 +135,7 @@ typedef struct dirent DIRENTRY; #include <sys/wait.h> #undef _POSIX_SOURCE #else -#if defined(MINIX) || defined(AMOEBA) || (defined(ISC) && defined(_POSIX_SOURCE)) || defined(Lynx) || (defined (__alpha__) && defined(linux)) +#if (defined(ISC) && defined(_POSIX_SOURCE)) || defined(Lynx) || (defined (__alpha__) && defined(linux)) #include <sys/types.h> #endif #include <sys/wait.h> @@ -399,7 +401,9 @@ xf86open(const char *path, int flags, ...) va_start(ap, flags); flags = xfToOsOpenFlags(flags); if (flags & O_CREAT) { - mode_t mode = va_arg(ap, mode_t); + /* can't request a mode_t directly on systems where mode_t + is an unsigned short */ + mode_t mode = (mode_t)va_arg(ap, unsigned int); fd = open(path, flags, mode); } else { fd = open(path, flags); @@ -1171,18 +1175,13 @@ xf86bsearch(const void *key, const void *base, xf86size_t nmemb, return bsearch(key, base, (size_t)nmemb, (size_t)size, compar); } -/*VARARGS1*/ int xf86execl(const char *pathname, const char *arg, ...) { #ifndef __EMX__ int i; pid_t pid; -#ifdef MACH386 - union wait exit_status; -#else int exit_status; -#endif char *arglist[5]; va_list args; va_start(args, arg); @@ -1206,7 +1205,7 @@ xf86execl(const char *pathname, const char *arg, ...) xf86DisableIO(); #endif setuid(getuid()); -#if !defined(SELF_CONTAINED_WRAPPER) && !defined(AMOEBA) && !defined(MINIX) +#if !defined(SELF_CONTAINED_WRAPPER) /* set stdin, stdout to the consoleFD, and leave stderr alone */ for (i = 0; i < 2; i++) { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile deleted file mode 100644 index 65b24cf6f..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile +++ /dev/null @@ -1,52 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile,v 1.8 2001/04/07 16:37:16 dawes Exp $ - - - - - -XCOMM $XConsortium: Imakefile /main/5 1996/09/28 17:24:30 rws $ - -#include <Server.tmpl> - -#if !HasGcc -PROWORKS_INOUT_SRC = sol8_iout.s -PROWORKS_INOUT_OBJ = sol8_iout.o -#endif - -MOUSESRC = sol8_mouse.c -MOUSEOBJ = sol8_mouse.o - -SRCS = sol8_init.c sol8_vid.c sol8_bios.c sol8_kbd.c sol8_io.c \ - VTsw_noop.c sol8_kbd.c sol8_kbdEv.c posix_tty.c $(MOUSESRC) \ - libc_wrapper.c $(PROWORKS_INOUT_SRC) stdResource.c stdPci.c \ - sol8_kbdgetmapping.c sol8_postkbdevents.c sigiostubs.c pm_noop.c \ - kmod_noop.c agp_noop.c - -OBJS = sol8_init.o sol8_vid.o sol8_bios.o sol8_kbd.o sol8_io.o \ - VTsw_noop.o sol8_kbd.o sol8_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - libc_wrapper.o $(PROWORKS_INOUT_OBJ) stdResource.o stdPci.o \ - sol8_kbdgetmapping.o sol8_postkbdevents.o sigiostubs.o pm_noop.o \ - kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalAsmObjectRule() - -LinkSourceFile(VTsw_noop.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c deleted file mode 100644 index 8d92b5f7b..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_bios.c,v 1.1 1999/09/25 14:38:05 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * Copyright 1999 by David Holland <davidh@iquest.net> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell, David Wexelblat, - * and David Holland not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. Thomas Roell, David Wexelblat, and David Holland - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL, DAVID WEXELBLAT, AND DAVID HOLLAND DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * THOMAS ROELL, DAVID WEXELBLAT OR DAVID HOLLAND 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 "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#undef usleep -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -extern char *apertureDevName; - -/* - * Read BIOS via mmap()ing physical memory. - */ -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - unsigned char *ptr; - int psize; - int mlen; - - /* - * Solaris 2.1 x86 SVR4 (10/27/93) - * The server must treat the virtual terminal device file - * as the standard SVR4 /dev/pmem. By default, then used VT - * is considered the "default" file to open. - * - * Solaris 2.8 x86 (7/26/99) - DWH - * - * Use /dev/xsvc to gain access to any bit of physical memory - */ - if (!apertureDevName) - if (!xf86LinearVidMem()) - FatalError("xf86ReadBIOS: Could not mmap " - "BIOS [a=%x]\n", Base); - - if ((fd = open(apertureDevName, O_RDONLY)) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - return(-1); - } - psize = xf86getpagesize(); - mlen = (Offset + Len + psize - 1) & ~psize; - /* Base is assumed to be page-aligned. */ - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t)Base); - if (ptr == MAP_FAILED) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed\n", - apertureDevName); - close(fd); - return(-1); - } - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); - (void)close(fd); - return(Len); -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c deleted file mode 100644 index ed6f0363a..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c +++ /dev/null @@ -1,196 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_init.c,v 1.2 1999/10/13 04:21:35 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * Copyright 1999 by David Holland <davidh@iquest.net> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * DAVID HOLLAND, THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DAVID HOLLAND, THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sol8_init.c /main/4 1996/02/21 17:54:10 kaleb $ */ - -#include <signal.h> -#include <sys/time.h> -#include <unistd.h> - -#include "X.h" -#include "Xmd.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -static Bool KeepTty = FALSE; -#ifdef SVR4 -static Bool Protect0 = FALSE; -#endif - -char fb_dev[PATH_MAX] = "/dev/console"; - -#define MAX_SECONDS 60 -#define USEC_IN_SEC (unsigned long)1000000 - -#ifndef SOL8 -int xf86_sol8usleep(unsigned long); -static void xf86_sol8sleep(int); -#endif - -void sol8_setkbdinitiate(double value); -void sol8_setkbdrepeat(double value); - -void -xf86OpenConsole() -{ - int fd; - int i; - MessageType from = X_PROBED; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* Protect page 0 to help find NULL dereferencing */ - /* mprotect() doesn't seem to work */ - if (Protect0) - { - int fd = -1; - - if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: cannot open /dev/zero (%s)\n", - strerror(errno)); - } - else - { - if ((int)mmap(0, 0x1000, PROT_NONE, - MAP_FIXED | MAP_SHARED, fd, 0) == -1) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: failed to protect page 0 (%s)\n", - strerror(errno)); - } - close(fd); - } - } - - if (!KeepTty) - { - setpgrp(); - } - - if (((xf86Info.consoleFd = open(fb_dev, O_RDWR | O_NDELAY, 0)) < 0)) - { - FatalError("xf86OpenConsole: Cannot open %s (%s)\n", - fb_dev, strerror(errno)); - } - - } - return; -} - -void xf86CloseConsole() -{ - - int tmp; - - close(xf86Info.consoleFd); - -/* - * This probably shouldn't be here, however, there is no corresonding - * xf86CloseKbd() routine - DWH - */ - -/* - * Next set the keyboard into "indirect" mode and turn off - * event translation. - */ - - tmp = 0; - (void) ioctl(xf86Info.kbdFd, KIOCSDIRECT, &tmp); - tmp = TR_ASCII; - (void) ioctl(xf86Info.kbdFd, KIOCTRANS, &tmp); - - close(xf86Info.kbdFd); - - return; -} - -int xf86ProcessArgument(argc, argv, i) -int argc; -char *argv[]; -int i; -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } - /* - * Undocumented flag to protect page 0 from read/write to help - * catch NULL pointer dereferences. This is purely a debugging - * flag. - */ - if (!strcmp(argv[i], "-protect0")) - { - Protect0 = TRUE; - return(1); - } - if (!strcmp(argv[i], "-dev") && i+1 < argc) { - strncpy(fb_dev, argv[i+1], PATH_MAX); - fb_dev[PATH_MAX-1] = '\0'; - return(2); - } - - if (!strcmp(argv[i], "-ar1") && i+1 < argc) { - sol8_setkbdinitiate(atof(argv[i+1])); - return(2); - } - if (!strcmp(argv[i], "-ar2") && i+1 < argc) { - sol8_setkbdrepeat(atof(argv[i+1])); - return(2); - } - - return(0); -} - -void xf86UseMsg() -{ - ErrorF("-ar1 <float> Set autorepeat initiate time (sec)\n"); - ErrorF(" (If not using XKB)\n"); - ErrorF("-ar2 <float> Set autorepeat interval time (sec)\n"); - ErrorF(" (If not using XKB)\n"); - ErrorF("-dev <fb> FrameBuffer device\n"); - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c deleted file mode 100644 index 26f80930f..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_io.c,v 1.2 1999/10/13 04:21:36 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes <dawes@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 names of Thomas Roell and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Dawes makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sysv_io.c /main/8 1996/10/19 18:08:06 kaleb $ */ - -#include "X.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -void -xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - int kbdCmd; - - if (loudness && pitch) - { - kbdCmd = KBD_CMD_BELL; - if (ioctl (xf86Info.kbdFd, KIOCCMD, &kbdCmd) == -1) { - ErrorF("Failed to activate bell\n"); - return; - } - - usleep(xf86Info.bell_duration * loudness * 20); - - kbdCmd = KBD_CMD_NOBELL; - if (ioctl (xf86Info.kbdFd, KIOCCMD, &kbdCmd) == -1) - ErrorF ("Failed to deactivate bell\n"); - } -} - -void -xf86SetKbdLeds(int leds) -{ - if( ioctl(xf86Info.kbdFd, KIOCSLED, &leds) < 0 ) - ErrorF("Failed to set Keyboard LED's\n"); -} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s deleted file mode 100644 index 169ec05c6..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s +++ /dev/null @@ -1,104 +0,0 @@ -/ $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_iout.s,v 1.1 1999/09/25 14:38:09 dawes Exp $ -/ -/ -/ -/ -/ $XConsortium: sol8_iout.s /main/4 1996/02/21 17:54:14 kaleb $ -/ -/ File: sol8_iout.s -/ -/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions -/ for Solaris 2.8 x86 using the ProWorks compiler by SunPro -/ -/ Author: Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com) -/ Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com) -/ -/ Synopsis: (c callable external declarations) -/ extern unsigned char inb(int port); -/ extern unsigned short inw(int port); -/ extern unsigned long inl(int port); -/ extern void outb(int port, unsigned char value); -/ extern void outw(int port, unsigned short value); -/ extern void outl(int port, unsigned long value); - - -.file "sol8_iout.s" -.text - -.globl inb -.globl inw -.globl inl -.globl outb -.globl outw -.globl outl - -/ -/ unsigned char inb(int port); -/ -.align 4 -inb: - movl 4(%esp),%edx - subl %eax,%eax - inb (%dx) - ret -.type inb,@function -.size inb,.-inb - -/ -/ unsigned short inw(int port); -/ -.align 4 -inw: - movl 4(%esp),%edx - subl %eax,%eax - inw (%dx) - ret -.type inw,@function -.size inw,.-inw - -/ -/ unsigned long inl(int port); -/ -.align 4 -inl: - movl 4(%esp),%edx - inl (%dx) - ret -.type inl,@function -.size inl,.-inl - -/ -/ void outb(int port, unsigned char value); -/ -.align 4 -outb: - movl 4(%esp),%edx - movl 8(%esp),%eax - outb (%dx) - ret -.type outb,@function -.size outb,.-outb - -/ -/ void outw(int port, unsigned short value); -/ -.align 4 -outw: - movl 4(%esp),%edx - movl 8(%esp),%eax - outw (%dx) - ret -.type outw,@function -.size outw,.-outw - -/ -/ void outl(int port, unsigned long value); -/ -.align 4 -outl: - movl 4(%esp),%edx - movl 8(%esp),%eax - outl (%dx) - ret -.type outl,@function -.size outl,.-outl diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c deleted file mode 100644 index 75ff246a6..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c +++ /dev/null @@ -1,146 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbd.c,v 1.3 1999/11/19 13:55:03 hohndel Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes <dawes@XFree86.org> - * Copyright 1999 by David Holland <davidh@iquest.net) - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell, David Dawes, and - * David Holland not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. Thomas Roell, David Dawes, and David Holland - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL, DAVID DAWES, AND DAVID HOLLAND DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELL, DAVID DAWES, - * OR DAVID HOLLAND 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 "X.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include <sys/kbd.h> - -void sol8_setkbdinitiate(double value); -void sol8_setkbdrepeat(double value); - -static int sol8_otranslation = -1; -static int sol8_odirect = -1; - -int -xf86GetKbdLeds() -{ - int leds; - - ioctl(xf86Info.kbdFd, KIOCGLED, &leds); - return(leds); -} - -void -xf86SetKbdRepeat(char rad) -{ - - sol8_setkbdinitiate( (double) xf86Info.kbdDelay / 1000.0 ); - sol8_setkbdrepeat( (double) xf86Info.kbdRate / 1000.0 ); - return; -} - - -/* - * Save initial keyboard state. This is called at the start of each server - * generation. - * - * Solx86_8: Should determine keyboard type. - * Should save keyboard state. - */ - -void xf86KbdInit() -{ - int ktype, klayout; - - if(xf86Info.kbdFd < 0) { - xf86Info.kbdFd = open("/dev/kbd", O_RDWR|O_NONBLOCK); - if(xf86Info.kbdFd < 0) { - FatalError("Unable to open keyboard: /dev/kbd\n"); - } - } - -/* - * None of the followin should ever fail. If it does, something is broke - * (IMO) - DWH 8/21/99 - */ - - if( ioctl(xf86Info.kbdFd, KIOCTYPE, &ktype) < 0) { - FatalError("Unable to determine keyboard type: %d\n", errno); - } - - if( ioctl(xf86Info.kbdFd, KIOCLAYOUT, &klayout) < 0) { - FatalError("Unable to determine keyboard layout: %d\n", errno); - } - - if( ioctl(xf86Info.kbdFd, KIOCGTRANS, &sol8_otranslation) < 0) { - FatalError("Unable to determine keyboard translation mode\n"); - } - - if( ioctl(xf86Info.kbdFd, KIOCGDIRECT, &sol8_odirect) < 0) { - FatalError("Unable to determine keyboard direct setting\n"); - } - - return; - -} - -int xf86KbdOn(void) -{ - int tmp = 1; - - if(ioctl(xf86Info.kbdFd, KIOCSDIRECT, &tmp) == -1) { - FatalError("Setting keyboard direct mode on\n"); - return -1; - } - - /* Setup translation */ - - tmp = TR_UNTRANS_EVENT; - - if(ioctl(xf86Info.kbdFd, KIOCTRANS, &tmp) == -1) { - FatalError("Setting keyboard translation\n"); - return -1; - } - return(xf86Info.kbdFd); -} - -int -xf86KbdOff() -{ - - if(sol8_otranslation != -1) { - if( ioctl(xf86Info.kbdFd, KIOCTRANS, &sol8_otranslation) < 0) { - FatalError("Unable to restore keyboard translation mode\n"); - } - } - - if(sol8_odirect != 0) { - if( ioctl(xf86Info.kbdFd, KIOCSDIRECT, &sol8_odirect) < 0 ){ - FatalError("Unable to restore keyboard direct setting\n"); - } - } - - return(xf86Info.kbdFd); -} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c deleted file mode 100644 index 83aa5af97..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdEv.c,v 1.1 1999/09/25 14:38:09 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes <dawes@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 names of Thomas Roell and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Dawes makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: std_kbdEv.c /main/4 1996/03/11 10:47:33 kaleb $ */ - -#include "X.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - - -#include <stdio.h> -#include <stdlib.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/stream.h> -#include <sys/stropts.h> -#include <sys/vuid_event.h> -#include <sys/kbio.h> -#include <sys/kbd.h> -#include <termio.h> - -extern sol8PostKbdEvent(Firm_event *event); - -/* Lets try reading more than one keyboard event at a time in the - * hopes that this will be slightly more efficient. - * Or we could just try the MicroSoft method, and forget about - * efficiency. :-) - */ -void -xf86KbdEvents() -{ - Firm_event event[64]; - - int nBytes, i; - -/* I certainly hope its not possible to read partial events. */ - - if ((nBytes = read( xf86Info.kbdFd, (char *)event, sizeof(event))) - > 0) - { - for (i = 0; i < (nBytes / sizeof(Firm_event)); i++) - sol8PostKbdEvent(&event[i]); - } -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c deleted file mode 100644 index 386aa5ffe..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c +++ /dev/null @@ -1,136 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_kbdgetmapping.c,v 1.1 1999/09/25 14:38:09 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sol8Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */ - -#include "X.h" -#include "Xmd.h" -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "sol8_keynames.h" -#include "xf86Config.h" - -#include "sol8_keymap.h" - - -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return (TRUE); -} - - - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -xf86KbdGetMapping (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; -{ - KeySym *k; - char type; - int i; - KeySym *pMap; - - xf86Info.kbdType = 0; - pMap = sol8defaultKeymap; - - /* - * compute the modifier 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; - - } - - xf86Info.kbdType = 0; - - pKeySyms->map = pMap; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h deleted file mode 100644 index 9ef08a215..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h +++ /dev/null @@ -1,144 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keymap.h,v 1.2 1999/09/27 14:59:28 dawes Exp $ */ -/* - * replacement for xf86Keymap.h - for Solaris8_x86 - */ - -/* Assumes a US English keyboard as default - sorry 'bout that - * - * Hopefully it'll be enough someone can have a sorta working - * keyboard, if they're not using XKB - * - * DWH 9/12/99 - */ - -static KeySym sol8defaultKeymap[NUM_KEYCODES * GLYPHS_PER_KEY] = { - - /* 000 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 001 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, /* ` */ - /* 002 */ XK_1, XK_exclam, NoSymbol, NoSymbol, /* 1 */ - /* 003 */ XK_2, XK_at, NoSymbol, NoSymbol, /* 2 */ - /* 004 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, /* 3 */ - /* 005 */ XK_4, XK_dollar, NoSymbol, NoSymbol, /* 4 */ - /* 006 */ XK_5, XK_percent, NoSymbol, NoSymbol, /* 5 */ - /* 007 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, /* 6 */ - /* 008 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, /* 7 */ - /* 009 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, /* 8 */ - /* 010 */ XK_9, XK_parenleft, NoSymbol, NoSymbol, /* 9 */ - /* 011 */ XK_0, XK_parenright, NoSymbol, NoSymbol, /* 10 */ - /* 012 */ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* - */ - /* 013 */ XK_equal, XK_plus, NoSymbol, NoSymbol, /* = */ - /* 014 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 015 */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, /* ^H */ - /* 016 */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, /* ^I */ - /* 017 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* q */ - /* 018 */ XK_W, NoSymbol, NoSymbol, NoSymbol, /* w */ - /* 019 */ XK_E, NoSymbol, NoSymbol, NoSymbol, /* e */ - /* 020 */ XK_R, NoSymbol, NoSymbol, NoSymbol, /* r */ - /* 021 */ XK_T, NoSymbol, NoSymbol, NoSymbol, /* t */ - /* 022 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, /* y */ - /* 023 */ XK_U, NoSymbol, NoSymbol, NoSymbol, /* u */ - /* 024 */ XK_I, NoSymbol, NoSymbol, NoSymbol, /* i */ - /* 025 */ XK_O, NoSymbol, NoSymbol, NoSymbol, /* o */ - /* 026 */ XK_P, NoSymbol, NoSymbol, NoSymbol, /* p */ - /* 027 */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, /* [ */ - /* 028 */ XK_bracketright, XK_braceright, NoSymbol, NoSymbol, /* { */ - /* 029 */ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* | */ - /* 030 */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 031 */ XK_A, NoSymbol, NoSymbol, NoSymbol, /* a */ - /* 032 */ XK_S, NoSymbol, NoSymbol, NoSymbol, /* s */ - /* 033 */ XK_D, NoSymbol, NoSymbol, NoSymbol, /* d */ - /* 034 */ XK_F, NoSymbol, NoSymbol, NoSymbol, /* f */ - /* 035 */ XK_G, NoSymbol, NoSymbol, NoSymbol, /* g */ - /* 036 */ XK_H, NoSymbol, NoSymbol, NoSymbol, /* h */ - /* 037 */ XK_J, NoSymbol, NoSymbol, NoSymbol, /* j */ - /* 038 */ XK_K, NoSymbol, NoSymbol, NoSymbol, /* k */ - /* 039 */ XK_L, NoSymbol, NoSymbol, NoSymbol, /* l */ - /* 040 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, /* ; */ - /* 041 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, /* ' */ - /* 042 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 043 */ XK_Return, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 044 */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 045 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 046 */ XK_Z, NoSymbol, NoSymbol, NoSymbol, /* z */ - /* 047 */ XK_X, NoSymbol, NoSymbol, NoSymbol, /* x */ - /* 048 */ XK_C, NoSymbol, NoSymbol, NoSymbol, /* c */ - /* 049 */ XK_V, NoSymbol, NoSymbol, NoSymbol, /* v */ - /* 050 */ XK_B, NoSymbol, NoSymbol, NoSymbol, /* b */ - /* 051 */ XK_N, NoSymbol, NoSymbol, NoSymbol, /* n */ - /* 052 */ XK_M, NoSymbol, NoSymbol, NoSymbol, /* m */ - /* 053 */ XK_comma, XK_less, NoSymbol, NoSymbol, /* , */ - /* 054 */ XK_period, XK_greater, NoSymbol, NoSymbol, /* . */ - /* 055 */ XK_slash, XK_question, NoSymbol, NoSymbol, /* / */ - /* 056 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 057 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 058 */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 059 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 060 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, /* hmmm */ - /* 061 */ XK_space, NoSymbol, NoSymbol, NoSymbol, /* */ - /* 062 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, /* hmmm */ - /* 063 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 064 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, /* hmmm */ - /* 065 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 066 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 067 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 068 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 069 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 070 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 071 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 072 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 073 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 074 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 075 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 076 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 077 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 078 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 079 */ XK_Left, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 080 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 081 */ XK_End, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 082 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 083 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 084 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 085 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 086 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 087 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 088 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 089 */ XK_Right, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 090 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, /* hmm */ - /* 091 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, /* hmm */ - /* 092 */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, /* hmm */ - /* 093 */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, /* hmm */ - /* 094 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 095 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, /* / */ - /* 096 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, /* hmm */ - /* 097 */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, /* 5 */ - /* 098 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, /* hmm */ - /* 099 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, /* hmm */ - /* 100 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, /* * */ - /* 101 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, - /* 102 */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, - /* 103 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, - /* 104 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, - /* 105 */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, /* - */ - /* 106 */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, /* + */ - /* 107 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 108 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, - /* 109 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 110 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, /* Esc */ - /* 111 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 112 */ XK_F1, NoSymbol, NoSymbol, NoSymbol, /* F1 */ - /* 113 */ XK_F2, NoSymbol, NoSymbol, NoSymbol, /* F2 */ - /* 114 */ XK_F3, NoSymbol, NoSymbol, NoSymbol, /* F3 */ - /* 115 */ XK_F4, NoSymbol, NoSymbol, NoSymbol, /* F4 */ - /* 116 */ XK_F5, NoSymbol, NoSymbol, NoSymbol, /* F5 */ - /* 117 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, /* F6 */ - /* 118 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, /* F7 */ - /* 119 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, /* F8 */ - /* 120 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, /* F9 */ - /* 121 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, /* F10 */ - /* 122 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, /* F11 */ - /* 123 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, /* F12 */ - /* 124 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, /* Print Screen */ - /* 125 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, /* Scroll Lock */ - /* 126 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, /* Pause */ -}; - 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 deleted file mode 100644 index 13e34cc54..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h +++ /dev/null @@ -1,184 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.2 1999/10/13 04:21:36 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: atKeynames.h /main/11 1996/03/09 11:17:41 kaleb $ */ - -#ifndef _SOL8KEYNAMES_H -#define _SOL8KEYNAMES_H - -#define XK_TECHNICAL -#define XK_KATAKANA -#include "keysym.h" - -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 127 -#define MIN_KEYCODE 8 -#define MAX_KEYCODE 135 - -#define AltMask Mod1Mask -#define NumLockMask Mod2Mask -#define AltLangMask Mod3Mask -#define KanaMask Mod4Mask -#define ScrollLockMask Mod5Mask - -#define ModifierDown(k) ((keyc->state & (k)) == (k)) - -/* - * definition of the Solaris Keyboard. - * ============================================================ - * Defined Key Cap Glyphs Pressed value - * Key Name Main Also (hex) (dec) - * ---------------- ---------- ------- ------ ------ - */ - -#define KEY_Escape /* Escape 0x01 */ 110 -#define KEY_1 /* 1 ! 0x02 */ 2 -#define KEY_2 /* 2 @ 0x03 */ 3 -#define KEY_3 /* 3 # 0x04 */ 4 -#define KEY_4 /* 4 $ 0x05 */ 5 -#define KEY_5 /* 5 % 0x06 */ 6 -#define KEY_6 /* 6 ^ 0x07 */ 7 -#define KEY_7 /* 7 & 0x08 */ 8 -#define KEY_8 /* 8 * 0x09 */ 9 -#define KEY_9 /* 9 ( 0x0a */ 10 -#define KEY_0 /* 0 ) 0x0b */ 11 -#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 -#define KEY_Equal /* = (Equal) + 0x0d */ 13 -#define KEY_BackSpace /* Back Space 0x0e */ 15 -#define KEY_Tab /* Tab 0x0f */ 16 -#define KEY_Q /* Q 0x10 */ 17 -#define KEY_W /* W 0x11 */ 18 -#define KEY_E /* E 0x12 */ 19 -#define KEY_R /* R 0x13 */ 20 -#define KEY_T /* T 0x14 */ 21 -#define KEY_Y /* Y 0x15 */ 22 -#define KEY_U /* U 0x16 */ 23 -#define KEY_I /* I 0x17 */ 24 -#define KEY_O /* O 0x18 */ 25 -#define KEY_P /* P 0x19 */ 26 -#define KEY_LBrace /* [ { 0x1a */ 27 -#define KEY_RBrace /* ] } 0x1b */ 28 -#define KEY_Enter /* Enter 0x1c */ 43 -#define KEY_LCtrl /* Ctrl(left) 0x1d */ 58 -#define KEY_A /* A 0x1e */ 31 -#define KEY_S /* S 0x1f */ 32 -#define KEY_D /* D 0x20 */ 33 -#define KEY_F /* F 0x21 */ 34 -#define KEY_G /* G 0x22 */ 35 -#define KEY_H /* H 0x23 */ 36 -#define KEY_J /* J 0x24 */ 37 -#define KEY_K /* K 0x25 */ 38 -#define KEY_L /* L 0x26 */ 39 -#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 40 -#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 41 -#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 1 -#define KEY_ShiftL /* Shift(left) 0x2a */ 44 -#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 29 -#define KEY_Z /* Z 0x2c */ 46 -#define KEY_X /* X 0x2d */ 47 -#define KEY_C /* C 0x2e */ 48 -#define KEY_V /* V 0x2f */ 49 -#define KEY_B /* B 0x30 */ 50 -#define KEY_N /* N 0x31 */ 51 -#define KEY_M /* M 0x32 */ 52 -#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 53 -#define KEY_Period /* . (Period) >(Greater)0x34 */ 54 -#define KEY_Slash /* / (Slash) ? 0x35 */ 55 -#define KEY_ShiftR /* Shift(right) 0x36 */ 57 -#define KEY_KP_Multiply /* * 0x37 */ 100 -#define KEY_Alt /* Alt(left) 0x38 */ 60 -#define KEY_Space /* (SpaceBar) 0x39 */ 61 -#define KEY_CapsLock /* CapsLock 0x3a */ 30 -#define KEY_F1 /* F1 0x3b */ 112 -#define KEY_F2 /* F2 0x3c */ 113 -#define KEY_F3 /* F3 0x3d */ 114 -#define KEY_F4 /* F4 0x3e */ 115 -#define KEY_F5 /* F5 0x3f */ 116 -#define KEY_F6 /* F6 0x40 */ 117 -#define KEY_F7 /* F7 0x41 */ 118 -#define KEY_F8 /* F8 0x42 */ 119 -#define KEY_F9 /* F9 0x43 */ 120 -#define KEY_F10 /* F10 0x44 */ 121 -#define KEY_NumLock /* NumLock 0x45 */ 122 -#define KEY_ScrollLock /* ScrollLock 0x46 */ 125 -#define KEY_KP_7 /* 7 Home 0x47 */ 91 -#define KEY_KP_8 /* 8 Up 0x48 */ 96 -#define KEY_KP_9 /* 9 PgUp 0x49 */ 101 -#define KEY_KP_Minus /* - (Minus) 0x4a */ 105 -#define KEY_KP_4 /* 4 Left 0x4b */ 92 -#define KEY_KP_5 /* 5 0x4c */ 97 -#define KEY_KP_6 /* 6 Right 0x4d */ 102 -#define KEY_KP_Plus /* + (Plus) 0x4e */ 106 -#define KEY_KP_1 /* 1 End 0x4f */ 93 -#define KEY_KP_2 /* 2 Down 0x50 */ 98 -#define KEY_KP_3 /* 3 PgDown 0x51 */ 103 -#define KEY_KP_0 /* 0 Insert 0x52 */ 99 -#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 104 -#define KEY_SysReqest /* SysReqest 0x54 */ 124 - /* NOTUSED 0x55 */ -#define KEY_F11 /* F11 0x57 */ 122 -#define KEY_F12 /* F12 0x58 */ 123 - -#ifdef _notdef_ /* these keys appear not to exist on a US English keyboard */ -#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 -#define KEY_Prefix0 /* special 0x60 */ 96 -#define KEY_Prefix1 /* specail 0x61 */ 97 -#endif - -/* - * The 'scancodes' below are generated by the server, because the MF101/102 - * keyboard sends them as sequence of other scancodes - */ -#define KEY_Home /* Home 0x59 */ 80 -#define KEY_Up /* Up 0x5a */ 83 -#define KEY_PgUp /* PgUp 0x5b */ 85 -#define KEY_Left /* Left 0x5c */ 79 -#ifdef _notdef_ -#define KEY_Begin /* Begin 0x5d */ 93 -#endif -#define KEY_Right /* Right 0x5e */ 89 -#define KEY_End /* End 0x5f */ 81 -#define KEY_Down /* Down 0x60 */ 84 -#define KEY_PgDown /* PgDown 0x61 */ 86 -#define KEY_Insert /* Insert 0x62 */ 75 -#define KEY_Delete /* Delete 0x63 */ 76 -#define KEY_KP_Enter /* Enter 0x64 */ 106 -#define KEY_RCtrl /* Ctrl(right) 0x65 */ 64 -#define KEY_Pause /* Pause 0x66 */ 126 -#define KEY_Print /* Print 0x67 */ 124 -#define KEY_KP_Divide /* Divide 0x68 */ 95 -#define KEY_AltLang /* AtlLang(right) 0x69 */ 62 -#define KEY_Break /* Break 0x6a */ 126 -#ifdef _notdef_ -#define KEY_LMeta /* Left Meta 0x6b */ 60 -#define KEY_RMeta /* Right Meta 0x6c */ 62 -#define KEY_Menu /* Menu 0x6d */ 109 -#define KEY_F13 /* F13 0x6e */ 110 -#define KEY_F14 /* F14 0x6f */ 111 -#define KEY_F15 /* F15 0x70 */ 112 -#define KEY_F16 /* F16 0x71 */ 113 -#define KEY_F17 /* F17 0x72 */ 114 -#define KEY_KP_DEC /* KP_DEC 0x73 */ 115 -#endif - -#endif /* _SOL8KEYNAMES_H */ 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 deleted file mode 100644 index 1e46cf95d..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c +++ /dev/null @@ -1,30 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c,v 1.1 1999/09/25 14:38:10 dawes Exp $ */ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#include "X.h" -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -static int -SupportedInterfaces(void) -{ - /* XXX This needs to be checked. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - return p; -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c deleted file mode 100644 index c3afe0095..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c +++ /dev/null @@ -1,386 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c,v 1.2 1999/10/13 04:21:36 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sol8PostKbdEvents.c /main/46 1996/10/25 11:36:30 kaleb $ */ - -/* [JCH-96/01/21] Extended std reverse map to four buttons. */ - -#include "X.h" -#include "Xproto.h" -#include "misc.h" - -#include "compiler.h" - -#include "Xpoll.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSlib.h" - - -#ifdef XINPUT -#include "XI.h" -#include "XIproto.h" -#include "xf86Xinput.h" -#else -#include "inputstr.h" -#endif - -#include <sys/vuid_event.h> -#include "sol8_keynames.h" - -#ifdef XKB -extern Bool noXkbExtension; -#endif - -#define XE_POINTER 1 -#define XE_KEYBOARD 2 - -#ifdef XTESTEXT1 - -#define XTestSERVER_SIDE -#include "xtestext1.h" -extern short xtest_mousex; -extern short xtest_mousey; -extern int on_steal_input; -extern Bool XTestStealKeyData(); -extern void XTestStealMotionData(); - -#ifdef XINPUT -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - xf86eqEnqueue((ev)) -#else -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - mieqEnqueue((ev)) -#endif - -#define MOVEPOINTER(dx, dy, time) \ - if (on_steal_input) \ - XTestStealMotionData(dx, dy, XE_POINTER, xtest_mousex, xtest_mousey); \ - miPointerDeltaCursor (dx, dy, time) - -#else /* ! XTESTEXT1 */ - -#ifdef XINPUT -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - xf86eqEnqueue((ev)) -#else -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - mieqEnqueue((ev)) -#endif -#define MOVEPOINTER(dx, dy, time) \ - miPointerDeltaCursor (dx, dy, time) - -#endif - - -/* - * Static variables to handle auto-repeat of keyboard keys. - * (Only needed if not using XKB) - * - */ - -void sol8_setkbdinitiate(double value); -void sol8_setkbdrepeat(double value); -void sol8_startautorepeat(int keycode); -CARD32 sol8_processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg); - - -static int sol8AutoRepeatInitiate = 400; /* defaults .4 sec */ -static int sol8AutoRepeatDelay = 50; /* default of .05 sec */ - -static OsTimerPtr sol8Timer = NULL; - - -/* - * sol8PostKbdEvent -- - * Translate the raw hardware Firm_event into an XEvent, and tell DIX - * about it. KeyCode preprocessing and so on is done ... - * - * Most of the Solaris 8 stuff has whacked Panix/PC98 support in the - * interests of simplicity - DWH 8/30/99 - * - */ - -void sol8PostKbdEvent(Firm_event *event) -{ - int specialkey; - Bool down; - KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; - Bool updateLeds = FALSE; - Bool UsePrefix = FALSE; - Bool Direction = FALSE; - xEvent kevent; - KeySym *keysym; - int keycode; - static int lockkeys = 0; - -/* - * Give down a value - */ - - if(event->value == VKEY_DOWN) - down = TRUE; - else - down = FALSE; - - /* - * and now get some special keysequences - */ - - specialkey = event->id; - - if ((ModifierDown(ControlMask | AltMask)) || - (ModifierDown(ControlMask | AltLangMask))) - { - - switch (specialkey) { - - case KEY_BackSpace: - if (!xf86Info.dontZap) { -#ifdef XFreeXDGA - DGAShutdown(); -#endif - GiveUp(0); - } - break; - - /* - * The idea here is to pass the scancode down to a list of - * registered routines. There should be some standard conventions - * for processing certain keys. - */ - case KEY_KP_Minus: /* Keypad - */ - if (!xf86Info.dontZoom) { - if (down) xf86ZoomViewport(xf86Info.currentScreen, -1); - return; - } - break; - - case KEY_KP_Plus: /* Keypad + */ - if (!xf86Info.dontZoom) { - if (down) xf86ZoomViewport(xf86Info.currentScreen, 1); - return; - } - break; - } - } - - - /* - * Now map the scancodes to real X-keycodes ... - */ - keycode = event->id + MIN_KEYCODE; - keysym = (keyc->curKeySyms.map + - keyc->curKeySyms.mapWidth * - (keycode - keyc->curKeySyms.minKeyCode)); - -#ifdef XKB - if (noXkbExtension) { -#endif - /* - * Toggle lock keys. - */ -#define CAPSFLAG 0x01 -#define NUMFLAG 0x02 -#define SCROLLFLAG 0x04 -#define MODEFLAG 0x08 - -/* - * Handle the KeyPresses of the lock keys. - */ - - if(down) { - switch( keysym[0] ) { - case XK_Caps_Lock: - if(lockkeys & CAPSFLAG) { - lockkeys &= ~CAPSFLAG; - return; - } else { - lockkeys |= CAPSFLAG; - updateLeds = TRUE; - } - xf86Info.capsLock = down; - break; - - case XK_Num_Lock: - if(lockkeys & NUMFLAG) { - lockkeys &= ~NUMFLAG; - return; - } else { - lockkeys |= NUMFLAG; - updateLeds = TRUE; - } - xf86Info.numLock = down; - break; - - case XK_Scroll_Lock: - if(lockkeys & SCROLLFLAG) { - lockkeys &= ~SCROLLFLAG; - return; - } else { - lockkeys |= SCROLLFLAG; - updateLeds = TRUE; - } - xf86Info.scrollLock = down; - break; - } - } else { - -/* - * Handle the releases of the lock keys. - */ - switch( keysym[0] ) { - case XK_Caps_Lock: - if(lockkeys & CAPSFLAG) { - return; - } else { - updateLeds = TRUE; - } - xf86Info.capsLock = down; - break; - - case XK_Num_Lock: - if(lockkeys & NUMFLAG) { - return; - } else { - updateLeds = TRUE; - } - xf86Info.numLock = down; - break; - - case XK_Scroll_Lock: - if(lockkeys & SCROLLFLAG) { - return; - } else { - updateLeds = TRUE; - } - xf86Info.scrollLock = down; - break; - } - } - - if (updateLeds) xf86KbdLeds(); -#ifdef XKB - } -#endif - -/* - * If this keycode is not a modifier key, and its down - * initiate the autorepeate sequence. - * (Only necessary if not using XKB) - * - * If its not down, then reset the timer - */ -#ifdef XKB - if(noXkbExtension) { -#endif - if( !keyc->modifierMap[keycode] ) { - if( down ) { - sol8_startautorepeat(keycode); - } else { - TimerFree(sol8Timer); - sol8Timer = NULL; - } - } -#ifdef XKB - } -#endif - - xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis(); - - /* - * And now send these prefixes ... - * NOTE: There cannot be multiple Mode_Switch keys !!!! - */ - - ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); -} - -/* - * Autorepeat stuff - * - */ - -void sol8_setkbdinitiate(double value) -{ - sol8AutoRepeatInitiate = value * 1000; - return; -} - -void sol8_setkbdrepeat(double value) -{ - sol8AutoRepeatDelay = value * 1000; - return; -} - - -void sol8_startautorepeat(int keycode) -{ - - sol8Timer = TimerSet( - sol8Timer, /* Timer */ - 0, /* Flags */ - sol8AutoRepeatInitiate, /* millis */ - (OsTimerCallback) sol8_processautorepeat, /* callback */ - (pointer) keycode); /* arg for timer */ - return; -} - - -CARD32 sol8_processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg) -{ - xEvent kevent; - int keycode; - - keycode = (int)arg; - - xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis(); - - /* - * Repeat a key by faking a KeyRelease, and a KeyPress event in rapid - * succession - */ - - ENQUEUE(&kevent, keycode, KeyRelease, XE_KEYBOARD); - ENQUEUE(&kevent, keycode, KeyPress, XE_KEYBOARD); - - /* And return the appropriate value so we get rescheduled */ - return(sol8AutoRepeatDelay); - -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c deleted file mode 100644 index d35883ca4..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c +++ /dev/null @@ -1,203 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_vid.c,v 1.1 1999/09/25 14:38:11 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: sol8_vid.c /main/4 1996/02/21 17:54:20 kaleb $ */ - -#include "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#undef usleep -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -char *apertureDevName = NULL; - -Bool -xf86LinearVidMem() -{ - - int mmapFd; - - apertureDevName = "/dev/xsvc"; - if ((mmapFd = open(apertureDevName, O_RDWR)) < 0) - { - xf86Msg(X_WARNING, - "xf86LinearVidMem: failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - xf86Msg(X_WARNING, - "xf86LinearVidMem: /dev/xsvc device driver required\n"); - xf86Msg(X_WARNING, - "xf86LinearVidMem: linear memory access disabled\n"); - return FALSE; - } - close(mmapFd); - return TRUE; - -} - -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - pointer base; - int fd; - - /* - * Solaris 2.8 7/26/99 - * Use /dev/xsvc for everything - * - * DWH - 7/26/99 - Solaris8/dev/xsvc changes - */ - - if (!apertureDevName) - if (!xf86LinearVidMem()) - FatalError("xf86MapVidMem: Could not mmap " - "linear framebuffer [s=%x,a=%x]\n", - Size, Base); - - - if ((fd = open(apertureDevName, O_RDWR,0)) < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - } - base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)Base); - close(fd); - if (base == MAP_FAILED) - { - FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - } - return(base); -} - -/* ARGSUSED */ -void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap(Base, Size); -} - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -static Bool ExtendedEnabled = FALSE; - -void -xf86EnableIO() -{ - - if (ExtendedEnabled) - return; - - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - FatalError("%s: Failed to set IOPL for I/O\n", - "xf86EnableIOPorts"); - } - - ExtendedEnabled = TRUE; - return; -} - -void -xf86DisableIO() -{ - if(!ExtendedEnabled) - return; - - sysi86(SI86V86, V86SC_IOPL, 0); - - ExtendedEnabled = FALSE; - return; -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool xf86DisableInterrupts() -{ - if (!ExtendedEnabled) - { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - return(FALSE); - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - sysi86(SI86V86, V86SC_IOPL, 0); - } - return(TRUE); -} - -void xf86EnableInterrupts() -{ - if (!ExtendedEnabled) - { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - return; - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - sysi86(SI86V86, V86SC_IOPL, 0); - } - return; -} - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, - unsigned long Size) -{ -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile deleted file mode 100644 index 66a49289d..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile +++ /dev/null @@ -1,53 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/Imakefile,v 3.18 2000/08/15 16:05:40 dawes Exp $ - - - - - -XCOMM $XConsortium: Imakefile /main/5 1996/09/28 17:24:30 rws $ - -#include <Server.tmpl> - -#if !HasGcc -PROWORKS_INOUT_SRC = solx86_iout.s -PROWORKS_INOUT_OBJ = solx86_iout.o -#endif - -MOUSESRC = solx86_mouse.c -MOUSEOBJ = solx86_mouse.o - -SRCS = solx86_init.c solx86_vid.c solx86_bios.c sysv_io.c \ - VTsw_usl.c sysv_kbd.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ - libc_wrapper.c $(PROWORKS_INOUT_SRC) stdResource.c stdPci.c \ - sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c - -OBJS = solx86_init.o solx86_vid.o solx86_bios.o sysv_io.o \ - VTsw_usl.o sysv_kbd.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - libc_wrapper.o $(PROWORKS_INOUT_OBJ) stdResource.o stdPci.o \ - sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalAsmObjectRule() - -LinkSourceFile(VTsw_usl.c,../shared) -LinkSourceFile(sysv_kbd.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(sysv_io.c,../sysv) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c b/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c deleted file mode 100644 index 09ac321a8..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_bios.c,v 1.2 1999/07/18 15:37:25 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#undef usleep -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -extern char *apertureDevName; - -/* - * Read BIOS via mmap()ing physical memory. - */ -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int fd; - unsigned char *ptr; - char solx86_vtname[20]; - int psize; - int mlen; - - /* - * Solaris 2.1 x86 SVR4 (10/27/93) - * The server must treat the virtual terminal device file - * as the standard SVR4 /dev/pmem. By default, then used VT - * is considered the "default" file to open. - */ - if (Base < 0xFFFFF) - sprintf(solx86_vtname,"/dev/vt%02d",xf86Info.vtno); - else - { - if (!apertureDevName) - if (!xf86LinearVidMem()) - FatalError("xf86ReadBIOS: Could not mmap " - "BIOS [a=%x]\n", Base); - sprintf(solx86_vtname, apertureDevName); - } - - if ((fd = open(solx86_vtname, O_RDONLY)) < 0) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n", - solx86_vtname, strerror(errno)); - return(-1); - } - psize = xf86getpagesize(); - mlen = (Offset + Len + psize - 1) & ~psize; - /* Base is assumed to be page-aligned. */ - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, fd, (off_t)Base); - if (ptr == MAP_FAILED) - { - xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed\n", - solx86_vtname); - close(fd); - return(-1); - } - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); - (void)close(fd); - return(Len); -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c b/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c deleted file mode 100644 index 1b29819b5..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c +++ /dev/null @@ -1,387 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_init.c,v 3.5 1998/07/25 16:57:04 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: solx86_init.c /main/4 1996/02/21 17:54:10 kaleb $ */ - -#include <signal.h> -#include <sys/time.h> -#include <unistd.h> - -#include "X.h" -#include "Xmd.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -static Bool KeepTty = FALSE; -#ifdef SVR4 -static Bool Protect0 = FALSE; -#endif -static int VTnum = -1; -static int xf86StartVT = -1; - -#define MAX_SECONDS 60 -#define USEC_IN_SEC (unsigned long)1000000 - -int xf86_solx86usleep(unsigned long); -static void xf86_solx86sleep(int); - -void -xf86OpenConsole() -{ - int fd; - struct vt_mode VT; - struct vt_stat vtinfo; - char vtname1[10]; - int i, FreeVTslot; - MessageType from = X_PROBED; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* Protect page 0 to help find NULL dereferencing */ - /* mprotect() doesn't seem to work */ - if (Protect0) - { - int fd = -1; - - if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: cannot open /dev/zero (%s)\n", - strerror(errno)); - } - else - { - if ((int)mmap(0, 0x1000, PROT_NONE, - MAP_FIXED | MAP_SHARED, fd, 0) == -1) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: failed to protect page 0 (%s)\n", - strerror(errno)); - } - close(fd); - } - } - /* - * setup the virtual terminal manager - */ - if (VTnum != -1) - { - xf86Info.vtno = VTnum; - from = X_CMDLINE; - } - else - { - if ((fd = open("/dev/vt00",O_RDWR,0)) < 0) - { - FatalError( - "xf86OpenConsole: Cannot open /dev/vt00 (%s)\n", - strerror(errno)); - } - if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) - { - FatalError("xf86OpenConsole: Cannot determine current VT\n"); - } - xf86StartVT=vtinfo.v_active; - -/* There is a SEVERE problem with x86's VT's the VT_OPENQRY ioctl() - * will panic the entire system if all 8 (7 VT's+Console) terminals - * are used. - * The only other way I've found to determine if there is a free - * is to try activating all the the available VT's and see if they - * all succeed - if they do, there there is not a free VT, and - * the Xserver cannot continue with out panic'ing the system. - * (Its ugly, however, it seems to work) - * Note there is a possible race condition here, btw. - * - * David Holland 2/23/94 - */ - - FreeVTslot = 0; - for(i=7; (i>=0) && (!FreeVTslot); i--) - if (ioctl(fd, VT_ACTIVATE, i) != 0) - FreeVTslot = 1; - - if(!FreeVTslot) - { - FatalError("xf86OpenConsole: Cannot find a free VT\n"); - } - - if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || - (xf86Info.vtno == -1)) - { - FatalError("xf86OpenConsole: Cannot find a free VT\n"); - } - close(fd); - } - xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); - - sprintf(vtname1,"/dev/vt%02d",xf86Info.vtno); /* Solaris 2.1 x86 */ - - if (!KeepTty) - { - setpgrp(); - } - - if (((xf86Info.consoleFd = open(vtname1, O_RDWR | O_NDELAY, 0)) < 0)) - { - FatalError("xf86OpenConsole: Cannot open %s (%s)\n", - vtname1, strerror(errno)); - } - - /* change ownership of the vt */ - chown(vtname1, getuid(), getgid()); - - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); - } - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_GETMODE failed\n"); - } - - signal(SIGUSR1, xf86VTRequest); - - VT.mode = VT_PROCESS; - VT.relsig = SIGUSR1; - VT.acqsig = SIGUSR1; - - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); - } - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) - { - FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n"); - } - } - else - { - /* serverGeneration != 1 */ - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); - } - /* - * If the server doesn't have the VT when the reset occurs, - * this is to make sure we don't continue until the activate - * signal is received. - */ - if (!xf86Screens[0]->vtSema) - sleep(5); - } - return; -} - -void xf86CloseConsole() -{ - struct vt_mode VT; - char *console = "/dev/vt00"; - int console_fd; - - /* - * Solaris 2.1 x86 doesnt seem to "switch" back to the console - * when the VT is relinquished and its mode is reset to auto. - * Also, Solaris 2.1 also seems to associate vt00 with the - * console so I've opened the "console" back up and made it - * the active vt again in text mode and then closed it. - * There must be a better hack for this but I'm not aware of - * one at this time. - * - * Doug Anson 11/6/93 - * danson@lgc.com - * - * Fixed - 12/5/93 - David Holland - davidh@dorite.use.com - * Did the whole thing similarly to the way linux does it - */ - - /* reset the display back to text mode */ - - ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */ - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) - { - VT.mode = VT_AUTO; - ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ - } - - /* Activate the VT that X was started on */ - - ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT); - close(xf86Info.consoleFd); /* make the vt-manager happy */ - return; -} - -int xf86ProcessArgument(argc, argv, i) -int argc; -char *argv[]; -int i; -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } - /* - * Undocumented flag to protect page 0 from read/write to help - * catch NULL pointer dereferences. This is purely a debugging - * flag. - */ - if (!strcmp(argv[i], "-protect0")) - { - Protect0 = TRUE; - return(1); - } - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0) - { - UseMsg(); - VTnum = -1; - return(0); - } - return(1); - } - return(0); -} - -void xf86UseMsg() -{ - ErrorF("vtXX use the specified VT number\n"); - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} - -/* - * xf86_solx86usleep() - Solaris 2.1 x86 does not have a suitable - * replacement (SYSV) for usleep. Although - * usleep exists in the BSD compatiblity libs - * I dont want to use those libs if possible. - * - * Doug Anson - * danson@lgc.com - */ -int -xf86_solx86usleep(unsigned long usec) -{ - int retval = 0; - struct itimerval naptime; - struct itimerval savetime; - unsigned long useconds = 0; - unsigned long seconds = 0; - int i; - unsigned long tmp; - -/* - * WHY DOESN'T THIS SIMPLY DO A select() WITH NO FILE DESCRIPTORS? - */ - - /* this time will allow a max of MAX_SECONDS seconds sleeping */ - for(i=MAX_SECONDS;i>=0;--i) - { - tmp = (unsigned long)((unsigned long)(i)*USEC_IN_SEC); - if (tmp <= usec) - { - seconds = i; - if (i == MAX_SECONDS) - useconds = 0; - else - useconds = (unsigned long)(usec - tmp); - i = -1; - } - } - - /* get the current time */ - if ((retval=getitimer(ITIMER_REAL,&savetime)) == 0) - { - /* set the itimer to reflect requested time to sleep */ - naptime.it_value.tv_sec = savetime.it_value.tv_sec + seconds; - naptime.it_value.tv_usec = savetime.it_value.tv_usec + useconds; - - /* specify a one-shot clock */ - naptime.it_interval.tv_usec = 0; - naptime.it_interval.tv_sec = 0; - - /* redisposition SIGALRM */ - signal(SIGALRM,xf86_solx86sleep); - - /* use SIGLARM */ - if ((retval=setitimer(ITIMER_REAL,&naptime,NULL)) == 0) - /* now just pause */ - retval = pause(); - - /* restore the timer */ - retval = setitimer(ITIMER_REAL,&savetime,NULL); - - /* restore the SIGALRM disposition */ - signal(SIGALRM,SIG_DFL); - } - - /* return the return value */ - return retval; -} - -/* - * xf86_solx86sleep() - This function is a NOP disposition for - * the SIGALRM that is used to implement - * usleep() in Solaris 2.1 x86. - * - * Doug Anson - * danson@lgc.com - */ -static void -xf86_solx86sleep(int signo) -{ - /* do nothing */ - return; -} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s b/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s deleted file mode 100644 index 5484653a9..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s +++ /dev/null @@ -1,104 +0,0 @@ -/ $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_iout.s,v 3.1 1996/12/23 06:51:18 dawes Exp $ -/ -/ -/ -/ -/ $XConsortium: solx86_iout.s /main/4 1996/02/21 17:54:14 kaleb $ -/ -/ File: solx86_iout.s -/ -/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions -/ for Solaris x86 using the ProWorks compiler by SunPro -/ -/ Author: Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com) -/ Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com) -/ -/ Synopsis: (c callable external declarations) -/ extern unsigned char inb(int port); -/ extern unsigned short inw(int port); -/ extern unsigned long inl(int port); -/ extern void outb(int port, unsigned char value); -/ extern void outw(int port, unsigned short value); -/ extern void outl(int port, unsigned long value); - - -.file "solx86_iout.s" -.text - -.globl inb -.globl inw -.globl inl -.globl outb -.globl outw -.globl outl - -/ -/ unsigned char inb(int port); -/ -.align 4 -inb: - movl 4(%esp),%edx - subl %eax,%eax - inb (%dx) - ret -.type inb,@function -.size inb,.-inb - -/ -/ unsigned short inw(int port); -/ -.align 4 -inw: - movl 4(%esp),%edx - subl %eax,%eax - inw (%dx) - ret -.type inw,@function -.size inw,.-inw - -/ -/ unsigned long inl(int port); -/ -.align 4 -inl: - movl 4(%esp),%edx - inl (%dx) - ret -.type inl,@function -.size inl,.-inl - -/ -/ void outb(int port, unsigned char value); -/ -.align 4 -outb: - movl 4(%esp),%edx - movl 8(%esp),%eax - outb (%dx) - ret -.type outb,@function -.size outb,.-outb - -/ -/ void outw(int port, unsigned short value); -/ -.align 4 -outw: - movl 4(%esp),%edx - movl 8(%esp),%eax - outw (%dx) - ret -.type outw,@function -.size outw,.-outw - -/ -/ void outl(int port, unsigned long value); -/ -.align 4 -outl: - movl 4(%esp),%edx - movl 8(%esp),%eax - outl (%dx) - ret -.type outl,@function -.size outl,.-outl diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c b/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c deleted file mode 100644 index eb12834fb..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c +++ /dev/null @@ -1,99 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_misc.c,v 1.2 1998/07/25 16:57:05 dawes Exp $ */ - -/* - * Copyright 1995-1997 by The XFree86 Project, Inc - */ - -#include <signal.h> -#include <sys/time.h> -#include <unistd.h> - -#define MAX_SECONDS 60 -#define USEC_IN_SEC (unsigned long)1000000 - -int xf86_solx86usleep(unsigned long); -static void xf86_solx86sleep(int); - -/* - * xf86_solx86usleep() - Solaris 2.1 x86 does not have a suitable - * replacement (SYSV) for usleep. Although - * usleep exists in the BSD compatiblity libs - * I dont want to use those libs if possible. - * - * Doug Anson - * danson@lgc.com - */ -int -xf86_solx86usleep(unsigned long usec) -{ - int retval = 0; - struct itimerval naptime; - struct itimerval savetime; - unsigned long useconds = 0; - unsigned long seconds = 0; - int i; - unsigned long tmp; - -/* - * WHY DOESN'T THIS SIMPLY DO A select() WITH NO FILE DESCRIPTORS? - */ - - /* this time will allow a max of MAX_SECONDS seconds sleeping */ - for(i=MAX_SECONDS;i>=0;--i) - { - tmp = (unsigned long)((unsigned long)(i)*USEC_IN_SEC); - if (tmp <= usec) - { - seconds = i; - if (i == MAX_SECONDS) - useconds = 0; - else - useconds = (unsigned long)(usec - tmp); - i = -1; - } - } - - /* get the current time */ - if ((retval=getitimer(ITIMER_REAL,&savetime)) == 0) - { - /* set the itimer to reflect requested time to sleep */ - naptime.it_value.tv_sec = savetime.it_value.tv_sec + seconds; - naptime.it_value.tv_usec = savetime.it_value.tv_usec + useconds; - - /* specify a one-shot clock */ - naptime.it_interval.tv_usec = 0; - naptime.it_interval.tv_sec = 0; - - /* redisposition SIGALRM */ - signal(SIGALRM,xf86_solx86sleep); - - /* use SIGLARM */ - if ((retval=setitimer(ITIMER_REAL,&naptime,NULL)) == 0) - /* now just pause */ - retval = pause(); - - /* restore the timer */ - retval = setitimer(ITIMER_REAL,&savetime,NULL); - - /* restore the SIGALRM disposition */ - signal(SIGALRM,SIG_DFL); - } - - /* return the return value */ - return retval; -} - -/* - * xf86_solx86sleep() - This function is a NOP disposition for - * the SIGALRM that is used to implement - * usleep() in Solaris 2.1 x86. - * - * Doug Anson - * danson@lgc.com - */ -static void -xf86_solx86sleep(int signo) -{ - /* do nothing */ - return; -} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c b/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c deleted file mode 100644 index 663593467..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c +++ /dev/null @@ -1,30 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_mouse.c,v 1.2 1999/06/12 15:37:12 dawes Exp $ */ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#include "X.h" -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -static int -SupportedInterfaces(void) -{ - /* XXX This needs to be checked. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - return p; -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c b/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c deleted file mode 100644 index cca4e4356..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c +++ /dev/null @@ -1,227 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/solx86/solx86_vid.c,v 3.15 1999/07/18 14:50:18 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: solx86_vid.c /main/4 1996/02/21 17:54:20 kaleb $ */ - -#include "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#undef usleep -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -char *apertureDevName = NULL; - -Bool -xf86LinearVidMem() -{ - - int mmapFd; - - apertureDevName = "/dev/xsvc"; - if ((mmapFd = open(apertureDevName, O_RDWR)) < 0) - { - apertureDevName = "/dev/fbs/aperture"; - if((mmapFd = open(apertureDevName, O_RDWR)) < 0) - { - xf86Msg(X_WARNING, - "xf86LinearVidMem: failed to open %s (%s)\n", - apertureDevName, strerror(errno)); - xf86Msg(X_WARNING, "xf86LinearVidMem: either /dev/fbs/aperture, or /dev/xsvc device " - "driver required\n"); - xf86Msg(X_WARNING, - "xf86LinearVidMem: linear memory access disabled\n"); - return FALSE; - } - } - close(mmapFd); - return TRUE; - -} - -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - pointer base; - int fd; - char solx86_vtname[20]; - - /* - * Solaris 2.1 x86 SVR4 (10/27/93) - * The server must treat the virtual terminal device file - * as the standard SVR4 /dev/pmem. - * - * Uning the /dev/vtXX device as /dev/pmem only works for the - * A0000-FFFFF region - If we wish you mmap the linear aperture - * it requires a device driver. - * - * So what we'll do is use /dev/vtXX for the A0000-FFFFF stuff, and - * try to use the /dev/fbs/aperture or /dev/xsvc driver if the server - * tries to mmap anything > FFFFF - * its very very unlikely that the server will try to mmap - * anything below FFFFF that can't be handled by /dev/vtXX. - * - * DWH - 2/23/94 - * DWH - 1/31/99 (Gee has it really been 5 years?) - */ - - if(Base < 0xFFFFF) - sprintf(solx86_vtname,"/dev/vt%02d",xf86Info.vtno); - else - - { - if (!apertureDevName) - if (!xf86LinearVidMem()) - FatalError("xf86MapVidMem: Could not mmap " - "linear framebuffer [s=%x,a=%x]\n", - Size, Base); - - sprintf(solx86_vtname, apertureDevName); - } - - if ((fd = open(solx86_vtname, O_RDWR,0)) < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - solx86_vtname, strerror(errno)); - } - base = mmap((caddr_t)0, Size, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, (off_t)Base); - close(fd); - if (base == MAP_FAILED) - { - FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - } - return(base); -} - -/* ARGSUSED */ -void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap(Base, Size); -} - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -static Bool ExtendedEnabled = FALSE; - -void -xf86EnableIO() -{ - - if (ExtendedEnabled) - return; - - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - FatalError("%s: Failed to set IOPL for I/O\n", - "xf86EnableIOPorts"); - } - - ExtendedEnabled = TRUE; - return; -} - -void -xf86DisableIO() -{ - if(!ExtendedEnabled) - return; - - sysi86(SI86V86, V86SC_IOPL, 0); - - ExtendedEnabled = FALSE; - return; -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool xf86DisableInterrupts() -{ - if (!ExtendedEnabled) - { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - return(FALSE); - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - sysi86(SI86V86, V86SC_IOPL, 0); - } - return(TRUE); -} - -void xf86EnableInterrupts() -{ - if (!ExtendedEnabled) - { - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) - { - return; - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - sysi86(SI86V86, V86SC_IOPL, 0); - } - return; -} - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, - unsigned long Size) -{ -} - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile index 04b459979..ede2a80d2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile @@ -1,34 +1,37 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile,v 1.8 2000/05/23 04:47:49 dawes Exp $ - -#if DoLoadableServer -#define IHaveSubdirs -SUBDIRS = module -#endif +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/Imakefile,v 1.10 2001/08/17 22:08:15 tsi Exp $ +#define IHaveModules #include <Server.tmpl> -SRCS = vbe.c vbe_module.c +#if DoLoadableServer +MODSRC = vbe_module.c +MODOBJ = vbe_module.o +#endif -OBJS = vbe.o vbe_module.o +SRCS = vbe.c $(MODSRC) +OBJS = vbe.o $(MODOBJ) INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XF86SRC)/int10 -I$(XF86SRC)/ddc \ -I$(XF86SRC)/i2c +ModuleObjectRule() + #if DoLoadableServer -#define IHaveSubdirs -SUBDIRS = module -#endif + +LibraryModuleTarget(vbe, $(OBJS)) +InstallLibraryModule(vbe,$(MODULEDIR),.) + +#else SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -#if DoLoadableServer -ForceSubdirs($(SUBDIRS)) -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) #endif DependTarget() +InstallDriverSDKLibraryModule(vbe,$(DRIVERSDKMODULEDIR),.) + +InstallDriverSDKNonExecFile(vbe.h,$(DRIVERSDKINCLUDEDIR)) + diff --git a/xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile deleted file mode 100644 index 8b67bc852..000000000 --- a/xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile +++ /dev/null @@ -1,31 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/module/Imakefile,v 1.1 2000/04/05 18:13:57 dawes Exp $ - -#define IHaveModules -#include <Server.tmpl> - -SRCS = vbe.c vbe_module.c - -OBJS = vbe.o vbe_module.o - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XF86SRC)/int10 -I$(XF86SRC)/ddc \ - -I$(XF86SRC)/i2c - -LinkSourceFile(vbe.c,..) -LinkSourceFile(vbe.h,..) -LinkSourceFile(vbe_module.c,..) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -LibraryModuleTarget(vbe, $(OBJS)) - -InstallLibraryModule(vbe,$(MODULEDIR),.) - -DependTarget() - -InstallDriverSDKLibraryModule(vbe,$(DRIVERSDKMODULEDIR),.) - -InstallDriverSDKNonExecFile(vbe.h,$(DRIVERSDKINCLUDEDIR)) - diff --git a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c index 57f994856..392ffef15 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.16 2001/05/04 19:05:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.17 2001/07/14 19:38:29 paulo Exp $ */ /* * XFree86 vbe module @@ -212,11 +212,13 @@ vbeProbeDDC(vbeInfoPtr pVbe) } typedef enum { - VBEOPT_NOVBE + VBEOPT_NOVBE, + VBEOPT_NODDC } VBEOpts; static const OptionInfoRec VBEOptions[] = { { VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE }, + { VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -227,6 +229,7 @@ vbeReadEDID(vbeInfoPtr pVbe) pointer page = pVbe->memory; unsigned char *tmp = NULL; Bool novbe = FALSE; + Bool noddc = FALSE; int screen = pVbe->pInt10->scrnIndex; OptionInfoPtr options; @@ -236,8 +239,9 @@ vbeReadEDID(vbeInfoPtr pVbe) (void)memcpy(options, VBEOptions, sizeof(VBEOptions)); xf86ProcessOptions(screen, xf86Screens[screen]->options, options); xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); + xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); xfree(options); - if (novbe) return NULL; + if (novbe || noddc) return NULL; if (!vbeProbeDDC(pVbe)) goto error; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h index 6f726250a..692d107b2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h @@ -26,7 +26,7 @@ * * Author: Rickard E. (Rik) Faith <faith@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.14.2.1 2001/06/01 02:24:18 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.15 2001/06/01 02:10:06 dawes Exp $ * */ diff --git a/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c b/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c index 8eeb95169..d49540c51 100644 --- a/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c +++ b/xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.50 2001/05/10 22:18:57 dbateman Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.52 2001/08/18 02:51:21 dawes Exp $ */ /* * @@ -10,9 +10,7 @@ * */ -#if !defined(AMOEBA) && !defined(MINIX) #define _NEED_SYSI86 -#endif #include "X.h" #include "misc.h" @@ -30,7 +28,10 @@ #define SAVE_FONT1 #endif -#if defined(Lynx) || defined(CSRG_BASED) || defined(MACH386) || defined(linux) || defined(AMOEBA) || defined(MINIX) || defined(__QNX__) || defined(sun) || defined(__GNU__) +/* + * These used to be OS-specific, which made this module have an undesirable + * OS dependency. Define them by default for all platforms. + */ #ifndef NEED_SAVED_CMAP #define NEED_SAVED_CMAP #endif @@ -40,7 +41,6 @@ #ifndef SAVE_FONT2 #define SAVE_FONT2 #endif -#endif /* bytes per plane to save for text */ #define TEXT_AMOUNT 16384 @@ -652,8 +652,10 @@ vgaHWSaveScreen(ScreenPtr pScreen, int mode) on = xf86IsUnblank(mode); +#if 0 if (on) SetTimeSinceLastInputEvent(); +#endif if ((pScrn != NULL) && pScrn->vtSema) { vgaHWBlankScreen(pScrn, on); diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c index 89d735f1d..5237e8b2c 100644 --- a/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c +++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.33 2001/05/15 18:22:23 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.35 2001/07/19 18:50:16 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -87,6 +87,10 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif + + /* Return successfully if no acceleration wanted */ + if (!infoRec) + return TRUE; if (XAAGeneration != serverGeneration) { if ( ((XAAScreenIndex = AllocateScreenPrivateIndex()) < 0) || @@ -535,6 +539,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth) pPriv->flags = OFFSCREEN; pPriv->offscreenArea = area; + pPriv->freeData = FALSE; pLink->next = infoRec->OffscreenPixmaps; pLink->pPix = pPix; @@ -550,6 +555,7 @@ BAILOUT: pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); pPriv->flags = 0; pPriv->offscreenArea = NULL; + pPriv->freeData = FALSE; if(!w || !h) /* either scratch or shared memory */ pPriv->flags |= SHARED_PIXMAP; } @@ -565,22 +571,35 @@ XAADestroyPixmap(PixmapPtr pPix) XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix); Bool ret; - if((pPix->refcnt == 1) && (pPriv->flags & OFFSCREEN)) { - if(pPriv->flags & DGA_PIXMAP) - xfree(pPriv->offscreenArea); - else { - FBAreaPtr area = pPriv->offscreenArea; - if(!area) { + if(pPix->refcnt == 1) { + if(pPriv->flags & OFFSCREEN) { + if(pPriv->flags & DGA_PIXMAP) + xfree(pPriv->offscreenArea); + else { + FBAreaPtr area = pPriv->offscreenArea; PixmapLinkPtr pLink = infoRec->OffscreenPixmaps; - while(pLink->pPix != pPix) + PixmapLinkPtr prev = NULL; + + while(pLink->pPix != pPix) { + prev = pLink; pLink = pLink->next; - xfree(pPix->devPrivate.ptr); - area = pLink->area; - } - xf86FreeOffscreenArea(area); - pPriv->offscreenArea = NULL; - DELIST_OFFSCREEN_PIXMAP(pPix); - } + } + + if(prev) prev->next = pLink->next; + else infoRec->OffscreenPixmaps = pLink->next; + + if(!area) area = pLink->area; + + xf86FreeOffscreenArea(area); + pPriv->offscreenArea = NULL; + xfree(pLink); + } + } + + if(pPriv->freeData) { /* pixmaps that were once in video ram */ + xfree(pPix->devPrivate.ptr); + pPix->devPrivate.ptr = NULL; + } } XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap); diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c index 01710212f..f604c4cce 100644 --- a/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c +++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.12 2001/04/21 23:32:56 mvojkovi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.14 2001/06/03 19:47:59 mvojkovi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -191,8 +191,9 @@ XAADoComposite ( XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); RegionRec region; CARD32 *formats; + int flags = 0; BoxPtr pbox; - int nbox; + int nbox, w, h; if(!REGION_NUM_RECTS(pDst->pCompositeClip)) return TRUE; @@ -227,7 +228,7 @@ XAADoComposite ( /* pull out color expandable operations here */ if((pMask->format == PICT_a1) && (alpha == 0xffff) && - (op == PictOpOver) && infoRec->WriteBitmap && + (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat && !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) && (!(infoRec->WriteBitmapFlags & RGB_EQUAL) || (red == green == blue))) @@ -269,12 +270,27 @@ XAADoComposite ( return TRUE; } + if(!(formats = infoRec->CPUToScreenAlphaTextureFormats)) + return FALSE; + + w = pMask->pDrawable->width; + h = pMask->pDrawable->height; + + if(pMask->repeat) { + if((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE) || + ((infoRec->CPUToScreenAlphaTextureFlags & + XAA_RENDER_POWER_OF_2_TILE_ONLY) && + ((h & (h - 1)) || (w & (w - 1))))) + { + return FALSE; + } + flags |= XAA_RENDER_REPEAT; + } + if((alpha != 0xffff) && (infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA)) return FALSE; - formats = infoRec->CPUToScreenAlphaTextureFormats; - while(*formats != pMask->format) { if(!(*formats)) return FALSE; formats++; @@ -297,7 +313,7 @@ XAADoComposite ( op, red, green, blue, alpha, pMask->format, ((PixmapPtr)(pMask->pDrawable))->devPrivate.ptr, ((PixmapPtr)(pMask->pDrawable))->devKind, - pMask->pDrawable->width, pMask->pDrawable->height, 0)) + w, h, flags)) { REGION_UNINIT(pScreen, ®ion); return FALSE; @@ -319,7 +335,23 @@ XAADoComposite ( return TRUE; } } else { - formats = infoRec->CPUToScreenTextureFormats; + if(!(formats = infoRec->CPUToScreenTextureFormats)) + return FALSE; + + w = pSrc->pDrawable->width; + h = pSrc->pDrawable->height; + + if(pSrc->repeat) { + if((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) || + ((infoRec->CPUToScreenTextureFlags & + XAA_RENDER_POWER_OF_2_TILE_ONLY) && + ((h & (h - 1)) || (w & (w - 1))))) + { + return FALSE; + } + flags |= XAA_RENDER_REPEAT; + } + while(*formats != pSrc->format) { if(!(*formats)) return FALSE; @@ -339,12 +371,11 @@ XAADoComposite ( return TRUE; } - if(!(infoRec->SetupForCPUToScreenTexture)(infoRec->pScrn, op, pSrc->format, ((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr, ((PixmapPtr)(pSrc->pDrawable))->devKind, - pSrc->pDrawable->width, pSrc->pDrawable->height, 0)) + w, h, flags)) { REGION_UNINIT(pScreen, ®ion); return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile index 7be07bcc7..b8faa8ef7 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile @@ -1,10 +1,10 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.18 2001/04/22 08:36:31 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.20 2001/07/09 23:45:24 paulo Exp $ XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic #if DoLoadableServer -LDSRCS = libc_wrapper.c loader.c -LDOBJS = libc_wrapper.o loader.o +LDSRCS = libc_wrapper.c loader.c loadmod.c +LDOBJS = libc_wrapper.o loader.o loadmod.o #endif #if HasNCurses @@ -83,7 +83,8 @@ AllTarget(ProgramTargetName($(PROG))) LOADERLIB = -L../loader -lxloader -L../dummylib -ldummy MODULEDEFINES = -DUSE_MODULES INCLUDES = -I../common -I../loader -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(FONTLIBSRC)/include #if !HasSnprintf SNPRINTF_DEFS = -DNEED_SNPRINTF #endif diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad index 871d7c227..615b6165d 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.13 2001/05/15 18:22:23 paulo Exp $ +!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.14 2001/06/23 01:45:56 paulo Exp $ !! *Form.background: gray85 @@ -469,6 +469,8 @@ XF86Cfg.translations: #override \ <Message>WM_PROTOCOLS: error-cancel() .xf86cfg.force.translations: #override \ <Message>WM_PROTOCOLS: addmode-cancel() +.xf86cfg.addMode.translations: #override \ +<Message>WM_PROTOCOLS: addmode-cancel() .xf86cfg.accessx.translations: #override \ <Message>WM_PROTOCOLS: accessx-close() .xf86cfg.test.translations: #override \ @@ -818,6 +820,16 @@ Press ESC if your monitor goes out of sync. .xf86cfg.force.maxHeight: 58 .xf86cfg.force.?.label: There is already a modeline with the\n\ specified identifier. Add anyway? + +.xf86cfg.addMode.geometry: 350x80 +.xf86cfg.addMode.minWidth: 350 +.xf86cfg.addMode.maxWidth: 350 +.xf86cfg.addMode.minHeight: 80 +.xf86cfg.addMode.maxHeight: 80 +.xf86cfg.addMode.?.label: XF86VidModeAddModeLine returned True,\n\ +but no modeline was added to the current Screen.\n\ +Do you want to add it to the Monitor section? + .xf86cfg.test.?.label: \ Testing modeline...\n\n\ Press ESC or stop button to quit. .xf86cfg.test.geometry: 250x72 diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c index f50925dbc..3802131cf 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.6.2.2 2001/05/23 14:45:15 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.10 2001/07/06 19:35:10 paulo Exp $ */ #include "xf86config.h" @@ -266,6 +266,9 @@ CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data) XtSetValues(filter, args, 1); card_entry = LookupCard(info->string); + if (card_entry == NULL) + return; + len = XmuSnprintf(tip, sizeof(tip), "Name: %s\n", card_entry->name); if (card_entry->flags & F_UNSUPPORTED) len += XmuSnprintf(tip + len, sizeof(tip) - len, @@ -307,11 +310,9 @@ CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data) first = 0; #ifndef USE_MODULES - if (!nomodules) { - XtSetArg(args[0], XtNstring, - card_entry->driver ? card_entry->driver : "vga"); - XtSetValues(driver, args, 1); - } + XtSetArg(args[0], XtNstring, + card_entry->driver ? card_entry->driver : "vga"); + XtSetValues(driver, args, 1); #endif str = XtNewString(tip); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h index e7ef66767..f33d1b87d 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.10.2.1 2001/05/21 22:24:02 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.15 2001/08/17 22:08:15 tsi Exp $ */ #include <X11/IntrinsicP.h> @@ -37,14 +37,11 @@ #include <dirent.h> #include <string.h> #include <unistd.h> +#if defined(sun) && defined(SVR4) +#include <strings.h> +#endif -#if NeedVarargsPrototypes #include <stdarg.h> -#define Va_start(a,b) va_start(a,b) -#else -#include <varargs.h> -#define Va_start(a,b) va_start(a) -#endif #ifdef __EMX__ #define strcasecmp stricmp @@ -94,6 +91,12 @@ #define UNUSED 0 #define USED 1 +#define CONFIG_LAYOUT 0 +#define CONFIG_SCREEN 1 +#define CONFIG_MODELINE 2 +#define CONFIG_ACCESSX 3 +extern int config_mode; + #define CONFPATH "%A," "%R," \ "/etc/X11/%R," "%P/etc/X11/%R," \ "%E," "%F," \ @@ -217,6 +220,8 @@ extern xf86cfgComputer computer; extern Atom wm_delete_window; extern Display *DPY; extern Pixmap menuPixmap; -extern Bool nomodules; +#ifdef USE_MODULES +extern int nomodules; +#endif #endif /* _xf86cfg_config_h */ diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c index 1e98306ed..8006933a8 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.4 2001/05/15 18:22:23 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.5 2001/07/25 15:05:08 dawes Exp $ */ #include <X11/IntrinsicP.h> @@ -42,9 +42,7 @@ #include <X11/Xaw/TextSrcP.h> #include <X11/Xmu/SysUtil.h> #include <X11/Xmu/Xmu.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> /* for bsearch() */ -#endif #include <ctype.h> #include "help.h" #include "options.h" diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c index 3489f2a04..d50f8e2eb 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.23.2.1 2001/05/21 22:24:02 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.29 2001/07/08 00:44:33 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -101,7 +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); +void UpdateMenuDeviceList(int); extern void AccessXConfigureStart(void); extern void AccessXConfigureEnd(void); @@ -111,10 +111,12 @@ extern void CloseAccessXAction(Widget, XEvent*, String*, Cardinal*); extern void TextMode(void); #endif +static void Usage(void); + /* * Initialization */ -Widget toplevel, work, config, layout, layoutsme, layoutp; +Widget toplevel, work, config, layout, layoutsme, layoutp, topMenu; XtAppContext appcon; Pixmap menuPixmap; @@ -130,12 +132,16 @@ static char XF86Config_path_static[1024]; static char XkbConfig_path_static[1024]; Bool xf86config_set = False; -Bool textmode = False, nomodules = False; +int textmode = False; +#ifdef USE_MODULES +int nomodules = False; +#endif +int noverify = False; xf86cfgComputer computer; xf86cfgDevice cpu_device; Cursor no_cursor; -static Widget device, menu, layoutm, popup, commands; +static Widget device, layoutm, popup, commands; static int xpos, ypos; int sxpos, sypos; static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 }; @@ -145,11 +151,7 @@ static Bool config_set = False; static Widget mouseSme, mouseMenu, keyboardSme, keyboardMenu, cardSme, cardMenu, monitorSme, monitorMenu; -#define CONFIG_LAYOUT 0 -#define CONFIG_SCREEN 1 -#define CONFIG_MODELINE 2 -#define CONFIG_ACCESSX 3 -static int config_mode = CONFIG_LAYOUT; +int config_mode = CONFIG_LAYOUT; static XtActionsRec actions[] = { {"filter-card", CardFilterAction}, @@ -166,7 +168,7 @@ static XtActionsRec actions[] = { {"options-cancel", OptionsCancelAction}, {"error-cancel", ErrorCancelAction}, {"quit-cancel", QuitCancelAction}, - {"addmode-cancel", CancelForceAddModeAction}, + {"addmode-cancel", CancelAddModeAction}, {"accessx-close", CloseAccessXAction}, {"testmode-cancel", CancelTestModeAction}, {"help-close", HelpCancelAction}, @@ -198,11 +200,31 @@ static XtResource appResources[] = { 0, XtRString, "menu10"}, }; -/* -static XrmOptionDescRec optionDescList[] = { - {"-xf86config", "*xf86config", XrmoptionSepArg, (XtPointer)"/etc/X11/XF86Config"}, -}; -*/ +static void +Usage(void) +{ + fprintf(stderr, +"Usage:\n" +" xf86cfg [-option ...]\n" +"\n" +"Options:\n" +" -xf86config <XF86Config> Alternate configuration file.\n" +" -modulepath <module-path> XFree86 modules location.\n" +" -serverpath <server-path> X server to start (if $DISPLAY is not defined).\n" +" -fontpath <font-path> Font path for fonts.\n" +" -rgbpath <rgb-path> Where the rgb.txt file is located.\n" +#ifdef HAS_NCURSES +" -textmode Use this option for the text only interface.\n" +#endif +#ifdef USE_MODULES +" -nomodules Use this option if xf86cfg is slow to start.\n" +" -verbose <number> Verbosity used in the loader (default 1).\n" +#endif +" -noverify Do not verify modules/options integrity.\n" +); + + exit(1); +} /* * Implementation @@ -220,15 +242,15 @@ main(int argc, char *argv[]) char *menuPixmapPath = NULL; XrmValue from, to; -#ifdef USE_MODULES - xf86Verbose = 1; -#endif - if ((XFree86Dir = getenv("XWINHOME")) == NULL) XFree86Dir = DefaultXFree86Dir; chdir(XFree86Dir); +#ifdef USE_MODULES + xf86Verbose = 1; +#endif + for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-xf86config") == 0) { if (i + 1 < argc) { @@ -252,8 +274,18 @@ main(int argc, char *argv[]) else if (strcmp(argv[i], "-textmode") == 0) textmode = True; #endif +#ifdef USE_MODULES else if (strcmp(argv[i], "-nomodules") == 0) nomodules = True; + else if (strcmp(argv[i], "-verbose") == 0) { + if (i + 1 < argc) + xf86Verbose = atoi(argv[++i]); + } +#endif + else if (strcmp(argv[i], "-noverify") == 0) + noverify = True; + else + Usage(); } #ifdef HAS_NCURSES @@ -269,7 +301,6 @@ main(int argc, char *argv[]) if (XkbConfig_path == NULL) XkbConfig_path = XkbConfigDir XkbConfigFile; toplevel = XtAppInitialize(&appcon, "XF86Cfg", -/* optionDescList, XtNumber(optionDescList),*/ NULL, 0, &argc, argv, NULL, NULL, 0); @@ -297,12 +328,12 @@ main(int argc, char *argv[]) toplevel, NULL, 0); hpane = XtVaCreateManagedWidget("hpane", panedWidgetClass, pane, XtNorientation, XtorientHorizontal, NULL, 0); - menu = XtCreateManagedWidget("topM", menuButtonWidgetClass, + topMenu = XtCreateManagedWidget("topM", menuButtonWidgetClass, hpane, NULL, 0); expert = XtCreateManagedWidget("expert", commandWidgetClass, hpane, NULL, 0); XtAddCallback(expert, XtNcallback, ExpertCallback, NULL); popup = XtCreatePopupShell("menu", simpleMenuWidgetClass, - menu, NULL, 0); + topMenu, NULL, 0); sme = XtCreateManagedWidget("layout", smeBSBObjectClass, popup, NULL, 0); XtAddCallback(sme, XtNcallback, SetConfigModeCallback, @@ -394,19 +425,8 @@ main(int argc, char *argv[]) bottom, NULL, 0); XtAddCallback(quit, XtNcallback, QuitCallback, NULL); - layopt = XtCreatePopupShell("options", simpleMenuWidgetClass, - layoutp, NULL, 0); - sme = XtCreateManagedWidget("default", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); - sme = XtCreateManagedWidget("remove", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); - - XtRealizeWidget(layopt); - XtRealizeWidget(toplevel); - XtRealizeWidget(menu); + XtRealizeWidget(topMenu); pixmap = XCreateBitmapFromData(XtDisplay(toplevel), XtWindow(toplevel), no_cursor_data, 8, 8); @@ -446,19 +466,28 @@ main(int argc, char *argv[]) UpdateMenuDeviceList(CARD); UpdateMenuDeviceList(MONITOR); XtSetSensitive(smemodeline, VideoModeInitialize()); - ReadCardsDatabase(); lay = XF86Config->conf_layout_lst; while (lay != NULL) { sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, layoutp, XtNlabel, lay->lay_identifier, - XtNmenuName, "options", + XtNmenuName, lay->lay_identifier, XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); if (layoutsme == NULL) layoutsme = sme; + layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass, + layoutp, NULL, 0); + sme = XtCreateManagedWidget("default", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); + sme = XtCreateManagedWidget("remove", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); + XtRealizeWidget(layopt); + lay = (XF86ConfLayoutPtr)(lay->list.next); } SelectLayoutCallback(layoutsme, @@ -488,6 +517,9 @@ main(int argc, char *argv[]) LoaderInitializeOptions(); #endif + /* ReadCardsDatabase() must be called after LoaderInitializeOptions() */ + ReadCardsDatabase(); + if (!config_set && startedx) { XtFree(XF86Config_path); #ifdef XF86CONFIG @@ -574,7 +606,7 @@ AskConfig(void) else { Arg args[2]; Cardinal num_args = 0; - char *l, *label, *str = ""; + char *l, *label = NULL, *str = ""; XtSetArg(args[0], XtNlabel, &l); XtGetValues(dialog, args, 1); @@ -747,23 +779,25 @@ InitializeDevices(void) keyboard_y = work->core.height - DEFAULT_KEYBOARD_HEIGHT; while (input != NULL) { - if (strcasecmp(input->inp_driver, "mouse") == 0) { - device = AddDevice(MOUSE, (XtPointer)input, mouse_x, mouse_y); - SetTip(device); - if ((mouse_x += DEFAULT_MOUSE_WIDTH) > work->core.width) { - if ((mouse_y -= DEFAULT_MOUSE_HEIGHT) < (work->core.height >> 1)) - mouse_y = work->core.height >> 1; - mouse_x = work->core.width - (work->core.width >> 2); + if (input->inp_driver) { + if (strcasecmp(input->inp_driver, "mouse") == 0) { + device = AddDevice(MOUSE, (XtPointer)input, mouse_x, mouse_y); + SetTip(device); + if ((mouse_x += DEFAULT_MOUSE_WIDTH) > work->core.width) { + if ((mouse_y -= DEFAULT_MOUSE_HEIGHT) < (work->core.height >> 1)) + mouse_y = work->core.height >> 1; + mouse_x = work->core.width - (work->core.width >> 2); + } } - } - else if (strcasecmp(input->inp_driver, "keyboard") == 0) { - device = AddDevice(KEYBOARD, (XtPointer)input, keyboard_x, keyboard_y); - SetTip(device); - if ((keyboard_x += DEFAULT_KEYBOARD_WIDTH) > - work->core.width - (work->core.width >> 2)) { - if ((keyboard_y -= DEFAULT_KEYBOARD_HEIGHT) < (work->core.height >> 1)) - keyboard_y = work->core.height >> 1; - keyboard_x = 6; + else if (strcasecmp(input->inp_driver, "keyboard") == 0) { + device = AddDevice(KEYBOARD, (XtPointer)input, keyboard_x, keyboard_y); + SetTip(device); + if ((keyboard_x += DEFAULT_KEYBOARD_WIDTH) > + work->core.width - (work->core.width >> 2)) { + if ((keyboard_y -= DEFAULT_KEYBOARD_HEIGHT) < (work->core.height >> 1)) + keyboard_y = work->core.height >> 1; + keyboard_x = 6; + } } } input = (XF86ConfInputPtr)(input->list.next); @@ -907,10 +941,15 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) XF86ConfLayoutPtr lay = (XF86ConfLayoutPtr)user_data; XF86ConfInputrefPtr input; XF86ConfAdjacencyPtr adj; + Widget sme, layopt; Arg args[1]; char *str; - if (lay == computer.layout) + /* XXX Needs to check computer.layout, + * because this function should also create + * a new layout... + */ + if (lay == computer.layout && computer.layout) return; if (computer.layout != NULL) { @@ -1003,8 +1042,8 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) l = (XF86ConfLayoutPtr)(l->list.next); } do { - ++num_layouts; XmuSnprintf(name, sizeof(name), "Layout%d", num_layouts); + ++num_layouts; } while (xf86findLayout(name, XF86Config->conf_layout_lst) != NULL); l = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec)); @@ -1015,11 +1054,22 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) layoutsme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, layoutp, XtNlabel, name, - XtNmenuName, "options", + XtNmenuName, l->lay_identifier, XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(layoutsme, XtNcallback, SelectLayoutCallback, (XtPointer)l); + + layopt = XtCreatePopupShell(l->lay_identifier, simpleMenuWidgetClass, + layoutp, NULL, 0); + sme = XtCreateManagedWidget("default", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); + sme = XtCreateManagedWidget("remove", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); + XtRealizeWidget(layopt); + computer.layout = l; XtSetArg(args[0], XtNstring, name); XtSetValues(layout, args, 1); @@ -1082,15 +1132,14 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) void DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) { - Widget sme = (Widget)(((SimpleMenuWidget)(w->core.parent->core.parent)) - ->simple_menu.entry_set); + Widget layopt, sme; int i; char *str; - Arg args[1]; XF86ConfLayoutPtr prev, tmp, lay; - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(sme, args, 1); + str = w && XtParent(w) ? XtName(XtParent(w)) : NULL; + if (str == NULL) + return; prev = XF86Config->conf_layout_lst; lay = xf86findLayout(str, prev); @@ -1107,6 +1156,8 @@ DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++) XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]); + for (i = 0; i < layoutp->core.num_popups; i++) + XtDestroyWidget(layoutp->core.popup_list[i]); prev->list.next = lay->list.next; lay->list.next = XF86Config->conf_layout_lst; @@ -1118,12 +1169,22 @@ DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, layoutp, XtNlabel, lay->lay_identifier, - XtNmenuName, "options", + XtNmenuName, lay->lay_identifier, XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); if (layoutsme == NULL) layoutsme = sme; + layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass, + layoutp, NULL, 0); + sme = XtCreateManagedWidget("default", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); + sme = XtCreateManagedWidget("remove", smeBSBObjectClass, + layopt, NULL, 0); + XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); + XtRealizeWidget(layopt); + lay = (XF86ConfLayoutPtr)(lay->list.next); } SelectLayoutCallback(layoutsme, @@ -1135,13 +1196,15 @@ void RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) { XF86ConfLayoutPtr prev, tmp, lay, rem; - Widget sme = (Widget)(((SimpleMenuWidget)(w->core.parent->core.parent)) - ->simple_menu.entry_set); + Widget sme = NULL; + int i; char *str; Arg args[1]; - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(sme, args, 1); + str = w && XtParent(w) ? XtName(XtParent(w)) : NULL; + if (str == NULL) + return; + prev = XF86Config->conf_layout_lst; lay = xf86findLayout(str, prev); tmp = prev; @@ -1174,8 +1237,6 @@ RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) SelectLayoutCallback(layoutsme, lay, NULL); } else { - int i; - computer.layout = NULL; XtSetArg(args[0], XtNstring, ""); XtSetValues(layout, args, 1); @@ -1185,17 +1246,27 @@ RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) DrawCables(); } + for (i = 0; i < ((CompositeWidget)layoutp)->composite.num_children; i++) { + XtSetArg(args[0], XtNlabel, &str); + XtGetValues(((CompositeWidget)layoutp)->composite.children[i], args, 1); + if (strcmp(rem->lay_identifier, str) == 0) { + sme = ((CompositeWidget)layoutp)->composite.children[i]; + break; + } + } + xf86removeLayout(XF86Config, rem); - XtDestroyWidget(sme); + if (sme) + XtDestroyWidget(sme); } void SetTip(xf86cfgDevice *device) { - XF86OptionPtr option; + XF86OptionPtr option = NULL; char *tip, buffer[4096]; Arg args[1]; - int len; + int len = 0; XtSetArg(args[0], XtNtip, &tip); XtGetValues(device->widget, args, 1); @@ -1423,7 +1494,7 @@ void OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data) { int i; - XF86OptionPtr *options; + XF86OptionPtr *options = NULL; #ifdef USE_MODULES xf86cfgModuleOptions *drv_opts = NULL; #endif @@ -1736,7 +1807,7 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) } } -static void +void UpdateMenuDeviceList(int type) { Widget sme = NULL, menu = NULL; @@ -2126,7 +2197,7 @@ SetConfigModeCallback(Widget w, XtPointer user_data, XtPointer call_data) XtSetArg(args[0], XtNlabel, &ptr); XtGetValues(w, args, 1); XtSetArg(args[0], XtNlabel, ptr); - XtSetValues(menu, args, 1); + XtSetValues(topMenu, args, 1); if (config_mode == CONFIG_LAYOUT) { XtSetArg(args[0], XtNheight, &height); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c index fed6b8850..2624096d0 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c @@ -26,373 +26,361 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.5.2.1 2001/05/28 21:36:44 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.15 2001/08/17 22:08:15 tsi Exp $ */ -#define LOADER_PRIVATE -#include "loader.h" -/* XXX beware (or fix it) libc functions called here are the xf86 ones */ +#include "config.h" +#include "cards.h" +#include "options.h" +#include "loader.h" +#include "stubs.h" +#include <X11/Xresource.h> #ifdef USE_MODULES -static void AddModuleOptions(char*, OptionInfoPtr); -void xf86AddDriver(DriverPtr, void*, int); -Bool xf86ServerIsOnlyDetecting(void); -void xf86AddInputDriver(InputDriverPtr, pointer, int); -void xf86AddModuleInfo(ModuleInfoPtr, void*); -Bool xf86LoaderCheckSymbol(const char*); -void xf86LoaderReqSymLists(const char **, ...); -void xf86Msg(int, const char*, ...); - -xf86cfgModuleOptions *module_options; - -int xf86ShowUnresolved = 1; - -LOOKUP miLookupTab[] = {{0,0}}; -LOOKUP dixLookupTab[] = {{0,0}}; -LOOKUP fontLookupTab[] = {{0,0}}; -LOOKUP extLookupTab[] = {{0,0}}; -LOOKUP xfree86LookupTab[] = { - /* Loader functions */ - SYMFUNC(LoaderDefaultFunc) - SYMFUNC(LoadSubModule) - SYMFUNC(DuplicateModule) - SYMFUNC(LoaderErrorMsg) - SYMFUNC(LoaderCheckUnresolved) - SYMFUNC(LoadExtension) - SYMFUNC(LoadFont) - SYMFUNC(LoaderReqSymbols) - SYMFUNC(LoaderReqSymLists) - SYMFUNC(LoaderRefSymbols) - SYMFUNC(LoaderRefSymLists) - SYMFUNC(UnloadSubModule) - SYMFUNC(LoaderSymbol) - SYMFUNC(LoaderListDirs) - SYMFUNC(LoaderFreeDirList) - SYMFUNC(LoaderGetOS) - - /* - * these here are our own interfaces to libc functions - */ - SYMFUNC(xf86abort) - SYMFUNC(xf86abs) - SYMFUNC(xf86acos) - SYMFUNC(xf86asin) - SYMFUNC(xf86atan) - SYMFUNC(xf86atan2) - SYMFUNC(xf86atof) - SYMFUNC(xf86atoi) - SYMFUNC(xf86atol) - SYMFUNC(xf86bsearch) - SYMFUNC(xf86ceil) - SYMFUNC(xf86calloc) - SYMFUNC(xf86clearerr) - SYMFUNC(xf86close) - SYMFUNC(xf86cos) - SYMFUNC(xf86exit) - SYMFUNC(xf86exp) - SYMFUNC(xf86fabs) - SYMFUNC(xf86fclose) - SYMFUNC(xf86feof) - SYMFUNC(xf86ferror) - SYMFUNC(xf86fflush) - SYMFUNC(xf86fgetc) - SYMFUNC(xf86fgetpos) - SYMFUNC(xf86fgets) - SYMFUNC(xf86floor) - SYMFUNC(xf86fmod) - SYMFUNC(xf86fopen) - SYMFUNC(xf86fprintf) - SYMFUNC(xf86fputc) - SYMFUNC(xf86fputs) - SYMFUNC(xf86fread) - SYMFUNC(xf86free) - SYMFUNC(xf86freopen) - SYMFUNC(xf86frexp) - SYMFUNC(xf86fscanf) - SYMFUNC(xf86fseek) - SYMFUNC(xf86fsetpos) - SYMFUNC(xf86ftell) - SYMFUNC(xf86fwrite) - SYMFUNC(xf86getc) - SYMFUNC(xf86getenv) - SYMFUNC(xf86getpagesize) - SYMFUNC(xf86hypot) - SYMFUNC(xf86ioctl) - SYMFUNC(xf86isalnum) - SYMFUNC(xf86isalpha) - SYMFUNC(xf86iscntrl) - SYMFUNC(xf86isdigit) - SYMFUNC(xf86isgraph) - SYMFUNC(xf86islower) - SYMFUNC(xf86isprint) - SYMFUNC(xf86ispunct) - SYMFUNC(xf86isspace) - SYMFUNC(xf86isupper) - SYMFUNC(xf86isxdigit) - SYMFUNC(xf86labs) - SYMFUNC(xf86ldexp) - SYMFUNC(xf86log) - SYMFUNC(xf86log10) - SYMFUNC(xf86lseek) - SYMFUNC(xf86malloc) - SYMFUNC(xf86memchr) - SYMFUNC(xf86memcmp) - SYMFUNC(xf86memcpy) -#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__ia64__) - /* - * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle - * structure copies. This causes a problem both here and in shared - * libraries as there is no way to map the name of the call to the - * correct function. - */ - SYMFUNC(memcpy) - /* - * Some PPC, SPARC, and IA64 compilers generate calls to memset to handle - * aggregate initializations. - */ - SYMFUNC(memset) +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <setjmp.h> +#include <signal.h> + +#include <stdarg.h> + +#ifndef SIGNALRETURNSINT +void sig_handler(int); +#else +int sig_handler(int); +#endif /* SIGNALRETURNSINT */ + +static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList, + XrmRepresentation*, XrmValue*, XPointer); +extern void CheckChipsets(xf86cfgModuleOptions*, int*); + +static jmp_buf jmp; +int signal_caught; +int error_level; +char *loaderPath, **loaderList, **ploaderList; +extern XrmDatabase options_xrm; +extern int noverify; +extern ModuleType module_type; +static OptionInfoPtr option; + +extern FontModule *font_module; +extern int numFontModules; + +char **checkerLegend; +int *checkerErrors; + +#ifndef SIGNALRETURNSINT +void +#else +int #endif - SYMFUNC(xf86memmove) - SYMFUNC(xf86memset) - SYMFUNC(xf86mmap) - SYMFUNC(xf86modf) - SYMFUNC(xf86munmap) - SYMFUNC(xf86open) - SYMFUNC(xf86perror) - SYMFUNC(xf86pow) - SYMFUNC(xf86printf) - SYMFUNC(xf86qsort) - SYMFUNC(xf86read) - SYMFUNC(xf86realloc) - SYMFUNC(xf86remove) - SYMFUNC(xf86rename) - SYMFUNC(xf86rewind) - SYMFUNC(xf86setbuf) - SYMFUNC(xf86setvbuf) - SYMFUNC(xf86sin) - SYMFUNC(xf86snprintf) - SYMFUNC(xf86sprintf) - SYMFUNC(xf86sqrt) - SYMFUNC(xf86sscanf) - SYMFUNC(xf86strcat) - SYMFUNC(xf86strcmp) - SYMFUNC(xf86strcasecmp) - SYMFUNC(xf86strcpy) - SYMFUNC(xf86strcspn) - SYMFUNC(xf86strerror) - SYMFUNC(xf86strlen) - SYMFUNC(xf86strncmp) - SYMFUNC(xf86strncasecmp) - SYMFUNC(xf86strncpy) - SYMFUNC(xf86strpbrk) - SYMFUNC(xf86strchr) - SYMFUNC(xf86strrchr) - SYMFUNC(xf86strspn) - SYMFUNC(xf86strstr) - SYMFUNC(xf86strtod) - SYMFUNC(xf86strtok) - SYMFUNC(xf86strtol) - SYMFUNC(xf86strtoul) - SYMFUNC(xf86tan) - SYMFUNC(xf86tmpfile) - SYMFUNC(xf86tolower) - SYMFUNC(xf86toupper) - SYMFUNC(xf86ungetc) - SYMFUNC(xf86vfprintf) - SYMFUNC(xf86vsnprintf) - SYMFUNC(xf86vsprintf) - SYMFUNC(xf86write) - -/* non-ANSI C functions */ - SYMFUNC(xf86opendir) - SYMFUNC(xf86closedir) - SYMFUNC(xf86readdir) - SYMFUNC(xf86rewinddir) - SYMFUNC(xf86ffs) - SYMFUNC(xf86strdup) - SYMFUNC(xf86bzero) - SYMFUNC(xf86usleep) - SYMFUNC(xf86execl) - - SYMFUNC(xf86getsecs) - SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */ - - SYMFUNC(xf86stat) - SYMFUNC(xf86fstat) - SYMFUNC(xf86access) - SYMFUNC(xf86geteuid) - SYMFUNC(xf86getegid) - SYMFUNC(xf86getpid) - SYMFUNC(xf86mknod) - SYMFUNC(xf86chmod) - SYMFUNC(xf86chown) - SYMFUNC(xf86sleep) - SYMFUNC(xf86mkdir) - SYMFUNC(xf86shmget) - SYMFUNC(xf86shmat) - SYMFUNC(xf86shmdt) - SYMFUNC(xf86shmctl) - SYMFUNC(xf86setjmp) - SYMFUNC(xf86longjmp) - - SYMFUNC(xf86AddDriver) - SYMFUNC(xf86ServerIsOnlyDetecting) - SYMFUNC(xf86AddInputDriver) - SYMFUNC(xf86AddModuleInfo) - SYMFUNC(xf86LoaderCheckSymbol) - - SYMFUNC(xf86LoaderReqSymLists) - SYMFUNC(xf86Msg) - SYMFUNC(ErrorF) - {0,0} -}; - -static DriverPtr driver; -static ModuleInfoPtr info; -static ModuleType type = GenericModule; - -static void -AddModuleOptions(char *name, OptionInfoPtr option) +sig_handler(int sig) { - xf86cfgModuleOptions *ptr; - OptionInfoPtr tmp; - - ptr = XtNew(xf86cfgModuleOptions); - ptr->name = XtNewString(name); - ptr->type = type; - if (option) { - int count; - - for (count = 0, tmp = option; tmp->name != NULL; tmp++, count++) - ; - ++count; - ptr->option = (XtPointer)XtCalloc(1, count * sizeof(OptionInfoRec)); - for (count = 0, tmp = option; tmp->name != NULL; count++, tmp++) { - memcpy(&ptr->option[count], tmp, sizeof(OptionInfoRec)); - ptr->option[count].name = XtNewString(tmp->name); - if (tmp->type == OPTV_STRING || tmp->type == OPTV_ANYSTR) - ptr->option[count].value.str = XtNewString(tmp->value.str); - } + char *str; + + switch (sig) { + case SIGTRAP: + str = "TRAP"; + break; + case SIGBUS: + str = "BUS"; + break; + case SIGSEGV: + str = "SEGV"; + break; + case SIGILL: + str = "ILL"; + break; + case SIGFPE: + str = "FPE"; + break; + default: + str = "???"; + break; } - else - ptr->option = NULL; - ptr->next = module_options; - module_options = ptr; + if (signal_caught == 1) { + ErrorF(" ERROR I am dead.\n"); + exit(1); + } + else if (signal_caught == 2) + abort(); + ++signal_caught; + ErrorF(" ERROR SIG%s caught!\n", str); + error_level += 50; + longjmp(jmp, 1); + /*NOTREACHED*/ +} + +void +CheckMsg(int code, char *fmt, ...) +{ + va_list ap; + + ++checkerErrors[code]; + ErrorF("%3d ", code); + + va_start(ap, fmt); + VErrorF(fmt, ap); + va_end(ap); +} + +static Bool +EnumDatabase(XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, + XrmRepresentation *type, XrmValue *value, XPointer closure) +{ + char *res = XrmQuarkToString(quarks[1]); + + option = module_options->option; + while (option->name) { + if (strcmp(option->name, res) == 0) + return (False); + ++option; + } + CheckMsg(CHECKER_OPTION_UNUSED, + "WARNING %s.%s is not used\n", + XrmQuarkToString(quarks[0]), res); + ++error_level; + + return (False); } Bool LoaderInitializeOptions(void) { static int first = 1; - static char *path = NULL, *modules = "lib/modules"; - int saveVerbose = xf86Verbose; + static char *modules = "lib/modules"; + Bool options_ok = False; + char query[256]; + char *type; + XrmValue value; + XrmQuark names[2]; + XrmQuark classes[2]; + int i; + static ModuleType module_types[] = { + GenericModule, FontRendererModule, InputModule, VideoModule, NullModule + }; + + /* The offset in this vector must match loader.h:enum ModuleType values */ + static char *module_strs[] = { + "Null Module", "Video Module", "Input Module", "Generic Module", "Font Module" + }; if (first) { - xf86Verbose = 10; - LoaderInit(); + checkerLegend = (char**) + XtCalloc(1, sizeof(char*) * (CHECKER_LAST_MESSAGE + 1)); + checkerErrors = (int*) + XtCalloc(1, sizeof(int) * (CHECKER_LAST_MESSAGE + 1)); + xf86cfgLoaderInit(); first = 0; + + checkerLegend[CHECKER_OPTIONS_FILE_MISSING] = + "The Options file, normally /usr/X11R6/lib/X11/Options was not found.\n" + "In the sources, it is at xc/programs/Xserver/hw/xfree86/Options."; + checkerLegend[CHECKER_OPTION_DESCRIPTION_MISSING] = + "No description for the module option. The description should be in\n" + "in the Options file, and using the sintax:\n" + "Module.Option: any text describing the option"; + checkerLegend[CHECKER_LOAD_FAILED] = + "Failed to load the module. Usually the loader will print a complete\n" + "description for the reason the module was not loaded. Use the -verbose\n" + "command line option if it is not printing any messages."; + checkerLegend[CHECKER_RECOGNIZED_AS] = + "This message means the module code did not follow what was expected\n" + "by the checker. For video drivers, it did not call xf86AddDriver,\n" + "a input module did not call xf86AddInputDriver and a font renderer\n" + "module did not call LoadFont. This message can also be printed if\n" + "the module is in the incorrect directory."; + checkerLegend[CHECKER_NO_OPTIONS_AVAILABLE] = + "The driver does not have an AvailableOptions function, or that\n" + "function is returning NULL. If the driver is returning NULL, and\n" + "really does not need any options from XF86Config, than the message\n" + "can be ignored."; + checkerLegend[CHECKER_NO_VENDOR_CHIPSET] = + "The checker could not fetch the PCI chipset/vendor information from\n" + "the module. The checker currently wraps xf86PrintChipsets and\n" + "xf86MatchPciInstances to read the information from the module."; + checkerLegend[CHECKER_CANNOT_VERIFY_CHIPSET] = + "The vendor id was not found, so it is not possible to search the list\n" + "of chipsets."; + checkerLegend[CHECKER_OPTION_UNUSED] = + "The option description is defined in the Options file, but the option\n" + "was name not retrieved when calling the module AvailableOptions."; + checkerLegend[CHECKER_NOMATCH_CHIPSET_STRINGS] = + "The string specified in the module does not match the one in\n" + "common/xf86PciInfo.h"; + checkerLegend[CHECKER_CHIPSET_NOT_LISTED] = + "This means that common/xf86PciInfo.h does not have an entry for the\n" + "given vendor and id."; + checkerLegend[CHECKER_CHIPSET_NOT_SUPPORTED] = + "The chipset is listed in common/xf86PciInfo.h, but the driver does\n" + "not support it, or does not list it in the chipsets fetched by the checker."; + checkerLegend[CHECKER_CHIPSET_NO_VENDOR] = + "The vendor id specified to xf86MatchPciInstances is not defined in\n" + "common/xf86PciInfo.h"; + checkerLegend[CHECKER_NO_CHIPSETS] = + "No chipsets were passed to xf86MatchPciIntances."; + checkerLegend[CHECKER_FILE_MODULE_NAME_MISMATCH] = + "The module name string does not match the the modname field of the\n" + "XF86ModuleVersionInfo structure. This generally is not an error, but\n" + "to may be a good idea to use the same string to avoid confusion."; } - xf86Verbose = saveVerbose; if (XF86Module_path == NULL) { - XF86Module_path = XtMalloc(strlen(XFree86Dir) + strlen(modules) + 2); + XF86Module_path = malloc(strlen(XFree86Dir) + strlen(modules) + 2); sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules); } - if (path == NULL || strcmp(XF86Module_path, path)) { - char **list, **l; - const char *subdirs[] = { - ".", - "drivers", - "input", - NULL - }; - int errmaj, errmin; - ModuleDescPtr module; - - path = strdup(XF86Module_path); - LoaderSetPath(path); - - list = LoaderListDirs(subdirs, NULL); - if (list) { -#if 0 - if (ptr) { - while (module_options) { - module_options = module_options->next; - XtFree(ptr->name); - XtFree((XtPointer)ptr->option); - XtFree((XtPointer)ptr); - ptr = module_options; - } - } -#endif - for (l = list; *l; l++) { - driver = NULL; - info = NULL; - type = GenericModule; - xf86Verbose = 0; - if ((module = LoadModule(*l, NULL, NULL, NULL, NULL, - NULL, &errmaj, &errmin)) == NULL) - LoaderErrorMsg(NULL, *l, errmaj, errmin); - else if (driver && driver->AvailableOptions) - AddModuleOptions(*l, (*driver->AvailableOptions)(-1, -1)); - else if (info && info->AvailableOptions) - AddModuleOptions(*l, (*info->AvailableOptions)(NULL)); - - UnloadModule(module); - xf86Verbose = saveVerbose; - } - LoaderFreeDirList(list); - } - else { - xf86Verbose = saveVerbose; - return (False); - } + if (loaderPath == NULL || strcmp(XF86Module_path, loaderPath)) + loaderPath = strdup(XF86Module_path); + else + /* nothing new */ + return (True); + + if (!noverify) { + options_ok = InitializeOptionsDatabase(); + InitializePciInfo(); } - xf86Verbose = saveVerbose; + for (i = 0; module_types[i] != NullModule; i++) { + xf86cfgLoaderInitList(module_types[i]); + if (!noverify) + ErrorF("================= Checking modules of type \"%s\" =================\n", + module_strs[module_types[i]]); - return (True); -} + if (loaderList) { + for (ploaderList = loaderList; *ploaderList; ploaderList++) { + if (!noverify) { + if (setjmp(jmp) == 0) { + int ok, nfont_modules; -void -xf86AddDriver(DriverPtr drv, void *module, int flags) -{ - driver = drv; - type = VideoModule; -} + nfont_modules = numFontModules; + error_level = 0; + signal_caught = 0; + signal(SIGTRAP, sig_handler); + signal(SIGBUS, sig_handler); + signal(SIGSEGV, sig_handler); + signal(SIGILL, sig_handler); + signal(SIGFPE, sig_handler); + ErrorF("CHECK MODULE %s\n", *ploaderList); + if ((ok = xf86cfgCheckModule()) == 0) { + CheckMsg(CHECKER_LOAD_FAILED, + "ERROR Failed to load module.\n"); + error_level += 50; + } + else if (module_type != module_types[i]) { + CheckMsg(CHECKER_RECOGNIZED_AS, + "WARNING %s recognized as a \"%s\"\n", *ploaderList, + module_strs[module_type]); + ++error_level; + } + signal(SIGTRAP, SIG_DFL); + signal(SIGBUS, SIG_DFL); + signal(SIGSEGV, SIG_DFL); + signal(SIGILL, SIG_DFL); + signal(SIGFPE, SIG_DFL); + if (ok) { + if (options_ok) { + if ((module_options == NULL || module_options->option == NULL) && + module_type != GenericModule) { + CheckMsg(CHECKER_NO_OPTIONS_AVAILABLE, + "WARNING Not a generic module, but no options available.\n"); + ++error_level; + } + else if (module_options && strcmp(module_options->name, *ploaderList) == 0) { + ErrorF(" CHECK OPTIONS\n"); + option = module_options->option; -Bool -xf86ServerIsOnlyDetecting(void) -{ - return (True); -} + while (option->name) { + XmuSnprintf(query, sizeof(query), "%s.%s", *ploaderList, option->name); + if (!XrmGetResource(options_xrm, query, "Module.Option", &type, &value) || + value.addr == NULL) { + CheckMsg(CHECKER_OPTION_DESCRIPTION_MISSING, + "WARNING no description for %s\n", query); + ++error_level; + } + ++option; + } -void -xf86AddInputDriver(InputDriverPtr inp, void *module, int flags) -{ - type = InputModule; -} + /* now do a linear search for Options file entries that are not + * in the driver. + */ + names[0] = XrmPermStringToQuark(module_options->name); + classes[0] = XrmPermStringToQuark("Option"); + names[1] = classes[1] = NULLQUARK; + (void)XrmEnumerateDatabase(options_xrm, (XrmNameList)&names, (XrmClassList)&classes, + XrmEnumOneLevel, EnumDatabase, NULL); + } + } + else { + CheckMsg(CHECKER_OPTIONS_FILE_MISSING, + "ERROR Options file missing.\n"); + error_level += 10; + } -void -xf86AddModuleInfo(ModuleInfoPtr inf, void *module) -{ - info = inf; -} + if (module_type == VideoModule && + (module_options == NULL || module_options->vendor < 0 || + module_options->chipsets == NULL)) { + CheckMsg(CHECKER_NO_VENDOR_CHIPSET, + "WARNING No vendor/chipset information available.\n"); + ++error_level; + } + else if (module_type == VideoModule) { + if (module_options == NULL) { + /* No description for this, if this happen, + * something really strange happened. */ + ErrorF(" ERROR No module_options!?!\n"); + error_level += 50; + } + else { + ErrorF(" CHECK CHIPSETS\n"); + CheckChipsets(module_options, &error_level); + } + } -Bool -xf86LoaderCheckSymbol(const char *symbol) -{ - return LoaderSymbol(symbol) != NULL; -} + /* font modules check */ + if (module_type == FontRendererModule) { + if (strcmp(*ploaderList, font_module->name)) { + /* not an error */ + ErrorF(" NOTICE FontModule->name specification mismatch: \"%s\" \"%s\"\n", + *ploaderList, font_module->name); + } + if (nfont_modules + 1 != numFontModules) { + /* not an error */ + ErrorF(" NOTICE font module \"%s\" loaded more than one font renderer.\n", + *ploaderList); + } + } + else if (nfont_modules != numFontModules) { + ErrorF(" WARNING number of font modules changed from %d to %d.\n", + nfont_modules, numFontModules); + ++error_level; + } + } + } + ErrorF(" SUMMARY error_level set to %d.\n\n", error_level); + } + else + (void)xf86cfgCheckModule(); + } + xf86cfgLoaderFreeList(); + } + else + ErrorF(" ERROR Failed to initialize module list.\n"); + } -void -xf86LoaderReqSymLists(const char **list0, ...) -{ -} + if (!noverify) { + ErrorF("===================================== LEGEND ===============================\n"); + ErrorF("NOTICE lines are just informative.\n"); + ErrorF("WARNING lines add 1 to error_level.\n"); + ErrorF("ERROR lines add 2 or more (based on the severity of the error) to error_level.\n\n"); + for (i = 0; i <= CHECKER_LAST_MESSAGE; i++) + if (checkerErrors[i]) { + ErrorF("%3d\n%s\n\n", i, checkerLegend[i]); + } + } -void xf86Msg(int type, const char *format, ...) -{ + return (True); } #endif diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c index 8c6f6661c..00724873c 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.6.2.2 2001/05/25 21:45:01 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.10 2001/07/06 02:04:10 paulo Exp $ */ #include "options.h" @@ -67,7 +67,7 @@ static Widget add, remov, update, list, name, value; static char *option_str; static int option_index, popped = False; static char *Options = "lib/X11/Options"; -static XrmDatabase xrm; +XrmDatabase options_xrm; #ifdef USE_MODULES static Widget modList, optList, desc, modOptionsShell, labelType; static char *module_sel; @@ -552,6 +552,10 @@ SelectModuleCallback(Widget w, XtPointer user_data, XtPointer call_data) XtVaSetValues(desc, XtNstring, "", NULL); XawListUnhighlight(optList); + + /* force relayout */ + XtUnmanageChild(optList); + XtManageChild(optList); } } @@ -644,25 +648,35 @@ UpdateOption(Widget w, XtPointer user_data, XtPointer call_data) XtSetSensitive(update, True); } -char * -GetOptionDescription(char *module, char *option) +Bool +InitializeOptionsDatabase(void) { static int first = 1; - char *type; - XrmValue value; - char query[256]; + static Bool result = True; if (first) { first = 0; XrmInitialize(); - if ((xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) { + if ((options_xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) { fprintf(stderr, "Cannot open '%s' database.\n", Options); - return (NULL); + return (result = False); } } + return (result); +} + +char * +GetOptionDescription(char *module, char *option) +{ + char *type; + XrmValue value; + char query[256]; + + InitializeOptionsDatabase(); + XmuSnprintf(query, sizeof(query), "%s.%s", module, option); - if (XrmGetResource(xrm, query, "Module.Option", &type, &value)) + if (XrmGetResource(options_xrm, query, "Module.Option", &type, &value)) return ((char*)value.addr); return (NULL); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h index 6c754f86b..a90072607 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.4.2.1 2001/05/25 21:45:01 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.7 2001/07/06 02:04:10 paulo Exp $ */ #include "config.h" @@ -46,5 +46,6 @@ void OptionsPopup(XF86OptionPtr*); void OptionsCancelAction(Widget, XEvent*, String*, Cardinal*); void ModuleOptionsCancelAction(Widget, XEvent*, String*, Cardinal*); char *GetOptionDescription(char *module, char *option); +Bool InitializeOptionsDatabase(void); -void CreateOptionsShell(void);
\ No newline at end of file +void CreateOptionsShell(void); diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c index 7a166623d..36f40828e 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.8.2.1 2001/05/21 22:24:02 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.9 2001/05/21 22:21:57 paulo Exp $ */ #include "xf86config.h" diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c index 227701269..3b2f194f6 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.6 2001/03/24 01:17:21 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.7 2001/07/08 05:46:35 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -650,48 +650,46 @@ AdjustScreenUI(void) XtUnmapWidget(work); while (adj) { - xf86cfgScreen *scr, *topscr, *botscr, *lefscr, *rigscr; + xf86cfgScreen *scr = NULL, + *topscr = NULL, *botscr = NULL, *lefscr = NULL, *rigscr = NULL; for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_screen) break; + if (i < computer.num_screens) scr = computer.screens[i]; if (adj->adj_top != NULL) { for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_top) break; - topscr = computer.screens[i]; + if (i < computer.num_screens) + topscr = computer.screens[i]; } - else - topscr = NULL; if (adj->adj_bottom != NULL) { for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_bottom) break; - botscr = computer.screens[i]; + if (i < computer.num_screens) + botscr = computer.screens[i]; } - else - botscr = NULL; if (adj->adj_left != NULL) { for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_left) break; - lefscr = computer.screens[i]; + if (i < computer.num_screens) + lefscr = computer.screens[i]; } - else - lefscr = NULL; if (adj->adj_right != NULL) { for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == adj->adj_right) break; - rigscr = computer.screens[i]; + if (i < computer.num_screens) + rigscr = computer.screens[i]; } - else - rigscr = NULL; if (lefscr == NULL && rigscr == NULL && topscr == NULL && lefscr == NULL) { XF86ConfScreenPtr s; @@ -701,19 +699,21 @@ AdjustScreenUI(void) for (i = 0; i < computer.num_screens; i++) if (computer.screens[i]->screen == s) break; - switch (adj->adj_where) { - case CONF_ADJ_RIGHTOF: - lefscr = computer.screens[i]; - break; - case CONF_ADJ_LEFTOF: - rigscr = computer.screens[i]; - break; - case CONF_ADJ_ABOVE: - botscr = computer.screens[i]; - break; - case CONF_ADJ_BELOW: - topscr = computer.screens[i]; - break; + if (i < computer.num_screens) { + switch (adj->adj_where) { + case CONF_ADJ_RIGHTOF: + lefscr = computer.screens[i]; + break; + case CONF_ADJ_LEFTOF: + rigscr = computer.screens[i]; + break; + case CONF_ADJ_ABOVE: + botscr = computer.screens[i]; + break; + case CONF_ADJ_BELOW: + topscr = computer.screens[i]; + break; + } } } } diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c index 9316a5211..d28ac0899 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.4 2000/11/14 21:59:24 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.7 2001/07/07 23:00:43 paulo Exp $ */ /* @@ -118,7 +118,8 @@ static void AddModeCallback(Widget, XtPointer, XtPointer); static void TestCallback(Widget, XtPointer, XtPointer); static void TestTimeout(XtPointer, XtIntervalId*); static void StopTestCallback(Widget, XtPointer, XtPointer); - +static int ForceAddMode(void); +static int AddMode(void); /* * Initialization */ @@ -133,7 +134,7 @@ static Bool S3Specials; static int invert_vclk, blank1, blank2, early_sc, screenno; static int (*XtErrorFunc)(Display*, XErrorEvent*); static Widget labels[VSYNC + 1], values[VSYNC + 1], repeater, monitor, - monitorb, add, text, vesab, vesap, forceshell, testshell; + monitorb, add, text, vesab, vesap, forceshell, testshell, addshell; static int MajorVersion, MinorVersion, EventBase, ErrorBase; static XtIntervalId timeout; @@ -442,20 +443,8 @@ VideoModeInitialize(void) MINMAJOR, MINMINOR); return (False); } - else { - int i; - Display *display = XtDisplay(toplevel); - - computer.num_vidmodes = ScreenCount(display); - computer.vidmodes = (xf86cfgVidmode**) - XtMalloc(sizeof(xf86cfgVidmode*) * computer.num_vidmodes); - for (i = 0; i < computer.num_vidmodes; i++) { - - computer.vidmodes[i] = (xf86cfgVidmode*) - XtCalloc(1, sizeof(xf86cfgVidmode)); - computer.vidmodes[i]->screen = i; - } - } + else + InitializeVidmodes(); vtune = XtCreateWidget("vidtune", formWidgetClass, work, NULL, 0); @@ -588,6 +577,23 @@ VideoModeInitialize(void) } void +InitializeVidmodes(void) +{ + int i; + Display *display = XtDisplay(toplevel); + + computer.num_vidmodes = ScreenCount(display); + computer.vidmodes = (xf86cfgVidmode**) + XtMalloc(sizeof(xf86cfgVidmode*) * computer.num_vidmodes); + for (i = 0; i < computer.num_vidmodes; i++) { + + computer.vidmodes[i] = (xf86cfgVidmode*) + XtCalloc(1, sizeof(xf86cfgVidmode)); + computer.vidmodes[i]->screen = i; + } +} + +void VideoModeConfigureStart(void) { vidtune = computer.vidmodes[screenno]; @@ -686,10 +692,14 @@ SetLabelAndModeline(void) vidtune->monitor->mon_identifier, NULL); XtSetSensitive(add, True); - XmuSnprintf(string, sizeof(string), "%dx%d@%d", - modeline.hdisplay, modeline.vdisplay, - (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / - (double)modeline.vtotal)); + if (modeline.htotal && modeline.vtotal) + XmuSnprintf(string, sizeof(string), "%dx%d@%d", + modeline.hdisplay, modeline.vdisplay, + (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / + (double)modeline.vtotal)); + else + XmuSnprintf(string, sizeof(string), "%dx%d", + modeline.hdisplay, modeline.vdisplay); XtVaSetValues(text, XtNstring, string, NULL); } else { @@ -715,15 +725,17 @@ VidmodeRestoreAction(Widget w, XEvent *event, static void UpdateSyncRates(Bool update) { - hsync_rate = (dot_clock * 1000) / modeline.htotal; - vsync_rate = (hsync_rate * 1000) / modeline.vtotal; - if (modeline.flags & V_INTERLACE) - vsync_rate *= 2; - else if (modeline.flags & V_DBLSCAN) - vsync_rate /= 2; - if (update) { - SetLabel(HSYNC, hsync_rate); - SetLabel(VSYNC, vsync_rate); + if (modeline.htotal && modeline.vtotal) { + hsync_rate = (dot_clock * 1000) / modeline.htotal; + vsync_rate = (hsync_rate * 1000) / modeline.vtotal; + if (modeline.flags & V_INTERLACE) + vsync_rate *= 2; + else if (modeline.flags & V_DBLSCAN) + vsync_rate /= 2; + if (update) { + SetLabel(HSYNC, hsync_rate); + SetLabel(VSYNC, vsync_rate); + } } } @@ -988,10 +1000,14 @@ SwitchCallback(Widget w, XtPointer call_data, XtPointer client_data) UpdateCallback(w, call_data, client_data); - XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", - modeline.hdisplay, modeline.vdisplay, - (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / - (double)modeline.vtotal)); + if (modeline.htotal && modeline.vtotal) + XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", + modeline.hdisplay, modeline.vdisplay, + (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / + (double)modeline.vtotal)); + else + XmuSnprintf(label, sizeof(label), "%dx%d", + modeline.hdisplay, modeline.vdisplay); XtSetArg(args[0], XtNlabel, label); XtSetValues(mode, args, 1); } @@ -1056,6 +1072,7 @@ AddVesaModeCallback(Widget w, XtPointer call_data, XtPointer client_data) { xf86cfgVesaModeInfo *vesa = (xf86cfgVesaModeInfo*)call_data; XF86VidModeModeInfo mode; + int num_infos = vidtune->num_infos; memcpy(&mode, &vesa->info, sizeof(XF86VidModeModeInfo)); if (XF86VidModeAddModeLine(XtDisplay(toplevel), vidtune->screen, @@ -1063,8 +1080,54 @@ AddVesaModeCallback(Widget w, XtPointer call_data, XtPointer client_data) XSync(XtDisplay(toplevel), False); GetModes(); } - else - XBell(XtDisplay(w), 80); + else { + XBell(XtDisplayOfObject(w), 80); + return; + } + + if (vidtune && num_infos == vidtune->num_infos) { + /* XF86VidModeAddModeLine returned True, but no modeline was added */ + XBell(XtDisplayOfObject(w), 80); + if (vidtune->monitor && AddMode()) { + XF86ConfModeLinePtr mode; + char label[256], *ptr, *str; + + XmuSnprintf(label, sizeof(label), "%s", vesa->ident); + + /* format mode name to not have spaces */ + ptr = strchr(label, ')'); + if (ptr) + *++ptr = '\0'; + ptr = str = label; + while (*ptr) { + if (*ptr != ' ') + *str++ = *ptr; + ++ptr; + } + *str = '\0'; + + if (xf86findModeLine(label, vidtune->monitor->mon_modeline_lst) + != NULL && !ForceAddMode()) + return; + + mode = (XF86ConfModeLinePtr)XtCalloc(1, sizeof(XF86ConfModeLineRec)); + mode->ml_identifier = XtNewString(label); + mode->ml_clock = vesa->info.dotclock; + mode->ml_hdisplay = vesa->info.hdisplay; + mode->ml_hsyncstart = vesa->info.hsyncstart; + mode->ml_hsyncend = vesa->info.hsyncend; + mode->ml_htotal = vesa->info.htotal; + mode->ml_vdisplay = vesa->info.vdisplay; + mode->ml_vsyncstart = vesa->info.vsyncstart; + mode->ml_vsyncend = vesa->info.vsyncend; + mode->ml_vtotal = vesa->info.vtotal; +/* mode->ml_vscan = ???;*/ + mode->ml_flags = vesa->info.flags; + mode->ml_hskew = vesa->info.hskew; + vidtune->monitor->mon_modeline_lst = + xf86addModeLine(vidtune->monitor->mon_modeline_lst, mode); + } + } } static void @@ -1089,21 +1152,31 @@ GetModes(void) for (i = 0; i < vidtune->num_infos; i++) { Widget sme; - XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", - vidtune->infos[i]->hdisplay, - vidtune->infos[i]->vdisplay, - (int)((double)vidtune->infos[i]->dotclock / - (double)vidtune->infos[i]->htotal * 1000.0 / - (double)vidtune->infos[i]->vtotal)); + if ((double)vidtune->infos[i]->htotal && + (double)vidtune->infos[i]->vtotal) + XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", + vidtune->infos[i]->hdisplay, + vidtune->infos[i]->vdisplay, + (int)((double)vidtune->infos[i]->dotclock / + (double)vidtune->infos[i]->htotal * 1000.0 / + (double)vidtune->infos[i]->vtotal)); + else + XmuSnprintf(label, sizeof(label), "%dx%d", + vidtune->infos[i]->hdisplay, + vidtune->infos[i]->vdisplay); sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0); XtAddCallback(sme, XtNcallback, SelectCallback, (XtPointer)vidtune->infos[i]); } - XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", - modeline.hdisplay, modeline.vdisplay, - (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / - (double)modeline.vtotal)); + if (modeline.htotal && modeline.vtotal) + XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz", + modeline.hdisplay, modeline.vdisplay, + (int)((double)dot_clock / (double)modeline.htotal * 1000.0 / + (double)modeline.vtotal)); + else + XmuSnprintf(label, sizeof(label), "%dx%d", + modeline.hdisplay, modeline.vdisplay); XtSetArg(args[0], XtNlabel, label); XtSetValues(mode, args, 1); } @@ -1118,13 +1191,6 @@ PopdownForce(Widget w, XtPointer user_data, XtPointer call_data) do_force = (long)user_data; } -void -CancelForceAddModeAction(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - PopdownForce(w, (XtPointer)False, NULL); -} - static int ForceAddMode(void) { @@ -1150,6 +1216,51 @@ ForceAddMode(void) return (do_force); } +static int do_add, asking_add; + +static void +PopdownAdd(Widget w, XtPointer user_data, XtPointer call_data) +{ + asking_add = 0; + XtPopdown(addshell); + do_add = (long)user_data; +} + +void +CancelAddModeAction(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + if (asking_force) + PopdownForce(w, (XtPointer)False, NULL); + else if (asking_add) + PopdownAdd(w, (XtPointer)False, NULL); +} + +static int +AddMode(void) +{ + if (addshell == NULL) { + Widget dialog; + + addshell = XtCreatePopupShell("addMode", transientShellWidgetClass, + toplevel, NULL, 0); + dialog = XtVaCreateManagedWidget("dialog", dialogWidgetClass, + addshell, XtNvalue, NULL, NULL, 0); + XawDialogAddButton(dialog, "yes", PopdownAdd, (XtPointer)True); + XawDialogAddButton(dialog, "no", PopdownAdd, (XtPointer)False); + XtRealizeWidget(addshell); + XSetWMProtocols(DPY, XtWindow(addshell), &wm_delete_window, 1); + } + + asking_add = 1; + + XtPopup(addshell, XtGrabExclusive); + while (asking_add) + XtAppProcessEvent(XtWidgetToApplicationContext(addshell), XtIMAll); + + return (do_add); +} + /*ARGSUSED*/ static void AddModeCallback(Widget w, XtPointer call_data, XtPointer client_data) diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man index 0a16cb385..95d6fddbc 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man @@ -26,7 +26,7 @@ .\" .\" Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.6.2.1 2001/05/21 22:24:02 paulo Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.7 2001/05/21 22:21:57 paulo Exp $ .\" .TH xf86cfg 1 __vendorversion__ .SH NAME diff --git a/xc/programs/Xserver/hw/xwin/Imakefile b/xc/programs/Xserver/hw/xwin/Imakefile index dcbcc20a6..dd7017f63 100644 --- a/xc/programs/Xserver/hw/xwin/Imakefile +++ b/xc/programs/Xserver/hw/xwin/Imakefile @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.6 2001/04/25 19:44:02 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.10 2001/07/02 09:37:16 alanh Exp $ #include <Server.tmpl> @@ -9,7 +9,7 @@ SHMDEF = -DHAS_SHM MMAPDEF = -DHAS_MMAP -SRCSA = InitInput.c \ +SRCS = InitInput.c \ InitOutput.c \ stubs.c \ wingc.c \ @@ -35,9 +35,12 @@ SRCSA = InitInput.c \ winshadddnl.c \ winpfbdd.c \ winkeybd.c \ - winmouse.c + winmouse.c \ + wincutpaste.c \ + winnativegdi.c \ + winlayer.c -OBJSA = InitInput.o \ +OBJS = InitInput.o \ InitOutput.o \ stubs.o \ wingc.o \ @@ -63,32 +66,26 @@ OBJSA = InitInput.o \ winshadddnl.o \ winpfbdd.o \ winkeybd.o \ - winmouse.o + winmouse.o \ + wincutpaste.o \ + winnativegdi.o \ + winlayer.o -INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) -I$(SERVERSRC)/render \ +INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/miext/shadow -I$(SERVERSRC)/miext/layer \ -I$(SERVERSRC)/include -I$(SERVERSRC)/os \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/miext/shadow + -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/render -I$(SERVERSRC)/randr DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI -#if BuildDPMS -SRCSB = dpmsstubs.c -OBJSB = dpmsstubs.o -#endif - -SRCS = $(SRCSA) $(SRCSB) $(SRCSC) -OBJS = $(OBJSA) $(OBJSB) $(OBJSC) - LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) SpecialCObjectRule(stubs,$(ICONFIGFILES),$(EXT_DEFINES)) -#if BuildDPMS -LinkSourceFile(dpmsstubs.c,$(SERVERSRC)/Xext) -SpecialCObjectRule(dpmsstubs,$(ICONFIGFILES),$(EXT_DEFINES)) -#endif - NormalLibraryObjectRule() NormalLibraryTarget(Xwin,$(OBJS)) +InstallManPage(XWin,$(MANDIR)) + DependTarget() diff --git a/xc/programs/Xserver/hw/xwin/InitOutput.c b/xc/programs/Xserver/hw/xwin/InitOutput.c index 31c3cdee3..68b4c3dc2 100644 --- a/xc/programs/Xserver/hw/xwin/InitOutput.c +++ b/xc/programs/Xserver/hw/xwin/InitOutput.c @@ -22,17 +22,21 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.8 2001/05/08 08:14:09 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.17 2001/08/06 11:02:30 alanh Exp $ */ #include "win.h" -int g_nNumScreens; -winScreenInfo g_winScreens[MAXSCREENS]; -int g_nLastScreen = -1; -ColormapPtr g_cmInstalledMaps[MAXSCREENS]; +int g_iNumScreens = 0; +winScreenInfo g_ScreenInfo[MAXSCREENS]; +int g_iLastScreen = -1; int g_fdMessageQueue = WIN_FD_INVALID; -int g_winScreenPrivateIndex = -1; -unsigned long g_winGeneration = 0; +int g_iScreenPrivateIndex = -1; +int g_iCmapPrivateIndex = -1; +int g_iGCPrivateIndex = -1; +int g_iPixmapPrivateIndex = -1; +unsigned long g_ulServerGeneration = 0; +HBITMAP g_hbmpGarbage = NULL; +static Bool g_fScreenInfoInitialized = FALSE; static PixmapFormatRec g_PixmapFormats[] = { { 1, 1, BITMAP_SCANLINE_PAD }, @@ -43,27 +47,35 @@ static PixmapFormatRec g_PixmapFormats[] = { { 24, 24, BITMAP_SCANLINE_PAD }, { 32, 32, BITMAP_SCANLINE_PAD } }; + const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]); void winInitializeDefaultScreens (void) { int i; + + /* Set a default DPI, if no parameter was passed */ + if (monitorResolution == 0) + monitorResolution = WIN_DEFAULT_DPI; - for (i = 0; i < MAXSCREENS; i++) + for (i = 0; i < MAXSCREENS; ++i) { - 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; - g_winScreens[i].fFullScreen = FALSE; - g_winScreens[i].iE3BTimeout = WIN_E3B_OFF; + g_ScreenInfo[i].dwScreen = i; + g_ScreenInfo[i].dwWidth = WIN_DEFAULT_WIDTH; + g_ScreenInfo[i].dwHeight = WIN_DEFAULT_HEIGHT; + g_ScreenInfo[i].dwDepth = WIN_DEFAULT_DEPTH; + g_ScreenInfo[i].dwRefreshRate = WIN_DEFAULT_REFRESH; + g_ScreenInfo[i].pfb = NULL; + g_ScreenInfo[i].fFullScreen = FALSE; + g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF; + g_ScreenInfo[i].dwWidth_mm = (WIN_DEFAULT_WIDTH / WIN_DEFAULT_DPI) + * 25.4; + g_ScreenInfo[i].dwHeight_mm = (WIN_DEFAULT_HEIGHT / WIN_DEFAULT_DPI) + * 25.4; + g_ScreenInfo[i].fUseWinKillKey = WIN_DEFAULT_WIN_KILL; + g_ScreenInfo[i].fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; } - g_nNumScreens = 1; } DWORD @@ -113,93 +125,166 @@ OsVendorInit (void) #if CYGDEBUG ErrorF ("OsVendorInit ()\n"); #endif + + /* Add a default screen if no screens were specified */ + if (g_iNumScreens == 0) + { + if (!g_fScreenInfoInitialized) + winInitializeDefaultScreens (); + + g_iNumScreens = 1; + g_iLastScreen = 0; + + g_ScreenInfo[0].dwWidth = GetSystemMetrics (SM_CXSCREEN); + g_ScreenInfo[0].dwHeight = GetSystemMetrics (SM_CYSCREEN); + } } /* See Porting Layer Definition - p. 57 */ void ddxUseMsg (void) { - ErrorF ("-screen n WxHxD\n"\ - "\tSet screen n's width, height, and bit depth\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\tGDI blitter\t\t1\n"\ - "\t\tDirectDraw blitter\t2\n"\ - "\t\tDirectDraw4 blitter\t4\n"); + ErrorF ("-screen scr_num width height\n" + "\tSet screen scr_num's width and height\n"); + ErrorF ("-engine engine_type_id\n" + "\tOverride the server's automatically selected engine type:\n" + "\t\t1 - GDI blitter\t\t1\n" + "\t\t2 - DirectDraw blitter\t2\n" + "\t\t4 - DirectDraw4 blitter\t4\n"); ErrorF ("-fullscreen\n" - "\tRun the specified server engine in fullscreen mode\n"); - ErrorF ("-emulate3buttons [n]\n" - "\tEmulate 3 button mouse with timeout of n milliseconds\n"); + "\tRun the server in fullscreen mode\n"); + ErrorF ("-depth bits_per_pixel\n" + "\tSpecify an optional bitdepth to use in fullscreen mode\n" + "\twith a DirectDraw engine.\n"); + ErrorF ("-refresh rate_in_Hz\n" + "\tSpecify an optional refresh rate to use in fullscreen mode\n" + "\twith a DirectDraw engine.\n"); + ErrorF ("-emulate3buttons [timeout]\n" + "\tEmulate 3 button mouse with an optional timeout in " + "milliseconds\n"); + ErrorF ("-[no]winkill\n" + "\tAlt+F4 exits the XServer\n"); + ErrorF ("-[no]unixkill\n" + "\tCtrl+Alt+Backspace exits the XServer\n"); } /* See Porting Layer Definition - p. 57 */ +/* + * INPUT + * argv: pointer to an array of null-terminated strings, one for + * each token in the X Server command line; the first token + * is 'XWin.exe', or similar. + * argc: a count of the number of tokens stored in argv. + * i: a zero-based index into argv indicating the current token being + * processed. + * + * OUTPUT + * return: return the number of tokens processed correctly. + * + * NOTE + * When looking for n tokens, check that i + n is less than argc. Or, + * you may check if i is greater than or equal to argc, in which case + * you should display the UseMsg () and return 0. + */ int ddxProcessArgument (int argc, char *argv[], int i) { - static Bool fFirstTime = TRUE; + ErrorF ("ddxProcessArgument ()\n"); /* Run some initialization procedures the first time through */ - if (fFirstTime) + if (!g_fScreenInfoInitialized) { winInitializeDefaultScreens (); - fFirstTime = FALSE; + g_fScreenInfoInitialized = TRUE; } + /* Set a default DPI */ + if (monitorResolution == 0) + monitorResolution = WIN_DEFAULT_DPI; + /* - * Look for the '-screen n WxHxD' arugment + * Look for the '-screen scr_num width height' argument */ if (strcmp (argv[i], "-screen") == 0) { + int iArgsProcessed = 1; int nScreenNum; + ErrorF ("ddxProcessArgument () - screen - argc: %d i: %d\n", + argc, i); + /* Display the usage message if the argument is malformed */ if (i + 2 >= argc) { - UseMsg (); return 0; } - - nScreenNum = atoi (argv[i+1]); + + /* Grab screen number */ + nScreenNum = atoi (argv[i + 1]); /* Validate the specified screen number */ if (nScreenNum < 0 || nScreenNum >= MAXSCREENS) { - ErrorF ("Invalid screen number %d\n", nScreenNum); + ErrorF ("ddxProcessArgument () - Invalid screen number %d\n", + nScreenNum); UseMsg (); return 0; } - - /* Grab the height, width, and depth parameters */ - if (3 != sscanf (argv[i+2], "%dx%dx%d", - (int*)&g_winScreens[nScreenNum].dwWidth, - (int*)&g_winScreens[nScreenNum].dwHeight, - (int*)&g_winScreens[nScreenNum].dwDepth)) - { - /* I see no height, width, and depth here */ - ErrorF ("Invalid screen configuration %s\n", argv[i+2]); - UseMsg (); + + /* Look for 'WxD' or 'W D' */ + if (2 == sscanf (argv[i + 2], "%dx%d", + (int *) &g_ScreenInfo[nScreenNum].dwWidth, + (int *) &g_ScreenInfo[nScreenNum].dwHeight)) + { + iArgsProcessed = 3; + } + else if (i + 3 < argc + && 1 == sscanf (argv[i + 2], "%d", + (int *) &g_ScreenInfo[nScreenNum].dwWidth) + && 1 == sscanf (argv[i + 3], "%d", + (int *) &g_ScreenInfo[nScreenNum].dwHeight)) + { + iArgsProcessed = 4; + } + else + { + /* I see no height and width here */ + ErrorF ("ddxProcessArgument () - Invalid screen width and " + "height: %s\n", + argv[i + 2]); return 0; - } + } + + + /* Calculate the screen width and height in millimeters */ + g_ScreenInfo[nScreenNum].dwWidth_mm + = (g_ScreenInfo[nScreenNum].dwWidth + / monitorResolution) * 25.4; + g_ScreenInfo[nScreenNum].dwHeight_mm + = (g_ScreenInfo[nScreenNum].dwHeight + / monitorResolution) * 25.4; + + /* + * Keep track of the last screen number seen, as parameters seen + * before a screen number apply to all screens, whereas parameters + * seen after a screen number apply to that screen number only. + */ + g_iLastScreen = nScreenNum; - if (nScreenNum >= g_nNumScreens) - g_nNumScreens = nScreenNum + 1; - g_nLastScreen = nScreenNum; - return 3; + /* Keep a count of the number of screens */ + ++g_iNumScreens; + + return iArgsProcessed; } /* - * Look for the '-blackpixel n' argument + * Look for the '-engine n' argument */ - if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */ + if (strcmp (argv[i], "-engine") == 0) { - Pixel pix; - + DWORD dwEngine = 0; + CARD8 c8OnBits = 0; + /* Display the usage message if the argument is malformed */ if (++i >= argc) { @@ -207,69 +292,121 @@ ddxProcessArgument (int argc, char *argv[], int i) return 0; } - pix = atoi (argv[i]); + /* Grab the argument */ + dwEngine = atoi (argv[i]); + + /* Count the one bits in the engine argument */ + c8OnBits = winCountBits (dwEngine); + + /* Argument should only have a single bit on */ + if (c8OnBits != 1) + { + UseMsg (); + return 0; + } /* Is this parameter attached to a screen or global? */ - if (-1 == g_nLastScreen) - { - int j; + if (-1 == g_iLastScreen) + { + int j; /* Parameter is for all screens */ - for (j = 0; j < MAXSCREENS; j++) - { - g_winScreens[j].pixelBlack = pix; - } - } + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].dwEnginePreferred = dwEngine; + } + } else - { + { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].pixelBlack = pix; - } + g_ScreenInfo[g_iLastScreen].dwEnginePreferred = dwEngine; + } + + /* Indicate that we have processed the argument */ return 2; } /* - * Look for the '-whitepixel n' argument + * Look for the '-fullscreen' argument */ - if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel n */ + if (strcmp(argv[i], "-fullscreen") == 0) { - Pixel pix; + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; - /* Display the usage message if the argument is malformed */ - if (++i >= argc) + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fFullScreen = TRUE; + } + } + else { - UseMsg (); - return 0; + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fFullScreen = TRUE; } - pix = atoi (argv[i]); + /* Indicate that we have processed this argument */ + return 1; + } - /* Is this parameter attached to a screen or global? */ - if (-1 == g_nLastScreen) + /* + * Look for the '-emulate3buttons' argument + */ + if (strcmp(argv[i], "-emulate3buttons") == 0) + { + int iArgsProcessed = 1; + int iE3BTimeout = WIN_DEFAULT_E3B_TIME; + + /* Grab the optional timeout value */ + if (i + 1 < argc + && 1 == sscanf (argv[i + 1], "%d", + &iE3BTimeout)) { - int j; + /* Indicate that we have processed the next argument */ + iArgsProcessed++; + } + else + { + /* + * sscanf () won't modify iE3BTimeout if it doesn't find + * the specified format; however, I want to be explicit + * about setting the default timeout in such cases to + * prevent some programs (me) from getting confused. + */ + iE3BTimeout = WIN_DEFAULT_E3B_TIME; + } + + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; /* Parameter is for all screens */ - for (j = 0; j < MAXSCREENS; j++) - { - g_winScreens[j].pixelWhite = pix; - } - } + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].iE3BTimeout = iE3BTimeout; + } + } else - { + { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].pixelWhite = pix; - } - return 2; + g_ScreenInfo[g_iLastScreen].iE3BTimeout = TRUE; + } + + /* Indicate that we have processed this argument */ + return iArgsProcessed; } /* - * Look for the '-linebias n' argument + * Look for the '-depth n' argument */ - if (strcmp (argv[i], "-linebias") == 0) + if (strcmp (argv[i], "-depth") == 0) { - unsigned int uiLinebias; - + DWORD dwDepth = 0; + /* Display the usage message if the argument is malformed */ if (++i >= argc) { @@ -277,34 +414,36 @@ ddxProcessArgument (int argc, char *argv[], int i) return 0; } - uiLinebias = atoi (argv[i]); + /* Grab the argument */ + dwDepth = atoi (argv[i]); /* Is this parameter attached to a screen or global? */ - if (-1 == g_nLastScreen) - { - int j; + if (-1 == g_iLastScreen) + { + int j; /* Parameter is for all screens */ - for (j = 0; j < MAXSCREENS; j++) - { - g_winScreens[j].dwLineBias = uiLinebias; - } - } + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].dwDepth = dwDepth; + } + } else - { + { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].dwLineBias = uiLinebias; - } + g_ScreenInfo[g_iLastScreen].dwDepth = dwDepth; + } + + /* Indicate that we have processed the argument */ return 2; } /* - * Look for the '-engine n' argument + * Look for the '-refresh n' argument */ - if (strcmp (argv[i], "-engine") == 0) + if (strcmp (argv[i], "-refresh") == 0) { - DWORD dwEngine = 0; - CARD8 c8OnBits = 0; + DWORD dwRefreshRate = 0; /* Display the usage message if the argument is malformed */ if (++i >= argc) @@ -314,33 +453,23 @@ ddxProcessArgument (int argc, char *argv[], int i) } /* Grab the argument */ - dwEngine = atoi (argv[i]); - - /* Count the one bits in the engine argument */ - c8OnBits = winCountBits (dwEngine); - - /* Argument should only have a single bit on */ - if (c8OnBits != 1) - { - UseMsg (); - return 0; - } + dwRefreshRate = atoi (argv[i]); /* Is this parameter attached to a screen or global? */ - if (-1 == g_nLastScreen) + if (-1 == g_iLastScreen) { int j; /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { - g_winScreens[j].dwEnginePreferred = dwEngine; + g_ScreenInfo[j].dwRefreshRate = dwRefreshRate; } } else { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].dwEnginePreferred = dwEngine; + g_ScreenInfo[g_iLastScreen].dwRefreshRate = dwRefreshRate; } /* Indicate that we have processed the argument */ @@ -348,25 +477,25 @@ ddxProcessArgument (int argc, char *argv[], int i) } /* - * Look for the '-fullscreen' argument + * Look for the '-nowinkill' argument */ - if (strcmp(argv[i], "-fullscreen") == 0) + if (strcmp(argv[i], "-nowinkill") == 0) { /* Is this parameter attached to a screen or is it global? */ - if (-1 == g_nLastScreen) + if (-1 == g_iLastScreen) { int j; /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { - g_winScreens[j].fFullScreen = TRUE; + g_ScreenInfo[j].fUseWinKillKey = FALSE; } } else { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].fFullScreen = TRUE; + g_ScreenInfo[g_iLastScreen].fUseWinKillKey = FALSE; } /* Indicate that we have processed this argument */ @@ -374,51 +503,81 @@ ddxProcessArgument (int argc, char *argv[], int i) } /* - * Look for the '-emulate3buttons' argument + * Look for the '-winkill' argument */ - if (strcmp(argv[i], "-emulate3buttons") == 0) + if (strcmp(argv[i], "-winkill") == 0) { - int iArgsProcessed = 1; - int iE3BTimeout = WIN_DEFAULT_E3B_TIME; + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; - /* Grab the optional timeout value */ - if (i + 1 < argc - && 1 == sscanf (argv[i + 1], "%d", - &iE3BTimeout)) - { - /* Indicate that we have processed the next argument */ - iArgsProcessed++; - } + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fUseWinKillKey = TRUE; + } + } else { - /* - * sscanf () won't modify iE3BTimeout if it doesn't find - * the specified format; however, I want to be explicit - * about setting the default timeout in such cases to - * prevent some programs (me) from getting confused. - */ - iE3BTimeout = WIN_DEFAULT_E3B_TIME; + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fUseWinKillKey = TRUE; } + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-nounixkill' argument + */ + if (strcmp(argv[i], "-nounixkill") == 0) + { /* Is this parameter attached to a screen or is it global? */ - if (-1 == g_nLastScreen) + if (-1 == g_iLastScreen) { int j; /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { - g_winScreens[j].iE3BTimeout = iE3BTimeout; + g_ScreenInfo[j].fUseUnixKillKey = FALSE; } } else { /* Parameter is for a single screen */ - g_winScreens[g_nLastScreen].iE3BTimeout = TRUE; + g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = FALSE; } /* Indicate that we have processed this argument */ - return iArgsProcessed; + return 1; + } + + /* + * Look for the '-unixkill' argument + */ + if (strcmp(argv[i], "-unixkill") == 0) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fUseUnixKillKey = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; } return 0; @@ -439,13 +598,17 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) { int i; +#if CYGDEBUG + ErrorF ("InitOutput ()\n"); +#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++) { @@ -453,7 +616,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) } /* Initialize each screen */ - for (i = 0; i < g_nNumScreens; i++) + for (i = 0; i < g_iNumScreens; i++) { if (-1 == AddScreen (winScreenInit, argc, argv)) { diff --git a/xc/programs/Xserver/os/Imakefile b/xc/programs/Xserver/os/Imakefile index 07c884e83..e1c371146 100644 --- a/xc/programs/Xserver/os/Imakefile +++ b/xc/programs/Xserver/os/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.31 2001/04/23 16:17:12 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.33 2001/08/01 00:44:59 tsi Exp $ #include <Server.tmpl> @@ -16,11 +16,6 @@ XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.31 2001/04/23 16:17:12 tsi #define OtherObjects hpsocket.o #endif -#ifdef AmoebaArchitecture -#define OtherSources iopreader.c -#define OtherObjects iopreader.o -#endif - /* * do not modify the following two definitions */ @@ -115,7 +110,7 @@ BOOTSTRAPCFLAGS = PAM_DEFINES = -DUSE_PAM #endif DEFINES = -DXSERV_t -DTRANS_SERVER $(CONNECTION_FLAGS) $(MEM_DEFINES) $(XDMAUTHDEFS) $(RPCDEFS) $(SIGNAL_DEFINES) $(OS_DEFINES) $(KRB5_DEFINES) $(RGB_DEFINES) - INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(TOP)/lib/Xau -I../lbx Krb5Includes + INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(FONTINCSRC) -I$(TOP)/lib/Xau -I../lbx Krb5Includes DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) $(TRANS_INCLUDES) $(CONNECTION_FLAGS) DependDefines LINTLIBS = ../dix/llib-ldix.ln diff --git a/xc/programs/Xserver/os/iopreader.c b/xc/programs/Xserver/os/iopreader.c deleted file mode 100644 index 092c7a7ab..000000000 --- a/xc/programs/Xserver/os/iopreader.c +++ /dev/null @@ -1,179 +0,0 @@ -/* $XConsortium: iopreader.c,v 1.2 94/04/12 17:24:33 dpw Exp $ */ - -/* Copyright (c) 1987 by the Regents of the University of California - * Copyright (c) 1994 by the Vrije Universiteit, Amsterdam. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * and the Vrije Universiteit make no representations about - * the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - */ - -#ifdef AMOEBA -/* - * iopreader.c - * - */ -#define port am_port_t -#include <amoeba.h> -#include <ampolicy.h> -#include <cmdreg.h> -#include <stdcom.h> -#include <stderr.h> -#include <server/iop/iop.h> -#undef port - -#include "osdep.h" - -#define DEVREADER_STACK 8000 -#define MAXEVENTQUEUE 32 - -capability iopcap; - -static mutex lock; -static semaphore empty, filled; - -static IOPEvent event_queue[MAXEVENTQUEUE]; -static int event_qin, event_qout; - -void IOPCleanUp(); -static void IOPServerReader(); - -/* - * Initialize the IOP server - */ -void -InitializeIOPServerReader() -{ - capability hostcap; - errstat err; - - /* - * Initialize event queue - */ - event_qin = event_qout = 0; - sema_init(&empty, MAXEVENTQUEUE); - sema_init(&filled, 0); - mu_init(&lock); - - /* - * Get IOP capability, and enable the server - */ - if (XServerHostName == NULL) - FatalError("No hostname, no screen\n"); - - if ((err = host_lookup(XServerHostName, &hostcap)) != STD_OK || - (err = dir_lookup(&hostcap, DEF_IOPSVRNAME, &iopcap)) != STD_OK) - { - FatalError("Cannot find IOP server for %s: %s\n", - XServerHostName, err_why(err)); - } - - /* - * Enable IOP server - */ - if ((err = iop_enable(&iopcap)) != STD_OK) - FatalError("iop_enable failed (%s)\n", err_why(err)); - - /* - * Start IOP reader thread - */ - atexit(IOPCleanUp); - if (thread_newthread(IOPServerReader, DEVREADER_STACK, 0, 0) <= 0) - FatalError("Cannot start IOP reader thread\n"); -} - -/* - * IOP clean up, actuall disable the IOP server. Its the IOP's own choice - * what do do (perhaps restore the screen?). - */ -void -IOPCleanUp() -{ - errstat err; - - if ((err = iop_disable(&iopcap)) != STD_OK) - ErrorF("iop_disable failed (%s)\n", err_why(err)); -} - -/* - * This threads polls the IOP server for events. Once an event (or a - * number of events) are read, they are queued up using a traditional - * producer/consumer approach. - */ -static void -IOPServerReader() -{ - IOPEvent queue[MAXEVENTQUEUE-1]; - int nevents, i; - errstat err; - - WaitForInitialization(); - -#ifdef XDEBUG - if (amDebug) ErrorF("IOPServerReader() running ...\n"); -#endif - - for (;;) { - do { - nevents = MAXEVENTQUEUE - 1; - err = iop_getevents(&iopcap, queue, &nevents); - if (err != STD_OK) { - if (err != RPC_FAILURE) { - ErrorF("iop_getevents failed (%s)\n", err_why(err)); - } - nevents = 0; - } - } while (nevents <= 0); - - /* store event(s) in the global event queue */ - sema_mdown(&empty, nevents); - mu_lock(&lock); - for (i = 0; i < nevents; i++) { - event_queue[event_qin] = queue[i]; - event_qin = (event_qin + 1) % MAXEVENTQUEUE; - } - mu_unlock(&lock); - sema_mup(&filled, nevents); - WakeUpMainThread(); - } -} - -/* - * Return the number of IOP events waiting - */ -int -AmoebaEventsAvailable() -{ - return sema_level(&filled); -} - -/* - * Get the IOP events from the queue. ``size'' is the maximum the - * requestor cares to handle, the actual size read is returned as - * result. - */ -int -AmoebaGetEvents(queue, size) - IOPEvent *queue; - int size; -{ - int nevents, i; - - if (sema_level(&filled) <= 0) return 0; - if ((nevents = sema_level(&filled)) > size) - nevents = size; - sema_mdown(&filled, nevents); - mu_lock(&lock); - for (i = 0; i < nevents; i++) { - queue[i] = event_queue[event_qout]; - event_qout = (event_qout + 1) % MAXEVENTQUEUE; - } - mu_unlock(&lock); - sema_mup(&empty, nevents); - return nevents; -} -#endif /* AMOEBA */ diff --git a/xc/programs/Xserver/render/mirect.c b/xc/programs/Xserver/render/mirect.c index 009358520..33c7a9f14 100644 --- a/xc/programs/Xserver/render/mirect.c +++ b/xc/programs/Xserver/render/mirect.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/mirect.c,v 1.3 2000/12/08 07:52:05 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/mirect.c,v 1.4 2001/06/08 19:36:34 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -30,6 +30,66 @@ #include "picturestr.h" #include "mipict.h" +static void +miColorRects (PicturePtr pDst, + PicturePtr pClipPict, + xRenderColor *color, + int nRect, + xRectangle *rects, + int xoff, + int yoff) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + CARD32 pixel; + GCPtr pGC; + CARD32 tmpval[4]; + RegionPtr pClip; + unsigned long mask; + + miRenderColorToPixel (pDst->pFormat, color, &pixel); + + pGC = GetScratchGC (pDst->pDrawable->depth, pScreen); + if (!pGC) + return; + tmpval[0] = GXcopy; + tmpval[1] = pixel; + mask = GCFunction | GCForeground; + if (pClipPict->clientClipType == CT_REGION) + { + tmpval[2] = pDst->clipOrigin.x - xoff; + tmpval[3] = pDst->clipOrigin.y - yoff; + mask |= CPClipXOrigin|CPClipYOrigin; + + pClip = REGION_CREATE (pScreen, NULL, 1); + REGION_COPY (pScreen, pClip, + (RegionPtr) pClipPict->clientClip); + (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); + } + + ChangeGC (pGC, mask, tmpval); + ValidateGC (pDst->pDrawable, pGC); + if (xoff || yoff) + { + int i; + for (i = 0; i < nRect; i++) + { + rects[i].x -= xoff; + rects[i].y -= yoff; + } + } + (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects); + if (xoff || yoff) + { + int i; + for (i = 0; i < nRect; i++) + { + rects[i].x += xoff; + rects[i].y += yoff; + } + } + FreeScratchGC (pGC); +} + void miCompositeRects (CARD8 op, PicturePtr pDst, @@ -38,12 +98,6 @@ miCompositeRects (CARD8 op, xRectangle *rects) { ScreenPtr pScreen = pDst->pDrawable->pScreen; - CARD32 pixel; - GCPtr pGC; - CARD32 tmpval[4]; - unsigned long mask; - int error; - RegionPtr pClip; if (color->alpha == 0xffff) { @@ -55,30 +109,12 @@ miCompositeRects (CARD8 op, if (op == PictOpSrc || op == PictOpClear) { - miRenderColorToPixel (pDst->pFormat, color, &pixel); - - pGC = GetScratchGC (pDst->pDrawable->depth, pScreen); - if (!pGC) - return; - tmpval[0] = GXcopy; - tmpval[1] = pixel; - mask = GCFunction | GCForeground; - if (pDst->clientClipType == CT_REGION) - { - tmpval[2] = pDst->clipOrigin.x; - tmpval[3] = pDst->clipOrigin.y; - mask |= CPClipXOrigin|CPClipYOrigin; - - pClip = REGION_CREATE (pScreen, NULL, 1); - REGION_COPY (pScreen, pClip, - (RegionPtr) pDst->clientClip); - (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); - } - - ChangeGC (pGC, mask, tmpval); - ValidateGC (pDst->pDrawable, pGC); - (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects); - FreeScratchGC (pGC); + miColorRects (pDst, pDst, color, nRect, rects, 0, 0); + if (pDst->alphaMap) + miColorRects (pDst->alphaMap, pDst, + color, nRect, rects, + pDst->alphaOrigin.x, + pDst->alphaOrigin.y); } else { @@ -86,6 +122,10 @@ miCompositeRects (CARD8 op, PixmapPtr pPixmap; PicturePtr pSrc; xRectangle one; + int error; + Pixel pixel; + GCPtr pGC; + CARD32 tmpval[2]; rgbaFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); if (!rgbaFormat) diff --git a/xc/programs/Xserver/render/picture.c b/xc/programs/Xserver/render/picture.c index 2db742752..1eabd4f27 100644 --- a/xc/programs/Xserver/render/picture.c +++ b/xc/programs/Xserver/render/picture.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.c,v 1.8 2000/10/21 00:26:13 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/picture.c,v 1.18 2001/08/10 22:25:59 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -38,7 +38,7 @@ #include "servermd.h" #include "picturestr.h" -int PictureScreenPrivateIndex; +int PictureScreenPrivateIndex = -1; int PictureWindowPrivateIndex; int PictureGeneration; RESTYPE PictureType; @@ -53,7 +53,7 @@ PictureDestroyWindow (WindowPtr pWindow) PictureScreenPtr ps = GetPictureScreen(pScreen); Bool ret; - while (pPicture = GetPictureWindow(pWindow)) + while ((pPicture = GetPictureWindow(pWindow))) { SetPictureWindow(pWindow, pPicture->pNext); FreeResource (pPicture->id, PictureType); @@ -71,113 +71,349 @@ PictureCloseScreen (int index, ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); Bool ret; + int n; pScreen->CloseScreen = ps->CloseScreen; ret = (*pScreen->CloseScreen) (index, pScreen); + for (n = 0; n < ps->nformats; n++) + if (ps->formats[n].type == PictTypeIndexed) + (*ps->CloseIndexed) (pScreen, &ps->formats[n]); SetPictureScreen(pScreen, 0); xfree (ps->formats); xfree (ps); return ret; } +void +PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef) +{ + ScreenPtr pScreen = pColormap->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + + pScreen->StoreColors = ps->StoreColors; + (*pScreen->StoreColors) (pColormap, ndef, pdef); + ps->StoreColors = pScreen->StoreColors; + pScreen->StoreColors = PictureStoreColors; + + if (pColormap->class == PseudoColor || pColormap->class == GrayScale) + { + PictFormatPtr format = ps->formats; + int nformats = ps->nformats; + + while (nformats--) + { + if (format->pColormap == pColormap) + { + (*ps->UpdateIndexed) (pScreen, format, ndef, pdef); + break; + } + format++; + } + } +} + +static int +visualDepth (ScreenPtr pScreen, VisualPtr pVisual) +{ + int d, v; + DepthPtr pDepth; + + for (d = 0; d < pScreen->numDepths; d++) + { + pDepth = &pScreen->allowedDepths[d]; + for (v = 0; v < pDepth->numVids; v++) + if (pDepth->vids[v] == pVisual->vid) + return pDepth->depth; + } + return 0; +} + +typedef struct _formatInit { + CARD32 format; + CARD8 depth; +} FormatInitRec, *FormatInitPtr; + +static int +addFormat (FormatInitRec formats[256], + int nformat, + CARD32 format, + CARD8 depth) +{ + int n; + + for (n = 0; n < nformat; n++) + if (formats[n].format == format && formats[n].depth == depth) + return nformat; + formats[nformat].format = format; + formats[nformat].depth = depth; + return ++nformat; +} + +#define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n))-1)) + PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) { - int nformats; + int nformats, f; PictFormatPtr pFormats; + FormatInitRec formats[1024]; + CARD32 format; + CARD8 depth; int i; + VisualPtr pVisual; + int v; + int bpp; + int type; + int r, g, b; + int d; + DepthPtr pDepth; + + nformats = 0; + /* formats required by protocol */ + formats[nformats].format = PICT_a8r8g8b8; + formats[nformats].depth = 32; + nformats++; + formats[nformats].format = PICT_x8r8g8b8; + formats[nformats].depth = 32; + nformats++; + formats[nformats].format = PICT_a1; + formats[nformats].depth = 1; + nformats++; + formats[nformats].format = PICT_a4; + formats[nformats].depth = 4; + nformats++; + formats[nformats].format = PICT_a8; + formats[nformats].depth = 8; + nformats++; + + /* now look through the depths and visuals adding other formats */ + for (v = 0; v < pScreen->numVisuals; v++) + { + pVisual = &pScreen->visuals[v]; + depth = visualDepth (pScreen, pVisual); + if (!depth) + continue; + bpp = BitsPerPixel (depth); + switch (pVisual->class) { + case DirectColor: + case TrueColor: + r = Ones (pVisual->redMask); + g = Ones (pVisual->greenMask); + b = Ones (pVisual->blueMask); + type = PICT_TYPE_OTHER; + /* + * Current rendering code supports only two direct formats, + * fields must be packed together at the bottom of the pixel + * and must be either RGB or BGR + */ + if (pVisual->offsetBlue == 0 && + pVisual->offsetGreen == b && + pVisual->offsetRed == b + g) + { + type = PICT_TYPE_ARGB; + } + else if (pVisual->offsetRed == 0 && + pVisual->offsetGreen == r && + pVisual->offsetBlue == r + g) + { + type = PICT_TYPE_ABGR; + } + if (type != PICT_TYPE_OTHER) + { + format = PICT_FORMAT(bpp, type, 0, r, g, b); + nformats = addFormat (formats, nformats, format, depth); + } + break; + case StaticColor: + case PseudoColor: + format = PICT_FORMAT (bpp, PICT_TYPE_COLOR, v, 0, 0, 0); + nformats = addFormat (formats, nformats, format, depth); + break; + case StaticGray: + case GrayScale: + format = PICT_FORMAT (bpp, PICT_TYPE_GRAY, v, 0, 0, 0); + nformats = addFormat (formats, nformats, format, depth); + break; + } + } + /* + * Walk supported depths and add useful Direct formats + */ + for (d = 0; d < pScreen->numDepths; d++) + { + pDepth = &pScreen->allowedDepths[d]; + bpp = BitsPerPixel (pDepth->depth); + format = 0; + switch (bpp) { + case 16: + /* depth 15 formats */ + if (pDepth->depth >= 15) + { + nformats = addFormat (formats, nformats, + PICT_x1r5g5b5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_x1b5g5r5, pDepth->depth); + } + /* depth 16 formats */ + if (pDepth->depth >= 16) + { + nformats = addFormat (formats, nformats, + PICT_a1r5g5b5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_a1b5g5r5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_r5g6b5, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_b5g6r5, pDepth->depth); + } + break; + case 24: + if (pDepth->depth >= 24) + { + nformats = addFormat (formats, nformats, + PICT_r8g8b8, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_b8g8r8, pDepth->depth); + } + break; + case 32: + if (pDepth->depth >= 24) + { + nformats = addFormat (formats, nformats, + PICT_x8r8g8b8, pDepth->depth); + nformats = addFormat (formats, nformats, + PICT_x8b8g8r8, pDepth->depth); + } + break; + } + } + - nformats = 6; pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec)); if (!pFormats) return 0; - i = 0; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 32; - pFormats[i].direct.red = 16; - pFormats[i].direct.redMask = 0xff; - pFormats[i].direct.green = 8; - pFormats[i].direct.greenMask = 0xff; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0xff; - pFormats[i].direct.alpha = 24; - pFormats[i].direct.alphaMask = 0xff; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 8; - pFormats[i].direct.red = 0; - pFormats[i].direct.redMask = 0; - pFormats[i].direct.green = 0; - pFormats[i].direct.greenMask = 0; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0xff; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 24; - pFormats[i].direct.red = 16; - pFormats[i].direct.redMask = 0xff; - pFormats[i].direct.green = 8; - pFormats[i].direct.greenMask = 0xff; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0xff; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0x0; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 16; - pFormats[i].direct.red = 11; - pFormats[i].direct.redMask = 0x1f; - pFormats[i].direct.green = 5; - pFormats[i].direct.greenMask = 0x3f; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0x1f; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0x0; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 15; - pFormats[i].direct.red = 10; - pFormats[i].direct.redMask = 0x1f; - pFormats[i].direct.green = 5; - pFormats[i].direct.greenMask = 0x1f; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0x1f; - pFormats[i].direct.alpha = 0; - pFormats[i].direct.alphaMask = 0x0; - pFormats[i].pColormap = 0; - i++; - pFormats[i].id = FakeClientID (0); - pFormats[i].type = PictTypeDirect; - pFormats[i].depth = 16; - pFormats[i].direct.red = 10; - pFormats[i].direct.redMask = 0x1f; - pFormats[i].direct.green = 5; - pFormats[i].direct.greenMask = 0x1f; - pFormats[i].direct.blue = 0; - pFormats[i].direct.blueMask = 0x1f; - pFormats[i].direct.alpha = 15; - pFormats[i].direct.alphaMask = 0x1; - pFormats[i].pColormap = 0; - i++; - *nformatp = i; + memset (pFormats, '\0', nformats * sizeof (PictFormatRec)); + for (f = 0; f < nformats; f++) + { + pFormats[f].id = FakeClientID (0); + pFormats[f].depth = formats[f].depth; + format = formats[f].format; + pFormats[f].format = format; + switch (PICT_FORMAT_TYPE(format)) { + case PICT_TYPE_ARGB: + pFormats[f].type = PictTypeDirect; + + pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); + if (pFormats[f].direct.alphaMask) + pFormats[f].direct.alpha = (PICT_FORMAT_R(format) + + PICT_FORMAT_G(format) + + PICT_FORMAT_B(format)); + + pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); + pFormats[f].direct.red = (PICT_FORMAT_G(format) + + PICT_FORMAT_B(format)); + + pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); + pFormats[f].direct.green = PICT_FORMAT_B(format); + + pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); + pFormats[f].direct.blue = 0; + break; + + case PICT_TYPE_ABGR: + pFormats[f].type = PictTypeDirect; + + pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); + if (pFormats[f].direct.alphaMask) + pFormats[f].direct.alpha = (PICT_FORMAT_B(format) + + PICT_FORMAT_G(format) + + PICT_FORMAT_R(format)); + + pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); + pFormats[f].direct.blue = (PICT_FORMAT_G(format) + + PICT_FORMAT_R(format)); + + pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); + pFormats[f].direct.green = PICT_FORMAT_R(format); + + pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); + pFormats[f].direct.red = 0; + break; + + case PICT_TYPE_A: + pFormats[f].type = PictTypeDirect; + + pFormats[f].direct.alpha = 0; + pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); + + /* remaining fields already set to zero */ + break; + + case PICT_TYPE_COLOR: + case PICT_TYPE_GRAY: + pFormats[f].type = PictTypeIndexed; + pFormats[f].format = PICT_FORMAT(PICT_FORMAT_BPP(format), + PICT_FORMAT_TYPE(format), + 0, 0, 0, 0); + pFormats[f].pVisual = &pScreen->visuals[PICT_FORMAT_A(format)]; + break; + } + } + *nformatp = nformats; return pFormats; } +Bool +PictureInitIndexedFormats (ScreenPtr pScreen) +{ + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); + PictFormatPtr format; + int nformat; + + if (!ps) + return FALSE; + format = ps->formats; + nformat = ps->nformats; + while (nformat--) + { + if (format->type == PictTypeIndexed && !format->pColormap) + { + if (format->pVisual->vid == pScreen->rootVisual) + format->pColormap = (ColormapPtr) LookupIDByType(pScreen->defColormap, + RT_COLORMAP); + else + { + if (CreateColormap (FakeClientID (0), pScreen, + format->pVisual, + &format->pColormap, AllocNone, + 0) != Success) + { + return FALSE; + } + } + if (!(*ps->InitIndexed) (pScreen, format)) + return FALSE; + } + format++; + } + return TRUE; +} + +Bool +PictureFinishInit (void) +{ + int s; + + for (s = 0; s < screenInfo.numScreens; s++) + if (!PictureInitIndexedFormats (screenInfo.screens[s])) + return FALSE; + return TRUE; +} + PictFormatPtr PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual) { - PictureScreenPtr ps = GetPictureScreen(pScreen); + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictFormatPtr format; int nformat; int type; @@ -197,6 +433,7 @@ PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual) type = PictTypeDirect; break; case DirectColor: + default: return 0; } while (nformat--) @@ -205,7 +442,7 @@ PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual) { if (type == PictTypeIndexed) { - if (format->pColormap && format->pColormap->pVisual == pVisual) + if (format->pVisual == pVisual) return format; } else @@ -229,10 +466,9 @@ PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual) PictFormatPtr PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 f) { - PictureScreenPtr ps = GetPictureScreen(pScreen); + PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictFormatPtr format; int nformat; - int type; if (!ps) return 0; @@ -240,7 +476,7 @@ PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 f) nformat = ps->nformats; while (nformat--) { - if (format->depth == depth && format->format == f & 0xffffff) + if (format->depth == depth && format->format == (f & 0xffffff)) return format; format++; } @@ -271,6 +507,9 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) PictureWindowPrivateIndex = AllocateWindowPrivateIndex(); PictureGeneration = serverGeneration; } + if (!AllocateWindowPrivate (pScreen, PictureWindowPrivateIndex, 0)) + return FALSE; + if (!formats) { formats = PictureCreateDefaultFormats (pScreen, &nformats); @@ -286,7 +525,10 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) } if (formats[n].type == PictTypeIndexed) { - type = PICT_TYPE_INDEX; + if ((formats[n].pVisual->class | DynamicClass) == PseudoColor) + type = PICT_TYPE_COLOR; + else + type = PICT_TYPE_GRAY; a = r = g = b = 0; } else @@ -331,8 +573,10 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) ps->CloseScreen = pScreen->CloseScreen; ps->DestroyWindow = pScreen->DestroyWindow; + ps->StoreColors = pScreen->StoreColors; pScreen->DestroyWindow = PictureDestroyWindow; pScreen->CloseScreen = PictureCloseScreen; + pScreen->StoreColors = PictureStoreColors; return TRUE; } @@ -348,6 +592,7 @@ SetPictureToDefaults (PicturePtr pPicture) pPicture->polyMode = PolyModePrecise; pPicture->freeCompClip = FALSE; pPicture->clientClipType = CT_NONE; + pPicture->componentAlpha = FALSE; pPicture->alphaMap = 0; pPicture->alphaOrigin.x = 0; @@ -458,7 +703,6 @@ ChangePicture (PicturePtr pPicture, PictureScreenPtr ps = GetPictureScreen(pScreen); BITS32 index2; int error = 0; - PixmapPtr pPixmap; BITS32 maskQ; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; @@ -545,10 +789,6 @@ ChangePicture (PicturePtr pPicture, if (vlist) { - pPixmap = NEXT_PTR(PixmapPtr); - } - else - { pid = NEXT_VAL(Pixmap); if (pid == None) { @@ -557,6 +797,7 @@ ChangePicture (PicturePtr pPicture, } else { + clipType = CT_PIXMAP; pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pid, RT_PIXMAP, @@ -569,6 +810,14 @@ ChangePicture (PicturePtr pPicture, } } } + else + { + pPixmap = NEXT_PTR(PixmapPtr); + if (pPixmap) + clipType = CT_PIXMAP; + else + clipType = CT_NONE; + } if (pPixmap) { @@ -643,6 +892,20 @@ ChangePicture (PicturePtr pPicture, case CPDither: pPicture->dither = NEXT_VAL(Atom); break; + case CPComponentAlpha: + { + unsigned int newca; + + newca = NEXT_VAL (unsigned int); + if (newca <= xTrue) + pPicture->componentAlpha = newca; + else + { + client->errorValue = newca; + error = BadValue; + } + } + break; default: client->errorValue = maskQ; error = BadValue; @@ -653,8 +916,36 @@ ChangePicture (PicturePtr pPicture, return error; } -void -ValidatePicture(PicturePtr pPicture) +int +SetPictureClipRects (PicturePtr pPicture, + int xOrigin, + int yOrigin, + int nRect, + xRectangle *rects) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + RegionPtr clientClip; + int result; + + clientClip = RECTS_TO_REGION(pScreen, + nRect, rects, CT_UNSORTED); + if (!clientClip) + return BadAlloc; + result =(*ps->ChangePictureClip) (pPicture, CT_REGION, + (pointer) clientClip, 0); + if (result == Success) + { + pPicture->clipOrigin.x = xOrigin; + pPicture->clipOrigin.y = yOrigin; + pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask; + pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; + } + return result; +} + +static void +ValidateOnePicture (PicturePtr pPicture) { if (pPicture->serialNumber != pPicture->pDrawable->serialNumber) { @@ -666,6 +957,14 @@ ValidatePicture(PicturePtr pPicture) } } +void +ValidatePicture(PicturePtr pPicture) +{ + ValidateOnePicture (pPicture); + if (pPicture->alphaMap) + ValidateOnePicture (pPicture->alphaMap); +} + int FreePicture (pointer value, XID pid) @@ -763,3 +1062,16 @@ CompositeGlyphs (CARD8 op, ValidatePicture (pDst); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, glyphs); } + +void +CompositeRects (CARD8 op, + PicturePtr pDst, + xRenderColor *color, + int nRect, + xRectangle *rects) +{ + PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); + + ValidatePicture (pDst); + (*ps->CompositeRects) (op, pDst, color, nRect, rects); +} diff --git a/xc/programs/Xserver/render/picture.h b/xc/programs/Xserver/render/picture.h index d2dc4ed1c..b7f7bf3fc 100644 --- a/xc/programs/Xserver/render/picture.h +++ b/xc/programs/Xserver/render/picture.h @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.h,v 1.5 2000/11/21 04:11:42 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/picture.h,v 1.7 2001/08/10 22:25:59 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -50,11 +50,12 @@ typedef struct _Picture *PicturePtr; #define PICT_FORMAT_B(f) (((f) ) & 0x0f) #define PICT_FORMAT_RGB(f) (((f) ) & 0xfff) -#define PICT_OTHER 0 +#define PICT_TYPE_OTHER 0 #define PICT_TYPE_A 1 #define PICT_TYPE_ARGB 2 #define PICT_TYPE_ABGR 3 -#define PICT_TYPE_INDEX 4 +#define PICT_TYPE_COLOR 4 +#define PICT_TYPE_GRAY 5 #define PICT_FORMAT_COLOR(f) (PICT_FORMAT_TYPE(f) & 2) @@ -84,6 +85,9 @@ typedef struct _Picture *PicturePtr; #define PICT_a2r2g2b2 PICT_FORMAT(8,PICT_TYPE_ARGB,2,2,2,2) #define PICT_a2b2g2r2 PICT_FORMAT(8,PICT_TYPE_ABGR,2,2,2,2) +#define PICT_c8 PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0) +#define PICT_g8 PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0) + /* 4bpp formats */ #define PICT_a4 PICT_FORMAT(4,PICT_TYPE_A,4,0,0,0) #define PICT_r1g2b1 PICT_FORMAT(4,PICT_TYPE_ARGB,0,1,2,1) @@ -91,9 +95,14 @@ typedef struct _Picture *PicturePtr; #define PICT_a1r1g1b1 PICT_FORMAT(4,PICT_TYPE_ARGB,1,1,1,1) #define PICT_a1b1g1r1 PICT_FORMAT(4,PICT_TYPE_ABGR,1,1,1,1) +#define PICT_c4 PICT_FORMAT(4,PICT_TYPE_COLOR,0,0,0,0) +#define PICT_g4 PICT_FORMAT(4,PICT_TYPE_GRAY,0,0,0,0) + /* 1bpp formats */ #define PICT_a1 PICT_FORMAT(1,PICT_TYPE_A,1,0,0,0) +#define PICT_g1 PICT_FORMAT(1,PICT_TYPE_GRAY,0,0,0,0) + #define FixedToInt(f) (int) ((f) >> 8) #define IntToFixed(i) ((Fixed) (i) << 8) #define FixedE ((Fixed) 1) diff --git a/xc/programs/Xserver/render/picturestr.h b/xc/programs/Xserver/render/picturestr.h index ff2ee58ea..6f9db4ac8 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.13 2001/04/05 17:42:35 dawes Exp $ + * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.16 2001/08/01 00:45:00 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -43,6 +43,8 @@ typedef struct _PictFormat { unsigned char type; unsigned char depth; DirectFormatRec direct; + void *indexed; /* opaque indexed conversion data */ + VisualPtr pVisual; /* for indexed formats */ ColormapPtr pColormap; } PictFormatRec; @@ -121,6 +123,17 @@ typedef void (*CompositeRectsProcPtr) (CARD8 op, int nRect, xRectangle *rects); +typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen, + PictFormatPtr pFormat); + +typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen, + PictFormatPtr pFormat); + +typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen, + PictFormatPtr pFormat, + int ndef, + xColorItem *pdef); + typedef struct _PictureScreen { int totalPictureSize; unsigned int *PicturePrivateSizes; @@ -145,6 +158,12 @@ typedef struct _PictureScreen { DestroyWindowProcPtr DestroyWindow; CloseScreenProcPtr CloseScreen; + StoreColorsProcPtr StoreColors; + + InitIndexedProcPtr InitIndexed; + CloseIndexedProcPtr CloseIndexed; + UpdateIndexedProcPtr UpdateIndexed; + } PictureScreenRec, *PictureScreenPtr; extern int PictureScreenPrivateIndex; @@ -193,6 +212,9 @@ PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format); Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); +Bool +PictureFinishInit (void); + void SetPictureToDefaults (PicturePtr pPicture); diff --git a/xc/programs/Xserver/render/render.c b/xc/programs/Xserver/render/render.c index 9a713ed47..dd37f8f25 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.10 2001/03/08 03:48:44 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/render.c,v 1.12 2001/08/16 08:03:25 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -177,6 +177,8 @@ RenderExtensionInit (void) if (!PictureType) return; + if (!PictureFinishInit ()) + return; extEntry = AddExtension (RENDER_NAME, 0, RenderNumberErrors, ProcRenderDispatch, SProcRenderDispatch, RenderResetProc, StandardMinorOpcode); @@ -543,13 +545,25 @@ ProcRenderFreePicture (ClientPtr client) return(client->noClientException); } +static Bool +PictOpValid (CARD8 op) +{ + if (/*PictOpMinimum <= op && */ op <= PictOpMaximum) + return TRUE; + if (PictOpDisjointMinimum <= op && op <= PictOpDisjointMaximum) + return TRUE; + if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum) + return TRUE; + return FALSE; +} + static int ProcRenderComposite (ClientPtr client) { PicturePtr pSrc, pMask, pDst; REQUEST(xRenderCompositeReq); - if (stuff->op > PictOpMaximum) + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; @@ -869,6 +883,11 @@ ProcRenderCompositeGlyphs (ClientPtr client) case X_RenderCompositeGlyphs32: size = 4; break; } + if (!PictOpValid (stuff->op)) + { + client->errorValue = stuff->op; + return BadValue; + } VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, @@ -1030,7 +1049,7 @@ ProcRenderFillRectangles (ClientPtr client) int things; REQUEST(xRenderFillRectanglesReq); - if (stuff->op > PictOpMaximum) + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; diff --git a/xc/util/patch/ChangeLog b/xc/util/patch/ChangeLog deleted file mode 100644 index 305293787..000000000 --- a/xc/util/patch/ChangeLog +++ /dev/null @@ -1,290 +0,0 @@ -Mon May 31 00:49:40 1993 Paul Eggert (eggert@twinsun.com) - - * patchlevel.h: PATCHLEVEL 12u9. - - * inp.c (plan_a): Don't lock the checked-out file if `patch -o' - redirected the output elsewhere. - * common.h (CHECKOUT_LOCKED, GET_LOCKED): New macros. GET and - CHECKOUT now just checkout unlocked copies. - - * Makefile (dist): Use gzip, not compress. - -Fri May 28 08:44:50 1993 Paul Eggert (eggert@twinsun.com) - - * backupfile.c (basename): Define even if NODIR isn't defined. - * patch.c (main): Ask just once to apply a reversed patch. - -Tue Sep 15 00:36:15 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u8. - -Mon Sep 14 22:01:23 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Makefile.SH: Add uninstall target. Simplify install target. - - * util.c (fatal, pfatal): Add some asterisks to make fatal - messages stand out more. - -Tue Aug 25 22:13:36 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * patch.c (main, get_some_switches), common.h, inp.c (plan_a, - plan_b), pch.c (there_is_another_patch): Add -t option, - similar to -f. - -Mon Jul 27 11:27:07 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * inp.c (plan_a, util.c (fetchname): Use a macro to simplify code. - * common.h: Define SCCSDIFF and RCSDIFF. - * inp.c (plan_a): Use them to make sure it's safe to check out - the default RCS or SCCS version. - From Paul Eggert. - -Wed Jul 22 14:37:08 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * patch.man: Use the standard comment syntax -- '\" -- instead - of '''. - -Tue Jul 21 15:26:01 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Configure: Add /etc /usr/lib /lib to pth. - -Mon Jul 20 14:10:32 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * util.h: Declare basename. - * inp.c (plan_a), util.c (fetchname): Use it to isolate the - leading path when testing for RCS and SCCS files. - -Sat Jul 11 18:03:26 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Configure: Use the user's PATH and build pth from it. - -Fri Jul 10 16:03:23 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * Configure: Change cc -S to cc -c and tr '[ - ]' '[\012-\012]' - to tr ' ' '\012' for AIX 3.2. - From chip@tct.com (Chip Salzenberg). - - * util.c (makedirs): Only make the directories that don't exist. - From chip@tct.com (Chip Salzenberg). - -Wed Jul 8 01:21:15 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * util.c (fatal, pfatal): Print "patch: " before message. - * pch.c, inp.c, patch.c, util.c: Remove "patch: " from the - callers that had it. - - * util.c (pfatal): New function. - * util.h: Declare it and pfatal[1-4] macros. - * various files: Use it instead of fatal where appropriate. - - * Configure: Make /usr/local/man/man1 the first choice for the - man pages. - - * patch.c (main): Open ofp after checking for ed script. - Close ofp and rejfp before trying plan B. - From epang@sfu.ca (Eugene Pang). - - * backupfile.h: Declare get_version. - - * Move decls of rindex and popen to common.h. - - * common.h (myuid): New variable. - * patch.c (main): Initialize it. - * inp.c (myuid): Function removed. - (plan_a): Use the variable, not the function. - - * patch.c: Reinstate -E option. - -Tue Jul 7 23:19:28 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * inp.c (myuid): New function. - (plan_a): Call it. Optimize stat calls. Be smarter about - detecting checked out RCS and SCCS files. - From Paul Eggert (eggert@twinsun.com). - - * inp.c, util.c, patch.c: Don't bother checking for stat() > 0. - -Mon Jul 6 13:01:52 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * version.c (version): Don't print the RCS stuff, since we're - not updating it regularly. - - * patch.c (get_some_switches): Make the usage message more accurate. - - * patchlevel.h: PATCHLEVEL 12u7. - - * Makefile.SH (dist): New target. - Makedist: File removed. - - * inp.c (plan_a): Check whether the user can write to the - file, not whether anyone can write to the file. - -Sat Jul 4 00:06:58 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * inp.c (plan_a): Try to check out read-only files from RCS or SCCS. - - * util.c (move_file): If backing up by linking fails, try copying. - From cek@sdc.boeing.com (Conrad Kimball). - - * patch.c (get_some_switches): Eliminate -E option; always - remove empty output files. - - * util.c (fetchname): Only undo slash removal for relative - paths if -p was not given. - - * Makefile.sh: Add mostlyclean target. - -Fri Jul 3 23:48:14 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * util.c (fetchname): Accept whitespace between `Index:' and filename. - Also plug a small memory leak for diffs against /dev/null. - From eggert@twinsun.com (Paul Eggert). - - * common.h: Don't define TRUE and FALSE if already defined. - From phk@data.fls.dk (Poul-Henning Kamp). - -Wed Apr 29 10:19:33 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) - - * backupfile.c (get_version): Exit if given a bad backup type. - -Fri Mar 27 09:57:14 1992 Karl Berry (karl at hayley) - - * common.h (S_ISDIR, S_ISREG): define these. - * inp.c (plan_a): use S_ISREG, not S_IFREG. - * util.c (fetchname): use S_ISDIR, not S_IFDIR. - -Mon Mar 16 14:10:42 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u6. - -Sat Mar 14 13:13:29 1992 David J. MacKenzie (djm at frob.eng.umd.edu) - - * Configure, config.h.SH: Check for directory header and unistd.h. - - * patch.c (main): If -E was given and output file is empty after - patching, remove it. - (get_some_switches): Recognize -E option. - - * patch.c (copy_till): Make garbled output an error, not a warning - that doesn't change the exit status. - - * common.h: Protect against system declarations of malloc and realloc. - - * Makedist: Add backupfile.[ch]. - - * Configure: Look for C library where NeXT and SVR4 put it. - Look in /usr/ucb after /bin and /usr/bin for utilities, - and look in /usr/ccs/bin, to make SVR4 happier. - Recognize m68k predefine. - - * util.c (fetchname): Test of stat return value was backward. - From csss@scheme.cs.ubc.ca. - - * version.c (version): Exit with status 0, not 1. - - * Makefile.SH: Add backupfile.[cho]. - * patch.c (main): Initialize backup file generation. - (get_some_switches): Add -V option. - * common.h, util,c, patch.c: Replace origext with simple_backup_suffix. - * util.c (move_file): Use find_backup_file_name. - -Tue Dec 3 11:27:16 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u5. - - * Makefile.SH: Change clean, distclean, and realclean targets a - little so they agree with the GNU coding standards. - Add Makefile to addedbyconf, so distclean removes it. - - * Configure: Recognize Domain/OS C library in /lib/libc. - From mmuegel@mot.com (Michael S. Muegel). - - * pch.c: Fixes from Wayne Davison: - Patch now accepts no-context context diffs that are - specified with an assumed one line hunk (e.g. "*** 10 ****"). - Fixed a bug in both context and unified diff processing that would - put a zero-context hunk in the wrong place (one line too soon). - Fixed a minor problem with p_max in unified diffs where it would - set p_max to hunkmax unnecessarily (the only adverse effect was to - not supply empty lines at eof by assuming they were truncated). - -Tue Jul 2 03:25:51 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu) - - * Configure: Check for signal declaration in - /usr/include/sys/signal.h as well as /usr/include/signal.h. - - * Configure, common.h, config.h.SH: Comment out the sprintf - declaration and tests to determine its return value type. It - conflicts with ANSI C systems' prototypes in stdio.h and the - return value of sprintf is never used anyway -- it's always cast - to void. - -Thu Jun 27 13:05:32 1991 David J. MacKenzie (djm at churchy.gnu.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u4. - -Thu Feb 21 15:18:14 1991 David J. MacKenzie (djm at geech.ai.mit.edu) - - * pch.c (another_hunk): Fix off by 1 error. From - iverson@xstor.com (Tim Iverson). - -Sun Jan 20 20:18:58 1991 David J. MacKenzie (djm at geech.ai.mit.edu) - - * Makefile.SH (all): Don't make a dummy `all' file. - - * patchlevel.h: PATCHLEVEL 12u3. - - * patch.c (nextarg): New function. - (get_some_switches): Use it, to prevent dereferencing a null - pointer if an option that takes an arg is not given one (is last - on the command line). From Paul Eggert. - - * pch.c (another_hunk): Fix from Wayne Davison to recognize - single-line hunks in unified diffs (with a single line number - instead of a range). - - * inp.c (rev_in_string): Don't use `s' before defining it. From - Wayne Davison. - -Mon Jan 7 06:25:11 1991 David J. MacKenzie (djm at geech.ai.mit.edu) - - * patchlevel.h: PATCHLEVEL 12u2. - - * pch.c (intuit_diff_type): Recognize `+++' in diff headers, for - unified diff format. From unidiff patch 1. - -Mon Dec 3 00:14:25 1990 David J. MacKenzie (djm at albert.ai.mit.edu) - - * patch.c (get_some_switches): Make the usage message more - informative. - -Sun Dec 2 23:20:18 1990 David J. MacKenzie (djm at albert.ai.mit.edu) - - * Configure: When checking for C preprocessor, look for 'abc.*xyz' - instead of 'abc.xyz', so ANSI C preprocessors work. - - * Apply fix for -D from ksb@mentor.cc.purdue.edu (Kevin Braunsdorf). - - * Apply unidiff patches from davison@dri.com (Wayne Davison). - -Wed Mar 7 23:47:25 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) - - * pch.c: Call malformed instead of goto malformed - (just allows easier debugging). - -Tue Jan 23 21:27:00 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) - - * common.h (TMP*NAME): Make these char *, not char []. - patch.c (main): Use TMPDIR (if present) to set TMP*NAME. - common.h: Declare getenv. - -Sun Dec 17 17:29:48 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu) - - * patch.c (reverse_flag_specified): New variable. - (get_some_switches, reinitialize_almost_everything): Use it. - -Local Variables: -mode: indented-text -left-margin: 8 -version-control: never -end: diff --git a/xc/util/patch/Configure b/xc/util/patch/Configure deleted file mode 100755 index 0636a7258..000000000 --- a/xc/util/patch/Configure +++ /dev/null @@ -1,1476 +0,0 @@ -#! /bin/sh -# -# If these # comments don't work, trim them. Don't worry about any other -# shell scripts, Configure will trim # comments from them for you. -# -# (If you are trying to port this package to a machine without sh, I would -# suggest you cut out the prototypical config.h from the end of Configure -# and edit it to reflect your system. Some packages may include samples -# of config.h for certain machines, so you might look for one of those.) -# -# oldHeader: Head.U,v 1.0 87/05/22 12:28:10 lwall Exp $ -# $XConsortium: Configure,v 1.1 94/09/09 20:04:01 gildea Exp $ -# -# Yes, you may rip this off to use in other distribution packages. -# (Note: this Configure script was generated automatically. Rather than -# working with this copy of Configure, you may wish to get metaconfig.) - -: sanity checks -: the user has a better chance than we do of setting a reasonable PATH -: but add some directories we need that are probably not there -PATH=.:${PATH}:/etc:/usr/lib:/lib -export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) - -if test ! -t 0; then - echo "Say 'sh Configure', not 'sh <Configure'" - exit 1 -fi - -(alias) >/dev/null 2>&1 && \ - echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \ - echo "especially on exotic machines. If yours does, try the Bourne shell instead.)" - -if test ! -d ../UU; then - if test ! -d UU; then - mkdir UU - fi - cd UU -fi - -case "$1" in --d) shift; fastread='yes';; -esac - -d_eunice='' -eunicefix='' -define='' -loclist='' -expr='' -sed='' -echo='' -cat='' -rm='' -mv='' -cp='' -tail='' -tr='' -mkdir='' -sort='' -uniq='' -grep='' -trylist='' -test='' -inews='' -egrep='' -more='' -pg='' -Mcc='' -vi='' -mailx='' -mail='' -cpp='' -Log='' -Header='' -bin='' -cc='' -contains='' -cppstdin='' -cppminus='' -d_charsprf='' -d_flexfnam='' -d_index='' -d_voidsig='' -d_dirheader='' -d_unistd='' -libc='' -mansrc='' -manext='' -models='' -split='' -small='' -medium='' -large='' -huge='' -ccflags='' -ldflags='' -n='' -c='' -package='' -registers='' -reg1='' -reg2='' -reg3='' -reg4='' -reg5='' -reg6='' -reg7='' -reg8='' -reg9='' -reg10='' -reg11='' -reg12='' -reg13='' -reg14='' -reg15='' -reg16='' -spitshell='' -shsharp='' -sharpbang='' -startsh='' -voidflags='' -defvoidused='' -CONFIG='' -: set package name -package=patch - -echo " " -echo "Beginning of configuration questions for $package kit." -: Eunice requires " " instead of "", can you believe it -echo " " - -define='define' -undef='/*undef' -libpth='/usr/lib /usr/local/lib /lib /usr/ccs/lib' -smallmach='pdp11 i8086 z8000 i80286 iAPX286' -rmlist='kit[1-9]isdone kit[1-9][0-9]isdone' -trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3 - -: We must find out about Eunice early -eunicefix=':' -if test -f /etc/unixtovms; then - eunicefix=/etc/unixtovms -fi -if test -f /etc/unixtovms.exe; then - eunicefix=/etc/unixtovms.exe -fi - -attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr" -attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200" -attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc" -attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX" -attrlist="$attrlist mc68k m68k __STDC__" -pth=`echo $PATH | tr : ' '` -d_newshome="../../NeWS" -defvoidused=7 - -: some greps do not return status, grrr. -echo "grimblepritz" >grimble -if grep blurfldyick grimble >/dev/null 2>&1 ; then - contains=contains -elif grep grimblepritz grimble >/dev/null 2>&1 ; then - contains=grep -else - contains=contains -fi -rm -f grimble -: the following should work in any shell -case "$contains" in -contains*) - echo " " - echo "AGH! Grep doesn't return a status. Attempting remedial action." - cat >contains <<'EOSS' -grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp -EOSS -chmod +x contains -esac - -: first determine how to suppress newline on echo command -echo "Checking echo to see how to suppress newlines..." -(echo "hi there\c" ; echo " ") >.echotmp -if $contains c .echotmp >/dev/null 2>&1 ; then - echo "...using -n." - n='-n' - c='' -else - cat <<'EOM' -...using \c -EOM - n='' - c='\c' -fi -echo $n "Type carriage return to continue. Your cursor should be here-->$c" -read ans -rm -f .echotmp - -: now set up to do reads with possible shell escape and default assignment -cat <<EOSC >myread -case "\$fastread" in -yes) ans=''; echo " " ;; -*) ans='!';; -esac -while expr "X\$ans" : "X!" >/dev/null; do - read ans - case "\$ans" in - !) - sh - echo " " - echo $n "\$rp $c" - ;; - !*) - set \`expr "X\$ans" : "X!\(.*\)\$"\` - sh -c "\$*" - echo " " - echo $n "\$rp $c" - ;; - esac -done -rp='Your answer:' -case "\$ans" in -'') ans="\$dflt";; -esac -EOSC - -: general instructions -cat <<EOH - -This installation shell script will examine your system and ask you questions -to determine how the $package package should be installed. If you get stuck -on a question, you may use a ! shell escape to start a subshell or execute -a command. Many of the questions will have default answers in square -brackets--typing carriage return will give you the default. - -On some of the questions which ask for file or directory names you are -allowed to use the ~name construct to specify the login directory belonging -to "name", even if you don't have a shell which knows about that. Questions -where this is allowed will be marked "(~name ok)". - -EOH -rp="[Type carriage return to continue]" -echo $n "$rp $c" -. myread -cat <<EOH - -Much effort has been expended to ensure that this shell script will run -on any Unix system. If despite that it blows up on you, your best bet is -to edit Configure and run it again. Also, let me (lwall@netlabs.com) -know how I blew it. If you can't run Configure for some reason, you'll have -to generate a config.sh file by hand. - -This installation script affects things in two ways: 1) it may do direct -variable substitutions on some of the files included in this kit, and -2) it builds a config.h file for inclusion in C programs. You may edit -any of these files as the need arises after running this script. - -If you make a mistake on a question, there is no easy way to back up to it -currently. The easiest thing to do is to edit config.sh and rerun all the -SH files. Configure will offer to let you do this before it runs the SH files. - -EOH -rp="[Type carriage return to continue]" -echo $n "$rp $c" -. myread - -: get old answers, if there is a config file out there -if test -f ../config.sh; then - echo " " - dflt=y - rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]" - echo $n "$rp $c" - . myread - case "$ans" in - n*) echo "OK, I'll ignore it.";; - *) echo "Fetching default answers from your old config.sh file..." - tmp="$n" - ans="$c" - . ../config.sh - n="$tmp" - c="$ans" - ;; - esac -fi - -: find out where common programs are -echo " " -echo "Locating common programs..." -cat <<EOSC >loc -$startsh -case \$# in -0) exit 1;; -esac -thing=\$1 -shift -dflt=\$1 -shift -for dir in \$*; do - case "\$thing" in - .) - if test -d \$dir/\$thing; then - echo \$dir - exit 0 - fi - ;; - *) - if test -f \$dir/\$thing; then - echo \$dir/\$thing - exit 0 - elif test -f \$dir/\$thing.exe; then - : on Eunice apparently - echo \$dir/\$thing - exit 0 - fi - ;; - esac -done -echo \$dflt -exit 1 -EOSC -chmod +x loc -$eunicefix loc -loclist=" -expr -sed -echo -cat -rm -tr -grep -" -trylist=" -test -Mcc -cpp -" -for file in $loclist; do - xxx=`loc $file $file $pth` - eval $file=$xxx - eval _$file=$xxx - case "$xxx" in - /*) - echo $file is in $xxx. - ;; - *) - echo "I don't know where $file is. I hope it's in everyone's PATH." - ;; - esac -done -echo " " -echo "Don't worry if any of the following aren't found..." -ans=offhand -for file in $trylist; do - xxx=`loc $file $file $pth` - eval $file=$xxx - eval _$file=$xxx - case "$xxx" in - /*) - echo $file is in $xxx. - ;; - *) - echo "I don't see $file out there, $ans." - ans=either - ;; - esac -done -case "$egrep" in -egrep) - echo "Substituting grep for egrep." - egrep=$grep - ;; -esac -case "$test" in -test) - echo "Hopefully test is built into your sh." - ;; -/bin/test) - echo " " - dflt=n - rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)" - echo $n "$rp $c" - . myread - case "$ans" in - y*) test=test ;; - esac - ;; -*) - test=test - ;; -esac -case "$echo" in -echo) - echo "Hopefully echo is built into your sh." - ;; -/bin/echo) - echo " " - echo "Checking compatibility between /bin/echo and builtin echo (if any)..." - $echo $n "hi there$c" >foo1 - echo $n "hi there$c" >foo2 - if cmp foo1 foo2 >/dev/null 2>&1; then - echo "They are compatible. In fact, they may be identical." - else - case "$n" in - '-n') n='' c='\c' ans='\c' ;; - *) n='-n' c='' ans='-n' ;; - esac - cat <<FOO -They are not compatible! You are probably running ksh on a non-USG system. -I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't -have echo built in and we may have to run some Bourne shell scripts. That -means I'll have to use $ans to suppress newlines now. Life is ridiculous. - -FOO - rp="Your cursor should be here-->" - $echo $n "$rp$c" - . myread - fi - $rm -f foo1 foo2 - ;; -*) - : cross your fingers - echo=echo - ;; -esac -rmlist="$rmlist loc" - -: get list of predefined functions in a handy place -echo " " -if test -f /lib/libc.a; then - echo "Your C library is in /lib/libc.a. You're normal." - libc=/lib/libc.a -else - if test -f /lib/clib -a -f /lib/libc; then - echo "Your standard C library is in /lib/libc. Must be Domain/OS." - libc=/lib/libc - elif test -f /lib/libsys_s.a; then - echo "Your C library is in /lib/libsys_s.a. Must be a NeXT." - libc=/lib/libsys_s.a - else - ans=`loc libc.a blurfl/dyick $libpth` - if test ! -f $ans; then - ans=`loc clib blurfl/dyick $libpth` - fi - if test ! -f $ans; then - ans=`loc libc blurfl/dyick $libpth` - fi - if test -f $ans; then - echo "Your C library is in $ans, of all places." - libc=$ans - else - if test -f "$libc"; then - echo "Your C library is in $libc, like you said before." - else - cat <<EOM - -I can't seem to find your C library. I've looked in the following places: - - $libpth - -None of these seems to contain your C library. What is the full name -EOM - dflt=None - $echo $n "of your C library? $c" - rp='C library full name?' - . myread - libc="$ans" - fi - fi - fi -fi -echo " " -$echo $n "Extracting names from $libc for later perusal...$c" -nm $libc 2>/dev/null | sed -n -e 's/^.* T _//p' -e 's/^.* T //p' > libc.list -if $contains '^printf$' libc.list >/dev/null 2>&1; then - echo "done" -else - nm $libc 2>/dev/null | sed -n -e 's/^.* D _//p' -e 's/^.* D //p' > libc.list - if $contains '^printf$' libc.list >/dev/null 2>&1; then - echo "done" - else - echo " " - echo "nm didn't seem to work right." - echo "Trying ar instead..." - if ar t $libc | sed -e 's/\.o$//' > libc.list; then - echo "Ok." - else - echo "That didn't work either. Giving up." - exit 1 - fi - fi -fi -rmlist="$rmlist libc.list" - -: make some quick guesses about what we are up against -echo " " -$echo $n "Hmm... $c" -if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then - echo "Looks kind of like a BSD system, but we'll see..." - echo exit 0 >bsd - echo exit 1 >usg - echo exit 1 >v7 -elif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then - echo "Looks kind of like a USG system, but we'll see..." - echo exit 1 >bsd - echo exit 0 >usg - echo exit 1 >v7 -else - echo "Looks kind of like a version 7 system, but we'll see..." - echo exit 1 >bsd - echo exit 1 >usg - echo exit 0 >v7 -fi -if $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then - cat <<'EOI' -There is, however, a strange, musty smell in the air that reminds me of -something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. -EOI - echo "exit 0" >eunice - eunicefix=unixtovms - d_eunice="$define" -: it so happens the Eunice I know will not run shell scripts in Unix format -else - echo " " - echo "Congratulations. You aren't running Eunice." - eunicefix=':' - d_eunice="$undef" - echo "exit 1" >eunice -fi -if test -f /xenix; then - echo "Actually, this looks more like a XENIX system..." - echo "exit 0" >xenix -else - echo " " - echo "It's not Xenix..." - echo "exit 1" >xenix -fi -chmod +x xenix -$eunicefix xenix -if test -f /venix; then - echo "Actually, this looks more like a VENIX system..." - echo "exit 0" >venix -else - echo " " - if xenix; then - : null - else - echo "Nor is it Venix..." - fi - echo "exit 1" >venix -fi -chmod +x bsd usg v7 eunice venix -$eunicefix bsd usg v7 eunice venix -rmlist="$rmlist bsd usg v7 eunice venix xenix" - -: see if sh knows # comments -echo " " -echo "Checking your sh to see if it knows about # comments..." -if sh -c '#' >/dev/null 2>&1 ; then - echo "Your sh handles # comments correctly." - shsharp=true - spitshell=cat - echo " " - echo "Okay, let's see if #! works on this system..." - echo "#!/bin/echo hi" > try - $eunicefix try - chmod +x try - try > today - if $contains hi today >/dev/null 2>&1; then - echo "It does." - sharpbang='#!' - else - echo "#! /bin/echo hi" > try - $eunicefix try - chmod +x try - try > today - if test -s today; then - echo "It does." - sharpbang='#! ' - else - echo "It doesn't." - sharpbang=': use ' - fi - fi -else - echo "Your sh doesn't grok # comments--I will strip them later on." - shsharp=false - echo "exec grep -v '^#'" >spitshell - chmod +x spitshell - $eunicefix spitshell - spitshell=`pwd`/spitshell - echo "I presume that if # doesn't work, #! won't work either!" - sharpbang=': use ' -fi - -: figure out how to guarantee sh startup -echo " " -echo "Checking out how to guarantee sh startup..." -startsh=$sharpbang'/bin/sh' -echo "Let's see if '$startsh' works..." -cat >try <<EOSS -$startsh -set abc -test "$?abc" != 1 -EOSS - -chmod +x try -$eunicefix try -if try; then - echo "Yup, it does." -else - echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." -fi -rm -f try today - -#: see if sprintf is declared as int or pointer to char -#echo " " -#cat >.ucbsprf.c <<'EOF' -#main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); } -#EOF -#if cc .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then -# echo "Your sprintf() returns (int)." -# d_charsprf="$undef" -#else -# echo "Your sprintf() returns (char*)." -# d_charsprf="$define" -#fi -#/bin/rm -f .ucbsprf.c .ucbsprf - -: see if we can have long filenames -echo " " -rm -f 123456789abcde -if (echo hi >123456789abcdef) 2>/dev/null; then - : not version 8 - if test -f 123456789abcde; then - echo 'You cannot have filenames longer than 14 characters. Sigh.' - d_flexfnam="$undef" - else - echo 'You can have filenames longer than 14 characters.' - d_flexfnam="$define" - fi -else - : version 8 probably - echo "You can't have filenames longer than 14 chars. V8 can't even think about them!" - d_flexfnam="$undef" -fi -: index or strcpy -echo " " -case "$d_index" in -n) dflt=n;; -*) dflt=y;; -esac -if $contains '^index$' libc.list >/dev/null 2>&1 ; then - if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then - echo "Your system has both index() and strchr(). Shall I use" - rp="index() rather than strchr()? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - n*) d_index="$define" ;; - *) d_index="$undef" ;; - esac - else - d_index="$undef" - echo "index() found." - fi -else - if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then - d_index="$define" - echo "strchr() found." - else - echo "No index() or strchr() found!" - d_index="$undef" - fi -fi - -: see if signal is declared as pointer to function returning int or void -echo " " -if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 || -$contains 'void.*signal' /usr/include/sys/signal.h >/dev/null 2>&1 ; then - echo "You have void (*signal())() instead of int." - d_voidsig="$define" -else - echo "You have int (*signal())() instead of void." - d_voidsig="$undef" -fi - -: check for directory library -echo " " -if test -f /usr/include/dirent.h; then - echo "You have dirent.h." - d_dirheader="#define DIRENT" -elif test -f /usr/include/ndir.h; then - echo "You have ndir.h." - d_dirheader="#define USG" -elif test -f /usr/include/sys/ndir.h; then - echo "You have sys/ndir.h." - d_dirheader="#define SYSNDIR -#define USG" -elif test -f /usr/include/sys/dir.h; then - echo "You have sys/dir.h; I hope that's the BSD version." - d_dirheader="#define SYSDIR" -else - echo "I can't find a directory library header file. -That means you won't have numbered backups available." - d_dirheader="#define NODIR" -fi - -: check for unistd.h -echo " " -if test -f /usr/include/unistd.h; then - echo "You have unistd.h." - d_unistd="$define" -else - echo "I don't see unistd.h, but that's OK." - d_unistd="$undef" -fi - -: check for void type -echo " " -$cat <<EOM -Checking to see how well your C compiler groks the void type... - - Support flag bits are: - 1: basic void declarations. - 2: arrays of pointers to functions returning void. - 4: operations between pointers to and addresses of void functions. - -EOM -case "$voidflags" in -'') - $cat >try.c <<'EOCP' -#if TRY & 1 -void main() { -#else -main() { -#endif - extern void *moo(); - void *(*goo)(); -#if TRY & 2 - void (*foo[10])(); -#endif - -#if TRY & 4 - if(*goo == moo) { - exit(0); - } -#endif - exit(0); -} -EOCP - : Argh -- AIX 3.2 does not have cc -S! - if cc -c -DTRY=7 try.c >.out 2>&1 ; then - voidflags=7 - echo "It appears to support void fully." - if $contains warning .out >/dev/null 2>&1; then - echo "However, you might get some warnings that look like this:" - $cat .out - fi - else - echo "Hmm, you compiler has some difficulty with void. Checking further..." - if cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then - echo "It supports 1..." - if cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then - voidflags=3 - echo "And it supports 2 but not 4." - else - echo "It doesn't support 2..." - if cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then - voidflags=5 - echo "But it supports 4." - else - voidflags=1 - echo "And it doesn't support 4." - fi - fi - else - echo "There is no support at all for void." - voidflags=0 - fi - fi -esac -dflt="$voidflags"; -rp="Your void support flags add up to what? [$dflt]" -$echo $n "$rp $c" -. myread -voidflags="$ans" -$rm -f try.* .out - -: see how we invoke the C preprocessor -echo " " -echo "Now, how can we feed standard input to your C preprocessor..." -cat <<'EOT' >testcpp.c -#define ABC abc -#define XYZ xyz -ABC.XYZ -EOT -echo 'Maybe "'$cpp'" will work...' -$cpp <testcpp.c >testcpp.out 2>&1 -if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, it does." - cppstdin="$cpp" - cppminus=''; -else - echo 'Nope, maybe "'$cpp' -" will work...' - $cpp - <testcpp.c >testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, it does." - cppstdin="$cpp" - cppminus='-'; - else - echo 'No such luck...maybe "cc -E" will work...' - cc -E <testcpp.c >testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "It works!" - cppstdin='cc -E' - cppminus=''; - else - echo 'Nixed again...maybe "cc -E -" will work...' - cc -E - <testcpp.c >testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Hooray, it works! I was beginning to wonder." - cppstdin='cc -E' - cppminus='-'; - else - echo 'Nope...maybe "cc -P" will work...' - cc -P <testcpp.c >testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, that does." - cppstdin='cc -P' - cppminus=''; - else - echo 'Nope...maybe "cc -P -" will work...' - cc -P - <testcpp.c >testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, that does." - cppstdin='cc -P' - cppminus='-'; - else - echo 'Hmm...perhaps you already told me...' - case "$cppstdin" in - '') ;; - *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;; - esac - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Hooray, you did! I was beginning to wonder." - else - echo 'Uh-uh. Time to get fancy...' - echo 'Trying (cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)' - cppstdin='(cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)' - cppminus=''; - $cppstdin <testcpp.c >testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Eureka!." - else - dflt=blurfl - $echo $n "No dice. I can't find a C preprocessor. Name one: $c" - rp='Name a C preprocessor:' - . myread - cppstdin="$ans" - $cppstdin <testcpp.c >testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "OK, that will do." - else - echo "Sorry, I can't get that to work. Go find one." - exit 1 - fi - fi - fi - fi - fi - fi - fi - fi -fi -rm -f testcpp.c testcpp.out - -: get C preprocessor symbols handy -echo " " -: AIX 3.2 rejects tr '[ - ]' because the range endpoints are the same. -echo $attrlist | $tr ' ' '\012' >Cppsym.know -$cat <<EOSS >Cppsym -$startsh -case "\$1" in --l) list=true - shift - ;; -esac -unknown='' -case "\$list\$#" in -1|2) - for sym do - if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then - exit 0 - elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then - : - else - unknown="\$unknown \$sym" - fi - done - set X \$unknown - shift - ;; -esac -case \$# in -0) exit 1;; -esac -echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\ -#ifdef \1\\ -exit 0; _ _ _ _\1\\ \1\\ -#endif\\ -/' >/tmp/Cppsym\$\$ -echo exit 1 >>/tmp/Cppsym\$\$ -$cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$ -case "\$list" in -true) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;; -*) - sh /tmp/Cppsym2\$\$ - status=\$? - ;; -esac -$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$ -exit \$status -EOSS -chmod +x Cppsym -$eunicefix Cppsym -echo "Your C preprocessor defines the following symbols:" -Cppsym -l $attrlist >Cppsym.true -cat Cppsym.true -rmlist="$rmlist Cppsym Cppsym.know Cppsym.true" - -: see how many register declarations we want to use -case "$registers" in -'') - if Cppsym vax; then - dflt=6 - elif Cppsym sun mc68000 mc68k m68k; then - dflt=10 - elif Cppsym pyr; then - dflt=14 - elif Cppsym ns32000 ns16000; then - dflt=5 - elif Cppsym $smallmach; then - dflt=3 - else - : if you have any other numbers for me, send them in - dflt=6 - fi - ;; -*) dflt=$registers ;; -esac -cat <<EOM - -Different C compilers on different machines pay attention to different -numbers of register declarations. About how many register declarations in -EOM -$echo $n "each routine does your C compiler pay attention to? (OK to guess) [$dflt] $c" -rp="# register declarations used? [$dflt]" -. myread -registers=$ans -reg1='' -awk "BEGIN { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" </dev/null >.foo -. .foo -awk "BEGIN { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \ - </dev/null >.foo -. .foo -rm -f .foo - -: preserve RCS keywords in files with variable substitution, grrr -Log='$Log' -Header='$Header' - -: set up shell script to do ~ expansion -cat >filexp <<EOSS -$startsh -: expand filename -case "\$1" in - ~/*|~) - echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" - ;; - ~*) - if $test -f /bin/csh; then - /bin/csh -f -c "glob \$1" - echo "" - else - name=\`$expr x\$1 : '..\([^/]*\)'\` - dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` - if $test ! -d "\$dir"; then - me=\`basename \$0\` - echo "\$me: can't locate home directory for: \$name" >&2 - exit 1 - fi - case "\$1" in - */*) - echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` - ;; - *) - echo \$dir - ;; - esac - fi - ;; -*) - echo \$1 - ;; -esac -EOSS -chmod +x filexp -$eunicefix filexp - -: determine where public executables go -case "$bin" in -'') - dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` - ;; -*) dflt="$bin" - ;; -esac -cont=true -while $test "$cont" ; do - echo " " - rp="Where do you want to put the public executables? [$dflt]" - $echo $n "$rp $c" - . myread - bin="$ans" - bin=`filexp $bin` - if test -d $bin; then - cont='' - else - dflt=n - rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]" - $echo $n "$rp $c" - . myread - dflt='' - case "$ans" in - y*) cont='';; - esac - fi -done - -: determine where manual pages go -case "$mansrc" in -'') - dflt=`loc . /usr/man/man1 /usr/local/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1` - ;; -*) dflt="$mansrc" - ;; -esac -cont=true -while $test "$cont" ; do - echo " " - rp="Where do the manual pages (source) go? [$dflt]" - $echo $n "$rp $c" - . myread - mansrc=`filexp "$ans"` - if test -d $mansrc; then - cont='' - else - dflt=n - rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]" - $echo $n "$rp $c" - . myread - dflt='' - case "$ans" in - y*) cont='';; - esac - fi -done -case "$mansrc" in -*l) - manext=l - ;; -*n) - manext=n - ;; -*C) - manext=C - ;; -*) - manext=1 - ;; -esac - -: see what memory models we can support -case "$models" in -'') - if Cppsym pdp11; then - dflt='unsplit split' - else - ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` - case "$ans" in - X) dflt='none';; - *) if $test -d /lib/small || $test -d /usr/lib/small; then - dflt='small' - else - dflt='' - fi - if $test -d /lib/medium || $test -d /usr/lib/medium; then - dflt="$dflt medium" - fi - if $test -d /lib/large || $test -d /usr/lib/large; then - dflt="$dflt large" - fi - if $test -d /lib/huge || $test -d /usr/lib/huge; then - dflt="$dflt huge" - fi - esac - fi - ;; -*) dflt="$models" ;; -esac -$cat <<EOM - -Some systems have different model sizes. On most systems they are called -small, medium, large, and huge. On the PDP11 they are called unsplit and -split. If your system doesn't support different memory models, say "none". -If you wish to force everything to one memory model, say "none" here and -put the appropriate flags later when it asks you for other cc and ld flags. -Venix systems may wish to put "none" and let the compiler figure things out. -(In the following question multiple model names should be space separated.) - -EOM -rp="Which models are supported? [$dflt]" -$echo $n "$rp $c" -. myread -models="$ans" - -case "$models" in -none) - small='' - medium='' - large='' - huge='' - unsplit='' - split='' - ;; -*split) - case "$split" in - '') - if $contains '-i' $mansrc/ld.1 >/dev/null 2>&1 || \ - $contains '-i' $mansrc/cc.1 >/dev/null 2>&1; then - dflt='-i' - else - dflt='none' - fi - ;; - *) dflt="$split";; - esac - rp="What flag indicates separate I and D space? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans='';; - esac - split="$ans" - unsplit='' - ;; -*large*|*small*|*medium*|*huge*) - case "$model" in - *large*) - case "$large" in - '') dflt='-Ml';; - *) dflt="$large";; - esac - rp="What flag indicates large model? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans=''; - esac - large="$ans" - ;; - *) large='';; - esac - case "$model" in - *huge*) - case "$huge" in - '') dflt='-Mh';; - *) dflt="$huge";; - esac - rp="What flag indicates huge model? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans=''; - esac - huge="$ans" - ;; - *) huge="$large";; - esac - case "$model" in - *medium*) - case "$medium" in - '') dflt='-Mm';; - *) dflt="$medium";; - esac - rp="What flag indicates medium model? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans=''; - esac - medium="$ans" - ;; - *) medium="$large";; - esac - case "$model" in - *small*) - case "$small" in - '') dflt='none';; - *) dflt="$small";; - esac - rp="What flag indicates small model? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - none) ans=''; - esac - small="$ans" - ;; - *) small='';; - esac - ;; -*) - echo "Unrecognized memory models--you may have to edit Makefile.SH" - ;; -esac - -case "$ccflags" in -'') dflt='none';; -*) dflt="$ccflags";; -esac -echo " " -rp="Any additional cc flags? [$dflt]" -$echo $n "$rp $c" -. myread -case "$ans" in -none) ans=''; -esac -ccflags="$ans" - -case "$ldflags" in -'') if venix; then - dflt='-i -z' - elif xenix; then - if test -f /usr/include/dirent.h; then - dflt='-ldir -lx' - else - dflt='-lx' - fi - else - dflt='none' - fi - ;; -*) dflt="$ldflags";; -esac -echo " " -rp="Any additional ld flags? [$dflt]" -$echo $n "$rp $c" -. myread -case "$ans" in -none) ans=''; -esac -ldflags="$ans" - -: see if we need a special compiler -echo " " -if usg; then - case "$cc" in - '') - case "$Mcc" in - /*) dflt='Mcc' - ;; - *) - case "$large" in - -M*) - dflt='cc' - ;; - *) - if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then - dflt='cc -M' - else - dflt='cc' - fi - ;; - esac - ;; - esac - ;; - *) dflt="$cc";; - esac - $cat <<'EOM' - -On some systems the default C compiler will not resolve multiple global -references that happen to have the same name. On some such systems the -"Mcc" command may be used to force these to be resolved. On other systems -a "cc -M" command is required. (Note that the -M flag on other systems -indicates a memory model to use!) What command will force resolution on -EOM - $echo $n "this system? [$dflt] $c" - rp="Command to resolve multiple refs? [$dflt]" - . myread - cc="$ans" -else - echo "Not a USG system--assuming cc can resolve multiple definitions." - cc=cc -fi - -echo " " -echo "End of configuration questions." -echo " " - -: create config.sh file -echo " " -if test -d ../UU; then - cd .. -fi -echo "Creating config.sh..." -$spitshell <<EOT >config.sh -$startsh -# config.sh -# This file was produced by running the Configure script. - -d_eunice='$d_eunice' -eunicefix='$eunicefix' -define='$define' -loclist='$loclist' -expr='$expr' -sed='$sed' -echo='$echo' -cat='$cat' -rm='$rm' -mv='$mv' -cp='$cp' -tail='$tail' -tr='$tr' -mkdir='$mkdir' -sort='$sort' -uniq='$uniq' -grep='$grep' -trylist='$trylist' -test='$test' -inews='$inews' -egrep='$egrep' -more='$more' -pg='$pg' -Mcc='$Mcc' -vi='$vi' -mailx='$mailx' -mail='$mail' -cpp='$cpp' -Log='$Log' -Header='$Header' -bin='$bin' -cc='$cc' -contains='$contains' -cppstdin='$cppstdin' -cppminus='$cppminus' -d_charsprf='$d_charsprf' -d_flexfnam='$d_flexfnam' -d_index='$d_index' -d_voidsig='$d_voidsig' -d_dirheader='$d_dirheader' -d_unistd='$d_unistd' -libc='$libc' -mansrc='$mansrc' -manext='$manext' -models='$models' -split='$split' -small='$small' -medium='$medium' -large='$large' -huge='$huge' -ccflags='$ccflags' -ldflags='$ldflags' -n='$n' -c='$c' -package='$package' -registers='$registers' -reg1='$reg1' -reg2='$reg2' -reg3='$reg3' -reg4='$reg4' -reg5='$reg5' -reg6='$reg6' -reg7='$reg7' -reg8='$reg8' -reg9='$reg9' -reg10='$reg10' -reg11='$reg11' -reg12='$reg12' -reg13='$reg13' -reg14='$reg14' -reg15='$reg15' -reg16='$reg16' -spitshell='$spitshell' -shsharp='$shsharp' -sharpbang='$sharpbang' -startsh='$startsh' -voidflags='$voidflags' -defvoidused='$defvoidused' -CONFIG=true -EOT - -CONFIG=true - -echo " " -dflt='' -fastread='' -echo "If you didn't make any mistakes, then just type a carriage return here." -rp="If you need to edit config.sh, do it as a shell escape here:" -$echo $n "$rp $c" -. UU/myread -case "$ans" in -'') ;; -*) : in case they cannot read - eval $ans;; -esac -. ./config.sh - -echo " " -echo "Doing variable substitutions on .SH files..." -set x `awk '{print $1}' <MANIFEST | $grep '\.SH'` -shift -case $# in -0) set x *.SH; shift;; -esac -if test ! -f $1; then - shift -fi -for file in $*; do - case "$file" in - */*) - dir=`$expr X$file : 'X\(.*\)/'` - file=`$expr X$file : 'X.*/\(.*\)'` - (cd $dir && . $file) - ;; - *) - . $file - ;; - esac -done -if test -f config.h.SH; then - if test ! -f config.h; then - : oops, they left it out of MANIFEST, probably, so do it anyway. - . config.h.SH - fi -fi - -if $contains '^depend:' Makefile >/dev/null 2>&1; then - dflt=n - $cat <<EOM - -Now you need to generate make dependencies by running "make depend". -You might prefer to run it in background: "make depend > makedepend.out &" -It can take a while, so you might not want to run it right now. - -EOM - rp="Run make depend now? [$dflt]" - $echo $n "$rp $c" - . UU/myread - case "$ans" in - y*) make depend - echo "Now you must run a make." - ;; - *) echo "You must run 'make depend' then 'make'." - ;; - esac -elif test -f Makefile; then - echo " " - echo "Now you must run a make." -else - echo "Done." -fi - -$rm -f kit*isdone -: the following is currently useless -cd UU && $rm -f $rmlist -: since this removes it all anyway -cd .. && $rm -rf UU -: end of Configure diff --git a/xc/util/patch/EXTERN.h b/xc/util/patch/EXTERN.h deleted file mode 100644 index 1f0a6da23..000000000 --- a/xc/util/patch/EXTERN.h +++ /dev/null @@ -1,21 +0,0 @@ -/* oldHeader: EXTERN.h,v 2.0 86/09/17 15:35:37 lwall Exp $ - * $XConsortium: EXTERN.h,v 2.1 94/09/09 20:04:44 gildea Exp $ - * - * Revision 2.0 86/09/17 15:35:37 lwall - * Baseline for netwide release. - * - */ - -#ifdef EXT -#undef EXT -#endif -#define EXT extern - -#ifdef INIT -#undef INIT -#endif -#define INIT(x) - -#ifdef DOINIT -#undef DOINIT -#endif diff --git a/xc/util/patch/INTERN.h b/xc/util/patch/INTERN.h deleted file mode 100644 index abaa57adf..000000000 --- a/xc/util/patch/INTERN.h +++ /dev/null @@ -1,19 +0,0 @@ -/* oldHeader: INTERN.h,v 2.0 86/09/17 15:35:58 lwall Exp $ - * $XConsortium: INTERN.h,v 2.1 94/09/09 20:08:54 gildea Exp $ - * - * Revision 2.0 86/09/17 15:35:58 lwall - * Baseline for netwide release. - * - */ - -#ifdef EXT -#undef EXT -#endif -#define EXT - -#ifdef INIT -#undef INIT -#endif -#define INIT(x) = x - -#define DOINIT diff --git a/xc/util/patch/MANIFEST b/xc/util/patch/MANIFEST deleted file mode 100644 index 05fc9417c..000000000 --- a/xc/util/patch/MANIFEST +++ /dev/null @@ -1,27 +0,0 @@ -After all the patch kits are run you should have the following files: - -Filename Kit Description --------- --- ----------- -Configure 1 A shell script that installs everything system dependent. -EXTERN.h 4 Toggle .h files to look foreign. -INTERN.h 4 Toggle .h files to look domestic. -MANIFEST 2 This list of files. -Makefile.SH 2 The makefile. -README 1 Installation instructions. -backupfile.c 4 Make Emacs style backup file names. -backupfile.h 4 Declarations to make Emacs style backup file names. -common.h 3 Common definitions. -config.H 4 Sample config.h, in case Configure won't run. -config.h.SH 3 Produces config.h. -inp.c 3 Input file abstract data type routines. -inp.h 3 Public defs for above. -malloc.c 1 An optional malloc package. -patch.c 3 The patch program. -patch.man 2 Manual page for patch. -patchlevel.h 4 The patch level of the patch program. -pch.c 2 Patch abstract data type routines. -pch.h 3 Public defs for above. -util.c 3 Utility routines. -util.h 3 Public defs for above. -version.c 1 Version number routine. -version.h 4 Public defs for above. diff --git a/xc/util/patch/Makefile.SH b/xc/util/patch/Makefile.SH deleted file mode 100644 index ab5d049fd..000000000 --- a/xc/util/patch/Makefile.SH +++ /dev/null @@ -1,116 +0,0 @@ -case $CONFIG in - '') . config.sh ;; -esac -echo "Extracting Makefile (with variable substitutions)" -cat >Makefile <<!GROK!THIS! -# oldHeader: Makefile.SH,v 2.0.1.2 88/06/22 20:43:40 lwall Locked $ -# $XConsortium: Makefile.SH,v 3.1 94/09/09 20:04:28 gildea Exp $ -# -# Revision 2.0.1.2 88/06/22 20:43:40 lwall -# patch12: config.h now depends on config.h.SH -# -# Revision 2.0.1.1 88/06/03 15:00:48 lwall -# patch10: upgraded to match some new metaconfig stuff -# -# Revision 2.0 86/09/17 15:36:15 lwall -# Baseline for netwide release. -# -# Revision 1.2 86/09/08 14:07:42 lwall -# Split up patch.c. -# -# Revision 1.1 86/08/01 20:18:35 lwall -# Initial revision -# - -CC = $cc -bin = $bin -mansrc = $mansrc -manext = $manext -CFLAGS = $ccflags -O -LDFLAGS = $ldflags -SMALL = $small -LARGE = $large $split - -!GROK!THIS! -cat >>Makefile <<'!NO!SUBS!' - -public = patch -private = -manpages = patch.man -util = Makefile - -c = patch.c pch.c inp.c util.c version.c backupfile.c - -obj = patch.o pch.o inp.o util.o version.o backupfile.o - -lintflags = -phbvxac - -addedbyconf = Makefile Makefile.old bsd config.h config.sh eunice loc pdp11 usg v7 - -# grrr -SHELL = /bin/sh - -.c.o: - $(CC) -c $(CFLAGS) $(LARGE) $*.c - -all: $(public) $(private) $(util) - @echo Done. - -patch: $(obj) - $(CC) $(LDFLAGS) $(obj) $(libs) -o patch - -config.h: config.h.SH - sh config.h.SH - -# won't work with csh -install: patch - export PATH || exit 1 - -mv $(bin)/patch $(bin)/patch.old - cp patch $(bin)/patch - chmod 755 $(bin)/patch - -cp patch.man $(mansrc)/patch.$(manext) - -uninstall: - rm -f $(bin)/patch $(mansrc)/patch.$(manext) - test ! -f $(bin)/patch.old || mv $(bin)/patch.old $(bin)/patch - -clean: - rm -f patch *.o core - -mostlyclean: clean - -distclean: clean - rm -f $(addedbyconf) - -realclean: distclean - -DISTFILES=ChangeLog Configure EXTERN.h INTERN.h MANIFEST Makefile.SH \ -README common.h config.H config.h.SH inp.c inp.h malloc.c patch.c patch.man \ -patchlevel.h pch.c pch.h util.c util.h version.c version.h backupfile.c \ -backupfile.h - -dist: $(DISTFILES) - echo patch-2.0.`sed -e '/PATCHLEVEL/!d' -e 's/[^0-9]*\([0-9a-z.]*\).*/\1/' -e q patchlevel.h` > .fname - rm -rf `cat .fname` - mkdir `cat .fname` - ln $(DISTFILES) `cat .fname` - tar chZf `cat .fname`.tar.Z `cat .fname` - rm -rf `cat .fname` .fname - -# The following lint has practically everything turned on. Unfortunately, -# you have to wade through a lot of mumbo jumbo that can't be suppressed. -# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message -# for that spot. - -lint: - lint $(lintflags) $(defs) $(c) > patch.fuzz - -patch.o: config.h common.h patch.c inp.h pch.h util.h version.h backupfile.h -pch.o: config.h common.h pch.c pch.h util.h -inp.o: config.h common.h inp.c inp.h util.h -util.o: config.h common.h util.c util.h backupfile.h -version.o: config.h common.h version.c version.h patchlevel.h util.h -backupfile.o: config.h backupfile.c backupfile.h - -!NO!SUBS! -$eunicefix Makefile diff --git a/xc/util/patch/Makefile.nt b/xc/util/patch/Makefile.nt deleted file mode 100644 index 34c9df897..000000000 --- a/xc/util/patch/Makefile.nt +++ /dev/null @@ -1,41 +0,0 @@ -# $XConsortium: Makefile.nt,v 1.2 94/09/12 20:19:31 kaleb Exp $ - -# Simple Makefile for MS Windows NT. - -CC = cl - -LIBS = crtdll.lib kernel32.lib - -CFLAGS = -Zi -Od -DWIN32 -D_DLL -D_MT -D__STDC__ -DX_86_ -nologo -LDFLAGS = -link -debug:full -debugtype:cv - -SRCS = backupfile.c getopt.c getopt1.c inp.c patch.c pch.c util.c \ - version.c - -OBJS = backupfile.obj getopt.obj getopt1.obj inp.obj patch.obj pch.obj \ - util.obj version.obj - -HDRS = EXTERN.h INTERN.h backupfile.h common.h getopt.h \ - inp.h patchlevel.h pch.h util.h version.h - -all: patch.exe - -patch.exe: $(OBJS) - $(CC) $(OBJS) $(LIBS) -o $@ $(LDFLAGS) - -.c.obj: - if exist $@ del $@ - $(CC) -c -DHAVE_CONFIG_H -I. $(CPPFLAGS) $(CFLAGS) $< - -clean: - rm -f patch.exe *.obj - -backupfile.obj: $(HDRS) -getopt.obj: $(HDRS) -getopt1.obj: $(HDRS) -inp.obj: $(HDRS) -patch.obj: $(HDRS) -pch.obj: $(HDRS) -util.obj: $(HDRS) -version.obj: $(HDRS) - diff --git a/xc/util/patch/README b/xc/util/patch/README deleted file mode 100644 index c8bd0e9c4..000000000 --- a/xc/util/patch/README +++ /dev/null @@ -1,98 +0,0 @@ -This version of patch contains modifications made by the Free Software -Foundation, summarized in the file ChangeLog. Primarily they are to -support the unified context diff format that GNU diff can produce, and -to support making GNU Emacs-style backup files. They also include -fixes for some bugs. - -There are two GNU variants of patch: this one, which retains Larry -Wall's interactive Configure script and has patchlevels starting with -`12u'; and another one that has a GNU-style non-interactive configure -script and accepts long-named options, and has patchlevels starting -with `12g'. Unlike the 12g variant, the 12u variant contains no -copylefted code, for the paranoid. The two variants are otherwise the -same. They should be available from the same places. - -The FSF is distributing this version of patch independently because as -of this writing, Larry Wall has not released a new version of patch -since mid-1988. I have heard that he has been too busy working on -other things, like Perl. - -Here is a wish list of some projects to improve patch: - -1. Correctly handle files and patchfiles that contain NUL characters. -This is hard to do straightforwardly; it would be less work to -adopt a kind of escape encoding internally. -Let ESC be a "control prefix". ESC @ stands for NUL. ESC [ stands for ESC. -You need to crunch this when reading input (replace fgets), -and when writing the output file (replace fputs), -but otherwise everything can go along as it does now. -Be careful to handle reject files correctly; -I think they are currently created using `write', not `fputs'. - -2. Correctly handle patches produced by GNU diff for files that do -not end with a newline. - -Please send bug reports for this version of patch to -bug-gnu-utils@prep.ai.mit.edu as well as to Larry Wall (lwall@netlabs.com). - --djm@gnu.ai.mit.edu (David MacKenzie) - - Patch Kit, Version 2.0 - - Copyright (c) 1988, Larry Wall - -You may copy the patch kit in whole or in part as long as you don't try to -make money off it, or pretend that you wrote it. --------------------------------------------------------------------------- - -Please read all the directions below before you proceed any further, and -then follow them carefully. Failure to do so may void your warranty. :-) - -After you have unpacked your kit, you should have all the files listed -in MANIFEST. - -Installation - -1) Run Configure. This will figure out various things about your system. - Some things Configure will figure out for itself, other things it will - ask you about. It will then proceed to make config.h, config.sh, and - Makefile. - - You might possibly have to trim # comments from the front of Configure - if your sh doesn't handle them, but all other # comments will be taken - care of. - - If you don't have sh, you'll have to rip the prototype of config.h out - of Configure and generate the defines by hand. - -2) Glance through config.h to make sure system dependencies are correct. - Most of them should have been taken care of by running the - Configure script. - - If you have any additional changes to make to the C definitions, they - can be done in the Makefile, or in config.h. Bear in mind that they may - get undone next time you run Configure. - -3) make - - This will attempt to make patch in the current directory. - -4) make install - - This will put patch into a public directory (normally /usr/local/bin). - It will also try to put the man pages in a reasonable place. It will not - nroff the man page, however. - -5) Read the manual entry before running patch. - -6) IMPORTANT! Help save the world! Communicate any problems and - suggested patches to me, lwall@netlabs.com (Larry Wall), - so we can keep the world in sync. If you have a problem, there's - someone else out there who either has had or will have the same problem. - - If possible, send in patches such that the patch program will apply them. - Context diffs are the best, then normal diffs. Don't send ed scripts-- - I've probably changed my copy since the version you have. - - Watch for patch patches in comp.sources.bugs. Patches will generally be - in a form usable by the patch program. Your current patch level - is shown in patchlevel.h. diff --git a/xc/util/patch/backupfile.c b/xc/util/patch/backupfile.c deleted file mode 100644 index d3862e336..000000000 --- a/xc/util/patch/backupfile.c +++ /dev/null @@ -1,340 +0,0 @@ -/* backupfile.c -- make Emacs style backup file names - Copyright (C) 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it without restriction. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ - -/* $XConsortium: backupfile.c,v 3.1 94/09/09 20:33:43 kaleb Exp $ */ - -/* David MacKenzie <djm@ai.mit.edu>. - Some algorithms adapted from GNU Emacs. */ - -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include "backupfile.h" -#include "config.h" -char *index (); -char *rindex (); -char *malloc (); - -#ifdef DIRENT -#include <dirent.h> -#ifdef direct -#undef direct -#endif -#define direct dirent -#define NLENGTH(direct) (strlen((direct)->d_name)) -#else /* !DIRENT */ -#define NLENGTH(direct) ((direct)->d_namlen) -#ifdef USG -#ifdef SYSNDIR -#include <sys/ndir.h> -#else /* !SYSNDIR */ -#include <ndir.h> -#endif /* !SYSNDIR */ -#else /* !USG */ -#ifdef SYSDIR -#include <sys/dir.h> -#endif /* SYSDIR */ -#endif /* !USG */ -#endif /* !DIRENT */ - -#ifndef isascii -#define ISDIGIT(c) (isdigit ((unsigned char) (c))) -#else -#define ISDIGIT(c) (isascii (c) && isdigit (c)) -#endif - -#if defined (HAVE_UNISTD_H) -#include <unistd.h> -#endif - -#if defined (_POSIX_VERSION) -/* POSIX does not require that the d_ino field be present, and some - systems do not provide it. */ -#define REAL_DIR_ENTRY(dp) 1 -#else -#define REAL_DIR_ENTRY(dp) ((dp)->d_ino != 0) -#endif - -/* Which type of backup file names are generated. */ -enum backup_type backup_type = none; - -/* The extension added to file names to produce a simple (as opposed - to numbered) backup file name. */ -char *simple_backup_suffix = "~"; - -char *basename (); -char *dirname (); -static char *concat (); -char *find_backup_file_name (); -static char *make_version_name (); -static int max_backup_version (); -static int version_number (); - -/* Return NAME with any leading path stripped off. */ - -char * -basename (name) - char *name; -{ - char *base; - - base = rindex (name, '/'); - return base ? base + 1 : name; -} - -#ifndef NODIR -/* Return the name of the new backup file for file FILE, - allocated with malloc. Return 0 if out of memory. - FILE must not end with a '/' unless it is the root directory. - Do not call this function if backup_type == none. */ - -char * -find_backup_file_name (file) - char *file; -{ - char *dir; - char *base_versions; - int highest_backup; - - if (backup_type == simple) - return concat (file, simple_backup_suffix); - base_versions = concat (basename (file), ".~"); - if (base_versions == 0) - return 0; - dir = dirname (file); - if (dir == 0) - { - free (base_versions); - return 0; - } - highest_backup = max_backup_version (base_versions, dir); - free (base_versions); - free (dir); - if (backup_type == numbered_existing && highest_backup == 0) - return concat (file, simple_backup_suffix); - return make_version_name (file, highest_backup + 1); -} - -/* Return the number of the highest-numbered backup file for file - FILE in directory DIR. If there are no numbered backups - of FILE in DIR, or an error occurs reading DIR, return 0. - FILE should already have ".~" appended to it. */ - -static int -max_backup_version (file, dir) - char *file, *dir; -{ - DIR *dirp; - struct direct *dp; - int highest_version; - int this_version; - int file_name_length; - - dirp = opendir (dir); - if (!dirp) - return 0; - - highest_version = 0; - file_name_length = strlen (file); - - while ((dp = readdir (dirp)) != 0) - { - if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length) - continue; - - this_version = version_number (file, dp->d_name, file_name_length); - if (this_version > highest_version) - highest_version = this_version; - } - closedir (dirp); - return highest_version; -} - -/* Return a string, allocated with malloc, containing - "FILE.~VERSION~". Return 0 if out of memory. */ - -static char * -make_version_name (file, version) - char *file; - int version; -{ - char *backup_name; - - backup_name = malloc (strlen (file) + 16); - if (backup_name == 0) - return 0; - sprintf (backup_name, "%s.~%d~", file, version); - return backup_name; -} - -/* If BACKUP is a numbered backup of BASE, return its version number; - otherwise return 0. BASE_LENGTH is the length of BASE. - BASE should already have ".~" appended to it. */ - -static int -version_number (base, backup, base_length) - char *base; - char *backup; - int base_length; -{ - int version; - char *p; - - version = 0; - if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length])) - { - for (p = &backup[base_length]; ISDIGIT (*p); ++p) - version = version * 10 + *p - '0'; - if (p[0] != '~' || p[1]) - version = 0; - } - return version; -} - -/* Return the newly-allocated concatenation of STR1 and STR2. - If out of memory, return 0. */ - -static char * -concat (str1, str2) - char *str1, *str2; -{ - char *newstr; - char str1_length = strlen (str1); - - newstr = malloc (str1_length + strlen (str2) + 1); - if (newstr == 0) - return 0; - strcpy (newstr, str1); - strcpy (newstr + str1_length, str2); - return newstr; -} - -/* Return the leading directories part of PATH, - allocated with malloc. If out of memory, return 0. - Assumes that trailing slashes have already been - removed. */ - -char * -dirname (path) - char *path; -{ - char *newpath; - char *slash; - int length; /* Length of result, not including NUL. */ - - slash = rindex (path, '/'); - if (slash == 0) - { - /* File is in the current directory. */ - path = "."; - length = 1; - } - else - { - /* Remove any trailing slashes from result. */ - while (slash > path && *slash == '/') - --slash; - - length = slash - path + 1; - } - newpath = malloc (length + 1); - if (newpath == 0) - return 0; - strncpy (newpath, path, length); - newpath[length] = 0; - return newpath; -} - -/* If ARG is an unambiguous match for an element of the - null-terminated array OPTLIST, return the index in OPTLIST - of the matched element, else -1 if it does not match any element - or -2 if it is ambiguous (is a prefix of more than one element). */ - -int -argmatch (arg, optlist) - char *arg; - char **optlist; -{ - int i; /* Temporary index in OPTLIST. */ - int arglen; /* Length of ARG. */ - int matchind = -1; /* Index of first nonexact match. */ - int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */ - - arglen = strlen (arg); - - /* Test all elements for either exact match or abbreviated matches. */ - for (i = 0; optlist[i]; i++) - { - if (!strncmp (optlist[i], arg, arglen)) - { - if (strlen (optlist[i]) == arglen) - /* Exact match found. */ - return i; - else if (matchind == -1) - /* First nonexact match found. */ - matchind = i; - else - /* Second nonexact match found. */ - ambiguous = 1; - } - } - if (ambiguous) - return -2; - else - return matchind; -} - -/* Error reporting for argmatch. - KIND is a description of the type of entity that was being matched. - VALUE is the invalid value that was given. - PROBLEM is the return value from argmatch. */ - -void -invalid_arg (kind, value, problem) - char *kind; - char *value; - int problem; -{ - fprintf (stderr, "patch: "); - if (problem == -1) - fprintf (stderr, "invalid"); - else /* Assume -2. */ - fprintf (stderr, "ambiguous"); - fprintf (stderr, " %s `%s'\n", kind, value); -} - -static char *backup_args[] = -{ - "never", "simple", "nil", "existing", "t", "numbered", 0 -}; - -static enum backup_type backup_types[] = -{ - simple, simple, numbered_existing, numbered_existing, numbered, numbered -}; - -/* Return the type of backup indicated by VERSION. - Unique abbreviations are accepted. */ - -enum backup_type -get_version (version) - char *version; -{ - int i; - - if (version == 0 || *version == 0) - return numbered_existing; - i = argmatch (version, backup_args); - if (i >= 0) - return backup_types[i]; - invalid_arg ("version control type", version, i); - exit (1); -} -#endif /* NODIR */ diff --git a/xc/util/patch/backupfile.h b/xc/util/patch/backupfile.h deleted file mode 100644 index 43240a130..000000000 --- a/xc/util/patch/backupfile.h +++ /dev/null @@ -1,37 +0,0 @@ -/* backupfile.h -- declarations for making Emacs style backup file names - Copyright (C) 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it without restriction. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ - -/* When to make backup files. */ -enum backup_type -{ - /* Never make backups. */ - none, - - /* Make simple backups of every file. */ - simple, - - /* Make numbered backups of files that already have numbered backups, - and simple backups of the others. */ - numbered_existing, - - /* Make numbered backups of every file. */ - numbered -}; - -extern enum backup_type backup_type; -extern char *simple_backup_suffix; - -#ifdef __STDC__ -char *find_backup_file_name (char *file); -enum backup_type get_version (char *version); -#else -char *find_backup_file_name (); -enum backup_type get_version (); -#endif diff --git a/xc/util/patch/common.h b/xc/util/patch/common.h deleted file mode 100644 index 7209d6f90..000000000 --- a/xc/util/patch/common.h +++ /dev/null @@ -1,214 +0,0 @@ -/* oldHeader: common.h,v 2.0.1.2 88/06/22 20:44:53 lwall Locked $ - * $XConsortium: common.h,v 3.3 94/09/14 21:13:08 gildea Exp $ - * - * Revision 2.0.1.2 88/06/22 20:44:53 lwall - * patch12: sprintf was declared wrong - * - * Revision 2.0.1.1 88/06/03 15:01:56 lwall - * patch10: support for shorter extensions. - * - * Revision 2.0 86/09/17 15:36:39 lwall - * Baseline for netwide release. - * - */ - -#define DEBUGGING - -#define VOIDUSED 7 -#include "config.h" - -/* shut lint up about the following when return value ignored */ - -#define Signal (void)signal -#define Unlink (void)unlink -#define Lseek (void)lseek -#define Fseek (void)fseek -#define Fstat (void)fstat -#define Pclose (void)pclose -#define Close (void)close -#define Fclose (void)fclose -#define Fflush (void)fflush -#define Sprintf (void)sprintf -#define Mktemp (void)mktemp -#define Strcpy (void)strcpy -#define Strcat (void)strcat - -/* NeXT declares malloc and realloc incompatibly from us in some of - these files. Temporarily redefine them to prevent errors. */ -#define malloc system_malloc -#define realloc system_realloc -#include <stdio.h> -#include <assert.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <ctype.h> -#include <signal.h> -#include <fcntl.h> -#undef malloc -#undef realloc - -#ifdef WIN32 -#include "winnt.h" -#endif - -/* constants */ - -/* AIX predefines these. */ -#ifdef TRUE -#undef TRUE -#endif -#ifdef FALSE -#undef FALSE -#endif -#define TRUE (1) -#define FALSE (0) - -#define MAXHUNKSIZE 100000 /* is this enough lines? */ -#define INITHUNKMAX 125 /* initial dynamic allocation size */ -#define MAXLINELEN 1024 -#define BUFFERSIZE 1024 - -#define SCCSPREFIX "s." -#define GET "get %s" -#define GET_LOCKED "get -e %s" -#define SCCSDIFF "get -p %s | diff - %s >/dev/null" - -#define RCSSUFFIX ",v" -#define CHECKOUT "co %s" -#define CHECKOUT_LOCKED "co -l %s" -#define RCSDIFF "rcsdiff %s > /dev/null" - -#ifdef FLEXFILENAMES -#define ORIGEXT ".orig" -#define REJEXT ".rej" -#else -#define ORIGEXT "~" -#define REJEXT "#" -#endif - -/* handy definitions */ - -#define Null(t) ((t)0) -#define Nullch Null(char *) -#define Nullfp Null(FILE *) -#define Nulline Null(LINENUM) - -#define Ctl(ch) ((ch) & 037) - -#define strNE(s1,s2) (strcmp(s1, s2)) -#define strEQ(s1,s2) (!strcmp(s1, s2)) -#define strnNE(s1,s2,l) (strncmp(s1, s2, l)) -#define strnEQ(s1,s2,l) (!strncmp(s1, s2, l)) - -/* typedefs */ - -typedef char bool; -typedef long LINENUM; /* must be signed */ -typedef unsigned MEM; /* what to feed malloc */ - -/* globals */ - -EXT int Argc; /* guess */ -EXT char **Argv; -EXT int Argc_last; /* for restarting plan_b */ -EXT char **Argv_last; - -EXT struct stat filestat; /* file statistics area */ -EXT int filemode INIT(0644); - -EXT char buf[MAXLINELEN]; /* general purpose buffer */ -EXT FILE *ofp INIT(Nullfp); /* output file pointer */ -EXT FILE *rejfp INIT(Nullfp); /* reject file pointer */ - -#ifndef WIN32 -EXT int myuid; /* cache getuid return value */ -#endif - -EXT bool using_plan_a INIT(TRUE); /* try to keep everything in memory */ -EXT bool out_of_mem INIT(FALSE); /* ran out of memory in plan a */ - -#define MAXFILEC 2 -EXT int filec INIT(0); /* how many file arguments? */ -EXT char *filearg[MAXFILEC]; -EXT bool ok_to_create_file INIT(FALSE); -EXT char *bestguess INIT(Nullch); /* guess at correct filename */ - -EXT char *outname INIT(Nullch); -EXT char rejname[128]; - -EXT char *origprae INIT(Nullch); - -EXT char *TMPOUTNAME; -EXT char *TMPINNAME; -EXT char *TMPREJNAME; -EXT char *TMPPATNAME; -EXT bool toutkeep INIT(FALSE); -EXT bool trejkeep INIT(FALSE); - -EXT LINENUM last_offset INIT(0); -#ifdef DEBUGGING -EXT int debug INIT(0); -#endif -EXT LINENUM maxfuzz INIT(2); -EXT bool force INIT(FALSE); -EXT bool batch INIT(FALSE); -EXT bool verbose INIT(TRUE); -EXT bool reverse INIT(FALSE); -EXT bool noreverse INIT(FALSE); -EXT bool skip_rest_of_patch INIT(FALSE); -EXT int strippath INIT(957); -EXT bool canonicalize INIT(FALSE); - -#define CONTEXT_DIFF 1 -#define NORMAL_DIFF 2 -#define ED_DIFF 3 -#define NEW_CONTEXT_DIFF 4 -#define UNI_DIFF 5 -EXT int diff_type INIT(0); - -EXT bool do_defines INIT(FALSE); /* patch using ifdef, ifndef, etc. */ -EXT char if_defined[128]; /* #ifdef xyzzy */ -EXT char not_defined[128]; /* #ifndef xyzzy */ -EXT char else_defined[] INIT("#else\n");/* #else */ -EXT char end_defined[128]; /* #endif xyzzy */ - -EXT char *revision INIT(Nullch); /* prerequisite revision, if any */ - -#include <errno.h> -#ifndef errno -extern int errno; -#endif - -FILE *popen(); -char *malloc(); -char *realloc(); -long atol(); -char *getenv(); -char *strcpy(); -char *strcat(); -char *rindex(); -#if 0 -long lseek(); -#endif -char *mktemp(); -#if 0 /* This can cause a prototype conflict. */ -#ifdef CHARSPRINTF -char *sprintf(); -#else -int sprintf(); -#endif -#endif - -#ifndef WIN32 -#if !defined(S_ISDIR) && defined(S_IFDIR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif -#if !defined(S_ISREG) && defined(S_IFREG) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif -#else -#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) -#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) -#endif - - diff --git a/xc/util/patch/config.H b/xc/util/patch/config.H deleted file mode 100644 index 93cdf0327..000000000 --- a/xc/util/patch/config.H +++ /dev/null @@ -1,33 +0,0 @@ -/* config.h - * This file was produced by running the Configure script. - * Feel free to modify any of this as the need arises. - */ - - -#/*undef EUNICE /* no file linking? */ -#/*undef VMS - -#/*undef index strchr /* cultural */ -#/*undef rindex strrchr /* differences? */ - -#/*undef void int /* is void to be avoided? */ - -/* How many register declarations are paid attention to? */ - -#define Reg1 register -#define Reg2 register -#define Reg3 register -#define Reg4 register -#define Reg5 register -#define Reg6 register -#define Reg7 -#define Reg8 -#define Reg9 -#define Reg10 -#define Reg11 -#define Reg12 -#define Reg13 -#define Reg14 -#define Reg15 -#define Reg16 - diff --git a/xc/util/patch/config.h.SH b/xc/util/patch/config.h.SH deleted file mode 100644 index e34562fcc..000000000 --- a/xc/util/patch/config.h.SH +++ /dev/null @@ -1,146 +0,0 @@ -case $CONFIG in -'') - if test ! -f config.sh; then - ln ../config.sh . || \ - ln ../../config.sh . || \ - ln ../../../config.sh . || \ - (echo "Can't find config.sh."; exit 1) - echo "Using config.sh from above..." - fi - . ./config.sh - ;; -esac -echo "Extracting config.h (with variable substitutions)" -cat <<!GROK!THIS! >config.h -/* config.h - * This file was produced by running the config.h.SH script, which - * gets its values from config.sh, which is generally produced by - * running Configure. - * - * Feel free to modify any of this as the need arises. Note, however, - * that running config.h.SH again will wipe out any changes you've made. - * For a more permanent change edit config.sh and rerun config.h.SH. - */ - - -/* EUNICE: - * This symbol, if defined, indicates that the program is being compiled - * under the EUNICE package under VMS. The program will need to handle - * things like files that don't go away the first time you unlink them, - * due to version numbering. It will also need to compensate for lack - * of a respectable link() command. - */ -/* VMS: - * This symbol, if defined, indicates that the program is running under - * VMS. It is currently only set in conjunction with the EUNICE symbol. - */ -#$d_eunice EUNICE /**/ -#$d_eunice VMS /**/ - -/* CPPSTDIN: - * This symbol contains the first part of the string which will invoke - * the C preprocessor on the standard input and produce to standard - * output. Typical value of "cc -E" or "/lib/cpp". - */ -/* CPPMINUS: - * This symbol contains the second part of the string which will invoke - * the C preprocessor on the standard input and produce to standard - * output. This symbol will have the value "-" if CPPSTDIN needs a minus - * to specify standard input, otherwise the value is "". - */ -#define CPPSTDIN "$cppstdin" -#define CPPMINUS "$cppminus" - -/* CHARSPRINTF: - * This symbol is defined if this system declares "char *sprintf()" in - * stdio.h. The trend seems to be to declare it as "int sprintf()". It - * is up to the package author to declare sprintf correctly based on the - * symbol. - */ -/* #$d_charsprf CHARSPRINTF /**/ - -/* FLEXFILENAMES: - * This symbol, if defined, indicates that the system supports filenames - * longer than 14 characters. - */ -#$d_flexfnam FLEXFILENAMES /**/ - -/* index: - * This preprocessor symbol is defined, along with rindex, if the system - * uses the strchr and strrchr routines instead. - */ -/* rindex: - * This preprocessor symbol is defined, along with index, if the system - * uses the strchr and strrchr routines instead. - */ -#$d_index index strchr /* cultural */ -#$d_index rindex strrchr /* differences? */ - -/* VOIDSIG: - * This symbol is defined if this system declares "void (*signal())()" in - * signal.h. The old way was to declare it as "int (*signal())()". It - * is up to the package author to declare things correctly based on the - * symbol. - */ -#$d_voidsig VOIDSIG /**/ - -/* DIRHEADER: - * This definition indicates which directory library header to use. - */ -$d_dirheader - -/* HAVE_UNISTD_H: - * This is defined if the system has unistd.h. - */ -#$d_unistd HAVE_UNISTD_H /**/ - -/* Reg1: - * This symbol, along with Reg2, Reg3, etc. is either the word "register" - * or null, depending on whether the C compiler pays attention to this - * many register declarations. The intent is that you don't have to - * order your register declarations in the order of importance, so you - * can freely declare register variables in sub-blocks of code and as - * function parameters. Do not use Reg<n> more than once per routine. - */ - -#define Reg1 $reg1 /**/ -#define Reg2 $reg2 /**/ -#define Reg3 $reg3 /**/ -#define Reg4 $reg4 /**/ -#define Reg5 $reg5 /**/ -#define Reg6 $reg6 /**/ -#define Reg7 $reg7 /**/ -#define Reg8 $reg8 /**/ -#define Reg9 $reg9 /**/ -#define Reg10 $reg10 /**/ -#define Reg11 $reg11 /**/ -#define Reg12 $reg12 /**/ -#define Reg13 $reg13 /**/ -#define Reg14 $reg14 /**/ -#define Reg15 $reg15 /**/ -#define Reg16 $reg16 /**/ - -/* VOIDFLAGS: - * This symbol indicates how much support of the void type is given by this - * compiler. What various bits mean: - * - * 1 = supports declaration of void - * 2 = supports arrays of pointers to functions returning void - * 4 = supports comparisons between pointers to void functions and - * addresses of void functions - * - * The package designer should define VOIDUSED to indicate the requirements - * of the package. This can be done either by #defining VOIDUSED before - * including config.h, or by defining defvoidused in Myinit.U. If the - * level of void support necessary is not present, defines void to int. - */ -#ifndef VOIDUSED -#define VOIDUSED $defvoidused -#endif -#define VOIDFLAGS $voidflags -#if (VOIDFLAGS & VOIDUSED) != VOIDUSED -#$define void int /* is void to be avoided? */ -#$define M_VOID /* Xenix strikes again */ -#endif - -!GROK!THIS! diff --git a/xc/util/patch/config.h.nt b/xc/util/patch/config.h.nt deleted file mode 100644 index b346523b9..000000000 --- a/xc/util/patch/config.h.nt +++ /dev/null @@ -1,82 +0,0 @@ - -/* $XConsortium: config.h.nt,v 1.1 94/09/09 20:26:16 kaleb Exp $ */ - -/* Portability variables. -*- C -*- */ - -/* Define if the system does not support the `const' keyword. */ -#undef const - -/* Define if the system supports file names longer than 14 characters. */ -#define HAVE_LONG_FILE_NAMES 1 - -/* Define if the system has pathconf(). */ -#undef HAVE_PATHCONF - -/* Define if the system has strerror(). */ -#define HAVE_STRERROR - -/* Define if the system has ANSI C header files and library functions. */ -#define STDC_HEADERS - -/* Define if the system uses strchr instead of index - and strrchr instead of rindex. */ -#define HAVE_STRING_H - -#if defined(STDC_HEADERS) || defined(HAVE_STRING_H) -#define index strchr -#define rindex strrchr -#endif - -/* Define if the system has unistd.h. */ -#undef HAVE_UNISTD_H - -/* Define as either int or void -- the type that signal handlers return. */ -#undef RETSIGTYPE - -#ifndef RETSIGTYPE -#define RETSIGTYPE void -#endif - -/* Which directory library header to use. */ -#undef DIRENT /* dirent.h */ -#undef SYSNDIR /* sys/ndir.h */ -#undef SYSDIR /* sys/dir.h */ -#undef NDIR /* ndir.h */ -#define DIRECT /* Windoze NT direct.h */ -#define NODIR /* none -- don't make numbered backup files */ - -/* Define if the system lets you pass fewer arguments to a function - than the function actually accepts (in the absence of a prototype). - Defining it makes I/O calls slightly more efficient. - You need not bother defining it unless your C preprocessor chokes on - multi-line arguments to macros. */ -#undef CANVARARG - -/* Define Reg* as either `register' or nothing, depending on whether - the C compiler pays attention to this many register declarations. - The intent is that you don't have to order your register declarations - in the order of importance, so you can freely declare register variables - in sub-blocks of code and as function parameters. - Do not use Reg<n> more than once per routine. - - These don't really matter a lot, since most modern C compilers ignore - register declarations and often do a better job of allocating - registers than people do. */ - -#define Reg1 -#define Reg2 -#define Reg3 -#define Reg4 -#define Reg5 -#define Reg6 -#define Reg7 -#define Reg8 -#define Reg9 -#define Reg10 -#define Reg11 -#define Reg12 -#define Reg13 -#define Reg14 -#define Reg15 -#define Reg16 - diff --git a/xc/util/patch/inp.c b/xc/util/patch/inp.c deleted file mode 100644 index 20e5709a7..000000000 --- a/xc/util/patch/inp.c +++ /dev/null @@ -1,387 +0,0 @@ -/* $XConsortium: inp.c,v 3.4 94/09/14 21:18:35 gildea Exp $ - * - * Revision 3.1 94/03/29 13:39:15 gildea - * check that a patch that creates a file has not already been applied. - * version "XC1" - * - * Revision 2.0.1.1 88/06/03 15:06:13 lwall - * patch10: made a little smarter about sccs files - * - * Revision 2.0 86/09/17 15:37:02 lwall - * Baseline for netwide release. - * - */ - -#include "EXTERN.h" -#include "common.h" -#include "util.h" -#include "pch.h" -#include "INTERN.h" -#include "inp.h" - -/* Input-file-with-indexable-lines abstract type */ - -static long i_size; /* size of the input file */ -static char *i_womp; /* plan a buffer for entire file */ -static char **i_ptr; /* pointers to lines in i_womp */ - -static int tifd = -1; /* plan b virtual string array */ -static char *tibuf[2]; /* plan b buffers */ -static LINENUM tiline[2] = {-1, -1}; /* 1st line in each buffer */ -static LINENUM lines_per_buf; /* how many lines per buffer */ -static int tireclen; /* length of records in tmp file */ - -/* New patch--prepare to edit another file. */ - -void -re_input() -{ - if (using_plan_a) { - i_size = 0; -#ifndef lint - if (i_ptr != Null(char**)) - free((char *)i_ptr); -#endif - if (i_womp != Nullch) - free(i_womp); - i_womp = Nullch; - i_ptr = Null(char **); - } - else { - using_plan_a = TRUE; /* maybe the next one is smaller */ - Close(tifd); - tifd = -1; - free(tibuf[0]); - free(tibuf[1]); - tibuf[0] = tibuf[1] = Nullch; - tiline[0] = tiline[1] = -1; - tireclen = 0; - } -} - -/* Constuct the line index, somehow or other. */ - -void -scan_input(filename) -char *filename; -{ - if (!plan_a(filename)) - plan_b(filename); - if (verbose) { - say3("Patching file %s using Plan %s...\n", filename, - (using_plan_a ? "A" : "B") ); - } -} - -/* Try keeping everything in memory. */ - -bool -plan_a(filename) -char *filename; -{ - int ifd, statfailed; - Reg1 char *s; - Reg2 LINENUM iline; - char lbuf[MAXLINELEN]; - int output_elsewhere = strcmp(filename, outname); - - statfailed = stat(filename, &filestat); - if (statfailed && ok_to_create_file) { - if (verbose) - say2("(Creating file %s...)\n",filename); - makedirs(filename, TRUE); - close(creat(filename, 0666)); - statfailed = stat(filename, &filestat); - } else if (!statfailed && ok_to_create_file) { - /* ok_to_create_file means the file either doesn't exist - or is zero-length. Since there is no context in the patch, - avoid doubling the file if the patch has already been applied - by bailing out here if these conditions are not met. */ - if (filestat.st_size != 0) - fatal2("supposedly new file \"%s\" already exists\n", filename); - } -#ifndef WIN32 - /* For nonexistent or read-only files, look for RCS or SCCS versions. */ - if (statfailed - || (! output_elsewhere - && (/* No one can write to it. */ - (filestat.st_mode & 0222) == 0 - /* I can't write to it. */ - || ((filestat.st_mode & 0022) == 0 - && filestat.st_uid != myuid)))) { - struct stat cstat; - char *cs = Nullch; - char *filebase; - int pathlen; - - filebase = basename(filename); - pathlen = filebase - filename; - - /* Put any leading path into `s'. - Leave room in lbuf for the diff command. */ - s = lbuf + 20; - strncpy(s, filename, pathlen); - -#define try(f, a1, a2) (Sprintf(s + pathlen, f, a1, a2), stat(s, &cstat) == 0) - if ( try("RCS/%s%s", filebase, RCSSUFFIX) - || try("RCS/%s" , filebase, 0) - || try( "%s%s", filebase, RCSSUFFIX)) { - Sprintf(buf, output_elsewhere?CHECKOUT:CHECKOUT_LOCKED, filename); - Sprintf(lbuf, RCSDIFF, filename); - cs = "RCS"; - } else if ( try("SCCS/%s%s", SCCSPREFIX, filebase) - || try( "%s%s", SCCSPREFIX, filebase)) { - Sprintf(buf, output_elsewhere?GET:GET_LOCKED, s); - Sprintf(lbuf, SCCSDIFF, s, filename); - cs = "SCCS"; - } else if (statfailed) - fatal2("can't find %s\n", filename); - /* else we can't write to it but it's not under a version - control system, so just proceed. */ - if (cs) { - if (!statfailed) { - if ((filestat.st_mode & 0222) != 0) - /* The owner can write to it. */ - fatal3("file %s seems to be locked by somebody else under %s\n", - filename, cs); - /* It might be checked out unlocked. See if it's safe to - check out the default version locked. */ - if (verbose) - say3("Comparing file %s to default %s version...\n", - filename, cs); - if (system(lbuf)) - fatal3("can't check out file %s: differs from default %s version\n", - filename, cs); - } - if (verbose) - say3("Checking out file %s from %s...\n", filename, cs); - if (system(buf) || stat(filename, &filestat)) - fatal3("can't check out file %s from %s\n", filename, cs); - } - } -#endif - filemode = filestat.st_mode; - if (!S_ISREG(filemode)) - fatal2("%s is not a normal file--can't patch\n", filename); - i_size = filestat.st_size; - if (out_of_mem) { - set_hunkmax(); /* make sure dynamic arrays are allocated */ - out_of_mem = FALSE; - return FALSE; /* force plan b because plan a bombed */ - } -#ifdef lint - i_womp = Nullch; -#else - i_womp = malloc((MEM)(i_size+2)); /* lint says this may alloc less than */ - /* i_size, but that's okay, I think. */ -#endif - if (i_womp == Nullch) - return FALSE; -#ifndef WIN32 - if ((ifd = open(filename, 0)) < 0) -#else - if ((ifd = open(filename, _O_RDONLY | _O_BINARY)) < 0) -#endif - pfatal2("can't open file %s", filename); -#ifndef lint - if (read(ifd, i_womp, (int)i_size) != i_size) { - Close(ifd); /* probably means i_size > 15 or 16 bits worth */ - free(i_womp); /* at this point it doesn't matter if i_womp was */ - return FALSE; /* undersized. */ - } -#endif - Close(ifd); - if (i_size && i_womp[i_size-1] != '\n') - i_womp[i_size++] = '\n'; - i_womp[i_size] = '\0'; - - /* count the lines in the buffer so we know how many pointers we need */ - - iline = 0; - for (s=i_womp; *s; s++) { - if (*s == '\n') - iline++; - } -#ifdef lint - i_ptr = Null(char**); -#else - i_ptr = (char **)malloc((MEM)((iline + 2) * sizeof(char *))); -#endif - if (i_ptr == Null(char **)) { /* shucks, it was a near thing */ - free((char *)i_womp); - return FALSE; - } - - /* now scan the buffer and build pointer array */ - - iline = 1; - i_ptr[iline] = i_womp; - for (s=i_womp; *s; s++) { - if (*s == '\n') - i_ptr[++iline] = s+1; /* these are NOT null terminated */ - } - input_lines = iline - 1; - - /* now check for revision, if any */ - - if (revision != Nullch) { - if (!rev_in_string(i_womp)) { - if (force) { - if (verbose) - say2( -"Warning: this file doesn't appear to be the %s version--patching anyway.\n", - revision); - } - else if (batch) { - fatal2( -"this file doesn't appear to be the %s version--aborting.\n", revision); - } - else { - ask2( -"This file doesn't appear to be the %s version--patch anyway? [n] ", - revision); - if (*buf != 'y') - fatal1("aborted\n"); - } - } - else if (verbose) - say2("Good. This file appears to be the %s version.\n", - revision); - } - return TRUE; /* plan a will work */ -} - -/* Keep (virtually) nothing in memory. */ - -void -plan_b(filename) -char *filename; -{ - Reg3 FILE *ifp; - Reg1 int i = 0; - Reg2 int maxlen = 1; - Reg4 bool found_revision = (revision == Nullch); - - using_plan_a = FALSE; -#ifndef WIN32 - if ((ifp = fopen(filename, "r")) == Nullfp) -#else - if ((ifp = fopen(filename, "rb")) == Nullfp) -#endif - pfatal2("can't open file %s", filename); -#ifndef WIN32 - if ((tifd = creat(TMPINNAME, 0666)) < 0) -#else - if ((tifd = open(TMPINNAME, _O_CREAT | _O_TRUNC | _O_BINARY, _S_IWRITE)) < 0) -#endif - pfatal2("can't open file %s", TMPINNAME); - while (fgets(buf, sizeof buf, ifp) != Nullch) { - if (revision != Nullch && !found_revision && rev_in_string(buf)) - found_revision = TRUE; - if ((i = strlen(buf)) > maxlen) - maxlen = i; /* find longest line */ - } - if (revision != Nullch) { - if (!found_revision) { - if (force) { - if (verbose) - say2( -"Warning: this file doesn't appear to be the %s version--patching anyway.\n", - revision); - } - else if (batch) { - fatal2( -"this file doesn't appear to be the %s version--aborting.\n", revision); - } - else { - ask2( -"This file doesn't appear to be the %s version--patch anyway? [n] ", - revision); - if (*buf != 'y') - fatal1("aborted\n"); - } - } - else if (verbose) - say2("Good. This file appears to be the %s version.\n", - revision); - } - Fseek(ifp, 0L, 0); /* rewind file */ - lines_per_buf = BUFFERSIZE / maxlen; - tireclen = maxlen; - tibuf[0] = malloc((MEM)(BUFFERSIZE + 1)); - tibuf[1] = malloc((MEM)(BUFFERSIZE + 1)); - if (tibuf[1] == Nullch) - fatal1("out of memory\n"); - for (i=1; ; i++) { - if (! (i % lines_per_buf)) /* new block */ - if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE) - pfatal1("can't write temp file"); - if (fgets(tibuf[0] + maxlen * (i%lines_per_buf), maxlen + 1, ifp) - == Nullch) { - input_lines = i - 1; - if (i % lines_per_buf) - if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE) - pfatal1("can't write temp file"); - break; - } - } - Fclose(ifp); - Close(tifd); - if ((tifd = open(TMPINNAME, 0)) < 0) { - pfatal2("can't reopen file %s", TMPINNAME); - } -} - -/* Fetch a line from the input file, \n terminated, not necessarily \0. */ - -char * -ifetch(line,whichbuf) -Reg1 LINENUM line; -int whichbuf; /* ignored when file in memory */ -{ - if (line < 1 || line > input_lines) - return ""; - if (using_plan_a) - return i_ptr[line]; - else { - LINENUM offline = line % lines_per_buf; - LINENUM baseline = line - offline; - - if (tiline[0] == baseline) - whichbuf = 0; - else if (tiline[1] == baseline) - whichbuf = 1; - else { - tiline[whichbuf] = baseline; -#ifndef lint /* complains of long accuracy */ - Lseek(tifd, (long)baseline / lines_per_buf * BUFFERSIZE, 0); -#endif - if (read(tifd, tibuf[whichbuf], BUFFERSIZE) < 0) - pfatal2("error reading tmp file %s", TMPINNAME); - } - return tibuf[whichbuf] + (tireclen*offline); - } -} - -/* True if the string argument contains the revision number we want. */ - -bool -rev_in_string(string) -char *string; -{ - Reg1 char *s; - Reg2 int patlen; - - if (revision == Nullch) - return TRUE; - patlen = strlen(revision); - if (strnEQ(string,revision,patlen) && isspace(string[patlen])) - return TRUE; - for (s = string; *s; s++) { - if (isspace(*s) && strnEQ(s+1, revision, patlen) && - isspace(s[patlen+1] )) { - return TRUE; - } - } - return FALSE; -} diff --git a/xc/util/patch/inp.h b/xc/util/patch/inp.h deleted file mode 100644 index 6fd4ec8f2..000000000 --- a/xc/util/patch/inp.h +++ /dev/null @@ -1,18 +0,0 @@ -/* oldHeader: inp.h,v 2.0 86/09/17 15:37:25 lwall Exp $ - * $XConsortium: inp.h,v 2.1 94/09/09 20:04:28 gildea Exp $ - * - * Revision 2.0 86/09/17 15:37:25 lwall - * Baseline for netwide release. - * - */ - -EXT LINENUM input_lines INIT(0); /* how long is input file in lines */ -EXT LINENUM last_frozen_line INIT(0); /* how many input lines have been */ - /* irretractibly output */ - -bool rev_in_string(); -void scan_input(); -bool plan_a(); /* returns false if insufficient memory */ -void plan_b(); -char *ifetch(); - diff --git a/xc/util/patch/malloc.c b/xc/util/patch/malloc.c deleted file mode 100644 index a8436c440..000000000 --- a/xc/util/patch/malloc.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * @(#)nmalloc.c 1 (Caltech) 2/21/82 - * - * U of M Modified: 20 Jun 1983 ACT: strange hacks for Emacs - * - * Nov 1983, Mike@BRL, Added support for 4.1C/4.2 BSD. - * - * This is a very fast storage allocator. It allocates blocks of a small - * number of different sizes, and keeps free lists of each size. Blocks - * that don't exactly fit are passed up to the next larger size. In this - * implementation, the available sizes are (2^n)-4 (or -16) bytes long. - * This is designed for use in a program that uses vast quantities of - * memory, but bombs when it runs out. To make it a little better, it - * warns the user when he starts to get near the end. - * - * June 84, ACT: modified rcheck code to check the range given to malloc, - * rather than the range determined by the 2-power used. - * - * Jan 85, RMS: calls malloc_warning to issue warning on nearly full. - * No longer Emacs-specific; can serve as all-purpose malloc for GNU. - * You should call malloc_init to reinitialize after loading dumped Emacs. - * Call malloc_stats to get info on memory stats if MSTATS turned on. - * realloc knows how to return same block given, just changing its size, - * if the power of 2 is correct. - */ - -/* - * nextf[i] is the pointer to the next free block of size 2^(i+3). The - * smallest allocatable block is 8 bytes. The overhead information will - * go in the first int of the block, and the returned pointer will point - * to the second. - * -#ifdef MSTATS - * nmalloc[i] is the difference between the number of mallocs and frees - * for a given block size. -#endif - */ - -#define ISALLOC ((char) 0xf7) /* magic byte that implies allocation */ -#define ISFREE ((char) 0x54) /* magic byte that implies free block */ - /* this is for error checking only */ - -extern char etext; - -/* end of the program; can be changed by calling init_malloc */ -static char *endofpure = &etext; - -#ifdef MSTATS -static int nmalloc[30]; -static int nmal, nfre; -#endif /* MSTATS */ - -/* If range checking is not turned on, all we have is a flag indicating - whether memory is allocated, an index in nextf[], and a size field; to - realloc() memory we copy either size bytes or 1<<(index+3) bytes depending - on whether the former can hold the exact size (given the value of - 'index'). If range checking is on, we always need to know how much space - is allocated, so the 'size' field is never used. */ - -struct mhead { - char mh_alloc; /* ISALLOC or ISFREE */ - char mh_index; /* index in nextf[] */ -/* Remainder are valid only when block is allocated */ - unsigned short mh_size; /* size, if < 0x10000 */ -#ifdef rcheck - unsigned mh_nbytes; /* number of bytes allocated */ - int mh_magic4; /* should be == MAGIC4 */ -#endif /* rcheck */ - }; - -/* Access free-list pointer of a block. - It is stored at block + 4. - This is not a field in the mhead structure - because we want sizeof (struct mhead) - to describe the overhead for when the block is in use, - and we do not want the free-list pointer to count in that. */ - -#define CHAIN(a) \ - (*(struct mhead **) (sizeof (char *) + (char *) (a))) - -#ifdef rcheck - -/* To implement range checking, we write magic values in at the beginning and - end of each allocated block, and make sure they are undisturbed whenever a - free or a realloc occurs. */ -/* Written in each of the 4 bytes following the block's real space */ -#define MAGIC1 0x55 -/* Written in the 4 bytes before the block's real space */ -#define MAGIC4 0x55555555 -#define ASSERT(p) if (!(p)) botch("p"); else -static -botch(s) - char *s; -{ - - printf("assertion botched: %s\n", s); - abort(); -} -#define EXTRA 4 /* 4 bytes extra for MAGIC1s */ -#else -#define ASSERT(p) -#define EXTRA 0 -#endif /* rcheck */ - -/* nextf[i] is free list of blocks of size 2**(i + 3) */ - -static struct mhead *nextf[30]; - -#ifdef M_WARN -/* Number of bytes of writable memory we can expect to be able to get */ -static int lim_data; -/* Level number of warnings already issued. - 0 -- no warnings issued. - 1 -- 75% warning already issued. - 2 -- 85% warning already issued. -*/ -static int warnlevel; -#endif /* M_WARN */ - -/* nonzero once initial bunch of free blocks made */ -static int gotpool; - -/* Cause reinitialization based on job parameters; - also declare where the end of pure storage is. */ -malloc_init (end) - char *end; { - endofpure = end; -#ifdef M_WARN - lim_data = 0; - warnlevel = 0; -#endif /* M_WARN */ - } - -static -morecore (nu) /* ask system for more memory */ - register int nu; { /* size index to get more of */ - char *sbrk (); - register char *cp; - register int nblks; - register int siz; - -#ifdef M_WARN -#ifndef BSD42 -#ifdef USG - extern long ulimit (); - if (lim_data == 0) /* find out how much we can get */ - lim_data = ulimit (3, 0) - TEXT_START; -#else /*HMS: was endif */ - if (lim_data == 0) /* find out how much we can get */ - lim_data = vlimit (LIM_DATA, -1); -#endif /* USG */ /HMS:* was not here */ -#else - if (lim_data == 0) { - struct rlimit XXrlimit; - - getrlimit (RLIMIT_DATA, &XXrlimit); - lim_data = XXrlimit.rlim_cur;} /* soft limit */ -#endif /* BSD42 */ -#endif /* M_WARN */ - - /* On initial startup, get two blocks of each size up to 1k bytes */ - if (!gotpool) - getpool (), getpool (), gotpool = 1; - - /* Find current end of memory and issue warning if getting near max */ - - cp = sbrk (0); - siz = cp - endofpure; -#ifdef M_WARN - switch (warnlevel) { - case 0: - if (siz > (lim_data / 4) * 3) { - warnlevel++; - malloc_warning ("Warning: past 75% of memory limit");} - break; - case 1: - if (siz > (lim_data / 20) * 17) { - warnlevel++; - malloc_warning ("Warning: past 85% of memory limit");} - break; - case 2: - if (siz > (lim_data / 20) * 19) { - warnlevel++; - malloc_warning ("Warning: past 95% of memory limit");} - break;} -#endif /* M_WARN */ - - if ((int) cp & 0x3ff) /* land on 1K boundaries */ - sbrk (1024 - ((int) cp & 0x3ff)); - - /* Take at least 2k, and figure out how many blocks of the desired size we're about to get */ - nblks = 1; - if ((siz = nu) < 8) - nblks = 1 << ((siz = 8) - nu); - - if ((cp = sbrk (1 << (siz + 3))) == (char *) -1) - return; /* no more room! */ - if ((int) cp & 7) { /* shouldn't happen, but just in case */ - cp = (char *) (((int) cp + 8) & ~7); - nblks--;} - - /* save new header and link the nblks blocks together */ - nextf[nu] = (struct mhead *) cp; - siz = 1 << (nu + 3); - while (1) { - ((struct mhead *) cp) -> mh_alloc = ISFREE; - ((struct mhead *) cp) -> mh_index = nu; - if (--nblks <= 0) break; - CHAIN ((struct mhead *) cp) = (struct mhead *) (cp + siz); - cp += siz;} -#if 0 - CHAIN ((struct mhead *) cp) = 0; /* since sbrk() returns cleared core, this is already set */ -#endif - } - -static -getpool () { - register int nu; - register char *cp = sbrk (0); - - if ((int) cp & 0x3ff) /* land on 1K boundaries */ - sbrk (1024 - ((int) cp & 0x3ff)); - - /* Get 2k of storage */ - - cp = sbrk (04000); - if (cp == (char *) -1) - return; - - /* Divide it into an initial 8-word block - plus one block of size 2**nu for nu = 3 ... 10. */ - - CHAIN (cp) = nextf[0]; - nextf[0] = (struct mhead *) cp; - ((struct mhead *) cp) -> mh_alloc = ISFREE; - ((struct mhead *) cp) -> mh_index = 0; - cp += 8; - - for (nu = 0; nu < 7; nu++) { - CHAIN (cp) = nextf[nu]; - nextf[nu] = (struct mhead *) cp; - ((struct mhead *) cp) -> mh_alloc = ISFREE; - ((struct mhead *) cp) -> mh_index = nu; - cp += 8 << nu;}} - -char * -malloc (n) /* get a block */ - unsigned n; { - register struct mhead *p; - register unsigned int nbytes; - register int nunits = 0; - - /* Figure out how many bytes are required, rounding up to the nearest - multiple of 4, then figure out which nextf[] area to use */ - nbytes = (n + sizeof *p + EXTRA + 3) & ~3; - { - register unsigned int shiftr = (nbytes - 1) >> 2; - - while (shiftr >>= 1) - nunits++; - } - - /* If there are no blocks of the appropriate size, go get some */ - /* COULD SPLIT UP A LARGER BLOCK HERE ... ACT */ - if (nextf[nunits] == 0) - morecore (nunits); - - /* Get one block off the list, and set the new list head */ - if ((p = nextf[nunits]) == 0) - return 0; - nextf[nunits] = CHAIN (p); - - /* Check for free block clobbered */ - /* If not for this check, we would gobble a clobbered free chain ptr */ - /* and bomb out on the NEXT allocate of this size block */ - if (p -> mh_alloc != ISFREE || p -> mh_index != nunits) -#ifdef rcheck - botch ("block on free list clobbered"); -#else - abort (); -#endif /* rcheck */ - - /* Fill in the info, and if range checking, set up the magic numbers */ - p -> mh_alloc = ISALLOC; -#ifdef rcheck - p -> mh_nbytes = n; - p -> mh_magic4 = MAGIC4; - { - register char *m = (char *) (p + 1) + n; - - *m++ = MAGIC1, *m++ = MAGIC1, *m++ = MAGIC1, *m = MAGIC1; - } -#else - p -> mh_size = n; -#endif /* rcheck */ -#ifdef MSTATS - nmalloc[nunits]++; - nmal++; -#endif /* MSTATS */ - return (char *) (p + 1);} - -free (mem) - char *mem; { - register struct mhead *p; - { - register char *ap = mem; - - ASSERT (ap != 0); - p = (struct mhead *) ap - 1; - ASSERT (p -> mh_alloc == ISALLOC); -#ifdef rcheck - ASSERT (p -> mh_magic4 == MAGIC4); - ap += p -> mh_nbytes; - ASSERT (*ap++ == MAGIC1); ASSERT (*ap++ == MAGIC1); - ASSERT (*ap++ == MAGIC1); ASSERT (*ap == MAGIC1); -#endif /* rcheck */ - } - { - register int nunits = p -> mh_index; - - ASSERT (nunits <= 29); - p -> mh_alloc = ISFREE; - CHAIN (p) = nextf[nunits]; - nextf[nunits] = p; -#ifdef MSTATS - nmalloc[nunits]--; - nfre++; -#endif /* MSTATS */ - } - } - -char * -realloc (mem, n) - char *mem; - register unsigned n; { - register struct mhead *p; - register unsigned int tocopy; - register int nbytes; - register int nunits; - - if ((p = (struct mhead *) mem) == 0) - return malloc (n); - p--; - nunits = p -> mh_index; - ASSERT (p -> mh_alloc == ISALLOC); -#ifdef rcheck - ASSERT (p -> mh_magic4 == MAGIC4); - { - register char *m = mem + (tocopy = p -> mh_nbytes); - ASSERT (*m++ == MAGIC1); ASSERT (*m++ == MAGIC1); - ASSERT (*m++ == MAGIC1); ASSERT (*m == MAGIC1); - } -#else - if (p -> mh_index >= 13) - tocopy = (1 << (p -> mh_index + 3)) - sizeof *p; - else - tocopy = p -> mh_size; -#endif /* rcheck */ - - /* See if desired size rounds to same power of 2 as actual size. */ - nbytes = (n + sizeof *p + EXTRA + 7) & ~7; - - /* If ok, use the same block, just marking its size as changed. */ - if (nbytes > (4 << nunits) && nbytes <= (8 << nunits)) { -#ifdef rcheck - register char *m = mem + tocopy; - *m++ = 0; *m++ = 0; *m++ = 0; *m++ = 0; - p-> mh_nbytes = n; - m = mem + n; - *m++ = MAGIC1; *m++ = MAGIC1; *m++ = MAGIC1; *m++ = MAGIC1; -#else - p -> mh_size = n; -#endif /* rcheck */ - return mem;} - - if (n < tocopy) - tocopy = n; - { - register char *new; - void bcopy(); /*HMS: here? */ - - if ((new = malloc (n)) == 0) - return 0; - bcopy (mem, new, tocopy); - free (mem); - return new; - } - } - -#ifdef MSTATS -/* Return statistics describing allocation of blocks of size 2**n. */ - -struct mstats_value { - int blocksize; - int nfree; - int nused; - }; - -struct mstats_value -malloc_stats (size) - int size; { - struct mstats_value v; - register int i; - register struct mhead *p; - - v.nfree = 0; - - if (size < 0 || size >= 30) { - v.blocksize = 0; - v.nused = 0; - return v;} - - v.blocksize = 1 << (size + 3); - v.nused = nmalloc[size]; - - for (p = nextf[size]; p; p = CHAIN (p)) - v.nfree++; - - return v;} -#endif - -/* how much space is available? */ - -unsigned freespace() { - register int i, j; - register struct mhead *p; - register unsigned space = 0; - int local; /* address only is used */ - - space = (char *)&local - sbrk(0); /* stack space */ - - for (i = 0; i < 30; i++) { - for (j = 0, p = nextf[i]; p; p = CHAIN (p), j++) ; - space += j * (1 << (i + 3));} - - return(space);} - -/* How big is this cell? */ - -unsigned mc_size(cp) - char *cp;{ - register struct mhead *p; - - if ((p = (struct mhead *) cp) == 0) { - /*HMS? */ - } - p--; -#ifdef rcheck - return p -> mh_nbytes; -#else - return (1 << (p -> mh_index + 3)) - sizeof *p; -#if 0 - if (p -> mh_index >= 13) - return (1 << (p -> mh_index + 3)) - sizeof *p; - else - return p -> mh_size; -#endif -#endif /* rcheck */ - } - -/*HMS: Really should use memcpy, if available... */ - -void bcopy(source, dest, len) - register char *source, *dest; - register len; { - register i; - - for (i = 0; i < len; i++) - *dest++ = *source++;} diff --git a/xc/util/patch/patch.c b/xc/util/patch/patch.c deleted file mode 100644 index 28048be97..000000000 --- a/xc/util/patch/patch.c +++ /dev/null @@ -1,941 +0,0 @@ -char rcsid[] = - "$XConsortium: patch.c,v 3.3 94/09/14 21:21:33 gildea Exp $"; -/* "oldHeader: patch.c,v 2.0.2.0 90/05/01 22:17:50 davison Locked $"; */ - -/* patch - a program to apply diffs to original files - * - * Copyright 1986, Larry Wall - * - * This program may be copied as long as you don't try to make any - * money off of it, or pretend that you wrote it. - * - * Revision 2.0.2.0 90/05/01 22:17:50 davison - * patch12u: unidiff support added - * - * Revision 2.0.1.6 88/06/22 20:46:39 lwall - * patch12: rindex() wasn't declared - * - * Revision 2.0.1.5 88/06/03 15:09:37 lwall - * patch10: exit code improved. - * patch10: better support for non-flexfilenames. - * - * Revision 2.0.1.4 87/02/16 14:00:04 lwall - * Short replacement caused spurious "Out of sync" message. - * - * Revision 2.0.1.3 87/01/30 22:45:50 lwall - * Improved diagnostic on sync error. - * Moved do_ed_script() to pch.c. - * - * Revision 2.0.1.2 86/11/21 09:39:15 lwall - * Fuzz factor caused offset of installed lines. - * - * Revision 2.0.1.1 86/10/29 13:10:22 lwall - * Backwards search could terminate prematurely. - * - * Revision 2.0 86/09/17 15:37:32 lwall - * Baseline for netwide release. - * - * Revision 1.5 86/08/01 20:53:24 lwall - * Changed some %d's to %ld's. - * Linted. - * - * Revision 1.4 86/08/01 19:17:29 lwall - * Fixes for machines that can't vararg. - * Added fuzz factor. - * Generalized -p. - * General cleanup. - * - * 85/08/15 van%ucbmonet@berkeley - * Changes for 4.3bsd diff -c. - * - * Revision 1.3 85/03/26 15:07:43 lwall - * Frozen. - * - * Revision 1.2.1.9 85/03/12 17:03:35 lwall - * Changed pfp->_file to fileno(pfp). - * - * Revision 1.2.1.8 85/03/12 16:30:43 lwall - * Check i_ptr and i_womp to make sure they aren't null before freeing. - * Also allow ed output to be suppressed. - * - * Revision 1.2.1.7 85/03/12 15:56:13 lwall - * Added -p option from jromine@uci-750a. - * - * Revision 1.2.1.6 85/03/12 12:12:51 lwall - * Now checks for normalness of file to patch. - * - * Revision 1.2.1.5 85/03/12 11:52:12 lwall - * Added -D (#ifdef) option from joe@fluke. - * - * Revision 1.2.1.4 84/12/06 11:14:15 lwall - * Made smarter about SCCS subdirectories. - * - * Revision 1.2.1.3 84/12/05 11:18:43 lwall - * Added -l switch to do loose string comparison. - * - * Revision 1.2.1.2 84/12/04 09:47:13 lwall - * Failed hunk count not reset on multiple patch file. - * - * Revision 1.2.1.1 84/12/04 09:42:37 lwall - * Branch for sdcrdcf changes. - * - * Revision 1.2 84/11/29 13:29:51 lwall - * Linted. Identifiers uniqified. Fixed i_ptr malloc() bug. Fixed - * multiple calls to mktemp(). Will now work on machines that can only - * read 32767 chars. Added -R option for diffs with new and old swapped. - * Various cosmetic changes. - * - * Revision 1.1 84/11/09 17:03:58 lwall - * Initial revision - * - */ - -#include "INTERN.h" -#include "common.h" -#include "EXTERN.h" -#include "version.h" -#include "util.h" -#include "pch.h" -#include "inp.h" -#include "backupfile.h" - -/* procedures */ - -void reinitialize_almost_everything(); -void get_some_switches(); -LINENUM locate_hunk(); -void abort_hunk(); -void apply_hunk(); -void init_output(); -void init_reject(); -void copy_till(); -void spew_output(); -void dump_line(); -bool patch_match(); -bool similar(); -void re_input(); -void my_exit(); - -/* TRUE if -E was specified on command line. */ -static int remove_empty_files = FALSE; - -/* TRUE if -R was specified on command line. */ -static int reverse_flag_specified = FALSE; - -/* Apply a set of diffs as appropriate. */ - -int -main(argc,argv) -int argc; -char **argv; -{ - LINENUM where; - LINENUM newwhere; - LINENUM fuzz; - LINENUM mymaxfuzz; - int hunk = 0; - int failed = 0; - int failtotal = 0; - bool rev_okayed = 0; - int i; - - setbuf(stderr, serrbuf); - for (i = 0; i<MAXFILEC; i++) - filearg[i] = Nullch; - -#ifndef WIN32 - myuid = getuid(); -#endif - - /* Cons up the names of the temporary files. */ - { - /* Directory for temporary files. */ - char *tmpdir; - int tmpname_len; - - tmpdir = getenv ("TMPDIR"); - if (tmpdir == NULL) { - tmpdir = "/tmp"; - } - tmpname_len = strlen (tmpdir) + 20; - - TMPOUTNAME = (char *) malloc (tmpname_len); - strcpy (TMPOUTNAME, tmpdir); - strcat (TMPOUTNAME, "/patchoXXXXXX"); - Mktemp(TMPOUTNAME); - - TMPINNAME = (char *) malloc (tmpname_len); - strcpy (TMPINNAME, tmpdir); - strcat (TMPINNAME, "/patchiXXXXXX"); - Mktemp(TMPINNAME); - - TMPREJNAME = (char *) malloc (tmpname_len); - strcpy (TMPREJNAME, tmpdir); - strcat (TMPREJNAME, "/patchrXXXXXX"); - Mktemp(TMPREJNAME); - - TMPPATNAME = (char *) malloc (tmpname_len); - strcpy (TMPPATNAME, tmpdir); - strcat (TMPPATNAME, "/patchpXXXXXX"); - Mktemp(TMPPATNAME); - } - - { - char *v; - - v = getenv ("SIMPLE_BACKUP_SUFFIX"); - if (v) - simple_backup_suffix = v; - else - simple_backup_suffix = ORIGEXT; -#ifndef NODIR - v = getenv ("VERSION_CONTROL"); - backup_type = get_version (v); /* OK to pass NULL. */ -#endif - } - - /* parse switches */ - Argc = argc; - Argv = argv; - get_some_switches(); - - /* make sure we clean up /tmp in case of disaster */ - set_signals(0); - - for ( - open_patch_file(filearg[1]); - there_is_another_patch(); - reinitialize_almost_everything() - ) { /* for each patch in patch file */ - - if (outname == Nullch) - outname = savestr(filearg[0]); - -#ifndef WIN32 - /* for ed script just up and do it and exit */ - if (diff_type == ED_DIFF) { - do_ed_script(); - continue; - } -#endif - - /* initialize the patched file */ - if (!skip_rest_of_patch) - init_output(TMPOUTNAME); - - /* initialize reject file */ - init_reject(TMPREJNAME); - - /* find out where all the lines are */ - if (!skip_rest_of_patch) - scan_input(filearg[0]); - - /* from here on, open no standard i/o files, because malloc */ - /* might misfire and we can't catch it easily */ - - /* apply each hunk of patch */ - hunk = 0; - failed = 0; - rev_okayed = FALSE; - out_of_mem = FALSE; - while (another_hunk()) { - hunk++; - fuzz = Nulline; - mymaxfuzz = pch_context(); - if (maxfuzz < mymaxfuzz) - mymaxfuzz = maxfuzz; - if (!skip_rest_of_patch) { - do { - where = locate_hunk(fuzz); - if (hunk == 1 && where == Nulline && !(force|rev_okayed)) { - /* dwim for reversed patch? */ - if (!pch_swap()) { - if (fuzz == Nulline) - say1( -"Not enough memory to try swapped hunk! Assuming unswapped.\n"); - continue; - } - reverse = !reverse; - where = locate_hunk(fuzz); /* try again */ - if (where == Nulline) { /* didn't find it swapped */ - if (!pch_swap()) /* put it back to normal */ - fatal1("lost hunk on alloc error!\n"); - reverse = !reverse; - } - else if (noreverse) { - if (!pch_swap()) /* put it back to normal */ - fatal1("lost hunk on alloc error!\n"); - reverse = !reverse; - say1( -"Ignoring previously applied (or reversed) patch.\n"); - skip_rest_of_patch = TRUE; - } - else if (batch) { - if (verbose) - say3( -"%seversed (or previously applied) patch detected! %s -R.", - reverse ? "R" : "Unr", - reverse ? "Assuming" : "Ignoring"); - } - else { - ask3( -"%seversed (or previously applied) patch detected! %s -R? [y] ", - reverse ? "R" : "Unr", - reverse ? "Assume" : "Ignore"); - if (*buf == 'n') { - ask1("Apply anyway? [n] "); - if (*buf == 'y') - rev_okayed = TRUE; - else - skip_rest_of_patch = TRUE; - where = Nulline; - reverse = !reverse; - if (!pch_swap()) /* put it back to normal */ - fatal1("lost hunk on alloc error!\n"); - } - } - } - } while (!skip_rest_of_patch && where == Nulline && - ++fuzz <= mymaxfuzz); - - if (skip_rest_of_patch) { /* just got decided */ - Fclose(ofp); - ofp = Nullfp; - } - } - - newwhere = pch_newfirst() + last_offset; - if (skip_rest_of_patch) { - abort_hunk(); - failed++; - if (verbose) - say3("Hunk #%d ignored at %ld.\n", hunk, newwhere); - } - else if (where == Nulline) { - abort_hunk(); - failed++; - if (verbose) - say3("Hunk #%d failed at %ld.\n", hunk, newwhere); - } - else { - apply_hunk(where); - if (verbose) { - say3("Hunk #%d succeeded at %ld", hunk, newwhere); - if (fuzz) - say2(" with fuzz %ld", fuzz); - if (last_offset) - say3(" (offset %ld line%s)", - last_offset, last_offset==1L?"":"s"); - say1(".\n"); - } - } - } - - if (out_of_mem && using_plan_a) { - Argc = Argc_last; - Argv = Argv_last; - say1("\n\nRan out of memory using Plan A--trying again...\n\n"); - if (ofp) - Fclose(ofp); - ofp = Nullfp; - if (rejfp) - Fclose(rejfp); - rejfp = Nullfp; - continue; - } - - assert(hunk); - - /* finish spewing out the new file */ - if (!skip_rest_of_patch) - spew_output(); - - /* and put the output where desired */ - ignore_signals(); - if (!skip_rest_of_patch) { - struct stat statbuf; - char *realout = outname; - - if (move_file(TMPOUTNAME, outname) < 0) { - toutkeep = TRUE; - realout = TMPOUTNAME; - chmod(TMPOUTNAME, filemode); - } - else - chmod(outname, filemode); - - if (remove_empty_files && stat(realout, &statbuf) == 0 - && statbuf.st_size == 0) { - if (verbose) - say2("Removing %s (empty after patching).\n", realout); - while (unlink(realout) >= 0) ; /* while is for Eunice. */ - } - } - Fclose(rejfp); - rejfp = Nullfp; - if (failed) { - failtotal += failed; - if (!*rejname) { - Strcpy(rejname, outname); -#ifndef FLEXFILENAMES - { - char *s = rindex(rejname,'/'); - - if (!s) - s = rejname; - if (strlen(s) > 13) - if (s[12] == '.') /* try to preserve difference */ - s[12] = s[13]; /* between .h, .c, .y, etc. */ - s[13] = '\0'; - } -#endif - Strcat(rejname, REJEXT); - } - if (skip_rest_of_patch) { - say4("%d out of %d hunks ignored--saving rejects to %s\n", - failed, hunk, rejname); - } - else { - say4("%d out of %d hunks failed--saving rejects to %s\n", - failed, hunk, rejname); - } - if (move_file(TMPREJNAME, rejname) < 0) - trejkeep = TRUE; - } - set_signals(1); - } - my_exit(failtotal); -} - -/* Prepare to find the next patch to do in the patch file. */ - -void -reinitialize_almost_everything() -{ - re_patch(); - re_input(); - - input_lines = 0; - last_frozen_line = 0; - - filec = 0; - if (filearg[0] != Nullch && !out_of_mem) { - free(filearg[0]); - filearg[0] = Nullch; - } - - if (outname != Nullch) { - free(outname); - outname = Nullch; - } - - last_offset = 0; - - diff_type = 0; - - if (revision != Nullch) { - free(revision); - revision = Nullch; - } - - reverse = reverse_flag_specified; - skip_rest_of_patch = FALSE; - - get_some_switches(); - - if (filec >= 2) - fatal1("you may not change to a different patch file\n"); -} - -static char * -nextarg() -{ - if (!--Argc) - fatal2("missing argument after `%s'\n", *Argv); - return *++Argv; -} - -/* Process switches and filenames up to next '+' or end of list. */ - -void -get_some_switches() -{ - Reg1 char *s; - - rejname[0] = '\0'; - Argc_last = Argc; - Argv_last = Argv; - if (!Argc) - return; - for (Argc--,Argv++; Argc; Argc--,Argv++) { - s = Argv[0]; - if (strEQ(s, "+")) { - return; /* + will be skipped by for loop */ - } - if (*s != '-' || !s[1]) { - if (filec == MAXFILEC) - fatal1("too many file arguments\n"); - filearg[filec++] = savestr(s); - } - else { - switch (*++s) { - case 'b': - simple_backup_suffix = savestr(nextarg()); - break; - case 'B': - origprae = savestr(nextarg()); - break; - case 'c': - diff_type = CONTEXT_DIFF; - break; - case 'd': - if (!*++s) - s = nextarg(); - if (chdir(s) < 0) - pfatal2("can't cd to %s", s); - break; - case 'D': - do_defines = TRUE; - if (!*++s) - s = nextarg(); - if (!isalpha(*s) && '_' != *s) - fatal1("argument to -D is not an identifier\n"); - Sprintf(if_defined, "#ifdef %s\n", s); - Sprintf(not_defined, "#ifndef %s\n", s); - Sprintf(end_defined, "#endif /* %s */\n", s); - break; -#ifndef WIN32 - case 'e': - diff_type = ED_DIFF; - break; -#endif - case 'E': - remove_empty_files = TRUE; - break; - case 'f': - force = TRUE; - break; - case 'F': - if (*++s == '=') - s++; - maxfuzz = atoi(s); - break; - case 'l': - canonicalize = TRUE; - break; - case 'n': - diff_type = NORMAL_DIFF; - break; - case 'N': - noreverse = TRUE; - break; - case 'o': - outname = savestr(nextarg()); - break; - case 'p': - if (*++s == '=') - s++; - strippath = atoi(s); - break; - case 'r': - Strcpy(rejname, nextarg()); - break; - case 'R': - reverse = TRUE; - reverse_flag_specified = TRUE; - break; - case 's': - verbose = FALSE; - break; - case 'S': - skip_rest_of_patch = TRUE; - break; - case 't': - batch = TRUE; - break; - case 'u': - diff_type = UNI_DIFF; - break; - case 'v': - version(); - break; - case 'V': -#ifndef NODIR - backup_type = get_version (nextarg ()); -#endif - break; -#ifdef DEBUGGING - case 'x': - debug = atoi(s+1); - break; -#endif - default: - fprintf(stderr, "patch: unrecognized option `%s'\n", Argv[0]); - fprintf(stderr, "\ -Usage: patch [options] [origfile [patchfile]] [+ [options] [origfile]]...\n\ -Options:\n\ - [-ceEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n\ - [-D symbol] [-Fmax-fuzz] [-o out-file] [-p[strip-count]]\n\ - [-r rej-name] [-V {numbered,existing,simple}]\n"); - my_exit(1); - } - } - } -} - -/* Attempt to find the right place to apply this hunk of patch. */ - -LINENUM -locate_hunk(fuzz) -LINENUM fuzz; -{ - Reg1 LINENUM first_guess = pch_first() + last_offset; - Reg2 LINENUM offset; - LINENUM pat_lines = pch_ptrn_lines(); - Reg3 LINENUM max_pos_offset = input_lines - first_guess - - pat_lines + 1; - Reg4 LINENUM max_neg_offset = first_guess - last_frozen_line - 1 - + pch_context(); - - if (!pat_lines) /* null range matches always */ - return first_guess; - if (max_neg_offset >= first_guess) /* do not try lines < 0 */ - max_neg_offset = first_guess - 1; - if (first_guess <= input_lines && patch_match(first_guess, Nulline, fuzz)) - return first_guess; - for (offset = 1; ; offset++) { - Reg5 bool check_after = (offset <= max_pos_offset); - Reg6 bool check_before = (offset <= max_neg_offset); - - if (check_after && patch_match(first_guess, offset, fuzz)) { -#ifdef DEBUGGING - if (debug & 1) - say3("Offset changing from %ld to %ld\n", last_offset, offset); -#endif - last_offset = offset; - return first_guess+offset; - } - else if (check_before && patch_match(first_guess, -offset, fuzz)) { -#ifdef DEBUGGING - if (debug & 1) - say3("Offset changing from %ld to %ld\n", last_offset, -offset); -#endif - last_offset = -offset; - return first_guess-offset; - } - else if (!check_before && !check_after) - return Nulline; - } -} - -/* We did not find the pattern, dump out the hunk so they can handle it. */ - -void -abort_hunk() -{ - Reg1 LINENUM i; - Reg2 LINENUM pat_end = pch_end(); - /* add in last_offset to guess the same as the previous successful hunk */ - LINENUM oldfirst = pch_first() + last_offset; - LINENUM newfirst = pch_newfirst() + last_offset; - LINENUM oldlast = oldfirst + pch_ptrn_lines() - 1; - LINENUM newlast = newfirst + pch_repl_lines() - 1; - char *stars = (diff_type >= NEW_CONTEXT_DIFF ? " ****" : ""); - char *minuses = (diff_type >= NEW_CONTEXT_DIFF ? " ----" : " -----"); - - fprintf(rejfp, "***************\n"); - for (i=0; i<=pat_end; i++) { - switch (pch_char(i)) { - case '*': - if (oldlast < oldfirst) - fprintf(rejfp, "*** 0%s\n", stars); - else if (oldlast == oldfirst) - fprintf(rejfp, "*** %ld%s\n", oldfirst, stars); - else - fprintf(rejfp, "*** %ld,%ld%s\n", oldfirst, oldlast, stars); - break; - case '=': - if (newlast < newfirst) - fprintf(rejfp, "--- 0%s\n", minuses); - else if (newlast == newfirst) - fprintf(rejfp, "--- %ld%s\n", newfirst, minuses); - else - fprintf(rejfp, "--- %ld,%ld%s\n", newfirst, newlast, minuses); - break; - case '\n': - fprintf(rejfp, "%s", pfetch(i)); - break; - case ' ': case '-': case '+': case '!': - fprintf(rejfp, "%c %s", pch_char(i), pfetch(i)); - break; - default: - fatal1("fatal internal error in abort_hunk\n"); - } - } -} - -/* We found where to apply it (we hope), so do it. */ - -void -apply_hunk(where) -LINENUM where; -{ - Reg1 LINENUM old = 1; - Reg2 LINENUM lastline = pch_ptrn_lines(); - Reg3 LINENUM new = lastline+1; -#define OUTSIDE 0 -#define IN_IFNDEF 1 -#define IN_IFDEF 2 -#define IN_ELSE 3 - Reg4 int def_state = OUTSIDE; - Reg5 bool R_do_defines = do_defines; - Reg6 LINENUM pat_end = pch_end(); - - where--; - while (pch_char(new) == '=' || pch_char(new) == '\n') - new++; - - while (old <= lastline) { - if (pch_char(old) == '-') { - copy_till(where + old - 1); - if (R_do_defines) { - if (def_state == OUTSIDE) { - fputs(not_defined, ofp); - def_state = IN_IFNDEF; - } - else if (def_state == IN_IFDEF) { - fputs(else_defined, ofp); - def_state = IN_ELSE; - } - fputs(pfetch(old), ofp); - } - last_frozen_line++; - old++; - } - else if (new > pat_end) { - break; - } - else if (pch_char(new) == '+') { - copy_till(where + old - 1); - if (R_do_defines) { - if (def_state == IN_IFNDEF) { - fputs(else_defined, ofp); - def_state = IN_ELSE; - } - else if (def_state == OUTSIDE) { - fputs(if_defined, ofp); - def_state = IN_IFDEF; - } - } - fputs(pfetch(new), ofp); - new++; - } - else if (pch_char(new) != pch_char(old)) { - say3("Out-of-sync patch, lines %ld,%ld--mangled text or line numbers, maybe?\n", - pch_hunk_beg() + old, - pch_hunk_beg() + new); -#ifdef DEBUGGING - say3("oldchar = '%c', newchar = '%c'\n", - pch_char(old), pch_char(new)); -#endif - my_exit(1); - } - else if (pch_char(new) == '!') { - copy_till(where + old - 1); - if (R_do_defines) { - fputs(not_defined, ofp); - def_state = IN_IFNDEF; - } - while (pch_char(old) == '!') { - if (R_do_defines) { - fputs(pfetch(old), ofp); - } - last_frozen_line++; - old++; - } - if (R_do_defines) { - fputs(else_defined, ofp); - def_state = IN_ELSE; - } - while (pch_char(new) == '!') { - fputs(pfetch(new), ofp); - new++; - } - } - else { - assert(pch_char(new) == ' '); - old++; - new++; - if (R_do_defines && def_state != OUTSIDE) { - fputs(end_defined, ofp); - def_state = OUTSIDE; - } - } - } - if (new <= pat_end && pch_char(new) == '+') { - copy_till(where + old - 1); - if (R_do_defines) { - if (def_state == OUTSIDE) { - fputs(if_defined, ofp); - def_state = IN_IFDEF; - } - else if (def_state == IN_IFNDEF) { - fputs(else_defined, ofp); - def_state = IN_ELSE; - } - } - while (new <= pat_end && pch_char(new) == '+') { - fputs(pfetch(new), ofp); - new++; - } - } - if (R_do_defines && def_state != OUTSIDE) { - fputs(end_defined, ofp); - } -} - -/* Open the new file. */ - -void -init_output(name) -char *name; -{ -#ifndef WIN32 - ofp = fopen(name, "w"); -#else - ofp = fopen(name, "wb"); -#endif - if (ofp == Nullfp) - pfatal2("can't create %s", name); -} - -/* Open a file to put hunks we can't locate. */ - -void -init_reject(name) -char *name; -{ -#ifndef WIN32 - rejfp = fopen(name, "w"); -#else - rejfp = fopen(name, "wb"); -#endif - if (rejfp == Nullfp) - pfatal2("can't create %s", name); -} - -/* Copy input file to output, up to wherever hunk is to be applied. */ - -void -copy_till(lastline) -Reg1 LINENUM lastline; -{ - Reg2 LINENUM R_last_frozen_line = last_frozen_line; - - if (R_last_frozen_line > lastline) - fatal1("misordered hunks! output would be garbled\n"); - while (R_last_frozen_line < lastline) { - dump_line(++R_last_frozen_line); - } - last_frozen_line = R_last_frozen_line; -} - -/* Finish copying the input file to the output file. */ - -void -spew_output() -{ -#ifdef DEBUGGING - if (debug & 256) - say3("il=%ld lfl=%ld\n",input_lines,last_frozen_line); -#endif - if (input_lines) - copy_till(input_lines); /* dump remainder of file */ - Fclose(ofp); - ofp = Nullfp; -} - -/* Copy one line from input to output. */ - -void -dump_line(line) -LINENUM line; -{ - Reg1 char *s; - Reg2 char R_newline = '\n'; - - /* Note: string is not null terminated. */ - for (s=ifetch(line, 0); putc(*s, ofp) != R_newline; s++) ; -} - -/* Does the patch pattern match at line base+offset? */ - -bool -patch_match(base, offset, fuzz) -LINENUM base; -LINENUM offset; -LINENUM fuzz; -{ - Reg1 LINENUM pline = 1 + fuzz; - Reg2 LINENUM iline; - Reg3 LINENUM pat_lines = pch_ptrn_lines() - fuzz; - - for (iline=base+offset+fuzz; pline <= pat_lines; pline++,iline++) { - if (canonicalize) { - if (!similar(ifetch(iline, (offset >= 0)), - pfetch(pline), - pch_line_len(pline) )) - return FALSE; - } - else if (strnNE(ifetch(iline, (offset >= 0)), - pfetch(pline), - pch_line_len(pline) )) - return FALSE; - } - return TRUE; -} - -/* Do two lines match with canonicalized white space? */ - -bool -similar(a,b,len) -Reg1 char *a; -Reg2 char *b; -Reg3 int len; -{ - while (len) { - if (isspace(*b)) { /* whitespace (or \n) to match? */ - if (!isspace(*a)) /* no corresponding whitespace? */ - return FALSE; - while (len && isspace(*b) && *b != '\n') - b++,len--; /* skip pattern whitespace */ - while (isspace(*a) && *a != '\n') - a++; /* skip target whitespace */ - if (*a == '\n' || *b == '\n') - return (*a == *b); /* should end in sync */ - } - else if (*a++ != *b++) /* match non-whitespace chars */ - return FALSE; - else - len--; /* probably not necessary */ - } - return TRUE; /* actually, this is not reached */ - /* since there is always a \n */ -} - -/* Exit with cleanup. */ - -void -my_exit(status) -int status; -{ - Unlink(TMPINNAME); - if (!toutkeep) { - Unlink(TMPOUTNAME); - } - if (!trejkeep) { - Unlink(TMPREJNAME); - } - Unlink(TMPPATNAME); - exit(status); -} diff --git a/xc/util/patch/patch.man b/xc/util/patch/patch.man deleted file mode 100644 index 653647b25..000000000 --- a/xc/util/patch/patch.man +++ /dev/null @@ -1,551 +0,0 @@ -.\" -*- nroff -*- -.rn '' }` -'\" $XConsortium: patch.man,v 1.2 94/09/09 20:04:28 gildea Exp $ -'\" -'\" Revision 2.0.1.2 88/06/22 20:47:18 lwall -'\" patch12: now avoids Bell System Logo -'\" -'\" Revision 2.0.1.1 88/06/03 15:12:51 lwall -'\" patch10: -B switch was contributed. -'\" -'\" Revision 2.0 86/09/17 15:39:09 lwall -'\" Baseline for netwide release. -'\" -'\" Revision 1.4 86/08/01 19:23:22 lwall -'\" Documented -v, -p, -F. -'\" Added notes to patch senders. -'\" -'\" Revision 1.3 85/03/26 15:11:06 lwall -'\" Frozen. -'\" -'\" Revision 1.2.1.4 85/03/12 16:14:27 lwall -'\" Documented -p. -'\" -'\" Revision 1.2.1.3 85/03/12 16:09:41 lwall -'\" Documented -D. -'\" -'\" Revision 1.2.1.2 84/12/05 11:06:55 lwall -'\" Added -l switch, and noted bistability bug. -'\" -'\" Revision 1.2.1.1 84/12/04 17:23:39 lwall -'\" Branch for sdcrdcf changes. -'\" -'\" Revision 1.2 84/12/04 17:22:02 lwall -'\" Baseline version. -'\" -.de Sh -.br -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp -.if t .sp .5v -.if n .sp -.. -'\" -'\" Set up \*(-- to give an unbreakable dash; -'\" string Tr holds user defined translation string. -'\" Bell System Logo is used as a dummy character. -'\" -'\" Shut up a groff -ww warning. -.if \n(.g .if !dTr .ds Tr -.ie n \{\ -.tr \(*W-\*(Tr -.ds -- \(*W- -.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -.ds L" "" -.ds R" "" -.ds L' ' -.ds R' ' -'br \} -.el \{\ -.ds -- \(em\| -.tr \*(Tr -.ds L" `` -.ds R" '' -.ds L' ` -.ds R' ' -'br\} -.TH PATCH 1 LOCAL -.SH NAME -patch - apply a diff file to an original -.SH SYNOPSIS -.B patch -[options] [origfile [patchfile]] [+ [options] [origfile]]... -.sp -but usually just -.sp -.B patch -<patchfile -.SH DESCRIPTION -.I Patch -will take a patch file containing any of the four forms of difference -listing produced by the -.I diff -program and apply those differences to an original file, producing a patched -version. -By default, the patched version is put in place of the original, with -the original file backed up to the same name with the -extension \*(L".orig\*(R" (\*(L"~\*(R" on systems that do not -support long filenames), or as specified by the -.BR -b , -.BR -B , -or -.B -V -switches. -The extension used for making backup files may also be specified in the -.B SIMPLE_BACKUP_SUFFIX -environment variable, which is overridden by above switches. -.PP -If the backup file already exists, -.B patch -creates a new backup file name by changing the first lowercase letter -in the last component of the file's name into uppercase. If there are -no more lowercase letters in the name, it removes the first character -from the name. It repeats this process until it comes up with a -backup file that does not already exist. -.PP -You may also specify where you want the output to go with a -.B -o -switch; if that file already exists, it is backed up first. -.PP -If -.I patchfile -is omitted, or is a hyphen, the patch will be read from standard input. -.PP -Upon startup, patch will attempt to determine the type of the diff listing, -unless over-ruled by a -.BR -c , -.BR -e , -.BR -n , -or -.B -u -switch. -Context diffs (old-style, new-style, and unified) and -normal diffs are applied by the -.I patch -program itself, while ed diffs are simply fed to the -.I ed -editor via a pipe. -.PP -.I Patch -will try to skip any leading garbage, apply the diff, -and then skip any trailing garbage. -Thus you could feed an article or message containing a -diff listing to -.IR patch , -and it should work. -If the entire diff is indented by a consistent amount, -this will be taken into account. -.PP -With context diffs, and to a lesser extent with normal diffs, -.I patch -can detect when the line numbers mentioned in the patch are incorrect, -and will attempt to find the correct place to apply each hunk of the patch. -As a first guess, it takes the line number mentioned for the hunk, plus or -minus any offset used in applying the previous hunk. -If that is not the correct place, -.I patch -will scan both forwards and backwards for a set of lines matching the context -given in the hunk. -First -.I patch -looks for a place where all lines of the context match. -If no such place is found, and it's a context diff, and the maximum fuzz factor -is set to 1 or more, then another scan takes place ignoring the first and last -line of context. -If that fails, and the maximum fuzz factor is set to 2 or more, -the first two and last two lines of context are ignored, -and another scan is made. -(The default maximum fuzz factor is 2.) -If -.I patch -cannot find a place to install that hunk of the patch, it will put the -hunk out to a reject file, which normally is the name of the output file -plus \*(L".rej\*(R" (\*(L"#\*(R" on systems that do not support -long filenames). -(Note that the rejected hunk will come out in context diff form whether the -input patch was a context diff or a normal diff. -If the input was a normal diff, many of the contexts will simply be null.) -The line numbers on the hunks in the reject file may be different than -in the patch file: they reflect the approximate location patch thinks the -failed hunks belong in the new file rather than the old one. -.PP -As each hunk is completed, you will be told whether the hunk succeeded or -failed, and which line (in the new file) -.I patch -thought the hunk should go on. -If this is different from the line number specified in the diff you will -be told the offset. -A single large offset MAY be an indication that a hunk was installed in the -wrong place. -You will also be told if a fuzz factor was used to make the match, in which -case you should also be slightly suspicious. -.PP -If no original file is specified on the command line, -.I patch -will try to figure out from the leading garbage what the name of the file -to edit is. -In the header of a context diff, the filename is found from lines beginning -with \*(L"***\*(R" or \*(L"---\*(R", with the shortest name of an existing -file winning. -Only context diffs have lines like that, but if there is an \*(L"Index:\*(R" -line in the leading garbage, -.I patch -will try to use the filename from that line. -The context diff header takes precedence over an Index line. -If no filename can be intuited from the leading garbage, you will be asked -for the name of the file to patch. -.PP -If the original file cannot be found or is read-only, but a suitable -SCCS or RCS file is handy, -.I patch -will attempt to get or check out the file. -.PP -Additionally, if the leading garbage contains a \*(L"Prereq: \*(R" line, -.I patch -will take the first word from the prerequisites line (normally a version -number) and check the input file to see if that word can be found. -If not, -.I patch -will ask for confirmation before proceeding. -.PP -The upshot of all this is that you should be able to say, while in a news -interface, the following: -.Sp - | patch -d /usr/src/local/blurfl -.Sp -and patch a file in the blurfl directory directly from the article containing -the patch. -.PP -If the patch file contains more than one patch, -.I patch -will try to apply each of them as if they came from separate patch files. -This means, among other things, that it is assumed that the name of the file -to patch must be determined for each diff listing, -and that the garbage before each diff listing will -be examined for interesting things such as filenames and revision level, as -mentioned previously. -You can give switches (and another original file name) for the second and -subsequent patches by separating the corresponding argument lists -by a \*(L'+\*(R'. -(The argument list for a second or subsequent patch may not specify a new -patch file, however.) -.PP -.I Patch -recognizes the following switches: -.TP 5 -.B \-b -causes the next argument to be interpreted as the backup extension, to be -used in place of \*(L".orig\*(R" or \*(L"~\*(R". -.TP 5 -.B \-B -causes the next argument to be interpreted as a prefix to the backup file -name. If this argument is specified any argument from -b will be ignored. -.TP 5 -.B \-c -forces -.I patch -to interpret the patch file as a context diff. -.TP 5 -.B \-d -causes -.I patch -to interpret the next argument as a directory, and cd to it before doing -anything else. -.TP 5 -.B \-D -causes -.I patch -to use the "#ifdef...#endif" construct to mark changes. -The argument following will be used as the differentiating symbol. -Note that, unlike the C compiler, there must be a space between the -.B \-D -and the argument. -.TP 5 -.B \-e -forces -.I patch -to interpret the patch file as an ed script. -.TP 5 -.B \-E -causes -.I patch -to remove output files that are empty after the patches have been applied. -.TP 5 -.B \-f -forces -.I patch -to assume that the user knows exactly what he or she is doing, and to not -ask any questions. It assumes the following: skip patches for which a -file to patch can't be found; patch files even though they have the -wrong version for the ``Prereq:'' line in the patch; and assume that -patches are not reversed even if they look like they are. -This option does not suppress commentary; use -.B \-s -for that. -.TP 5 -.B \-t -similar to -.BR \-f , -in that it suppresses questions, but makes some different assumptions: -skip patches for which a file to patch can't be found (the same as \fB\-f\fP); -skip patches for which the file has the wrong version for the ``Prereq:'' line -in the patch; and assume that patches are reversed if they look like -they are. -.TP 5 -.B \-F<number> -sets the maximum fuzz factor. -This switch only applies to context diffs, and causes -.I patch -to ignore up to that many lines in looking for places to install a hunk. -Note that a larger fuzz factor increases the odds of a faulty patch. -The default fuzz factor is 2, and it may not be set to more than -the number of lines of context in the context diff, ordinarily 3. -.TP 5 -.B \-l -causes the pattern matching to be done loosely, in case the tabs and -spaces have been munged in your input file. -Any sequence of whitespace in the pattern line will match any sequence -in the input file. -Normal characters must still match exactly. -Each line of the context must still match a line in the input file. -.TP 5 -.B \-n -forces -.I patch -to interpret the patch file as a normal diff. -.TP 5 -.B \-N -causes -.I patch -to ignore patches that it thinks are reversed or already applied. -See also -.B \-R . -.TP 5 -.B \-o -causes the next argument to be interpreted as the output file name. -.TP 5 -.B \-p<number> -sets the pathname strip count, -which controls how pathnames found in the patch file are treated, in case -the you keep your files in a different directory than the person who sent -out the patch. -The strip count specifies how many slashes are to be stripped from -the front of the pathname. -(Any intervening directory names also go away.) -For example, supposing the filename in the patch file was -.sp - /u/howard/src/blurfl/blurfl.c -.sp -setting -.B \-p -or -.B \-p0 -gives the entire pathname unmodified, -.B \-p1 -gives -.sp - u/howard/src/blurfl/blurfl.c -.sp -without the leading slash, -.B \-p4 -gives -.sp - blurfl/blurfl.c -.sp -and not specifying -.B \-p -at all just gives you "blurfl.c", unless all of the directories in the -leading path (u/howard/src/blurfl) exist and that path is relative, -in which case you get the entire pathname unmodified. -Whatever you end up with is looked for either in the current directory, -or the directory specified by the -.B \-d -switch. -.TP 5 -.B \-r -causes the next argument to be interpreted as the reject file name. -.TP 5 -.B \-R -tells -.I patch -that this patch was created with the old and new files swapped. -(Yes, I'm afraid that does happen occasionally, human nature being what it -is.) -.I Patch -will attempt to swap each hunk around before applying it. -Rejects will come out in the swapped format. -The -.B \-R -switch will not work with ed diff scripts because there is too little -information to reconstruct the reverse operation. -.Sp -If the first hunk of a patch fails, -.I patch -will reverse the hunk to see if it can be applied that way. -If it can, you will be asked if you want to have the -.B \-R -switch set. -If it can't, the patch will continue to be applied normally. -(Note: this method cannot detect a reversed patch if it is a normal diff -and if the first command is an append (i.e. it should have been a delete) -since appends always succeed, due to the fact that a null context will match -anywhere. -Luckily, most patches add or change lines rather than delete them, so most -reversed normal diffs will begin with a delete, which will fail, triggering -the heuristic.) -.TP 5 -.B \-s -makes -.I patch -do its work silently, unless an error occurs. -.TP 5 -.B \-S -causes -.I patch -to ignore this patch from the patch file, but continue on looking -for the next patch in the file. -Thus -.sp - patch -S + -S + <patchfile -.sp -will ignore the first and second of three patches. -.TP 5 -.B \-u -forces -.I patch -to interpret the patch file as a unified context diff (a unidiff). -.TP 5 -.B \-v -causes -.I patch -to print out its revision header and patch level. -.TP 5 -.B \-V -causes the next argument to be interpreted as a method for creating -backup file names. The type of backups made can also be given in the -.B VERSION_CONTROL -environment variable, which is overridden by this option. -The -.B -B -option overrides this option, causing the prefix to always be used for -making backup file names. -The value of the -.B VERSION_CONTROL -environment variable and the argument to the -.B -V -option are like the GNU -Emacs `version-control' variable; they also recognize synonyms that -are more descriptive. The valid values are (unique abbreviations are -accepted): -.RS -.TP -`t' or `numbered' -Always make numbered backups. -.TP -`nil' or `existing' -Make numbered backups of files that already -have them, simple backups of the others. -This is the default. -.TP -`never' or `simple' -Always make simple backups. -.RE -.TP 5 -.B \-x<number> -sets internal debugging flags, and is of interest only to -.I patch -patchers. -.SH AUTHOR -Larry Wall <lwall@netlabs.com> -.br -with many other contributors. -.SH ENVIRONMENT -.TP -.B TMPDIR -Directory to put temporary files in; default is /tmp. -.TP -.B SIMPLE_BACKUP_SUFFIX -Extension to use for backup file names instead of \*(L".orig\*(R" or -\*(L"~\*(R". -.TP -.B VERSION_CONTROL -Selects when numbered backup files are made. -.SH FILES -$TMPDIR/patch* -.SH SEE ALSO -diff(1) -.SH NOTES FOR PATCH SENDERS -There are several things you should bear in mind if you are going to -be sending out patches. -First, you can save people a lot of grief by keeping a patchlevel.h file -which is patched to increment the patch level as the first diff in the -patch file you send out. -If you put a Prereq: line in with the patch, it won't let them apply -patches out of order without some warning. -Second, make sure you've specified the filenames right, either in a -context diff header, or with an Index: line. -If you are patching something in a subdirectory, be sure to tell the patch -user to specify a -.B \-p -switch as needed. -Third, you can create a file by sending out a diff that compares a -null file to the file you want to create. -This will only work if the file you want to create doesn't exist already in -the target directory. -Fourth, take care not to send out reversed patches, since it makes people wonder -whether they already applied the patch. -Fifth, while you may be able to get away with putting 582 diff listings into -one file, it is probably wiser to group related patches into separate files in -case something goes haywire. -.SH DIAGNOSTICS -Too many to list here, but generally indicative that -.I patch -couldn't parse your patch file. -.PP -The message \*(L"Hmm...\*(R" indicates that there is unprocessed text in -the patch file and that -.I patch -is attempting to intuit whether there is a patch in that text and, if so, -what kind of patch it is. -.PP -.I Patch -will exit with a non-zero status if any reject files were created. -When applying a set of patches in a loop it behooves you to check this -exit status so you don't apply a later patch to a partially patched file. -.SH CAVEATS -.I Patch -cannot tell if the line numbers are off in an ed script, and can only detect -bad line numbers in a normal diff when it finds a \*(L"change\*(R" or -a \*(L"delete\*(R" command. -A context diff using fuzz factor 3 may have the same problem. -Until a suitable interactive interface is added, you should probably do -a context diff in these cases to see if the changes made sense. -Of course, compiling without errors is a pretty good indication that the patch -worked, but not always. -.PP -.I Patch -usually produces the correct results, even when it has to do a lot of -guessing. -However, the results are guaranteed to be correct only when the patch is -applied to exactly the same version of the file that the patch was -generated from. -.SH BUGS -Could be smarter about partial matches, excessively \&deviant offsets and -swapped code, but that would take an extra pass. -.PP -If code has been duplicated (for instance with #ifdef OLDCODE ... #else ... -#endif), -.I patch -is incapable of patching both versions, and, if it works at all, will likely -patch the wrong one, and tell you that it succeeded to boot. -.PP -If you apply a patch you've already applied, -.I patch -will think it is a reversed patch, and offer to un-apply the patch. -This could be construed as a feature. -.rn }` '' diff --git a/xc/util/patch/patchlevel.h b/xc/util/patch/patchlevel.h deleted file mode 100644 index c1169f19a..000000000 --- a/xc/util/patch/patchlevel.h +++ /dev/null @@ -1,2 +0,0 @@ -/* $XConsortium: patchlevel.h,v 3.2 94/09/14 21:31:55 gildea Exp $ */ -#define PATCHLEVEL "12u9.XC2" diff --git a/xc/util/patch/pch.c b/xc/util/patch/pch.c deleted file mode 100644 index 5bb7fd141..000000000 --- a/xc/util/patch/pch.c +++ /dev/null @@ -1,1313 +0,0 @@ -/* oldHeader: pch.c,v 2.0.1.7 88/06/03 15:13:28 lwall Locked $ - * $XConsortium: pch.c,v 3.3 94/09/14 21:22:55 gildea Exp $ - * - * Revision 2.0.2.0 90/05/01 22:17:51 davison - * patch12u: unidiff support added - * - * Revision 2.0.1.7 88/06/03 15:13:28 lwall - * patch10: Can now find patches in shar scripts. - * patch10: Hunks that swapped and then swapped back could core dump. - * - * Revision 2.0.1.6 87/06/04 16:18:13 lwall - * pch_swap didn't swap p_bfake and p_efake. - * - * Revision 2.0.1.5 87/01/30 22:47:42 lwall - * Improved responses to mangled patches. - * - * Revision 2.0.1.4 87/01/05 16:59:53 lwall - * New-style context diffs caused double call to free(). - * - * Revision 2.0.1.3 86/11/14 10:08:33 lwall - * Fixed problem where a long pattern wouldn't grow the hunk. - * Also restored p_input_line when backtracking so error messages are right. - * - * Revision 2.0.1.2 86/11/03 17:49:52 lwall - * New-style delete triggers spurious assertion error. - * - * Revision 2.0.1.1 86/10/29 15:52:08 lwall - * Could falsely report new-style context diff. - * - * Revision 2.0 86/09/17 15:39:37 lwall - * Baseline for netwide release. - * - */ - -#include "EXTERN.h" -#include "common.h" -#include "util.h" -#include "INTERN.h" -#include "pch.h" - -/* Patch (diff listing) abstract type. */ - -static long p_filesize; /* size of the patch file */ -static LINENUM p_first; /* 1st line number */ -static LINENUM p_newfirst; /* 1st line number of replacement */ -static LINENUM p_ptrn_lines; /* # lines in pattern */ -static LINENUM p_repl_lines; /* # lines in replacement text */ -static LINENUM p_end = -1; /* last line in hunk */ -static LINENUM p_max; /* max allowed value of p_end */ -static LINENUM p_context = 3; /* # of context lines */ -static LINENUM p_input_line = 0; /* current line # from patch file */ -static char **p_line = Null(char**); /* the text of the hunk */ -static short *p_len = Null(short*); /* length of each line */ -static char *p_char = Nullch; /* +, -, and ! */ -static int hunkmax = INITHUNKMAX; /* size of above arrays to begin with */ -static int p_indent; /* indent to patch */ -static LINENUM p_base; /* where to intuit this time */ -static LINENUM p_bline; /* line # of p_base */ -static LINENUM p_start; /* where intuit found a patch */ -static LINENUM p_sline; /* and the line number for it */ -static LINENUM p_hunk_beg; /* line number of current hunk */ -static LINENUM p_efake = -1; /* end of faked up lines--don't free */ -static LINENUM p_bfake = -1; /* beg of faked up lines */ - -/* Prepare to look for the next patch in the patch file. */ - -void -re_patch() -{ - p_first = Nulline; - p_newfirst = Nulline; - p_ptrn_lines = Nulline; - p_repl_lines = Nulline; - p_end = (LINENUM)-1; - p_max = Nulline; - p_indent = 0; -} - -/* Open the patch file at the beginning of time. */ - -void -open_patch_file(filename) -char *filename; -{ - if (filename == Nullch || !*filename || strEQ(filename, "-")) { - pfp = fopen(TMPPATNAME, "w"); - if (pfp == Nullfp) - pfatal2("can't create %s", TMPPATNAME); - while (fgets(buf, sizeof buf, stdin) != Nullch) - fputs(buf, pfp); - Fclose(pfp); - filename = TMPPATNAME; - } - pfp = fopen(filename, "r"); - if (pfp == Nullfp) - pfatal2("patch file %s not found", filename); - Fstat(fileno(pfp), &filestat); - p_filesize = filestat.st_size; - next_intuit_at(0L,1L); /* start at the beginning */ - set_hunkmax(); -} - -/* Make sure our dynamically realloced tables are malloced to begin with. */ - -void -set_hunkmax() -{ -#ifndef lint - if (p_line == Null(char**)) - p_line = (char**) malloc((MEM)hunkmax * sizeof(char *)); - if (p_len == Null(short*)) - p_len = (short*) malloc((MEM)hunkmax * sizeof(short)); -#endif - if (p_char == Nullch) - p_char = (char*) malloc((MEM)hunkmax * sizeof(char)); -} - -/* Enlarge the arrays containing the current hunk of patch. */ - -void -grow_hunkmax() -{ - hunkmax *= 2; - /* - * Note that on most systems, only the p_line array ever gets fresh memory - * since p_len can move into p_line's old space, and p_char can move into - * p_len's old space. Not on PDP-11's however. But it doesn't matter. - */ - assert(p_line != Null(char**) && p_len != Null(short*) && p_char != Nullch); -#ifndef lint - p_line = (char**) realloc((char*)p_line, (MEM)hunkmax * sizeof(char *)); - p_len = (short*) realloc((char*)p_len, (MEM)hunkmax * sizeof(short)); - p_char = (char*) realloc((char*)p_char, (MEM)hunkmax * sizeof(char)); -#endif - if (p_line != Null(char**) && p_len != Null(short*) && p_char != Nullch) - return; - if (!using_plan_a) - fatal1("out of memory\n"); - out_of_mem = TRUE; /* whatever is null will be allocated again */ - /* from within plan_a(), of all places */ -} - -/* True if the remainder of the patch file contains a diff of some sort. */ - -bool -there_is_another_patch() -{ - if (p_base != 0L && p_base >= p_filesize) { - if (verbose) - say1("done\n"); - return FALSE; - } - if (verbose) - say1("Hmm..."); - diff_type = intuit_diff_type(); - if (!diff_type) { - if (p_base != 0L) { - if (verbose) - say1(" Ignoring the trailing garbage.\ndone\n"); - } - else - say1(" I can't seem to find a patch in there anywhere.\n"); - return FALSE; - } - if (verbose) - say3(" %sooks like %s to me...\n", - (p_base == 0L ? "L" : "The next patch l"), - diff_type == UNI_DIFF ? "a unified diff" : - diff_type == CONTEXT_DIFF ? "a context diff" : - diff_type == NEW_CONTEXT_DIFF ? "a new-style context diff" : - diff_type == NORMAL_DIFF ? "a normal diff" : - "an ed script" ); - if (p_indent && verbose) - say3("(Patch is indented %d space%s.)\n", p_indent, p_indent==1?"":"s"); - skip_to(p_start,p_sline); - while (filearg[0] == Nullch) { - if (force || batch) { - say1("No file to patch. Skipping...\n"); - filearg[0] = savestr(bestguess); - skip_rest_of_patch = TRUE; - return TRUE; - } - ask1("File to patch: "); - if (*buf != '\n') { - if (bestguess) - free(bestguess); - bestguess = savestr(buf); - filearg[0] = fetchname(buf, 0, FALSE); - } - if (filearg[0] == Nullch) { -#ifndef WIN32 - ask1("No file found--skip this patch? [n] "); - if (*buf != 'y') { - continue; - } - if (verbose) - say1("Skipping patch...\n"); -#else - if (verbose) - say1("File not found--skipping patch...\n"); -#endif - filearg[0] = fetchname(bestguess, 0, TRUE); - skip_rest_of_patch = TRUE; - return TRUE; - } - } - return TRUE; -} - -/* Determine what kind of diff is in the remaining part of the patch file. */ - -int -intuit_diff_type() -{ - Reg4 long this_line = 0; - Reg5 long previous_line; - Reg6 long first_command_line = -1; - long fcl_line; - Reg7 bool last_line_was_command = FALSE; - Reg8 bool this_is_a_command = FALSE; - Reg9 bool stars_last_line = FALSE; - Reg10 bool stars_this_line = FALSE; - Reg3 int indent; - Reg1 char *s; - Reg2 char *t; - char *indtmp = Nullch; - char *oldtmp = Nullch; - char *newtmp = Nullch; - char *indname = Nullch; - char *oldname = Nullch; - char *newname = Nullch; - Reg11 int retval; - bool no_filearg = (filearg[0] == Nullch); - - ok_to_create_file = FALSE; - Fseek(pfp, p_base, 0); - p_input_line = p_bline - 1; - for (;;) { - previous_line = this_line; - last_line_was_command = this_is_a_command; - stars_last_line = stars_this_line; - this_line = ftell(pfp); - indent = 0; - p_input_line++; - if (fgets(buf, sizeof buf, pfp) == Nullch) { - if (first_command_line >= 0L) { - /* nothing but deletes!? */ - p_start = first_command_line; - p_sline = fcl_line; - retval = ED_DIFF; - goto scan_exit; - } - else { - p_start = this_line; - p_sline = p_input_line; - retval = 0; - goto scan_exit; - } - } - for (s = buf; *s == ' ' || *s == '\t' || *s == 'X'; s++) { - if (*s == '\t') - indent += 8 - (indent % 8); - else - indent++; - } - for (t=s; isdigit(*t) || *t == ','; t++) ; - this_is_a_command = (isdigit(*s) && - (*t == 'd' || *t == 'c' || *t == 'a') ); - if (first_command_line < 0L && this_is_a_command) { - first_command_line = this_line; - fcl_line = p_input_line; - p_indent = indent; /* assume this for now */ - } - if (!stars_last_line && strnEQ(s, "*** ", 4)) - oldtmp = savestr(s+4); - else if (strnEQ(s, "--- ", 4)) - newtmp = savestr(s+4); - else if (strnEQ(s, "+++ ", 4)) - oldtmp = savestr(s+4); /* pretend it is the old name */ - else if (strnEQ(s, "Index:", 6)) - indtmp = savestr(s+6); - else if (strnEQ(s, "Prereq:", 7)) { - for (t=s+7; isspace(*t); t++) ; - revision = savestr(t); - for (t=revision; *t && !isspace(*t); t++) ; - *t = '\0'; - if (!*revision) { - free(revision); - revision = Nullch; - } - } - if ((!diff_type || diff_type == ED_DIFF) && - first_command_line >= 0L && - strEQ(s, ".\n") ) { - p_indent = indent; - p_start = first_command_line; - p_sline = fcl_line; - retval = ED_DIFF; - goto scan_exit; - } - if ((!diff_type || diff_type == UNI_DIFF) && strnEQ(s, "@@ -", 4)) { - if (!atol(s+3)) - ok_to_create_file = TRUE; - p_indent = indent; - p_start = this_line; - p_sline = p_input_line; - retval = UNI_DIFF; - goto scan_exit; - } - stars_this_line = strnEQ(s, "********", 8); - if ((!diff_type || diff_type == CONTEXT_DIFF) && stars_last_line && - strnEQ(s, "*** ", 4)) { - if (!atol(s+4)) - ok_to_create_file = TRUE; - /* if this is a new context diff the character just before */ - /* the newline is a '*'. */ - while (*s != '\n') - s++; - p_indent = indent; - p_start = previous_line; - p_sline = p_input_line - 1; - retval = (*(s-1) == '*' ? NEW_CONTEXT_DIFF : CONTEXT_DIFF); - goto scan_exit; - } - if ((!diff_type || diff_type == NORMAL_DIFF) && - last_line_was_command && - (strnEQ(s, "< ", 2) || strnEQ(s, "> ", 2)) ) { - p_start = previous_line; - p_sline = p_input_line - 1; - p_indent = indent; - retval = NORMAL_DIFF; - goto scan_exit; - } - } - scan_exit: - if (no_filearg) { - if (indtmp != Nullch) - indname = fetchname(indtmp, strippath, ok_to_create_file); - if (oldtmp != Nullch) - oldname = fetchname(oldtmp, strippath, ok_to_create_file); - if (newtmp != Nullch) - newname = fetchname(newtmp, strippath, ok_to_create_file); - if (oldname && newname) { - if (strlen(oldname) < strlen(newname)) - filearg[0] = savestr(oldname); - else - filearg[0] = savestr(newname); - } - else if (oldname) - filearg[0] = savestr(oldname); - else if (newname) - filearg[0] = savestr(newname); - else if (indname) - filearg[0] = savestr(indname); - } - if (bestguess) { - free(bestguess); - bestguess = Nullch; - } - if (filearg[0] != Nullch) - bestguess = savestr(filearg[0]); - else if (indtmp != Nullch) - bestguess = fetchname(indtmp, strippath, TRUE); - else { - if (oldtmp != Nullch) - oldname = fetchname(oldtmp, strippath, TRUE); - if (newtmp != Nullch) - newname = fetchname(newtmp, strippath, TRUE); - if (oldname && newname) { - if (strlen(oldname) < strlen(newname)) - bestguess = savestr(oldname); - else - bestguess = savestr(newname); - } - else if (oldname) - bestguess = savestr(oldname); - else if (newname) - bestguess = savestr(newname); - } - if (indtmp != Nullch) - free(indtmp); - if (oldtmp != Nullch) - free(oldtmp); - if (newtmp != Nullch) - free(newtmp); - if (indname != Nullch) - free(indname); - if (oldname != Nullch) - free(oldname); - if (newname != Nullch) - free(newname); - return retval; -} - -/* Remember where this patch ends so we know where to start up again. */ - -void -next_intuit_at(file_pos,file_line) -long file_pos; -long file_line; -{ - p_base = file_pos; - p_bline = file_line; -} - -/* Basically a verbose fseek() to the actual diff listing. */ - -void -skip_to(file_pos,file_line) -long file_pos; -long file_line; -{ - char *ret; - - assert(p_base <= file_pos); - if (verbose && p_base < file_pos) { - Fseek(pfp, p_base, 0); - say1("The text leading up to this was:\n--------------------------\n"); - while (ftell(pfp) < file_pos) { - ret = fgets(buf, sizeof buf, pfp); - assert(ret != Nullch); - say2("|%s", buf); - } - say1("--------------------------\n"); - } - else - Fseek(pfp, file_pos, 0); - p_input_line = file_line - 1; -} - -/* Make this a function for better debugging. */ -static void -malformed () -{ - fatal3("malformed patch at line %ld: %s", p_input_line, buf); - /* about as informative as "Syntax error" in C */ -} - -/* True if there is more of the current diff listing to process. */ - -bool -another_hunk() -{ - Reg1 char *s; - Reg8 char *ret; - Reg2 int context = 0; - - while (p_end >= 0) { - if (p_end == p_efake) - p_end = p_bfake; /* don't free twice */ - else - free(p_line[p_end]); - p_end--; - } - assert(p_end == -1); - p_efake = -1; - - p_max = hunkmax; /* gets reduced when --- found */ - if (diff_type == CONTEXT_DIFF || diff_type == NEW_CONTEXT_DIFF) { - long line_beginning = ftell(pfp); - /* file pos of the current line */ - LINENUM repl_beginning = 0; /* index of --- line */ - Reg4 LINENUM fillcnt = 0; /* #lines of missing ptrn or repl */ - Reg5 LINENUM fillsrc; /* index of first line to copy */ - Reg6 LINENUM filldst; /* index of first missing line */ - bool ptrn_spaces_eaten = FALSE; /* ptrn was slightly misformed */ - Reg9 bool repl_could_be_missing = TRUE; - /* no + or ! lines in this hunk */ - bool repl_missing = FALSE; /* we are now backtracking */ - long repl_backtrack_position = 0; - /* file pos of first repl line */ - LINENUM repl_patch_line; /* input line number for same */ - Reg7 LINENUM ptrn_copiable = 0; - /* # of copiable lines in ptrn */ - - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch || strnNE(buf, "********", 8)) { - next_intuit_at(line_beginning,p_input_line); - return FALSE; - } - p_context = 100; - p_hunk_beg = p_input_line + 1; - while (p_end < p_max) { - line_beginning = ftell(pfp); - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) { - if (p_max - p_end < 4) - Strcpy(buf, " \n"); /* assume blank lines got chopped */ - else { - if (repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - fatal1("unexpected end of file in patch\n"); - } - } - p_end++; - assert(p_end < hunkmax); - p_char[p_end] = *buf; -#ifdef zilog - p_line[(short)p_end] = Nullch; -#else - p_line[p_end] = Nullch; -#endif - switch (*buf) { - case '*': - if (strnEQ(buf, "********", 8)) { - if (repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - else - fatal2("unexpected end of hunk at line %ld\n", - p_input_line); - } - if (p_end != 0) { - if (repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - fatal3("unexpected *** at line %ld: %s", p_input_line, buf); - } - context = 0; - p_line[p_end] = savestr(buf); - if (out_of_mem) { - p_end--; - return FALSE; - } - for (s=buf; *s && !isdigit(*s); s++) ; - if (!*s) - malformed (); - if (strnEQ(s,"0,0",3)) - strcpy(s,s+2); - p_first = (LINENUM) atol(s); - while (isdigit(*s)) s++; - if (*s == ',') { - for (; *s && !isdigit(*s); s++) ; - if (!*s) - malformed (); - p_ptrn_lines = ((LINENUM)atol(s)) - p_first + 1; - } - else if (p_first) - p_ptrn_lines = 1; - else { - p_ptrn_lines = 0; - p_first = 1; - } - p_max = p_ptrn_lines + 6; /* we need this much at least */ - while (p_max >= hunkmax) - grow_hunkmax(); - p_max = hunkmax; - break; - case '-': - if (buf[1] == '-') { - if (repl_beginning || - (p_end != p_ptrn_lines + 1 + (p_char[p_end-1] == '\n'))) - { - if (p_end == 1) { - /* `old' lines were omitted - set up to fill */ - /* them in from 'new' context lines. */ - p_end = p_ptrn_lines + 1; - fillsrc = p_end + 1; - filldst = 1; - fillcnt = p_ptrn_lines; - } - else { - if (repl_beginning) { - if (repl_could_be_missing){ - repl_missing = TRUE; - goto hunk_done; - } - fatal3( -"duplicate \"---\" at line %ld--check line numbers at line %ld\n", - p_input_line, p_hunk_beg + repl_beginning); - } - else { - fatal4( -"%s \"---\" at line %ld--check line numbers at line %ld\n", - (p_end <= p_ptrn_lines - ? "Premature" - : "Overdue" ), - p_input_line, p_hunk_beg); - } - } - } - repl_beginning = p_end; - repl_backtrack_position = ftell(pfp); - repl_patch_line = p_input_line; - p_line[p_end] = savestr(buf); - if (out_of_mem) { - p_end--; - return FALSE; - } - p_char[p_end] = '='; - for (s=buf; *s && !isdigit(*s); s++) ; - if (!*s) - malformed (); - p_newfirst = (LINENUM) atol(s); - while (isdigit(*s)) s++; - if (*s == ',') { - for (; *s && !isdigit(*s); s++) ; - if (!*s) - malformed (); - p_repl_lines = ((LINENUM)atol(s)) - p_newfirst + 1; - } - else if (p_newfirst) - p_repl_lines = 1; - else { - p_repl_lines = 0; - p_newfirst = 1; - } - p_max = p_repl_lines + p_end; - if (p_max > MAXHUNKSIZE) - fatal4("hunk too large (%ld lines) at line %ld: %s", - p_max, p_input_line, buf); - while (p_max >= hunkmax) - grow_hunkmax(); - if (p_repl_lines != ptrn_copiable - && (p_context != 0 || p_repl_lines != 1)) - repl_could_be_missing = FALSE; - break; - } - goto change_line; - case '+': case '!': - repl_could_be_missing = FALSE; - change_line: - if (buf[1] == '\n' && canonicalize) - strcpy(buf+1," \n"); - if (!isspace(buf[1]) && buf[1] != '>' && buf[1] != '<' && - repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - if (context >= 0) { - if (context < p_context) - p_context = context; - context = -1000; - } - p_line[p_end] = savestr(buf+2); - if (out_of_mem) { - p_end--; - return FALSE; - } - break; - case '\t': case '\n': /* assume the 2 spaces got eaten */ - if (repl_beginning && repl_could_be_missing && - (!ptrn_spaces_eaten || diff_type == NEW_CONTEXT_DIFF) ) { - repl_missing = TRUE; - goto hunk_done; - } - p_line[p_end] = savestr(buf); - if (out_of_mem) { - p_end--; - return FALSE; - } - if (p_end != p_ptrn_lines + 1) { - ptrn_spaces_eaten |= (repl_beginning != 0); - context++; - if (!repl_beginning) - ptrn_copiable++; - p_char[p_end] = ' '; - } - break; - case ' ': - if (!isspace(buf[1]) && - repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - context++; - if (!repl_beginning) - ptrn_copiable++; - p_line[p_end] = savestr(buf+2); - if (out_of_mem) { - p_end--; - return FALSE; - } - break; - default: - if (repl_beginning && repl_could_be_missing) { - repl_missing = TRUE; - goto hunk_done; - } - malformed (); - } - /* set up p_len for strncmp() so we don't have to */ - /* assume null termination */ - if (p_line[p_end]) - p_len[p_end] = strlen(p_line[p_end]); - else - p_len[p_end] = 0; - } - - hunk_done: - if (p_end >=0 && !repl_beginning) - fatal2("no --- found in patch at line %ld\n", pch_hunk_beg()); - - if (repl_missing) { - - /* reset state back to just after --- */ - p_input_line = repl_patch_line; - for (p_end--; p_end > repl_beginning; p_end--) - free(p_line[p_end]); - Fseek(pfp, repl_backtrack_position, 0); - - /* redundant 'new' context lines were omitted - set */ - /* up to fill them in from the old file context */ - if (!p_context && p_repl_lines == 1) { - p_repl_lines = 0; - p_max--; - } - fillsrc = 1; - filldst = repl_beginning+1; - fillcnt = p_repl_lines; - p_end = p_max; - } - else if (!p_context && fillcnt == 1) { - /* the first hunk was a null hunk with no context */ - /* and we were expecting one line -- fix it up. */ - while (filldst < p_end) { - p_line[filldst] = p_line[filldst+1]; - p_char[filldst] = p_char[filldst+1]; - p_len[filldst] = p_len[filldst+1]; - filldst++; - } -#if 0 - repl_beginning--; /* this doesn't need to be fixed */ -#endif - p_end--; - p_first++; /* do append rather than insert */ - fillcnt = 0; - p_ptrn_lines = 0; - } - - if (diff_type == CONTEXT_DIFF && - (fillcnt || (p_first > 1 && ptrn_copiable > 2*p_context)) ) { - if (verbose) - say4("%s\n%s\n%s\n", -"(Fascinating--this is really a new-style context diff but without", -"the telltale extra asterisks on the *** line that usually indicate", -"the new style...)"); - diff_type = NEW_CONTEXT_DIFF; - } - - /* if there were omitted context lines, fill them in now */ - if (fillcnt) { - p_bfake = filldst; /* remember where not to free() */ - p_efake = filldst + fillcnt - 1; - while (fillcnt-- > 0) { - while (fillsrc <= p_end && p_char[fillsrc] != ' ') - fillsrc++; - if (fillsrc > p_end) - fatal2("replacement text or line numbers mangled in hunk at line %ld\n", - p_hunk_beg); - p_line[filldst] = p_line[fillsrc]; - p_char[filldst] = p_char[fillsrc]; - p_len[filldst] = p_len[fillsrc]; - fillsrc++; filldst++; - } - while (fillsrc <= p_end && fillsrc != repl_beginning && - p_char[fillsrc] != ' ') - fillsrc++; -#ifdef DEBUGGING - if (debug & 64) - printf("fillsrc %ld, filldst %ld, rb %ld, e+1 %ld\n", - fillsrc,filldst,repl_beginning,p_end+1); -#endif - assert(fillsrc==p_end+1 || fillsrc==repl_beginning); - assert(filldst==p_end+1 || filldst==repl_beginning); - } - } - else if (diff_type == UNI_DIFF) { - long line_beginning = ftell(pfp); - /* file pos of the current line */ - Reg4 LINENUM fillsrc; /* index of old lines */ - Reg5 LINENUM filldst; /* index of new lines */ - char ch; - - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch || strnNE(buf, "@@ -", 4)) { - next_intuit_at(line_beginning,p_input_line); - return FALSE; - } - s = buf+4; - if (!*s) - malformed (); - p_first = (LINENUM) atol(s); - while (isdigit(*s)) s++; - if (*s == ',') { - p_ptrn_lines = (LINENUM) atol(++s); - while (isdigit(*s)) s++; - } else - p_ptrn_lines = 1; - if (*s == ' ') s++; - if (*s != '+' || !*++s) - malformed (); - p_newfirst = (LINENUM) atol(s); - while (isdigit(*s)) s++; - if (*s == ',') { - p_repl_lines = (LINENUM) atol(++s); - while (isdigit(*s)) s++; - } else - p_repl_lines = 1; - if (*s == ' ') s++; - if (*s != '@') - malformed (); - if (!p_ptrn_lines) - p_first++; /* do append rather than insert */ - p_max = p_ptrn_lines + p_repl_lines + 1; - while (p_max >= hunkmax) - grow_hunkmax(); - fillsrc = 1; - filldst = fillsrc + p_ptrn_lines; - p_end = filldst + p_repl_lines; - Sprintf(buf,"*** %ld,%ld ****\n",p_first,p_first + p_ptrn_lines - 1); - p_line[0] = savestr(buf); - if (out_of_mem) { - p_end = -1; - return FALSE; - } - p_char[0] = '*'; - Sprintf(buf,"--- %ld,%ld ----\n",p_newfirst,p_newfirst+p_repl_lines-1); - p_line[filldst] = savestr(buf); - if (out_of_mem) { - p_end = 0; - return FALSE; - } - p_char[filldst++] = '='; - p_context = 100; - context = 0; - p_hunk_beg = p_input_line + 1; - while (fillsrc <= p_ptrn_lines || filldst <= p_end) { - line_beginning = ftell(pfp); - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) { - if (p_max - filldst < 3) - Strcpy(buf, " \n"); /* assume blank lines got chopped */ - else { - fatal1("unexpected end of file in patch\n"); - } - } - if (*buf == '\t' || *buf == '\n') { - ch = ' '; /* assume the space got eaten */ - s = savestr(buf); - } - else { - ch = *buf; - s = savestr(buf+1); - } - if (out_of_mem) { - while (--filldst > p_ptrn_lines) - free(p_line[filldst]); - p_end = fillsrc-1; - return FALSE; - } - switch (ch) { - case '-': - if (fillsrc > p_ptrn_lines) { - free(s); - p_end = filldst-1; - malformed (); - } - p_char[fillsrc] = ch; - p_line[fillsrc] = s; - p_len[fillsrc++] = strlen(s); - break; - case '=': - ch = ' '; - /* FALL THROUGH */ - case ' ': - if (fillsrc > p_ptrn_lines) { - free(s); - while (--filldst > p_ptrn_lines) - free(p_line[filldst]); - p_end = fillsrc-1; - malformed (); - } - context++; - p_char[fillsrc] = ch; - p_line[fillsrc] = s; - p_len[fillsrc++] = strlen(s); - s = savestr(s); - if (out_of_mem) { - while (--filldst > p_ptrn_lines) - free(p_line[filldst]); - p_end = fillsrc-1; - return FALSE; - } - /* FALL THROUGH */ - case '+': - if (filldst > p_end) { - free(s); - while (--filldst > p_ptrn_lines) - free(p_line[filldst]); - p_end = fillsrc-1; - malformed (); - } - p_char[filldst] = ch; - p_line[filldst] = s; - p_len[filldst++] = strlen(s); - break; - default: - p_end = filldst; - malformed (); - } - if (ch != ' ' && context > 0) { - if (context < p_context) - p_context = context; - context = -1000; - } - }/* while */ - } - else { /* normal diff--fake it up */ - char hunk_type; - Reg3 int i; - LINENUM min, max; - long line_beginning = ftell(pfp); - - p_context = 0; - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch || !isdigit(*buf)) { - next_intuit_at(line_beginning,p_input_line); - return FALSE; - } - p_first = (LINENUM)atol(buf); - for (s=buf; isdigit(*s); s++) ; - if (*s == ',') { - p_ptrn_lines = (LINENUM)atol(++s) - p_first + 1; - while (isdigit(*s)) s++; - } - else - p_ptrn_lines = (*s != 'a'); - hunk_type = *s; - if (hunk_type == 'a') - p_first++; /* do append rather than insert */ - min = (LINENUM)atol(++s); - for (; isdigit(*s); s++) ; - if (*s == ',') - max = (LINENUM)atol(++s); - else - max = min; - if (hunk_type == 'd') - min++; - p_end = p_ptrn_lines + 1 + max - min + 1; - if (p_end > MAXHUNKSIZE) - fatal4("hunk too large (%ld lines) at line %ld: %s", - p_end, p_input_line, buf); - while (p_end >= hunkmax) - grow_hunkmax(); - p_newfirst = min; - p_repl_lines = max - min + 1; - Sprintf(buf, "*** %ld,%ld\n", p_first, p_first + p_ptrn_lines - 1); - p_line[0] = savestr(buf); - if (out_of_mem) { - p_end = -1; - return FALSE; - } - p_char[0] = '*'; - for (i=1; i<=p_ptrn_lines; i++) { - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) - fatal2("unexpected end of file in patch at line %ld\n", - p_input_line); - if (*buf != '<') - fatal2("< expected at line %ld of patch\n", p_input_line); - p_line[i] = savestr(buf+2); - if (out_of_mem) { - p_end = i-1; - return FALSE; - } - p_len[i] = strlen(p_line[i]); - p_char[i] = '-'; - } - if (hunk_type == 'c') { - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) - fatal2("unexpected end of file in patch at line %ld\n", - p_input_line); - if (*buf != '-') - fatal2("--- expected at line %ld of patch\n", p_input_line); - } - Sprintf(buf, "--- %ld,%ld\n", min, max); - p_line[i] = savestr(buf); - if (out_of_mem) { - p_end = i-1; - return FALSE; - } - p_char[i] = '='; - for (i++; i<=p_end; i++) { - ret = pgets(buf, sizeof buf, pfp); - p_input_line++; - if (ret == Nullch) - fatal2("unexpected end of file in patch at line %ld\n", - p_input_line); - if (*buf != '>') - fatal2("> expected at line %ld of patch\n", p_input_line); - p_line[i] = savestr(buf+2); - if (out_of_mem) { - p_end = i-1; - return FALSE; - } - p_len[i] = strlen(p_line[i]); - p_char[i] = '+'; - } - } - if (reverse) /* backwards patch? */ - if (!pch_swap()) - say1("Not enough memory to swap next hunk!\n"); -#ifdef DEBUGGING - if (debug & 2) { - int i; - char special; - - for (i=0; i <= p_end; i++) { - if (i == p_ptrn_lines) - special = '^'; - else - special = ' '; - fprintf(stderr, "%3d %c %c %s", i, p_char[i], special, p_line[i]); - Fflush(stderr); - } - } -#endif - if (p_end+1 < hunkmax) /* paranoia reigns supreme... */ - p_char[p_end+1] = '^'; /* add a stopper for apply_hunk */ - return TRUE; -} - -/* Input a line from the patch file, worrying about indentation. */ - -char * -pgets(bf,sz,fp) -char *bf; -int sz; -FILE *fp; -{ - char *ret = fgets(bf, sz, fp); - Reg1 char *s; - Reg2 int indent = 0; - - if (p_indent && ret != Nullch) { - for (s=buf; - indent < p_indent && (*s == ' ' || *s == '\t' || *s == 'X'); s++) { - if (*s == '\t') - indent += 8 - (indent % 7); - else - indent++; - } - if (buf != s) - Strcpy(buf, s); - } - return ret; -} - -/* Reverse the old and new portions of the current hunk. */ - -bool -pch_swap() -{ - char **tp_line; /* the text of the hunk */ - short *tp_len; /* length of each line */ - char *tp_char; /* +, -, and ! */ - Reg1 LINENUM i; - Reg2 LINENUM n; - bool blankline = FALSE; - Reg3 char *s; - - i = p_first; - p_first = p_newfirst; - p_newfirst = i; - - /* make a scratch copy */ - - tp_line = p_line; - tp_len = p_len; - tp_char = p_char; - p_line = Null(char**); /* force set_hunkmax to allocate again */ - p_len = Null(short*); - p_char = Nullch; - set_hunkmax(); - if (p_line == Null(char**) || p_len == Null(short*) || p_char == Nullch) { -#ifndef lint - if (p_line == Null(char**)) - free((char*)p_line); - p_line = tp_line; - if (p_len == Null(short*)) - free((char*)p_len); - p_len = tp_len; -#endif - if (p_char == Nullch) - free((char*)p_char); - p_char = tp_char; - return FALSE; /* not enough memory to swap hunk! */ - } - - /* now turn the new into the old */ - - i = p_ptrn_lines + 1; - if (tp_char[i] == '\n') { /* account for possible blank line */ - blankline = TRUE; - i++; - } - if (p_efake >= 0) { /* fix non-freeable ptr range */ - if (p_efake <= i) - n = p_end - i + 1; - else - n = -i; - p_efake += n; - p_bfake += n; - } - for (n=0; i <= p_end; i++,n++) { - p_line[n] = tp_line[i]; - p_char[n] = tp_char[i]; - if (p_char[n] == '+') - p_char[n] = '-'; - p_len[n] = tp_len[i]; - } - if (blankline) { - i = p_ptrn_lines + 1; - p_line[n] = tp_line[i]; - p_char[n] = tp_char[i]; - p_len[n] = tp_len[i]; - n++; - } - assert(p_char[0] == '='); - p_char[0] = '*'; - for (s=p_line[0]; *s; s++) - if (*s == '-') - *s = '*'; - - /* now turn the old into the new */ - - assert(tp_char[0] == '*'); - tp_char[0] = '='; - for (s=tp_line[0]; *s; s++) - if (*s == '*') - *s = '-'; - for (i=0; n <= p_end; i++,n++) { - p_line[n] = tp_line[i]; - p_char[n] = tp_char[i]; - if (p_char[n] == '-') - p_char[n] = '+'; - p_len[n] = tp_len[i]; - } - assert(i == p_ptrn_lines + 1); - i = p_ptrn_lines; - p_ptrn_lines = p_repl_lines; - p_repl_lines = i; -#ifndef lint - if (tp_line == Null(char**)) - free((char*)tp_line); - if (tp_len == Null(short*)) - free((char*)tp_len); -#endif - if (tp_char == Nullch) - free((char*)tp_char); - return TRUE; -} - -/* Return the specified line position in the old file of the old context. */ - -LINENUM -pch_first() -{ - return p_first; -} - -/* Return the number of lines of old context. */ - -LINENUM -pch_ptrn_lines() -{ - return p_ptrn_lines; -} - -/* Return the probable line position in the new file of the first line. */ - -LINENUM -pch_newfirst() -{ - return p_newfirst; -} - -/* Return the number of lines in the replacement text including context. */ - -LINENUM -pch_repl_lines() -{ - return p_repl_lines; -} - -/* Return the number of lines in the whole hunk. */ - -LINENUM -pch_end() -{ - return p_end; -} - -/* Return the number of context lines before the first changed line. */ - -LINENUM -pch_context() -{ - return p_context; -} - -/* Return the length of a particular patch line. */ - -short -pch_line_len(line) -LINENUM line; -{ - return p_len[line]; -} - -/* Return the control character (+, -, *, !, etc) for a patch line. */ - -char -pch_char(line) -LINENUM line; -{ - return p_char[line]; -} - -/* Return a pointer to a particular patch line. */ - -char * -pfetch(line) -LINENUM line; -{ - return p_line[line]; -} - -/* Return where in the patch file this hunk began, for error messages. */ - -LINENUM -pch_hunk_beg() -{ - return p_hunk_beg; -} - -/* Apply an ed script by feeding ed itself. */ - -#ifndef WIN32 -void -do_ed_script() -{ - Reg1 char *t; - Reg2 long beginning_of_this_line; - Reg3 bool this_line_is_command = FALSE; - Reg4 FILE *pipefp; - - if (!skip_rest_of_patch) { - Unlink(TMPOUTNAME); - copy_file(filearg[0], TMPOUTNAME); - if (verbose) - Sprintf(buf, "/bin/ed %s", TMPOUTNAME); - else - Sprintf(buf, "/bin/ed - %s", TMPOUTNAME); - pipefp = popen(buf, "w"); - } - for (;;) { - beginning_of_this_line = ftell(pfp); - if (pgets(buf, sizeof buf, pfp) == Nullch) { - next_intuit_at(beginning_of_this_line,p_input_line); - break; - } - p_input_line++; - for (t=buf; isdigit(*t) || *t == ','; t++) ; - this_line_is_command = (isdigit(*buf) && - (*t == 'd' || *t == 'c' || *t == 'a') ); - if (this_line_is_command) { - if (!skip_rest_of_patch) - fputs(buf, pipefp); - if (*t != 'd') { - while (pgets(buf, sizeof buf, pfp) != Nullch) { - p_input_line++; - if (!skip_rest_of_patch) - fputs(buf, pipefp); - if (strEQ(buf, ".\n")) - break; - } - } - } - else { - next_intuit_at(beginning_of_this_line,p_input_line); - break; - } - } - if (skip_rest_of_patch) - return; - fprintf(pipefp, "w\n"); - fprintf(pipefp, "q\n"); - Fflush(pipefp); - Pclose(pipefp); - ignore_signals(); - if (move_file(TMPOUTNAME, outname) < 0) { - toutkeep = TRUE; - chmod(TMPOUTNAME, filemode); - } - else - chmod(outname, filemode); - set_signals(1); -} -#endif diff --git a/xc/util/patch/pch.h b/xc/util/patch/pch.h deleted file mode 100644 index 3873f28a5..000000000 --- a/xc/util/patch/pch.h +++ /dev/null @@ -1,38 +0,0 @@ -/* oldHeader: pch.h,v 2.0.1.1 87/01/30 22:47:16 lwall Exp $ - * $XConsortium: pch.h,v 3.3 94/09/14 21:24:15 gildea Exp $ - * - * Revision 2.0.1.1 87/01/30 22:47:16 lwall - * Added do_ed_script(). - * - * Revision 2.0 86/09/17 15:39:57 lwall - * Baseline for netwide release. - * - */ - -EXT FILE *pfp INIT(Nullfp); /* patch file pointer */ - -void re_patch(); -void open_patch_file(); -void set_hunkmax(); -void grow_hunkmax(); -bool there_is_another_patch(); -int intuit_diff_type(); -void next_intuit_at(); -void skip_to(); -bool another_hunk(); -bool pch_swap(); -char *pfetch(); -short pch_line_len(); -LINENUM pch_first(); -LINENUM pch_ptrn_lines(); -LINENUM pch_newfirst(); -LINENUM pch_repl_lines(); -LINENUM pch_end(); -LINENUM pch_context(); -LINENUM pch_hunk_beg(); -char pch_char(); -char *pfetch(); -char *pgets(); -#ifndef WIN32 -void do_ed_script(); -#endif diff --git a/xc/util/patch/util.c b/xc/util/patch/util.c deleted file mode 100644 index ef70642a9..000000000 --- a/xc/util/patch/util.c +++ /dev/null @@ -1,474 +0,0 @@ -/* $XConsortium: util.c,v 3.3 94/09/14 21:26:09 gildea Exp $ */ - -#define const /*nothing*/ - -#include "EXTERN.h" -#include "common.h" -#include "INTERN.h" -#include "util.h" -#include "backupfile.h" - -void my_exit(); - -static char * -private_strerror (errnum) - int errnum; -{ - extern char *sys_errlist[]; - extern int sys_nerr; - - if (errnum > 0 && errnum <= sys_nerr) - return sys_errlist[errnum]; - return "Unknown system error"; -} -#define strerror private_strerror - -/* Rename a file, copying it if necessary. */ - -int -move_file(from,to) -char *from, *to; -{ - char bakname[512]; - Reg1 char *s; - Reg2 int i; - Reg3 int fromfd; - - /* to stdout? */ - - if (strEQ(to, "-")) { -#ifdef DEBUGGING - if (debug & 4) - say2("Moving %s to stdout.\n", from); -#endif - fromfd = open(from, 0); - if (fromfd < 0) - pfatal2("internal error, can't reopen %s", from); - while ((i=read(fromfd, buf, sizeof buf)) > 0) - if (write(1, buf, i) != 1) - pfatal1("write failed"); - Close(fromfd); - return 0; - } - - if (origprae) { - Strcpy(bakname, origprae); - Strcat(bakname, to); - } else { -#ifndef NODIR - char *backupname = find_backup_file_name(to); - if (backupname == (char *) 0) - fatal1("out of memory\n"); - Strcpy(bakname, backupname); - free(backupname); -#else /* NODIR */ - Strcpy(bakname, to); - Strcat(bakname, simple_backup_suffix); -#endif /* NODIR */ - } - - if (stat(to, &filestat) == 0) { /* output file exists */ - dev_t to_device = filestat.st_dev; - ino_t to_inode = filestat.st_ino; - char *simplename = bakname; - - for (s=bakname; *s; s++) { - if (*s == '/') - simplename = s+1; - } - /* Find a backup name that is not the same file. - Change the first lowercase char into uppercase; - if that isn't sufficient, chop off the first char and try again. */ - while (stat(bakname, &filestat) == 0 && - to_device == filestat.st_dev && to_inode == filestat.st_ino) { - /* Skip initial non-lowercase chars. */ - for (s=simplename; *s && !islower(*s); s++) ; - if (*s) - *s = toupper(*s); - else - Strcpy(simplename, simplename+1); - } - while (unlink(bakname) >= 0) ; /* while() is for benefit of Eunice */ -#ifdef DEBUGGING - if (debug & 4) - say3("Moving %s to %s.\n", to, bakname); -#endif -#ifndef WIN32 - if (link(to, bakname) < 0) { - /* Maybe `to' is a symlink into a different file system. - Copying replaces the symlink with a file; using rename - would be better. */ - Reg4 int tofd; - Reg5 int bakfd; - - bakfd = creat(bakname, 0666); - if (bakfd < 0) { - say4("Can't backup %s, output is in %s: %s\n", to, from, - strerror(errno)); - return -1; - } - tofd = open(to, 0); - if (tofd < 0) - pfatal2("internal error, can't open %s", to); - while ((i=read(tofd, buf, sizeof buf)) > 0) - if (write(bakfd, buf, i) != i) - pfatal1("write failed"); - Close(tofd); - Close(bakfd); - } -#endif - while (unlink(to) >= 0) ; - } -#ifdef DEBUGGING - if (debug & 4) - say3("Moving %s to %s.\n", from, to); -#endif -#ifndef WIN32 - if (link(from, to) < 0) { /* different file system? */ - Reg4 int tofd; - - tofd = creat(to, 0666); - if (tofd < 0) { - say4("Can't create %s, output is in %s: %s\n", - to, from, strerror(errno)); - return -1; - } - fromfd = open(from, 0); - if (fromfd < 0) - pfatal2("internal error, can't reopen %s", from); - while ((i=read(fromfd, buf, sizeof buf)) > 0) - if (write(tofd, buf, i) != i) - pfatal1("write failed"); - Close(fromfd); - Close(tofd); - } - Unlink(from); -#else - rename (from, to); -#endif - return 0; -} - -/* Copy a file. */ - -void -copy_file(from,to) -char *from, *to; -{ - Reg3 int tofd; - Reg2 int fromfd; - Reg1 int i; - - tofd = creat(to, 0666); - if (tofd < 0) - pfatal2("can't create %s", to); - fromfd = open(from, 0); - if (fromfd < 0) - pfatal2("internal error, can't reopen %s", from); - while ((i=read(fromfd, buf, sizeof buf)) > 0) - if (write(tofd, buf, i) != i) - pfatal2("write to %s failed", to); - Close(fromfd); - Close(tofd); -} - -/* Allocate a unique area for a string. */ - -char * -savestr(s) -Reg1 char *s; -{ - Reg3 char *rv; - Reg2 char *t; - - if (!s) - s = "Oops"; - t = s; - while (*t++); - rv = malloc((MEM) (t - s)); - if (rv == Nullch) { - if (using_plan_a) - out_of_mem = TRUE; - else - fatal1("out of memory\n"); - } - else { - t = rv; - while (*t++ = *s++); - } - return rv; -} - -#if defined(lint) && defined(CANVARARG) - -/*VARARGS ARGSUSED*/ -say(pat) char *pat; { ; } -/*VARARGS ARGSUSED*/ -fatal(pat) char *pat; { ; } -/*VARARGS ARGSUSED*/ -pfatal(pat) char *pat; { ; } -/*VARARGS ARGSUSED*/ -ask(pat) char *pat; { ; } - -#else - -/* Vanilla terminal output (buffered). */ - -void -say(pat,arg1,arg2,arg3) -char *pat; -long arg1,arg2,arg3; -{ - fprintf(stderr, pat, arg1, arg2, arg3); - Fflush(stderr); -} - -/* Terminal output, pun intended. */ - -void /* very void */ -fatal(pat,arg1,arg2,arg3) -char *pat; -long arg1,arg2,arg3; -{ - fprintf(stderr, "patch: **** "); - fprintf(stderr, pat, arg1, arg2, arg3); - my_exit(1); -} - -/* Say something from patch, something from the system, then silence . . . */ - -void /* very void */ -pfatal(pat,arg1,arg2,arg3) -char *pat; -long arg1,arg2,arg3; -{ - int errnum = errno; - - fprintf(stderr, "patch: **** "); - fprintf(stderr, pat, arg1, arg2, arg3); - fprintf(stderr, ": %s\n", strerror(errnum)); - my_exit(1); -} - -/* Get a response from the user, somehow or other. */ - -void -ask(pat,arg1,arg2,arg3) -char *pat; -long arg1,arg2,arg3; -{ -#ifndef WIN32 - int ttyfd; - int r; - bool tty2 = isatty(2); - - Sprintf(buf, pat, arg1, arg2, arg3); - Fflush(stderr); - write(2, buf, strlen(buf)); - if (tty2) { /* might be redirected to a file */ - r = read(2, buf, sizeof buf); - } - else if (isatty(1)) { /* this may be new file output */ - Fflush(stdout); - write(1, buf, strlen(buf)); - r = read(1, buf, sizeof buf); - } - else if ((ttyfd = open("/dev/tty", 2)) >= 0 && isatty(ttyfd)) { - /* might be deleted or unwriteable */ - write(ttyfd, buf, strlen(buf)); - r = read(ttyfd, buf, sizeof buf); - Close(ttyfd); - } - else if (isatty(0)) { /* this is probably patch input */ - Fflush(stdin); - write(0, buf, strlen(buf)); - r = read(0, buf, sizeof buf); - } - else { /* no terminal at all--default it */ - buf[0] = '\n'; - r = 1; - } - if (r <= 0) - buf[0] = 0; - else - buf[r] = '\0'; - if (!tty2) - say1(buf); -#else - buf[0] = '\n'; buf[1] = '\0'; -#endif -} -#endif /* lint */ - -/* How to handle certain events when not in a critical region. */ - -void -set_signals(reset) -int reset; -{ -#ifndef lint -#ifdef VOIDSIG - static void (*hupval)(),(*intval)(); -#else - static int (*hupval)(),(*intval)(); -#endif - - if (!reset) { -#ifndef WIN32 - hupval = signal(SIGHUP, SIG_IGN); - if (hupval != SIG_IGN) -#ifdef VOIDSIG - hupval = my_exit; -#else - hupval = (int(*)())my_exit; -#endif -#endif - intval = signal(SIGINT, SIG_IGN); - if (intval != SIG_IGN) -#ifdef VOIDSIG - intval = my_exit; -#else - intval = (int(*)())my_exit; -#endif - } -#ifndef WIN32 - Signal(SIGHUP, hupval); -#endif - Signal(SIGINT, intval); -#endif -} - -/* How to handle certain events when in a critical region. */ - -void -ignore_signals() -{ -#ifndef lint -#ifndef WIN32 - Signal(SIGHUP, SIG_IGN); -#endif - Signal(SIGINT, SIG_IGN); -#endif -} - -/* Make sure we'll have the directories to create a file. - If `striplast' is TRUE, ignore the last element of `filename'. */ - -void -makedirs(filename,striplast) -Reg1 char *filename; -bool striplast; -{ - char tmpbuf[256]; - Reg2 char *s = tmpbuf; - char *dirv[20]; /* Point to the NULs between elements. */ - Reg3 int i; - Reg4 int dirvp = 0; /* Number of finished entries in dirv. */ - - /* Copy `filename' into `tmpbuf' with a NUL instead of a slash - between the directories. */ - while (*filename) { - if (*filename == '/') { - filename++; - dirv[dirvp++] = s; - *s++ = '\0'; - } - else { - *s++ = *filename++; - } - } - *s = '\0'; - dirv[dirvp] = s; - if (striplast) - dirvp--; - if (dirvp < 0) - return; - - strcpy(buf, "mkdir"); - s = buf; - for (i=0; i<=dirvp; i++) { - struct stat sbuf; - - if (stat(tmpbuf, &sbuf) && errno == ENOENT) { - while (*s) s++; - *s++ = ' '; - strcpy(s, tmpbuf); - } -#ifndef WIN32 - *dirv[i] = '/'; -#else - *dirv[i] = '\\'; -#endif - } - if (s != buf) - system(buf); -} - -/* Make filenames more reasonable. */ - -char * -fetchname(at,strip_leading,assume_exists) -char *at; -int strip_leading; -int assume_exists; -{ - char *fullname; - char *name; - Reg1 char *t; - char tmpbuf[200]; - int sleading = strip_leading; - - if (!at) - return Nullch; - while (isspace(*at)) - at++; -#ifdef DEBUGGING - if (debug & 128) - say4("fetchname %s %d %d\n",at,strip_leading,assume_exists); -#endif - if (strnEQ(at, "/dev/null", 9)) /* so files can be created by diffing */ - return Nullch; /* against /dev/null. */ - name = fullname = t = savestr(at); - - /* Strip off up to `sleading' leading slashes and null terminate. */ - for (; *t && !isspace(*t); t++) - if (*t == '/') - if (--sleading >= 0) - name = t+1; - *t = '\0'; - - /* If no -p option was given (957 is the default value!), - we were given a relative pathname, - and the leading directories that we just stripped off all exist, - put them back on. */ - if (strip_leading == 957 && name != fullname && *fullname != '/') { - name[-1] = '\0'; - if (stat(fullname, &filestat) == 0 && S_ISDIR (filestat.st_mode)) { - name[-1] = '/'; - name=fullname; - } - } - - name = savestr(name); - free(fullname); - - if (stat(name, &filestat) && !assume_exists) { - char *filebase = basename(name); - int pathlen = filebase - name; - - /* Put any leading path into `tmpbuf'. */ - strncpy(tmpbuf, name, pathlen); - -#define try(f, a1, a2) (Sprintf(tmpbuf + pathlen, f, a1, a2), stat(tmpbuf, &filestat) == 0) - if ( try("RCS/%s%s", filebase, RCSSUFFIX) - || try("RCS/%s" , filebase, 0) - || try( "%s%s", filebase, RCSSUFFIX) - || try("SCCS/%s%s", SCCSPREFIX, filebase) - || try( "%s%s", SCCSPREFIX, filebase)) - return name; - free(name); - name = Nullch; - } - - return name; -} diff --git a/xc/util/patch/util.h b/xc/util/patch/util.h deleted file mode 100644 index ad385c30c..000000000 --- a/xc/util/patch/util.h +++ /dev/null @@ -1,88 +0,0 @@ -/* oldHeader: util.h,v 2.0 86/09/17 15:40:06 lwall Exp $ - * $XConsortium: util.h,v 2.1 94/09/09 20:04:28 gildea Exp $ - * - * Revision 2.0 86/09/17 15:40:06 lwall - * Baseline for netwide release. - * - */ - -/* and for those machine that can't handle a variable argument list */ - -#ifdef CANVARARG - -#define say1 say -#define say2 say -#define say3 say -#define say4 say -#define ask1 ask -#define ask2 ask -#define ask3 ask -#define ask4 ask -#define fatal1 fatal -#define fatal2 fatal -#define fatal3 fatal -#define fatal4 fatal -#define pfatal1 pfatal -#define pfatal2 pfatal -#define pfatal3 pfatal -#define pfatal4 pfatal - -#else /* hope they allow multi-line macro actual arguments */ - -#ifdef lint - -#define say1(a) say(a, 0, 0, 0) -#define say2(a,b) say(a, (b)==(b), 0, 0) -#define say3(a,b,c) say(a, (b)==(b), (c)==(c), 0) -#define say4(a,b,c,d) say(a, (b)==(b), (c)==(c), (d)==(d)) -#define ask1(a) ask(a, 0, 0, 0) -#define ask2(a,b) ask(a, (b)==(b), 0, 0) -#define ask3(a,b,c) ask(a, (b)==(b), (c)==(c), 0) -#define ask4(a,b,c,d) ask(a, (b)==(b), (c)==(c), (d)==(d)) -#define fatal1(a) fatal(a, 0, 0, 0) -#define fatal2(a,b) fatal(a, (b)==(b), 0, 0) -#define fatal3(a,b,c) fatal(a, (b)==(b), (c)==(c), 0) -#define fatal4(a,b,c,d) fatal(a, (b)==(b), (c)==(c), (d)==(d)) -#define pfatal1(a) pfatal(a, 0, 0, 0) -#define pfatal2(a,b) pfatal(a, (b)==(b), 0, 0) -#define pfatal3(a,b,c) pfatal(a, (b)==(b), (c)==(c), 0) -#define pfatal4(a,b,c,d) pfatal(a, (b)==(b), (c)==(c), (d)==(d)) - -#else /* lint */ - /* if this doesn't work, try defining CANVARARG above */ -#define say1(a) say(a, Nullch, Nullch, Nullch) -#define say2(a,b) say(a, b, Nullch, Nullch) -#define say3(a,b,c) say(a, b, c, Nullch) -#define say4 say -#define ask1(a) ask(a, Nullch, Nullch, Nullch) -#define ask2(a,b) ask(a, b, Nullch, Nullch) -#define ask3(a,b,c) ask(a, b, c, Nullch) -#define ask4 ask -#define fatal1(a) fatal(a, Nullch, Nullch, Nullch) -#define fatal2(a,b) fatal(a, b, Nullch, Nullch) -#define fatal3(a,b,c) fatal(a, b, c, Nullch) -#define fatal4 fatal -#define pfatal1(a) pfatal(a, Nullch, Nullch, Nullch) -#define pfatal2(a,b) pfatal(a, b, Nullch, Nullch) -#define pfatal3(a,b,c) pfatal(a, b, c, Nullch) -#define pfatal4 pfatal - -#endif /* lint */ - -/* if neither of the above work, join all multi-line macro calls. */ -#endif - -EXT char serrbuf[BUFSIZ]; /* buffer for stderr */ - -char *fetchname(); -int move_file(); -void copy_file(); -void say(); -void fatal(); -void pfatal(); -void ask(); -char *savestr(); -void set_signals(); -void ignore_signals(); -void makedirs(); -char *basename(); diff --git a/xc/util/patch/version.c b/xc/util/patch/version.c deleted file mode 100644 index 86e86842a..000000000 --- a/xc/util/patch/version.c +++ /dev/null @@ -1,25 +0,0 @@ -/* oldHeader: version.c,v 2.0 86/09/17 15:40:11 lwall Exp $ - * $XConsortium: version.c,v 2.1 94/09/09 20:04:28 gildea Exp $ - * - * Revision 2.0 86/09/17 15:40:11 lwall - * Baseline for netwide release. - * - */ - -#include "EXTERN.h" -#include "common.h" -#include "util.h" -#include "INTERN.h" -#include "patchlevel.h" -#include "version.h" - -void my_exit(); - -/* Print out the version number and die. */ - -void -version() -{ - fprintf(stderr, "Patch version 2.0, patch level %s\n", PATCHLEVEL); - my_exit(0); -} diff --git a/xc/util/patch/version.h b/xc/util/patch/version.h deleted file mode 100644 index bc249e0f8..000000000 --- a/xc/util/patch/version.h +++ /dev/null @@ -1,9 +0,0 @@ -/* oldHeader: version.h,v 2.0 86/09/17 15:40:14 lwall Exp $ - * $XConsortium: version.h,v 2.1 94/09/09 20:04:28 gildea Exp $ - * - * Revision 2.0 86/09/17 15:40:14 lwall - * Baseline for netwide release. - * - */ - -void version(); diff --git a/xc/util/patch/winnt.h b/xc/util/patch/winnt.h deleted file mode 100644 index 3f45159f0..000000000 --- a/xc/util/patch/winnt.h +++ /dev/null @@ -1,25 +0,0 @@ - -/* $XConsortium: winnt.h,v 1.1 94/09/09 20:27:49 kaleb Exp $ */ - - -#define stat _stat -#define dev_t _dev_t -#define ino_t _ino_t -#define chdir _chdir -#define chmod(p1,p2) _chmod(p1,_S_IWRITE) -#define open _open -#define close _close -#define creat(p1,p2) _creat(p1,_S_IWRITE) -#define fileno _fileno -#define fstat _fstat -#define isatty _isatty -#define lseek _lseek -#define mktemp _mktemp -#define pclose _pclose -#define popen _popen -#define read _read -#define write _write -#define unlink _unlink -#define sys_errlist _sys_errlist -#define sys_nerr (*_sys_nerr_dll) - |